- BaseService
- DataService
- FakeModel
- FakeModelService
- FetchRecordEpic
- Mapper
- MemoryAdapter
- MemorySerializer
- MockAdapter
- MockMapper
- MockSerializer
- Model
- QueryBuilder
- QueryManager
- RestAdapter
- RestSerializer
- IAction
- IActionCreators
- IActionTypes
- IAdapter
- IAdapterFactory
- IAttrs
- IConfiguration
- IContext
- IDataServiceState
- IDecorator
- IEpic
- IFakeModel
- IFakeModelData
- IFieldOptions
- IFieldRelationship
- IFieldType
- IFieldTypes
- IForceReload
- IIsEnumOptions
- IMapper
- IMapperFactory
- IModel
- IModelAPIData
- IModelData
- IModelDataCreatorMap
- IModelFactory
- IModelId
- IModelMeta
- IModelsMap
- IModuleMap
- IPostActionHandlers
- IPushAll
- IQueryBuilder
- IQueryCache
- IQueryManager
- IQueryManagerMeta
- IQueryParams
- IQueryResponse
- IRawQueryResponse
- IRelationship
- IRelationshipOptions
- IRestAdapterOptions
- ISelectors
- ISerializer
- ISerializerFactory
- IService
- IServiceFactory
- IServiceMap
- ISetField
- ISetMetaField
- ISort
- IValidate
- IValidator
- IValidatorMap
- FetchAllAction
- FetchItemAction
- FilterValue
- IActionCreator
- IActionEpic
- IConfigureStore
- IDataServiceStateRecord
- IModelKeys
- IObservableAction
- IQueryCacheRecord
- IReducer
- IReducers
- Omit
- SortDirection
- DEFAULT_COALESCE_BUFFER_TIME
- DataServiceStateRecord
- QueryCacheRecord
- _FakeXHR
- _FakedXHRHistory
- _modelDataCreatorMap
- configuration
- initializationComplete
- initialize
- initializeValidateJS
- mapValuesWithKeys
- mapWithKeys
- serviceMap
- addPenultimateFieldToPath
- attr
- belongsTo
- configure
- configureStore
- createEnumField
- createMockFakeModel
- createMockFakeModelArray
- createMockFakeModelData
- createMockFakeModels
- createMockQueryResponse
- createMockServiceState
- createRecordEpic
- fetchAllReducer
- field
- flattenObjectKeys
- getConfiguration
- getDataService
- getDateTimeFormat
- getEpics
- getFakeXHR
- getFakedXHRHistory
- getFieldTypeForRelationship
- getModelDataCreatorMap
- getNestedFieldName
- getReducers
- getRelatedFieldNameForRelationship
- getService
- hasMany
- initializeDateTimeValidator
- initializeMockDataCreators
- initializePhoneNumberValidator
- initializeServices
- initializeTestServices
- isApplicationInitialized
- isEnum
- loggerMiddleware
- makeInitialize
- makeInitializeValidateJS
- pushAllReducer
- pushRecordReducer
- registerService
- relationship
- required
- resetInitializationStatus
- seedService
- seedServiceList
- seedServices
- setFieldReducer
- setMetaFieldReducer
- setQueryResponseReducer
- setRelationshipReducer
- setTimeoutPromise
- shouldFetchAll
- shouldFetchItem
- stubXHR
- unloadAllReducer
- unloadRecordReducer
- validation
- ArrayField
- BelongsToField
- BooleanField
- DateField
- DateTimeField
- EmailField
- FileField
- HasManyField
- NumberField
- ObjectField
- PhoneNumberField
- StringField
- TimeField
- URLField
- defaultConfiguration
- fakeModelModule
Ƭ FetchAllAction: IAction<IQueryBuilder, IPostActionHandlers & IForceReload>
Defined in Services/DataService/ShouldFetchAll.ts:7
Ƭ FetchItemAction: IAction<object
, IForceReload>
Defined in Services/DataService/ShouldFetchItem.ts:5
Ƭ FilterValue: * string
| number
| boolean
*
Defined in Query/QueryBuilder.ts:13
Ƭ IActionCreator: function
Defined in Services/IService.ts:14
▸(payload?: T
, meta?: M
): IAction<T
, M
>
Parameters:
Name | Type |
---|---|
Optional payload |
T |
Optional meta |
M |
Returns: IAction<T
, M
>
Ƭ IActionEpic: Epic
<IObservableAction<T
, M
>, any
, any
>
Defined in Services/IService.ts:24
Ƭ IConfigureStore: function
Defined in Store/ConfigureStore.ts:10
▸(reducers: IReducers<any
>, epics: IActionEpic[]): Store
<any
>
Parameters:
Name | Type |
---|---|
reducers | IReducers<any > |
epics | IActionEpic[] |
Returns: Store
<any
>
Ƭ IDataServiceStateRecord: * Record
<IDataServiceState<T
>> & Readonly
<IDataServiceState<T
>>
*
Defined in Services/DataService/DataServiceStateRecord.ts:7
Ƭ IModelKeys: * object
| null
*
Defined in Model/IModel.ts:8
Ƭ IObservableAction: * ActionsObservable
<IAction<T
, M
>> & IAction<T
, M
>
*
Defined in Services/IService.ts:23
Ƭ IQueryCacheRecord: * Record
<IQueryCache> & Readonly
<IQueryCache>
*
Defined in Query/QueryCacheRecord.ts:4
Ƭ IReducer: function
Defined in Services/IService.ts:20
▸(state: S
, action: IAction): S
Parameters:
Name | Type |
---|---|
state | S |
action | IAction |
Returns: S
Ƭ IReducers: * object
| __type
*
Defined in Services/IService.ts:21
Ƭ Omit: Omit<T, K>
Defined in Omit.ts:8
Creates a type whose signature contains the given interface T
, minus the keys named in K
.
For example: Omit<IStudentData, "name" | "age">
will return a type with the given interface but without "name" or "age".
"Borrowed" from Material UI.
Ƭ SortDirection: * "asc" | "desc" *
Defined in Query/QueryBuilder.ts:6
● DEFAULT_COALESCE_BUFFER_TIME: 50
= 50
Defined in Configure.ts:29
● DataServiceStateRecord: Factory
<IDataServiceState<any
>> = Record<IDataServiceState>({
items: Map<string, IModel>(),
requestCache: Map<string, IQueryCacheRecord>(),
})
Defined in Services/DataService/DataServiceStateRecord.ts:10
The state used for a DataService implementation
● QueryCacheRecord: Factory
<IQueryCache> = Record({
query: undefined,
response: undefined,
isLoading: false,
errors: undefined,
})
Defined in Query/QueryCacheRecord.ts:9
Creates an ImmutableJS Record of IQueryCache
● _FakeXHR: any
Defined in TestUtils/StubXhr.ts:4
● _FakedXHRHistory: any
[] = []
Defined in TestUtils/StubXhr.ts:3
● _modelDataCreatorMap: IModelDataCreatorMap
Defined in TestUtils/Mock/MockDataCreators.ts:8
● configuration: IConfiguration = {} as IConfiguration
Defined in Configure.ts:40
● initializationComplete: boolean
= false
Defined in Initialize.ts:4
● initialize: (Anonymous function)
= makeInitialize(Initializers)
Defined in Initialize.ts:37
Initializers are fired once when the app boots up, providing a useful hook for initializing the application. For instance, if a third-party dependency needs some initial setup, create an initializer in the Initializers directory.
Every function exported from the Initializers directory whose name starts with "initialize" will be executed.
● initializeValidateJS: (Anonymous function)
= makeInitializeValidateJS(validateJS, Validators)
Defined in Initializers/InitializeValidateJS.ts:27
Validation initializers are pulled out of the Validation directory and executed using a standard naming convention such that they are executed if their name starts with "initialize". They are passed an instance of validate.js
● mapValuesWithKeys: any
= convert("mapValues", mapValues, {
cap: false,
})
Defined in Utils/Lodash.ts:11
By default, lodash/fp/mapValues does not return the key to the iterator. This example was lifted from their docs to make it work as expected. type: {any}
see: https://github.com/lodash/lodash/wiki/FP-Guide
● mapWithKeys: any
= convert("map", map, {
cap: false,
})
Defined in Utils/Lodash.ts:22
By default, lodash/fp/map does not return the key to the iterator. This example was lifted from their docs to make it work as expected. type: {any}
see: https://github.com/lodash/lodash/wiki/FP-Guide
● serviceMap: IServiceMap
Defined in Services/ServiceProvider.ts:21
▸ addPenultimateFieldToPath(path: string
, field: any
): string
[]
Defined in Utils/String.ts:24
Given a path string in dot notation compatible with lodash's get
and set
functions, will return the path as an array of strings with the given field as the second to last item.
Parameters:
Name | Type | Description |
---|---|---|
path | string |
- |
field | any |
- |
Returns: string
[]
▸ attr(fieldType: IFieldType, options?: IFieldOptions): IDecorator<IAttrs>
Defined in Model/Decorators/Attr.ts:24
A decorator which maps a property's getter and setter to getField
and setField
methods implemented on the target class.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
fieldType | IFieldType | - | - |
Default value options |
IFieldOptions | {} | - |
Returns: IDecorator<IAttrs>
▸ belongsTo(options?: IRelationshipOptions): IDecorator<IRelationship>
Defined in Model/Decorators/BelongsTo.ts:14
A decorator which creates a "BelongsTo" relationship, for establishing a one-to-many or one-to-one relationship to the related service, such that this service has one of the related service. The relatedFieldName
is the FK field on this model, for identifying the ID of the related model.
If no serviceName
is provided, the property being decorated will be used. If no relatedFieldName
is provided, the serviceName
will be used with the suffix "Id". eg: "organizationId"
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
Default value options |
IRelationshipOptions | {} | - |
Returns: IDecorator<IRelationship>
▸ configure(config: IConfiguration, configureStore?: IConfigureStore): Store
<any
>
Defined in Configure.ts:46
Parameters:
Name | Type | Default value |
---|---|---|
config | IConfiguration | - |
Default value configureStore |
IConfigureStore | defaultConfigureStore |
Returns: Store
<any
>
▸ configureStore(reducers: IReducers<any
>, epics: IActionEpic[]): Store
<Object
, AnyAction
> & object
Defined in Store/ConfigureStore.ts:12
Parameters:
Name | Type |
---|---|
reducers | IReducers<any > |
epics | IActionEpic[] |
Returns: Store
<Object
, AnyAction
> & object
▸ createEnumField(fieldEnum: any
): IFieldType<any
> & object
Defined in Model/FieldType/EnumField.ts:4
Parameters:
Name | Type |
---|---|
fieldEnum | any |
Returns: IFieldType<any
> & object
▸ createMockFakeModel(overrideValues?: Partial
<IFakeModelData>): FakeModel
Defined in Model/Model.mock.ts:44
Parameters:
Name | Type |
---|---|
Optional overrideValues |
Partial <IFakeModelData> |
Returns: FakeModel
▸ createMockFakeModelArray(numItems?: number
): IFakeModelData[]
Defined in Model/Model.mock.ts:59
Generates an array of items using fake data
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
Default value numItems |
number |
10 | - |
Returns: IFakeModelData[]
▸ createMockFakeModelData(id?: string
): IFakeModelData
Defined in Model/Model.mock.ts:35
Generates a single item using fake data
Parameters:
Name | Type | Description |
---|---|---|
Optional id |
string |
- |
Returns: IFakeModelData
▸ createMockFakeModels(numItems?: number
): FakeModel[]
Defined in Model/Model.mock.ts:69
Parameters:
Name | Type | Default value |
---|---|---|
Default value numItems |
number |
10 |
Returns: FakeModel[]
▸ createMockQueryResponse(overrideValues?: Partial
<IQueryResponse>): IQueryResponse
Defined in Query/IQueryCache.mock.ts:6
Creates a mock IQueryResponse object
Parameters:
Name | Type |
---|---|
Optional overrideValues |
Partial <IQueryResponse> |
Returns: IQueryResponse
▸ createMockServiceState<T
>(service: IService<T
>, actions?: IAction[]): object
Defined in TestUtils/Mock/CreateMockServiceState.ts:12
Creates a mock state object for the given service to plug it into a mock Redux store see: redux-test-utils/createMockStore
Type parameters:
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
service | IService<T > |
- | - |
Default value actions |
IAction[] | [] | - |
Returns: object
any
▸ createRecordEpic(__namedParameters: object
): any
Defined in Services/DataService/Epics/CreateRecordEpic.ts:18
Parameters:
__namedParameters: object
Name | Type |
---|---|
actions | IActionCreators |
adapter | IAdapter<any > |
mapper | IMapper<any , any > |
name | string |
serializer | ISerializer<any , any > |
types | IActionTypes |
Returns: any
▸ fetchAllReducer<T
>(state: IDataServiceStateRecord<T
>, action: FetchAllAction): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/FetchAllReducer.ts:10
Sets isLoading = true on the cached request associated to the given IQueryBuilder in the action's payload if it appears we will perform the request.
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | FetchAllAction |
Returns: Record
<IDataServiceState<T
>> & object
▸ field(fieldType: IFieldType, options?: * IFieldOptions & any
*): IDecorator<IFieldTypes>
Defined in Model/Decorators/Field.ts:30
A decorator which marks the FieldType for the property and sets up default validation rules.
Note: Chances are you should use the @attr
, @belongsTo
or @hasMany
decorators instead, each of which wrap this decorator.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
fieldType | IFieldType | - | - |
Default value options |
IFieldOptions & any |
{} | - |
Returns: IDecorator<IFieldTypes>
▸ flattenObjectKeys(obj: any
): any
Defined in Utils/Lodash.ts:39
Flattens the keys of an object's immediate children onto a copy of the parent object.
For example:
Given input: { a: { b: 123, c: 456 }, name: "Jessica" }
, This will output: { "a.b": 123, "a.c": 456, name: "Jessica" }
.
Note that this function will intentionally go only one level deep.
Parameters:
Name | Type | Description |
---|---|---|
obj | any |
- |
Returns: any
▸ getConfiguration(): IConfiguration
Defined in Configure.ts:42
Returns: IConfiguration
▸ getDataService<T
>(name: string
): DataService<T
>
Defined in Services/ServiceProvider.ts:44
Get the requested DataService using getService.
Type parameters:
T : IModelData
Parameters:
Name | Type | Description |
---|---|---|
name | string |
- |
Returns: DataService<T
>
▸ getDateTimeFormat(options: any
): any
Defined in Validators/DateTime.ts:3
Parameters:
Name | Type |
---|---|
options | any |
Returns: any
▸ getEpics(): IActionEpic[]
Defined in Services/ServiceProvider.ts:110
Creates the root epic which will be added to the redux-observable epic middleware
Note: This method is called on startup. You should not need to call it directly except for testing purposes.
Returns: IActionEpic[]
▸ getFakeXHR(): any
Defined in TestUtils/StubXhr.ts:15
Returns: any
▸ getFakedXHRHistory(): any
[]
Defined in TestUtils/StubXhr.ts:19
Returns: any
[]
▸ getFieldTypeForRelationship(relationshipType: RelationshipType): IFieldType<any
>
Defined in Model/Decorators/Relationship.ts:60
Get the corresponding FieldType object for the given RelationshipType.
Parameters:
Name | Type | Description |
---|---|---|
relationshipType | RelationshipType | - |
Returns: IFieldType<any
>
▸ getModelDataCreatorMap(): IModelDataCreatorMap
Defined in TestUtils/Mock/MockDataCreators.ts:22
Returns: IModelDataCreatorMap
▸ getNestedFieldName(path: any
): any
Defined in Utils/String.ts:11
Given a path string in dot notation compatible with lodash's get
and set
functions, this will return the nested value.
For example, given path "a.b.c", this will return "c".
Parameters:
Name | Type | Description |
---|---|---|
path | any |
- |
Returns: any
▸ getReducers(): IReducers<any
>
Defined in Services/ServiceProvider.ts:101
Creates the root reducer to be added to the Redux store. Note: This method is called on startup. You should not need to call it directly except for testing purposes.
Returns: IReducers<any
>
▸ getRelatedFieldNameForRelationship(relationshipType: RelationshipType, baseName: string
): string
Defined in Model/Decorators/Relationship.ts:81
Determine the property name of the related field depending on the relationship.
BelongsTo will add the suffix "Id" to the given baseName
HasMany will add the suffix "Ids" to the given baseName
Parameters:
Name | Type | Description |
---|---|---|
relationshipType | RelationshipType | - |
baseName | string |
- |
Returns: string
▸ getService<T
>(name: any
): IService<T
>
Defined in Services/ServiceProvider.ts:30
Behaves as a dependency injection service to facilitate injecting service instances based on their name and module. This is useful for testing so services can be replaced with mocks.
Type parameters:
Parameters:
Name | Type | Description |
---|---|---|
name | any |
- |
Returns: IService<T
>
▸ hasMany(options?: IRelationshipOptions): IDecorator<IRelationship>
Defined in Model/Decorators/HasMany.ts:14
A decorator which creates a "HasMany" relationship, for establishing a many-to-one or many-to-many relationship to the related service, such that this service has many of the related service. The relatedFieldName
is the FK field on this model, for identifying the IDs of the related models.
If no serviceName
is provided, the property being decorated will be used. If no relatedFieldName
is provided, the serviceName
will be used with the suffix "Ids". eg: "studentIds"
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
Default value options |
IRelationshipOptions | {} | - |
Returns: IDecorator<IRelationship>
▸ initializeDateTimeValidator(validate: any
): any
Defined in Validators/DateTime.ts:19
Parameters:
Name | Type |
---|---|
validate | any |
Returns: any
▸ initializeMockDataCreators(modules: any
): void
Defined in TestUtils/Mock/MockDataCreators.ts:11
Build a modelDataCreatorMap for later use in the seedService* functions
Parameters:
Name | Type |
---|---|
modules | any |
Returns: void
▸ initializePhoneNumberValidator(validate: any
): (Anonymous function)
Defined in Validators/PhoneNumber.ts:1
Parameters:
Name | Type |
---|---|
validate | any |
Returns: (Anonymous function)
▸ initializeServices(modules: IModuleMap): void
Defined in Services/ServiceProvider.ts:62
Initialize the map of services to enable dependency injection.
We assume each module exports a class which follows the naming convention: "Service" For example: the "country" module should export a CountryService
Note: This is called when the application boots up, pulling in the map from the "fakeModelModule" directory to automagically register all fakeModelModule. Eventually, it would be nice to register services as they are requested and dynamically update the redux store as they are needed. This would be especially ideal for code splitting.
You should not need to call this method directly unless it is needed for testing.
Parameters:
Name | Type | Description |
---|---|---|
modules | IModuleMap |
Returns: void
▸ initializeTestServices(modules?: IModuleMap, configOptions?: Partial
<IConfiguration>): Store
<any
>
Defined in TestUtils/InitializeTestServices.ts:17
Registers the services, short circuits their XHR epics and returns a Redux store. Will use a MemoryAdapter and MemorySerializer by default.
Parameters:
Name | Type | Default value |
---|---|---|
Default value modules |
IModuleMap | {} |
Default value configOptions |
Partial <IConfiguration> |
{} |
Returns: Store
<any
>
▸ isApplicationInitialized(): boolean
Defined in Initialize.ts:11
Determine if the application's initializers have been fired yet.
Returns: boolean
▸ isEnum(fieldEnum: any
, options?: IIsEnumOptions): IDecorator<IFieldTypes>
Defined in Model/Decorators/IsEnum.ts:17
A decorator which maps a property's getter and setter to getField
and setField
methods implemented on the target class.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
fieldEnum | any |
- | - |
Default value options |
IIsEnumOptions | {} | - |
Returns: IDecorator<IFieldTypes>
▸ loggerMiddleware(): (Anonymous function)
Defined in Store/Middleware/Logger.ts:1
Returns: (Anonymous function)
▸ makeInitialize(initializers: any
): (Anonymous function)
Defined in Initialize.ts:20
Parameters:
Name | Type |
---|---|
initializers | any |
Returns: (Anonymous function)
▸ makeInitializeValidateJS(validate: validateJS.ValidateJS
, validators: IValidatorMap): (Anonymous function)
Defined in Initializers/InitializeValidateJS.ts:14
Parameters:
Name | Type |
---|---|
validate | validateJS.ValidateJS |
validators | IValidatorMap |
Returns: (Anonymous function)
▸ pushAllReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<IPushAll<T
>>): IDataServiceStateRecord<T
>
Defined in Services/DataService/Reducers/PushAllReducer.ts:10
Adds/Updates the given array of IModel instances onto the store
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<IPushAll<T >> |
Returns: IDataServiceStateRecord<T
>
▸ pushRecordReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<IModel<T
>>): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/PushRecordReducer.ts:6
Adds/Updates the given IModel instance to the store
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<IModel<T >> |
Returns: Record
<IDataServiceState<T
>> & object
▸ registerService(service: IService<any
>): void
Defined in Services/ServiceProvider.ts:92
Enables service dependency injection by registering services so they can later be retrieved (injected) as needed.
Note: Until we can support dynamically updating the redux store, you should not need to call this method except as a convenience for testing purposes.
Parameters:
Name | Type | Description |
---|---|---|
service | IService<any > |
Returns: void
▸ relationship(relationshipType: RelationshipType, options?: IRelationshipOptions): IDecorator<IRelationship>
Defined in Model/Decorators/Relationship.ts:103
A decorator which establishes that the decorated property is related to the given serviceName through the given relatedFieldName. You probably want to use @belongsTo
or @hasMany
decorators, which wrap this one.
If no serviceName
is provided, the name of the property being decorated will be used. If no relatedFieldName
is provided, the name of the property being decorated will be used with the suffix "Id" or "Ids" depending on the relationship.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
relationshipType | RelationshipType | - | - |
Default value options |
IRelationshipOptions | {} | - |
Returns: IDecorator<IRelationship>
▸ required(message?: string
, allowEmpty?: boolean
): IDecorator<IValidate>
Defined in Model/Decorators/Required.ts:11
Decorator to conveniently set a "required" validation rule.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
Default value message |
string |
"is required" | - |
Default value allowEmpty |
boolean |
false | - |
Returns: IDecorator<IValidate>
▸ resetInitializationStatus(): boolean
Defined in Initialize.ts:18
Reset the application's initialization status.
Returns: boolean
▸ seedService<T
>(serviceName: string
, overrideValues?: Partial
<T
>): IModel<T
>
Defined in TestUtils/Seed/SeedService.ts:11
Adds seed data to the redux store for a single specific service
Type parameters:
T : IModelData
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
serviceName | string |
- | service to seed |
Default value overrideValues |
Partial <T > |
{} | values to override in seed |
Returns: IModel<T
>
▸ seedServiceList<T
>(serviceName: string
, count?: number
, overrideValues?: Partial
<T
>, options?: Partial
< object
& IQueryResponse>): IModel<T
>[]
Defined in TestUtils/Seed/SeedServiceList.ts:20
Adds the given number of seeds to the redux store for a single specified service. If overrideValues
are provided, they will be passed to each item.
The given options
param may be used to set the query params or the shape of the response envelope. If options.queryParams
are not given, the overrideValues
will be used by default.
Type parameters:
T : IModelData
Parameters:
Name | Type | Default value |
---|---|---|
serviceName | string |
- |
Default value count |
number |
5 |
Default value overrideValues |
Partial <T > |
{} |
Default value options |
Partial < object & IQueryResponse> |
{} |
Returns: IModel<T
>[]
▸ seedServices(serviceNames?: string
[]): __type
Defined in TestUtils/Seed/SeedServices.ts:9
Add multiple seeds for each of the initialized services
Parameters:
Name | Type | Description |
---|---|---|
Optional serviceNames |
string [] |
services to seed, defaults to all services initialized in initializeTestServices() |
Returns: __type
▸ setFieldReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<ISetField<T
>>): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/SetFieldReducer.ts:7
Sets the field on the item associated to the given id
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<ISetField<T >> |
Returns: Record
<IDataServiceState<T
>> & object
▸ setMetaFieldReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<ISetMetaField<T
>>): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/SetMetaFieldReducer.ts:13
Sets the given meta field for the IModel instance associated to the given id
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<ISetMetaField<T >> |
Returns: Record
<IDataServiceState<T
>> & object
▸ setQueryResponseReducer(state: IDataServiceStateRecord<any
>, action: IAction<IQueryCache>): Record
<IDataServiceState<any
>> & object
Defined in Services/DataService/Reducers/SetQueryResponseReducer.ts:6
Sets the given IQueryCache
to the requestCache
, using its query.getHashCode()
as a key
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<any > |
action | IAction<IQueryCache> |
Returns: Record
<IDataServiceState<any
>> & object
▸ setRelationshipReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<ISetField<T
>>): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/SetRelationshipReducer.ts:7
Sets the given relationship onto the IModel associated to the given id
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<ISetField<T >> |
Returns: Record
<IDataServiceState<T
>> & object
▸ setTimeoutPromise<T
>(callback: function
, delay?: number
): Promise
<T
>
Defined in Utils/SetTimeoutPromise.ts:8
Calls setTimeout
with the given callback
function for the given delay
in milliseconds and returns a promise.
The promise will resolve with the value returned from the callback if it succeeds; it will reject with an Error if one is thrown.
Type parameters:
Parameters:
Name | Type | Default value |
---|---|---|
callback | function |
- |
Default value delay |
number |
0 |
Returns: Promise
<T
>
▸ shouldFetchAll(state: IDataServiceStateRecord<any
>, action: FetchAllAction): boolean
Defined in Services/DataService/ShouldFetchAll.ts:13
Determines if the given FetchAllAction should fire based on whether or not we already have an existing request cache associated to the action's query params.
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<any > |
action | FetchAllAction |
Returns: boolean
▸ shouldFetchItem(state: IDataServiceStateRecord<any
>, action: FetchItemAction): boolean
Defined in Services/DataService/ShouldFetchItem.ts:11
Determines if the given FetchItemAction should fire based on whether or not we already have the requested item based on its id, or if we should force reload it.
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<any > |
action | FetchItemAction |
Returns: boolean
▸ stubXHR(): void
Defined in TestUtils/StubXhr.ts:7
Stub all XHR requests via Sinon
Returns: void
▸ unloadAllReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<null
>): Record
<IDataServiceState<any
>> & object
Defined in Services/DataService/Reducers/UnloadAllReducer.ts:6
Disconnects all IModel instances from the store and returns a new copy of the store
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<null > |
Returns: Record
<IDataServiceState<any
>> & object
▸ unloadRecordReducer<T
>(state: IDataServiceStateRecord<T
>, action: IAction<IModelId>): Record
<IDataServiceState<T
>> & object
Defined in Services/DataService/Reducers/UnloadRecordReducer.ts:7
Disconnects the IModel associated to the given id and removes it from the store
Type parameters:
T : IModelData
Parameters:
Name | Type |
---|---|
state | IDataServiceStateRecord<T > |
action | IAction<IModelId> |
Returns: Record
<IDataServiceState<T
>> & object
▸ validation(validationRules: any
): IDecorator<IValidate>
Defined in Model/Decorators/Validation.ts:18
A property decorator for specifying validation rules.
We currently use Validate.js, but this should work with any rules-based validation engine.
Parameters:
Name | Type | Description |
---|---|---|
validationRules | any |
- |
Returns: IDecorator<IValidate>
ArrayField: object
Defined in Model/FieldType/ArrayField.ts:4
● defaultValue: undefined
[] = []
Defined in Model/FieldType/ArrayField.ts:7
● serialize: true
= true
Defined in Model/FieldType/ArrayField.ts:5
● type: string
= "array"
Defined in Model/FieldType/ArrayField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/ArrayField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<any
>
Defined in Model/FieldType/ArrayField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<any
>
defaultValidationRules: object
Defined in Model/FieldType/ArrayField.ts:6
● type: string
= "array"
Defined in Model/FieldType/ArrayField.ts:6
BelongsToField: object
Defined in Model/FieldType/BelongsToField.ts:4
● serialize: false
= false
Defined in Model/FieldType/BelongsToField.ts:6
● type: string
= "belongsTo"
Defined in Model/FieldType/BelongsToField.ts:7
BooleanField: object
Defined in Model/FieldType/BooleanField.ts:4
● defaultValue: false
= false
Defined in Model/FieldType/BooleanField.ts:7
● serialize: true
= true
Defined in Model/FieldType/BooleanField.ts:5
● type: string
= "boolean"
Defined in Model/FieldType/BooleanField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/BooleanField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<boolean
>
Defined in Model/FieldType/BooleanField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<boolean
>
defaultValidationRules: object
Defined in Model/FieldType/BooleanField.ts:6
● type: string
= "boolean"
Defined in Model/FieldType/BooleanField.ts:6
DateField: object
Defined in Model/FieldType/DateField.ts:5
● defaultValue: null
= null
Defined in Model/FieldType/DateField.ts:8
● serialize: true
= true
Defined in Model/FieldType/DateField.ts:6
● type: string
= "date"
Defined in Model/FieldType/DateField.ts:19
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/DateField.ts:9
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: * string
| any
*): Promise
<Date
>
Defined in Model/FieldType/DateField.ts:11
Parameters:
Name | Type |
---|---|
value | string | any |
Returns: Promise
<Date
>
▸ transform(date: Date
): Promise
<string
>
Defined in Model/FieldType/DateField.ts:10
Parameters:
Name | Type |
---|---|
date | Date |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/DateField.ts:7
datetime: object
Defined in Model/FieldType/DateField.ts:7
● dateOnly: boolean
= true
Defined in Model/FieldType/DateField.ts:7
DateTimeField: object
Defined in Model/FieldType/DateTimeField.ts:4
● defaultValue: null
= null
Defined in Model/FieldType/DateTimeField.ts:7
● serialize: true
= true
Defined in Model/FieldType/DateTimeField.ts:5
● type: string
= "dateTime"
Defined in Model/FieldType/DateTimeField.ts:18
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/DateTimeField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: * string
| any
*): Promise
<Date
>
Defined in Model/FieldType/DateTimeField.ts:10
Parameters:
Name | Type |
---|---|
value | string | any |
Returns: Promise
<Date
>
▸ transform(date: Date
): Promise
<string
>
Defined in Model/FieldType/DateTimeField.ts:9
Parameters:
Name | Type |
---|---|
date | Date |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/DateTimeField.ts:6
● datetime: boolean
= true
Defined in Model/FieldType/DateTimeField.ts:6
EmailField: object
Defined in Model/FieldType/EmailField.ts:4
● type: string
= "email"
Defined in Model/FieldType/EmailField.ts:7
defaultValidationRules: object
Defined in Model/FieldType/EmailField.ts:6
● email: boolean
= true
Defined in Model/FieldType/EmailField.ts:6
FileField: object
Defined in Model/FieldType/FileField.ts:3
● defaultValidationRules: object
Defined in Model/FieldType/FileField.ts:5
● defaultValue: null
= null
Defined in Model/FieldType/FileField.ts:6
● serialize: true
= true
Defined in Model/FieldType/FileField.ts:4
● type: string
= "file"
Defined in Model/FieldType/FileField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/FileField.ts:7
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): any
Defined in Model/FieldType/FileField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: any
▸ transform(file: File
): Promise
<any
[]>
Defined in Model/FieldType/FileField.ts:10
Parameters:
Name | Type |
---|---|
file | File |
Returns: Promise
<any
[]>
HasManyField: object
Defined in Model/FieldType/HasManyField.ts:4
● serialize: false
= false
Defined in Model/FieldType/HasManyField.ts:6
● type: string
= "hasMany"
Defined in Model/FieldType/HasManyField.ts:7
NumberField: object
Defined in Model/FieldType/NumberField.ts:4
● defaultValue: number
= 0
Defined in Model/FieldType/NumberField.ts:7
● serialize: true
= true
Defined in Model/FieldType/NumberField.ts:5
● type: string
= "number"
Defined in Model/FieldType/NumberField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/NumberField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<number
>
Defined in Model/FieldType/NumberField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<number
>
defaultValidationRules: object
Defined in Model/FieldType/NumberField.ts:6
● numericality: boolean
= true
Defined in Model/FieldType/NumberField.ts:6
ObjectField: object
Defined in Model/FieldType/ObjectField.ts:4
● defaultValue: null
= null
Defined in Model/FieldType/ObjectField.ts:7
● serialize: true
= true
Defined in Model/FieldType/ObjectField.ts:5
● type: string
= "object"
Defined in Model/FieldType/ObjectField.ts:8
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/ObjectField.ts:9
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<any
>
Defined in Model/FieldType/ObjectField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<any
>
defaultValidationRules: object
Defined in Model/FieldType/ObjectField.ts:6
● type: string
= "object"
Defined in Model/FieldType/ObjectField.ts:6
PhoneNumberField: object
Defined in Model/FieldType/PhoneNumberField.ts:4
● defaultValue: string
= ""
Defined in Model/FieldType/PhoneNumberField.ts:7
● serialize: true
= true
Defined in Model/FieldType/PhoneNumberField.ts:5
● type: string
= "phoneNumber"
Defined in Model/FieldType/PhoneNumberField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/PhoneNumberField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<string
>
Defined in Model/FieldType/PhoneNumberField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/PhoneNumberField.ts:6
● phoneNumber: boolean
= true
Defined in Model/FieldType/PhoneNumberField.ts:6
StringField: object
Defined in Model/FieldType/StringField.ts:4
● defaultValue: string
= ""
Defined in Model/FieldType/StringField.ts:7
● serialize: true
= true
Defined in Model/FieldType/StringField.ts:5
● type: string
= "string"
Defined in Model/FieldType/StringField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/StringField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<string
>
Defined in Model/FieldType/StringField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/StringField.ts:6
● type: string
= "string"
Defined in Model/FieldType/StringField.ts:6
TimeField: object
Defined in Model/FieldType/TimeField.ts:5
● defaultValue: null
= null
Defined in Model/FieldType/TimeField.ts:8
● serialize: true
= true
Defined in Model/FieldType/TimeField.ts:6
● type: string
= "time"
Defined in Model/FieldType/TimeField.ts:16
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/TimeField.ts:9
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(serializedDate: string
): Promise
<Date
>
Defined in Model/FieldType/TimeField.ts:11
Parameters:
Name | Type |
---|---|
serializedDate | string |
Returns: Promise
<Date
>
▸ transform(date: Date
): Promise
<string
>
Defined in Model/FieldType/TimeField.ts:10
Parameters:
Name | Type |
---|---|
date | Date |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/TimeField.ts:7
datetime: object
Defined in Model/FieldType/TimeField.ts:7
● message: string
= "must be a valid time"
Defined in Model/FieldType/TimeField.ts:7
● timeOnly: boolean
= true
Defined in Model/FieldType/TimeField.ts:7
URLField: object
Defined in Model/FieldType/URLField.ts:4
● defaultValue: string
= ""
Defined in Model/FieldType/URLField.ts:7
● serialize: true
= true
Defined in Model/FieldType/URLField.ts:5
● type: string
= "URL"
Defined in Model/FieldType/URLField.ts:9
▸ isValidType(value: any
): boolean
Defined in Model/FieldType/URLField.ts:8
Parameters:
Name | Type |
---|---|
value | any |
Returns: boolean
▸ normalize(value: any
): Promise
<string
>
Defined in Model/FieldType/URLField.ts:10
Parameters:
Name | Type |
---|---|
value | any |
Returns: Promise
<string
>
defaultValidationRules: object
Defined in Model/FieldType/URLField.ts:6
url: object
Defined in Model/FieldType/URLField.ts:6
● allowLocal: boolean
= true
Defined in Model/FieldType/URLField.ts:6
defaultConfiguration: object
Defined in Configure.ts:31
● adapter: RestAdapter = RestAdapter
Defined in Configure.ts:32
● coalesceBufferTime: number
= DEFAULT_COALESCE_BUFFER_TIME
Defined in Configure.ts:37
● coalesceFindRequests: false
= false
Defined in Configure.ts:36
● mapper: Mapper = Mapper
Defined in Configure.ts:34
● preferPatchOverPut: false
= false
Defined in Configure.ts:35
● serializer: RestSerializer = RestSerializer
Defined in Configure.ts:33
fakeModelModule: object
Defined in TestUtils/FakeModelModule.ts:4
fakeModel: object
Defined in TestUtils/FakeModelModule.ts:5
● FakeModel: FakeModel
Defined in TestUtils/FakeModelModule.ts:6
● FakeModelService: FakeModelService
Defined in TestUtils/FakeModelModule.ts:7
● createMockFakeModel: createMockFakeModel
Defined in TestUtils/FakeModelModule.ts:8