@webda/core 1.6.0-beta.3 → 2.0.0-beta.2

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.
Files changed (253) hide show
  1. package/lib/application.d.ts +355 -195
  2. package/lib/application.js +188 -682
  3. package/lib/application.js.map +1 -1
  4. package/lib/application.spec.js +109 -289
  5. package/lib/application.spec.js.map +1 -1
  6. package/lib/core.d.ts +150 -215
  7. package/lib/core.js +188 -71
  8. package/lib/core.js.map +1 -1
  9. package/lib/core.spec.js +103 -42
  10. package/lib/core.spec.js.map +1 -1
  11. package/lib/index.d.ts +4 -0
  12. package/lib/index.js +9 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib/models/aclmodel.d.ts +3 -1
  15. package/lib/models/aclmodel.js +6 -3
  16. package/lib/models/aclmodel.js.map +1 -1
  17. package/lib/models/aclmodel.spec.js +10 -5
  18. package/lib/models/aclmodel.spec.js.map +1 -1
  19. package/lib/models/coremodel.d.ts +86 -24
  20. package/lib/models/coremodel.js +85 -36
  21. package/lib/models/coremodel.js.map +1 -1
  22. package/lib/models/coremodel.spec.js +21 -2
  23. package/lib/models/coremodel.spec.js.map +1 -1
  24. package/lib/models/ident.d.ts +7 -5
  25. package/lib/models/ident.js +2 -1
  26. package/lib/models/ident.js.map +1 -1
  27. package/lib/models/ident.spec.js +1 -1
  28. package/lib/models/ident.spec.js.map +1 -1
  29. package/lib/models/ownermodel.d.ts +18 -4
  30. package/lib/models/ownermodel.js +24 -4
  31. package/lib/models/ownermodel.js.map +1 -1
  32. package/lib/models/ownermodel.spec.js +18 -1
  33. package/lib/models/ownermodel.spec.js.map +1 -1
  34. package/lib/models/rolemodel.js.map +1 -1
  35. package/lib/models/rolemodel.spec.js +5 -2
  36. package/lib/models/rolemodel.spec.js.map +1 -1
  37. package/lib/models/user.d.ts +7 -6
  38. package/lib/models/user.js +2 -1
  39. package/lib/models/user.js.map +1 -1
  40. package/lib/models/user.spec.js +1 -1
  41. package/lib/models/user.spec.js.map +1 -1
  42. package/lib/queues/filequeue.d.ts +2 -7
  43. package/lib/queues/filequeue.js +4 -13
  44. package/lib/queues/filequeue.js.map +1 -1
  45. package/lib/queues/filequeue.spec.js +2 -3
  46. package/lib/queues/filequeue.spec.js.map +1 -1
  47. package/lib/queues/memoryqueue.d.ts +2 -7
  48. package/lib/queues/memoryqueue.js +1 -11
  49. package/lib/queues/memoryqueue.js.map +1 -1
  50. package/lib/queues/memoryqueue.spec.js +1 -1
  51. package/lib/queues/memoryqueue.spec.js.map +1 -1
  52. package/lib/queues/queue.spec.d.ts +1 -1
  53. package/lib/queues/queue.spec.js +12 -10
  54. package/lib/queues/queue.spec.js.map +1 -1
  55. package/lib/queues/queueservice.d.ts +1 -1
  56. package/lib/queues/queueservice.js +1 -1
  57. package/lib/queues/queueservice.js.map +1 -1
  58. package/lib/router.d.ts +52 -2
  59. package/lib/router.js +80 -51
  60. package/lib/router.js.map +1 -1
  61. package/lib/router.spec.js +23 -6
  62. package/lib/router.spec.js.map +1 -1
  63. package/lib/services/asyncevents.d.ts +1 -0
  64. package/lib/services/asyncevents.js +4 -3
  65. package/lib/services/asyncevents.js.map +1 -1
  66. package/lib/services/asyncevents.spec.js +2 -2
  67. package/lib/services/asyncevents.spec.js.map +1 -1
  68. package/lib/services/authentication.d.ts +39 -11
  69. package/lib/services/authentication.js +60 -55
  70. package/lib/services/authentication.js.map +1 -1
  71. package/lib/services/authentication.spec.js +2 -1
  72. package/lib/services/authentication.spec.js.map +1 -1
  73. package/lib/services/binary.d.ts +127 -65
  74. package/lib/services/binary.js +255 -98
  75. package/lib/services/binary.js.map +1 -1
  76. package/lib/services/binary.spec.d.ts +2 -1
  77. package/lib/services/binary.spec.js +101 -30
  78. package/lib/services/binary.spec.js.map +1 -1
  79. package/lib/services/cloudbinary.d.ts +67 -0
  80. package/lib/services/cloudbinary.js +178 -0
  81. package/lib/services/cloudbinary.js.map +1 -0
  82. package/lib/services/cloudbinary.spec.d.ts +13 -0
  83. package/lib/services/cloudbinary.spec.js +212 -0
  84. package/lib/services/cloudbinary.spec.js.map +1 -0
  85. package/lib/services/configuration.d.ts +7 -2
  86. package/lib/services/configuration.js +6 -5
  87. package/lib/services/configuration.js.map +1 -1
  88. package/lib/services/configuration.spec.js +3 -2
  89. package/lib/services/configuration.spec.js.map +1 -1
  90. package/lib/services/cron.d.ts +5 -6
  91. package/lib/services/cron.js +5 -12
  92. package/lib/services/cron.js.map +1 -1
  93. package/lib/services/cron.spec.js +3 -4
  94. package/lib/services/cron.spec.js.map +1 -1
  95. package/lib/services/debugmailer.d.ts +3 -5
  96. package/lib/services/debugmailer.js +3 -11
  97. package/lib/services/debugmailer.js.map +1 -1
  98. package/lib/services/debugmailer.spec.js +1 -1
  99. package/lib/services/debugmailer.spec.js.map +1 -1
  100. package/lib/services/echo.d.ts +3 -7
  101. package/lib/services/echo.js +1 -11
  102. package/lib/services/echo.js.map +1 -1
  103. package/lib/services/echo.spec.js +4 -3
  104. package/lib/services/echo.spec.js.map +1 -1
  105. package/lib/services/filebinary.d.ts +45 -16
  106. package/lib/services/filebinary.js +147 -50
  107. package/lib/services/filebinary.js.map +1 -1
  108. package/lib/services/filebinary.spec.d.ts +4 -2
  109. package/lib/services/filebinary.spec.js +50 -12
  110. package/lib/services/filebinary.spec.js.map +1 -1
  111. package/lib/services/fileconfiguration.d.ts +1 -5
  112. package/lib/services/fileconfiguration.js +3 -12
  113. package/lib/services/fileconfiguration.js.map +1 -1
  114. package/lib/services/fileconfiguration.spec.js +2 -2
  115. package/lib/services/fileconfiguration.spec.js.map +1 -1
  116. package/lib/services/invitationservice.d.ts +28 -4
  117. package/lib/services/invitationservice.js +9 -6
  118. package/lib/services/invitationservice.js.map +1 -1
  119. package/lib/services/invitationservice.spec.js +4 -3
  120. package/lib/services/invitationservice.spec.js.map +1 -1
  121. package/lib/services/kubernetesconfiguration.d.ts +3 -5
  122. package/lib/services/kubernetesconfiguration.js +7 -14
  123. package/lib/services/kubernetesconfiguration.js.map +1 -1
  124. package/lib/services/kubernetesconfiguration.spec.js +5 -5
  125. package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
  126. package/lib/services/mailer.d.ts +1 -5
  127. package/lib/services/mailer.js +1 -10
  128. package/lib/services/mailer.js.map +1 -1
  129. package/lib/services/mailer.spec.js +3 -3
  130. package/lib/services/mailer.spec.js.map +1 -1
  131. package/lib/services/notificationservice.d.ts +2 -0
  132. package/lib/services/notificationservice.js +2 -0
  133. package/lib/services/notificationservice.js.map +1 -1
  134. package/lib/services/notificationservice.spec.js +2 -2
  135. package/lib/services/notificationservice.spec.js.map +1 -1
  136. package/lib/services/oauth.d.ts +8 -6
  137. package/lib/services/oauth.js +30 -14
  138. package/lib/services/oauth.js.map +1 -1
  139. package/lib/services/oauth.spec.js +11 -10
  140. package/lib/services/oauth.spec.js.map +1 -1
  141. package/lib/services/resource.d.ts +18 -5
  142. package/lib/services/resource.js +42 -23
  143. package/lib/services/resource.js.map +1 -1
  144. package/lib/services/resource.spec.js +4 -4
  145. package/lib/services/resource.spec.js.map +1 -1
  146. package/lib/services/service.d.ts +25 -25
  147. package/lib/services/service.js +21 -25
  148. package/lib/services/service.js.map +1 -1
  149. package/lib/services/service.spec.js +2 -2
  150. package/lib/services/service.spec.js.map +1 -1
  151. package/lib/services/version.d.ts +2 -5
  152. package/lib/services/version.js +1 -10
  153. package/lib/services/version.js.map +1 -1
  154. package/lib/services/version.spec.js +1 -1
  155. package/lib/services/version.spec.js.map +1 -1
  156. package/lib/stores/aggregator.d.ts +3 -5
  157. package/lib/stores/aggregator.js +3 -10
  158. package/lib/stores/aggregator.js.map +1 -1
  159. package/lib/stores/file.d.ts +15 -8
  160. package/lib/stores/file.js +21 -18
  161. package/lib/stores/file.js.map +1 -1
  162. package/lib/stores/file.spec.d.ts +3 -1
  163. package/lib/stores/file.spec.js +32 -8
  164. package/lib/stores/file.spec.js.map +1 -1
  165. package/lib/stores/mapper.d.ts +1 -5
  166. package/lib/stores/mapper.js +5 -13
  167. package/lib/stores/mapper.js.map +1 -1
  168. package/lib/stores/mapper.spec.js +2 -2
  169. package/lib/stores/mapper.spec.js.map +1 -1
  170. package/lib/stores/memory.d.ts +5 -9
  171. package/lib/stores/memory.js +5 -17
  172. package/lib/stores/memory.js.map +1 -1
  173. package/lib/stores/memory.spec.d.ts +2 -1
  174. package/lib/stores/memory.spec.js +36 -4
  175. package/lib/stores/memory.spec.js.map +1 -1
  176. package/lib/stores/store.d.ts +142 -29
  177. package/lib/stores/store.js +451 -82
  178. package/lib/stores/store.js.map +1 -1
  179. package/lib/stores/store.spec.d.ts +31 -4
  180. package/lib/stores/store.spec.js +206 -35
  181. package/lib/stores/store.spec.js.map +1 -1
  182. package/lib/stores/webdaql/WebdaQLLexer.d.ts +53 -0
  183. package/lib/stores/webdaql/WebdaQLLexer.js +290 -0
  184. package/lib/stores/webdaql/WebdaQLLexer.js.map +1 -0
  185. package/lib/stores/webdaql/WebdaQLParserLexer.d.ts +53 -0
  186. package/lib/stores/webdaql/WebdaQLParserLexer.js +290 -0
  187. package/lib/stores/webdaql/WebdaQLParserLexer.js.map +1 -0
  188. package/lib/stores/webdaql/WebdaQLParserListener.d.ts +284 -0
  189. package/lib/stores/webdaql/WebdaQLParserListener.js +4 -0
  190. package/lib/stores/webdaql/WebdaQLParserListener.js.map +1 -0
  191. package/lib/stores/webdaql/WebdaQLParserParser.d.ts +301 -0
  192. package/lib/stores/webdaql/WebdaQLParserParser.js +1781 -0
  193. package/lib/stores/webdaql/WebdaQLParserParser.js.map +1 -0
  194. package/lib/stores/webdaql/WebdaQLParserVisitor.d.ts +174 -0
  195. package/lib/stores/webdaql/WebdaQLParserVisitor.js +4 -0
  196. package/lib/stores/webdaql/WebdaQLParserVisitor.js.map +1 -0
  197. package/lib/stores/webdaql/query.d.ts +300 -0
  198. package/lib/stores/webdaql/query.js +471 -0
  199. package/lib/stores/webdaql/query.js.map +1 -0
  200. package/lib/stores/webdaql/query.spec.d.ts +1 -0
  201. package/lib/stores/webdaql/query.spec.js +136 -0
  202. package/lib/stores/webdaql/query.spec.js.map +1 -0
  203. package/lib/test.d.ts +54 -9
  204. package/lib/test.js +139 -25
  205. package/lib/test.js.map +1 -1
  206. package/lib/unpackedapplication.d.ts +66 -0
  207. package/lib/unpackedapplication.js +219 -0
  208. package/lib/unpackedapplication.js.map +1 -0
  209. package/lib/utils/abstractdeployer.spec.js +1 -1
  210. package/lib/utils/abstractdeployer.spec.js.map +1 -1
  211. package/lib/utils/context.d.ts +17 -58
  212. package/lib/utils/context.js +33 -124
  213. package/lib/utils/context.js.map +1 -1
  214. package/lib/utils/context.spec.js +52 -28
  215. package/lib/utils/context.spec.js.map +1 -1
  216. package/lib/utils/cookie.d.ts +6 -3
  217. package/lib/utils/cookie.js +9 -5
  218. package/lib/utils/cookie.js.map +1 -1
  219. package/lib/utils/cookie.spec.js +5 -5
  220. package/lib/utils/cookie.spec.js.map +1 -1
  221. package/lib/utils/httpcontext.d.ts +182 -0
  222. package/lib/utils/httpcontext.js +325 -0
  223. package/lib/utils/httpcontext.js.map +1 -0
  224. package/lib/utils/httpcontext.spec.d.ts +5 -0
  225. package/lib/utils/httpcontext.spec.js +90 -0
  226. package/lib/utils/httpcontext.spec.js.map +1 -0
  227. package/lib/utils/logger.d.ts +18 -5
  228. package/lib/utils/logger.js +17 -4
  229. package/lib/utils/logger.js.map +1 -1
  230. package/lib/utils/logger.spec.js.map +1 -1
  231. package/lib/utils/serializers.js +5 -1
  232. package/lib/utils/serializers.js.map +1 -1
  233. package/lib/utils/serializers.spec.js +3 -3
  234. package/lib/utils/serializers.spec.js.map +1 -1
  235. package/lib/utils/waiter.d.ts +1 -1
  236. package/lib/utils/waiter.js.map +1 -1
  237. package/lib/utils/waiter.spec.js +2 -2
  238. package/lib/utils/waiter.spec.js.map +1 -1
  239. package/package.json +25 -18
  240. package/test/config-file-no-reload.json +2 -1
  241. package/test/config-file-reload.json +2 -1
  242. package/test/config-kube-reload.json +2 -1
  243. package/test/config-reload.json +1 -1
  244. package/test/config.json +8 -11
  245. package/test/config.old.json +1 -1
  246. package/test/moddas/annotatedservice.js +1 -3
  247. package/test/moddas/debugmailer.js +2 -7
  248. package/test/moddas/fakeservice.js +1 -1
  249. package/test/moddas/voidstore.js +2 -4
  250. package/test/models/ident.js +1 -1
  251. package/test/models/task.js +1 -6
  252. package/webda.module.json +1124 -0
  253. package/test/config.old-default.json +0 -151
