@webda/core 2.1.5 → 2.3.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 +55 -8
- package/lib/application.js +27 -1
- package/lib/application.js.map +1 -1
- package/lib/application.spec.js +8 -2
- package/lib/application.spec.js.map +1 -1
- package/lib/core.d.ts +66 -6
- package/lib/core.js +96 -3
- package/lib/core.js.map +1 -1
- package/lib/core.spec.js +49 -1
- package/lib/core.spec.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/models/aclmodel.d.ts +1 -1
- package/lib/models/aclmodel.spec.js +10 -10
- package/lib/models/aclmodel.spec.js.map +1 -1
- package/lib/models/coremodel.d.ts +79 -24
- package/lib/models/coremodel.js +96 -19
- package/lib/models/coremodel.js.map +1 -1
- package/lib/models/coremodel.spec.js +32 -2
- package/lib/models/coremodel.spec.js.map +1 -1
- package/lib/models/user.d.ts +3 -3
- package/lib/models/user.js.map +1 -1
- package/lib/models/user.spec.js +1 -0
- package/lib/models/user.spec.js.map +1 -1
- package/lib/router.d.ts +1 -1
- package/lib/services/authentication.d.ts +1 -1
- package/lib/services/binary.d.ts +2 -2
- package/lib/services/cloudbinary.spec.js +1 -0
- package/lib/services/cloudbinary.spec.js.map +1 -1
- package/lib/services/configuration.d.ts +1 -1
- package/lib/services/cron.d.ts +1 -0
- package/lib/services/cron.js +9 -1
- package/lib/services/cron.js.map +1 -1
- package/lib/services/cron.spec.js +1 -0
- package/lib/services/cron.spec.js.map +1 -1
- package/lib/services/oauth.d.ts +1 -1
- package/lib/services/proxy.d.ts +7 -1
- package/lib/services/proxy.js +13 -4
- package/lib/services/proxy.js.map +1 -1
- package/lib/services/service.d.ts +28 -4
- package/lib/services/service.js +15 -11
- package/lib/services/service.js.map +1 -1
- package/lib/services/service.spec.js +55 -7
- package/lib/services/service.spec.js.map +1 -1
- package/lib/stores/aliasstore.d.ts +107 -0
- package/lib/stores/aliasstore.js +152 -0
- package/lib/stores/aliasstore.js.map +1 -0
- package/lib/stores/aliasstore.spec.d.ts +11 -0
- package/lib/stores/aliasstore.spec.js +87 -0
- package/lib/stores/aliasstore.spec.js.map +1 -0
- package/lib/stores/file.js +1 -1
- package/lib/stores/file.js.map +1 -1
- package/lib/stores/file.spec.js +12 -113
- package/lib/stores/file.spec.js.map +1 -1
- package/lib/stores/mapper.d.ts +1 -1
- package/lib/stores/mapper.js +1 -1
- package/lib/stores/mapper.js.map +1 -1
- package/lib/stores/memory.spec.d.ts +1 -0
- package/lib/stores/memory.spec.js +23 -0
- package/lib/stores/memory.spec.js.map +1 -1
- package/lib/stores/store.d.ts +76 -6
- package/lib/stores/store.js +116 -10
- package/lib/stores/store.js.map +1 -1
- package/lib/stores/store.spec.d.ts +2 -0
- package/lib/stores/store.spec.js +121 -0
- package/lib/stores/store.spec.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLLexer.js +5 -5
- package/lib/stores/webdaql/WebdaQLLexer.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserLexer.js +5 -5
- package/lib/stores/webdaql/WebdaQLParserLexer.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserParser.js +4 -4
- package/lib/stores/webdaql/WebdaQLParserParser.js.map +1 -1
- package/lib/stores/webdaql/query.d.ts +16 -1
- package/lib/stores/webdaql/query.js +50 -1
- package/lib/stores/webdaql/query.js.map +1 -1
- package/lib/stores/webdaql/query.spec.js +20 -0
- package/lib/stores/webdaql/query.spec.js.map +1 -1
- package/lib/test.js +1 -3
- package/lib/test.js.map +1 -1
- package/lib/utils/context.d.ts +15 -4
- package/lib/utils/context.js +61 -26
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/cookie.js +1 -1
- package/lib/utils/cookie.js.map +1 -1
- package/lib/utils/cookie.spec.js +7 -189
- package/lib/utils/cookie.spec.js.map +1 -1
- package/lib/utils/httpcontext.d.ts +2 -2
- package/lib/utils/throttler.d.ts +82 -0
- package/lib/utils/throttler.js +136 -0
- package/lib/utils/throttler.js.map +1 -0
- package/lib/utils/throttler.spec.d.ts +1 -0
- package/lib/utils/throttler.spec.js +47 -0
- package/lib/utils/throttler.spec.js.map +1 -0
- package/lib/utils/waiter.d.ts +2 -2
- package/package.json +10 -9
- package/webda.module.json +76 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represent an item within the Throttler
|
|
3
|
+
*/
|
|
4
|
+
class ThrottlerItem {
|
|
5
|
+
constructor(method, callbacks, name) {
|
|
6
|
+
this.method = method;
|
|
7
|
+
this.callbacks = callbacks;
|
|
8
|
+
this.name = name;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return `${this.name}: ${this.promise ? "IN-PROGRESS" : "QUEUED"}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Promise Throttler
|
|
16
|
+
*
|
|
17
|
+
* Allow you to queue promise and execute them concurrently
|
|
18
|
+
*
|
|
19
|
+
* Several libraries does that
|
|
20
|
+
*
|
|
21
|
+
* The queue method still gives you a simple Promise linked to the resolution
|
|
22
|
+
* of your queued item, so you can still wait for the execution of the specific
|
|
23
|
+
* item
|
|
24
|
+
*/
|
|
25
|
+
export class Throttler {
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param concurrency max concurrent promise to execute
|
|
29
|
+
*/
|
|
30
|
+
constructor(concurrency = 10) {
|
|
31
|
+
this.concurrency = concurrency;
|
|
32
|
+
/**
|
|
33
|
+
* Current queue
|
|
34
|
+
*/
|
|
35
|
+
this._queue = [];
|
|
36
|
+
/**
|
|
37
|
+
* Number of promises in-progress
|
|
38
|
+
*/
|
|
39
|
+
this.current = 0;
|
|
40
|
+
/**
|
|
41
|
+
* Resolver for each call to waitForCompletion
|
|
42
|
+
*/
|
|
43
|
+
this._waiters = [];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Queue a new promise
|
|
47
|
+
*
|
|
48
|
+
* @param method executor that return the promise to queue
|
|
49
|
+
* @param name of the task, usefull when calling getInProgress
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
queue(method, name = `Promise_${this.getSize()}`) {
|
|
53
|
+
return new Promise((...callbacks) => {
|
|
54
|
+
this._queue.push(new ThrottlerItem(method, callbacks, name));
|
|
55
|
+
this.add();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Set the concurrency
|
|
60
|
+
* @param concurrency newValue
|
|
61
|
+
*
|
|
62
|
+
* If decreased, it will be in effect only when current promises resolve
|
|
63
|
+
* If increased, it will have immediate effect
|
|
64
|
+
*/
|
|
65
|
+
setConcurrency(concurrency) {
|
|
66
|
+
let oldValue = this.concurrency;
|
|
67
|
+
this.concurrency = concurrency;
|
|
68
|
+
// Ensure we launch new promise if concurrency has increased
|
|
69
|
+
while (oldValue < this.concurrency) {
|
|
70
|
+
this.add();
|
|
71
|
+
oldValue++;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get inprogress items
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
getInProgress() {
|
|
79
|
+
return this._queue.filter(p => p.promise);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get global queue size
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
getSize() {
|
|
86
|
+
return this._queue.length;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Wait until every promise resolve
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
async waitForCompletion() {
|
|
93
|
+
if (this.current === 0) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return new Promise(resolve => {
|
|
97
|
+
this._waiters.push(resolve);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Internal manage the promise concurrency
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
add() {
|
|
105
|
+
if (this.current >= this.concurrency) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const next = this._queue.find(p => !p.promise);
|
|
109
|
+
if (!next) {
|
|
110
|
+
if (this.current === 0) {
|
|
111
|
+
// Call all waiters
|
|
112
|
+
this._waiters.forEach(p => p());
|
|
113
|
+
this._waiters = [];
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.current++;
|
|
118
|
+
next.promise = next
|
|
119
|
+
.method()
|
|
120
|
+
.then(res => {
|
|
121
|
+
// Call the resolve
|
|
122
|
+
next.callbacks[0](res);
|
|
123
|
+
})
|
|
124
|
+
.catch(err => {
|
|
125
|
+
// Call the reject
|
|
126
|
+
next.callbacks[1](err);
|
|
127
|
+
})
|
|
128
|
+
.finally(() => {
|
|
129
|
+
this.current--;
|
|
130
|
+
// Remove from queue
|
|
131
|
+
this._queue.splice(this._queue.indexOf(next), 1);
|
|
132
|
+
this.add();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=throttler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttler.js","sourceRoot":"","sources":["../../src/utils/throttler.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,aAAa;IAKjB,YAAmB,MAA0B,EAAS,SAAkC,EAAS,IAAY;QAA1F,WAAM,GAAN,MAAM,CAAoB;QAAS,cAAS,GAAT,SAAS,CAAyB;QAAS,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IACjH,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpE,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,SAAS;IAcpB;;;OAGG;IACH,YAAsB,cAAsB,EAAE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) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { suite, test } from "@testdeck/mocha";
|
|
8
|
+
import * as assert from "assert";
|
|
9
|
+
import { Throttler } from "./throttler.js";
|
|
10
|
+
let ThrottlerTest = class ThrottlerTest {
|
|
11
|
+
async test() {
|
|
12
|
+
let resolvers = [];
|
|
13
|
+
let t = new Throttler(2);
|
|
14
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P1");
|
|
15
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P2");
|
|
16
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P3");
|
|
17
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P4");
|
|
18
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P5");
|
|
19
|
+
t.queue(() => new Promise((_, reject) => resolvers.push(reject)), "P6");
|
|
20
|
+
t.queue(() => new Promise(resolve => resolvers.push(resolve)), "P7");
|
|
21
|
+
assert.strictEqual(t.getSize(), 7);
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
resolvers.shift()();
|
|
24
|
+
assert.strictEqual(t.getInProgress().length, 2);
|
|
25
|
+
t.setConcurrency(1);
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
resolvers.shift()();
|
|
28
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
29
|
+
let curs = t.getInProgress();
|
|
30
|
+
assert.strictEqual(curs.length, 1, `Currents ${curs}`);
|
|
31
|
+
t.setConcurrency(3);
|
|
32
|
+
assert.strictEqual(t.getInProgress().length, 3);
|
|
33
|
+
let p = t.waitForCompletion();
|
|
34
|
+
resolvers.forEach(r => r());
|
|
35
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
36
|
+
resolvers.forEach(r => r());
|
|
37
|
+
await p;
|
|
38
|
+
await t.waitForCompletion();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
test
|
|
43
|
+
], ThrottlerTest.prototype, "test", null);
|
|
44
|
+
ThrottlerTest = __decorate([
|
|
45
|
+
suite
|
|
46
|
+
], ThrottlerTest);
|
|
47
|
+
//# sourceMappingURL=throttler.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttler.spec.js","sourceRoot":"","sources":["../../src/utils/throttler.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAEX,AAAN,KAAK,CAAC,IAAI;QACR,IAAI,SAAS,GAAmB,EAAE,CAAC;QACnC,IAAI,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3E,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3E,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,OAAO,CAAC,E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AAC,MAAM,EAAE,CAAC,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC;QACvD,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAC9B,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,CAAC,CAAC;QACR,MAAM,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC9B,CAAC;CACF,CAAA;AA7BO;IADL,IAAI;yCA6BJ;AA9BG,aAAa;IADlB,KAAK;GACA,aAAa,CA+BlB"}
|
package/lib/utils/waiter.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Logger } from "../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Function that define the amount of time between calls
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type WaitDelayer = (retries: number) => number;
|
|
6
6
|
/**
|
|
7
7
|
* Return a delayer that always wait for the same amount of time
|
|
8
8
|
* @param pause amount of time to wait
|
|
@@ -18,7 +18,7 @@ export declare function WaitExponentialDelay(pause: number): WaitDelayer;
|
|
|
18
18
|
/**
|
|
19
19
|
* Delayer factory definition
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type WaitDelayerFactory = (interval: number) => WaitDelayer;
|
|
22
22
|
/**
|
|
23
23
|
* WaitDelayer definition
|
|
24
24
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webda/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Expose API with Lambda",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc-esm",
|
|
16
16
|
"build:module": "webda build",
|
|
17
|
+
"build:watch": "webda build --watch",
|
|
17
18
|
"grammar": "antlr4ts -visitor src/stores/webdaql/WebdaQLLexer.g4 src/stores/webdaql/WebdaQLParser.g4 && yarn run lint:fix",
|
|
18
19
|
"pretest": "npm run build",
|
|
19
20
|
"lint": "prettier --check src/**/*",
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@types/json-schema": "^7.0.8",
|
|
25
|
-
"@webda/workout": "^2.
|
|
26
|
+
"@webda/workout": "^2.2.0",
|
|
26
27
|
"accept-language": "^3.0.18",
|
|
27
28
|
"ajv": "^8.6.2",
|
|
28
29
|
"ajv-formats": "^2.1.1",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"global": "^4.4.0",
|
|
38
39
|
"jsonc-parser": "^3.0.0",
|
|
39
40
|
"jsonpath": "^1.1.1",
|
|
40
|
-
"jsonwebtoken": "^
|
|
41
|
+
"jsonwebtoken": "^9.0.0",
|
|
41
42
|
"merge": "^2.1.1",
|
|
42
43
|
"mime-types": "^2.1.31",
|
|
43
44
|
"mustache": "^4.2.0",
|
|
@@ -55,20 +56,20 @@
|
|
|
55
56
|
"yaml": "^2.0.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@testdeck/mocha": "^0.2
|
|
59
|
+
"@testdeck/mocha": "^0.3.2",
|
|
59
60
|
"@types/node": "14.6.0",
|
|
60
61
|
"@types/nodemailer": "^6.4.4",
|
|
61
|
-
"@webda/tsc-esm": "^1.0.
|
|
62
|
+
"@webda/tsc-esm": "^1.0.2",
|
|
62
63
|
"antlr4ts-cli": "^0.5.0-alpha.4",
|
|
63
64
|
"axios": "^1.1.3",
|
|
64
65
|
"c8": "^7.11.3",
|
|
65
|
-
"fs-extra": "^
|
|
66
|
+
"fs-extra": "^11.0.0",
|
|
66
67
|
"mocha": "^10.0.0",
|
|
67
68
|
"prettier": "^2.3.2",
|
|
68
|
-
"sinon": "^
|
|
69
|
+
"sinon": "^15.0.0",
|
|
69
70
|
"source-map-support": "^0.5.19",
|
|
70
71
|
"ts-node": "^10.1.0",
|
|
71
|
-
"typescript": "~4.
|
|
72
|
+
"typescript": "~4.9.3"
|
|
72
73
|
},
|
|
73
74
|
"files": [
|
|
74
75
|
"lib",
|
|
@@ -102,5 +103,5 @@
|
|
|
102
103
|
"engines": {
|
|
103
104
|
"node": ">=14.6.0"
|
|
104
105
|
},
|
|
105
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "fcdb5181ae9353dd8618017fae07ca75203bb1ad"
|
|
106
107
|
}
|
package/webda.module.json
CHANGED
|
@@ -1617,6 +1617,13 @@
|
|
|
1617
1617
|
"description": "Webda model to use within the Store",
|
|
1618
1618
|
"default": "Webda/CoreModel"
|
|
1619
1619
|
},
|
|
1620
|
+
"models": {
|
|
1621
|
+
"type": "array",
|
|
1622
|
+
"items": {
|
|
1623
|
+
"type": "string"
|
|
1624
|
+
},
|
|
1625
|
+
"description": "Different models managed by this store"
|
|
1626
|
+
},
|
|
1620
1627
|
"asyncDelete": {
|
|
1621
1628
|
"type": "boolean",
|
|
1622
1629
|
"description": "async delete"
|
|
@@ -1627,14 +1634,44 @@
|
|
|
1627
1634
|
},
|
|
1628
1635
|
"strict": {
|
|
1629
1636
|
"type": "boolean",
|
|
1630
|
-
"description": "Allow to load object that does not have the type data",
|
|
1637
|
+
"description": "Allow to load object that does not have the type data\n\nIf set to true, then the Store will only managed the defined _model and no model extending this one",
|
|
1638
|
+
"default": false
|
|
1639
|
+
},
|
|
1640
|
+
"defaultModel": {
|
|
1641
|
+
"type": "boolean",
|
|
1642
|
+
"description": "When __type model not found, use the model If strict is setup this parameter is not used",
|
|
1631
1643
|
"default": true
|
|
1632
1644
|
},
|
|
1645
|
+
"forceModel": {
|
|
1646
|
+
"type": "boolean",
|
|
1647
|
+
"description": "If set, Store will ignore the __type",
|
|
1648
|
+
"default": false
|
|
1649
|
+
},
|
|
1633
1650
|
"slowQueryThreshold": {
|
|
1634
1651
|
"type": "number",
|
|
1635
1652
|
"description": "Slow query threshold",
|
|
1636
1653
|
"default": 30000
|
|
1637
1654
|
},
|
|
1655
|
+
"parent": {
|
|
1656
|
+
"type": "object",
|
|
1657
|
+
"properties": {
|
|
1658
|
+
"name": {
|
|
1659
|
+
"type": "string"
|
|
1660
|
+
},
|
|
1661
|
+
"condition": {
|
|
1662
|
+
"type": "string"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
"required": [
|
|
1666
|
+
"name",
|
|
1667
|
+
"condition"
|
|
1668
|
+
],
|
|
1669
|
+
"description": "Parent of the store\n\nIf parent is specified the url route is relative to it"
|
|
1670
|
+
},
|
|
1671
|
+
"graphql": {
|
|
1672
|
+
"type": "boolean",
|
|
1673
|
+
"description": "For future use in our GraphQL api\n\nExpose this store in the graphql"
|
|
1674
|
+
},
|
|
1638
1675
|
"persistence": {
|
|
1639
1676
|
"type": "object",
|
|
1640
1677
|
"properties": {
|
|
@@ -1739,6 +1776,13 @@
|
|
|
1739
1776
|
"description": "Webda model to use within the Store",
|
|
1740
1777
|
"default": "Webda/CoreModel"
|
|
1741
1778
|
},
|
|
1779
|
+
"models": {
|
|
1780
|
+
"type": "array",
|
|
1781
|
+
"items": {
|
|
1782
|
+
"type": "string"
|
|
1783
|
+
},
|
|
1784
|
+
"description": "Different models managed by this store"
|
|
1785
|
+
},
|
|
1742
1786
|
"asyncDelete": {
|
|
1743
1787
|
"type": "boolean",
|
|
1744
1788
|
"description": "async delete"
|
|
@@ -1749,14 +1793,44 @@
|
|
|
1749
1793
|
},
|
|
1750
1794
|
"strict": {
|
|
1751
1795
|
"type": "boolean",
|
|
1752
|
-
"description": "Allow to load object that does not have the type data",
|
|
1796
|
+
"description": "Allow to load object that does not have the type data\n\nIf set to true, then the Store will only managed the defined _model and no model extending this one",
|
|
1797
|
+
"default": false
|
|
1798
|
+
},
|
|
1799
|
+
"defaultModel": {
|
|
1800
|
+
"type": "boolean",
|
|
1801
|
+
"description": "When __type model not found, use the model If strict is setup this parameter is not used",
|
|
1753
1802
|
"default": true
|
|
1754
1803
|
},
|
|
1804
|
+
"forceModel": {
|
|
1805
|
+
"type": "boolean",
|
|
1806
|
+
"description": "If set, Store will ignore the __type",
|
|
1807
|
+
"default": false
|
|
1808
|
+
},
|
|
1755
1809
|
"slowQueryThreshold": {
|
|
1756
1810
|
"type": "number",
|
|
1757
1811
|
"description": "Slow query threshold",
|
|
1758
1812
|
"default": 30000
|
|
1759
1813
|
},
|
|
1814
|
+
"parent": {
|
|
1815
|
+
"type": "object",
|
|
1816
|
+
"properties": {
|
|
1817
|
+
"name": {
|
|
1818
|
+
"type": "string"
|
|
1819
|
+
},
|
|
1820
|
+
"condition": {
|
|
1821
|
+
"type": "string"
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
"required": [
|
|
1825
|
+
"name",
|
|
1826
|
+
"condition"
|
|
1827
|
+
],
|
|
1828
|
+
"description": "Parent of the store\n\nIf parent is specified the url route is relative to it"
|
|
1829
|
+
},
|
|
1830
|
+
"graphql": {
|
|
1831
|
+
"type": "boolean",
|
|
1832
|
+
"description": "For future use in our GraphQL api\n\nExpose this store in the graphql"
|
|
1833
|
+
},
|
|
1760
1834
|
"folder": {
|
|
1761
1835
|
"type": "string",
|
|
1762
1836
|
"description": "Local path where to store all `json` files"
|