@venizia/ignis-kernel 0.4.2 → 0.4.3
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/dist/cjs/base/applications/common/constants.d.ts +9 -0
- package/dist/cjs/base/applications/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/applications/common/constants.js +11 -1
- package/dist/cjs/base/applications/common/constants.js.map +1 -1
- package/dist/cjs/base/applications/common/types/middlewares.d.ts +2 -2
- package/dist/cjs/base/applications/common/types/middlewares.d.ts.map +1 -1
- package/dist/cjs/base/applications/common/types/middlewares.js.map +1 -1
- package/dist/cjs/base/applications/deprecations.d.ts +2 -2
- package/dist/cjs/base/applications/deprecations.js +7 -7
- package/dist/cjs/base/applications/deprecations.js.map +1 -1
- package/dist/cjs/base/applications/rest.js +1 -1
- package/dist/cjs/base/applications/rest.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts +10 -0
- package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.js +12 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts +1 -2
- package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts +11 -0
- package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js +13 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/cjs/base/auth/authorize/common/types/request.d.ts +2 -1
- package/dist/cjs/base/auth/authorize/common/types/request.d.ts.map +1 -1
- package/dist/cjs/base/auth/authorize/common/types/request.js.map +1 -1
- package/dist/cjs/base/auth/authorize/providers/request-domain.js +4 -4
- package/dist/cjs/base/auth/authorize/providers/request-domain.js.map +1 -1
- package/dist/cjs/base/controllers/common/constants.d.ts +10 -0
- package/dist/cjs/base/controllers/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/controllers/common/constants.js +12 -1
- package/dist/cjs/base/controllers/common/constants.js.map +1 -1
- package/dist/cjs/base/controllers/factory/controller.d.ts +1 -1
- package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/cjs/base/controllers/rest/abstract.d.ts +2 -1
- package/dist/cjs/base/controllers/rest/abstract.d.ts.map +1 -1
- package/dist/cjs/base/controllers/rest/abstract.js +6 -4
- package/dist/cjs/base/controllers/rest/abstract.js.map +1 -1
- package/dist/cjs/base/metadata/model-metadata.d.ts +17 -0
- package/dist/cjs/base/metadata/model-metadata.d.ts.map +1 -0
- package/dist/cjs/base/metadata/model-metadata.js +50 -0
- package/dist/cjs/base/metadata/model-metadata.js.map +1 -0
- package/dist/cjs/base/metadata/model-settings.d.ts +7 -17
- package/dist/cjs/base/metadata/model-settings.d.ts.map +1 -1
- package/dist/cjs/base/metadata/model-settings.js +22 -65
- package/dist/cjs/base/metadata/model-settings.js.map +1 -1
- package/dist/cjs/base/metadata/persistents.d.ts +1 -1
- package/dist/cjs/base/metadata/persistents.d.ts.map +1 -1
- package/dist/cjs/base/metadata/persistents.js +5 -12
- package/dist/cjs/base/metadata/persistents.js.map +1 -1
- package/dist/cjs/base/models/common/constants.d.ts +17 -0
- package/dist/cjs/base/models/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/models/common/constants.js +20 -1
- package/dist/cjs/base/models/common/constants.js.map +1 -1
- package/dist/cjs/base/models/common/schemas.d.ts +1 -1
- package/dist/cjs/base/models/common/schemas.d.ts.map +1 -1
- package/dist/cjs/base/models/common/schemas.js.map +1 -1
- package/dist/cjs/base/models/common/types/id.d.ts +0 -2
- package/dist/cjs/base/models/common/types/id.d.ts.map +1 -1
- package/dist/cjs/base/models/common/types/id.js.map +1 -1
- package/dist/cjs/helpers/inversion/common/constants.d.ts +10 -0
- package/dist/cjs/helpers/inversion/common/constants.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/common/constants.js +11 -1
- package/dist/cjs/helpers/inversion/common/constants.js.map +1 -1
- package/dist/cjs/helpers/inversion/common/types/model.d.ts +17 -29
- package/dist/cjs/helpers/inversion/common/types/model.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/common/types/model.js.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts +5 -4
- package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js +5 -4
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/dist/esm/base/applications/common/constants.d.ts +9 -0
- package/dist/esm/base/applications/common/constants.d.ts.map +1 -1
- package/dist/esm/base/applications/common/constants.js +9 -0
- package/dist/esm/base/applications/common/constants.js.map +1 -1
- package/dist/esm/base/applications/common/types/middlewares.d.ts +2 -2
- package/dist/esm/base/applications/common/types/middlewares.d.ts.map +1 -1
- package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
- package/dist/esm/base/applications/deprecations.d.ts +2 -2
- package/dist/esm/base/applications/deprecations.js +5 -5
- package/dist/esm/base/applications/deprecations.js.map +1 -1
- package/dist/esm/base/applications/rest.js +2 -2
- package/dist/esm/base/applications/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +10 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/jose.js +10 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +1 -2
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +11 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.js +11 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/request.d.ts +2 -1
- package/dist/esm/base/auth/authorize/common/types/request.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/request-domain.js +5 -5
- package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
- package/dist/esm/base/controllers/common/constants.d.ts +10 -0
- package/dist/esm/base/controllers/common/constants.d.ts.map +1 -1
- package/dist/esm/base/controllers/common/constants.js +10 -0
- package/dist/esm/base/controllers/common/constants.js.map +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.d.ts +2 -1
- package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.js +6 -4
- package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
- package/dist/esm/base/metadata/model-metadata.d.ts +17 -0
- package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -0
- package/dist/esm/base/metadata/model-metadata.js +46 -0
- package/dist/esm/base/metadata/model-metadata.js.map +1 -0
- package/dist/esm/base/metadata/model-settings.d.ts +7 -17
- package/dist/esm/base/metadata/model-settings.d.ts.map +1 -1
- package/dist/esm/base/metadata/model-settings.js +20 -63
- package/dist/esm/base/metadata/model-settings.js.map +1 -1
- package/dist/esm/base/metadata/persistents.d.ts +1 -1
- package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
- package/dist/esm/base/metadata/persistents.js +6 -13
- package/dist/esm/base/metadata/persistents.js.map +1 -1
- package/dist/esm/base/models/common/constants.d.ts +17 -0
- package/dist/esm/base/models/common/constants.d.ts.map +1 -1
- package/dist/esm/base/models/common/constants.js +17 -0
- package/dist/esm/base/models/common/constants.js.map +1 -1
- package/dist/esm/base/models/common/schemas.d.ts +1 -1
- package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
- package/dist/esm/base/models/common/schemas.js.map +1 -1
- package/dist/esm/base/models/common/types/id.d.ts +0 -2
- package/dist/esm/base/models/common/types/id.d.ts.map +1 -1
- package/dist/esm/base/models/common/types/id.js.map +1 -1
- package/dist/esm/helpers/inversion/common/constants.d.ts +10 -0
- package/dist/esm/helpers/inversion/common/constants.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/common/constants.js +9 -0
- package/dist/esm/helpers/inversion/common/constants.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/model.d.ts +17 -29
- package/dist/esm/helpers/inversion/common/types/model.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts +5 -4
- package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.js +5 -4
- package/dist/esm/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,77 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.assertNoRemovedModelSettings = void 0;
|
|
4
4
|
const core_1 = require("@venizia/ignis-helpers/core");
|
|
5
|
-
/** The
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/** The keys 0.4.2 deprecated and 0.4.3 removed, and the key that replaces each. */
|
|
6
|
+
const REMOVED_MODEL_SETTINGS = {
|
|
7
|
+
defaultFilter: 'query.filter',
|
|
8
|
+
defaultLimit: 'query.limit.default',
|
|
9
|
+
maxLimit: 'query.limit.max',
|
|
10
|
+
scopeFilter: 'access',
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `query.limit.max`; `scopeFilter` -> `access` (`writeGuard` -> `access.write.mode`, `sharedRows`
|
|
18
|
-
* -> `access.write.sharedRows`).
|
|
19
|
-
* - An old key together with the key that replaces it is an error.
|
|
20
|
-
* - Returns the old keys in use so the application can warn once at boot.
|
|
13
|
+
* Refuses a removed `@model` settings key. A model that still says `scopeFilter` would otherwise
|
|
14
|
+
* lose its row scope without a sound (a plain-JavaScript or `any`-typed model gets no type error),
|
|
15
|
+
* so the decorator throws instead, naming the key to use. `devz codemod model-settings --write` rewrites
|
|
16
|
+
* the keys.
|
|
21
17
|
*/
|
|
22
|
-
const
|
|
18
|
+
const assertNoRemovedModelSettings = (opts) => {
|
|
23
19
|
const { model, settings } = opts;
|
|
24
20
|
if (!settings) {
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
const { defaultFilter, defaultLimit, maxLimit, scopeFilter, ...current } = settings;
|
|
28
|
-
const deprecated = [];
|
|
29
|
-
const normalized = { ...current };
|
|
30
|
-
if (defaultFilter !== undefined) {
|
|
31
|
-
if (current.query?.filter !== undefined) {
|
|
32
|
-
throw conflict({ model, old: 'defaultFilter', use: 'query.filter' });
|
|
33
|
-
}
|
|
34
|
-
normalized.query = { ...normalized.query, filter: defaultFilter };
|
|
35
|
-
deprecated.push({ key: 'defaultFilter', use: 'query.filter' });
|
|
36
|
-
}
|
|
37
|
-
if (defaultLimit !== undefined) {
|
|
38
|
-
if (current.query?.limit?.default !== undefined) {
|
|
39
|
-
throw conflict({ model, old: 'defaultLimit', use: 'query.limit.default' });
|
|
40
|
-
}
|
|
41
|
-
normalized.query = {
|
|
42
|
-
...normalized.query,
|
|
43
|
-
limit: { ...normalized.query?.limit, default: defaultLimit },
|
|
44
|
-
};
|
|
45
|
-
deprecated.push({ key: 'defaultLimit', use: 'query.limit.default' });
|
|
21
|
+
return;
|
|
46
22
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
normalized.query = {
|
|
52
|
-
...normalized.query,
|
|
53
|
-
limit: { ...normalized.query?.limit, max: maxLimit },
|
|
54
|
-
};
|
|
55
|
-
deprecated.push({ key: 'maxLimit', use: 'query.limit.max' });
|
|
23
|
+
const removed = Object.keys(REMOVED_MODEL_SETTINGS).filter((key) => Object.hasOwn(settings, key));
|
|
24
|
+
if (removed.length === 0) {
|
|
25
|
+
return;
|
|
56
26
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const access = { ...rest };
|
|
63
|
-
deprecated.push({ key: 'scopeFilter', use: 'access' });
|
|
64
|
-
if (writeGuard !== undefined) {
|
|
65
|
-
access.write = { ...access.write, mode: writeGuard };
|
|
66
|
-
deprecated.push({ key: 'scopeFilter.writeGuard', use: 'access.write.mode' });
|
|
67
|
-
}
|
|
68
|
-
if (sharedRows !== undefined) {
|
|
69
|
-
access.write = { ...access.write, sharedRows };
|
|
70
|
-
deprecated.push({ key: 'scopeFilter.sharedRows', use: 'access.write.sharedRows' });
|
|
71
|
-
}
|
|
72
|
-
normalized.access = access;
|
|
73
|
-
}
|
|
74
|
-
return { settings: normalized, deprecated };
|
|
27
|
+
throw (0, core_1.getError)({
|
|
28
|
+
message: `[model][${model}] Removed settings key(s): ${removed
|
|
29
|
+
.map((key) => `settings.${key} (use settings.${REMOVED_MODEL_SETTINGS[key]})`)
|
|
30
|
+
.join(', ')} | removed in 0.4.3 | run 'devz codemod model-settings --write' to rewrite them`,
|
|
31
|
+
});
|
|
75
32
|
};
|
|
76
|
-
exports.
|
|
33
|
+
exports.assertNoRemovedModelSettings = assertNoRemovedModelSettings;
|
|
77
34
|
//# sourceMappingURL=model-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-settings.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;
|
|
1
|
+
{"version":3,"file":"model-settings.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAEvD,mFAAmF;AACnF,MAAM,sBAAsB,GAA2B;IACrD,aAAa,EAAE,cAAc;IAC7B,YAAY,EAAE,qBAAqB;IACnC,QAAQ,EAAE,iBAAiB;IAC3B,WAAW,EAAE,QAAQ;CACtB,CAAC;AAEF;;;;;GAKG;AACI,MAAM,4BAA4B,GAAG,CAAC,IAG5C,EAAQ,EAAE;IACT,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEjC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAClG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,IAAA,eAAQ,EAAC;QACb,OAAO,EAAE,WAAW,KAAK,8BAA8B,OAAO;aAC3D,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,GAAG,kBAAkB,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC;aAC7E,IAAI,CAAC,IAAI,CAAC,iFAAiF;KAC/F,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\n\n/** The keys 0.4.2 deprecated and 0.4.3 removed, and the key that replaces each. */\nconst REMOVED_MODEL_SETTINGS: Record<string, string> = {\n defaultFilter: 'query.filter',\n defaultLimit: 'query.limit.default',\n maxLimit: 'query.limit.max',\n scopeFilter: 'access',\n};\n\n/**\n * Refuses a removed `@model` settings key. A model that still says `scopeFilter` would otherwise\n * lose its row scope without a sound (a plain-JavaScript or `any`-typed model gets no type error),\n * so the decorator throws instead, naming the key to use. `devz codemod model-settings --write` rewrites\n * the keys.\n */\nexport const assertNoRemovedModelSettings = (opts: {\n model: string;\n settings: object | undefined;\n}): void => {\n const { model, settings } = opts;\n\n if (!settings) {\n return;\n }\n\n const removed = Object.keys(REMOVED_MODEL_SETTINGS).filter((key) => Object.hasOwn(settings, key));\n if (removed.length === 0) {\n return;\n }\n\n throw getError({\n message: `[model][${model}] Removed settings key(s): ${removed\n .map((key) => `settings.${key} (use settings.${REMOVED_MODEL_SETTINGS[key]})`)\n .join(', ')} | removed in 0.4.3 | run 'devz codemod model-settings --write' to rewrite them`,\n });\n};\n"]}
|
|
@@ -2,7 +2,7 @@ import type { IDataSourceMetadata, IModelMetadata, TRepositoryMetadata } from '.
|
|
|
2
2
|
import type { IDataSource } from '../datasources';
|
|
3
3
|
import type { AbstractEntity } from '../models';
|
|
4
4
|
/** Registers a model class with its static schema and relations. */
|
|
5
|
-
export declare const model: (input
|
|
5
|
+
export declare const model: (input?: IModelMetadata) => ClassDecorator;
|
|
6
6
|
/** Registers a datasource with driver and auto-discovery settings. */
|
|
7
7
|
export declare const datasource: (metadata?: IDataSourceMetadata) => ClassDecorator;
|
|
8
8
|
export declare const repository: <Model extends AbstractEntity = AbstractEntity, DataSource extends IDataSource = IDataSource>(metadata?: TRepositoryMetadata<Model, DataSource>) => ClassDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhD,oEAAoE;AACpE,eAAO,MAAM,KAAK,GAAI,QAAO,cAAmB,KAAG,cAmClD,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,WAAW,mBAAmB,KAAG,cAQ3D,CAAC;AA0PF,eAAO,MAAM,UAAU,GACrB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,UAAU,SAAS,WAAW,GAAG,WAAW,EAE5C,WAAW,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,KAChD,cAeF,CAAC"}
|
|
@@ -8,22 +8,15 @@ const core_1 = require("@venizia/ignis-helpers/core");
|
|
|
8
8
|
const datasources_1 = require("../datasources");
|
|
9
9
|
const constants_1 = require("../repositories/common/constants");
|
|
10
10
|
const injectable_1 = require("./injectable");
|
|
11
|
+
const model_metadata_1 = require("./model-metadata");
|
|
11
12
|
const model_settings_1 = require("./model-settings");
|
|
12
13
|
/** Registers a model class with its static schema and relations. */
|
|
13
|
-
const model = (input) => {
|
|
14
|
+
const model = (input = {}) => {
|
|
14
15
|
return (target) => {
|
|
15
16
|
(0, injectable_1.injectable)({ type: inversion_1.ArtifactTypes.MODEL, ...(0, injectable_1.pickRegistrationOptions)({ metadata: input }) })(target);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const { settings
|
|
19
|
-
model: target.name,
|
|
20
|
-
settings: input.settings,
|
|
21
|
-
});
|
|
22
|
-
const metadata = {
|
|
23
|
-
...input,
|
|
24
|
-
settings,
|
|
25
|
-
...(deprecated.length > 0 ? { deprecatedSettings: deprecated } : {}),
|
|
26
|
-
};
|
|
17
|
+
const metadata = (0, model_metadata_1.normalizeModelMetadata)({ model: target.name, metadata: input });
|
|
18
|
+
(0, model_settings_1.assertNoRemovedModelSettings)({ model: target.name, settings: metadata.settings });
|
|
19
|
+
const { settings } = metadata;
|
|
27
20
|
const defaultLimit = settings?.query?.limit?.default;
|
|
28
21
|
if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {
|
|
29
22
|
throw (0, core_1.getError)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAStD,mDAM6B;AAC7B,0DAA2E;AAC3E,sDAAuD;AAEvD,gDAAmD;AAEnD,gEAAmE;AACnE,6CAAmE;AACnE,qDAA0D;AAE1D,oEAAoE;AAC7D,MAAM,KAAK,GAAG,CAAC,KAAqB,EAAkB,EAAE;IAC7D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAA,uBAAU,EAAC,EAAE,IAAI,EAAE,yBAAa,CAAC,KAAK,EAAE,GAAG,IAAA,oCAAuB,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CACxF,MAAM,CACP,CAAC;QAEF,6FAA6F;QAC7F,4CAA4C;QAC5C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAA,uCAAsB,EAAC;YACtD,KAAK,EAAE,MAAM,CAAC,IAAI;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;QACH,MAAM,QAAQ,GAAmB;YAC/B,GAAG,KAAK;YACR,QAAQ;YACR,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,CAAC;QAEF,MAAM,YAAY,GAAG,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC;QACrD,I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YAAY,EAAE,EAAE;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\nimport { normalizeModelSettings } from './model-settings';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (input: IModelMetadata): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata: input }) })(\n target,\n );\n\n // The one place the deprecated flat keys become the grouped ones; the registry, and so every\n // reader, only ever sees the grouped shape.\n const { settings, deprecated } = normalizeModelSettings({\n model: target.name,\n settings: input.settings,\n });\n const metadata: IModelMetadata = {\n ...input,\n settings,\n ...(deprecated.length > 0 ? { deprecatedSettings: deprecated } : {}),\n };\n\n const defaultLimit = settings?.query?.limit?.default;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = settings?.query?.limit?.max;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAStD,mDAM6B;AAC7B,0DAA2E;AAC3E,sDAAuD;AAEvD,gDAAmD;AAEnD,gEAAmE;AACnE,6CAAmE;AACnE,qDAA0D;AAC1D,qDAAgE;AAEhE,oEAAoE;AAC7D,MAAM,KAAK,GAAG,CAAC,QAAwB,EAAE,EAAkB,EAAE;IAClE,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAA,uBAAU,EAAC,EAAE,IAAI,EAAE,yBAAa,CAAC,KAAK,EAAE,GAAG,IAAA,oCAAuB,EAAC,EAAE,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AC,CAAC;IAE3E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEK,MAAM,UAAU,GAAG,CAIxB,QAAiD,EACjC,EAAE;IAClB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,uBAAuB,CAAC;gBACtB,QAAQ,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;gBACzD,YAAY,EAAE,EAAE;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\nimport { normalizeModelMetadata } from './model-metadata';\nimport { assertNoRemovedModelSettings } from './model-settings';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (input: IModelMetadata = {}): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata: input }) })(\n target,\n );\n\n const metadata = normalizeModelMetadata({ model: target.name, metadata: input });\n\n assertNoRemovedModelSettings({ model: target.name, settings: metadata.settings });\n const { settings } = metadata;\n\n const defaultLimit = settings?.query?.limit?.default;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = settings?.query?.limit?.max;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
|
|
@@ -8,4 +8,21 @@ export declare class SchemaTypes {
|
|
|
8
8
|
static isValid(input: string): input is TSchemaType;
|
|
9
9
|
}
|
|
10
10
|
export type TSchemaType = TConstValue<typeof SchemaTypes>;
|
|
11
|
+
/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
|
|
12
|
+
export declare class ModelTypes {
|
|
13
|
+
static readonly ENTITY = "entity";
|
|
14
|
+
static readonly SCHEME_SET: Set<string>;
|
|
15
|
+
static isValid(value: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Valid model type values. */
|
|
18
|
+
export type TModelType = TConstValue<typeof ModelTypes>;
|
|
19
|
+
/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
|
|
20
|
+
export declare class IdSchemaTypes {
|
|
21
|
+
static readonly NUMBER = "number";
|
|
22
|
+
static readonly STRING = "string";
|
|
23
|
+
static readonly SCHEME_SET: Set<string>;
|
|
24
|
+
static isValid(value: string): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Valid id schema type values. */
|
|
27
|
+
export type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;
|
|
11
28
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAkE;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW;CAGpD;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAkE;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW;CAGpD;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D,iGAAiG;AACjG,qBAAa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA0B;IAEpD,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAExD,2FAA2F;AAC3F,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA+C;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchemaTypes = void 0;
|
|
3
|
+
exports.IdSchemaTypes = exports.ModelTypes = exports.SchemaTypes = void 0;
|
|
4
4
|
class SchemaTypes {
|
|
5
5
|
static { this.SELECT = 'select'; }
|
|
6
6
|
static { this.UPDATE = 'update'; }
|
|
@@ -12,4 +12,23 @@ class SchemaTypes {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.SchemaTypes = SchemaTypes;
|
|
15
|
+
/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
|
|
16
|
+
class ModelTypes {
|
|
17
|
+
static { this.ENTITY = 'entity'; }
|
|
18
|
+
static { this.SCHEME_SET = new Set([this.ENTITY]); }
|
|
19
|
+
static isValid(value) {
|
|
20
|
+
return this.SCHEME_SET.has(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ModelTypes = ModelTypes;
|
|
24
|
+
/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
|
|
25
|
+
class IdSchemaTypes {
|
|
26
|
+
static { this.NUMBER = 'number'; }
|
|
27
|
+
static { this.STRING = 'string'; }
|
|
28
|
+
static { this.SCHEME_SET = new Set([this.NUMBER, this.STRING]); }
|
|
29
|
+
static isValid(value) {
|
|
30
|
+
return this.SCHEME_SET.has(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.IdSchemaTypes = IdSchemaTypes;
|
|
15
34
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAVH,kCAWC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAVH,kCAWC;AAID,iGAAiG;AACjG,MAAa,UAAU;aACL,WAAM,GAAG,QAAQ,CAAC;aAClB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AANH,gCAOC;AAKD,2FAA2F;AAC3F,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,sCASC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n\n/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */\nexport class ModelTypes {\n static readonly ENTITY = 'entity';\n static readonly SCHEME_SET = new Set([this.ENTITY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid model type values. */\nexport type TModelType = TConstValue<typeof ModelTypes>;\n\n/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */\nexport class IdSchemaTypes {\n static readonly NUMBER = 'number';\n static readonly STRING = 'string';\n\n static readonly SCHEME_SET = new Set<string>([this.NUMBER, this.STRING]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid id schema type values. */\nexport type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from '@hono/zod-openapi';
|
|
2
|
-
import type { TIdSchemaType } from './
|
|
2
|
+
import type { TIdSchemaType } from './constants';
|
|
3
3
|
/**
|
|
4
4
|
* The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.
|
|
5
5
|
* Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;iBA6BpB,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD,eAAO,MAAM,cAAc,GAAI,OAAO;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE;;;;iBAkC9D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM;IACrD,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;;;;;;;CAMA,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI1B,CAAC;AAEF,mCAAmC;AACnC,KAAK,aAAa,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QA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QACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB;QACnD,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAEjG,OAAO;QACL,CAAC,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;QAC3C,GAAG,IAAA,sBAAc,GAAE;KACpB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":";;;AAAA,mDAAsC;AACtC,0DAAqD;AACrD,sDAAuD;AAGvD;;;GAGG;AACU,QAAA,WAAW,GAAG,eAAC;KACzB,MAAM,CAAC;IACN,UAAU,EAAE,eAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,eAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,eAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,eAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,eAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,eAAC,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,EAAE,eAAC,CAAC,GAAG,EAAE,CAAC;KACpC,CAAC;SACD,QAAQ,EAAE;IACb,KAAK,EAAE,eAAC,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,EAAE,eAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,SAAS,E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I,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAEjG,OAAO;QACL,CAAC,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;QAC3C,GAAG,IAAA,sBAAc,GAAE;KACpB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './constants';\n\n/**\n * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.\n * Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.\n */\nexport const ErrorSchema = z\n .object({\n statusCode: z.number().optional(),\n message: z.string(),\n normalized: z\n .object({\n text: z.string(),\n code: z.string(),\n args: z.record(z.string(), z.any()),\n })\n .optional(),\n extra: z.record(z.string(), z.any()).optional(),\n requestId: z.string().optional(),\n details: z.record(z.string(), z.any()).optional(),\n })\n .openapi('ErrorResponse', {\n description: 'Error Schema',\n example: {\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: 'A category named %{name} already exists.',\n normalized: {\n text: 'A category named %{name} already exists.',\n code: 'server.commerce.category.create.duplicate_name',\n args: { name: 'Ticket' },\n },\n extra: { categoryId: 42 },\n requestId: 'abc-123-def',\n details: { url: 'http://localhost:3000/categories', path: '/categories' },\n },\n });\n\nexport type TErrorResponse = z.infer<typeof ErrorSchema>;\n\nexport const idParamsSchema = (opts?: { idType: TIdSchemaType }) => {\n const { idType = 'number' } = opts ?? {};\n\n switch (idType) {\n case 'number': {\n return z.object({\n id: z.number().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: [1, 2, 3],\n }),\n });\n }\n case 'string': {\n return z.object({\n id: z.string().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: ['4651e634-a530-4484-9b09-9616a28f35e3', 'some_unique_id'],\n }),\n });\n }\n default: {\n throw getError({\n message: `[idParamsSchema] Invalid input idType | valid: [string | number] | idType: ${idType}`,\n });\n }\n }\n};\n\nexport const jsonContent = <T extends z.ZodType>(opts: {\n schema: T;\n description: string;\n required?: boolean;\n}) => {\n return {\n description: opts.description,\n content: { 'application/json': { schema: opts.schema } },\n required: opts.required,\n };\n};\n\n/** The JSON error body of a route, under `4XX` and `5XX` - the range keys OpenAPI accepts. */\nexport const errorResponses = () => {\n const errorResponse = jsonContent({ description: 'Error Response', schema: ErrorSchema });\n\n return { '4XX': errorResponse, '5XX': errorResponse };\n};\n\n/** OpenAPI Header Object format */\ntype THeaderObject = {\n description?: string;\n schema: { type: string; examples?: Array<string> };\n};\n\n/** Map of header names to Header Objects */\ntype TResponseHeaders = Record<string, THeaderObject>;\n\ntype TJsonResponseOpts<T extends z.ZodType, H extends TResponseHeaders | undefined> = {\n schema: T;\n description?: string;\n required?: boolean;\n headers?: H;\n};\n\nexport const jsonResponse = <\n ContentSchema extends z.ZodType,\n HeaderSchema extends TResponseHeaders | undefined = undefined,\n>(\n opts: TJsonResponseOpts<ContentSchema, HeaderSchema>,\n) => {\n const baseResponse = jsonContent({\n required: opts.required,\n description: opts.description ?? 'Success Response',\n schema: opts.schema,\n });\n\n const successResponse = opts.headers ? { ...baseResponse, headers: opts.headers } : baseResponse;\n\n return {\n [HTTP.ResultCodes.RS_2.Ok]: successResponse,\n ...errorResponses(),\n };\n};\n"]}
|
|
@@ -18,7 +18,5 @@ declare const entityIdBrand: unique symbol;
|
|
|
18
18
|
export type TEntityId = string & {
|
|
19
19
|
readonly [entityIdBrand]: never;
|
|
20
20
|
};
|
|
21
|
-
/** Path-param id shape every entity family resolves to (`AbstractEntity.getIdType()`). */
|
|
22
|
-
export type TIdSchemaType = 'number' | 'string';
|
|
23
21
|
export {};
|
|
24
22
|
//# sourceMappingURL=id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhE,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhE,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["export type NumberIdType = number;\nexport type StringIdType = string;\nexport type BigIntIdType = bigint;\nexport type IdType = NumberIdType | StringIdType | BigIntIdType;\n\ndeclare const entityIdBrand: unique symbol;\n\n/**\n * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id\n * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.\n *\n * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the\n * laundering VISIBLE at each boundary, not proving the string is a real id.\n *\n * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,\n * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,\n * fixtures, path params - until each converts. A union with `string` would restore those but makes\n * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.\n */\nexport type TEntityId = string & { readonly [entityIdBrand]: never };\n
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["export type NumberIdType = number;\nexport type StringIdType = string;\nexport type BigIntIdType = bigint;\nexport type IdType = NumberIdType | StringIdType | BigIntIdType;\n\ndeclare const entityIdBrand: unique symbol;\n\n/**\n * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id\n * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.\n *\n * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the\n * laundering VISIBLE at each boundary, not proving the string is a real id.\n *\n * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,\n * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,\n * fixtures, path params - until each converts. A union with `string` would restore those but makes\n * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.\n */\nexport type TEntityId = string & { readonly [entityIdBrand]: never };\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
1
2
|
/** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */
|
|
2
3
|
export declare class ArtifactTypes {
|
|
3
4
|
static readonly CONFIGURATION = "configuration";
|
|
@@ -10,4 +11,13 @@ export declare class ArtifactTypes {
|
|
|
10
11
|
static readonly SCHEME_SET: Set<string>;
|
|
11
12
|
static isValid(value: string): boolean;
|
|
12
13
|
}
|
|
14
|
+
/** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */
|
|
15
|
+
export declare class AuthorizeModelFormats {
|
|
16
|
+
static readonly ARRAY = "array";
|
|
17
|
+
static readonly RECORD = "record";
|
|
18
|
+
static readonly SCHEME_SET: Set<string>;
|
|
19
|
+
static isValid(value: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Valid authorize model format values. */
|
|
22
|
+
export type TAuthorizeModelFormat = TConstValue<typeof AuthorizeModelFormats>;
|
|
13
23
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,aAAa,mBAAmB;IAChD,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAQvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,iIAAiI;AACjI,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,aAAa,mBAAmB;IAChD,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAQvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,sGAAsG;AACtG,qBAAa,qBAAqB;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA8C;IAExE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArtifactTypes = void 0;
|
|
3
|
+
exports.AuthorizeModelFormats = exports.ArtifactTypes = void 0;
|
|
4
4
|
/** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */
|
|
5
5
|
class ArtifactTypes {
|
|
6
6
|
static { this.CONFIGURATION = 'configuration'; }
|
|
@@ -24,4 +24,14 @@ class ArtifactTypes {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.ArtifactTypes = ArtifactTypes;
|
|
27
|
+
/** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */
|
|
28
|
+
class AuthorizeModelFormats {
|
|
29
|
+
static { this.ARRAY = 'array'; }
|
|
30
|
+
static { this.RECORD = 'record'; }
|
|
31
|
+
static { this.SCHEME_SET = new Set([this.ARRAY, this.RECORD]); }
|
|
32
|
+
static isValid(value) {
|
|
33
|
+
return this.SCHEME_SET.has(value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AuthorizeModelFormats = AuthorizeModelFormats;
|
|
27
37
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":";;;AAEA,iIAAiI;AACjI,MAAa,aAAa;aACR,kBAAa,GAAG,eAAe,CAAC;aAChC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AArBH,sCAsBC;AAED,sGAAsG;AACtG,MAAa,qBAAqB;aAChB,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,sDASC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */\nexport class ArtifactTypes {\n static readonly CONFIGURATION = 'configuration';\n static readonly COMPONENT = 'component';\n static readonly CONTROLLER = 'controller';\n static readonly SERVICE = 'service';\n static readonly REPOSITORY = 'repository';\n static readonly DATASOURCE = 'datasource';\n static readonly MODEL = 'model';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATION,\n this.COMPONENT,\n this.CONTROLLER,\n this.SERVICE,\n this.REPOSITORY,\n this.DATASOURCE,\n this.MODEL,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */\nexport class AuthorizeModelFormats {\n static readonly ARRAY = 'array';\n static readonly RECORD = 'record';\n\n static readonly SCHEME_SET = new Set<string>([this.ARRAY, this.RECORD]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid authorize model format values. */\nexport type TAuthorizeModelFormat = TConstValue<typeof AuthorizeModelFormats>;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractEntity } from '../../../../base/models';
|
|
1
|
+
import type { AbstractEntity, TModelType } from '../../../../base/models';
|
|
2
2
|
import type { ScopeFilters, TFilter, TScopeFilterMissingBehavior, TScopeWriteGuard, TWhere } from '../../../../base/repositories';
|
|
3
3
|
import type { TClass, TNullable, TValueOrResolver } from '@venizia/ignis-helpers/common';
|
|
4
4
|
import type { IArtifactRegistrationOptions } from './artifact';
|
|
@@ -62,19 +62,6 @@ export interface IModelAccessSettings {
|
|
|
62
62
|
/** What a restricted caller may write to the scope columns. See {@link IModelAccessWriteSettings}. */
|
|
63
63
|
write?: IModelAccessWriteSettings;
|
|
64
64
|
}
|
|
65
|
-
/**
|
|
66
|
-
* The old, flat shape of {@link IModelAccessSettings}.
|
|
67
|
-
*
|
|
68
|
-
* @deprecated Use `settings.access` (`writeGuard` is `access.write.mode`, `sharedRows` is
|
|
69
|
-
* `access.write.sharedRows`). Removed in 0.4.3.
|
|
70
|
-
*/
|
|
71
|
-
export interface IScopeFilterSettings {
|
|
72
|
-
resolve: () => TNullable<TWhere> | typeof ScopeFilters.UNRESTRICTED;
|
|
73
|
-
onMissing?: TScopeFilterMissingBehavior;
|
|
74
|
-
writeGuard?: TScopeWriteGuard;
|
|
75
|
-
sharedRows?: boolean;
|
|
76
|
-
columns?: string[];
|
|
77
|
-
}
|
|
78
65
|
/** What a query runs with when it names nothing (`@model` settings.query). */
|
|
79
66
|
export interface IModelQuerySettings {
|
|
80
67
|
/** Default filter auto-applied to all repository operations. Bypassable via shouldSkipDefaultFilter. */
|
|
@@ -110,30 +97,31 @@ export interface IModelSettings {
|
|
|
110
97
|
access?: IModelAccessSettings;
|
|
111
98
|
/** Authorization settings for this model (principal name, etc.). */
|
|
112
99
|
authorize?: IModelAuthorizeSettings;
|
|
113
|
-
/** @deprecated Use `query.filter`. Removed in 0.4.3. */
|
|
114
|
-
defaultFilter?: TFilter;
|
|
115
|
-
/** @deprecated Use `access`. Removed in 0.4.3. */
|
|
116
|
-
scopeFilter?: IScopeFilterSettings;
|
|
117
|
-
/** @deprecated Use `query.limit.default`. Removed in 0.4.3. */
|
|
118
|
-
defaultLimit?: number;
|
|
119
|
-
/** @deprecated Use `query.limit.max`. Removed in 0.4.3. */
|
|
120
|
-
maxLimit?: number;
|
|
121
100
|
}
|
|
122
|
-
/**
|
|
123
|
-
export interface
|
|
124
|
-
/**
|
|
101
|
+
/** Whether tooling that reads the model registry should migrate this model (`@model({ migration })`). */
|
|
102
|
+
export interface IModelMigrationSettings {
|
|
103
|
+
/** Default `true`. `false` marks the model as one a migration tool leaves alone. IGNIS generates no migrations itself. */
|
|
104
|
+
use?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** One deprecated metadata key a model still uses, and the key that replaces it. */
|
|
107
|
+
export interface IDeprecatedModelMetadata {
|
|
125
108
|
key: string;
|
|
126
|
-
/** The key that replaces it: `query.filter`, `access.write.mode`. */
|
|
127
109
|
use: string;
|
|
128
110
|
}
|
|
129
111
|
export interface IModelMetadata extends IArtifactRegistrationOptions {
|
|
130
|
-
|
|
112
|
+
/** Optional: `ModelTypes.ENTITY` is the only value and the default. */
|
|
113
|
+
type?: TModelType;
|
|
131
114
|
tableName?: string;
|
|
115
|
+
/** Migration marker for consumer tooling that reads the public registry. */
|
|
116
|
+
migration?: IModelMigrationSettings;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Use `migration: { use: false }`. Removed in 0.4.4. On a registry entry it is
|
|
119
|
+
* derived (`!migration.use`) so tooling that reads it keeps working this release.
|
|
120
|
+
*/
|
|
132
121
|
skipMigrate?: boolean;
|
|
133
|
-
/** As the `@model` decorator stores it: normalised to the new keys; the deprecated keys are gone. */
|
|
134
122
|
settings?: IModelSettings;
|
|
135
123
|
/** Set by the decorator, read by the boot warning; not for application code. */
|
|
136
|
-
|
|
124
|
+
deprecatedMetadata?: IDeprecatedModelMetadata[];
|
|
137
125
|
}
|
|
138
126
|
export interface IEntityStatics {
|
|
139
127
|
schema?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAA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