entropic-bond 1.51.13 → 1.52.0

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.
@@ -1,6 +1,6 @@
1
1
  import { ClassPropNames, ClassPropNamesOfType, Primitive, SomeClassProps, UnderscoredProp } from '../types/utility-types';
2
2
 
3
- export type PersistentConstructor = new () => Persistent;
3
+ export type PersistentConstructor<T extends Persistent = Persistent> = new () => T;
4
4
  /**
5
5
  * The corresponding type of the plain object of a persistent class.
6
6
  */
@@ -58,7 +58,7 @@ export declare class Persistent {
58
58
  * @see classesExtending
59
59
  * @see annotations
60
60
  */
61
- static classFactory(className: string | undefined): PersistentConstructor;
61
+ static classFactory(className: string | undefined): PersistentConstructor<Persistent>;
62
62
  /**
63
63
  * Returns the names of all registered classes
64
64
  * @returns the names of all registered classes
@@ -196,12 +196,12 @@ export interface PersistentProperty {
196
196
  isReference?: boolean;
197
197
  isPureReference?: boolean;
198
198
  storeInCollection?: string | CollectionPathCallback;
199
- subCollection?: string;
200
199
  cachedProps?: ClassPropNames<Persistent>[];
201
200
  toObjectSpecial?: (classObj: any) => any;
202
201
  fromObjectSpecial?: (obj: any) => any;
203
202
  searchableArray?: boolean;
204
203
  validator?: ValidatorFunction<any, any>;
204
+ typeName?: string;
205
205
  }
206
206
  /**
207
207
  * Decorator for a property that you want to persist.
@@ -230,7 +230,7 @@ export declare function persistentReference(target: Persistent, property: string
230
230
  * @see persistentReference
231
231
  * @see persistentPureReferenceWithCachedProps
232
232
  */
233
- export declare function persistentReferenceWithCachedProps<T extends Persistent>(cachedProps: ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback): (target: Persistent, property: string) => void;
233
+ export declare function persistentReferenceWithCachedProps<T extends Persistent>(propType: PersistentConstructor<T> | T, cachedProps: ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback): (target: Persistent, property: string) => void;
234
234
  /**
235
235
  * Decorator for a property that is a reference to a persistent object.
236
236
  * In this case, and contrary to the @persistentReference decorator, the reference
@@ -254,7 +254,7 @@ export declare function persistentPureReference(target: Persistent, property: st
254
254
  * // the reference object will contain the properties name and email of the referenced user
255
255
  * // without having to populate the _friend property
256
256
  */
257
- export declare function persistentPureReferenceWithCachedProps<T extends Persistent>(cachedProps: ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback): (target: Persistent, property: string) => void;
257
+ export declare function persistentPureReferenceWithCachedProps<T extends Persistent>(propType: PersistentConstructor<T> | T, cachedProps: ClassPropNamesOfType<T, Primitive>[], storeInCollection?: string | CollectionPathCallback): (target: Persistent, property: string) => void;
258
258
  export declare function persistentParser(options?: Partial<PersistentProperty>): (target: Persistent, property: string) => void;
259
259
  /**
260
260
  * Decorator to register a persistent class. Entropic Bond needs that you register
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "entropic-bond",
3
3
  "type": "module",
4
- "version": "1.51.13",
4
+ "version": "1.52.0",
5
5
  "description": "Tidy up your messy components",
6
6
  "main": "./lib/entropic-bond.umd.cjs",
7
7
  "module": "./lib/entropic-bond.js",