@webda/core 2.0.0-beta.1 → 2.0.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 +9 -21
- package/lib/application.js +71 -84
- package/lib/application.js.map +1 -1
- package/lib/application.spec.js +121 -140
- package/lib/application.spec.js.map +1 -1
- package/lib/core.d.ts +86 -46
- package/lib/core.js +254 -316
- package/lib/core.js.map +1 -1
- package/lib/core.spec.js +326 -391
- package/lib/core.spec.js.map +1 -1
- package/lib/index.d.ts +49 -45
- package/lib/index.js +54 -67
- package/lib/index.js.map +1 -1
- package/lib/models/aclmodel.d.ts +2 -2
- package/lib/models/aclmodel.js +63 -90
- package/lib/models/aclmodel.js.map +1 -1
- package/lib/models/aclmodel.spec.js +127 -151
- package/lib/models/aclmodel.spec.js.map +1 -1
- package/lib/models/coremodel.d.ts +84 -11
- package/lib/models/coremodel.js +104 -103
- package/lib/models/coremodel.js.map +1 -1
- package/lib/models/coremodel.spec.js +91 -91
- package/lib/models/coremodel.spec.js.map +1 -1
- package/lib/models/deployment.js +1 -2
- package/lib/models/ident.d.ts +5 -3
- package/lib/models/ident.js +4 -9
- package/lib/models/ident.js.map +1 -1
- package/lib/models/ident.spec.js +9 -11
- package/lib/models/ident.spec.js.map +1 -1
- package/lib/models/ownermodel.d.ts +12 -2
- package/lib/models/ownermodel.js +54 -62
- package/lib/models/ownermodel.js.map +1 -1
- package/lib/models/ownermodel.spec.js +129 -152
- package/lib/models/ownermodel.spec.js.map +1 -1
- package/lib/models/rolemodel.d.ts +2 -2
- package/lib/models/rolemodel.js +24 -40
- package/lib/models/rolemodel.js.map +1 -1
- package/lib/models/rolemodel.spec.js +44 -61
- package/lib/models/rolemodel.spec.js.map +1 -1
- package/lib/models/user.d.ts +5 -5
- package/lib/models/user.js +3 -8
- package/lib/models/user.js.map +1 -1
- package/lib/models/user.spec.js +14 -16
- package/lib/models/user.spec.js.map +1 -1
- package/lib/queues/filequeue.d.ts +2 -2
- package/lib/queues/filequeue.js +72 -93
- package/lib/queues/filequeue.js.map +1 -1
- package/lib/queues/filequeue.spec.js +53 -70
- package/lib/queues/filequeue.spec.js.map +1 -1
- package/lib/queues/memoryqueue.d.ts +2 -2
- package/lib/queues/memoryqueue.js +37 -61
- package/lib/queues/memoryqueue.js.map +1 -1
- package/lib/queues/memoryqueue.spec.js +142 -165
- package/lib/queues/memoryqueue.spec.js.map +1 -1
- package/lib/queues/pubsubservice.d.ts +2 -2
- package/lib/queues/pubsubservice.js +3 -7
- package/lib/queues/pubsubservice.js.map +1 -1
- package/lib/queues/queue.spec.d.ts +1 -1
- package/lib/queues/queue.spec.js +42 -56
- package/lib/queues/queue.spec.js.map +1 -1
- package/lib/queues/queueservice.d.ts +4 -4
- package/lib/queues/queueservice.js +52 -67
- package/lib/queues/queueservice.js.map +1 -1
- package/lib/router.d.ts +7 -3
- package/lib/router.js +49 -48
- package/lib/router.js.map +1 -1
- package/lib/router.spec.js +64 -61
- package/lib/router.spec.js.map +1 -1
- package/lib/services/asyncevents.d.ts +2 -2
- package/lib/services/asyncevents.js +44 -64
- package/lib/services/asyncevents.js.map +1 -1
- package/lib/services/asyncevents.spec.js +81 -98
- package/lib/services/asyncevents.spec.js.map +1 -1
- package/lib/services/authentication.d.ts +28 -19
- package/lib/services/authentication.js +539 -571
- package/lib/services/authentication.js.map +1 -1
- package/lib/services/authentication.spec.js +411 -447
- package/lib/services/authentication.spec.js.map +1 -1
- package/lib/services/binary.d.ts +8 -6
- package/lib/services/binary.js +212 -244
- package/lib/services/binary.js.map +1 -1
- package/lib/services/binary.spec.d.ts +3 -3
- package/lib/services/binary.spec.js +390 -443
- package/lib/services/binary.spec.js.map +1 -1
- package/lib/services/cloudbinary.d.ts +3 -3
- package/lib/services/cloudbinary.js +46 -71
- package/lib/services/cloudbinary.js.map +1 -1
- package/lib/services/cloudbinary.spec.d.ts +3 -3
- package/lib/services/cloudbinary.spec.js +133 -162
- package/lib/services/cloudbinary.spec.js.map +1 -1
- package/lib/services/configuration.d.ts +6 -3
- package/lib/services/configuration.js +78 -103
- package/lib/services/configuration.js.map +1 -1
- package/lib/services/configuration.spec.js +63 -83
- package/lib/services/configuration.spec.js.map +1 -1
- package/lib/services/cron.d.ts +3 -2
- package/lib/services/cron.js +9 -13
- package/lib/services/cron.js.map +1 -1
- package/lib/services/cron.spec.js +18 -21
- package/lib/services/cron.spec.js.map +1 -1
- package/lib/services/cryptoservice.d.ts +258 -0
- package/lib/services/cryptoservice.js +312 -0
- package/lib/services/cryptoservice.js.map +1 -0
- package/lib/services/cryptoservice.spec.d.ts +1 -0
- package/lib/services/cryptoservice.spec.js +137 -0
- package/lib/services/cryptoservice.spec.js.map +1 -0
- package/lib/services/debugmailer.d.ts +1 -1
- package/lib/services/debugmailer.js +13 -34
- package/lib/services/debugmailer.js.map +1 -1
- package/lib/services/debugmailer.spec.js +16 -29
- package/lib/services/debugmailer.spec.js.map +1 -1
- package/lib/services/echo.d.ts +2 -2
- package/lib/services/echo.js +15 -31
- package/lib/services/echo.js.map +1 -1
- package/lib/services/echo.spec.js +27 -40
- package/lib/services/echo.spec.js.map +1 -1
- package/lib/services/filebinary.d.ts +15 -5
- package/lib/services/filebinary.js +171 -200
- package/lib/services/filebinary.js.map +1 -1
- package/lib/services/filebinary.spec.d.ts +2 -1
- package/lib/services/filebinary.spec.js +106 -117
- package/lib/services/filebinary.spec.js.map +1 -1
- package/lib/services/fileconfiguration.d.ts +2 -2
- package/lib/services/fileconfiguration.js +25 -43
- package/lib/services/fileconfiguration.js.map +1 -1
- package/lib/services/fileconfiguration.spec.js +79 -109
- package/lib/services/fileconfiguration.spec.js.map +1 -1
- package/lib/services/invitationservice.d.ts +9 -9
- package/lib/services/invitationservice.js +275 -313
- package/lib/services/invitationservice.js.map +1 -1
- package/lib/services/invitationservice.spec.js +442 -448
- package/lib/services/invitationservice.spec.js.map +1 -1
- package/lib/services/kubernetesconfiguration.d.ts +2 -2
- package/lib/services/kubernetesconfiguration.js +41 -59
- package/lib/services/kubernetesconfiguration.js.map +1 -1
- package/lib/services/kubernetesconfiguration.spec.js +80 -98
- package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
- package/lib/services/mailer.d.ts +4 -4
- package/lib/services/mailer.js +62 -86
- package/lib/services/mailer.js.map +1 -1
- package/lib/services/mailer.spec.js +86 -127
- package/lib/services/mailer.spec.js.map +1 -1
- package/lib/services/notificationservice.d.ts +4 -4
- package/lib/services/notificationservice.js +23 -42
- package/lib/services/notificationservice.js.map +1 -1
- package/lib/services/notificationservice.spec.js +47 -73
- package/lib/services/notificationservice.spec.js.map +1 -1
- package/lib/services/oauth.d.ts +32 -6
- package/lib/services/oauth.js +73 -78
- package/lib/services/oauth.js.map +1 -1
- package/lib/services/oauth.spec.js +128 -147
- package/lib/services/oauth.spec.js.map +1 -1
- package/lib/services/proxy.d.ts +74 -0
- package/lib/services/proxy.js +126 -0
- package/lib/services/proxy.js.map +1 -0
- package/lib/services/proxy.spec.d.ts +1 -0
- package/lib/services/proxy.spec.js +59 -0
- package/lib/services/proxy.spec.js.map +1 -0
- package/lib/services/resource.d.ts +2 -2
- package/lib/services/resource.js +12 -18
- package/lib/services/resource.js.map +1 -1
- package/lib/services/resource.spec.js +67 -99
- package/lib/services/resource.spec.js.map +1 -1
- package/lib/services/service.d.ts +33 -7
- package/lib/services/service.js +74 -42
- package/lib/services/service.js.map +1 -1
- package/lib/services/service.spec.js +62 -67
- package/lib/services/service.spec.js.map +1 -1
- package/lib/services/version.d.ts +1 -1
- package/lib/services/version.js +3 -8
- package/lib/services/version.js.map +1 -1
- package/lib/services/version.spec.js +11 -24
- package/lib/services/version.spec.js.map +1 -1
- package/lib/stores/aggregator.d.ts +3 -3
- package/lib/stores/aggregator.js +37 -57
- package/lib/stores/aggregator.js.map +1 -1
- package/lib/stores/file.d.ts +3 -3
- package/lib/stores/file.js +93 -131
- package/lib/stores/file.js.map +1 -1
- package/lib/stores/file.spec.d.ts +2 -2
- package/lib/stores/file.spec.js +261 -289
- package/lib/stores/file.spec.js.map +1 -1
- package/lib/stores/mapper.d.ts +4 -4
- package/lib/stores/mapper.js +112 -137
- package/lib/stores/mapper.js.map +1 -1
- package/lib/stores/mapper.spec.js +131 -150
- package/lib/stores/mapper.spec.js.map +1 -1
- package/lib/stores/memory.d.ts +67 -6
- package/lib/stores/memory.js +155 -117
- package/lib/stores/memory.js.map +1 -1
- package/lib/stores/memory.spec.d.ts +3 -2
- package/lib/stores/memory.spec.js +127 -105
- package/lib/stores/memory.spec.js.map +1 -1
- package/lib/stores/store.d.ts +35 -15
- package/lib/stores/store.js +839 -821
- package/lib/stores/store.js.map +1 -1
- package/lib/stores/store.spec.d.ts +6 -4
- package/lib/stores/store.spec.js +627 -647
- package/lib/stores/store.spec.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLLexer.d.ts +4 -4
- package/lib/stores/webdaql/WebdaQLLexer.js +9 -13
- package/lib/stores/webdaql/WebdaQLLexer.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserLexer.d.ts +4 -4
- package/lib/stores/webdaql/WebdaQLParserLexer.js +9 -13
- package/lib/stores/webdaql/WebdaQLParserLexer.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserListener.d.ts +2 -2
- package/lib/stores/webdaql/WebdaQLParserListener.js +1 -2
- package/lib/stores/webdaql/WebdaQLParserListener.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserParser.d.ts +10 -10
- package/lib/stores/webdaql/WebdaQLParserParser.js +62 -91
- package/lib/stores/webdaql/WebdaQLParserParser.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLParserVisitor.d.ts +2 -2
- package/lib/stores/webdaql/WebdaQLParserVisitor.js +1 -2
- package/lib/stores/webdaql/WebdaQLParserVisitor.js.map +1 -1
- package/lib/stores/webdaql/query.d.ts +4 -5
- package/lib/stores/webdaql/query.js +16 -19
- package/lib/stores/webdaql/query.js.map +1 -1
- package/lib/stores/webdaql/query.spec.js +30 -32
- package/lib/stores/webdaql/query.spec.js.map +1 -1
- package/lib/test.d.ts +3 -3
- package/lib/test.js +74 -94
- package/lib/test.js.map +1 -1
- package/lib/unpackedapplication.d.ts +1 -1
- package/lib/unpackedapplication.js +25 -31
- package/lib/unpackedapplication.js.map +1 -1
- package/lib/utils/abstractdeployer.js +1 -5
- package/lib/utils/abstractdeployer.js.map +1 -1
- package/lib/utils/abstractdeployer.spec.js +6 -8
- package/lib/utils/abstractdeployer.spec.js.map +1 -1
- package/lib/utils/context.d.ts +61 -29
- package/lib/utils/context.js +133 -127
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/context.spec.js +147 -153
- package/lib/utils/context.spec.js.map +1 -1
- package/lib/utils/cookie.d.ts +66 -45
- package/lib/utils/cookie.js +69 -158
- package/lib/utils/cookie.js.map +1 -1
- package/lib/utils/cookie.spec.js +220 -238
- package/lib/utils/cookie.spec.js.map +1 -1
- package/lib/utils/esm.d.ts +4 -0
- package/lib/utils/esm.js +10 -0
- package/lib/utils/esm.js.map +1 -0
- package/lib/utils/httpcontext.d.ts +37 -9
- package/lib/utils/httpcontext.js +86 -57
- package/lib/utils/httpcontext.js.map +1 -1
- package/lib/utils/httpcontext.spec.js +37 -48
- package/lib/utils/httpcontext.spec.js.map +1 -1
- package/lib/utils/logger.d.ts +2 -2
- package/lib/utils/logger.js +15 -28
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.spec.js +9 -11
- package/lib/utils/logger.spec.js.map +1 -1
- package/lib/utils/serializers.js +17 -20
- package/lib/utils/serializers.js.map +1 -1
- package/lib/utils/serializers.spec.js +43 -44
- package/lib/utils/serializers.spec.js.map +1 -1
- package/lib/utils/session.d.ts +120 -0
- package/lib/utils/session.js +155 -0
- package/lib/utils/session.js.map +1 -0
- package/lib/utils/session.spec.d.ts +1 -0
- package/lib/utils/session.spec.js +66 -0
- package/lib/utils/session.spec.js.map +1 -0
- package/lib/utils/waiter.d.ts +1 -1
- package/lib/utils/waiter.js +32 -52
- package/lib/utils/waiter.js.map +1 -1
- package/lib/utils/waiter.spec.js +75 -92
- package/lib/utils/waiter.spec.js.map +1 -1
- package/package.json +22 -14
- package/test/config-invitation.json +1 -3
- package/test/config.json +3 -3
- package/test/config.old.json +1 -2
- package/test/moddas/annotatedservice.js +5 -5
- package/test/moddas/debugmailer.js +2 -3
- package/test/moddas/fakeservice.js +2 -3
- package/test/moddas/voidstore.js +6 -4
- package/test/models/ident.js +2 -6
- package/test/models/task.js +3 -7
- package/test/package.json +2 -1
- package/webda.module.json +956 -188
package/lib/application.spec.js
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
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;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const path = require("path");
|
|
21
|
-
const index_1 = require("./index");
|
|
22
|
-
const test_1 = require("./test");
|
|
23
|
-
let ApplicationTest = class ApplicationTest extends test_1.WebdaTest {
|
|
24
|
-
before() {
|
|
25
|
-
const _super = Object.create(null, {
|
|
26
|
-
before: { get: () => super.before }
|
|
27
|
-
});
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
yield _super.before.call(this);
|
|
30
|
-
this.sampleApp = new test_1.TestApplication(path.join(__dirname, "..", "..", "..", "sample-app"));
|
|
31
|
-
yield this.sampleApp.load();
|
|
32
|
-
});
|
|
7
|
+
import { suite, test } from "@testdeck/mocha";
|
|
8
|
+
import * as assert from "assert";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
import { Application, UnpackedApplication } from "./index.js";
|
|
11
|
+
import { TestApplication, WebdaTest } from "./test.js";
|
|
12
|
+
import { getCommonJS } from "./utils/esm.js";
|
|
13
|
+
const { __dirname } = getCommonJS(import.meta.url);
|
|
14
|
+
let ApplicationTest = class ApplicationTest extends WebdaTest {
|
|
15
|
+
async before() {
|
|
16
|
+
await super.before();
|
|
17
|
+
this.sampleApp = new TestApplication(path.join(__dirname, "..", "..", "..", "sample-app"));
|
|
18
|
+
await this.sampleApp.load();
|
|
33
19
|
}
|
|
34
20
|
testObjectParameter() {
|
|
35
21
|
assert.deepStrictEqual(this.sampleApp.replaceVariables({
|
|
@@ -67,145 +53,140 @@ let ApplicationTest = class ApplicationTest extends test_1.WebdaTest {
|
|
|
67
53
|
getConfiguration() {
|
|
68
54
|
let config = this.sampleApp.getConfiguration();
|
|
69
55
|
}
|
|
70
|
-
cacheSchema() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
assert.strictEqual(app.getSchema("fake"), 666);
|
|
86
|
-
});
|
|
56
|
+
async cacheSchema() {
|
|
57
|
+
let app = new Application(__dirname + "/../test/config.json");
|
|
58
|
+
await app.load();
|
|
59
|
+
// Should load from cache
|
|
60
|
+
assert.notStrictEqual(app.getSchema("WebdaTest/Mailer"), undefined);
|
|
61
|
+
assert.strictEqual(app.getSchema("Webda/Container"), undefined);
|
|
62
|
+
// Check if cached just use cache
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
app.baseConfiguration.cachedModules = {
|
|
65
|
+
schemas: {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
fake: 666
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
assert.strictEqual(app.getSchema("fake"), 666);
|
|
87
71
|
}
|
|
88
|
-
cov() {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
version: ""
|
|
124
|
-
});
|
|
125
|
-
assert.strictEqual(app.isCached(), true);
|
|
126
|
-
assert.strictEqual(app.getCurrentDeployment(), "");
|
|
127
|
-
assert.strictEqual(app.replaceVariables("hello", {}), "hello");
|
|
128
|
-
assert.strictEqual(app.replaceVariables("hello ${test} ${test2}", {}), "hello undefined undefined");
|
|
129
|
-
assert.throws(() => app.replaceVariables("hello ${now && process.exit(666)}", {}), /Variable cannot use every javascript features/);
|
|
130
|
-
assert.throws(() => app.replaceVariables("hello ${test} ${{ test}", {}), /Variable cannot use every javascript features/);
|
|
131
|
-
assert.throws(() => app.replaceVariables("hello " + "${test}".repeat(12), {}), /Too many variables/);
|
|
132
|
-
unpackedApp = new index_1.UnpackedApplication(__dirname + "/../test/moddas", undefined);
|
|
133
|
-
yield unpackedApp.load();
|
|
72
|
+
async cov() {
|
|
73
|
+
assert.throws(() => new Application("/notexisting"), /Not a webda application folder or webda.config.jsonc or webda.config.json file: unexisting.*/);
|
|
74
|
+
await assert.rejects(() => new Application(__dirname + "/../test/moddas").load(), /Not a webda application folder or webda.config.jsonc or webda.config.json file: .*/);
|
|
75
|
+
await assert.rejects(() => new Application(__dirname + "/../test/badapp").load(), /Cannot parse JSON of: .*/);
|
|
76
|
+
// If allow module is enable the Application should let run anywhere
|
|
77
|
+
new Application(__dirname + "/../test/moddas", undefined);
|
|
78
|
+
let unpackedApp = new UnpackedApplication(__dirname + "/../test/badapp", undefined);
|
|
79
|
+
unpackedApp.loadProjectInformation();
|
|
80
|
+
// Read cached modules
|
|
81
|
+
let app = new Application(__dirname + "/../test/cachedapp", undefined);
|
|
82
|
+
await app.load();
|
|
83
|
+
app.getGitInformation();
|
|
84
|
+
// No package.json should not fail although more than abnormal
|
|
85
|
+
app = new TestApplication(__dirname + "/../test/config.json");
|
|
86
|
+
await app.load();
|
|
87
|
+
assert.ok(!app.extends(null, String));
|
|
88
|
+
app.getPackageWebda();
|
|
89
|
+
assert.throws(() => app.getModda("Unknown"), /Undefined modda Unknown/);
|
|
90
|
+
app.getDeployers();
|
|
91
|
+
app.getModules();
|
|
92
|
+
app.getBeans();
|
|
93
|
+
// Alternative of files
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
app.getPackageDescription.files = undefined;
|
|
96
|
+
// Nothing can be really checked here
|
|
97
|
+
app.addModel("WebdaTest/NotExisting", null);
|
|
98
|
+
app.addDeployer("WebdaTest/NotExisting", null);
|
|
99
|
+
delete app.getModels()["webdatest/notexisting"];
|
|
100
|
+
assert.deepStrictEqual(app.getGitInformation(), {
|
|
101
|
+
branch: "",
|
|
102
|
+
commit: "",
|
|
103
|
+
short: "",
|
|
104
|
+
tag: "",
|
|
105
|
+
tags: [],
|
|
106
|
+
version: ""
|
|
134
107
|
});
|
|
108
|
+
assert.strictEqual(app.isCached(), true);
|
|
109
|
+
assert.strictEqual(app.getCurrentDeployment(), "");
|
|
110
|
+
assert.strictEqual(app.replaceVariables("hello", {}), "hello");
|
|
111
|
+
assert.strictEqual(app.replaceVariables("hello ${test} ${test2}", {}), "hello undefined undefined");
|
|
112
|
+
assert.throws(() => app.replaceVariables("hello ${now && process.exit(666)}", {}), /Variable cannot use every javascript features/);
|
|
113
|
+
assert.throws(() => app.replaceVariables("hello ${test} ${{ test}", {}), /Variable cannot use every javascript features/);
|
|
114
|
+
assert.throws(() => app.replaceVariables("hello " + "${test}".repeat(12), {}), /Too many variables/);
|
|
115
|
+
unpackedApp = new UnpackedApplication(__dirname + "/../test/moddas", undefined);
|
|
116
|
+
await unpackedApp.load();
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
unpackedApp.baseConfiguration.cachedModules.project.webda = undefined;
|
|
119
|
+
assert.deepStrictEqual(unpackedApp.getPackageWebda(), { namespace: "Webda" });
|
|
135
120
|
}
|
|
136
|
-
getFullNameFromPrototype() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
assert.strictEqual(app.getFullNameFromPrototype(service), "plop/test");
|
|
150
|
-
});
|
|
121
|
+
async getFullNameFromPrototype() {
|
|
122
|
+
let app = new TestApplication(__dirname + "/../test/config.json");
|
|
123
|
+
await app.load();
|
|
124
|
+
let services = app.getModdas();
|
|
125
|
+
let name = Object.keys(services).pop();
|
|
126
|
+
let service = services[name].prototype;
|
|
127
|
+
assert.strictEqual(app.getFullNameFromPrototype(service), name);
|
|
128
|
+
// Cheat for deployer
|
|
129
|
+
services = app.getModels();
|
|
130
|
+
name = Object.keys(services).pop();
|
|
131
|
+
service = services[name].prototype;
|
|
132
|
+
app.addDeployer("Plop/Test", services[name]);
|
|
133
|
+
assert.strictEqual(app.getFullNameFromPrototype(service), "plop/test");
|
|
151
134
|
}
|
|
152
|
-
loadModule() {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ReTest: "notFound.js"
|
|
165
|
-
}
|
|
166
|
-
}, "");
|
|
167
|
-
yield app.loadModule({});
|
|
168
|
-
yield app.importFile("./../test/moddas/fakeservice.js");
|
|
169
|
-
let cwd = process.cwd();
|
|
170
|
-
try {
|
|
171
|
-
// Check loading of aws module
|
|
172
|
-
process.chdir(path.join(__dirname, "..", "..", "aws"));
|
|
173
|
-
yield app.loadLocalModule();
|
|
135
|
+
async loadModule() {
|
|
136
|
+
let app = new Application(__dirname + "/../test/config.json");
|
|
137
|
+
await app.loadModule({
|
|
138
|
+
moddas: {
|
|
139
|
+
Test: "moddas/fakeservice.js",
|
|
140
|
+
ReTest: "./notFound.js"
|
|
141
|
+
},
|
|
142
|
+
models: {
|
|
143
|
+
ReTest: "notFound.js"
|
|
144
|
+
},
|
|
145
|
+
deployers: {
|
|
146
|
+
ReTest: "notFound.js"
|
|
174
147
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
148
|
+
}, "");
|
|
149
|
+
await app.loadModule({});
|
|
150
|
+
await app.importFile("./../test/moddas/fakeservice.js");
|
|
151
|
+
let cwd = process.cwd();
|
|
152
|
+
try {
|
|
153
|
+
// Check loading of aws module
|
|
154
|
+
process.chdir(path.join(__dirname, "..", "..", "aws"));
|
|
155
|
+
await app.loadLocalModule();
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
process.chdir(cwd);
|
|
159
|
+
}
|
|
179
160
|
}
|
|
180
161
|
};
|
|
181
162
|
__decorate([
|
|
182
|
-
|
|
163
|
+
test
|
|
183
164
|
], ApplicationTest.prototype, "testObjectParameter", null);
|
|
184
165
|
__decorate([
|
|
185
|
-
|
|
166
|
+
test
|
|
186
167
|
], ApplicationTest.prototype, "configurationImports", null);
|
|
187
168
|
__decorate([
|
|
188
|
-
|
|
169
|
+
test
|
|
189
170
|
], ApplicationTest.prototype, "testStringParameter", null);
|
|
190
171
|
__decorate([
|
|
191
|
-
|
|
172
|
+
test
|
|
192
173
|
], ApplicationTest.prototype, "getAppPath", null);
|
|
193
174
|
__decorate([
|
|
194
|
-
|
|
175
|
+
test
|
|
195
176
|
], ApplicationTest.prototype, "getConfiguration", null);
|
|
196
177
|
__decorate([
|
|
197
|
-
|
|
178
|
+
test
|
|
198
179
|
], ApplicationTest.prototype, "cacheSchema", null);
|
|
199
180
|
__decorate([
|
|
200
|
-
|
|
181
|
+
test
|
|
201
182
|
], ApplicationTest.prototype, "cov", null);
|
|
202
183
|
__decorate([
|
|
203
|
-
|
|
184
|
+
test
|
|
204
185
|
], ApplicationTest.prototype, "getFullNameFromPrototype", null);
|
|
205
186
|
__decorate([
|
|
206
|
-
|
|
187
|
+
test
|
|
207
188
|
], ApplicationTest.prototype, "loadModule", null);
|
|
208
189
|
ApplicationTest = __decorate([
|
|
209
|
-
|
|
190
|
+
suite
|
|
210
191
|
], ApplicationTest);
|
|
211
192
|
//# sourceMappingURL=application.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.spec.js","sourceRoot":"","sources":["../src/application.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.spec.js","sourceRoot":"","sources":["../src/application.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAGnD,IAAM,eAAe,GAArB,MAAM,eA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EAAE;gBACN,IAAI,EAAE,uBAAuB;gBAC7B,MAAM,EAAE,eAAe;aACxB;YACD,MAAM,EAAE;gBACN,MAAM,EAAE,aAAa;aACtB;YACD,SAAS,EAAE;gBACT,MAAM,EAAE,aAAa;aACtB;SACF,EACD,EAAE,CACH,CAAC;QACF,MAAM,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,GAAG,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC;QACxD,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QACxB,IAAI;YACF,8BAA8B;YAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACvD,MAAM,GAAG,CAAC,eAAe,EAAE,CAAC;SAC7B;gBAAS;YACR,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpB;IACH,CAAC;CACF,CAAA;AAxLC;IADC,IAAI;0DAuBJ;AAGD;IADC,IAAI;2DAKJ;AAGD;IADC,IAAI;0DAUJ;AAGD;IADC,IAAI;iDAIJ;AAGD;IADC,IAAI;uDAGJ;AAGD;IADC,IAAI;kDAgBJ;AAGD;IADC,IAAI;0CAiEJ;AAGD;IADC,IAAI;+DAcJ;AAGD;IADC,IAAI;iDA4BJ;AAjMG,eAAe;IADpB,KAAK;GACA,eAAe,CAkMpB"}
|
package/lib/core.d.ts
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { WorkerLogLevel, WorkerOutput } from "@webda/workout";
|
|
4
|
+
import Ajv, { ErrorObject } from "ajv";
|
|
3
5
|
import * as events from "events";
|
|
4
6
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
|
-
import
|
|
6
|
-
import { Application, Configuration } from "./application";
|
|
7
|
-
import { Context, HttpContext, Logger, Service } from "./index";
|
|
8
|
-
import { CoreModel, CoreModelDefinition } from "./models/coremodel";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
7
|
+
import { Writable } from "stream";
|
|
8
|
+
import { Application, Configuration } from "./application.js";
|
|
9
|
+
import { Context, HttpContext, Logger, Service, Store } from "./index.js";
|
|
10
|
+
import { Constructor, CoreModel, CoreModelDefinition } from "./models/coremodel.js";
|
|
11
|
+
import { RouteInfo, Router } from "./router.js";
|
|
12
|
+
import CryptoService from "./services/cryptoservice.js";
|
|
13
|
+
/**
|
|
14
|
+
* Copy from https://github.com/ajv-validator/ajv/blob/master/lib/runtime/validation_error.ts
|
|
15
|
+
* It is not exported by ajv
|
|
16
|
+
*/
|
|
17
|
+
export declare class ValidationError extends Error {
|
|
18
|
+
readonly errors: Partial<ErrorObject>[];
|
|
19
|
+
readonly ajv: true;
|
|
20
|
+
readonly validation: true;
|
|
21
|
+
constructor(errors: Partial<ErrorObject>[]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export declare class RegistryEntry extends CoreModel {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
11
29
|
/**
|
|
12
30
|
* Error with a code
|
|
13
31
|
*/
|
|
@@ -67,7 +85,6 @@ export declare class WebsiteOriginFilter implements RequestFilter<Context> {
|
|
|
67
85
|
checkRequest(context: Context): Promise<boolean>;
|
|
68
86
|
}
|
|
69
87
|
export declare function Bean(constructor: Function): void;
|
|
70
|
-
export declare function Route(route: string, methods?: string | string[], allowPath?: boolean, openapi?: OpenAPIWebdaDefinition): (target: any, executor: string) => void;
|
|
71
88
|
export declare type CoreEvents = {
|
|
72
89
|
/**
|
|
73
90
|
* Emitted when new result is sent
|
|
@@ -81,13 +98,25 @@ export declare type CoreEvents = {
|
|
|
81
98
|
* Emitted when a request does not match any route
|
|
82
99
|
*/
|
|
83
100
|
"Webda.404": EventWithContext;
|
|
101
|
+
/**
|
|
102
|
+
* Emitted when Services have been initialized
|
|
103
|
+
*/
|
|
84
104
|
"Webda.Init.Services": {
|
|
85
105
|
[key: string]: Service;
|
|
86
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Emitted when Services have been created
|
|
109
|
+
*/
|
|
87
110
|
"Webda.Create.Services": {
|
|
88
111
|
[key: string]: Service;
|
|
89
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Emitted when Core is initialized
|
|
115
|
+
*/
|
|
90
116
|
"Webda.Init": Configuration;
|
|
117
|
+
/**
|
|
118
|
+
* Emitted whenever a new Context is created
|
|
119
|
+
*/
|
|
91
120
|
"Webda.NewContext": Context;
|
|
92
121
|
[key: string]: unknown;
|
|
93
122
|
};
|
|
@@ -107,9 +136,21 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
107
136
|
protected services: {
|
|
108
137
|
[key: string]: Service;
|
|
109
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* Application that generates this Core
|
|
141
|
+
*/
|
|
110
142
|
protected application: Application;
|
|
143
|
+
/**
|
|
144
|
+
* Router that will route http request in
|
|
145
|
+
*/
|
|
111
146
|
protected router: Router;
|
|
147
|
+
/**
|
|
148
|
+
* If Core is already initiated
|
|
149
|
+
*/
|
|
112
150
|
protected _initiated: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Services who failed to create or initialize
|
|
153
|
+
*/
|
|
113
154
|
protected failedServices: {
|
|
114
155
|
[key: string]: any;
|
|
115
156
|
};
|
|
@@ -139,7 +180,13 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
139
180
|
*/
|
|
140
181
|
protected _currentExecutor: any;
|
|
141
182
|
protected _configFile: string;
|
|
183
|
+
/**
|
|
184
|
+
* Contains the current initialization process
|
|
185
|
+
*/
|
|
142
186
|
protected _initPromise: Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* When the Core was initialized
|
|
189
|
+
*/
|
|
143
190
|
protected _initTime: number;
|
|
144
191
|
/**
|
|
145
192
|
* Console logger
|
|
@@ -160,11 +207,24 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
160
207
|
* See [[CorsFilter]]
|
|
161
208
|
*/
|
|
162
209
|
protected _requestCORSFilters: RequestFilter<Context>[];
|
|
210
|
+
/**
|
|
211
|
+
* Worker output
|
|
212
|
+
*
|
|
213
|
+
* @see @webda/workout
|
|
214
|
+
*/
|
|
163
215
|
private workerOutput;
|
|
164
216
|
/**
|
|
165
217
|
* Store the instance id
|
|
166
218
|
*/
|
|
167
219
|
private instanceId;
|
|
220
|
+
/**
|
|
221
|
+
* Application registry
|
|
222
|
+
*/
|
|
223
|
+
protected registry: Store<RegistryEntry>;
|
|
224
|
+
/**
|
|
225
|
+
* Manage encryption within the application
|
|
226
|
+
*/
|
|
227
|
+
protected cryptoService: CryptoService;
|
|
168
228
|
/**
|
|
169
229
|
* @params {Object} config - The configuration Object, if undefined will load the configuration file
|
|
170
230
|
*/
|
|
@@ -189,10 +249,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
189
249
|
* @returns
|
|
190
250
|
*/
|
|
191
251
|
getAppPath(subpath?: string): string;
|
|
192
|
-
/**
|
|
193
|
-
* Reinit the @Route
|
|
194
|
-
*/
|
|
195
|
-
reinitResolvedRoutes(): void;
|
|
196
252
|
/**
|
|
197
253
|
* Retrieve all detected modules definition
|
|
198
254
|
*/
|
|
@@ -210,6 +266,12 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
210
266
|
* @param service
|
|
211
267
|
*/
|
|
212
268
|
protected initService(service: string): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Get an object from the application based on its full uuid
|
|
271
|
+
* @param fullUuid
|
|
272
|
+
* @param partials
|
|
273
|
+
*/
|
|
274
|
+
getModelObject<T extends CoreModel = CoreModel>(fullUuid: string, partials?: any): Promise<T>;
|
|
213
275
|
/**
|
|
214
276
|
* Init Webda
|
|
215
277
|
*
|
|
@@ -230,12 +292,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
230
292
|
* @param filter
|
|
231
293
|
*/
|
|
232
294
|
registerCORSFilter(filter: RequestFilter<Context>): void;
|
|
233
|
-
/**
|
|
234
|
-
*
|
|
235
|
-
* @param {Object} executor The executor to expose as executor
|
|
236
|
-
* @param {String} code to execute
|
|
237
|
-
*/
|
|
238
|
-
sandbox(code: any, context?: vm.Context): any;
|
|
239
295
|
/**
|
|
240
296
|
* Validate the object with schema
|
|
241
297
|
*
|
|
@@ -319,29 +375,7 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
319
375
|
*
|
|
320
376
|
* @param {String} name The model name to retrieve
|
|
321
377
|
*/
|
|
322
|
-
getModel(name: any):
|
|
323
|
-
/**
|
|
324
|
-
* This should return a "turning" secret with cache and a service to modify it every x mins
|
|
325
|
-
* WARNING The security is lower without this "turning" secret, you can still set the global.secret parameter
|
|
326
|
-
*
|
|
327
|
-
* Dont rely on this method, it will probably disapear to avoid secret leak
|
|
328
|
-
*
|
|
329
|
-
* @deprecated
|
|
330
|
-
* @returns {String} Current secret
|
|
331
|
-
*/
|
|
332
|
-
getSecret(): string;
|
|
333
|
-
/**
|
|
334
|
-
* Retrieve a HMAC for a string
|
|
335
|
-
* @param data
|
|
336
|
-
* @returns
|
|
337
|
-
*/
|
|
338
|
-
getHmac(data: string): Promise<string>;
|
|
339
|
-
/**
|
|
340
|
-
* Return a salt to use when doing digest
|
|
341
|
-
*
|
|
342
|
-
* @returns {String} Current salt
|
|
343
|
-
*/
|
|
344
|
-
getSalt(): string;
|
|
378
|
+
getModel<T = any>(name: any): Constructor<T> | CoreModelDefinition;
|
|
345
379
|
/**
|
|
346
380
|
* Add to context information and executor based on the http context
|
|
347
381
|
*/
|
|
@@ -399,6 +433,16 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
399
433
|
* @param obj service get setter from
|
|
400
434
|
*/
|
|
401
435
|
protected _getSetters(obj: any): any[];
|
|
436
|
+
/**
|
|
437
|
+
* A registry is a predefined store
|
|
438
|
+
* @returns
|
|
439
|
+
*/
|
|
440
|
+
getRegistry(): Store<RegistryEntry>;
|
|
441
|
+
/**
|
|
442
|
+
* Return the crypto service
|
|
443
|
+
* @returns
|
|
444
|
+
*/
|
|
445
|
+
getCrypto(): CryptoService;
|
|
402
446
|
/**
|
|
403
447
|
* Auto connect services with setters
|
|
404
448
|
*/
|
|
@@ -408,10 +452,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
408
452
|
* Init services and Beans along with Routes
|
|
409
453
|
*/
|
|
410
454
|
initStatics(): void;
|
|
411
|
-
/**
|
|
412
|
-
* Init Routes declare by @Route annotation
|
|
413
|
-
*/
|
|
414
|
-
initBeanRoutes(serviceBean: Service): void;
|
|
415
455
|
/**
|
|
416
456
|
* Create a new context for a request
|
|
417
457
|
*
|
|
@@ -420,7 +460,7 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
420
460
|
* @param stream - The request output stream if any
|
|
421
461
|
* @return A new context object to pass along
|
|
422
462
|
*/
|
|
423
|
-
newContext<T extends Context>(httpContext: HttpContext, stream?:
|
|
463
|
+
newContext<T extends Context>(httpContext: HttpContext, stream?: Writable, noInit?: boolean): Promise<T>;
|
|
424
464
|
/**
|
|
425
465
|
* Convert an object to JSON using the Webda json filter
|
|
426
466
|
*
|