@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,24 +1,46 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PersistenceKeys = void 0;
|
4
|
+
/**
|
5
|
+
* @description Persistence-related constant keys
|
6
|
+
* @summary Enum containing string constants used throughout the persistence layer for metadata, relations, and other persistence-related operations
|
7
|
+
* @enum {string}
|
8
|
+
* @readonly
|
9
|
+
* @memberOf module:core
|
10
|
+
*/
|
4
11
|
var PersistenceKeys;
|
5
12
|
(function (PersistenceKeys) {
|
13
|
+
/** @description Key for index metadata */
|
6
14
|
PersistenceKeys["INDEX"] = "index";
|
15
|
+
/** @description Key for unique constraint metadata */
|
7
16
|
PersistenceKeys["UNIQUE"] = "unique";
|
17
|
+
/** @description Key for adapter metadata */
|
8
18
|
PersistenceKeys["ADAPTER"] = "adapter";
|
19
|
+
/** @description Template for injectable adapter names */
|
9
20
|
PersistenceKeys["INJECTABLE"] = "decaf_{0}_adapter_for_{1}";
|
21
|
+
/** @description Key for table name metadata */
|
10
22
|
PersistenceKeys["TABLE"] = "table";
|
23
|
+
/** @description Key for column name metadata */
|
11
24
|
PersistenceKeys["COLUMN"] = "column";
|
25
|
+
/** @description Key for general metadata storage */
|
12
26
|
PersistenceKeys["METADATA"] = "__metadata";
|
27
|
+
/** @description Key for relations metadata storage */
|
13
28
|
PersistenceKeys["RELATIONS"] = "__relations";
|
29
|
+
/** @description Key for clause sequence metadata */
|
14
30
|
PersistenceKeys["CLAUSE_SEQUENCE"] = "clause-sequence";
|
15
31
|
// Ownership
|
32
|
+
/** @description Key for created-by ownership metadata */
|
16
33
|
PersistenceKeys["CREATED_BY"] = "ownership.created-by";
|
34
|
+
/** @description Key for updated-by ownership metadata */
|
17
35
|
PersistenceKeys["UPDATED_BY"] = "ownership.updated-by";
|
18
36
|
// Relations
|
37
|
+
/** @description Key for one-to-one relation metadata */
|
19
38
|
PersistenceKeys["ONE_TO_ONE"] = "relations.one-to-one";
|
39
|
+
/** @description Key for one-to-many relation metadata */
|
20
40
|
PersistenceKeys["ONE_TO_MANY"] = "relations.one-to-many";
|
41
|
+
/** @description Key for many-to-one relation metadata */
|
21
42
|
PersistenceKeys["MANY_TO_ONE"] = "relations.many-to-one";
|
43
|
+
/** @description Key for populate metadata */
|
22
44
|
PersistenceKeys["POPULATE"] = "populate";
|
23
45
|
})(PersistenceKeys || (exports.PersistenceKeys = PersistenceKeys = {}));
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6I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@@
|
|
1
|
+
/**
|
2
|
+
* @description Persistence-related constant keys
|
3
|
+
* @summary Enum containing string constants used throughout the persistence layer for metadata, relations, and other persistence-related operations
|
4
|
+
* @enum {string}
|
5
|
+
* @readonly
|
6
|
+
* @memberOf module:core
|
7
|
+
*/
|
1
8
|
export declare enum PersistenceKeys {
|
9
|
+
/** @description Key for index metadata */
|
2
10
|
INDEX = "index",
|
11
|
+
/** @description Key for unique constraint metadata */
|
3
12
|
UNIQUE = "unique",
|
13
|
+
/** @description Key for adapter metadata */
|
4
14
|
ADAPTER = "adapter",
|
15
|
+
/** @description Template for injectable adapter names */
|
5
16
|
INJECTABLE = "decaf_{0}_adapter_for_{1}",
|
17
|
+
/** @description Key for table name metadata */
|
6
18
|
TABLE = "table",
|
19
|
+
/** @description Key for column name metadata */
|
7
20
|
COLUMN = "column",
|
21
|
+
/** @description Key for general metadata storage */
|
8
22
|
METADATA = "__metadata",
|
23
|
+
/** @description Key for relations metadata storage */
|
9
24
|
RELATIONS = "__relations",
|
25
|
+
/** @description Key for clause sequence metadata */
|
10
26
|
CLAUSE_SEQUENCE = "clause-sequence",
|
27
|
+
/** @description Key for created-by ownership metadata */
|
11
28
|
CREATED_BY = "ownership.created-by",
|
29
|
+
/** @description Key for updated-by ownership metadata */
|
12
30
|
UPDATED_BY = "ownership.updated-by",
|
31
|
+
/** @description Key for one-to-one relation metadata */
|
13
32
|
ONE_TO_ONE = "relations.one-to-one",
|
33
|
+
/** @description Key for one-to-many relation metadata */
|
14
34
|
ONE_TO_MANY = "relations.one-to-many",
|
35
|
+
/** @description Key for many-to-one relation metadata */
|
15
36
|
MANY_TO_ONE = "relations.many-to-one",
|
37
|
+
/** @description Key for populate metadata */
|
16
38
|
POPULATE = "populate"
|
17
39
|
}
|
@@ -4,7 +4,17 @@ exports.uses = uses;
|
|
4
4
|
const reflection_1 = require("@decaf-ts/reflection");
|
5
5
|
const constants_1 = require("./constants.cjs");
|
6
6
|
const Adapter_1 = require("./Adapter.cjs");
|
7
|
+
/**
|
8
|
+
* @description Specifies which persistence adapter flavor a model should use
|
9
|
+
* @summary This decorator applies metadata to a model class to indicate which persistence adapter flavor
|
10
|
+
* should be used when performing database operations on instances of the model. The flavor is a string
|
11
|
+
* identifier that corresponds to a registered adapter configuration.
|
12
|
+
* @param {string} flavour - The identifier of the adapter flavor to use
|
13
|
+
* @return {Function} A decorator function that can be applied to a model class
|
14
|
+
* @function uses
|
15
|
+
* @category Class Decorators
|
16
|
+
*/
|
7
17
|
function uses(flavour) {
|
8
18
|
return (0, reflection_1.apply)((0, reflection_1.metadata)(Adapter_1.Adapter.key(constants_1.PersistenceKeys.ADAPTER), flavour));
|
9
19
|
}
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9ycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wZXJzaXN0ZW5jZS9kZWNvcmF0b3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBY0Esb0JBRUM7QUFoQkQscURBQXVEO0FBQ3ZELCtDQUE4QztBQUM5QywyQ0FBb0M7QUFFcEM7Ozs7Ozs7OztHQVNHO0FBQ0gsU0FBZ0IsSUFBSSxDQUFDLE9BQWU7SUFDbEMsT0FBTyxJQUFBLGtCQUFLLEVBQUMsSUFBQSxxQkFBUSxFQUFDLGlCQUFPLENBQUMsR0FBRyxDQUFDLDJCQUFlLENBQUMsT0FBTyxDQUFDLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQztBQUN4RSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgYXBwbHksIG1ldGFkYXRhIH0gZnJvbSBcIkBkZWNhZi10cy9yZWZsZWN0aW9uXCI7XG5pbXBvcnQgeyBQZXJzaXN0ZW5jZUtleXMgfSBmcm9tIFwiLi9jb25zdGFudHN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model should use
|
3
|
+
* @summary This decorator applies metadata to a model class to indicate which persistence adapter flavor
|
4
|
+
* should be used when performing database operations on instances of the model. The flavor is a string
|
5
|
+
* identifier that corresponds to a registered adapter configuration.
|
6
|
+
* @param {string} flavour - The identifier of the adapter flavor to use
|
7
|
+
* @return {Function} A decorator function that can be applied to a model class
|
8
|
+
* @function uses
|
9
|
+
* @category Class Decorators
|
10
|
+
*/
|
1
11
|
export declare function uses(flavour: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
@@ -2,10 +2,33 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.UnsupportedError = void 0;
|
4
4
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
5
|
+
/**
|
6
|
+
* @description Error thrown when an unsupported operation is attempted
|
7
|
+
* @summary This error is thrown when an operation is requested that is not supported by the current
|
8
|
+
* persistence adapter or configuration. It extends the BaseError class and sets a 500 status code.
|
9
|
+
* @param {string|Error} msg - The error message or an Error object to wrap
|
10
|
+
* @class UnsupportedError
|
11
|
+
* @example
|
12
|
+
* ```typescript
|
13
|
+
* // Throwing an UnsupportedError
|
14
|
+
* if (!adapter.supportsTransactions()) {
|
15
|
+
* throw new UnsupportedError('Transactions are not supported by this adapter');
|
16
|
+
* }
|
17
|
+
*
|
18
|
+
* // Catching an UnsupportedError
|
19
|
+
* try {
|
20
|
+
* await adapter.beginTransaction();
|
21
|
+
* } catch (error) {
|
22
|
+
* if (error instanceof UnsupportedError) {
|
23
|
+
* console.error('Operation not supported:', error.message);
|
24
|
+
* }
|
25
|
+
* }
|
26
|
+
* ```
|
27
|
+
*/
|
5
28
|
class UnsupportedError extends db_decorators_1.BaseError {
|
6
29
|
constructor(msg) {
|
7
30
|
super(UnsupportedError.name, msg, 500);
|
8
31
|
}
|
9
32
|
}
|
10
33
|
exports.UnsupportedError = UnsupportedError;
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
34
|
+
//# sourceMapping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GBgdHlwZXNjcmlwdFxuICogLy8gVGhyb3dpbmcgYW4gVW5zdXBwb3J0ZWRFcnJvclxuICogaWYgKCFhZGFwdGVyLnN1cHBvcnRzVHJhbnNhY3Rpb25zKCkpIHtcbiAqICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkRXJyb3IoJ1RyYW5zYWN0aW9ucyBhcmUgbm90IHN1cHBvcnRlZCBieSB0aGlzIGFkYXB0ZXInKTtcbiAqIH1cbiAqIFxuICogLy8gQ2F0Y2hpbmcgYW4gVW5zdXBwb3J0ZWRFcnJvclxuICogdHJ5IHtcbiAqICAgYXdhaXQgYWRhcHRlci5iZWdpblRyYW5zYWN0aW9uKCk7XG4gKiB9IGNhdGNoIChlcnJvcikge1xuICogICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBVbnN1cHBvcnRlZEVycm9yKSB7XG4gKiAgICAgY29uc29sZS5lcnJvcignT3BlcmF0aW9uIG5vdCBzdXBwb3J0ZWQ6JywgZXJyb3IubWVzc2FnZSk7XG4gKiAgIH1cbiAqIH1cbiAqIGBgYFxuICovXG5leHBvcnQgY2xhc3MgVW5zdXBwb3J0ZWRFcnJvciBleHRlbmRzIEJhc2VFcnJvciB7XG4gIGNvbnN0cnVjdG9yKG1zZzogc3RyaW5nIHwgRXJyb3IpIHtcbiAgICBzdXBlcihVbnN1cHBvcnRlZEVycm9yLm5hbWUsIG1zZywgNTAwKTtcbiAgfVxufVxuIl19
|
@@ -1,4 +1,27 @@
|
|
1
1
|
import { BaseError } from "@decaf-ts/db-decorators";
|
2
|
+
/**
|
3
|
+
* @description Error thrown when an unsupported operation is attempted
|
4
|
+
* @summary This error is thrown when an operation is requested that is not supported by the current
|
5
|
+
* persistence adapter or configuration. It extends the BaseError class and sets a 500 status code.
|
6
|
+
* @param {string|Error} msg - The error message or an Error object to wrap
|
7
|
+
* @class UnsupportedError
|
8
|
+
* @example
|
9
|
+
* ```typescript
|
10
|
+
* // Throwing an UnsupportedError
|
11
|
+
* if (!adapter.supportsTransactions()) {
|
12
|
+
* throw new UnsupportedError('Transactions are not supported by this adapter');
|
13
|
+
* }
|
14
|
+
*
|
15
|
+
* // Catching an UnsupportedError
|
16
|
+
* try {
|
17
|
+
* await adapter.beginTransaction();
|
18
|
+
* } catch (error) {
|
19
|
+
* if (error instanceof UnsupportedError) {
|
20
|
+
* console.error('Operation not supported:', error.message);
|
21
|
+
* }
|
22
|
+
* }
|
23
|
+
* ```
|
24
|
+
*/
|
2
25
|
export declare class UnsupportedError extends BaseError {
|
3
26
|
constructor(msg: string | Error);
|
4
27
|
}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcGVyc2lzdGVuY2UvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEJ1bGtDcnVkT3BlcmF0aW9uS2V5cywgT3BlcmF0aW9uS2V5cyB9IGZyb20gXCJAZGVjYWYtdHMvZGItZGVjb3JhdG9yc1wiO1xuXG4vKipcbiAqIEBkZXNjcmlwdGlvbiBUeXBlIHJlcHJlc2VudGluZyBwb3NzaWJsZSBJRCBmb3JtYXRzIGZvciBkYXRhYmFzZSBldmVudHNcbiAqIEBzdW1tYXJ5IEEgdW5pb24gdHlwZSB0aGF0IGRlZmluZXMgdGhlIHBvc3NpYmxlIGZvcm1hdHMgZm9yIGV2ZW50IGlkZW50aWZpZXJzIGluIHRoZSBwZXJzaXN0ZW5jZSBsYXllci5cbiAqIFRoZXNlIGNhbiBiZSBzaW5nbGUgdmFsdWVzIChzdHJpbmcsIG51bWJlciwgYmlnaW50KSBvciBhcnJheXMgb2Yg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UcnVlIGlmIHRoZSBvYnNlcnZlciBzaG91bGQgYmUgbm90aWZpZWQsIGZhbHNlIG90aGVyd2lzZVxuICogQHR5cGVkZWYge0Z1bmN0aW9ufSBPYnNlcnZlckZpbHRlclxuICogQG1lbWJlck9mIG1vZHVsZTpjb3JlXG4gKi9cbmV4cG9ydCB0eXBlIE9ic2VydmVyRmlsdGVyID0gKFxuICB0YWJsZTogc3RyaW5nLFxuICBldmVudDogT3BlcmF0aW9uS2V5cyB8IEJ1bGtDcnVkT3BlcmF0aW9uS2V5cyB8IHN0cmluZyxcbiAgaWQ6IEV2ZW50SWRzXG4pID0+IGJvb2xlYW47XG4iXX0=
|
@@ -1,3 +1,21 @@
|
|
1
1
|
import { BulkCrudOperationKeys, OperationKeys } from "@decaf-ts/db-decorators";
|
2
|
+
/**
|
3
|
+
* @description Type representing possible ID formats for database events
|
4
|
+
* @summary A union type that defines the possible formats for event identifiers in the persistence layer.
|
5
|
+
* These can be single values (string, number, bigint) or arrays of these types.
|
6
|
+
* @typedef {(string|number|bigint|string[]|number[]|bigint[])} EventIds
|
7
|
+
* @memberOf module:core
|
8
|
+
*/
|
2
9
|
export type EventIds = string | number | bigint | string[] | number[] | bigint[];
|
10
|
+
/**
|
11
|
+
* @description Function type for filtering observer notifications
|
12
|
+
* @summary A function type that defines a predicate used to determine whether an observer should be notified
|
13
|
+
* about a specific database event. The filter examines the table name, event type, and affected IDs.
|
14
|
+
* @param {string} table - The name of the database table where the event occurred
|
15
|
+
* @param {(OperationKeys|BulkCrudOperationKeys|string)} event - The type of operation that triggered the event
|
16
|
+
* @param {EventIds} id - The identifier(s) of the affected record(s)
|
17
|
+
* @return {boolean} True if the observer should be notified, false otherwise
|
18
|
+
* @typedef {Function} ObserverFilter
|
19
|
+
* @memberOf module:core
|
20
|
+
*/
|
3
21
|
export type ObserverFilter = (table: string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds) => boolean;
|