@@ -1,7 +1,237 @@
1
- import { CachedModule, Configuration, ConfigurationV1, Context, Core, CoreModelDefinition, Module, Service } from "./index";
2
- import { Deployment } from "./models/deployment";
3
1
  import { WorkerLogLevel, WorkerOutput } from "@webda/workout";
4
- import { JSONSchema6 } from "json-schema";
2
+ import { JSONSchema7 } from "json-schema";
3
+ import { OpenAPIV3 } from "openapi-types";
4
+ import { Context, Core, CoreModelDefinition, Service } from "./index";
5
+ export declare type PackageDescriptorAuthor = string | {
6
+ name?: string;
7
+ email?: string;
8
+ url?: string;
9
+ };
10
+ export declare type Modda = ServiceConstructor<Service>;
11
+ /**
12
+ * Some package exists but seems pretty big for this
13
+ * https://classic.yarnpkg.com/en/docs/package-json
14
+ */
15
+ export interface PackageDescriptor {
16
+ name?: string;
17
+ version?: string;
18
+ description?: string;
19
+ keywords?: string[];
20
+ license?: string | {
21
+ name: string;
22
+ };
23
+ homepage?: string;
24
+ bugs?: string;
25
+ repository?: string;
26
+ author?: PackageDescriptorAuthor;
27
+ contributors?: string[] | PackageDescriptorAuthor[];
28
+ files?: string[];
29
+ main?: string;
30
+ bin?: string | {
31
+ [key: string]: string;
32
+ };
33
+ man?: string | string[];
34
+ directories?: {
35
+ [key: string]: string;
36
+ };
37
+ scripts?: {
38
+ [key: string]: string;
39
+ };
40
+ config?: any;
41
+ dependencies?: {
42
+ [key: string]: string;
43
+ };
44
+ devDependencies?: {
45
+ [key: string]: string;
46
+ };
47
+ peerDependencies?: {
48
+ [key: string]: string;
49
+ };
50
+ peerDependenciesMeta?: {
51
+ [key: string]: {
52
+ optional: boolean;
53
+ };
54
+ };
55
+ optionalDependencies?: {
56
+ [key: string]: string;
57
+ };
58
+ bundledDependencies?: string[];
59
+ flat?: boolean;
60
+ resolutions?: {
61
+ [key: string]: string;
62
+ };
63
+ engines?: {
64
+ [key: string]: string;
65
+ };
66
+ os?: string[];
67
+ cpu?: string[];
68
+ private?: boolean;
69
+ publishConfig?: any;
70
+ webda?: Partial<WebdaPackageDescriptor>;
71
+ termsOfService?: string;
72
+ title?: string;
73
+ }
74
+ /**
75
+ * A Webda module is a NPM package
76
+ *
77
+ * It contains one or more Modda to provide features
78
+ */
79
+ export interface Module {
80
+ /**
81
+ * Services provided by the module
82
+ */
83
+ moddas?: {
84
+ [key: string]: string;
85
+ };
86
+ /**
87
+ * Models provided by the module
88
+ */
89
+ models?: {
90
+ [key: string]: string;
91
+ };
92
+ /**
93
+ * Deployers provided by the module
94
+ *
95
+ * @link Deployer
96
+ */
97
+ deployers?: {
98
+ [key: string]: string;
99
+ };
100
+ /**
101
+ * Schemas for services, deployers and coremodel
102
+ */
103
+ schemas?: {
104
+ [key: string]: JSONSchema7;
105
+ };
106
+ /**
107
+ * Application beans
108
+ */
109
+ beans?: {
110
+ [key: string]: string;
111
+ };
112
+ }
113
+ /**
114
+ * Cached module is all modules discover plus local package including the sources list
115
+ */
116
+ export interface CachedModule extends Module {
117
+ /**
118
+ * Contained dynamic information on the project
119
+ * Statically capture on deployment
120
+ */
121
+ project: ProjectInformation;
122
+ }
123
+ export declare type StaticWebsite = {
124
+ url: string;
125
+ path?: string;
126
+ index?: string;
127
+ catchAll?: boolean;
128
+ };
129
+ export declare type UnpackedConfiguration = {
130
+ version: 3;
131
+ /**
132
+ * Services configuration
133
+ */
134
+ services?: any;
135
+ /**
136
+ * Global parameters
137
+ */
138
+ parameters?: {
139
+ /**
140
+ * Trust this reverse proxies
141
+ */
142
+ trustedProxies?: string | string[];
143
+ /**
144
+ * Allowed origin for referer that match
145
+ * any of this regexp
146
+ *
147
+ * {@link OriginFilter}
148
+ */
149
+ csrfOrigins?: string[];
150
+ /**
151
+ * Allow you to authorize one or several websites
152
+ * If you use "*" then the API is open to direct call and any origins
153
+ * You can also serve one static website by having a
154
+ *
155
+ * {@link WebsiteOriginFilter}
156
+ */
157
+ website?: string | string[];
158
+ /**
159
+ * Serve statically a website
160
+ */
161
+ static?: StaticWebsite;
162
+ /**
163
+ * Cookie configuration for session
164
+ */
165
+ cookie?: {
166
+ sameSite: "None" | "Strict" | "Lax";
167
+ domain: string;
168
+ /**
169
+ * @minimum 1
170
+ */
171
+ maxAge: number;
172
+ path: string;
173
+ };
174
+ /**
175
+ * Read from the configuration service before init
176
+ */
177
+ configurationService?: string;
178
+ /**
179
+ * Application salt
180
+ */
181
+ salt?: string;
182
+ /**
183
+ * Define the api url
184
+ */
185
+ apiUrl?: string;
186
+ /**
187
+ * Define the model to use for Context
188
+ *
189
+ * @default Context
190
+ */
191
+ contextModel?: string;
192
+ /**
193
+ * Will not try to parse request bigger than this
194
+ *
195
+ * This parameter can be overriden by a direct call to
196
+ * getHttpContext().getRawBody(xxx)
197
+ *
198
+ * @default 10Mb
199
+ */
200
+ requestLimit?: number;
201
+ /**
202
+ * Will not take more than this to read a request (unit: milliseconds)
203
+ *
204
+ * This parameter can be overriden by a direct call to
205
+ * getHttpContext().getRawBody(undefined, xxx)
206
+ *
207
+ * @default 60000
208
+ */
209
+ requestTimeout?: number;
210
+ /**
211
+ * Allow any other type of parameters
212
+ */
213
+ [key: string]: any;
214
+ };
215
+ /**
216
+ * OpenAPI override
217
+ */
218
+ openapi?: Partial<OpenAPIV3.Document>;
219
+ /**
220
+ * Include other configuration.json
221
+ *
222
+ * This allow you so share Store definition or parameters between different components
223
+ * The configuration is merged with `deepmerge(...imports, local)`
224
+ */
225
+ imports?: string[];
226
+ };
227
+ export declare type Configuration = UnpackedConfiguration & {
228
+ /**
229
+ * Cached modules to avoid scanning node_modules
230
+ * This is used by packagers
231
+ */
232
+ cachedModules?: CachedModule;
233
+ };
234
+ export declare type StoredConfiguration = Configuration;
5
235
  /**
6
236
  * Return the gather information from the repository
7
237
  * @mermaid Make TypeDoc easy to use with mermaid.js
@@ -56,29 +286,66 @@ export interface GitInformation {
56
286
  */
