@decaf-ts/core 0.7.67 → 0.7.68
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.
- package/README.md +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/interfaces/Observable.d.ts +1 -0
- package/lib/esm/interfaces/Observable.js +3 -1
- package/lib/esm/interfaces/Observable.js.map +1 -1
- package/lib/esm/persistence/decorators.d.ts +5 -1
- package/lib/esm/persistence/decorators.js +14 -5
- package/lib/esm/persistence/decorators.js.map +1 -1
- package/lib/esm/persistence/index.d.ts +1 -0
- package/lib/esm/persistence/index.js +1 -0
- package/lib/esm/persistence/index.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/interfaces/Observable.cjs +4 -0
- package/lib/interfaces/Observable.d.ts +1 -0
- package/lib/interfaces/Observable.js.map +1 -1
- package/lib/persistence/decorators.cjs +14 -5
- package/lib/persistence/decorators.d.ts +5 -1
- package/lib/persistence/decorators.js.map +1 -1
- package/lib/persistence/index.cjs +1 -0
- package/lib/persistence/index.d.ts +1 -0
- package/lib/persistence/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,8BAA2B;AAC3B,+BAA4B;AAC5B,6BAA0B;AAC1B,4BAAyB;AACzB,gCAA6B;AAC7B,mCAAgC;AAChC,qCAAkC;AAClC,8BAA2B;AAC3B,2BAAwB;AACxB,6BAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,8BAA2B;AAC3B,+BAA4B;AAC5B,6BAA0B;AAC1B,gCAA6B;AAC7B,4BAAyB;AACzB,gCAA6B;AAC7B,mCAAgC;AAChC,qCAAkC;AAClC,8BAA2B;AAC3B,2BAAwB;AACxB,6BAA0B"}
|
package/lib/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ __exportStar(require("./persistence/index.cjs"), exports);
|
|
|
47
47
|
* @const VERSION
|
|
48
48
|
* @memberOf module:core
|
|
49
49
|
*/
|
|
50
|
-
exports.VERSION = "0.7.
|
|
50
|
+
exports.VERSION = "0.7.67";
|
|
51
51
|
/**
|
|
52
52
|
* @description Stores the current package version
|
|
53
53
|
* @summary A constant representing the version of the core package
|
package/lib/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export * from "./persistence";
|
|
|
20
20
|
* @const VERSION
|
|
21
21
|
* @memberOf module:core
|
|
22
22
|
*/
|
|
23
|
-
export declare const VERSION = "0.7.
|
|
23
|
+
export declare const VERSION = "0.7.67";
|
|
24
24
|
/**
|
|
25
25
|
* @description Stores the current package version
|
|
26
26
|
* @summary A constant representing the version of the core package
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Observer } from "./Observer";
|
|
2
|
+
export declare function unRegistration(observable: Observable, observer: Observer): () => void;
|
|
2
3
|
/**
|
|
3
4
|
* @description Interface for objects that can be observed
|
|
4
5
|
* @summary Defines a contract for objects that implement the Observer pattern, allowing them to register observers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../src/interfaces/Observable.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../src/interfaces/Observable.ts"],"names":[],"mappings":";;AAEA,wCAEC;AAFD,SAAgB,cAAc,CAAC,UAAsB,EAAE,QAAkB;IACvE,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -27,12 +27,21 @@ async function uuidCreateUpdateHandler(context, data, key, model) {
|
|
|
27
27
|
typeof model[key] !== "undefined") {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
// eslint-disable-next-line prefer-const
|
|
31
|
+
let { seed, args } = data;
|
|
32
|
+
if (seed && typeof seed === "function") {
|
|
33
|
+
seed = seed(model, ...(args || []), context);
|
|
34
|
+
}
|
|
35
|
+
model[key] = generators_1.UUID.instance.generate(seed);
|
|
31
36
|
}
|
|
32
|
-
function uuid(update = false, ...args) {
|
|
37
|
+
function uuid(update = false, seed, ...args) {
|
|
38
|
+
if (typeof update === "function") {
|
|
39
|
+
seed = update;
|
|
40
|
+
update = false;
|
|
41
|
+
}
|
|
33
42
|
const decorationKey = constants_1.PersistenceKeys.UUID;
|
|
34
|
-
function uuid(update, ...args) {
|
|
35
|
-
const meta = { update: update, args: args };
|
|
43
|
+
function uuid(update, seed, ...args) {
|
|
44
|
+
const meta = { update: update, seed: seed, args: args };
|
|
36
45
|
const decorators = [
|
|
37
46
|
(0, decorator_validation_1.required)(),
|
|
38
47
|
(0, db_decorators_1.generated)(constants_1.PersistenceKeys.UUID),
|
|
@@ -47,7 +56,7 @@ function uuid(update = false, ...args) {
|
|
|
47
56
|
return decoration_1.Decoration.for(decorationKey)
|
|
48
57
|
.define({
|
|
49
58
|
decorator: uuid,
|
|
50
|
-
args: [update, ...args],
|
|
59
|
+
args: [update, seed, ...args],
|
|
51
60
|
})
|
|
52
61
|
.apply();
|
|
53
62
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
2
2
|
import { ContextOf } from "./types";
|
|
3
3
|
import { Repo } from "../repository/Repository";
|
|
4
|
+
import { ContextualArgs } from "../utils/index";
|
|
4
5
|
/**
|
|
5
6
|
* @description Handler function that sets a timestamp property to the current timestamp.
|
|
6
7
|
* @summary Updates a model property with the current timestamp from the repository context.
|
|
@@ -19,6 +20,9 @@ import { Repo } from "../repository/Repository";
|
|
|
19
20
|
export declare function uuidCreateUpdateHandler<M extends Model<boolean>, R extends Repo<M>>(this: R, context: ContextOf<R>, data: UUIDMetadata, key: keyof M, model: M): Promise<void>;
|
|
20
21
|
export type UUIDMetadata = {
|
|
21
22
|
update: boolean;
|
|
23
|
+
seed?: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string);
|
|
22
24
|
args?: any[];
|
|
23
25
|
};
|
|
24
|
-
export declare function uuid(
|
|
26
|
+
export declare function uuid(...args: any[]): (target: any, propertyKey?: any) => void;
|
|
27
|
+
export declare function uuid(update: boolean, ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
28
|
+
export declare function uuid(seed: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string), ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/persistence/decorators.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/persistence/decorators.ts"],"names":[],"mappings":";;AA6BA,0DAuBC;AAoBD,oBA0CC;AAlHD,+CAA8C;AAC9C,yEAAiE;AACjE,2DAKiC;AACjC,qDAAyD;AAGzD,iDAAoC;AAGpC;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,uBAAuB,CAK3C,OAAqB,EACrB,IAAkB,EAClB,GAAY,EACZ,KAAQ;IAER,IACE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;QACtC,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,WAAW,EACjC,CAAC;QACD,OAAO;IACT,CAAC;IAED,wCAAwC;IACxC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QACvC,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,OAAO,CA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
__exportStar(require("./Dispatch.cjs"), exports);
|
|
19
19
|
__exportStar(require("./constants.cjs"), exports);
|
|
20
20
|
__exportStar(require("./Context.cjs"), exports);
|
|
21
|
+
__exportStar(require("./decorators.cjs"), exports);
|
|
21
22
|
__exportStar(require("./errors.cjs"), exports);
|
|
22
23
|
__exportStar(require("./generators.cjs"), exports);
|
|
23
24
|
__exportStar(require("./event-filters.cjs"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/persistence/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2BAA2B;AAC3B,iDAA2B;AAC3B,kDAA4B;AAC5B,gDAA0B;AAC1B,+CAAyB;AACzB,mDAA6B;AAC7B,sDAAgC;AAChC,wDAAkC;AAClC,iDAA2B;AAC3B,8CAAwB;AACxB,gDAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/persistence/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2BAA2B;AAC3B,iDAA2B;AAC3B,kDAA4B;AAC5B,gDAA0B;AAC1B,mDAA6B;AAC7B,+CAAyB;AACzB,mDAA6B;AAC7B,sDAAgC;AAChC,wDAAkC;AAClC,iDAA2B;AAC3B,8CAAwB;AACxB,gDAA0B"}
|