@decaf-ts/core 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/lib/esm/identity/decorators.d.ts +3 -4
- package/lib/esm/identity/decorators.js +5 -11
- package/lib/esm/identity/decorators.js.map +1 -1
- package/lib/esm/identity/index.d.ts +0 -1
- package/lib/esm/identity/index.js +0 -1
- package/lib/esm/identity/index.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/interfaces/ContextuallyLogged.d.ts +8 -0
- package/lib/esm/interfaces/ContextuallyLogged.js +2 -0
- package/lib/esm/interfaces/ContextuallyLogged.js.map +1 -0
- package/lib/esm/interfaces/ErrorParser.d.ts +2 -2
- package/lib/esm/interfaces/Executor.d.ts +1 -1
- package/lib/esm/interfaces/Observable.d.ts +8 -8
- package/lib/esm/interfaces/Observer.d.ts +2 -2
- package/lib/esm/interfaces/RawExecutor.d.ts +1 -1
- package/lib/esm/model/BaseModel.d.ts +2 -2
- package/lib/esm/model/BaseModel.js +2 -2
- package/lib/esm/{ram/model/RamSequenceModel.d.ts → model/SequenceModel.d.ts} +3 -3
- package/lib/esm/{ram/model/RamSequenceModel.js → model/SequenceModel.js} +12 -11
- package/lib/esm/model/SequenceModel.js.map +1 -0
- package/lib/esm/model/construction.d.ts +9 -8
- package/lib/esm/model/construction.js +2 -2
- package/lib/esm/model/construction.js.map +1 -1
- package/lib/esm/model/decorators.d.ts +5 -4
- package/lib/esm/model/decorators.js +3 -3
- package/lib/esm/model/decorators.js.map +1 -1
- package/lib/esm/model/index.d.ts +1 -0
- package/lib/esm/model/index.js +1 -0
- package/lib/esm/model/index.js.map +1 -1
- package/lib/esm/overrides/Metadata.d.ts +1 -8
- package/lib/esm/overrides/Model.d.ts +75 -0
- package/lib/esm/overrides/Model.js +2 -0
- package/lib/esm/overrides/Model.js.map +1 -0
- package/lib/esm/overrides/index.d.ts +2 -0
- package/lib/esm/overrides/index.js +2 -0
- package/lib/esm/overrides/index.js.map +1 -1
- package/lib/esm/overrides/injectables.d.ts +10 -0
- package/lib/esm/overrides/injectables.js +2 -0
- package/lib/esm/overrides/injectables.js.map +1 -0
- package/lib/esm/overrides/overrides.js +45 -3
- package/lib/esm/overrides/overrides.js.map +1 -1
- package/lib/esm/persistence/Adapter.d.ts +55 -53
- package/lib/esm/persistence/Adapter.js +85 -61
- package/lib/esm/persistence/Adapter.js.map +1 -1
- package/lib/esm/persistence/Dispatch.d.ts +7 -6
- package/lib/esm/persistence/Dispatch.js +25 -18
- package/lib/esm/persistence/Dispatch.js.map +1 -1
- package/lib/esm/persistence/ObserverHandler.d.ts +7 -6
- package/lib/esm/persistence/ObserverHandler.js +5 -4
- package/lib/esm/persistence/ObserverHandler.js.map +1 -1
- package/lib/esm/persistence/Sequence.d.ts +34 -25
- package/lib/esm/persistence/Sequence.js +136 -15
- package/lib/esm/persistence/Sequence.js.map +1 -1
- package/lib/esm/persistence/constants.d.ts +1 -0
- package/lib/esm/persistence/constants.js +1 -0
- package/lib/esm/persistence/constants.js.map +1 -1
- package/lib/esm/persistence/generators.d.ts +14 -0
- package/lib/esm/persistence/generators.js +31 -0
- package/lib/esm/persistence/generators.js.map +1 -0
- package/lib/esm/persistence/index.d.ts +1 -0
- package/lib/esm/persistence/index.js +1 -0
- package/lib/esm/persistence/index.js.map +1 -1
- package/lib/esm/persistence/migrations.d.ts +8 -8
- package/lib/esm/persistence/migrations.js +8 -9
- package/lib/esm/persistence/migrations.js.map +1 -1
- package/lib/esm/persistence/types.d.ts +38 -20
- package/lib/esm/query/Paginator.d.ts +6 -5
- package/lib/esm/query/Paginator.js +4 -4
- package/lib/esm/query/Paginator.js.map +1 -1
- package/lib/esm/query/Statement.d.ts +9 -8
- package/lib/esm/query/Statement.js +23 -10
- package/lib/esm/query/Statement.js.map +1 -1
- package/lib/esm/ram/RamAdapter.d.ts +22 -31
- package/lib/esm/ram/RamAdapter.js +36 -34
- package/lib/esm/ram/RamAdapter.js.map +1 -1
- package/lib/esm/ram/RamPaginator.d.ts +2 -1
- package/lib/esm/ram/RamPaginator.js +5 -3
- package/lib/esm/ram/RamPaginator.js.map +1 -1
- package/lib/esm/ram/RamStatement.d.ts +7 -7
- package/lib/esm/ram/RamStatement.js.map +1 -1
- package/lib/esm/ram/handlers.d.ts +3 -4
- package/lib/esm/ram/handlers.js.map +1 -1
- package/lib/esm/ram/index.d.ts +0 -3
- package/lib/esm/ram/index.js +0 -3
- package/lib/esm/ram/index.js.map +1 -1
- package/lib/esm/ram/types.d.ts +4 -12
- package/lib/esm/repository/Repository.d.ts +31 -95
- package/lib/esm/repository/Repository.js +107 -203
- package/lib/esm/repository/Repository.js.map +1 -1
- package/lib/esm/repository/decorators.js +4 -3
- package/lib/esm/repository/decorators.js.map +1 -1
- package/lib/esm/repository/utils.d.ts +1 -1
- package/lib/esm/repository/utils.js +2 -3
- package/lib/esm/repository/utils.js.map +1 -1
- package/lib/esm/utils/ContextualLoggedClass.d.ts +16 -0
- package/lib/esm/utils/ContextualLoggedClass.js +29 -0
- package/lib/esm/utils/ContextualLoggedClass.js.map +1 -0
- package/lib/esm/utils/Services.d.ts +50 -0
- package/lib/esm/utils/Services.js +154 -0
- package/lib/esm/utils/Services.js.map +1 -0
- package/lib/esm/utils/decorators.d.ts +1 -9
- package/lib/esm/utils/decorators.js +26 -15
- package/lib/esm/utils/decorators.js.map +1 -1
- package/lib/esm/utils/index.d.ts +2 -1
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/identity/decorators.cjs +5 -11
- package/lib/identity/decorators.d.ts +3 -4
- package/lib/identity/decorators.js.map +1 -1
- package/lib/identity/index.cjs +0 -1
- package/lib/identity/index.d.ts +0 -1
- package/lib/identity/index.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/interfaces/ContextuallyLogged.cjs +3 -0
- package/lib/interfaces/ContextuallyLogged.d.ts +8 -0
- package/lib/interfaces/ContextuallyLogged.js.map +1 -0
- package/lib/interfaces/ErrorParser.d.ts +2 -2
- package/lib/interfaces/Executor.d.ts +1 -1
- package/lib/interfaces/Observable.d.ts +8 -8
- package/lib/interfaces/Observer.d.ts +2 -2
- package/lib/interfaces/RawExecutor.d.ts +1 -1
- package/lib/model/BaseModel.cjs +2 -2
- package/lib/model/BaseModel.d.ts +2 -2
- package/lib/{ram/model/RamSequenceModel.cjs → model/SequenceModel.cjs} +14 -13
- package/lib/{ram/model/RamSequenceModel.d.ts → model/SequenceModel.d.ts} +3 -3
- package/lib/model/SequenceModel.js.map +1 -0
- package/lib/model/construction.cjs +2 -2
- package/lib/model/construction.d.ts +9 -8
- package/lib/model/construction.js.map +1 -1
- package/lib/model/decorators.cjs +3 -3
- package/lib/model/decorators.d.ts +5 -4
- package/lib/model/decorators.js.map +1 -1
- package/lib/model/index.cjs +1 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.js.map +1 -1
- package/lib/overrides/Metadata.d.ts +1 -8
- package/lib/overrides/Model.cjs +4 -0
- package/lib/overrides/Model.d.ts +75 -0
- package/lib/overrides/Model.js.map +1 -0
- package/lib/overrides/index.cjs +2 -0
- package/lib/overrides/index.d.ts +2 -0
- package/lib/overrides/index.js.map +1 -1
- package/lib/overrides/injectables.cjs +4 -0
- package/lib/overrides/injectables.d.ts +10 -0
- package/lib/overrides/injectables.js.map +1 -0
- package/lib/overrides/overrides.cjs +43 -1
- package/lib/overrides/overrides.js.map +1 -1
- package/lib/persistence/Adapter.cjs +90 -66
- package/lib/persistence/Adapter.d.ts +55 -53
- package/lib/persistence/Adapter.js.map +1 -1
- package/lib/persistence/Dispatch.cjs +25 -18
- package/lib/persistence/Dispatch.d.ts +7 -6
- package/lib/persistence/Dispatch.js.map +1 -1
- package/lib/persistence/ObserverHandler.cjs +5 -4
- package/lib/persistence/ObserverHandler.d.ts +7 -6
- package/lib/persistence/ObserverHandler.js.map +1 -1
- package/lib/persistence/Sequence.cjs +136 -15
- package/lib/persistence/Sequence.d.ts +34 -25
- package/lib/persistence/Sequence.js.map +1 -1
- package/lib/persistence/constants.cjs +1 -0
- package/lib/persistence/constants.d.ts +1 -0
- package/lib/persistence/constants.js.map +1 -1
- package/lib/persistence/generators.cjs +36 -0
- package/lib/persistence/generators.d.ts +14 -0
- package/lib/persistence/generators.js.map +1 -0
- package/lib/persistence/index.cjs +1 -0
- package/lib/persistence/index.d.ts +1 -0
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/migrations.cjs +7 -8
- package/lib/persistence/migrations.d.ts +8 -8
- package/lib/persistence/migrations.js.map +1 -1
- package/lib/persistence/types.d.ts +38 -20
- package/lib/query/Paginator.cjs +4 -4
- package/lib/query/Paginator.d.ts +6 -5
- package/lib/query/Paginator.js.map +1 -1
- package/lib/query/Statement.cjs +34 -21
- package/lib/query/Statement.d.ts +9 -8
- package/lib/query/Statement.js.map +1 -1
- package/lib/ram/RamAdapter.cjs +35 -33
- package/lib/ram/RamAdapter.d.ts +22 -31
- package/lib/ram/RamAdapter.js.map +1 -1
- package/lib/ram/RamPaginator.cjs +5 -3
- package/lib/ram/RamPaginator.d.ts +2 -1
- package/lib/ram/RamPaginator.js.map +1 -1
- package/lib/ram/RamStatement.d.ts +7 -7
- package/lib/ram/RamStatement.js.map +1 -1
- package/lib/ram/handlers.d.ts +3 -4
- package/lib/ram/handlers.js.map +1 -1
- package/lib/ram/index.cjs +0 -3
- package/lib/ram/index.d.ts +0 -3
- package/lib/ram/index.js.map +1 -1
- package/lib/ram/types.d.ts +4 -12
- package/lib/repository/Repository.cjs +108 -204
- package/lib/repository/Repository.d.ts +31 -95
- package/lib/repository/Repository.js.map +1 -1
- package/lib/repository/decorators.cjs +2 -1
- package/lib/repository/decorators.js.map +1 -1
- package/lib/repository/utils.cjs +2 -3
- package/lib/repository/utils.d.ts +1 -1
- package/lib/repository/utils.js.map +1 -1
- package/lib/utils/ContextualLoggedClass.cjs +33 -0
- package/lib/utils/ContextualLoggedClass.d.ts +16 -0
- package/lib/utils/ContextualLoggedClass.js.map +1 -0
- package/lib/utils/Services.cjs +159 -0
- package/lib/utils/Services.d.ts +50 -0
- package/lib/utils/Services.js.map +1 -0
- package/lib/utils/decorators.cjs +27 -16
- package/lib/utils/decorators.d.ts +1 -9
- package/lib/utils/decorators.js.map +1 -1
- package/lib/utils/index.cjs +2 -1
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/esm/identity/utils.d.ts +0 -24
- package/lib/esm/identity/utils.js +0 -44
- package/lib/esm/identity/utils.js.map +0 -1
- package/lib/esm/ram/RamContext.d.ts +0 -28
- package/lib/esm/ram/RamContext.js +0 -30
- package/lib/esm/ram/RamContext.js.map +0 -1
- package/lib/esm/ram/RamSequence.d.ts +0 -75
- package/lib/esm/ram/RamSequence.js +0 -145
- package/lib/esm/ram/RamSequence.js.map +0 -1
- package/lib/esm/ram/model/RamSequenceModel.js.map +0 -1
- package/lib/esm/ram/model/index.d.ts +0 -1
- package/lib/esm/ram/model/index.js +0 -2
- package/lib/esm/ram/model/index.js.map +0 -1
- package/lib/identity/utils.cjs +0 -49
- package/lib/identity/utils.d.ts +0 -24
- package/lib/identity/utils.js.map +0 -1
- package/lib/ram/RamContext.cjs +0 -34
- package/lib/ram/RamContext.d.ts +0 -28
- package/lib/ram/RamContext.js.map +0 -1
- package/lib/ram/RamSequence.cjs +0 -149
- package/lib/ram/RamSequence.d.ts +0 -75
- package/lib/ram/RamSequence.js.map +0 -1
- package/lib/ram/model/RamSequenceModel.js.map +0 -1
- package/lib/ram/model/index.cjs +0 -18
- package/lib/ram/model/index.d.ts +0 -1
- package/lib/ram/model/index.js.map +0 -1
package/lib/query/Paginator.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Adapter } from "../persistence";
|
|
|
2
2
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
3
3
|
import { Constructor } from "@decaf-ts/decoration";
|
|
4
4
|
import { LoggedClass } from "@decaf-ts/logging";
|
|
5
|
+
import { MaybeContextualArg } from "../utils/index";
|
|
5
6
|
/**
|
|
6
7
|
* @description Handles pagination for database queries
|
|
7
8
|
* @summary Provides functionality for navigating through paginated query results
|
|
@@ -59,7 +60,7 @@ import { LoggedClass } from "@decaf-ts/logging";
|
|
|
59
60
|
* Paginator-->>Client: return page results
|
|
60
61
|
*/
|
|
61
62
|
export declare abstract class Paginator<M extends Model, R = M[], Q = any> extends LoggedClass {
|
|
62
|
-
protected readonly adapter: Adapter<any, any, Q, any
|
|
63
|
+
protected readonly adapter: Adapter<any, any, Q, any>;
|
|
63
64
|
protected readonly query: Q;
|
|
64
65
|
readonly size: number;
|
|
65
66
|
protected readonly clazz: Constructor<M>;
|
|
@@ -72,10 +73,10 @@ export declare abstract class Paginator<M extends Model, R = M[], Q = any> exten
|
|
|
72
73
|
get total(): number;
|
|
73
74
|
get count(): number;
|
|
74
75
|
protected get statement(): Q;
|
|
75
|
-
protected constructor(adapter: Adapter<any, any, Q, any
|
|
76
|
+
protected constructor(adapter: Adapter<any, any, Q, any>, query: Q, size: number, clazz: Constructor<M>);
|
|
76
77
|
protected abstract prepare(rawStatement: Q): Q;
|
|
77
|
-
next(): Promise<R[]>;
|
|
78
|
-
previous(): Promise<R[]>;
|
|
78
|
+
next(...args: MaybeContextualArg<any>): Promise<R[]>;
|
|
79
|
+
previous(...args: MaybeContextualArg<any>): Promise<R[]>;
|
|
79
80
|
protected validatePage(page: number): number;
|
|
80
|
-
abstract page(page?: number): Promise<R[]>;
|
|
81
|
+
abstract page(page?: number, ...args: MaybeContextualArg<any>): Promise<R[]>;
|
|
81
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paginator.js","sourceRoot":"","sources":["../../src/query/Paginator.ts"],"names":[],"mappings":";;;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AAC,SAAS,CAAC,IAAI,CAAC;YACrC,MAAM,IAAI,oBAAW,CACnB,sDAAsD,CACvD,CAAC;QACJ,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW;YACpE,MAAM,IAAI,oBAAW,CACnB,QAAQ,IAAI,CAAC,WAAW,qCAAqC,IAAI,EAAE,CACpE,CAAC;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;CAGF;AA7DD,8BA6DC"}
|
package/lib/query/Statement.cjs
CHANGED
|
@@ -14,9 +14,10 @@ exports.Statement = void 0;
|
|
|
14
14
|
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
15
15
|
const Condition_1 = require("./Condition.cjs");
|
|
16
16
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
17
|
-
const decorators_1 = require("./../utils/decorators.cjs");
|
|
18
|
-
const errors_1 = require("./errors.cjs");
|
|
19
17
|
const logging_1 = require("@decaf-ts/logging");
|
|
18
|
+
const persistence_1 = require("./../persistence/index.cjs");
|
|
19
|
+
const errors_1 = require("./errors.cjs");
|
|
20
|
+
const index_1 = require("./../utils/index.cjs");
|
|
20
21
|
/**
|
|
21
22
|
* @description Base class for database query statements
|
|
22
23
|
* @summary Provides a foundation for building and executing database queries
|
|
@@ -68,7 +69,7 @@ const logging_1 = require("@decaf-ts/logging");
|
|
|
68
69
|
* Adapter-->>Statement: return processed results
|
|
69
70
|
* Statement-->>Client: return final results
|
|
70
71
|
*/
|
|
71
|
-
class Statement extends
|
|
72
|
+
class Statement extends index_1.ContextualLoggedClass {
|
|
72
73
|
constructor(adapter) {
|
|
73
74
|
super();
|
|
74
75
|
this.adapter = adapter;
|
|
@@ -125,100 +126,112 @@ class Statement extends logging_1.LoggedClass {
|
|
|
125
126
|
this.offsetSelector = value;
|
|
126
127
|
return this;
|
|
127
128
|
}
|
|
128
|
-
async execute() {
|
|
129
|
+
async execute(...args) {
|
|
130
|
+
let execArgs = args;
|
|
131
|
+
if ((!execArgs.length ||
|
|
132
|
+
!(execArgs[execArgs.length - 1] instanceof db_decorators_1.Context)) &&
|
|
133
|
+
this.fromSelector) {
|
|
134
|
+
const ctx = await this.adapter.context(db_decorators_1.OperationKeys.READ, {}, this.fromSelector);
|
|
135
|
+
execArgs = [...execArgs, ctx];
|
|
136
|
+
}
|
|
137
|
+
const { ctx } = persistence_1.Adapter.logCtx(execArgs, this.toString());
|
|
129
138
|
try {
|
|
130
139
|
const query = this.build();
|
|
131
|
-
return (await this.raw(query));
|
|
140
|
+
return (await this.raw(query, ctx));
|
|
132
141
|
}
|
|
133
142
|
catch (e) {
|
|
134
143
|
throw new db_decorators_1.InternalError(e);
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
|
-
async raw(rawInput) {
|
|
138
|
-
const
|
|
146
|
+
async raw(rawInput, ...args) {
|
|
147
|
+
const { ctx, ctxArgs } = this.logCtx(args, this.raw);
|
|
148
|
+
const results = await this.adapter.raw(rawInput, ...ctxArgs);
|
|
139
149
|
if (!this.selectSelector)
|
|
140
150
|
return results;
|
|
141
151
|
const pkAttr = decorator_validation_1.Model.pk(this.fromSelector);
|
|
142
152
|
const processor = function recordProcessor(r) {
|
|
143
153
|
const id = r[pkAttr];
|
|
144
|
-
return this.adapter.revert(r, this.fromSelector,
|
|
154
|
+
return this.adapter.revert(r, this.fromSelector, id, undefined, ctx);
|
|
145
155
|
}.bind(this);
|
|
146
156
|
if (Array.isArray(results))
|
|
147
157
|
return results.map(processor);
|
|
148
158
|
return processor(results);
|
|
149
159
|
}
|
|
160
|
+
toString() {
|
|
161
|
+
return `${this.adapter.flavour} statement`;
|
|
162
|
+
}
|
|
150
163
|
}
|
|
151
164
|
exports.Statement = Statement;
|
|
152
165
|
__decorate([
|
|
153
|
-
(0,
|
|
166
|
+
(0, logging_1.final)(),
|
|
154
167
|
__metadata("design:type", Function),
|
|
155
168
|
__metadata("design:paramtypes", [Array]),
|
|
156
169
|
__metadata("design:returntype", Object)
|
|
157
170
|
], Statement.prototype, "select", null);
|
|
158
171
|
__decorate([
|
|
159
|
-
(0,
|
|
172
|
+
(0, logging_1.final)(),
|
|
160
173
|
__metadata("design:type", Function),
|
|
161
174
|
__metadata("design:paramtypes", [typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object]),
|
|
162
175
|
__metadata("design:returntype", Object)
|
|
163
176
|
], Statement.prototype, "distinct", null);
|
|
164
177
|
__decorate([
|
|
165
|
-
(0,
|
|
178
|
+
(0, logging_1.final)(),
|
|
166
179
|
__metadata("design:type", Function),
|
|
167
180
|
__metadata("design:paramtypes", [typeof (_b = typeof S !== "undefined" && S) === "function" ? _b : Object]),
|
|
168
181
|
__metadata("design:returntype", Object)
|
|
169
182
|
], Statement.prototype, "max", null);
|
|
170
183
|
__decorate([
|
|
171
|
-
(0,
|
|
184
|
+
(0, logging_1.final)(),
|
|
172
185
|
__metadata("design:type", Function),
|
|
173
186
|
__metadata("design:paramtypes", [typeof (_c = typeof S !== "undefined" && S) === "function" ? _c : Object]),
|
|
174
187
|
__metadata("design:returntype", Object)
|
|
175
188
|
], Statement.prototype, "min", null);
|
|
176
189
|
__decorate([
|
|
177
|
-
(0,
|
|
190
|
+
(0, logging_1.final)(),
|
|
178
191
|
__metadata("design:type", Function),
|
|
179
192
|
__metadata("design:paramtypes", [typeof (_d = typeof S !== "undefined" && S) === "function" ? _d : Object]),
|
|
180
193
|
__metadata("design:returntype", Object)
|
|
181
194
|
], Statement.prototype, "count", null);
|
|
182
195
|
__decorate([
|
|
183
|
-
(0,
|
|
196
|
+
(0, logging_1.final)(),
|
|
184
197
|
__metadata("design:type", Function),
|
|
185
198
|
__metadata("design:paramtypes", [Object]),
|
|
186
199
|
__metadata("design:returntype", Object)
|
|
187
200
|
], Statement.prototype, "from", null);
|
|
188
201
|
__decorate([
|
|
189
|
-
(0,
|
|
202
|
+
(0, logging_1.final)(),
|
|
190
203
|
__metadata("design:type", Function),
|
|
191
204
|
__metadata("design:paramtypes", [Condition_1.Condition]),
|
|
192
205
|
__metadata("design:returntype", Object)
|
|
193
206
|
], Statement.prototype, "where", null);
|
|
194
207
|
__decorate([
|
|
195
|
-
(0,
|
|
208
|
+
(0, logging_1.final)(),
|
|
196
209
|
__metadata("design:type", Function),
|
|
197
210
|
__metadata("design:paramtypes", [Array]),
|
|
198
211
|
__metadata("design:returntype", Object)
|
|
199
212
|
], Statement.prototype, "orderBy", null);
|
|
200
213
|
__decorate([
|
|
201
|
-
(0,
|
|
214
|
+
(0, logging_1.final)(),
|
|
202
215
|
__metadata("design:type", Function),
|
|
203
216
|
__metadata("design:paramtypes", [Object]),
|
|
204
217
|
__metadata("design:returntype", Object)
|
|
205
218
|
], Statement.prototype, "groupBy", null);
|
|
206
219
|
__decorate([
|
|
207
|
-
(0,
|
|
220
|
+
(0, logging_1.final)(),
|
|
208
221
|
__metadata("design:type", Function),
|
|
209
222
|
__metadata("design:paramtypes", [Number]),
|
|
210
223
|
__metadata("design:returntype", Object)
|
|
211
224
|
], Statement.prototype, "limit", null);
|
|
212
225
|
__decorate([
|
|
213
|
-
(0,
|
|
226
|
+
(0, logging_1.final)(),
|
|
214
227
|
__metadata("design:type", Function),
|
|
215
228
|
__metadata("design:paramtypes", [Number]),
|
|
216
229
|
__metadata("design:returntype", Object)
|
|
217
230
|
], Statement.prototype, "offset", null);
|
|
218
231
|
__decorate([
|
|
219
|
-
(0,
|
|
232
|
+
(0, logging_1.final)(),
|
|
220
233
|
__metadata("design:type", Function),
|
|
221
|
-
__metadata("design:paramtypes", []),
|
|
234
|
+
__metadata("design:paramtypes", [void 0]),
|
|
222
235
|
__metadata("design:returntype", Promise)
|
|
223
236
|
], Statement.prototype, "execute", null);
|
|
224
237
|
//# sourceMappingURL=Statement.js.map
|
package/lib/query/Statement.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { Condition } from "./Condition";
|
|
|
5
5
|
import type { CountOption, DistinctOption, LimitOption, MaxOption, MinOption, OffsetOption, OrderAndGroupOption, SelectOption, WhereOption } from "./options";
|
|
6
6
|
import { Paginatable } from "../interfaces/Paginatable";
|
|
7
7
|
import { Paginator } from "./Paginator";
|
|
8
|
-
import { Adapter } from "../persistence";
|
|
8
|
+
import { Adapter, type ContextOf } from "../persistence";
|
|
9
9
|
import { Logger } from "@decaf-ts/logging";
|
|
10
|
-
import { LoggedClass } from "@decaf-ts/logging";
|
|
11
10
|
import { Constructor } from "@decaf-ts/decoration";
|
|
11
|
+
import { type ContextualArgs, ContextualLoggedClass, type MaybeContextualArg } from "../utils/index";
|
|
12
12
|
/**
|
|
13
13
|
* @description Base class for database query statements
|
|
14
14
|
* @summary Provides a foundation for building and executing database queries
|
|
@@ -60,8 +60,8 @@ import { Constructor } from "@decaf-ts/decoration";
|
|
|
60
60
|
* Adapter-->>Statement: return processed results
|
|
61
61
|
* Statement-->>Client: return final results
|
|
62
62
|
*/
|
|
63
|
-
export declare abstract class Statement<
|
|
64
|
-
protected adapter: Adapter<any, any, Q, any
|
|
63
|
+
export declare abstract class Statement<M extends Model, A extends Adapter<any, any, any, any>, R, Q = A extends Adapter<any, any, infer Q, any> ? Q : never> extends ContextualLoggedClass<ContextOf<A>> implements Executor<R>, RawExecutor<Q>, Paginatable<M, R, Q> {
|
|
64
|
+
protected adapter: Adapter<any, any, Q, any>;
|
|
65
65
|
protected readonly selectSelector?: SelectSelector<M>[];
|
|
66
66
|
protected distinctSelector?: SelectSelector<M>;
|
|
67
67
|
protected maxSelector?: SelectSelector<M>;
|
|
@@ -73,7 +73,7 @@ export declare abstract class Statement<Q, M extends Model, R> extends LoggedCla
|
|
|
73
73
|
protected groupBySelector?: GroupBySelector<M>;
|
|
74
74
|
protected limitSelector?: number;
|
|
75
75
|
protected offsetSelector?: number;
|
|
76
|
-
protected constructor(adapter: Adapter<any, any, Q, any
|
|
76
|
+
protected constructor(adapter: Adapter<any, any, Q, any>);
|
|
77
77
|
protected get log(): Logger;
|
|
78
78
|
select<S extends readonly SelectSelector<M>[]>(): SelectOption<M, M[]>;
|
|
79
79
|
select<S extends readonly SelectSelector<M>[]>(selector: readonly [...S]): SelectOption<M, Pick<M, S[number]>[]>;
|
|
@@ -87,9 +87,10 @@ export declare abstract class Statement<Q, M extends Model, R> extends LoggedCla
|
|
|
87
87
|
groupBy(selector: GroupBySelector<M>): LimitOption<M, R>;
|
|
88
88
|
limit(value: number): OffsetOption<R>;
|
|
89
89
|
offset(value: number): Executor<R>;
|
|
90
|
-
execute(): Promise<R>;
|
|
91
|
-
raw<R>(rawInput: Q): Promise<R>;
|
|
90
|
+
execute(...args: MaybeContextualArg<ContextOf<A>>): Promise<R>;
|
|
91
|
+
raw<R>(rawInput: Q, ...args: ContextualArgs<ContextOf<A>>): Promise<R>;
|
|
92
92
|
protected abstract build(): Q;
|
|
93
93
|
protected abstract parseCondition(condition: Condition<M>, ...args: any[]): Q;
|
|
94
|
-
abstract paginate(size: number): Promise<Paginator<M, R, Q>>;
|
|
94
|
+
abstract paginate(size: number, ...args: MaybeContextualArg<ContextOf<A>>): Promise<Paginator<M, R, Q>>;
|
|
95
|
+
toString(): string;
|
|
95
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Statement.js","sourceRoot":"","sources":["../../src/query/Statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yEAAuD;AAQvD,+CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"Statement.js","sourceRoot":"","sources":["../../src/query/Statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yEAAuD;AAQvD,+CAAwC;AACxC,2DAAgF;AAChF,+CAA0C;AAc1C,4DAAyD;AACzD,yCAAsC;AAGtC,gDAIwB;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAsB,SAMpB,SAAQ,6BAAmC;IAe3C,YAAgC,OAAkC;QAChE,KAAK,EAAE,CAAC;QADsB,YAAO,GAAP,OAAO,CAA2B;IAElE,CAAC;IAED,IAAu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AGM;IADN,IAAA,eAAK,GAAE;;qCACgB,qBAAS;;sCAGhC;AAGM;IADN,IAAA,eAAK,GAAE;;;;wCAMP;AAGM;IADN,IAAA,eAAK,GAAE;;;;wCAIP;AAGM;IADN,IAAA,eAAK,GAAE;;;;sCAIP;AAGM;IADN,IAAA,eAAK,GAAE;;;;uCAIP;AAGK;IADL,IAAA,eAAK,GAAE;;;;wCAsBP"}
|
package/lib/ram/RamAdapter.cjs
CHANGED
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RamAdapter = void 0;
|
|
4
4
|
const RamStatement_1 = require("./RamStatement.cjs");
|
|
5
|
-
const RamContext_1 = require("./RamContext.cjs");
|
|
6
|
-
const Repository_1 = require("./../repository/Repository.cjs");
|
|
7
5
|
const persistence_1 = require("./../persistence/index.cjs");
|
|
8
6
|
const transactional_decorators_1 = require("@decaf-ts/transactional-decorators");
|
|
9
7
|
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
10
8
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
11
|
-
const RamSequence_1 = require("./RamSequence.cjs");
|
|
12
9
|
const handlers_1 = require("./handlers.cjs");
|
|
13
10
|
const constants_1 = require("./constants.cjs");
|
|
14
11
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
@@ -58,7 +55,7 @@ const decoration_1 = require("@decaf-ts/decoration");
|
|
|
58
55
|
class RamAdapter extends persistence_1.Adapter {
|
|
59
56
|
constructor(conf = {}, alias) {
|
|
60
57
|
super(conf, constants_1.RamFlavour, alias);
|
|
61
|
-
this.Context =
|
|
58
|
+
this.Context = db_decorators_1.Context;
|
|
62
59
|
this.indexes = {};
|
|
63
60
|
this.lock = new transactional_decorators_1.Lock();
|
|
64
61
|
}
|
|
@@ -110,9 +107,10 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
110
107
|
* @param pk - The primary key property name
|
|
111
108
|
* @return Object containing the record and ID
|
|
112
109
|
*/
|
|
113
|
-
prepare(model,
|
|
114
|
-
const
|
|
115
|
-
|
|
110
|
+
prepare(model, ...args) {
|
|
111
|
+
const ctx = args.pop();
|
|
112
|
+
const prepared = super.prepare(model, ...args, ctx);
|
|
113
|
+
delete prepared.record[decorator_validation_1.Model.pk(model.constructor)];
|
|
116
114
|
return prepared;
|
|
117
115
|
}
|
|
118
116
|
/**
|
|
@@ -121,13 +119,12 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
121
119
|
* This method is the inverse of the prepare method.
|
|
122
120
|
* @template M - The model type to revert to
|
|
123
121
|
* @param {Record<string, any>} obj - The stored record
|
|
124
|
-
* @param {
|
|
125
|
-
* @param
|
|
126
|
-
* @param {string | number} id - The primary key value
|
|
122
|
+
* @param {Constructor<M>} clazz - The model class or name
|
|
123
|
+
* @param {PrimaryKeyType} id - The primary key value
|
|
127
124
|
* @return {M} The reconstructed model instance
|
|
128
125
|
*/
|
|
129
|
-
revert(obj, clazz,
|
|
130
|
-
const res = super.revert(obj, clazz,
|
|
126
|
+
revert(obj, clazz, id, transient, ...args) {
|
|
127
|
+
const res = super.revert(obj, clazz, id, transient, ...args);
|
|
131
128
|
return res;
|
|
132
129
|
}
|
|
133
130
|
/**
|
|
@@ -135,7 +132,7 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
135
132
|
* @summary Stores a new record in the specified table with the given ID.
|
|
136
133
|
* This method acquires a lock to ensure thread safety, creates the table if it doesn't exist,
|
|
137
134
|
* checks for conflicts, and stores the model.
|
|
138
|
-
* @param {string}
|
|
135
|
+
* @param {string} clazz - The name of the table to store the record in
|
|
139
136
|
* @param {string | number} id - The unique identifier for the record
|
|
140
137
|
* @param {Record<string, any>} model - The record data to store
|
|
141
138
|
* @return {Promise<Record<string, any>>} A promise that resolves to the stored record
|
|
@@ -159,11 +156,15 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
159
156
|
* RamAdapter->>RamAdapter: lock.release()
|
|
160
157
|
* RamAdapter-->>Caller: model
|
|
161
158
|
*/
|
|
162
|
-
async create(
|
|
159
|
+
async create(clazz, id, model, ctx) {
|
|
160
|
+
const log = ctx.logger.for(this.create);
|
|
161
|
+
const tableName = decorator_validation_1.Model.tableName(clazz);
|
|
162
|
+
log.debug(`creating record in table ${tableName} with id ${id}`);
|
|
163
163
|
await this.lock.acquire();
|
|
164
164
|
if (!this.client.has(tableName))
|
|
165
165
|
this.client.set(tableName, new Map());
|
|
166
|
-
if (this.client.get(tableName) &&
|
|
166
|
+
if (this.client.get(tableName) &&
|
|
167
|
+
this.client.get(tableName)?.has(id))
|
|
167
168
|
throw new db_decorators_1.ConflictError(`Record with id ${id} already exists in table ${tableName}`);
|
|
168
169
|
this.client.get(tableName)?.set(id, model);
|
|
169
170
|
this.lock.release();
|
|
@@ -173,8 +174,8 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
173
174
|
* @description Retrieves a record from in-memory storage
|
|
174
175
|
* @summary Fetches a record with the specified ID from the given table.
|
|
175
176
|
* This method checks if the table and record exist and throws appropriate errors if not.
|
|
176
|
-
* @param {
|
|
177
|
-
* @param {
|
|
177
|
+
* @param {Constructor} clazz - The name of the table to retrieve from
|
|
178
|
+
* @param {PrimaryKeyType} id - The unique identifier of the record to retrieve
|
|
178
179
|
* @return {Promise<Record<string, any>>} A promise that resolves to the retrieved record
|
|
179
180
|
* @mermaid
|
|
180
181
|
* sequenceDiagram
|
|
@@ -195,7 +196,10 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
195
196
|
* Storage-->>RamAdapter: record
|
|
196
197
|
* RamAdapter-->>Caller: record
|
|
197
198
|
*/
|
|
198
|
-
async read(
|
|
199
|
+
async read(clazz, id,
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
201
|
+
ctx) {
|
|
202
|
+
const tableName = decorator_validation_1.Model.tableName(clazz);
|
|
199
203
|
if (!this.client.has(tableName))
|
|
200
204
|
throw new db_decorators_1.NotFoundError(`Table ${tableName} not found`);
|
|
201
205
|
if (!this.client.get(tableName)?.has(id))
|
|
@@ -231,7 +235,10 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
231
235
|
* RamAdapter->>RamAdapter: lock.release()
|
|
232
236
|
* RamAdapter-->>Caller: model
|
|
233
237
|
*/
|
|
234
|
-
async update(
|
|
238
|
+
async update(clazz, id, model, ctx) {
|
|
239
|
+
const log = ctx.logger.for(this.update);
|
|
240
|
+
const tableName = decorator_validation_1.Model.tableName(clazz);
|
|
241
|
+
log.debug(`updating record in table ${tableName} with id ${id}`);
|
|
235
242
|
await this.lock.acquire();
|
|
236
243
|
if (!this.client.has(tableName))
|
|
237
244
|
throw new db_decorators_1.NotFoundError(`Table ${tableName} not found`);
|
|
@@ -271,7 +278,10 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
271
278
|
* RamAdapter->>RamAdapter: lock.release()
|
|
272
279
|
* RamAdapter-->>Caller: record
|
|
273
280
|
*/
|
|
274
|
-
async delete(
|
|
281
|
+
async delete(clazz, id, ctx) {
|
|
282
|
+
const log = ctx.logger.for(this.delete);
|
|
283
|
+
const tableName = decorator_validation_1.Model.tableName(clazz);
|
|
284
|
+
log.debug(`deleting record from table ${tableName} with pk ${id}`);
|
|
275
285
|
await this.lock.acquire();
|
|
276
286
|
if (!this.client.has(tableName))
|
|
277
287
|
throw new db_decorators_1.NotFoundError(`Table ${tableName} not found`);
|
|
@@ -294,7 +304,7 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
294
304
|
tableFor(from) {
|
|
295
305
|
if (typeof from === "string")
|
|
296
306
|
from = decorator_validation_1.Model.get(from);
|
|
297
|
-
const table =
|
|
307
|
+
const table = decorator_validation_1.Model.tableName(from);
|
|
298
308
|
if (!this.client.has(table))
|
|
299
309
|
this.client.set(table, new Map());
|
|
300
310
|
return this.client.get(table);
|
|
@@ -342,7 +352,9 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
342
352
|
* end
|
|
343
353
|
* RamAdapter-->>Caller: result
|
|
344
354
|
*/
|
|
345
|
-
async raw(rawInput) {
|
|
355
|
+
async raw(rawInput, ctx) {
|
|
356
|
+
const log = ctx.logger.for(this.raw);
|
|
357
|
+
log.debug(`performing raw query: ${JSON.stringify(rawInput)}`);
|
|
346
358
|
const { where, sort, limit, skip, from } = rawInput;
|
|
347
359
|
let { select } = rawInput;
|
|
348
360
|
const collection = this.tableFor(from);
|
|
@@ -350,7 +362,7 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
350
362
|
throw new db_decorators_1.InternalError(`Table ${from} not found in RamAdapter`);
|
|
351
363
|
const id = decorator_validation_1.Model.pk(from);
|
|
352
364
|
const props = decoration_1.Metadata.get(from, decoration_1.Metadata.key(db_decorators_1.DBKeys.ID, id));
|
|
353
|
-
let result = Array.from(collection.entries()).map(([pk, r]) => this.revert(r, from,
|
|
365
|
+
let result = Array.from(collection.entries()).map(([pk, r]) => this.revert(r, from, persistence_1.Sequence.parseValue(props.type, pk), undefined, ctx));
|
|
354
366
|
result = where ? result.filter(where) : result;
|
|
355
367
|
if (sort)
|
|
356
368
|
result = result.sort(sort);
|
|
@@ -391,16 +403,6 @@ class RamAdapter extends persistence_1.Adapter {
|
|
|
391
403
|
Statement() {
|
|
392
404
|
return new RamStatement_1.RamStatement(this);
|
|
393
405
|
}
|
|
394
|
-
/**
|
|
395
|
-
* @description Creates a new sequence for generating sequential IDs
|
|
396
|
-
* @summary Factory method that creates a new RamSequence instance for ID generation.
|
|
397
|
-
* This method provides a way to create auto-incrementing sequences for entity IDs.
|
|
398
|
-
* @param {SequenceOptions} options - Configuration options for the sequence
|
|
399
|
-
* @return {Promise<Sequence>} A promise that resolves to the new sequence instance
|
|
400
|
-
*/
|
|
401
|
-
async Sequence(options) {
|
|
402
|
-
return new RamSequence_1.RamSequence(options, this);
|
|
403
|
-
}
|
|
404
406
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
405
407
|
for(config, ...args) {
|
|
406
408
|
if (!this.proxies)
|
package/lib/ram/RamAdapter.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { RamFlags, RawRamQuery, RamStorage,
|
|
1
|
+
import { RamFlags, RawRamQuery, RamStorage, RamConfig, RamContext } from "./types";
|
|
2
2
|
import { RamStatement } from "./RamStatement";
|
|
3
|
-
import {
|
|
3
|
+
import { Repository } from "../repository/Repository";
|
|
4
4
|
import { Dispatch } from "../persistence/Dispatch";
|
|
5
|
-
import { Adapter
|
|
6
|
-
import { SequenceOptions } from "../interfaces";
|
|
5
|
+
import { Adapter } from "../persistence";
|
|
7
6
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
8
|
-
import { BaseError, OperationKeys } from "@decaf-ts/db-decorators";
|
|
7
|
+
import { BaseError, OperationKeys, PrimaryKeyType } from "@decaf-ts/db-decorators";
|
|
9
8
|
import { Constructor } from "@decaf-ts/decoration";
|
|
10
9
|
/**
|
|
11
10
|
* @description In-memory adapter for data persistence
|
|
@@ -50,7 +49,7 @@ import { Constructor } from "@decaf-ts/decoration";
|
|
|
50
49
|
* RamAdapter-->>Repository: model
|
|
51
50
|
* Repository-->>Client: model
|
|
52
51
|
*/
|
|
53
|
-
export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQuery
|
|
52
|
+
export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQuery, RamContext> {
|
|
54
53
|
constructor(conf?: RamConfig, alias?: string);
|
|
55
54
|
/**
|
|
56
55
|
* @description Gets the repository constructor for a model
|
|
@@ -59,7 +58,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
59
58
|
* @template M - The model type for the repository
|
|
60
59
|
* @return {Constructor<RamRepository<M>>} A constructor for creating RAM repositories
|
|
61
60
|
*/
|
|
62
|
-
repository<
|
|
61
|
+
repository<R extends Repository<any, Adapter<any, any, any, any>>>(): Constructor<R>;
|
|
63
62
|
/**
|
|
64
63
|
* @description Creates operation flags with UUID
|
|
65
64
|
* @summary Extends the base flags with a UUID for user identification.
|
|
@@ -71,8 +70,8 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
71
70
|
* @return {Promise<RamFlags>} Complete flags with UUID
|
|
72
71
|
*/
|
|
73
72
|
flags<M extends Model<boolean>>(operation: OperationKeys, model: Constructor<M>, flags: Partial<RamFlags>): Promise<RamFlags>;
|
|
74
|
-
protected Dispatch(): Dispatch
|
|
75
|
-
Context:
|
|
73
|
+
protected Dispatch(): Dispatch<RamAdapter>;
|
|
74
|
+
Context: Constructor<RamContext>;
|
|
76
75
|
private indexes;
|
|
77
76
|
private lock;
|
|
78
77
|
/**
|
|
@@ -92,9 +91,10 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
92
91
|
* @param pk - The primary key property name
|
|
93
92
|
* @return Object containing the record and ID
|
|
94
93
|
*/
|
|
95
|
-
prepare<M extends Model>(model: M,
|
|
94
|
+
prepare<M extends Model>(model: M, ...args: [...any[], RamContext]): {
|
|
96
95
|
record: Record<string, any>;
|
|
97
96
|
id: string;
|
|
97
|
+
transient?: Record<string, any>;
|
|
98
98
|
};
|
|
99
99
|
/**
|
|
100
100
|
* @description Converts a stored record back to a model instance
|
|
@@ -102,18 +102,17 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
102
102
|
* This method is the inverse of the prepare method.
|
|
103
103
|
* @template M - The model type to revert to
|
|
104
104
|
* @param {Record<string, any>} obj - The stored record
|
|
105
|
-
* @param {
|
|
106
|
-
* @param
|
|
107
|
-
* @param {string | number} id - The primary key value
|
|
105
|
+
* @param {Constructor<M>} clazz - The model class or name
|
|
106
|
+
* @param {PrimaryKeyType} id - The primary key value
|
|
108
107
|
* @return {M} The reconstructed model instance
|
|
109
108
|
*/
|
|
110
|
-
revert<M extends Model>(obj: Record<string, any>, clazz:
|
|
109
|
+
revert<M extends Model>(obj: Record<string, any>, clazz: Constructor<M>, id: PrimaryKeyType, transient?: Record<string, any>, ...args: [...any[], RamContext]): M;
|
|
111
110
|
/**
|
|
112
111
|
* @description Creates a new record in the in-memory storage
|
|
113
112
|
* @summary Stores a new record in the specified table with the given ID.
|
|
114
113
|
* This method acquires a lock to ensure thread safety, creates the table if it doesn't exist,
|
|
115
114
|
* checks for conflicts, and stores the model.
|
|
116
|
-
* @param {string}
|
|
115
|
+
* @param {string} clazz - The name of the table to store the record in
|
|
117
116
|
* @param {string | number} id - The unique identifier for the record
|
|
118
117
|
* @param {Record<string, any>} model - The record data to store
|
|
119
118
|
* @return {Promise<Record<string, any>>} A promise that resolves to the stored record
|
|
@@ -137,13 +136,13 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
137
136
|
* RamAdapter->>RamAdapter: lock.release()
|
|
138
137
|
* RamAdapter-->>Caller: model
|
|
139
138
|
*/
|
|
140
|
-
create(
|
|
139
|
+
create<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ctx: RamContext): Promise<Record<string, any>>;
|
|
141
140
|
/**
|
|
142
141
|
* @description Retrieves a record from in-memory storage
|
|
143
142
|
* @summary Fetches a record with the specified ID from the given table.
|
|
144
143
|
* This method checks if the table and record exist and throws appropriate errors if not.
|
|
145
|
-
* @param {
|
|
146
|
-
* @param {
|
|
144
|
+
* @param {Constructor} clazz - The name of the table to retrieve from
|
|
145
|
+
* @param {PrimaryKeyType} id - The unique identifier of the record to retrieve
|
|
147
146
|
* @return {Promise<Record<string, any>>} A promise that resolves to the retrieved record
|
|
148
147
|
* @mermaid
|
|
149
148
|
* sequenceDiagram
|
|
@@ -164,7 +163,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
164
163
|
* Storage-->>RamAdapter: record
|
|
165
164
|
* RamAdapter-->>Caller: record
|
|
166
165
|
*/
|
|
167
|
-
read(
|
|
166
|
+
read<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ctx: RamContext): Promise<Record<string, any>>;
|
|
168
167
|
/**
|
|
169
168
|
* @description Updates an existing record in the in-memory storage
|
|
170
169
|
* @summary Updates a record with the specified ID in the given table.
|
|
@@ -194,7 +193,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
194
193
|
* RamAdapter->>RamAdapter: lock.release()
|
|
195
194
|
* RamAdapter-->>Caller: model
|
|
196
195
|
*/
|
|
197
|
-
update(
|
|
196
|
+
update<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ctx: RamContext): Promise<Record<string, any>>;
|
|
198
197
|
/**
|
|
199
198
|
* @description Deletes a record from the in-memory storage
|
|
200
199
|
* @summary Removes a record with the specified ID from the given table.
|
|
@@ -225,7 +224,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
225
224
|
* RamAdapter->>RamAdapter: lock.release()
|
|
226
225
|
* RamAdapter-->>Caller: record
|
|
227
226
|
*/
|
|
228
|
-
delete(
|
|
227
|
+
delete<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ctx: RamContext): Promise<Record<string, any>>;
|
|
229
228
|
/**
|
|
230
229
|
* @description Gets or creates a table in the in-memory storage
|
|
231
230
|
* @summary Retrieves the Map representing a table for a given model or table name.
|
|
@@ -279,7 +278,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
279
278
|
* end
|
|
280
279
|
* RamAdapter-->>Caller: result
|
|
281
280
|
*/
|
|
282
|
-
raw<R>(rawInput: RawRamQuery<any
|
|
281
|
+
raw<R>(rawInput: RawRamQuery<any>, ctx: RamContext): Promise<R>;
|
|
283
282
|
/**
|
|
284
283
|
* @description Parses and converts errors to appropriate types
|
|
285
284
|
* @summary Ensures that errors are of the correct type for consistent error handling.
|
|
@@ -296,15 +295,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
|
|
|
296
295
|
* @template M - The model type for the statement
|
|
297
296
|
* @return {RamStatement<M, any>} A new statement builder instance
|
|
298
297
|
*/
|
|
299
|
-
Statement<M extends Model<boolean>>(): RamStatement<M, any
|
|
300
|
-
/**
|
|
301
|
-
* @description Creates a new sequence for generating sequential IDs
|
|
302
|
-
* @summary Factory method that creates a new RamSequence instance for ID generation.
|
|
303
|
-
* This method provides a way to create auto-incrementing sequences for entity IDs.
|
|
304
|
-
* @param {SequenceOptions} options - Configuration options for the sequence
|
|
305
|
-
* @return {Promise<Sequence>} A promise that resolves to the new sequence instance
|
|
306
|
-
*/
|
|
307
|
-
Sequence(options: SequenceOptions): Promise<Sequence>;
|
|
298
|
+
Statement<M extends Model<boolean>>(): RamStatement<M, any, Adapter<any, any, RawRamQuery<M>, RamContext>>;
|
|
308
299
|
for(config: Partial<RamConfig>, ...args: any[]): typeof this;
|
|
309
300
|
/**
|
|
310
301
|
* @description Sets up RAM-specific decorations for model properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RamAdapter.js","sourceRoot":"","sources":["../../src/ram/RamAdapter.ts"],"names":[],"mappings":";;;AAOA,qDAA8C;
|
|
1
|
+
{"version":3,"file":"RamAdapter.js","sourceRoot":"","sources":["../../src/ram/RamAdapter.ts"],"names":[],"mappings":";;;AAOA,qDAA8C;AAG9C,4DAAoE;AACpE,iFAA0D;AAC1D,yEAAgE;AAChE,2DAWiC;AACjC,6CAAwD;AACxD,+CAAyC;AACzC,qDAK8B;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAa,UAAW,SAAQ,qBAK/B;IACC,YAAY,OAAkB,EAAS,EAAE,KAAc;QACrD,KAAK,CAAC,IAAI,EAAE,sBAAU,EAAE,KAAK,CAAC,CAAC;QAwCxB,YAAO,GAA4B,uBAAO,CAAC;QAE5C,YAAO,GAGX,EAAE,CAAC;QAEC,SAAI,GAAG,IAAI,+BAAI,EAAE,CAAC;IA9C1B,CAAC;IAED;;;;;;OAMG;IACM,UAAU;QAGjB,OAAO,KAAK,CAAC,UAA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