entropic-bond 1.53.0 → 1.53.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -190,18 +190,24 @@ export declare class Persistent {
|
|
|
190
190
|
}
|
|
191
191
|
type CollectionPathCallback = (value: Persistent, prop: PersistentProperty) => string;
|
|
192
192
|
type ValidatorFunction<T extends Persistent, P extends ClassPropNames<T>> = (value: T[P], property: PersistentProperty, persistentInstance: T) => boolean;
|
|
193
|
+
export type OwnerCollectionResolver = (ownerClassName: string, params: {}) => string;
|
|
194
|
+
export type CachedPropsConfig<T extends Persistent> = {
|
|
195
|
+
cachedProps: ClassPropNamesOfType<T, Primitive>[];
|
|
196
|
+
updater?: (property: PersistentProperty) => Promise<void>;
|
|
197
|
+
ownerCollectionResolver?: OwnerCollectionResolver;
|
|
198
|
+
};
|
|
193
199
|
export interface PersistentProperty {
|
|
194
200
|
name: string;
|
|
195
201
|
isReference?: boolean;
|
|
196
202
|
isPureReference?: boolean;
|
|
197
203
|
storeInCollection?: string | CollectionPathCallback;
|
|
198
204
|
subCollection?: string;
|
|
199
|
-
cachedProps?: ClassPropNames<Persistent>[];
|
|
200
205
|
toObjectSpecial?: (classObj: any) => any;
|
|
201
206
|
fromObjectSpecial?: (obj: any) => any;
|
|
202
207
|
searchableArray?: boolean;
|
|
203
208
|
validator?: ValidatorFunction<any, any>;
|
|
204
209
|
typeName?: string | string[];
|
|
210
|
+
cachedPropsConfig?: CachedPropsConfig<Persistent>;
|
|
205
211
|
}
|
|
206
212
|
/**
|
|
207
213
|
* Decorator for a property that you want to persist.
|
|
@@ -228,7 +234,7 @@ export declare function persistentReference(target: Persistent, property: string
|
|
|
228
234
|
* @param cachedProps the properties whose values should be stored in the reference object
|
|
229
235
|
* @param storedInCollection indicates the path of the collection where this reference is stored
|
|
230
236
|
*/
|
|
231
|
-
export declare function persistentReferenceWithCachedProps<T extends Persistent>(
|
|
237
|
+
export declare function persistentReferenceWithCachedProps<T extends Persistent>(cachedPropsConfig: CachedPropsConfig<T> | ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback, propTypeName?: string | string[]): (target: Persistent, property: string) => void;
|
|
232
238
|
/**
|
|
233
239
|
* Decorator for a property that is a reference to a persistent object.
|
|
234
240
|
* In this case, and contrary to the @persistentReference decorator, the reference
|
|
@@ -252,7 +258,7 @@ export declare function persistentPureReference(target: Persistent, property: st
|
|
|
252
258
|
* // the reference object will contain the properties name and email of the referenced user
|
|
253
259
|
* // without having to populate the _friend property
|
|
254
260
|
*/
|
|
255
|
-
export declare function persistentPureReferenceWithCachedProps<T extends Persistent>(
|
|
261
|
+
export declare function persistentPureReferenceWithCachedProps<T extends Persistent>(cachedPropsConfig: CachedPropsConfig<T> | ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback, propTypeName?: string | string[]): (target: Persistent, property: string) => void;
|
|
256
262
|
export declare function persistentParser(options?: Partial<PersistentProperty>): (target: Persistent, property: string) => void;
|
|
257
263
|
/**
|
|
258
264
|
* Decorator to register a persistent class. Entropic Bond needs that you register
|
|
@@ -53,9 +53,12 @@ export type QueryObject<T> = {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
export type DocumentListenerUninstaller = () => void;
|
|
56
|
-
interface DocumentChange {
|
|
56
|
+
export interface DocumentChange {
|
|
57
57
|
before: Persistent | undefined;
|
|
58
58
|
after: Persistent;
|
|
59
|
+
params: {
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
};
|
|
59
62
|
}
|
|
60
63
|
export type DocumentChangeListerner = (change: DocumentChange) => void;
|
|
61
64
|
export interface DocumentChangeListernerHandler {
|