57
287
  export interface ServiceConstructor<T extends Service> {
58
288
  new (webda: Core, name: string, params: any): T;
59
- getModda(): any;
60
- getSchema(): JSONSchema6;
289
+ }
290
+ export declare enum SectionEnum {
291
+ Moddas = "moddas",
292
+ Deployers = "deployers",
293
+ Models = "models",
294
+ Beans = "beans"
61
295
  }
62
296
  /**
63
- * Retrieve a JSONSchema from a webda object
64
- *
297
+ * Webda specific metadata for the project
65
298
  */
66
- export interface SchemaResolver {
67
- fromPrototype(type: any): JSONSchema6;
68
- fromServiceType(type: string): JSONSchema6;
299
+ export interface WebdaPackageDescriptor {
300
+ /**
301
+ * Webda namespace
302
+ */
303
+ namespace?: string;
304
+ /**
305
+ * Logo to display within the shell tty
306
+ */
307
+ logo?: string;
308
+ /**
309
+ * Information on the workspace
310
+ */
311
+ workspaces?: {
312
+ packages: string[];
313
+ parent: PackageDescriptor;
314
+ path: string;
315
+ };
316
+ [key: string]: any;
69
317
  }
70
318
  /**
71
- * Implement the default way of retrieving schema
319
+ * Information on the whole project
72
320
  */
73
- export declare class DefaultSchemaResolver implements SchemaResolver {
321
+ export interface ProjectInformation {
74
322
  /**
75
- * Application
323
+ * package.json information
76
324
  */
77
- protected app: Application;
78
- constructor(app: Application);
79
- fromServiceType(type?: string): JSONSchema6;
80
- fromPrototype(type: any): JSONSchema6;
325
+ package: PackageDescriptor;
326
+ /**
327
+ * Webda project information
328
+ *
329
+ * It is the aggregation of webda information contained in package
330
+ * and its workspace meta
331
+ */
332
+ webda: WebdaPackageDescriptor;
333
+ /**
334
+ * Git information gathered
335
+ */
336
+ git: GitInformation;
337
+ /**
338
+ * Deployment information
339
+ */
340
+ deployment: {
341
+ name: string;
342
+ [key: string]: any;
343
+ };
81
344
  }
345
+ /**
346
+ * Type of Section
347
+ */
348
+ export declare type Section = "moddas" | "deployers" | "models" | "beans";
82
349
  /**
83
350
  * Map a Webda Application
84
351
  *
@@ -96,7 +363,7 @@ export declare class Application {
96
363
  /**
97
364
  * Get Application root path
98
365
  */
99
- protected appPath: string;
366
+ readonly appPath: string;
100
367
  /**
101
368
  * Base configuration loaded from webda.config.json
102
369
  */
@@ -105,10 +372,6 @@ export declare class Application {
105
372
  * Current deployment
106
373
  */
107
374
  protected currentDeployment: string;
108
- /**
109
- * Contains all definitions from imported modules and current code
110
- */
111
- protected cachedModules: CachedModule;
112
375
  /**
113
376
  * Contains definitions of current application
114
377
  */
@@ -124,10 +387,10 @@ export declare class Application {
124
387
  [key: string]: any;
125
388
  };
126
389
  /**
127
- * Services type registry
390
+ * Moddas registry
128
391
  */
129
- protected services: {
130
- [key: string]: ServiceConstructor<Service>;
392
+ protected moddas: {
393
+ [key: string]: Modda;
131
394
  };
132
395
  /**
133
396
  * Models type registry
@@ -135,26 +398,10 @@ export declare class Application {
135
398
  protected models: {
136
399
  [key: string]: any;
137
400
  };
138
- /**
139
- * Flag if application has been compiled already
140
- */
141
- protected compiled: boolean;
142
401
  /**
143
402
  * Class Logger
144
403
  */
145
404
  protected logger: WorkerOutput;
146
- /**
147
- * Contains package.json of application
148
- */
149
- protected packageDescription: any;
150
- /**
151
- * Contains webda section of package.json and workspaces if exist
152
- */
153
- protected packageWebda: any;
154
- /**
155
- * Webda namespace
156
- */
157
- protected namespace: string;
158
405
  /**
159
406
  * Detect if running as workspace
160
407
  */
@@ -164,30 +411,47 @@ export declare class Application {
164
411
  */
165
412
  protected initTime: number;
166
413
  /**
167
- * Current Schema resolver
414
+ * Configuration file
415
+ */
416
+ readonly configurationFile: string;
417
+ /**
418
+ * Current deployment file
419
+ */
420
+ deploymentFile: string;
421
+ /**
422
+ * Current application
168
423
  */
169
- protected schemaResolver: SchemaResolver;
424
+ protected static active: Application;
170
425
  /**
171
426
  *
172
427
  * @param {string} fileOrFolder to load Webda Application from
173
428
  * @param {Logger} logger
174
429
  */
175
- constructor(file: string, logger?: WorkerOutput, allowModule?: boolean);
430
+ constructor(file: string, logger?: WorkerOutput);
431
+ /**
432
+ * Import all required modules
433
+ */
434
+ load(): Promise<this>;
176
435
  /**
436
+ * Allow subclass to implement migration
177
437
  *
178
- * @param proto Prototype to send
438
+ * @param file
439
+ * @returns
179
440
  */
180
- getFullNameFromPrototype(proto: any): string;
441
+ loadConfiguration(file: string): void;
181
442
  /**
182
- * Set the current schema resolver
183
443
  *
184
- * @param resolver
444
+ * @param proto Prototype to send
185
445
  */
186
- setSchemaResolver(resolver: SchemaResolver): void;
446
+ getFullNameFromPrototype(proto: any): string;
187
447
  /**
188
- * Get schema resolver
448
+ * Get a schema from a type
449
+ *
450
+ * Schema should be precomputed in the default app
451
+ * @param type
452
+ * @returns
189
453
  */
190
- getSchemaResolver(): SchemaResolver;
454
+ getSchema(type: string): JSONSchema7;
191
455
  /**
192
456
  * Check if application has cached modules
193
457
  *
@@ -196,40 +460,16 @@ export declare class Application {
196
460
  * take the schema from the cached modules also
197
461
  */
198
462
  isCached(): boolean;
199
- /**
200
- * Check package.json
201
- */
202
- loadPackageInfos(): void;
203
463
  /**
204
464
  * Retrieve specific webda conf from package.json
205
465
  *
206
466
  * In case of workspaces the object is combined
207
467
  */
208
- getPackageWebda(): any;
468
+ getPackageWebda(): WebdaPackageDescriptor;
209
469
  /**
210
470
  * Retrieve content of package.json
211
471
  */
212
- getPackageDescription(): any;
213
- /**
214
- * Set the status of the compilation
215
- *
216
- * @param compile true will avoid trigger new compilation
217
- */
218
- preventCompilation(compile: boolean): void;
219
- /**
220
- * Migrate from v0 to v1 configuration
221
- *
222
- * A V0 is a webda.config.json that does not contain any version tag
223
- *
224
- * @param config
225
- */
226
- migrateV0Config(config: any): Configuration;
227
- /**
228
- * Migrate from v1 to v2 configuration format
229
- *
230
- * @param config
231
- */
232
- migrateV1Config(config: ConfigurationV1): Configuration;
472
+ getPackageDescription(): PackageDescriptor;
233
473
  /**
234
474
  * Log information
235
475
  *
@@ -253,25 +493,38 @@ export declare class Application {
253
493
  * @param name
254
494
  * @param service
255
495
  */
256
- addService(name: string, service: ServiceConstructor<Service>): void;
496
+ addService(name: string, service: Modda): this;
497
+ /**
498
+ *
499
+ * @param section
500
+ * @param name
501
+ * @returns
502
+ */
503
+ getWebdaObject(section: Section, name: any): any;
257
504
  /**
258
505
  * Get a service based on name
259
506
  *
260
507
  * @param name
261
508
  */
262
- getService(name: any): ServiceConstructor<Service<import("./index").ServiceParameters>>;
509
+ getModda(name: any): Modda;
263
510
  /**
264
511
  * Return all services of the application
265
512
  */
266
- getServices(): {
267
- [key: string]: ServiceConstructor<Service<import("./index").ServiceParameters>>;
513
+ getModdas(): {
514
+ [key: string]: Modda;
515
+ };
516
+ /**
517
+ * Return all beans of the application
518
+ */
519
+ getBeans(): {
520
+ [key: string]: string;
268
521
  };
269
522
  /**
270
523
  * Retrieve the model implementation
271
524
  *
272
525
  * @param name model to retrieve
273
526
  */
274
- getModel(name: string): any;
527
+ getModel(name: string): Context | CoreModelDefinition;
275
528
  /**
276
529
  * Get all models definitions
277
530
  */
@@ -282,7 +535,7 @@ export declare class Application {
282
535
  * Return all deployers
283
536
  */
284
537
  getDeployers(): {
285
- [key: string]: ServiceConstructor<Service>;
538
+ [key: string]: Modda;
286
539
  };
287
540
  /**
288
541
  * Add a new model
@@ -290,22 +543,14 @@ export declare class Application {
290
543
  * @param name
291
544
  * @param model
292
545
  */
293
- addModel(name: string, model: any): void;
546
+ addModel(name: string, model: any): this;
294
547
  /**
295
548
  * Add a new deployer
296
549
  *
297
550
  * @param name
298
551
  * @param model
299
552
  */
300
- addDeployer(name: string, model: any): void;
301
- /**
302
- * Check if a deployment exists for this application
303
- * This method cannot be called for a packaged application
304
- * as we do not keep deployments files when deployed
305
- *
306
- * @param deploymentName
307
- */
308
- hasDeployment(deploymentName: string): boolean;
553
+ addDeployer(name: string, model: any): this;
309
554
  /**
310
555
  * Return webda current version
311
556
  *
@@ -313,14 +558,13 @@ export declare class Application {
313
558
  * @since 0.4.0
314
559
  */
315
560
  getWebdaVersion(): string;
316
- getDeployment(deploymentName?: string): Deployment;
317
561
  /**
318
562
  * Retrieve Git Repository information
319
563
  *
320
564
  * {@link GitInformation} for more details on how the information is gathered
321
565
  * @return the git information
322
566
  */
323
- getGitInformation(): GitInformation;
567
+ getGitInformation(_packageName?: string, _version?: string): GitInformation;
324
568
  /**
325
569
  * Allow variable inside of string
326
570
  *
@@ -366,67 +610,21 @@ export declare class Application {
366
610
  */
367
611
  replaceVariables(object: any, replacements?: any): any;
368
612
  /**
369
- * Return the application Configuration for a deployment
370
- *
371
- * Given this inputs:
372
- *
373
- * webda.config.json
374
- * ```json
375
- * {
376
- * "parameters": {
377
- * "param3": "test"
378
- * },
379
- * "services": {
380
- * "MyService": {
381
- * "param1": {
382
- * "sub": "test"
383
- * },
384
- * "param2": "value"
385
- * }
386
- * }
387
- * }
388
- * ```
389
- *
390
- * deployment.json
391
- * ```json
392
- * {
393
- * "parameters": {
394
- * "param4": "deployment"
395
- * }
396
- * "services": {
397
- * "MyService": {
398
- * "param1": {
399
- * "sub2": "deploymentSub"
400
- * },
401
- * "param2": "${package.version}"
402
- * }
403
- * }
404
- * }
405
- * ```
406
- *
407
- * The result would be:
408
- * ```json
409
- * {
410
- * "parameters": {
411
- * "param3": "test",
412
- * "param4": "deployment"
413
- * },
414
- * "services": {
415
- * "MyService": {
416
- * "param1": {
417
- * "sub": "test",
418
- * "sub2": "deploymentSub"
419
- * },
420
- * "param2": "1.1.0"
421
- * }
422
- * }
423
- * }
424
- * ```
425
- * This map can also use parameters {@link replaceVariables}
613
+ * Get current deployment name
614
+ */
615
+ getCurrentDeployment(): string;
616
+ /**
617
+ * Return all application modules merged as one
426
618
  *
427
- * @param deploymentName to use for the Configuration
619
+ * Used when deployed
620
+ * @returns
621
+ */
622
+ getModules(): CachedModule;
623
+ /**
624
+ * Get application configuration
625
+ * @returns
428
626
  */
429
- getConfiguration(deploymentName?: string): Configuration;
627
+ getConfiguration(_deployment?: string): Configuration;
430
628
  /**
431
629
  * Return current Configuration of the Application
432
630
  *
@@ -437,35 +635,6 @@ export declare class Application {
437
635
  * ```
438
636
  */
439
637
  getCurrentConfiguration(): Configuration;
440
- /**
441
- * Set the current deployment for the application
442
- * Call to getCurrentConfiguration will resolve to the computed configuration for the deployment
443
- * If needed, you can call the method with undefined to reset to default configuration
444
- *
445
- * @param deployment to set
446
- */
447
- setCurrentDeployment(deployment: string): void;
448
- /**
449
- * Get current deployment name
450
- */
451
- getCurrentDeployment(): string;
452
- /**
453
- * Compile the application if it is a Typescript application
454
- * Do nothing otherwise
455
- */
456
- compile(): void;
457
- /**
458
- * Load all imported modules and current module
459
- * It will compile module
460
- * Generate the current module file
461
- * Load any imported webda.module.json
462
- */
463
- loadModules(): void;
464
- getModules(): CachedModule;
465
- /**
466
- * Generate the module for current application
467
- */
468
- generateModule(): void;
469
638
  /**
470
639
  * Import a file
471
640
  *
@@ -473,18 +642,18 @@ export declare class Application {
473
642
  *
474
643
  * @param info
475
644
  */
476
- resolveRequire(info: string): any;
645
+ importFile(info: string): Promise<any>;
477
646
  /**
478
647
  * Load local module
479
648
  */
480
- loadLocalModule(): void;
649
+ loadLocalModule(): Promise<void>;
481
650
  /**
482
651
  * Load the module,
483
652
  *
484
653
  * @protected
485
654
  * @ignore Useless for documentation
486
655
  */
487
- loadModule(info: Module, parent?: string): void;
656
+ loadModule(module: Module, parent?: string): Promise<void>;
488
657
  /**
489
658
  * Return the full name including namespace
490
659
  *
@@ -502,13 +671,4 @@ export declare class Application {
502
671
  * @param className
503
672
  */
504
673
  extends(obj: any, className: any): boolean;
505
- /**
506
- * Load a javascript file and check for Modda
507
- * @param path to load
508
- */
509
- protected loadJavascriptFile(absolutePath: string): void;
510
- /**
511
- * Get the application files
512
- */
513
- getPackagesLocations(): string[];
514
674
  }