@webda/core 1.2.1 → 1.6.0-beta.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/application.d.ts +3 -0
- package/lib/application.js +26 -22
- package/lib/application.js.map +1 -1
- package/lib/application.spec.js +185 -2
- package/lib/application.spec.js.map +1 -1
- package/lib/core.d.ts +62 -6
- package/lib/core.js +127 -86
- package/lib/core.js.map +1 -1
- package/lib/core.spec.js +151 -6
- package/lib/core.spec.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/models/aclmodel.d.ts +42 -3
- package/lib/models/aclmodel.js +58 -3
- package/lib/models/aclmodel.js.map +1 -1
- package/lib/models/aclmodel.spec.js +46 -0
- package/lib/models/aclmodel.spec.js.map +1 -1
- package/lib/models/coremodel.d.ts +58 -10
- package/lib/models/coremodel.js +39 -32
- package/lib/models/coremodel.js.map +1 -1
- package/lib/models/coremodel.spec.js +68 -6
- package/lib/models/coremodel.spec.js.map +1 -1
- package/lib/models/ident.d.ts +8 -2
- package/lib/models/ident.js.map +1 -1
- package/lib/models/ident.spec.js +16 -0
- package/lib/models/ident.spec.js.map +1 -1
- package/lib/models/ownermodel.d.ts +1 -1
- package/lib/models/ownermodel.js.map +1 -1
- package/lib/models/ownermodel.spec.js +22 -19
- package/lib/models/ownermodel.spec.js.map +1 -1
- package/lib/models/user.d.ts +2 -0
- package/lib/models/user.js +4 -2
- package/lib/models/user.js.map +1 -1
- package/lib/models/user.spec.js +9 -2
- package/lib/models/user.spec.js.map +1 -1
- package/lib/queues/filequeue.d.ts +63 -0
- package/lib/queues/filequeue.js +161 -0
- package/lib/queues/filequeue.js.map +1 -0
- package/lib/queues/filequeue.spec.d.ts +1 -0
- package/lib/queues/filequeue.spec.js +90 -0
- package/lib/queues/filequeue.spec.js.map +1 -0
- package/lib/queues/memoryqueue.d.ts +18 -4
- package/lib/queues/memoryqueue.js +20 -13
- package/lib/queues/memoryqueue.js.map +1 -1
- package/lib/queues/memoryqueue.spec.js +142 -39
- package/lib/queues/memoryqueue.spec.js.map +1 -1
- package/lib/queues/pubsubservice.d.ts +27 -0
- package/lib/queues/pubsubservice.js +21 -0
- package/lib/queues/pubsubservice.js.map +1 -0
- package/lib/queues/queue.spec.js +16 -7
- package/lib/queues/queue.spec.js.map +1 -1
- package/lib/queues/queueservice.d.ts +108 -13
- package/lib/queues/queueservice.js +100 -36
- package/lib/queues/queueservice.js.map +1 -1
- package/lib/router.js +4 -6
- package/lib/router.js.map +1 -1
- package/lib/router.spec.js +27 -2
- package/lib/router.spec.js.map +1 -1
- package/lib/services/asyncevents.d.ts +110 -5
- package/lib/services/asyncevents.js +134 -39
- package/lib/services/asyncevents.js.map +1 -1
- package/lib/services/asyncevents.spec.js +58 -4
- package/lib/services/asyncevents.spec.js.map +1 -1
- package/lib/services/authentication.d.ts +57 -5
- package/lib/services/authentication.js +93 -84
- package/lib/services/authentication.js.map +1 -1
- package/lib/services/authentication.spec.js +118 -82
- package/lib/services/authentication.spec.js.map +1 -1
- package/lib/services/binary.d.ts +175 -48
- package/lib/services/binary.js +205 -170
- package/lib/services/binary.js.map +1 -1
- package/lib/services/binary.spec.d.ts +22 -3
- package/lib/services/binary.spec.js +327 -22
- package/lib/services/binary.spec.js.map +1 -1
- package/lib/services/configuration.d.ts +94 -13
- package/lib/services/configuration.js +98 -28
- package/lib/services/configuration.js.map +1 -1
- package/lib/services/configuration.spec.js +40 -1
- package/lib/services/configuration.spec.js.map +1 -1
- package/lib/services/cron.d.ts +4 -4
- package/lib/services/cron.js +37 -53
- package/lib/services/cron.js.map +1 -1
- package/lib/services/cron.spec.d.ts +1 -0
- package/lib/services/cron.spec.js +76 -0
- package/lib/services/cron.spec.js.map +1 -0
- package/lib/services/debugmailer.spec.js +18 -4
- package/lib/services/debugmailer.spec.js.map +1 -1
- package/lib/services/echo.js +22 -13
- package/lib/services/echo.js.map +1 -1
- package/lib/services/echo.spec.d.ts +1 -0
- package/lib/services/echo.spec.js +52 -0
- package/lib/services/echo.spec.js.map +1 -0
- package/lib/services/filebinary.d.ts +16 -9
- package/lib/services/filebinary.js +58 -73
- package/lib/services/filebinary.js.map +1 -1
- package/lib/services/filebinary.spec.d.ts +8 -1
- package/lib/services/filebinary.spec.js +133 -7
- package/lib/services/filebinary.spec.js.map +1 -1
- package/lib/services/fileconfiguration.d.ts +9 -3
- package/lib/services/fileconfiguration.js +13 -6
- package/lib/services/fileconfiguration.js.map +1 -1
- package/lib/services/fileconfiguration.spec.js +100 -5
- package/lib/services/fileconfiguration.spec.js.map +1 -1
- package/lib/services/kubernetesconfiguration.d.ts +8 -2
- package/lib/services/kubernetesconfiguration.js +16 -5
- package/lib/services/kubernetesconfiguration.js.map +1 -1
- package/lib/services/kubernetesconfiguration.spec.js +53 -16
- package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
- package/lib/services/mailer.d.ts +11 -2
- package/lib/services/mailer.js +28 -34
- package/lib/services/mailer.js.map +1 -1
- package/lib/services/mailer.spec.js +69 -23
- package/lib/services/mailer.spec.js.map +1 -1
- package/lib/services/oauth.d.ts +5 -2
- package/lib/services/oauth.js +22 -8
- package/lib/services/oauth.js.map +1 -1
- package/lib/services/oauth.spec.js +33 -3
- package/lib/services/oauth.spec.js.map +1 -1
- package/lib/services/resource.spec.js +39 -2
- package/lib/services/resource.spec.js.map +1 -1
- package/lib/services/service.d.ts +16 -0
- package/lib/services/service.js +47 -6
- package/lib/services/service.js.map +1 -1
- package/lib/services/service.spec.d.ts +1 -0
- package/lib/services/service.spec.js +119 -0
- package/lib/services/service.spec.js.map +1 -0
- package/lib/stores/aggregator.d.ts +43 -0
- package/lib/stores/aggregator.js +106 -0
- package/lib/stores/aggregator.js.map +1 -0
- package/lib/stores/file.d.ts +49 -11
- package/lib/stores/file.js +84 -81
- package/lib/stores/file.js.map +1 -1
- package/lib/stores/file.spec.d.ts +6 -1
- package/lib/stores/file.spec.js +134 -9
- package/lib/stores/file.spec.js.map +1 -1
- package/lib/stores/mapper.d.ts +151 -0
- package/lib/stores/mapper.js +294 -0
- package/lib/stores/mapper.js.map +1 -0
- package/lib/stores/mapper.spec.d.ts +1 -0
- package/lib/stores/mapper.spec.js +55 -0
- package/lib/stores/mapper.spec.js.map +1 -0
- package/lib/stores/memory.d.ts +52 -7
- package/lib/stores/memory.js +71 -33
- package/lib/stores/memory.js.map +1 -1
- package/lib/stores/memory.spec.d.ts +6 -1
- package/lib/stores/memory.spec.js +65 -4
- package/lib/stores/memory.spec.js.map +1 -1
- package/lib/stores/store.d.ts +263 -126
- package/lib/stores/store.js +285 -493
- package/lib/stores/store.js.map +1 -1
- package/lib/stores/store.spec.d.ts +20 -0
- package/lib/stores/store.spec.js +242 -18
- package/lib/stores/store.spec.js.map +1 -1
- package/lib/test.d.ts +1 -7
- package/lib/test.js +3 -12
- package/lib/test.js.map +1 -1
- package/lib/utils/abstractdeployer.spec.d.ts +1 -0
- package/lib/utils/abstractdeployer.spec.js +23 -0
- package/lib/utils/abstractdeployer.spec.js.map +1 -0
- package/lib/utils/context.d.ts +25 -2
- package/lib/utils/context.js +33 -12
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/context.spec.js +81 -11
- package/lib/utils/context.spec.js.map +1 -1
- package/lib/utils/cookie.d.ts +12 -0
- package/lib/utils/cookie.js +13 -1
- package/lib/utils/cookie.js.map +1 -1
- package/lib/utils/cookie.spec.js +42 -11
- package/lib/utils/cookie.spec.js.map +1 -1
- package/lib/utils/logger.d.ts +23 -4
- package/lib/utils/logger.js +29 -6
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.spec.js +8 -0
- package/lib/utils/logger.spec.js.map +1 -1
- package/lib/utils/serializers.d.ts +5 -5
- package/lib/utils/serializers.js +10 -10
- package/lib/utils/serializers.js.map +1 -1
- package/lib/utils/serializers.spec.js +41 -16
- package/lib/utils/serializers.spec.js.map +1 -1
- package/lib/utils/waiter.d.ts +59 -1
- package/lib/utils/waiter.js +86 -3
- package/lib/utils/waiter.js.map +1 -1
- package/lib/utils/waiter.spec.js +48 -4
- package/lib/utils/waiter.spec.js.map +1 -1
- package/package.json +16 -11
- package/test/badapp/package.json +4 -0
- package/test/badapp/webda.config.json +1 -0
- package/test/cachedapp/webda.config.json +7 -0
- package/test/config-file-no-reload.json +70 -0
- package/test/config-file-reload.json +7 -1
- package/test/config-kube-reload.json +7 -1
- package/test/config.json +45 -21
- package/test/config.old-default.json +0 -16
- package/test/config.old.json +0 -16
- package/test/deployments/invalid.json +1 -0
- package/test/moddas/fakeservice.js +5 -0
- package/test/models/ident.js +10 -14
- package/test/models/task.js +2 -4
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { StoreTest } from "./store.spec";
|
|
2
|
-
import { Store } from "../index";
|
|
2
|
+
import { CoreModel, Store } from "../index";
|
|
3
3
|
declare class MemoryStoreTest extends StoreTest {
|
|
4
4
|
getIdentStore(): Store<any>;
|
|
5
5
|
getUserStore(): Store<any>;
|
|
6
|
+
getIndex(): Promise<CoreModel>;
|
|
7
|
+
recreateIndex(): Promise<void>;
|
|
6
8
|
deleteAsyncHttp(): Promise<void>;
|
|
9
|
+
initRoutes(): void;
|
|
10
|
+
getSync(): void;
|
|
11
|
+
badActions(): Promise<void>;
|
|
7
12
|
}
|
|
8
13
|
export { MemoryStoreTest };
|
|
@@ -20,13 +20,33 @@ const store_spec_1 = require("./store.spec");
|
|
|
20
20
|
const assert = require("assert");
|
|
21
21
|
const mocha_1 = require("@testdeck/mocha");
|
|
22
22
|
const context_1 = require("../utils/context");
|
|
23
|
+
const store_1 = require("./store");
|
|
23
24
|
let MemoryStoreTest = class MemoryStoreTest extends store_spec_1.StoreTest {
|
|
24
25
|
getIdentStore() {
|
|
25
|
-
|
|
26
|
+
// Need to slow down the _get
|
|
27
|
+
let store = this.getService("MemoryIdents");
|
|
28
|
+
let original = store._get.bind(store);
|
|
29
|
+
store._get = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
yield this.sleep(1);
|
|
31
|
+
return original(...args);
|
|
32
|
+
});
|
|
33
|
+
return store;
|
|
26
34
|
}
|
|
27
35
|
getUserStore() {
|
|
28
36
|
return this.getService("MemoryUsers");
|
|
29
37
|
}
|
|
38
|
+
getIndex() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return this.getService("memoryaggregators").get("index");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
recreateIndex() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let store = this.getService("memoryaggregators");
|
|
46
|
+
yield store.__clean();
|
|
47
|
+
yield this.getService("memoryidentsindexer").createAggregate();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
30
50
|
deleteAsyncHttp() {
|
|
31
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
52
|
let executor, ctx;
|
|
@@ -39,19 +59,60 @@ let MemoryStoreTest = class MemoryStoreTest extends store_spec_1.StoreTest {
|
|
|
39
59
|
yield identStore.delete("toDelete");
|
|
40
60
|
executor = this.getExecutor(ctx, "test.webda.io", "GET", "/memory/idents/toDelete");
|
|
41
61
|
assert.notStrictEqual(executor, undefined);
|
|
42
|
-
yield
|
|
62
|
+
yield assert.rejects(() => executor.execute(ctx), err => err == 404);
|
|
43
63
|
executor = this.getExecutor(ctx, "test.webda.io", "PUT", "/memory/idents/toDelete");
|
|
44
64
|
assert.notStrictEqual(executor, undefined);
|
|
45
|
-
yield
|
|
65
|
+
yield assert.rejects(() => executor.execute(ctx), err => err == 404);
|
|
46
66
|
executor = this.getExecutor(ctx, "test.webda.io", "DELETE", "/memory/idents/toDelete");
|
|
47
67
|
assert.notStrictEqual(executor, undefined);
|
|
48
|
-
yield
|
|
68
|
+
yield assert.rejects(() => executor.execute(ctx), err => err == 404);
|
|
69
|
+
assert.strictEqual(identStore._getSync("notFound"), null);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
initRoutes() {
|
|
73
|
+
// cov
|
|
74
|
+
let identStore = this.getIdentStore();
|
|
75
|
+
identStore.getParameters().expose = undefined;
|
|
76
|
+
identStore.initRoutes();
|
|
77
|
+
}
|
|
78
|
+
getSync() {
|
|
79
|
+
let identStore = this.getIdentStore();
|
|
80
|
+
assert.throws(() => identStore._getSync("plop", true), store_1.StoreNotFoundError);
|
|
81
|
+
}
|
|
82
|
+
badActions() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
let identStore = this.getIdentStore();
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
identStore._model = {
|
|
87
|
+
getActions: () => {
|
|
88
|
+
return { test: { global: true } };
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
yield assert.throws(() => identStore.initRoutes(), /Action static method _test does not exist/);
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
identStore._model = {
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
prototype: {},
|
|
96
|
+
getActions: () => {
|
|
97
|
+
return { test: { global: false } };
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
yield assert.throws(() => identStore.initRoutes(), /Action method _test does not exist/);
|
|
49
101
|
});
|
|
50
102
|
}
|
|
51
103
|
};
|
|
52
104
|
__decorate([
|
|
53
105
|
mocha_1.test
|
|
54
106
|
], MemoryStoreTest.prototype, "deleteAsyncHttp", null);
|
|
107
|
+
__decorate([
|
|
108
|
+
mocha_1.test
|
|
109
|
+
], MemoryStoreTest.prototype, "initRoutes", null);
|
|
110
|
+
__decorate([
|
|
111
|
+
mocha_1.test
|
|
112
|
+
], MemoryStoreTest.prototype, "getSync", null);
|
|
113
|
+
__decorate([
|
|
114
|
+
mocha_1.test
|
|
115
|
+
], MemoryStoreTest.prototype, "badActions", null);
|
|
55
116
|
MemoryStoreTest = __decorate([
|
|
56
117
|
mocha_1.suite
|
|
57
118
|
], MemoryStoreTest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.spec.js","sourceRoot":"","sources":["../../src/stores/memory.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAEzC,iCAAiC;AACjC,2CAA8C;AAC9C,8CAA+C;
|
|
1
|
+
{"version":3,"file":"memory.spec.js","sourceRoot":"","sources":["../../src/stores/memory.spec.ts"],"names":[],"mappings":"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"}
|
package/lib/stores/store.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { EventWithContext } from "../core";
|
|
1
|
+
import { EventWithContext, WebdaError } from "../core";
|
|
2
2
|
import { ConfigurationProvider } from "../index";
|
|
3
3
|
import { CoreModel, CoreModelDefinition } from "../models/coremodel";
|
|
4
4
|
import { Service, ServiceParameters } from "../services/service";
|
|
5
5
|
import { Context } from "../utils/context";
|
|
6
|
+
export declare class StoreNotFoundError extends WebdaError {
|
|
7
|
+
constructor(uuid: string, storeName: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class UpdateConditionFailError extends WebdaError {
|
|
10
|
+
constructor(uuid: string, conditionField: string, condition: string | Date);
|
|
11
|
+
}
|
|
6
12
|
interface EventStore {
|
|
7
13
|
/**
|
|
8
14
|
* Target object
|
|
@@ -100,6 +106,10 @@ export interface EventStorePartialUpdated {
|
|
|
100
106
|
* Emitting store
|
|
101
107
|
*/
|
|
102
108
|
store: Store;
|
|
109
|
+
/**
|
|
110
|
+
* Update date
|
|
111
|
+
*/
|
|
112
|
+
updateDate?: Date;
|
|
103
113
|
/**
|
|
104
114
|
* Info on the update
|
|
105
115
|
*/
|
|
@@ -147,6 +157,7 @@ export interface EventStorePartialUpdated {
|
|
|
147
157
|
*/
|
|
148
158
|
index: number;
|
|
149
159
|
};
|
|
160
|
+
deleteAttribute?: string;
|
|
150
161
|
};
|
|
151
162
|
}
|
|
152
163
|
/**
|
|
@@ -209,6 +220,19 @@ export interface EventStoreWebGet extends EventWithContext {
|
|
|
209
220
|
*/
|
|
210
221
|
object: CoreModel;
|
|
211
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Event sent when object is retrieved via GET request
|
|
225
|
+
*/
|
|
226
|
+
export interface EventStoreWebGetNotFound extends EventWithContext {
|
|
227
|
+
/**
|
|
228
|
+
* Emitting store
|
|
229
|
+
*/
|
|
230
|
+
store: Store;
|
|
231
|
+
/**
|
|
232
|
+
* Target object
|
|
233
|
+
*/
|
|
234
|
+
uuid: string;
|
|
235
|
+
}
|
|
212
236
|
/**
|
|
213
237
|
* Event sent when object is updated via PUT request
|
|
214
238
|
*/
|
|
@@ -243,62 +267,47 @@ export interface EventStoreWebDelete extends EventWithContext {
|
|
|
243
267
|
*/
|
|
244
268
|
store: Store;
|
|
245
269
|
}
|
|
246
|
-
|
|
247
|
-
* Mapper parameters
|
|
248
|
-
*/
|
|
249
|
-
export interface MapStoreParameter {
|
|
250
|
-
/**
|
|
251
|
-
* Key on the current model which holds the collection
|
|
252
|
-
*/
|
|
253
|
-
key: string;
|
|
254
|
-
/**
|
|
255
|
-
* Other fields to duplicate inside the model
|
|
256
|
-
*/
|
|
257
|
-
fields: string;
|
|
270
|
+
export declare type ExposeParameters = {
|
|
258
271
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
272
|
+
* URL endpoint to use to expose REST Resources API
|
|
273
|
+
*
|
|
274
|
+
* @default service.getName().toLowerCase()
|
|
261
275
|
*/
|
|
262
|
-
|
|
276
|
+
url?: string;
|
|
263
277
|
/**
|
|
264
|
-
*
|
|
278
|
+
* You can restrict any part of the CRUD
|
|
279
|
+
*
|
|
280
|
+
* @default {}
|
|
265
281
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
282
|
+
restrict?: {
|
|
283
|
+
/**
|
|
284
|
+
* Do not expose the POST
|
|
285
|
+
*/
|
|
286
|
+
create?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Do not expose the PUT and PATCH
|
|
289
|
+
*/
|
|
290
|
+
update?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Do not expose the GET
|
|
293
|
+
*/
|
|
294
|
+
get?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Do not expose the DELETE
|
|
297
|
+
*/
|
|
298
|
+
delete?: boolean;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
268
301
|
/**
|
|
269
302
|
* Store parameter
|
|
270
303
|
*/
|
|
271
304
|
export declare class StoreParameters extends ServiceParameters {
|
|
272
|
-
/**
|
|
273
|
-
* Field to store the lastUpdate of the object
|
|
274
|
-
*
|
|
275
|
-
* @default "_lastUpdate"
|
|
276
|
-
*/
|
|
277
|
-
lastUpdateField?: string;
|
|
278
|
-
/**
|
|
279
|
-
* Field to store the creationDate of the object
|
|
280
|
-
*
|
|
281
|
-
* @default "_creationDate"
|
|
282
|
-
*/
|
|
283
|
-
creationDateField?: string;
|
|
284
305
|
/**
|
|
285
306
|
* Webda model to use within the Store
|
|
286
307
|
*
|
|
287
308
|
* @default "Webda/CoreModel"
|
|
288
309
|
*/
|
|
289
310
|
model?: string;
|
|
290
|
-
/**
|
|
291
|
-
* Create an index object that link all other objects uuid
|
|
292
|
-
*/
|
|
293
|
-
index?: string[];
|
|
294
|
-
/**
|
|
295
|
-
* You can define a Map between different Stores
|
|
296
|
-
*
|
|
297
|
-
* {@link Pages/pages/Store}
|
|
298
|
-
*/
|
|
299
|
-
map: {
|
|
300
|
-
[key: string]: MapStoreParameter;
|
|
301
|
-
};
|
|
302
311
|
/**
|
|
303
312
|
* async delete
|
|
304
313
|
*/
|
|
@@ -306,39 +315,24 @@ export declare class StoreParameters extends ServiceParameters {
|
|
|
306
315
|
/**
|
|
307
316
|
* Expose the service to an urls
|
|
308
317
|
*/
|
|
309
|
-
expose?:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
* You can restrict any part of the CRUD
|
|
318
|
-
*
|
|
319
|
-
* @default {}
|
|
320
|
-
*/
|
|
321
|
-
restrict?: {
|
|
322
|
-
/**
|
|
323
|
-
* Do not expose the POST
|
|
324
|
-
*/
|
|
325
|
-
create?: boolean;
|
|
326
|
-
/**
|
|
327
|
-
* Do not expose the PUT and PATCH
|
|
328
|
-
*/
|
|
329
|
-
update?: boolean;
|
|
330
|
-
/**
|
|
331
|
-
* Do not expose the GET
|
|
332
|
-
*/
|
|
333
|
-
get?: boolean;
|
|
334
|
-
/**
|
|
335
|
-
* Do not expose the DELETE
|
|
336
|
-
*/
|
|
337
|
-
delete?: boolean;
|
|
338
|
-
};
|
|
339
|
-
};
|
|
318
|
+
expose?: ExposeParameters | boolean | string;
|
|
319
|
+
/**
|
|
320
|
+
* Allow to load object that does not have the type data
|
|
321
|
+
*
|
|
322
|
+
* @deprecated 2.0
|
|
323
|
+
* @default true
|
|
324
|
+
*/
|
|
325
|
+
strict?: boolean;
|
|
340
326
|
constructor(params: any, service: Service<any>);
|
|
341
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* A mapping service allow to link two object together
|
|
330
|
+
*
|
|
331
|
+
* Therefore they need to handle the cascadeDelete
|
|
332
|
+
*/
|
|
333
|
+
export interface MappingService<T = any> {
|
|
334
|
+
initModel(object: any): T;
|
|
335
|
+
}
|
|
342
336
|
/**
|
|
343
337
|
* This class handle NoSQL storage and mapping (duplication) between NoSQL object
|
|
344
338
|
* TODO Create the mapping documentation
|
|
@@ -373,13 +367,29 @@ export declare class StoreParameters extends ServiceParameters {
|
|
|
373
367
|
* }
|
|
374
368
|
* @category CoreServices
|
|
375
369
|
*/
|
|
376
|
-
declare abstract class Store<T extends CoreModel = CoreModel, K extends StoreParameters = StoreParameters> extends Service<K> implements ConfigurationProvider {
|
|
377
|
-
|
|
378
|
-
|
|
370
|
+
declare abstract class Store<T extends CoreModel = CoreModel, K extends StoreParameters = StoreParameters> extends Service<K> implements ConfigurationProvider, MappingService<T> {
|
|
371
|
+
/**
|
|
372
|
+
* Contain the reverse map
|
|
373
|
+
*/
|
|
374
|
+
_reverseMap: {
|
|
375
|
+
mapper: MappingService;
|
|
376
|
+
property: string;
|
|
377
|
+
}[];
|
|
378
|
+
/**
|
|
379
|
+
* Contains the current model
|
|
380
|
+
*/
|
|
379
381
|
_model: CoreModelDefinition;
|
|
380
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Contain the model update date
|
|
384
|
+
*/
|
|
381
385
|
_lastUpdateField: string;
|
|
386
|
+
/**
|
|
387
|
+
* Contain the model creation date
|
|
388
|
+
*/
|
|
382
389
|
_creationDateField: string;
|
|
390
|
+
/**
|
|
391
|
+
* Contain the model uuid field
|
|
392
|
+
*/
|
|
383
393
|
protected _uuidField: string;
|
|
384
394
|
/**
|
|
385
395
|
* Load the parameters for a service
|
|
@@ -391,36 +401,86 @@ declare abstract class Store<T extends CoreModel = CoreModel, K extends StorePar
|
|
|
391
401
|
* @throws Error if model is not found
|
|
392
402
|
*/
|
|
393
403
|
computeParameters(): void;
|
|
404
|
+
/**
|
|
405
|
+
* Return Store current model
|
|
406
|
+
* @returns
|
|
407
|
+
*/
|
|
394
408
|
getModel(): CoreModelDefinition;
|
|
395
|
-
|
|
396
|
-
|
|
409
|
+
getLastUpdateField(): string;
|
|
410
|
+
getObject(uid: string): Promise<CoreModel>;
|
|
411
|
+
/**
|
|
412
|
+
* @inheritdoc
|
|
413
|
+
*/
|
|
397
414
|
initRoutes(): void;
|
|
415
|
+
/**
|
|
416
|
+
* Get the url where the store is exposed
|
|
417
|
+
*/
|
|
398
418
|
getUrl(): string;
|
|
419
|
+
/**
|
|
420
|
+
* Init a model from the current stored data
|
|
421
|
+
*
|
|
422
|
+
* Initial the reverse map as well
|
|
423
|
+
*
|
|
424
|
+
* @param object
|
|
425
|
+
* @returns
|
|
426
|
+
*/
|
|
399
427
|
initModel(object?: any): T;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Add reverse map information
|
|
430
|
+
*
|
|
431
|
+
* @param prop
|
|
432
|
+
* @param cascade
|
|
433
|
+
* @param store
|
|
434
|
+
*/
|
|
435
|
+
addReverseMap(prop: string, store: MappingService): void;
|
|
403
436
|
incrementAttribute(uid: string, prop: string, value: number): any;
|
|
404
437
|
upsertItemToCollection(uid: string, prop: string, item: any, index?: number, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
405
|
-
|
|
406
|
-
_upsertItemToCollection(uid: string, prop: string, item: any, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<any>;
|
|
407
|
-
deleteItemFromCollection(uid: string, prop: string, index: number, itemWriteCondition: any, itemWriteConditionField: string): Promise<void>;
|
|
408
|
-
_deleteItemFromCollection(uid: string, prop: string, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<any>;
|
|
409
|
-
createIndex(): Promise<void>;
|
|
410
|
-
initMap(map: any): void;
|
|
411
|
-
toString(): string;
|
|
412
|
-
generateUid(): any;
|
|
438
|
+
deleteItemFromCollection(uid: string, prop: string, index: number, itemWriteCondition: any, itemWriteConditionField?: string): Promise<void>;
|
|
413
439
|
/**
|
|
414
440
|
* Save an object
|
|
415
441
|
*
|
|
416
442
|
* @param {Object} Object to save
|
|
417
443
|
* @param {String} Uuid to use, if not specified take the object.uuid or generate one if not found
|
|
418
444
|
* @return {Promise} with saved object
|
|
445
|
+
*
|
|
446
|
+
* Might want to rename to create
|
|
419
447
|
*/
|
|
420
448
|
save(object: any, ctx?: Context): Promise<any>;
|
|
421
|
-
|
|
449
|
+
/**
|
|
450
|
+
* Patch an object
|
|
451
|
+
*
|
|
452
|
+
* @param object
|
|
453
|
+
* @param reverseMap
|
|
454
|
+
* @returns
|
|
455
|
+
*/
|
|
422
456
|
patch(object: any, reverseMap?: boolean): Promise<any>;
|
|
423
|
-
|
|
457
|
+
/**
|
|
458
|
+
* Check if an UpdateCondition is met
|
|
459
|
+
* @param model
|
|
460
|
+
* @param conditionField
|
|
461
|
+
* @param condition
|
|
462
|
+
* @param uid
|
|
463
|
+
*/
|
|
464
|
+
checkUpdateCondition(model: T, conditionField?: string, condition?: any, uid?: string): void;
|
|
465
|
+
/**
|
|
466
|
+
* Check if an UpdateCondition is met
|
|
467
|
+
* @param model
|
|
468
|
+
* @param conditionField
|
|
469
|
+
* @param condition
|
|
470
|
+
* @param uid
|
|
471
|
+
*/
|
|
472
|
+
checkCollectionUpdateCondition(model: T, collection: string, conditionField?: string, condition?: any, index?: number): void;
|
|
473
|
+
/**
|
|
474
|
+
*
|
|
475
|
+
* @param model
|
|
476
|
+
* @param prop
|
|
477
|
+
* @param item
|
|
478
|
+
* @param index
|
|
479
|
+
* @param itemWriteCondition
|
|
480
|
+
* @param itemWriteConditionField
|
|
481
|
+
* @param updateDate
|
|
482
|
+
*/
|
|
483
|
+
simulateUpsertItemToCollection(model: T, prop: string, item: any, updateDate: Date, index?: number, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
424
484
|
/**
|
|
425
485
|
* Update an object
|
|
426
486
|
*
|
|
@@ -429,45 +489,36 @@ declare abstract class Store<T extends CoreModel = CoreModel, K extends StorePar
|
|
|
429
489
|
* @return {Promise} with saved object
|
|
430
490
|
*/
|
|
431
491
|
update(object: any, reverseMap?: boolean, partial?: boolean): Promise<any>;
|
|
432
|
-
getMapper(map: any, uuid: any): number;
|
|
433
|
-
removeMapper(map: any, uuid: any): boolean;
|
|
434
|
-
_handleUpdatedMap(object: any, map: any, mapped: any, store: any, updates: any): Promise<any>;
|
|
435
|
-
_handleUpdatedMapTransferOut(object: any, map: any, mapped: any, store: any, updates: any): any;
|
|
436
|
-
_handleUpdatedMapTransferIn(object: any, map: any, store: any, updates: any): any;
|
|
437
|
-
_handleUpdatedMapMapper(object: any, map: any, mapped: any, store: any, updates: any): any;
|
|
438
|
-
_handleDeletedMap(object: any, map: any, mapped: any, store: any): any;
|
|
439
|
-
_handleCreatedMap(object: any, map: any, mapped: any, store: any): any;
|
|
440
|
-
_handleMapProperty(store: any, object: any, property: any, updates: any): Promise<any>;
|
|
441
|
-
abstract _removeAttribute(uuid: string, attribute: string): Promise<void>;
|
|
442
|
-
removeAttribute(uuid: string, attribute: string): Promise<void>;
|
|
443
|
-
handleIndex(object: CoreModel, updates: object | string): Promise<void>;
|
|
444
|
-
handleMap(object: any, map: any, updates: any): Promise<any[]>;
|
|
445
|
-
_update(object: any, uid: any, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<any>;
|
|
446
|
-
_patch(object: any, uid: string, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<any>;
|
|
447
|
-
cascadeDelete(obj: any, uuid: string): Promise<any>;
|
|
448
492
|
/**
|
|
449
|
-
*
|
|
493
|
+
* Remove an attribute from an object
|
|
450
494
|
*
|
|
451
|
-
* @param
|
|
452
|
-
* @param
|
|
453
|
-
* @
|
|
495
|
+
* @param uuid
|
|
496
|
+
* @param attribute
|
|
497
|
+
* @returns
|
|
454
498
|
*/
|
|
455
|
-
|
|
499
|
+
removeAttribute(uuid: string, attribute: string, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
456
500
|
/**
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
* @
|
|
501
|
+
* Cascade delete a related object
|
|
502
|
+
*
|
|
503
|
+
* @param obj
|
|
504
|
+
* @param uuid
|
|
505
|
+
* @returns
|
|
460
506
|
*/
|
|
461
|
-
|
|
462
|
-
_delete(uid: string, writeCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
463
|
-
_get(uid: string): Promise<any>;
|
|
507
|
+
cascadeDelete(obj: CoreModel, uuid: string): Promise<any>;
|
|
464
508
|
/**
|
|
465
|
-
*
|
|
509
|
+
* Delete an object from the store without condition nor async
|
|
510
|
+
* @param uid to delete
|
|
511
|
+
* @returns
|
|
512
|
+
*/
|
|
513
|
+
forceDelete(uid: string): Promise<void>;
|
|
514
|
+
/**
|
|
515
|
+
* Delete an object
|
|
466
516
|
*
|
|
467
|
-
* @param {
|
|
468
|
-
* @
|
|
517
|
+
* @param {String} uuid to delete
|
|
518
|
+
* @param {Boolean} delete sync even if asyncDelete is active
|
|
519
|
+
* @return {Promise} the deletion promise
|
|
469
520
|
*/
|
|
470
|
-
|
|
521
|
+
delete(uid: string | T, writeCondition?: any, writeConditionField?: string, sync?: boolean): Promise<void>;
|
|
471
522
|
/**
|
|
472
523
|
* By default we cannot know if the store will trigger or not
|
|
473
524
|
*
|
|
@@ -480,7 +531,9 @@ declare abstract class Store<T extends CoreModel = CoreModel, K extends StorePar
|
|
|
480
531
|
* @param {string} id
|
|
481
532
|
* @returns {Promise<Map<string, any>>}
|
|
482
533
|
*/
|
|
483
|
-
getConfiguration(id: string): Promise<
|
|
534
|
+
getConfiguration(id: string): Promise<{
|
|
535
|
+
[key: string]: any;
|
|
536
|
+
}>;
|
|
484
537
|
/**
|
|
485
538
|
* Get an object
|
|
486
539
|
*
|
|
@@ -488,10 +541,42 @@ declare abstract class Store<T extends CoreModel = CoreModel, K extends StorePar
|
|
|
488
541
|
* @return {Promise} the object retrieved ( can be undefined if not found )
|
|
489
542
|
*/
|
|
490
543
|
get(uid: string, ctx?: Context): Promise<T>;
|
|
544
|
+
/**
|
|
545
|
+
* Set one attribute in an object
|
|
546
|
+
*
|
|
547
|
+
* this is an helper function that calls patch
|
|
548
|
+
*
|
|
549
|
+
* @param uid of the object
|
|
550
|
+
* @param property to update1
|
|
551
|
+
* @param value new value
|
|
552
|
+
* @returns
|
|
553
|
+
*/
|
|
554
|
+
setAttribute(uid: string, property: string, value: any): Promise<void>;
|
|
555
|
+
/**
|
|
556
|
+
* Search inside the store
|
|
557
|
+
*
|
|
558
|
+
* Still need to define a good abstraction for it
|
|
559
|
+
*
|
|
560
|
+
* @param request
|
|
561
|
+
* @param offset
|
|
562
|
+
* @param limit
|
|
563
|
+
* @returns
|
|
564
|
+
*/
|
|
491
565
|
find(request?: any, offset?: number, limit?: number): Promise<any>;
|
|
492
|
-
|
|
566
|
+
/**
|
|
567
|
+
* Handle POST
|
|
568
|
+
* @param ctx
|
|
569
|
+
*/
|
|
493
570
|
httpCreate(ctx: Context): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Handle obect action
|
|
573
|
+
* @param ctx
|
|
574
|
+
*/
|
|
494
575
|
httpAction(ctx: Context): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Handle collection action
|
|
578
|
+
* @param ctx
|
|
579
|
+
*/
|
|
495
580
|
httpGlobalAction(ctx: Context): Promise<void>;
|
|
496
581
|
/**
|
|
497
582
|
* Handle HTTP Update for an object
|
|
@@ -512,5 +597,57 @@ declare abstract class Store<T extends CoreModel = CoreModel, K extends StorePar
|
|
|
512
597
|
* @returns
|
|
513
598
|
*/
|
|
514
599
|
httpRoute(ctx: Context): Promise<void>;
|
|
600
|
+
/**
|
|
601
|
+
* Return the model uuid field
|
|
602
|
+
*/
|
|
603
|
+
getUuidField(): string;
|
|
604
|
+
abstract _find(request: any, offset: any, limit: any): Promise<CoreModel[]>;
|
|
605
|
+
/**
|
|
606
|
+
* Check if an object exists
|
|
607
|
+
* @abstract
|
|
608
|
+
* @params {String} uuid of the object
|
|
609
|
+
*/
|
|
610
|
+
abstract exists(uid: string): Promise<boolean>;
|
|
611
|
+
/**
|
|
612
|
+
* The underlying store should recheck writeCondition only if it does not require
|
|
613
|
+
* another get()
|
|
614
|
+
*
|
|
615
|
+
* @param uid
|
|
616
|
+
* @param writeCondition
|
|
617
|
+
* @param itemWriteConditionField
|
|
618
|
+
*/
|
|
619
|
+
abstract _delete(uid: string, writeCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* Retrieve an element from the store
|
|
622
|
+
*
|
|
623
|
+
* @param uid to retrieve
|
|
624
|
+
* @param raiseIfNotFound raise an StoreNotFound exception if not found
|
|
625
|
+
*/
|
|
626
|
+
abstract _get(uid: string, raiseIfNotFound?: boolean): Promise<T>;
|
|
627
|
+
/**
|
|
628
|
+
* Get an object
|
|
629
|
+
*
|
|
630
|
+
* @param {Array} uuid to gets if undefined then retrieve the all table
|
|
631
|
+
* @return {Promise} the objects retrieved ( can be [] if not found )
|
|
632
|
+
*/
|
|
633
|
+
abstract getAll(list?: string[]): Promise<T[]>;
|
|
634
|
+
abstract _update(object: any, uid: string, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<any>;
|
|
635
|
+
abstract _patch(object: any, uid: string, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<any>;
|
|
636
|
+
abstract _removeAttribute(uuid: string, attribute: string, itemWriteCondition?: any, itemWriteConditionField?: string): Promise<void>;
|
|
637
|
+
/**
|
|
638
|
+
* Save within the store
|
|
639
|
+
* @param object
|
|
640
|
+
*/
|
|
641
|
+
abstract _save(object: T): Promise<any>;
|
|
642
|
+
/**
|
|
643
|
+
* Increment the attribute
|
|
644
|
+
* @param uid
|
|
645
|
+
* @param prop
|
|
646
|
+
* @param value
|
|
647
|
+
* @param updateDate
|
|
648
|
+
*/
|
|
649
|
+
abstract _incrementAttribute(uid: string, prop: string, value: number, updateDate: Date): Promise<any>;
|
|
650
|
+
abstract _upsertItemToCollection(uid: string, prop: string, item: any, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<any>;
|
|
651
|
+
abstract _deleteItemFromCollection(uid: string, prop: string, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<any>;
|
|
515
652
|
}
|
|
516
653
|
export { Store };
|