@webda/core 1.6.0-beta.1 → 2.0.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 +317 -195
- package/lib/application.js +171 -674
- package/lib/application.js.map +1 -1
- package/lib/application.spec.js +97 -289
- package/lib/application.spec.js.map +1 -1
- package/lib/core.d.ts +102 -214
- package/lib/core.js +146 -70
- package/lib/core.js.map +1 -1
- package/lib/core.spec.js +80 -17
- package/lib/core.spec.js.map +1 -1
- package/lib/index.d.ts +14 -9
- package/lib/index.js +19 -10
- package/lib/index.js.map +1 -1
- package/lib/models/aclmodel.d.ts +29 -8
- package/lib/models/aclmodel.js +68 -18
- package/lib/models/aclmodel.js.map +1 -1
- package/lib/models/aclmodel.spec.js +56 -19
- package/lib/models/aclmodel.spec.js.map +1 -1
- package/lib/models/coremodel.d.ts +9 -17
- package/lib/models/coremodel.js +36 -36
- package/lib/models/coremodel.js.map +1 -1
- package/lib/models/ident.d.ts +8 -3
- package/lib/models/ident.js +8 -1
- package/lib/models/ident.js.map +1 -1
- package/lib/models/ident.spec.js +3 -0
- package/lib/models/ident.spec.js.map +1 -1
- package/lib/models/ownermodel.d.ts +8 -4
- package/lib/models/ownermodel.js +10 -6
- package/lib/models/ownermodel.js.map +1 -1
- package/lib/models/rolemodel.js.map +1 -1
- package/lib/models/rolemodel.spec.js +4 -1
- package/lib/models/rolemodel.spec.js.map +1 -1
- package/lib/models/user.d.ts +32 -3
- package/lib/models/user.js +31 -0
- package/lib/models/user.js.map +1 -1
- package/lib/models/user.spec.js +11 -0
- package/lib/models/user.spec.js.map +1 -1
- package/lib/queues/filequeue.d.ts +2 -7
- package/lib/queues/filequeue.js +2 -11
- package/lib/queues/filequeue.js.map +1 -1
- package/lib/queues/filequeue.spec.js +0 -1
- package/lib/queues/filequeue.spec.js.map +1 -1
- package/lib/queues/memoryqueue.d.ts +2 -7
- package/lib/queues/memoryqueue.js +1 -11
- package/lib/queues/memoryqueue.js.map +1 -1
- package/lib/queues/memoryqueue.spec.js +0 -1
- package/lib/queues/memoryqueue.spec.js.map +1 -1
- package/lib/queues/queue.spec.d.ts +1 -1
- package/lib/queues/queue.spec.js +11 -9
- package/lib/queues/queue.spec.js.map +1 -1
- package/lib/queues/queueservice.js +1 -1
- package/lib/queues/queueservice.js.map +1 -1
- package/lib/router.d.ts +46 -1
- package/lib/router.js +89 -51
- package/lib/router.js.map +1 -1
- package/lib/router.spec.js +19 -2
- package/lib/router.spec.js.map +1 -1
- package/lib/services/asyncevents.d.ts +1 -0
- package/lib/services/asyncevents.js +4 -3
- package/lib/services/asyncevents.js.map +1 -1
- package/lib/services/authentication.d.ts +47 -5
- package/lib/services/authentication.js +99 -40
- package/lib/services/authentication.js.map +1 -1
- package/lib/services/authentication.spec.js +10 -0
- package/lib/services/authentication.spec.js.map +1 -1
- package/lib/services/binary.d.ts +126 -64
- package/lib/services/binary.js +247 -96
- package/lib/services/binary.js.map +1 -1
- package/lib/services/binary.spec.d.ts +1 -0
- package/lib/services/binary.spec.js +96 -25
- package/lib/services/binary.spec.js.map +1 -1
- package/lib/services/cloudbinary.d.ts +67 -0
- package/lib/services/cloudbinary.js +178 -0
- package/lib/services/cloudbinary.js.map +1 -0
- package/lib/services/cloudbinary.spec.d.ts +13 -0
- package/lib/services/cloudbinary.spec.js +205 -0
- package/lib/services/cloudbinary.spec.js.map +1 -0
- package/lib/services/configuration.d.ts +7 -2
- package/lib/services/configuration.js +4 -3
- package/lib/services/configuration.js.map +1 -1
- package/lib/services/configuration.spec.js +1 -0
- package/lib/services/configuration.spec.js.map +1 -1
- package/lib/services/cron.d.ts +5 -6
- package/lib/services/cron.js +4 -11
- package/lib/services/cron.js.map +1 -1
- package/lib/services/cron.spec.js +2 -3
- package/lib/services/cron.spec.js.map +1 -1
- package/lib/services/debugmailer.d.ts +11 -6
- package/lib/services/debugmailer.js +20 -14
- package/lib/services/debugmailer.js.map +1 -1
- package/lib/services/debugmailer.spec.js +1 -0
- package/lib/services/debugmailer.spec.js.map +1 -1
- package/lib/services/echo.d.ts +2 -6
- package/lib/services/echo.js +1 -11
- package/lib/services/echo.js.map +1 -1
- package/lib/services/echo.spec.js +1 -0
- package/lib/services/echo.spec.js.map +1 -1
- package/lib/services/filebinary.d.ts +36 -12
- package/lib/services/filebinary.js +123 -38
- package/lib/services/filebinary.js.map +1 -1
- package/lib/services/filebinary.spec.d.ts +4 -2
- package/lib/services/filebinary.spec.js +48 -8
- package/lib/services/filebinary.spec.js.map +1 -1
- package/lib/services/fileconfiguration.d.ts +1 -5
- package/lib/services/fileconfiguration.js +1 -10
- package/lib/services/fileconfiguration.js.map +1 -1
- package/lib/services/invitationservice.d.ts +198 -0
- package/lib/services/invitationservice.js +443 -0
- package/lib/services/invitationservice.js.map +1 -0
- package/lib/services/invitationservice.spec.d.ts +1 -0
- package/lib/services/invitationservice.spec.js +517 -0
- package/lib/services/invitationservice.spec.js.map +1 -0
- package/lib/services/kubernetesconfiguration.d.ts +3 -5
- package/lib/services/kubernetesconfiguration.js +5 -12
- package/lib/services/kubernetesconfiguration.js.map +1 -1
- package/lib/services/kubernetesconfiguration.spec.js +1 -1
- package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
- package/lib/services/mailer.d.ts +44 -7
- package/lib/services/mailer.js +34 -14
- package/lib/services/mailer.js.map +1 -1
- package/lib/services/mailer.spec.js +29 -0
- package/lib/services/mailer.spec.js.map +1 -1
- package/lib/services/notificationservice.d.ts +76 -0
- package/lib/services/notificationservice.js +91 -0
- package/lib/services/notificationservice.js.map +1 -0
- package/lib/services/notificationservice.spec.d.ts +1 -0
- package/lib/services/notificationservice.spec.js +104 -0
- package/lib/services/notificationservice.spec.js.map +1 -0
- package/lib/services/oauth.d.ts +6 -4
- package/lib/services/oauth.js +28 -11
- package/lib/services/oauth.js.map +1 -1
- package/lib/services/oauth.spec.js +7 -10
- package/lib/services/oauth.spec.js.map +1 -1
- package/lib/services/resource.d.ts +1 -5
- package/lib/services/resource.js +22 -17
- package/lib/services/resource.js.map +1 -1
- package/lib/services/resource.spec.js +0 -1
- package/lib/services/resource.spec.js.map +1 -1
- package/lib/services/service.d.ts +29 -26
- package/lib/services/service.js +16 -22
- package/lib/services/service.js.map +1 -1
- package/lib/services/service.spec.js +3 -0
- package/lib/services/service.spec.js.map +1 -1
- package/lib/services/version.d.ts +2 -5
- package/lib/services/version.js +1 -10
- package/lib/services/version.js.map +1 -1
- package/lib/stores/aggregator.d.ts +3 -5
- package/lib/stores/aggregator.js +3 -10
- package/lib/stores/aggregator.js.map +1 -1
- package/lib/stores/file.d.ts +7 -8
- package/lib/stores/file.js +18 -18
- package/lib/stores/file.js.map +1 -1
- package/lib/stores/file.spec.js +8 -6
- package/lib/stores/file.spec.js.map +1 -1
- package/lib/stores/mapper.d.ts +1 -5
- package/lib/stores/mapper.js +56 -39
- package/lib/stores/mapper.js.map +1 -1
- package/lib/stores/mapper.spec.js +120 -1
- package/lib/stores/mapper.spec.js.map +1 -1
- package/lib/stores/memory.d.ts +5 -9
- package/lib/stores/memory.js +5 -17
- package/lib/stores/memory.js.map +1 -1
- package/lib/stores/memory.spec.d.ts +1 -0
- package/lib/stores/memory.spec.js +32 -0
- package/lib/stores/memory.spec.js.map +1 -1
- package/lib/stores/store.d.ts +131 -26
- package/lib/stores/store.js +399 -80
- package/lib/stores/store.js.map +1 -1
- package/lib/stores/store.spec.d.ts +29 -2
- package/lib/stores/store.spec.js +204 -31
- package/lib/stores/store.spec.js.map +1 -1
- package/lib/stores/webdaql/WebdaQLLexer.d.ts +53 -0
- package/lib/stores/webdaql/WebdaQLLexer.js +290 -0
- package/lib/stores/webdaql/WebdaQLLexer.js.map +1 -0
- package/lib/stores/webdaql/WebdaQLParserLexer.d.ts +53 -0
- package/lib/stores/webdaql/WebdaQLParserLexer.js +290 -0
- package/lib/stores/webdaql/WebdaQLParserLexer.js.map +1 -0
- package/lib/stores/webdaql/WebdaQLParserListener.d.ts +308 -0
- package/lib/stores/webdaql/WebdaQLParserListener.js +4 -0
- package/lib/stores/webdaql/WebdaQLParserListener.js.map +1 -0
- package/lib/stores/webdaql/WebdaQLParserParser.d.ts +301 -0
- package/lib/stores/webdaql/WebdaQLParserParser.js +1781 -0
- package/lib/stores/webdaql/WebdaQLParserParser.js.map +1 -0
- package/lib/stores/webdaql/WebdaQLParserVisitor.d.ts +198 -0
- package/lib/stores/webdaql/WebdaQLParserVisitor.js +4 -0
- package/lib/stores/webdaql/WebdaQLParserVisitor.js.map +1 -0
- package/lib/stores/webdaql/query.d.ts +300 -0
- package/lib/stores/webdaql/query.js +471 -0
- package/lib/stores/webdaql/query.js.map +1 -0
- package/lib/stores/webdaql/query.spec.d.ts +1 -0
- package/lib/stores/webdaql/query.spec.js +136 -0
- package/lib/stores/webdaql/query.spec.js.map +1 -0
- package/lib/test.d.ts +50 -2
- package/lib/test.js +161 -16
- package/lib/test.js.map +1 -1
- package/lib/unpackedapplication.d.ts +66 -0
- package/lib/unpackedapplication.js +202 -0
- package/lib/unpackedapplication.js.map +1 -0
- package/lib/utils/context.d.ts +14 -12
- package/lib/utils/context.js +14 -9
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/context.spec.js +1 -1
- package/lib/utils/context.spec.js.map +1 -1
- package/lib/utils/cookie.d.ts +6 -3
- package/lib/utils/cookie.js +22 -20
- package/lib/utils/cookie.js.map +1 -1
- package/lib/utils/cookie.spec.js +0 -1
- package/lib/utils/cookie.spec.js.map +1 -1
- package/lib/utils/logger.d.ts +16 -3
- package/lib/utils/logger.js +16 -3
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.spec.js.map +1 -1
- package/lib/utils/serializers.js +5 -1
- package/lib/utils/serializers.js.map +1 -1
- package/lib/utils/waiter.d.ts +1 -1
- package/lib/utils/waiter.js.map +1 -1
- package/package.json +25 -18
- package/test/config-file-no-reload.json +2 -1
- package/test/config-file-reload.json +2 -1
- package/test/config-invitation.json +63 -0
- package/test/config-kube-reload.json +2 -1
- package/test/config-reload.json +1 -1
- package/test/config.json +6 -10
- package/test/config.old.json +1 -1
- package/test/moddas/annotatedservice.js +1 -3
- package/test/moddas/debugmailer.js +2 -7
- package/test/moddas/fakeservice.js +1 -1
- package/test/moddas/voidstore.js +2 -4
- package/test/models/ident.js +1 -1
- package/test/models/task.js +1 -5
- package/webda.module.json +1124 -0
- package/test/config.old-default.json +0 -151
package/lib/core.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import Ajv from "ajv";
|
|
2
3
|
import * as events from "events";
|
|
3
|
-
import { JSONSchema6 } from "json-schema";
|
|
4
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
5
|
import * as vm from "vm";
|
|
6
|
-
import { Application } from "./application";
|
|
6
|
+
import { Application, Configuration } from "./application";
|
|
7
7
|
import { Context, HttpContext, Logger, Service } from "./index";
|
|
8
8
|
import { CoreModel, CoreModelDefinition } from "./models/coremodel";
|
|
9
|
-
import { RouteInfo, Router } from "./router";
|
|
9
|
+
import { OpenAPIWebdaDefinition, RouteInfo, Router } from "./router";
|
|
10
10
|
import { WorkerOutput, WorkerLogLevel } from "@webda/workout";
|
|
11
|
-
import { AbstractDeployer } from "./utils/abstractdeployer";
|
|
12
11
|
/**
|
|
13
12
|
* Error with a code
|
|
14
13
|
*/
|
|
@@ -31,190 +30,6 @@ export declare class WebdaError extends Error {
|
|
|
31
30
|
export interface EventWithContext {
|
|
32
31
|
context: Context;
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Emitted when new request comes in
|
|
36
|
-
*/
|
|
37
|
-
export interface EventWebdaRequest extends EventWithContext {
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Emitted when new result is sent
|
|
41
|
-
*/
|
|
42
|
-
export interface EventWebdaResult extends EventWithContext {
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Emitted when a request does not match any route
|
|
46
|
-
*/
|
|
47
|
-
export interface EventWebda404 extends EventWithContext {
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Define a reusable service
|
|
51
|
-
*
|
|
52
|
-
* A Modda is a class that can be reused
|
|
53
|
-
* For example:
|
|
54
|
-
* - MongoDB Store implementation
|
|
55
|
-
* - SQS Service implementation
|
|
56
|
-
* - etc
|
|
57
|
-
*/
|
|
58
|
-
export interface ModdaDefinition {
|
|
59
|
-
uuid: string;
|
|
60
|
-
/**
|
|
61
|
-
* Label of the service
|
|
62
|
-
*/
|
|
63
|
-
label: string;
|
|
64
|
-
/**
|
|
65
|
-
* Description of your service
|
|
66
|
-
*/
|
|
67
|
-
description: string;
|
|
68
|
-
/**
|
|
69
|
-
* Documentation page must be available online
|
|
70
|
-
*/
|
|
71
|
-
documentation?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Type of services
|
|
74
|
-
*/
|
|
75
|
-
category?: "services" | "models" | "deployers";
|
|
76
|
-
/**
|
|
77
|
-
* URL of the logo to display
|
|
78
|
-
*/
|
|
79
|
-
logo?: string;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A Webda module is a NPM package
|
|
83
|
-
*
|
|
84
|
-
* It contains one or more Modda to provide features
|
|
85
|
-
*/
|
|
86
|
-
export interface Module {
|
|
87
|
-
/**
|
|
88
|
-
* Services provided by the module
|
|
89
|
-
*/
|
|
90
|
-
services?: {
|
|
91
|
-
[key: string]: string;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Models provided by the module
|
|
95
|
-
*/
|
|
96
|
-
models?: {
|
|
97
|
-
[key: string]: string;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Deployers provided by the module
|
|
101
|
-
*
|
|
102
|
-
* @link Deployer
|
|
103
|
-
*/
|
|
104
|
-
deployers?: {
|
|
105
|
-
[key: string]: string;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Schemas for services, deployers and coremodel
|
|
109
|
-
*/
|
|
110
|
-
schemas?: {
|
|
111
|
-
[key: string]: JSONSchema6;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Cached module is all modules discover plus local package including the sources list
|
|
116
|
-
*/
|
|
117
|
-
export interface CachedModule extends Module {
|
|
118
|
-
/**
|
|
119
|
-
* Source files to import
|
|
120
|
-
*/
|
|
121
|
-
sources?: string[];
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Configuration from Webda 1.0 > version > 0.5
|
|
125
|
-
*/
|
|
126
|
-
export interface ConfigurationV1 {
|
|
127
|
-
/**
|
|
128
|
-
* Configuration version
|
|
129
|
-
*/
|
|
130
|
-
version: number;
|
|
131
|
-
/**
|
|
132
|
-
* Cached modules to avoid scanning node_modules
|
|
133
|
-
* This is used by packagers
|
|
134
|
-
*/
|
|
135
|
-
cachedModules?: CachedModule;
|
|
136
|
-
/**
|
|
137
|
-
* Models
|
|
138
|
-
*/
|
|
139
|
-
models?: any;
|
|
140
|
-
/**
|
|
141
|
-
* Services configuration
|
|
142
|
-
*/
|
|
143
|
-
services?: any;
|
|
144
|
-
[key: string]: any;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Configuration from Webda version >= 1.0
|
|
148
|
-
*/
|
|
149
|
-
export interface Configuration {
|
|
150
|
-
/**
|
|
151
|
-
* @minimum 2
|
|
152
|
-
*/
|
|
153
|
-
version: number;
|
|
154
|
-
/**
|
|
155
|
-
* Cached modules to avoid scanning node_modules
|
|
156
|
-
* This is used by packagers
|
|
157
|
-
*/
|
|
158
|
-
cachedModules?: CachedModule;
|
|
159
|
-
/**
|
|
160
|
-
* Module definition
|
|
161
|
-
*/
|
|
162
|
-
module: Module;
|
|
163
|
-
/**
|
|
164
|
-
* Services configuration
|
|
165
|
-
*/
|
|
166
|
-
services?: any;
|
|
167
|
-
/**
|
|
168
|
-
* Global parameters
|
|
169
|
-
*/
|
|
170
|
-
parameters?: {
|
|
171
|
-
/**
|
|
172
|
-
* Allowed origin for referer that match
|
|
173
|
-
* any of this regexp
|
|
174
|
-
*
|
|
175
|
-
* {@link OriginFilter}
|
|
176
|
-
*/
|
|
177
|
-
csrfOrigins?: string[];
|
|
178
|
-
/**
|
|
179
|
-
* Allow you to authorize one or several websites
|
|
180
|
-
* If you use "*" then the API is open to direct call and any origins
|
|
181
|
-
*
|
|
182
|
-
* {@link WebsiteOriginFilter}
|
|
183
|
-
*/
|
|
184
|
-
website?: string | string[] | {
|
|
185
|
-
url: string;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Cookie configuration for session
|
|
189
|
-
*/
|
|
190
|
-
cookie?: {
|
|
191
|
-
sameSite: "None" | "Strict" | "Lax";
|
|
192
|
-
domain: string;
|
|
193
|
-
/**
|
|
194
|
-
* @minimum 1
|
|
195
|
-
*/
|
|
196
|
-
maxAge: number;
|
|
197
|
-
path: string;
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Read from the configuration service before init
|
|
201
|
-
*/
|
|
202
|
-
configurationService?: string;
|
|
203
|
-
/**
|
|
204
|
-
* Application salt
|
|
205
|
-
*/
|
|
206
|
-
salt?: string;
|
|
207
|
-
/**
|
|
208
|
-
* Define the api url
|
|
209
|
-
*/
|
|
210
|
-
apiUrl?: string;
|
|
211
|
-
[key: string]: any;
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* OpenAPI override
|
|
215
|
-
*/
|
|
216
|
-
openapi?: any;
|
|
217
|
-
}
|
|
218
33
|
/**
|
|
219
34
|
* RequestFilter allow a service which implement it to control incoming request
|
|
220
35
|
*
|
|
@@ -252,14 +67,39 @@ export declare class WebsiteOriginFilter implements RequestFilter<Context> {
|
|
|
252
67
|
checkRequest(context: Context): Promise<boolean>;
|
|
253
68
|
}
|
|
254
69
|
export declare function Bean(constructor: Function): void;
|
|
255
|
-
export declare function Route(route: string, methods?: string | string[], allowPath?: boolean, openapi?:
|
|
70
|
+
export declare function Route(route: string, methods?: string | string[], allowPath?: boolean, openapi?: OpenAPIWebdaDefinition): (target: any, executor: string) => void;
|
|
71
|
+
export declare type CoreEvents = {
|
|
72
|
+
/**
|
|
73
|
+
* Emitted when new result is sent
|
|
74
|
+
*/
|
|
75
|
+
"Webda.Result": EventWithContext;
|
|
76
|
+
/**
|
|
77
|
+
* Emitted when new request comes in
|
|
78
|
+
*/
|
|
79
|
+
"Webda.Request": EventWithContext;
|
|
80
|
+
/**
|
|
81
|
+
* Emitted when a request does not match any route
|
|
82
|
+
*/
|
|
83
|
+
"Webda.404": EventWithContext;
|
|
84
|
+
"Webda.Init.Services": {
|
|
85
|
+
[key: string]: Service;
|
|
86
|
+
};
|
|
87
|
+
"Webda.Create.Services": {
|
|
88
|
+
[key: string]: Service;
|
|
89
|
+
};
|
|
90
|
+
"Webda.Init": Configuration;
|
|
91
|
+
"Webda.NewContext": Context;
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
};
|
|
94
|
+
declare type NoSchemaResult = null;
|
|
95
|
+
declare type SchemaValidResult = true;
|
|
256
96
|
/**
|
|
257
97
|
* This is the main class of the framework, it handles the routing, the services initialization and resolution
|
|
258
98
|
*
|
|
259
99
|
* @class Core
|
|
260
100
|
* @category CoreFeatures
|
|
261
101
|
*/
|
|
262
|
-
export declare class Core extends events.EventEmitter {
|
|
102
|
+
export declare class Core<E extends CoreEvents = CoreEvents> extends events.EventEmitter {
|
|
263
103
|
/**
|
|
264
104
|
* Webda Services
|
|
265
105
|
* @hidden
|
|
@@ -286,11 +126,14 @@ export declare class Core extends events.EventEmitter {
|
|
|
286
126
|
/**
|
|
287
127
|
* JSON Schema validator instance
|
|
288
128
|
*/
|
|
289
|
-
protected _ajv:
|
|
129
|
+
protected _ajv: Ajv;
|
|
290
130
|
/**
|
|
291
131
|
* JSON Schema registry
|
|
132
|
+
* Save if a schema was added to Ajv already
|
|
292
133
|
*/
|
|
293
|
-
protected _ajvSchemas:
|
|
134
|
+
protected _ajvSchemas: {
|
|
135
|
+
[key: string]: true;
|
|
136
|
+
};
|
|
294
137
|
/**
|
|
295
138
|
* Current executor
|
|
296
139
|
*/
|
|
@@ -304,17 +147,34 @@ export declare class Core extends events.EventEmitter {
|
|
|
304
147
|
*/
|
|
305
148
|
protected logger: Logger;
|
|
306
149
|
/**
|
|
307
|
-
*
|
|
150
|
+
* Request Filter registry
|
|
308
151
|
*
|
|
309
152
|
* Added via [[Webda.registerRequestFilter]]
|
|
310
153
|
* See [[CorsFilter]]
|
|
311
154
|
*/
|
|
312
155
|
protected _requestFilters: RequestFilter<Context>[];
|
|
156
|
+
/**
|
|
157
|
+
* CORS Filter registry
|
|
158
|
+
*
|
|
159
|
+
* Added via [[Webda.registerCORSRequestFilter]]
|
|
160
|
+
* See [[CorsFilter]]
|
|
161
|
+
*/
|
|
162
|
+
protected _requestCORSFilters: RequestFilter<Context>[];
|
|
313
163
|
private workerOutput;
|
|
164
|
+
/**
|
|
165
|
+
* Store the instance id
|
|
166
|
+
*/
|
|
167
|
+
private instanceId;
|
|
314
168
|
/**
|
|
315
169
|
* @params {Object} config - The configuration Object, if undefined will load the configuration file
|
|
316
170
|
*/
|
|
317
171
|
constructor(application: Application);
|
|
172
|
+
/**
|
|
173
|
+
* Return Core instance id
|
|
174
|
+
*
|
|
175
|
+
* It is a random generated string
|
|
176
|
+
*/
|
|
177
|
+
getInstanceId(): string;
|
|
318
178
|
/**
|
|
319
179
|
* Get absolute url with subpath
|
|
320
180
|
* @param subpath
|
|
@@ -336,13 +196,7 @@ export declare class Core extends events.EventEmitter {
|
|
|
336
196
|
/**
|
|
337
197
|
* Retrieve all detected modules definition
|
|
338
198
|
*/
|
|
339
|
-
getModules(): CachedModule;
|
|
340
|
-
/**
|
|
341
|
-
* Retrieve all deployers
|
|
342
|
-
*/
|
|
343
|
-
getDeployers(): {
|
|
344
|
-
[key: string]: import("./application").ServiceConstructor<Service<import("./index").ServiceParameters>>;
|
|
345
|
-
};
|
|
199
|
+
getModules(): import("./application").CachedModule;
|
|
346
200
|
/**
|
|
347
201
|
* Return application definition
|
|
348
202
|
*/
|
|
@@ -362,7 +216,20 @@ export declare class Core extends events.EventEmitter {
|
|
|
362
216
|
* It will resolve Services init method and autolink
|
|
363
217
|
*/
|
|
364
218
|
init(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Register a request filtering
|
|
221
|
+
*
|
|
222
|
+
* Will apply to all requests regardless of the devMode
|
|
223
|
+
* @param filter
|
|
224
|
+
*/
|
|
365
225
|
registerRequestFilter(filter: RequestFilter<Context>): void;
|
|
226
|
+
/**
|
|
227
|
+
* Register a CORS request filtering
|
|
228
|
+
*
|
|
229
|
+
* Does not apply in devMode
|
|
230
|
+
* @param filter
|
|
231
|
+
*/
|
|
232
|
+
registerCORSFilter(filter: RequestFilter<Context>): void;
|
|
366
233
|
/**
|
|
367
234
|
*
|
|
368
235
|
* @param {Object} executor The executor to expose as executor
|
|
@@ -375,11 +242,7 @@ export declare class Core extends events.EventEmitter {
|
|
|
375
242
|
* @param schema path to use
|
|
376
243
|
* @param object to validate
|
|
377
244
|
*/
|
|
378
|
-
validateSchema(webdaObject: CoreModel |
|
|
379
|
-
/**
|
|
380
|
-
* Get last errors from AJV schema validator ( called through validate method )
|
|
381
|
-
*/
|
|
382
|
-
validationLastErrors(): any;
|
|
245
|
+
validateSchema(webdaObject: CoreModel | string, object: any): NoSchemaResult | SchemaValidResult;
|
|
383
246
|
/**
|
|
384
247
|
* Return webda current version
|
|
385
248
|
*
|
|
@@ -433,7 +296,7 @@ export declare class Core extends events.EventEmitter {
|
|
|
433
296
|
* @param type The type of implementation
|
|
434
297
|
* @returns {{}}
|
|
435
298
|
*/
|
|
436
|
-
|
|
299
|
+
getServicesOfType(type?: any): {
|
|
437
300
|
[key: string]: Service;
|
|
438
301
|
};
|
|
439
302
|
getConfiguration(): Configuration;
|
|
@@ -451,10 +314,6 @@ export declare class Core extends events.EventEmitter {
|
|
|
451
314
|
getModels(): {
|
|
452
315
|
[key: string]: CoreModelDefinition;
|
|
453
316
|
};
|
|
454
|
-
/**
|
|
455
|
-
* Register model
|
|
456
|
-
*/
|
|
457
|
-
registerModel(name: string, clazz: any): void;
|
|
458
317
|
/**
|
|
459
318
|
* Check for a model name and return the wanted class or throw exception if none found
|
|
460
319
|
*
|
|
@@ -488,11 +347,11 @@ export declare class Core extends events.EventEmitter {
|
|
|
488
347
|
*
|
|
489
348
|
* @abstract
|
|
490
349
|
*/
|
|
491
|
-
flushHeaders(
|
|
350
|
+
flushHeaders(_context: Context): void;
|
|
492
351
|
/**
|
|
493
352
|
* Flush the entire response to the client
|
|
494
353
|
*/
|
|
495
|
-
flush(
|
|
354
|
+
flush(_context: Context): void;
|
|
496
355
|
/**
|
|
497
356
|
* Return if Webda is in debug mode
|
|
498
357
|
*/
|
|
@@ -539,6 +398,9 @@ export declare class Core extends events.EventEmitter {
|
|
|
539
398
|
*/
|
|
540
399
|
protected autoConnectServices(): void;
|
|
541
400
|
protected jsonFilter(key: string, value: any): any;
|
|
401
|
+
/**
|
|
402
|
+
* Init services and Beans along with Routes
|
|
403
|
+
*/
|
|
542
404
|
initStatics(): void;
|
|
543
405
|
/**
|
|
544
406
|
* Init Routes declare by @Route annotation
|
|
@@ -561,10 +423,29 @@ export declare class Core extends events.EventEmitter {
|
|
|
561
423
|
* @return {String} The export of the strip object ( removed all attribute with _ )
|
|
562
424
|
*/
|
|
563
425
|
toPublicJSON(object: any): string;
|
|
426
|
+
/**
|
|
427
|
+
* Return a UUID
|
|
428
|
+
*
|
|
429
|
+
* @param format to return different type of format
|
|
430
|
+
* Plan to implement base64 and maybe base85
|
|
431
|
+
*/
|
|
432
|
+
getUuid(_format?: "hex"): string;
|
|
433
|
+
/**
|
|
434
|
+
* @override
|
|
435
|
+
*/
|
|
436
|
+
emit<K extends keyof E>(eventType: K | symbol | string, event?: E[K], ...data: any[]): boolean;
|
|
564
437
|
/**
|
|
565
438
|
* Emit the event with data and wait for Promise to finish if listener returned a Promise
|
|
566
439
|
*/
|
|
567
|
-
emitSync<
|
|
440
|
+
emitSync<K extends keyof E>(eventType: K | symbol, event?: E[K], ...data: any[]): Promise<any[]>;
|
|
441
|
+
/**
|
|
442
|
+
* Type the listener part
|
|
443
|
+
* @param event
|
|
444
|
+
* @param listener
|
|
445
|
+
* @param queue
|
|
446
|
+
* @returns
|
|
447
|
+
*/
|
|
448
|
+
on<Key extends keyof E>(event: Key | symbol, listener: (evt: E[Key]) => void): this;
|
|
568
449
|
/**
|
|
569
450
|
* Logs
|
|
570
451
|
* @param level
|
|
@@ -576,10 +457,17 @@ export declare class Core extends events.EventEmitter {
|
|
|
576
457
|
*/
|
|
577
458
|
parameter(name: string): any;
|
|
578
459
|
/**
|
|
579
|
-
* Verify if
|
|
460
|
+
* Verify if a request can be done
|
|
580
461
|
*
|
|
581
462
|
* @param context Context of the request
|
|
582
463
|
*/
|
|
583
464
|
protected checkRequest(ctx: Context): Promise<boolean>;
|
|
465
|
+
/**
|
|
466
|
+
* Verify if an origin is allowed to do request on the API
|
|
467
|
+
*
|
|
468
|
+
* @param context Context of the request
|
|
469
|
+
*/
|
|
470
|
+
protected checkCORSRequest(ctx: Context): Promise<boolean>;
|
|
584
471
|
exportOpenAPI(skipHidden?: boolean): OpenAPIV3.Document;
|
|
585
472
|
}
|
|
473
|
+
export {};
|