@decaf-ts/core 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -157
- package/README.md +652 -15
- package/dist/core.cjs +2110 -132
- package/dist/core.esm.cjs +2111 -133
- package/lib/esm/identity/decorators.d.ts +52 -7
- package/lib/esm/identity/decorators.js +53 -8
- package/lib/esm/identity/utils.d.ts +19 -0
- package/lib/esm/identity/utils.js +20 -1
- package/lib/esm/index.d.ts +9 -2
- package/lib/esm/index.js +10 -3
- package/lib/esm/interfaces/ErrorParser.d.ts +12 -0
- package/lib/esm/interfaces/ErrorParser.js +1 -1
- package/lib/esm/interfaces/Executor.d.ts +13 -0
- package/lib/esm/interfaces/Executor.js +1 -1
- package/lib/esm/interfaces/Observable.d.ts +27 -0
- package/lib/esm/interfaces/Observable.js +1 -1
- package/lib/esm/interfaces/Observer.d.ts +12 -0
- package/lib/esm/interfaces/Observer.js +1 -1
- package/lib/esm/interfaces/Paginatable.d.ts +15 -0
- package/lib/esm/interfaces/Paginatable.js +1 -1
- package/lib/esm/interfaces/Queriable.d.ts +34 -9
- package/lib/esm/interfaces/Queriable.js +1 -1
- package/lib/esm/interfaces/RawExecutor.d.ts +14 -0
- package/lib/esm/interfaces/RawExecutor.js +1 -1
- package/lib/esm/interfaces/SequenceOptions.d.ts +52 -0
- package/lib/esm/interfaces/SequenceOptions.js +19 -1
- package/lib/esm/model/BaseModel.d.ts +31 -0
- package/lib/esm/model/BaseModel.js +24 -1
- package/lib/esm/model/construction.d.ts +433 -0
- package/lib/esm/model/construction.js +441 -2
- package/lib/esm/model/decorators.d.ts +159 -29
- package/lib/esm/model/decorators.js +160 -30
- package/lib/esm/model/types.d.ts +9 -0
- package/lib/esm/model/types.js +1 -1
- package/lib/esm/persistence/Adapter.d.ts +358 -17
- package/lib/esm/persistence/Adapter.js +287 -19
- package/lib/esm/persistence/Dispatch.d.ts +114 -1
- package/lib/esm/persistence/Dispatch.js +102 -4
- package/lib/esm/persistence/ObserverHandler.d.ts +95 -0
- package/lib/esm/persistence/ObserverHandler.js +96 -1
- package/lib/esm/persistence/Sequence.d.ts +89 -0
- package/lib/esm/persistence/Sequence.js +70 -1
- package/lib/esm/persistence/constants.d.ts +22 -0
- package/lib/esm/persistence/constants.js +23 -1
- package/lib/esm/persistence/decorators.d.ts +10 -0
- package/lib/esm/persistence/decorators.js +11 -1
- package/lib/esm/persistence/errors.d.ts +23 -0
- package/lib/esm/persistence/errors.js +24 -1
- package/lib/esm/persistence/types.d.ts +18 -0
- package/lib/esm/persistence/types.js +1 -1
- package/lib/esm/query/Condition.d.ts +78 -31
- package/lib/esm/query/Condition.js +132 -53
- package/lib/esm/query/Paginator.d.ts +56 -0
- package/lib/esm/query/Paginator.js +57 -1
- package/lib/esm/query/Statement.d.ts +51 -0
- package/lib/esm/query/Statement.js +52 -1
- package/lib/esm/query/constants.d.ts +25 -0
- package/lib/esm/query/constants.js +26 -1
- package/lib/esm/query/errors.d.ts +14 -0
- package/lib/esm/query/errors.js +15 -1
- package/lib/esm/query/options.d.ts +21 -3
- package/lib/esm/query/options.js +1 -1
- package/lib/esm/query/selectors.d.ts +26 -0
- package/lib/esm/query/selectors.js +1 -1
- package/lib/esm/ram/RamAdapter.d.ts +311 -0
- package/lib/esm/ram/RamAdapter.js +312 -1
- package/lib/esm/ram/RamContext.d.ts +16 -1
- package/lib/esm/ram/RamContext.js +18 -3
- package/lib/esm/ram/RamPaginator.d.ts +43 -0
- package/lib/esm/ram/RamPaginator.js +54 -2
- package/lib/esm/ram/RamSequence.d.ts +61 -0
- package/lib/esm/ram/RamSequence.js +63 -2
- package/lib/esm/ram/RamStatement.d.ts +74 -0
- package/lib/esm/ram/RamStatement.js +75 -1
- package/lib/esm/ram/constants.d.ts +8 -0
- package/lib/esm/ram/constants.js +9 -1
- package/lib/esm/ram/handlers.d.ts +19 -0
- package/lib/esm/ram/handlers.js +20 -1
- package/lib/esm/ram/model/RamSequence.d.ts +25 -0
- package/lib/esm/ram/model/RamSequence.js +19 -1
- package/lib/esm/ram/types.d.ts +42 -0
- package/lib/esm/ram/types.js +1 -1
- package/lib/esm/repository/Repository.d.ts +363 -8
- package/lib/esm/repository/Repository.js +361 -16
- package/lib/esm/repository/constants.d.ts +25 -0
- package/lib/esm/repository/constants.js +26 -1
- package/lib/esm/repository/decorators.d.ts +27 -0
- package/lib/esm/repository/decorators.js +28 -1
- package/lib/esm/repository/errors.d.ts +12 -5
- package/lib/esm/repository/errors.js +13 -6
- package/lib/esm/repository/injectables.d.ts +18 -0
- package/lib/esm/repository/injectables.js +19 -1
- package/lib/esm/repository/types.d.ts +15 -0
- package/lib/esm/repository/types.js +1 -1
- package/lib/esm/repository/utils.d.ts +11 -0
- package/lib/esm/repository/utils.js +12 -1
- package/lib/esm/utils/decorators.d.ts +8 -0
- package/lib/esm/utils/decorators.js +9 -1
- package/lib/esm/utils/errors.d.ts +46 -0
- package/lib/esm/utils/errors.js +47 -1
- package/lib/identity/decorators.cjs +53 -8
- package/lib/identity/decorators.d.ts +52 -7
- package/lib/identity/utils.cjs +20 -1
- package/lib/identity/utils.d.ts +19 -0
- package/lib/index.cjs +10 -3
- package/lib/index.d.ts +9 -2
- package/lib/interfaces/ErrorParser.cjs +1 -1
- package/lib/interfaces/ErrorParser.d.ts +12 -0
- package/lib/interfaces/Executor.cjs +1 -1
- package/lib/interfaces/Executor.d.ts +13 -0
- package/lib/interfaces/Observable.cjs +1 -1
- package/lib/interfaces/Observable.d.ts +27 -0
- package/lib/interfaces/Observer.cjs +1 -1
- package/lib/interfaces/Observer.d.ts +12 -0
- package/lib/interfaces/Paginatable.cjs +1 -1
- package/lib/interfaces/Paginatable.d.ts +15 -0
- package/lib/interfaces/Queriable.cjs +1 -1
- package/lib/interfaces/Queriable.d.ts +34 -9
- package/lib/interfaces/RawExecutor.cjs +1 -1
- package/lib/interfaces/RawExecutor.d.ts +14 -0
- package/lib/interfaces/SequenceOptions.cjs +19 -1
- package/lib/interfaces/SequenceOptions.d.ts +52 -0
- package/lib/model/BaseModel.cjs +24 -1
- package/lib/model/BaseModel.d.ts +31 -0
- package/lib/model/construction.cjs +441 -2
- package/lib/model/construction.d.ts +433 -0
- package/lib/model/decorators.cjs +160 -30
- package/lib/model/decorators.d.ts +159 -29
- package/lib/model/types.cjs +1 -1
- package/lib/model/types.d.ts +9 -0
- package/lib/persistence/Adapter.cjs +287 -19
- package/lib/persistence/Adapter.d.ts +358 -17
- package/lib/persistence/Dispatch.cjs +102 -4
- package/lib/persistence/Dispatch.d.ts +114 -1
- package/lib/persistence/ObserverHandler.cjs +96 -1
- package/lib/persistence/ObserverHandler.d.ts +95 -0
- package/lib/persistence/Sequence.cjs +70 -1
- package/lib/persistence/Sequence.d.ts +89 -0
- package/lib/persistence/constants.cjs +23 -1
- package/lib/persistence/constants.d.ts +22 -0
- package/lib/persistence/decorators.cjs +11 -1
- package/lib/persistence/decorators.d.ts +10 -0
- package/lib/persistence/errors.cjs +24 -1
- package/lib/persistence/errors.d.ts +23 -0
- package/lib/persistence/types.cjs +1 -1
- package/lib/persistence/types.d.ts +18 -0
- package/lib/query/Condition.cjs +132 -53
- package/lib/query/Condition.d.ts +78 -31
- package/lib/query/Paginator.cjs +57 -1
- package/lib/query/Paginator.d.ts +56 -0
- package/lib/query/Statement.cjs +52 -1
- package/lib/query/Statement.d.ts +51 -0
- package/lib/query/constants.cjs +26 -1
- package/lib/query/constants.d.ts +25 -0
- package/lib/query/errors.cjs +15 -1
- package/lib/query/errors.d.ts +14 -0
- package/lib/query/options.cjs +1 -1
- package/lib/query/options.d.ts +21 -3
- package/lib/query/selectors.cjs +1 -1
- package/lib/query/selectors.d.ts +26 -0
- package/lib/ram/RamAdapter.cjs +312 -1
- package/lib/ram/RamAdapter.d.ts +311 -0
- package/lib/ram/RamContext.cjs +18 -3
- package/lib/ram/RamContext.d.ts +16 -1
- package/lib/ram/RamPaginator.cjs +54 -2
- package/lib/ram/RamPaginator.d.ts +43 -0
- package/lib/ram/RamSequence.cjs +63 -2
- package/lib/ram/RamSequence.d.ts +61 -0
- package/lib/ram/RamStatement.cjs +75 -1
- package/lib/ram/RamStatement.d.ts +74 -0
- package/lib/ram/constants.cjs +9 -1
- package/lib/ram/constants.d.ts +8 -0
- package/lib/ram/handlers.cjs +20 -1
- package/lib/ram/handlers.d.ts +19 -0
- package/lib/ram/model/RamSequence.cjs +19 -1
- package/lib/ram/model/RamSequence.d.ts +25 -0
- package/lib/ram/types.cjs +1 -1
- package/lib/ram/types.d.ts +42 -0
- package/lib/repository/Repository.cjs +360 -15
- package/lib/repository/Repository.d.ts +363 -8
- package/lib/repository/constants.cjs +26 -1
- package/lib/repository/constants.d.ts +25 -0
- package/lib/repository/decorators.cjs +28 -1
- package/lib/repository/decorators.d.ts +27 -0
- package/lib/repository/errors.cjs +13 -6
- package/lib/repository/errors.d.ts +12 -5
- package/lib/repository/injectables.cjs +19 -1
- package/lib/repository/injectables.d.ts +18 -0
- package/lib/repository/types.cjs +1 -1
- package/lib/repository/types.d.ts +15 -0
- package/lib/repository/utils.cjs +12 -1
- package/lib/repository/utils.d.ts +11 -0
- package/lib/utils/decorators.cjs +9 -1
- package/lib/utils/decorators.d.ts +8 -0
- package/lib/utils/errors.cjs +47 -1
- package/lib/utils/errors.d.ts +46 -0
- package/package.json +5 -5
@@ -1,12 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* @description Interface for sequence configuration options
|
3
|
+
* @summary Defines the configuration options for creating and managing sequences
|
4
|
+
* @interface SequenceOptions
|
5
|
+
* @memberOf module:core
|
6
|
+
*/
|
1
7
|
export interface SequenceOptions {
|
8
|
+
/**
|
9
|
+
* @description Optional name for the sequence
|
10
|
+
* @summary A unique identifier for the sequence
|
11
|
+
*/
|
2
12
|
name?: string;
|
13
|
+
/**
|
14
|
+
* @description The data type of the sequence
|
15
|
+
* @summary Specifies whether the sequence generates Number or BigInt values
|
16
|
+
*/
|
3
17
|
type: "Number" | "BigInt" | undefined;
|
18
|
+
/**
|
19
|
+
* @description The initial value of the sequence
|
20
|
+
* @summary The value that the sequence starts with
|
21
|
+
*/
|
4
22
|
startWith: number;
|
23
|
+
/**
|
24
|
+
* @description The increment value for each step in the sequence
|
25
|
+
* @summary The amount by which the sequence increases with each call
|
26
|
+
*/
|
5
27
|
incrementBy: number;
|
28
|
+
/**
|
29
|
+
* @description Optional minimum value for the sequence
|
30
|
+
* @summary The lowest value that the sequence can generate
|
31
|
+
*/
|
6
32
|
minValue?: number;
|
33
|
+
/**
|
34
|
+
* @description Optional maximum value for the sequence
|
35
|
+
* @summary The highest value that the sequence can generate
|
36
|
+
*/
|
7
37
|
maxValue?: number;
|
38
|
+
/**
|
39
|
+
* @description Whether the sequence should cycle when reaching its limits
|
40
|
+
* @summary If true, the sequence will restart from minValue when reaching maxValue
|
41
|
+
*/
|
8
42
|
cycle: boolean;
|
9
43
|
}
|
44
|
+
/**
|
45
|
+
* @description Default options for sequences
|
46
|
+
* @summary Provides a standard configuration for number sequences starting at 0 and incrementing by 1
|
47
|
+
* @const DefaultSequenceOptions
|
48
|
+
* @memberOf module:core
|
49
|
+
*/
|
10
50
|
export declare const DefaultSequenceOptions: SequenceOptions;
|
51
|
+
/**
|
52
|
+
* @description Predefined options for numeric sequences
|
53
|
+
* @summary Configuration for standard number sequences starting at 0 and incrementing by 1
|
54
|
+
* @const NumericSequence
|
55
|
+
* @memberOf module:core
|
56
|
+
*/
|
11
57
|
export declare const NumericSequence: SequenceOptions;
|
58
|
+
/**
|
59
|
+
* @description Predefined options for BigInt sequences
|
60
|
+
* @summary Configuration for BigInt sequences starting at 0 and incrementing by 1
|
61
|
+
* @const BigIntSequence
|
62
|
+
* @memberOf module:core
|
63
|
+
*/
|
12
64
|
export declare const BigIntSequence: SequenceOptions;
|
package/lib/model/BaseModel.cjs
CHANGED
@@ -12,6 +12,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BaseModel = void 0;
|
13
13
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
14
14
|
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
15
|
+
/**
|
16
|
+
* @description Base model class for all domain models
|
17
|
+
* @summary An abstract base class that extends the Model class from decorator-validation and adds timestamp functionality.
|
18
|
+
* All domain models in the application should extend this class to inherit common properties and behaviors.
|
19
|
+
* @param {ModelArg<BaseModel>} arg - Optional initialization data for the model
|
20
|
+
* @class BaseModel
|
21
|
+
* @example
|
22
|
+
* ```typescript
|
23
|
+
* class User extends BaseModel {
|
24
|
+
* @required()
|
25
|
+
* username!: string;
|
26
|
+
*
|
27
|
+
* @email()
|
28
|
+
* email!: string;
|
29
|
+
*
|
30
|
+
* constructor(data?: ModelArg<User>) {
|
31
|
+
* super(data);
|
32
|
+
* }
|
33
|
+
* }
|
34
|
+
*
|
35
|
+
* const user = new User({ username: 'john', email: 'john@example.com' });
|
36
|
+
* ```
|
37
|
+
*/
|
15
38
|
class BaseModel extends decorator_validation_1.Model {
|
16
39
|
constructor(arg) {
|
17
40
|
super(arg);
|
@@ -26,4 +49,4 @@ __decorate([
|
|
26
49
|
(0, db_decorators_1.timestamp)(),
|
27
50
|
__metadata("design:type", Date)
|
28
51
|
], BaseModel.prototype, "updatedOn", void 0);
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFzZU1vZGVsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21vZGVsL0Jhc2VNb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSwyREFBa0U7QUFDbEUseUVBQWlFO0FBRWpFOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBc0JHO0FBQ0gsTUFBc0IsU0FBVSxTQUFRLDRCQUFLO0lBZTNDLFlBQXNCLEdBQXlCO1FBQzdDLEtBQUss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Model.d.ts
CHANGED
@@ -1,6 +1,37 @@
|
|
1
1
|
import { ModelArg, Model } from "@decaf-ts/decorator-validation";
|
2
|
+
/**
|
3
|
+
* @description Base model class for all domain models
|
4
|
+
* @summary An abstract base class that extends the Model class from decorator-validation and adds timestamp functionality.
|
5
|
+
* All domain models in the application should extend this class to inherit common properties and behaviors.
|
6
|
+
* @param {ModelArg<BaseModel>} arg - Optional initialization data for the model
|
7
|
+
* @class BaseModel
|
8
|
+
* @example
|
9
|
+
* ```typescript
|
10
|
+
* class User extends BaseModel {
|
11
|
+
* @required()
|
12
|
+
* username!: string;
|
13
|
+
*
|
14
|
+
* @email()
|
15
|
+
* email!: string;
|
16
|
+
*
|
17
|
+
* constructor(data?: ModelArg<User>) {
|
18
|
+
* super(data);
|
19
|
+
* }
|
20
|
+
* }
|
21
|
+
*
|
22
|
+
* const user = new User({ username: 'john', email: 'john@example.com' });
|
23
|
+
* ```
|
24
|
+
*/
|
2
25
|
export declare abstract class BaseModel extends Model {
|
26
|
+
/**
|
27
|
+
* @description Creation timestamp for the model
|
28
|
+
* @summary Automatically set to the current date and time when the model is created
|
29
|
+
*/
|
3
30
|
createdOn: Date;
|
31
|
+
/**
|
32
|
+
* @description Last update timestamp for the model
|
33
|
+
* @summary Automatically updated to the current date and time whenever the model is modified
|
34
|
+
*/
|
4
35
|
updatedOn: Date;
|
5
36
|
protected constructor(arg?: ModelArg<BaseModel>);
|
6
37
|
}
|