@decaf-ts/db-decorators 0.12.0 → 0.13.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.
- package/lib/cjs/identity/decorators.cjs +5 -4
- package/lib/cjs/identity/decorators.cjs.map +1 -0
- package/lib/cjs/identity/index.cjs +1 -0
- package/lib/cjs/identity/index.cjs.map +1 -0
- package/lib/cjs/index.cjs +2 -1
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/interfaces/BulkCrudOperator.cjs +1 -0
- package/lib/cjs/interfaces/BulkCrudOperator.cjs.map +1 -0
- package/lib/cjs/interfaces/Contextual.cjs +1 -0
- package/lib/cjs/interfaces/Contextual.cjs.map +1 -0
- package/lib/cjs/interfaces/CrudOperator.cjs +1 -0
- package/lib/cjs/interfaces/CrudOperator.cjs.map +1 -0
- package/lib/cjs/interfaces/IRepository.cjs +1 -0
- package/lib/cjs/interfaces/IRepository.cjs.map +1 -0
- package/lib/cjs/interfaces/index.cjs +1 -0
- package/lib/cjs/interfaces/index.cjs.map +1 -0
- package/lib/cjs/model/constants.cjs +1 -0
- package/lib/cjs/model/constants.cjs.map +1 -0
- package/lib/cjs/model/decorators.cjs +25 -24
- package/lib/cjs/model/decorators.cjs.map +1 -0
- package/lib/cjs/model/index.cjs +1 -0
- package/lib/cjs/model/index.cjs.map +1 -0
- package/lib/cjs/model/model.cjs +1 -0
- package/lib/cjs/model/model.cjs.map +1 -0
- package/lib/cjs/model/validation.cjs +1 -0
- package/lib/cjs/model/validation.cjs.map +1 -0
- package/lib/cjs/operations/Operations.cjs +6 -5
- package/lib/cjs/operations/Operations.cjs.map +1 -0
- package/lib/cjs/operations/OperationsRegistry.cjs +1 -0
- package/lib/cjs/operations/OperationsRegistry.cjs.map +1 -0
- package/lib/cjs/operations/constants.cjs +15 -39
- package/lib/cjs/operations/constants.cjs.map +1 -0
- package/lib/cjs/operations/decorators.cjs +42 -41
- package/lib/cjs/operations/decorators.cjs.map +1 -0
- package/lib/cjs/operations/index.cjs +1 -0
- package/lib/cjs/operations/index.cjs.map +1 -0
- package/lib/cjs/operations/types.cjs +1 -0
- package/lib/cjs/operations/types.cjs.map +1 -0
- package/lib/cjs/overrides/Metadata.cjs +1 -0
- package/lib/cjs/overrides/Metadata.cjs.map +1 -0
- package/lib/cjs/overrides/Model.cjs +1 -0
- package/lib/cjs/overrides/Model.cjs.map +1 -0
- package/lib/cjs/overrides/ModelBuilderExtensions.cjs +8 -7
- package/lib/cjs/overrides/ModelBuilderExtensions.cjs.map +1 -0
- package/lib/cjs/overrides/index.cjs +1 -0
- package/lib/cjs/overrides/index.cjs.map +1 -0
- package/lib/cjs/overrides/overrides.cjs +21 -20
- package/lib/cjs/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/repository/Context.cjs +3 -2
- package/lib/cjs/repository/Context.cjs.map +1 -0
- package/lib/cjs/repository/Repository.cjs +42 -41
- package/lib/cjs/repository/Repository.cjs.map +1 -0
- package/lib/cjs/repository/constants.cjs +1 -0
- package/lib/cjs/repository/constants.cjs.map +1 -0
- package/lib/cjs/repository/errors.cjs +1 -0
- package/lib/cjs/repository/errors.cjs.map +1 -0
- package/lib/cjs/repository/index.cjs +1 -0
- package/lib/cjs/repository/index.cjs.map +1 -0
- package/lib/cjs/repository/types.cjs +1 -0
- package/lib/cjs/repository/types.cjs.map +1 -0
- package/lib/cjs/repository/utils.cjs +10 -9
- package/lib/cjs/repository/utils.cjs.map +1 -0
- package/lib/cjs/repository/wrappers.cjs +8 -7
- package/lib/cjs/repository/wrappers.cjs.map +1 -0
- package/lib/cjs/validation/constants.cjs +4 -3
- package/lib/cjs/validation/constants.cjs.map +1 -0
- package/lib/cjs/validation/decorators.cjs +22 -21
- package/lib/cjs/validation/decorators.cjs.map +1 -0
- package/lib/cjs/validation/index.cjs +1 -0
- package/lib/cjs/validation/index.cjs.map +1 -0
- package/lib/cjs/validation/validation.cjs +3 -2
- package/lib/cjs/validation/validation.cjs.map +1 -0
- package/lib/cjs/validation/validators/ReadOnlyValidator.cjs +14 -8
- package/lib/cjs/validation/validators/ReadOnlyValidator.cjs.map +1 -0
- package/lib/cjs/validation/validators/TimestampValidator.cjs +14 -8
- package/lib/cjs/validation/validators/TimestampValidator.cjs.map +1 -0
- package/lib/cjs/validation/validators/UpdateValidator.cjs +1 -0
- package/lib/cjs/validation/validators/UpdateValidator.cjs.map +1 -0
- package/lib/cjs/validation/validators/index.cjs +1 -0
- package/lib/cjs/validation/validators/index.cjs.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/types/identity/decorators.d.cts +8 -0
- package/lib/types/identity/decorators.d.mts +8 -0
- package/lib/types/identity/index.d.cts +6 -0
- package/lib/types/identity/index.d.mts +6 -0
- package/lib/types/index.d.cts +15 -0
- package/lib/types/index.d.mts +15 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/interfaces/BulkCrudOperator.d.cts +47 -0
- package/lib/types/interfaces/BulkCrudOperator.d.mts +47 -0
- package/lib/types/interfaces/Contextual.d.cts +23 -0
- package/lib/types/interfaces/Contextual.d.mts +23 -0
- package/lib/types/interfaces/CrudOperator.d.cts +46 -0
- package/lib/types/interfaces/CrudOperator.d.mts +46 -0
- package/lib/types/interfaces/IRepository.d.cts +19 -0
- package/lib/types/interfaces/IRepository.d.mts +19 -0
- package/lib/types/interfaces/index.d.cts +9 -0
- package/lib/types/interfaces/index.d.mts +9 -0
- package/lib/types/model/constants.d.cts +37 -0
- package/lib/types/model/constants.d.mts +37 -0
- package/lib/types/model/decorators.d.cts +145 -0
- package/lib/types/model/decorators.d.mts +145 -0
- package/lib/types/model/index.d.cts +9 -0
- package/lib/types/model/index.d.mts +9 -0
- package/lib/types/model/model.d.cts +6 -0
- package/lib/types/model/model.d.mts +6 -0
- package/lib/types/model/validation.d.cts +57 -0
- package/lib/types/model/validation.d.mts +57 -0
- package/lib/types/operations/Operations.d.cts +80 -0
- package/lib/types/operations/Operations.d.mts +80 -0
- package/lib/types/operations/OperationsRegistry.d.cts +72 -0
- package/lib/types/operations/OperationsRegistry.d.mts +72 -0
- package/lib/types/operations/constants.d.cts +106 -0
- package/lib/types/operations/constants.d.mts +106 -0
- package/lib/types/operations/decorators.d.cts +348 -0
- package/lib/types/operations/decorators.d.mts +348 -0
- package/lib/types/operations/index.d.cts +10 -0
- package/lib/types/operations/index.d.mts +10 -0
- package/lib/types/operations/types.d.cts +60 -0
- package/lib/types/operations/types.d.mts +60 -0
- package/lib/types/overrides/Metadata.d.cts +54 -0
- package/lib/types/overrides/Metadata.d.mts +54 -0
- package/lib/types/overrides/Model.d.cts +84 -0
- package/lib/types/overrides/Model.d.mts +84 -0
- package/lib/types/overrides/ModelBuilderExtensions.d.cts +15 -0
- package/lib/types/overrides/ModelBuilderExtensions.d.mts +15 -0
- package/lib/types/overrides/index.d.cts +10 -0
- package/lib/types/overrides/index.d.mts +10 -0
- package/lib/types/overrides/overrides.d.cts +1 -0
- package/lib/types/overrides/overrides.d.mts +1 -0
- package/lib/types/repository/Context.d.cts +112 -0
- package/lib/types/repository/Context.d.mts +112 -0
- package/lib/types/repository/Repository.d.cts +352 -0
- package/lib/types/repository/Repository.d.mts +352 -0
- package/lib/types/repository/constants.d.cts +9 -0
- package/lib/types/repository/constants.d.mts +9 -0
- package/lib/types/repository/errors.d.cts +126 -0
- package/lib/types/repository/errors.d.mts +126 -0
- package/lib/types/repository/index.d.cts +12 -0
- package/lib/types/repository/index.d.mts +12 -0
- package/lib/types/repository/types.d.cts +62 -0
- package/lib/types/repository/types.d.mts +62 -0
- package/lib/types/repository/utils.d.cts +34 -0
- package/lib/types/repository/utils.d.mts +34 -0
- package/lib/types/repository/wrappers.d.cts +39 -0
- package/lib/types/repository/wrappers.d.mts +39 -0
- package/lib/types/validation/constants.d.cts +45 -0
- package/lib/types/validation/constants.d.mts +45 -0
- package/lib/types/validation/decorators.d.cts +143 -0
- package/lib/types/validation/decorators.d.mts +143 -0
- package/lib/types/validation/index.d.cts +4 -0
- package/lib/types/validation/index.d.mts +4 -0
- package/lib/types/validation/validation.d.cts +41 -0
- package/lib/types/validation/validation.d.mts +41 -0
- package/lib/types/validation/validators/ReadOnlyValidator.d.cts +47 -0
- package/lib/types/validation/validators/ReadOnlyValidator.d.mts +47 -0
- package/lib/types/validation/validators/TimestampValidator.d.cts +48 -0
- package/lib/types/validation/validators/TimestampValidator.d.mts +48 -0
- package/lib/types/validation/validators/UpdateValidator.d.cts +40 -0
- package/lib/types/validation/validators/UpdateValidator.d.mts +40 -0
- package/lib/types/validation/validators/index.d.cts +3 -0
- package/lib/types/validation/validators/index.d.mts +3 -0
- package/package.json +4 -4
- package/lib/cjs/identity/decorators.js.map +0 -1
- package/lib/cjs/identity/index.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/BulkCrudOperator.js.map +0 -1
- package/lib/cjs/interfaces/Contextual.js.map +0 -1
- package/lib/cjs/interfaces/CrudOperator.js.map +0 -1
- package/lib/cjs/interfaces/IRepository.js.map +0 -1
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/model/constants.js.map +0 -1
- package/lib/cjs/model/decorators.js.map +0 -1
- package/lib/cjs/model/index.js.map +0 -1
- package/lib/cjs/model/model.js.map +0 -1
- package/lib/cjs/model/validation.js.map +0 -1
- package/lib/cjs/operations/Operations.js.map +0 -1
- package/lib/cjs/operations/OperationsRegistry.js.map +0 -1
- package/lib/cjs/operations/constants.js.map +0 -1
- package/lib/cjs/operations/decorators.js.map +0 -1
- package/lib/cjs/operations/index.js.map +0 -1
- package/lib/cjs/operations/types.js.map +0 -1
- package/lib/cjs/overrides/Metadata.js.map +0 -1
- package/lib/cjs/overrides/Model.js.map +0 -1
- package/lib/cjs/overrides/ModelBuilderExtensions.js.map +0 -1
- package/lib/cjs/overrides/index.js.map +0 -1
- package/lib/cjs/overrides/overrides.js.map +0 -1
- package/lib/cjs/repository/Context.js.map +0 -1
- package/lib/cjs/repository/Repository.js.map +0 -1
- package/lib/cjs/repository/constants.js.map +0 -1
- package/lib/cjs/repository/errors.js.map +0 -1
- package/lib/cjs/repository/index.js.map +0 -1
- package/lib/cjs/repository/types.js.map +0 -1
- package/lib/cjs/repository/utils.js.map +0 -1
- package/lib/cjs/repository/wrappers.js.map +0 -1
- package/lib/cjs/validation/constants.js.map +0 -1
- package/lib/cjs/validation/decorators.js.map +0 -1
- package/lib/cjs/validation/index.js.map +0 -1
- package/lib/cjs/validation/validation.js.map +0 -1
- package/lib/cjs/validation/validators/ReadOnlyValidator.js.map +0 -1
- package/lib/cjs/validation/validators/TimestampValidator.js.map +0 -1
- package/lib/cjs/validation/validators/UpdateValidator.js.map +0 -1
- package/lib/cjs/validation/validators/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["validation.js"],"names":[],"mappings":";;AAAA,yEAA6D;AAC7D,iDAAsD;AACtD;;;;;;;GAOG;AACH,iCAAU,CAAC,SAAS,GAAG,UAAU,GAAG;IAChC,OAAO,mCAAoB,CAAC,OAAO,GAAG,GAAG,CAAC;AAC9C,CAAC,CAAC;AACF,sCAAsC"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadOnlyValidator = void 0;
|
|
2
4
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
5
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
-
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else
|
|
9
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
10
|
+
if (d = decorators[i])
|
|
11
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
12
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
13
|
};
|
|
8
14
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
16
|
+
return Reflect.metadata(k, v);
|
|
10
17
|
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ReadOnlyValidator = void 0;
|
|
13
18
|
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
-
const
|
|
19
|
+
const constants_js_1 = require("./../constants.cjs");
|
|
15
20
|
const decorator_validation_2 = require("@decaf-ts/decorator-validation");
|
|
16
21
|
/**
|
|
17
22
|
* @description A validator that ensures properties marked as readonly cannot be modified during updates.
|
|
@@ -41,7 +46,7 @@ const decorator_validation_2 = require("@decaf-ts/decorator-validation");
|
|
|
41
46
|
*/
|
|
42
47
|
let ReadOnlyValidator = class ReadOnlyValidator extends decorator_validation_1.Validator {
|
|
43
48
|
constructor() {
|
|
44
|
-
super(
|
|
49
|
+
super(constants_js_1.DEFAULT_ERROR_MESSAGES.READONLY.INVALID);
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* @description Implementation of the base validator's hasErrors method.
|
|
@@ -72,7 +77,8 @@ let ReadOnlyValidator = class ReadOnlyValidator extends decorator_validation_1.V
|
|
|
72
77
|
};
|
|
73
78
|
exports.ReadOnlyValidator = ReadOnlyValidator;
|
|
74
79
|
exports.ReadOnlyValidator = ReadOnlyValidator = __decorate([
|
|
75
|
-
(0, decorator_validation_1.validator)(
|
|
80
|
+
(0, decorator_validation_1.validator)(constants_js_1.UpdateValidationKeys.READONLY),
|
|
76
81
|
__metadata("design:paramtypes", [])
|
|
77
82
|
], ReadOnlyValidator);
|
|
83
|
+
//# sourceMappingURL=ReadOnlyValidator.js.map
|
|
78
84
|
//# sourceMappingURL=ReadO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|
2
4
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
5
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5
|
-
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else
|
|
9
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
10
|
+
if (d = decorators[i])
|
|
11
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
12
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
13
|
};
|
|
8
14
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
16
|
+
return Reflect.metadata(k, v);
|
|
10
17
|
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TimestampValidator = void 0;
|
|
13
18
|
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
-
const
|
|
19
|
+
const constants_js_1 = require("./../constants.cjs");
|
|
15
20
|
/**
|
|
16
21
|
* @description A validator that ensures timestamp values are only updated with newer timestamps.
|
|
17
22
|
* @summary Validates the update of a timestamp by comparing the new timestamp with the old one, ensuring the new timestamp is more recent.
|
|
@@ -41,7 +46,7 @@ const constants_1 = require("./../constants.cjs");
|
|
|
41
46
|
*/
|
|
42
47
|
let TimestampValidator = class TimestampValidator extends decorator_validation_1.Validator {
|
|
43
48
|
constructor() {
|
|
44
|
-
super(
|
|
49
|
+
super(constants_js_1.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID);
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* @description Implementation of the base validator's hasErrors method.
|
|
@@ -79,7 +84,8 @@ let TimestampValidator = class TimestampValidator extends decorator_validation_1
|
|
|
79
84
|
};
|
|
80
85
|
exports.TimestampValidator = TimestampValidator;
|
|
81
86
|
exports.TimestampValidator = TimestampValidator = __decorate([
|
|
82
|
-
(0, decorator_validation_1.validator)(
|
|
87
|
+
(0, decorator_validation_1.validator)(constants_js_1.UpdateValidationKeys.TIMESTAMP),
|
|
83
88
|
__metadata("design:paramtypes", [])
|
|
84
89
|
], TimestampValidator);
|
|
90
|
+
//# sourceMappingURL=TimestampValidator.js.map
|
|
85
91
|
//# sourceMappingURL=TimestampValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimestampValidator.js","sourceRoot":"","sources":["TimestampValidator.js"],"names":[],"mappings":";;;AAAA,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI;IACjF,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7H,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU;QAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;;QAC1H,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;gBAAE,CAAC,GAA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AK,CAAC,CAAC;YACxB,QAAQ,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,6DAA6D;QACjE,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACP,OAAO,OAAO,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ,CAAC;AAKO,gDAAkB;AAJ3B,6BAAA,kBAAkB,GAAG,UAAU,CAAC;IAC5B,IAAA,gCAAS,EAAC,mCAAoB,CAAC,SAAS,CAAC;IACzC,UAAU,CAAC,mBAAmB,EAAE,EAAE,CAAC;CACtC,EAAE,kBAAkB,CAAC,CAAC;AAEvB,8CAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateValidator.js","sourceRoot":"","sources":["UpdateValidator.js"],"names":[],"mappings":";;;AAAA,yEAAyG;AACzG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,eAAgB,SAAQ,gCAAS;IAC1C,YAAY,OAAO,GAAG,6CAAiB,CAAC,OAAO,EAAE,GAAG,aAAa;QAC7D,KAAK,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,CAAC;IACrC,CAAC;CACJ;AAJD,0CAIC;AACD,2CAA2C"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ReadOnlyValidator.cjs"), exports);
|
|
18
18
|
__exportStar(require("./TimestampValidator.cjs"), exports);
|
|
19
19
|
__exportStar(require("./UpdateValidator.cjs"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,0DAAwC;AACxC,uDAAqC;AACrC,iCAAiC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export * from "./validation/index.js";
|
|
|
17
17
|
* @const VERSION
|
|
18
18
|
* @memberOf module:db-decorators
|
|
19
19
|
*/
|
|
20
|
-
export const VERSION = "0.
|
|
20
|
+
export const VERSION = "0.12.0";
|
|
21
21
|
export const PACKAGE_NAME = "@decaf-ts/db-decorators";
|
|
22
22
|
Metadata.registerLibrary(PACKAGE_NAME, VERSION);
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Decorator that marks a property as an ID field
|
|
3
|
+
* @summary Creates a composite decorator that marks a property as required, readonly, and as the ID field for database operations
|
|
4
|
+
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
5
|
+
* @function id
|
|
6
|
+
* @category Property Decorators
|
|
7
|
+
*/
|
|
8
|
+
export declare function id(): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Decorator that marks a property as an ID field
|
|
3
|
+
* @summary Creates a composite decorator that marks a property as required, readonly, and as the ID field for database operations
|
|
4
|
+
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
5
|
+
* @function id
|
|
6
|
+
* @category Property Decorators
|
|
7
|
+
*/
|
|
8
|
+
export declare function id(): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./identity/index.cjs";
|
|
2
|
+
export * from "./interfaces/index.cjs";
|
|
3
|
+
export * from "./model/index.cjs";
|
|
4
|
+
export * from "./operations/index.cjs";
|
|
5
|
+
export * from "./overrides/index.cjs";
|
|
6
|
+
export * from "./repository/index.cjs";
|
|
7
|
+
export * from "./validation/index.cjs";
|
|
8
|
+
/**
|
|
9
|
+
* @description Current version of the reflection package
|
|
10
|
+
* @summary Stores the semantic version number of the package
|
|
11
|
+
* @const VERSION
|
|
12
|
+
* @memberOf module:db-decorators
|
|
13
|
+
*/
|
|
14
|
+
export declare const VERSION = "0.12.0";
|
|
15
|
+
export declare const PACKAGE_NAME = "@decaf-ts/db-decorators";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./identity/index.js";
|
|
2
|
+
export * from "./interfaces/index.js";
|
|
3
|
+
export * from "./model/index.js";
|
|
4
|
+
export * from "./operations/index.js";
|
|
5
|
+
export * from "./overrides/index.js";
|
|
6
|
+
export * from "./repository/index.js";
|
|
7
|
+
export * from "./validation/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* @description Current version of the reflection package
|
|
10
|
+
* @summary Stores the semantic version number of the package
|
|
11
|
+
* @const VERSION
|
|
12
|
+
* @memberOf module:db-decorators
|
|
13
|
+
*/
|
|
14
|
+
export declare const VERSION = "0.12.0";
|
|
15
|
+
export declare const PACKAGE_NAME = "@decaf-ts/db-decorators";
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CrudOperator } from "./CrudOperator.cjs";
|
|
2
|
+
import { PrimaryKeyType } from "../repository/index.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* @description Interface for bulk CRUD operations
|
|
5
|
+
* @summary Extends the basic CRUD operations to support bulk operations on multiple models at once
|
|
6
|
+
* @template M - The model type
|
|
7
|
+
* @interface BulkCrudOperator
|
|
8
|
+
* @memberOf module:db-decorators
|
|
9
|
+
*/
|
|
10
|
+
export interface BulkCrudOperator<M> extends CrudOperator<M> {
|
|
11
|
+
/**
|
|
12
|
+
* @description Creates multiple model instances in the database
|
|
13
|
+
* @summary Bulk operation to create multiple models at once
|
|
14
|
+
* @template M - The model type
|
|
15
|
+
* @param {M[]} models - Array of model instances to create
|
|
16
|
+
* @param {...any[]} args - Additional arguments
|
|
17
|
+
* @return {Promise<M[]>} Promise resolving to the created model instances
|
|
18
|
+
*/
|
|
19
|
+
createAll(models: M[], ...args: any[]): Promise<M[]>;
|
|
20
|
+
/**
|
|
21
|
+
* @description Retrieves multiple model instances from the database by their keys
|
|
22
|
+
* @summary Bulk operation to read multiple models at once
|
|
23
|
+
* @template M - The model type
|
|
24
|
+
* @param {(PrimaryKeyType[])} keys - Array of primary keys to retrieve
|
|
25
|
+
* @param {...any[]} args - Additional arguments
|
|
26
|
+
* @return {Promise<M[]>} Promise resolving to the retrieved model instances
|
|
27
|
+
*/
|
|
28
|
+
readAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
|
|
29
|
+
/**
|
|
30
|
+
* @description Updates multiple model instances in the database
|
|
31
|
+
* @summary Bulk operation to update multiple models at once
|
|
32
|
+
* @template M - The model type
|
|
33
|
+
* @param {M[]} models - Array of model instances to update
|
|
34
|
+
* @param {...any[]} args - Additional arguments
|
|
35
|
+
* @return {Promise<M[]>} Promise resolving to the updated model instances
|
|
36
|
+
*/
|
|
37
|
+
updateAll(models: M[], ...args: any[]): Promise<M[]>;
|
|
38
|
+
/**
|
|
39
|
+
* @description Deletes multiple model instances from the database by their keys
|
|
40
|
+
* @summary Bulk operation to delete multiple models at once
|
|
41
|
+
* @template M - The model type
|
|
42
|
+
* @param {(PrimaryKeyType[])} keys - Array of primary keys to delete
|
|
43
|
+
* @param {...any[]} args - Additional arguments
|
|
44
|
+
* @return {Promise<M[]>} Promise resolving to the deleted model instances
|
|
45
|
+
*/
|
|
46
|
+
deleteAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CrudOperator } from "./CrudOperator.js";
|
|
2
|
+
import { PrimaryKeyType } from "../repository/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* @description Interface for bulk CRUD operations
|
|
5
|
+
* @summary Extends the basic CRUD operations to support bulk operations on multiple models at once
|
|
6
|
+
* @template M - The model type
|
|
7
|
+
* @interface BulkCrudOperator
|
|
8
|
+
* @memberOf module:db-decorators
|
|
9
|
+
*/
|
|
10
|
+
export interface BulkCrudOperator<M> extends CrudOperator<M> {
|
|
11
|
+
/**
|
|
12
|
+
* @description Creates multiple model instances in the database
|
|
13
|
+
* @summary Bulk operation to create multiple models at once
|
|
14
|
+
* @template M - The model type
|
|
15
|
+
* @param {M[]} models - Array of model instances to create
|
|
16
|
+
* @param {...any[]} args - Additional arguments
|
|
17
|
+
* @return {Promise<M[]>} Promise resolving to the created model instances
|
|
18
|
+
*/
|
|
19
|
+
createAll(models: M[], ...args: any[]): Promise<M[]>;
|
|
20
|
+
/**
|
|
21
|
+
* @description Retrieves multiple model instances from the database by their keys
|
|
22
|
+
* @summary Bulk operation to read multiple models at once
|
|
23
|
+
* @template M - The model type
|
|
24
|
+
* @param {(PrimaryKeyType[])} keys - Array of primary keys to retrieve
|
|
25
|
+
* @param {...any[]} args - Additional arguments
|
|
26
|
+
* @return {Promise<M[]>} Promise resolving to the retrieved model instances
|
|
27
|
+
*/
|
|
28
|
+
readAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
|
|
29
|
+
/**
|
|
30
|
+
* @description Updates multiple model instances in the database
|
|
31
|
+
* @summary Bulk operation to update multiple models at once
|
|
32
|
+
* @template M - The model type
|
|
33
|
+
* @param {M[]} models - Array of model instances to update
|
|
34
|
+
* @param {...any[]} args - Additional arguments
|
|
35
|
+
* @return {Promise<M[]>} Promise resolving to the updated model instances
|
|
36
|
+
*/
|
|
37
|
+
updateAll(models: M[], ...args: any[]): Promise<M[]>;
|
|
38
|
+
/**
|
|
39
|
+
* @description Deletes multiple model instances from the database by their keys
|
|
40
|
+
* @summary Bulk operation to delete multiple models at once
|
|
41
|
+
* @template M - The model type
|
|
42
|
+
* @param {(PrimaryKeyType[])} keys - Array of primary keys to delete
|
|
43
|
+
* @param {...any[]} args - Additional arguments
|
|
44
|
+
* @return {Promise<M[]>} Promise resolving to the deleted model instances
|
|
45
|
+
*/
|
|
46
|
+
deleteAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OperationKeys } from "../operations/index.cjs";
|
|
2
|
+
import { Context } from "../repository/index.cjs";
|
|
3
|
+
export type FlagsOf<C extends Context<any>> = C extends Context<infer T> ? T : never;
|
|
4
|
+
/**
|
|
5
|
+
* @description Interface for context-aware operations
|
|
6
|
+
* @summary Provides context management for database operations
|
|
7
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
8
|
+
* @template C - Type extending Context<F>, defaults to Context<F>
|
|
9
|
+
* @interface Contextual
|
|
10
|
+
* @memberOf module:db-decorators
|
|
11
|
+
*/
|
|
12
|
+
export interface Contextual<C extends Context<any> = Context<any>> {
|
|
13
|
+
/**
|
|
14
|
+
* @description Creates a context for a specific operation
|
|
15
|
+
* @summary Generates an operation-specific context with custom flags
|
|
16
|
+
* @param {(OperationKeys.CREATE|OperationKeys.READ|OperationKeys.UPDATE|OperationKeys.DELETE)} operation - The operation type
|
|
17
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
18
|
+
* @param {Partial<F>} overrides - Custom flag overrides for this context
|
|
19
|
+
* @param {...any[]} args - Additional arguments
|
|
20
|
+
* @return {Promise<C>} Promise resolving to the created context
|
|
21
|
+
*/
|
|
22
|
+
context(operation: ((...args: any[]) => any) | OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FlagsOf<C>>, ...args: any[]): Promise<C>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OperationKeys } from "../operations/index.js";
|
|
2
|
+
import { Context } from "../repository/index.js";
|
|
3
|
+
export type FlagsOf<C extends Context<any>> = C extends Context<infer T> ? T : never;
|
|
4
|
+
/**
|
|
5
|
+
* @description Interface for context-aware operations
|
|
6
|
+
* @summary Provides context management for database operations
|
|
7
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
8
|
+
* @template C - Type extending Context<F>, defaults to Context<F>
|
|
9
|
+
* @interface Contextual
|
|
10
|
+
* @memberOf module:db-decorators
|
|
11
|
+
*/
|
|
12
|
+
export interface Contextual<C extends Context<any> = Context<any>> {
|
|
13
|
+
/**
|
|
14
|
+
* @description Creates a context for a specific operation
|
|
15
|
+
* @summary Generates an operation-specific context with custom flags
|
|
16
|
+
* @param {(OperationKeys.CREATE|OperationKeys.READ|OperationKeys.UPDATE|OperationKeys.DELETE)} operation - The operation type
|
|
17
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
18
|
+
* @param {Partial<F>} overrides - Custom flag overrides for this context
|
|
19
|
+
* @param {...any[]} args - Additional arguments
|
|
20
|
+
* @return {Promise<C>} Promise resolving to the created context
|
|
21
|
+
*/
|
|
22
|
+
context(operation: ((...args: any[]) => any) | OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FlagsOf<C>>, ...args: any[]): Promise<C>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PrimaryKeyType } from "../repository/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* @description Basic CRUD operations interface
|
|
4
|
+
* @summary Exposes a standard Create, Read, Update, Delete API for database operations
|
|
5
|
+
* @template M - The model type
|
|
6
|
+
* @interface CrudOperator
|
|
7
|
+
* @memberOf module:db-decorators
|
|
8
|
+
*/
|
|
9
|
+
export interface CrudOperator<M> {
|
|
10
|
+
/**
|
|
11
|
+
* @description Creates a new model instance in the database
|
|
12
|
+
* @summary Create a new model
|
|
13
|
+
* @template M - The model type
|
|
14
|
+
* @param {M} model - The model instance to create
|
|
15
|
+
* @param {...any[]} args - Additional arguments
|
|
16
|
+
* @return {Promise<M>} Promise resolving to the created model instance
|
|
17
|
+
*/
|
|
18
|
+
create(model: M, ...args: any[]): Promise<M>;
|
|
19
|
+
/**
|
|
20
|
+
* @description Retrieves a model instance from the database by its key
|
|
21
|
+
* @summary Read a model
|
|
22
|
+
* @template M - The model type
|
|
23
|
+
* @param {PrimaryKeyType} key - The primary key of the model to retrieve
|
|
24
|
+
* @param {...any[]} args - Additional arguments
|
|
25
|
+
* @return {Promise<M>} Promise resolving to the retrieved model instance
|
|
26
|
+
*/
|
|
27
|
+
read(key: PrimaryKeyType, ...args: any[]): Promise<M>;
|
|
28
|
+
/**
|
|
29
|
+
* @description Updates a model instance in the database
|
|
30
|
+
* @summary Update a model
|
|
31
|
+
* @template M - The model type
|
|
32
|
+
* @param {M} model - The model instance to update
|
|
33
|
+
* @param {...any[]} args - Additional arguments
|
|
34
|
+
* @return {Promise<M>} Promise resolving to the updated model instance
|
|
35
|
+
*/
|
|
36
|
+
update(model: M, ...args: any[]): Promise<M>;
|
|
37
|
+
/**
|
|
38
|
+
* @description Deletes a model instance from the database by its key
|
|
39
|
+
* @summary Delete a model
|
|
40
|
+
* @template M - The model type
|
|
41
|
+
* @param {PrimaryKeyType} key - The primary key of the model to delete
|
|
42
|
+
* @param {...any[]} args - Additional arguments
|
|
43
|
+
* @return {Promise<M>} Promise resolving to the deleted model instance
|
|
44
|
+
*/
|
|
45
|
+
delete(key: PrimaryKeyType, ...args: any[]): Promise<M>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PrimaryKeyType } from "../repository/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @description Basic CRUD operations interface
|
|
4
|
+
* @summary Exposes a standard Create, Read, Update, Delete API for database operations
|
|
5
|
+
* @template M - The model type
|
|
6
|
+
* @interface CrudOperator
|
|
7
|
+
* @memberOf module:db-decorators
|
|
8
|
+
*/
|
|
9
|
+
export interface CrudOperator<M> {
|
|
10
|
+
/**
|
|
11
|
+
* @description Creates a new model instance in the database
|
|
12
|
+
* @summary Create a new model
|
|
13
|
+
* @template M - The model type
|
|
14
|
+
* @param {M} model - The model instance to create
|
|
15
|
+
* @param {...any[]} args - Additional arguments
|
|
16
|
+
* @return {Promise<M>} Promise resolving to the created model instance
|
|
17
|
+
*/
|
|
18
|
+
create(model: M, ...args: any[]): Promise<M>;
|
|
19
|
+
/**
|
|
20
|
+
* @description Retrieves a model instance from the database by its key
|
|
21
|
+
* @summary Read a model
|
|
22
|
+
* @template M - The model type
|
|
23
|
+
* @param {PrimaryKeyType} key - The primary key of the model to retrieve
|
|
24
|
+
* @param {...any[]} args - Additional arguments
|
|
25
|
+
* @return {Promise<M>} Promise resolving to the retrieved model instance
|
|
26
|
+
*/
|
|
27
|
+
read(key: PrimaryKeyType, ...args: any[]): Promise<M>;
|
|
28
|
+
/**
|
|
29
|
+
* @description Updates a model instance in the database
|
|
30
|
+
* @summary Update a model
|
|
31
|
+
* @template M - The model type
|
|
32
|
+
* @param {M} model - The model instance to update
|
|
33
|
+
* @param {...any[]} args - Additional arguments
|
|
34
|
+
* @return {Promise<M>} Promise resolving to the updated model instance
|
|
35
|
+
*/
|
|
36
|
+
update(model: M, ...args: any[]): Promise<M>;
|
|
37
|
+
/**
|
|
38
|
+
* @description Deletes a model instance from the database by its key
|
|
39
|
+
* @summary Delete a model
|
|
40
|
+
* @template M - The model type
|
|
41
|
+
* @param {PrimaryKeyType} key - The primary key of the model to delete
|
|
42
|
+
* @param {...any[]} args - Additional arguments
|
|
43
|
+
* @return {Promise<M>} Promise resolving to the deleted model instance
|
|
44
|
+
*/
|
|
45
|
+
delete(key: PrimaryKeyType, ...args: any[]): Promise<M>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { BulkCrudOperator } from "./BulkCrudOperator.cjs";
|
|
3
|
+
import { Context, RepositoryFlags } from "../repository/index.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* @description Repository interface for database operations
|
|
6
|
+
* @summary Interface holding basic CRUD APIs for database models, providing standard operations and metadata
|
|
7
|
+
* @template M - Type extending Model
|
|
8
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
9
|
+
* @template C - Type extending Context<F>, defaults to Context<F>
|
|
10
|
+
* @interface IRepository
|
|
11
|
+
* @memberOf module:db-decorators
|
|
12
|
+
*/
|
|
13
|
+
export interface IRepository<M extends Model<boolean>, C extends Context<any> = Context<RepositoryFlags>> extends BulkCrudOperator<M> {
|
|
14
|
+
/**
|
|
15
|
+
* @description The constructor of the model class
|
|
16
|
+
* @summary Reference to the model class constructor used to create new instances
|
|
17
|
+
*/
|
|
18
|
+
readonly class: ModelConstructor<M>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { BulkCrudOperator } from "./BulkCrudOperator.js";
|
|
3
|
+
import { Context, RepositoryFlags } from "../repository/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* @description Repository interface for database operations
|
|
6
|
+
* @summary Interface holding basic CRUD APIs for database models, providing standard operations and metadata
|
|
7
|
+
* @template M - Type extending Model
|
|
8
|
+
* @template F - Type extending RepositoryFlags, defaults to RepositoryFlags
|
|
9
|
+
* @template C - Type extending Context<F>, defaults to Context<F>
|
|
10
|
+
* @interface IRepository
|
|
11
|
+
* @memberOf module:db-decorators
|
|
12
|
+
*/
|
|
13
|
+
export interface IRepository<M extends Model<boolean>, C extends Context<any> = Context<RepositoryFlags>> extends BulkCrudOperator<M> {
|
|
14
|
+
/**
|
|
15
|
+
* @description The constructor of the model class
|
|
16
|
+
* @summary Reference to the model class constructor used to create new instances
|
|
17
|
+
*/
|
|
18
|
+
readonly class: ModelConstructor<M>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the interfaces module.
|
|
3
|
+
* @summary This file exports all the necessary components for the interfaces functionality, including BulkCrudOperator, Contextual, CrudOperator, and IRepository.
|
|
4
|
+
* @module db-decorators/interfaces
|
|
5
|
+
*/
|
|
6
|
+
export * from "./BulkCrudOperator.cjs";
|
|
7
|
+
export * from "./Contextual.cjs";
|
|
8
|
+
export * from "./CrudOperator.cjs";
|
|
9
|
+
export * from "./IRepository.cjs";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the interfaces module.
|
|
3
|
+
* @summary This file exports all the necessary components for the interfaces functionality, including BulkCrudOperator, Contextual, CrudOperator, and IRepository.
|
|
4
|
+
* @module db-decorators/interfaces
|
|
5
|
+
*/
|
|
6
|
+
export * from "./BulkCrudOperator.js";
|
|
7
|
+
export * from "./Contextual.js";
|
|
8
|
+
export * from "./CrudOperator.js";
|
|
9
|
+
export * from "./IRepository.js";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Database reflection keys
|
|
3
|
+
* @summary Collection of keys used for reflection metadata in database operations
|
|
4
|
+
* @const DBKeys
|
|
5
|
+
* @memberOf module:db-decorators
|
|
6
|
+
*/
|
|
7
|
+
export declare const DBKeys: {
|
|
8
|
+
REFLECT: string;
|
|
9
|
+
REPOSITORY: string;
|
|
10
|
+
CLASS: string;
|
|
11
|
+
ID: string;
|
|
12
|
+
INDEX: string;
|
|
13
|
+
UNIQUE: string;
|
|
14
|
+
SERIALIZE: string;
|
|
15
|
+
READONLY: string;
|
|
16
|
+
TIMESTAMP: string;
|
|
17
|
+
TRANSIENT: string;
|
|
18
|
+
HASH: string;
|
|
19
|
+
COMPOSED: string;
|
|
20
|
+
GENERATED: string;
|
|
21
|
+
VERSION: string;
|
|
22
|
+
ORIGINAL: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @description Default separator character for composite indexes
|
|
26
|
+
* @summary The default separator character used when concatenating multiple fields into a single index
|
|
27
|
+
* @const DefaultSeparator
|
|
28
|
+
* @memberOf module:db-decorators
|
|
29
|
+
*/
|
|
30
|
+
export declare const DefaultSeparator = "_";
|
|
31
|
+
/**
|
|
32
|
+
* @description Default format for timestamp fields
|
|
33
|
+
* @summary Standard date format string used for timestamp fields in database models
|
|
34
|
+
* @const DEFAULT_TIMESTAMP_FORMAT
|
|
35
|
+
* @memberOf module:db-decorators
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:S";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Database reflection keys
|
|
3
|
+
* @summary Collection of keys used for reflection metadata in database operations
|
|
4
|
+
* @const DBKeys
|
|
5
|
+
* @memberOf module:db-decorators
|
|
6
|
+
*/
|
|
7
|
+
export declare const DBKeys: {
|
|
8
|
+
REFLECT: string;
|
|
9
|
+
REPOSITORY: string;
|
|
10
|
+
CLASS: string;
|
|
11
|
+
ID: string;
|
|
12
|
+
INDEX: string;
|
|
13
|
+
UNIQUE: string;
|
|
14
|
+
SERIALIZE: string;
|
|
15
|
+
READONLY: string;
|
|
16
|
+
TIMESTAMP: string;
|
|
17
|
+
TRANSIENT: string;
|
|
18
|
+
HASH: string;
|
|
19
|
+
COMPOSED: string;
|
|
20
|
+
GENERATED: string;
|
|
21
|
+
VERSION: string;
|
|
22
|
+
ORIGINAL: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @description Default separator character for composite indexes
|
|
26
|
+
* @summary The default separator character used when concatenating multiple fields into a single index
|
|
27
|
+
* @const DefaultSeparator
|
|
28
|
+
* @memberOf module:db-decorators
|
|
29
|
+
*/
|
|
30
|
+
export declare const DefaultSeparator = "_";
|
|
31
|
+
/**
|
|
32
|
+
* @description Default format for timestamp fields
|
|
33
|
+
* @summary Standard date format string used for timestamp fields in database models
|
|
34
|
+
* @const DEFAULT_TIMESTAMP_FORMAT
|
|
35
|
+
* @memberOf module:db-decorators
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:S";
|