UNPKG

@crnk/angular-ngrx

Version:

Angular helper library for ngrx-json-api and crnk:

40 lines (39 loc) 1.8 kB
import { OperationType, Resource, ResourceError, ResourceState, ManyResourceRelationship, OneResourceRelationship, ResourceIdentifier, StoreResource } from 'ngrx-json-api'; import { BeanPath, StringPath } from '../expression'; /** * For some reason the compiler does not get in applicaiton projects it if we make use of StoreResource directly. * For this reason we repeat the fields here. */ export interface CrnkStoreResource extends StoreResource { type: string; id: string; state?: ResourceState; persistedResource?: Resource; loading?: OperationType; errors?: Array<ResourceError>; hasTemporaryId?: boolean; } export interface TypedManyResourceRelationship<T extends StoreResource> extends ManyResourceRelationship { reference?: Array<T>; } export interface TypedOneResourceRelationship<T extends StoreResource> extends OneResourceRelationship { reference?: T; } export declare class QResourceIdentifier extends BeanPath<ResourceIdentifier> { id: StringPath; type: StringPath; } export declare class QTypedOneResourceRelationship<Q extends BeanPath<T>, T extends StoreResource> extends BeanPath<TypedOneResourceRelationship<T>> { private _referenceType; data: QResourceIdentifier; private _reference; constructor(parent: BeanPath<any>, property: string, _referenceType: new (...args: any[]) => Q); readonly reference: Q; } export declare class QTypedManyResourceRelationship<Q extends BeanPath<T>, T extends StoreResource> extends BeanPath<TypedManyResourceRelationship<T>> { private _referenceType; data: QResourceIdentifier; private _reference; constructor(parent: BeanPath<any>, property: string, _referenceType: new (...args: any[]) => Q); readonly reference: Q; }