@webda/core 2.0.0-beta.3 → 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 +5 -5
- 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 +20 -24
- package/lib/core.js +222 -315
- package/lib/core.js.map +1 -1
- package/lib/core.spec.js +332 -406
- package/lib/core.spec.js.map +1 -1
- package/lib/index.d.ts +49 -48
- package/lib/index.js +53 -70
- 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 -152
- package/lib/models/aclmodel.spec.js.map +1 -1
- package/lib/models/coremodel.d.ts +7 -6
- package/lib/models/coremodel.js +65 -113
- package/lib/models/coremodel.js.map +1 -1
- package/lib/models/coremodel.spec.js +88 -107
- package/lib/models/coremodel.spec.js.map +1 -1
- package/lib/models/deployment.js +1 -2
- package/lib/models/ident.d.ts +3 -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 +2 -2
- package/lib/models/ownermodel.js +39 -62
- package/lib/models/ownermodel.js.map +1 -1
- package/lib/models/ownermodel.spec.js +126 -168
- package/lib/models/ownermodel.spec.js.map +1 -1
- package/lib/models/rolemodel.d.ts +1 -1
- package/lib/models/rolemodel.js +24 -40
- package/lib/models/rolemodel.js.map +1 -1
- package/lib/models/rolemodel.spec.js +44 -63
- package/lib/models/rolemodel.spec.js.map +1 -1
- package/lib/models/user.d.ts +3 -3
- 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 +3 -3
- package/lib/queues/queueservice.js +51 -67
- package/lib/queues/queueservice.js.map +1 -1
- package/lib/router.d.ts +3 -3
- package/lib/router.js +46 -47
- 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 +23 -13
- package/lib/services/authentication.js +537 -563
- 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 +7 -5
- package/lib/services/binary.js +211 -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 +45 -70
- 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 +1 -1
- package/lib/services/configuration.js +78 -105
- 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 +9 -4
- package/lib/services/cryptoservice.js +187 -221
- package/lib/services/cryptoservice.js.map +1 -1
- package/lib/services/cryptoservice.spec.js +88 -115
- package/lib/services/cryptoservice.spec.js.map +1 -1
- 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 +5 -5
- package/lib/services/filebinary.js +165 -210
- package/lib/services/filebinary.js.map +1 -1
- package/lib/services/filebinary.spec.d.ts +2 -1
- package/lib/services/filebinary.spec.js +106 -116
- package/lib/services/filebinary.spec.js.map +1 -1
- package/lib/services/fileconfiguration.d.ts +1 -1
- package/lib/services/fileconfiguration.js +25 -44
- 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 +7 -7
- package/lib/services/invitationservice.js +274 -314
- 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 +1 -1
- package/lib/services/kubernetesconfiguration.js +41 -60
- 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 +3 -3
- package/lib/services/notificationservice.js +21 -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 +4 -4
- package/lib/services/oauth.js +68 -83
- package/lib/services/oauth.js.map +1 -1
- package/lib/services/oauth.spec.js +130 -156
- package/lib/services/oauth.spec.js.map +1 -1
- package/lib/services/proxy.d.ts +2 -6
- package/lib/services/proxy.js +45 -58
- package/lib/services/proxy.js.map +1 -1
- package/lib/services/proxy.spec.js +34 -53
- package/lib/services/proxy.spec.js.map +1 -1
- 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 +26 -3
- package/lib/services/service.js +68 -40
- 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 +2 -2
- package/lib/stores/aggregator.js +37 -58
- 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 +3 -3
- package/lib/stores/mapper.js +110 -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 +3 -3
- package/lib/stores/memory.js +98 -144
- package/lib/stores/memory.js.map +1 -1
- package/lib/stores/memory.spec.d.ts +2 -2
- package/lib/stores/memory.spec.js +124 -145
- package/lib/stores/memory.spec.js.map +1 -1
- package/lib/stores/store.d.ts +17 -13
- package/lib/stores/store.js +819 -847
- package/lib/stores/store.js.map +1 -1
- package/lib/stores/store.spec.d.ts +5 -4
- package/lib/stores/store.spec.js +624 -669
- 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 +73 -100
- 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 +7 -5
- package/lib/utils/context.js +95 -103
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/context.spec.js +139 -163
- package/lib/utils/context.spec.js.map +1 -1
- package/lib/utils/cookie.d.ts +3 -3
- package/lib/utils/cookie.js +42 -61
- package/lib/utils/cookie.js.map +1 -1
- package/lib/utils/cookie.spec.js +42 -64
- 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 +3 -0
- package/lib/utils/httpcontext.js +48 -65
- package/lib/utils/httpcontext.js.map +1 -1
- package/lib/utils/httpcontext.spec.js +37 -56
- 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 +6 -6
- package/lib/utils/session.js +37 -59
- package/lib/utils/session.js.map +1 -1
- package/lib/utils/session.spec.js +38 -51
- package/lib/utils/session.spec.js.map +1 -1
- 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 +17 -12
- package/test/config-invitation.json +1 -3
- package/test/config.json +1 -2
- 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 -189
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,eAAgB,SAAQ,SAAS;IAGrC,KAAK,CAAC,MAAM;QACV,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,IA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,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,14 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { WorkerLogLevel, WorkerOutput } from "@webda/workout";
|
|
3
|
-
import Ajv from "ajv";
|
|
4
|
+
import Ajv, { ErrorObject } from "ajv";
|
|
4
5
|
import * as events from "events";
|
|
5
6
|
import { OpenAPIV3 } from "openapi-types";
|
|
6
|
-
import
|
|
7
|
-
import { Application, Configuration } from "./application";
|
|
8
|
-
import { Context, HttpContext, Logger, Service, Store } from "./index";
|
|
9
|
-
import { CoreModel, CoreModelDefinition } from "./models/coremodel";
|
|
10
|
-
import {
|
|
11
|
-
import CryptoService from "./services/cryptoservice";
|
|
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
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
*
|
|
14
25
|
*/
|
|
@@ -74,7 +85,6 @@ export declare class WebsiteOriginFilter implements RequestFilter<Context> {
|
|
|
74
85
|
checkRequest(context: Context): Promise<boolean>;
|
|
75
86
|
}
|
|
76
87
|
export declare function Bean(constructor: Function): void;
|
|
77
|
-
export declare function Route(route: string, methods?: string | string[], allowPath?: boolean, openapi?: OpenAPIWebdaDefinition): (target: any, executor: string) => void;
|
|
78
88
|
export declare type CoreEvents = {
|
|
79
89
|
/**
|
|
80
90
|
* Emitted when new result is sent
|
|
@@ -239,10 +249,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
239
249
|
* @returns
|
|
240
250
|
*/
|
|
241
251
|
getAppPath(subpath?: string): string;
|
|
242
|
-
/**
|
|
243
|
-
* Reinit the @Route
|
|
244
|
-
*/
|
|
245
|
-
reinitResolvedRoutes(): void;
|
|
246
252
|
/**
|
|
247
253
|
* Retrieve all detected modules definition
|
|
248
254
|
*/
|
|
@@ -286,12 +292,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
286
292
|
* @param filter
|
|
287
293
|
*/
|
|
288
294
|
registerCORSFilter(filter: RequestFilter<Context>): void;
|
|
289
|
-
/**
|
|
290
|
-
*
|
|
291
|
-
* @param {Object} executor The executor to expose as executor
|
|
292
|
-
* @param {String} code to execute
|
|
293
|
-
*/
|
|
294
|
-
sandbox(code: any, context?: vm.Context): any;
|
|
295
295
|
/**
|
|
296
296
|
* Validate the object with schema
|
|
297
297
|
*
|
|
@@ -375,7 +375,7 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
375
375
|
*
|
|
376
376
|
* @param {String} name The model name to retrieve
|
|
377
377
|
*/
|
|
378
|
-
getModel(name: any):
|
|
378
|
+
getModel<T = any>(name: any): Constructor<T> | CoreModelDefinition;
|
|
379
379
|
/**
|
|
380
380
|
* Add to context information and executor based on the http context
|
|
381
381
|
*/
|
|
@@ -452,10 +452,6 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
452
452
|
* Init services and Beans along with Routes
|
|
453
453
|
*/
|
|
454
454
|
initStatics(): void;
|
|
455
|
-
/**
|
|
456
|
-
* Init Routes declare by @Route annotation
|
|
457
|
-
*/
|
|
458
|
-
initBeanRoutes(serviceBean: Service): void;
|
|
459
455
|
/**
|
|
460
456
|
* Create a new context for a request
|
|
461
457
|
*
|
|
@@ -464,7 +460,7 @@ export declare class Core<E extends CoreEvents = CoreEvents> extends events.Even
|
|
|
464
460
|
* @param stream - The request output stream if any
|
|
465
461
|
* @return A new context object to pass along
|
|
466
462
|
*/
|
|
467
|
-
newContext<T extends Context>(httpContext: HttpContext, stream?:
|
|
463
|
+
newContext<T extends Context>(httpContext: HttpContext, stream?: Writable, noInit?: boolean): Promise<T>;
|
|
468
464
|
/**
|
|
469
465
|
* Convert an object to JSON using the Webda json filter
|
|
470
466
|
*
|