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

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 +351 -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 +108 -214
  7. package/lib/core.js +169 -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 +11 -18
  20. package/lib/models/coremodel.js +36 -36
  21. package/lib/models/coremodel.js.map +1 -1
  22. package/lib/models/coremodel.spec.js +2 -2
  23. package/lib/models/coremodel.spec.js.map +1 -1
  24. package/lib/models/ident.d.ts +3 -3
  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 +8 -4
  30. package/lib/models/ownermodel.js +9 -4
  31. package/lib/models/ownermodel.js.map +1 -1
  32. package/lib/models/ownermodel.spec.js +1 -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 +4 -3
  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 +48 -2
  59. package/lib/router.js +78 -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 +40 -16
  106. package/lib/services/filebinary.js +142 -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 +10 -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 +22 -25
  147. package/lib/services/service.js +16 -22
  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 +4 -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 +137 -26
  177. package/lib/stores/store.js +431 -75
  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 +49 -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 +157 -0
  222. package/lib/utils/httpcontext.js +279 -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 +82 -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,233 @@
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
+ * Allowed origin for referer that match
141
+ * any of this regexp
142
+ *
143
+ * {@link OriginFilter}
144
+ */
145
+ csrfOrigins?: string[];
146
+ /**
147
+ * Allow you to authorize one or several websites
148
+ * If you use "*" then the API is open to direct call and any origins
149
+ * You can also serve one static website by having a
150
+ *
151
+ * {@link WebsiteOriginFilter}
152
+ */
153
+ website?: string | string[];
154
+ /**
155
+ * Serve statically a website
156
+ */
157
+ static?: StaticWebsite;
158
+ /**
159
+ * Cookie configuration for session
160
+ */
161
+ cookie?: {
162
+ sameSite: "None" | "Strict" | "Lax";
163
+ domain: string;
164
+ /**
165
+ * @minimum 1
166
+ */
167
+ maxAge: number;
168
+ path: string;
169
+ };
170
+ /**
171
+ * Read from the configuration service before init
172
+ */
173
+ configurationService?: string;
174
+ /**
175
+ * Application salt
176
+ */
177
+ salt?: string;
178
+ /**
179
+ * Define the api url
180
+ */
181
+ apiUrl?: string;
182
+ /**
183
+ * Define the model to use for Context
184
+ *
185
+ * @default Context
186
+ */
187
+ contextModel?: string;
188
+ /**
189
+ * Will not try to parse request bigger than this
190
+ *
191
+ * This parameter can be overriden by a direct call to
192
+ * getHttpContext().getRawBody(xxx)
193
+ *
194
+ * @default 10Mb
195
+ */
196
+ requestLimit?: number;
197
+ /**
198
+ * Will not take more than this to read a request (unit: milliseconds)
199
+ *
200
+ * This parameter can be overriden by a direct call to
201
+ * getHttpContext().getRawBody(undefined, xxx)
202
+ *
203
+ * @default 60000
204
+ */
205
+ requestTimeout?: number;
206
+ /**
207
+ * Allow any other type of parameters
208
+ */
209
+ [key: string]: any;
210
+ };
211
+ /**
212
+ * OpenAPI override
213
+ */
214
+ openapi?: Partial<OpenAPIV3.Document>;
215
+ /**
216
+ * Include other configuration.json
217
+ *
218
+ * This allow you so share Store definition or parameters between different components
219
+ * The configuration is merged with `deepmerge(...imports, local)`
220
+ */
221
+ imports?: string[];
222
+ };
223
+ export declare type Configuration = UnpackedConfiguration & {
224
+ /**
225
+ * Cached modules to avoid scanning node_modules
226
+ * This is used by packagers
227
+ */
228
+ cachedModules?: CachedModule;
229
+ };
230
+ export declare type StoredConfiguration = Configuration;
5
231
  /**
6
232
  * Return the gather information from the repository
7
233
  * @mermaid Make TypeDoc easy to use with mermaid.js
@@ -56,29 +282,66 @@ export interface GitInformation {
56
282
  */
57
283
  export interface ServiceConstructor<T extends Service> {
58
284
  new (webda: Core, name: string, params: any): T;
59
- getModda(): any;
60
- getSchema(): JSONSchema6;
285
+ }
286
+ export declare enum SectionEnum {
287
+ Moddas = "moddas",
288
+ Deployers = "deployers",
289
+ Models = "models",
290
+ Beans = "beans"
61
291
  }
62
292
  /**
63
- * Retrieve a JSONSchema from a webda object
64
- *
293
+ * Webda specific metadata for the project
65
294
  */
66
- export interface SchemaResolver {
67
- fromPrototype(type: any): JSONSchema6;
68
- fromServiceType(type: string): JSONSchema6;
295
+ export interface WebdaPackageDescriptor {
296
+ /**
297
+ * Webda namespace
298
+ */
299
+ namespace?: string;
300
+ /**
301
+ * Logo to display within the shell tty
302
+ */
303
+ logo?: string;
304
+ /**
305
+ * Information on the workspace
306
+ */
307
+ workspaces?: {
308
+ packages: string[];
309
+ parent: PackageDescriptor;
310
+ path: string;
311
+ };
312
+ [key: string]: any;
69
313
  }
70
314
  /**
71
- * Implement the default way of retrieving schema
315
+ * Information on the whole project
72
316
  */
73
- export declare class DefaultSchemaResolver implements SchemaResolver {
317
+ export interface ProjectInformation {
74
318
  /**
75
- * Application
319
+ * package.json information
76
320
  */
77
- protected app: Application;
78
- constructor(app: Application);
79
- fromServiceType(type?: string): JSONSchema6;
80
- fromPrototype(type: any): JSONSchema6;
321
+ package: PackageDescriptor;
322
+ /**
323
+ * Webda project information
324
+ *
325
+ * It is the aggregation of webda information contained in package
326
+ * and its workspace meta
327
+ */
328
+ webda: WebdaPackageDescriptor;
329
+ /**
330
+ * Git information gathered
331
+ */
332
+ git: GitInformation;
333
+ /**
334
+ * Deployment information
335
+ */
336
+ deployment: {
337
+ name: string;
338
+ [key: string]: any;
339
+ };
81
340
  }
341
+ /**
342
+ * Type of Section
343
+ */
344
+ export declare type Section = "moddas" | "deployers" | "models" | "beans";
82
345
  /**
83
346
  * Map a Webda Application
84
347
  *
@@ -96,7 +359,7 @@ export declare class Application {
96
359
  /**
97
360
  * Get Application root path
98
361
  */
99
- protected appPath: string;
362
+ readonly appPath: string;
100
363
  /**
101
364
  * Base configuration loaded from webda.config.json
102
365
  */
@@ -105,10 +368,6 @@ export declare class Application {
105
368
  * Current deployment
106
369
  */
107
370
  protected currentDeployment: string;
108
- /**
109
- * Contains all definitions from imported modules and current code
110
- */
111
- protected cachedModules: CachedModule;
112
371
  /**
113
372
  * Contains definitions of current application
114
373
  */
@@ -124,10 +383,10 @@ export declare class Application {
124
383
  [key: string]: any;
125
384
  };
126
385
  /**
127
- * Services type registry
386
+ * Moddas registry
128
387
  */
129
- protected services: {
130
- [key: string]: ServiceConstructor<Service>;
388
+ protected moddas: {
389
+ [key: string]: Modda;
131
390
  };
132
391
  /**
133
392
  * Models type registry
@@ -135,26 +394,10 @@ export declare class Application {
135
394
  protected models: {
136
395
  [key: string]: any;
137
396
  };
138
- /**
139
- * Flag if application has been compiled already
140
- */
141
- protected compiled: boolean;
142
397
  /**
143
398
  * Class Logger
144
399
  */
145
400
  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
401
  /**
159
402
  * Detect if running as workspace
160
403
  */
@@ -164,30 +407,47 @@ export declare class Application {
164
407
  */
165
408
  protected initTime: number;
166
409
  /**
167
- * Current Schema resolver
410
+ * Configuration file
411
+ */
412
+ readonly configurationFile: string;
413
+ /**
414
+ * Current deployment file
415
+ */
416
+ deploymentFile: string;
417
+ /**
418
+ * Current application
168
419
  */
169
- protected schemaResolver: SchemaResolver;
420
+ protected static active: Application;
170
421
  /**
171
422
  *
172
423
  * @param {string} fileOrFolder to load Webda Application from
173
424
  * @param {Logger} logger
174
425
  */
175
- constructor(file: string, logger?: WorkerOutput, allowModule?: boolean);
426
+ constructor(file: string, logger?: WorkerOutput);
427
+ /**
428
+ * Import all required modules
429
+ */
430
+ load(): Promise<this>;
176
431
  /**
432
+ * Allow subclass to implement migration
177
433
  *
178
- * @param proto Prototype to send
434
+ * @param file
435
+ * @returns
179
436
  */
180
- getFullNameFromPrototype(proto: any): string;
437
+ loadConfiguration(file: string): void;
181
438
  /**
182
- * Set the current schema resolver
183
439
  *
184
- * @param resolver
440
+ * @param proto Prototype to send
185
441
  */
186
- setSchemaResolver(resolver: SchemaResolver): void;
442
+ getFullNameFromPrototype(proto: any): string;
187
443
  /**
188
- * Get schema resolver
444
+ * Get a schema from a type
445
+ *
446
+ * Schema should be precomputed in the default app
447
+ * @param type
448
+ * @returns
189
449
  */
190
- getSchemaResolver(): SchemaResolver;
450
+ getSchema(type: string): JSONSchema7;
191
451
  /**
192
452
  * Check if application has cached modules
193
453
  *
@@ -196,40 +456,16 @@ export declare class Application {
196
456
  * take the schema from the cached modules also
197
457
  */
198
458
  isCached(): boolean;
199
- /**
200
- * Check package.json
201
- */
202
- loadPackageInfos(): void;
203
459
  /**
204
460
  * Retrieve specific webda conf from package.json
205
461
  *
206
462
  * In case of workspaces the object is combined
207
463
  */
208
- getPackageWebda(): any;
464
+ getPackageWebda(): WebdaPackageDescriptor;
209
465
  /**
210
466
  * Retrieve content of package.json
211
467
  */
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;
468
+ getPackageDescription(): PackageDescriptor;
233
469
  /**
234
470
  * Log information
235
471
  *
@@ -253,25 +489,38 @@ export declare class Application {
253
489
  * @param name
254
490
  * @param service
255
491
  */
256
- addService(name: string, service: ServiceConstructor<Service>): void;
492
+ addService(name: string, service: Modda): this;
493
+ /**
494
+ *
495
+ * @param section
496
+ * @param name
497
+ * @returns
498
+ */
499
+ getWebdaObject(section: Section, name: any): any;
257
500
  /**
258
501
  * Get a service based on name
259
502
  *
260
503
  * @param name
261
504
  */
262
- getService(name: any): ServiceConstructor<Service<import("./index").ServiceParameters>>;
505
+ getModda(name: any): Modda;
263
506
  /**
264
507
  * Return all services of the application
265
508
  */
266
- getServices(): {
267
- [key: string]: ServiceConstructor<Service<import("./index").ServiceParameters>>;
509
+ getModdas(): {
510
+ [key: string]: Modda;
511
+ };
512
+ /**
513
+ * Return all beans of the application
514
+ */
515
+ getBeans(): {
516
+ [key: string]: string;
268
517
  };
269
518
  /**
270
519
  * Retrieve the model implementation
271
520
  *
272
521
  * @param name model to retrieve
273
522
  */
274
- getModel(name: string): any;
523
+ getModel(name: string): Context | CoreModelDefinition;
275
524
  /**
276
525
  * Get all models definitions
277
526
  */
@@ -282,7 +531,7 @@ export declare class Application {
282
531
  * Return all deployers
283
532
  */
284
533
  getDeployers(): {
285
- [key: string]: ServiceConstructor<Service>;
534
+ [key: string]: Modda;
286
535
  };
287
536
  /**
288
537
  * Add a new model
@@ -290,22 +539,14 @@ export declare class Application {
290
539
  * @param name
291
540
  * @param model
292
541
  */
293
- addModel(name: string, model: any): void;
542
+ addModel(name: string, model: any): this;
294
543
  /**
295
544
  * Add a new deployer
296
545
  *
297
546
  * @param name
298
547
  * @param model
299
548
  */
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;
549
+ addDeployer(name: string, model: any): this;
309
550
  /**
310
551
  * Return webda current version
311
552
  *
@@ -313,14 +554,13 @@ export declare class Application {
313
554
  * @since 0.4.0
314
555
  */
315
556
  getWebdaVersion(): string;
316
- getDeployment(deploymentName?: string): Deployment;
317
557
  /**
318
558
  * Retrieve Git Repository information
319
559
  *
320
560
  * {@link GitInformation} for more details on how the information is gathered
321
561
  * @return the git information
322
562
  */
323
- getGitInformation(): GitInformation;
563
+ getGitInformation(_packageName?: string, _version?: string): GitInformation;
324
564
  /**
325
565
  * Allow variable inside of string
326
566
  *
@@ -366,67 +606,21 @@ export declare class Application {
366
606
  */
367
607
  replaceVariables(object: any, replacements?: any): any;
368
608
  /**
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}
609
+ * Get current deployment name
610
+ */
611
+ getCurrentDeployment(): string;
612
+ /**
613
+ * Return all application modules merged as one
426
614
  *
427
- * @param deploymentName to use for the Configuration
615
+ * Used when deployed
616
+ * @returns
617
+ */
618
+ getModules(): CachedModule;
619
+ /**
620
+ * Get application configuration
621
+ * @returns
428
622
  */
429
- getConfiguration(deploymentName?: string): Configuration;
623
+ getConfiguration(_deployment?: string): Configuration;
430
624
  /**
431
625
  * Return current Configuration of the Application
432
626
  *
@@ -437,35 +631,6 @@ export declare class Application {
437
631
  * ```
438
632
  */
439
633
  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
634
  /**
470
635
  * Import a file
471
636
  *
@@ -473,18 +638,18 @@ export declare class Application {
473
638
  *
474
639
  * @param info
475
640
  */
476
- resolveRequire(info: string): any;
641
+ importFile(info: string): Promise<any>;
477
642
  /**
478
643
  * Load local module
479
644
  */
480
- loadLocalModule(): void;
645
+ loadLocalModule(): Promise<void>;
481
646
  /**
482
647
  * Load the module,
483
648
  *
484
649
  * @protected
485
650
  * @ignore Useless for documentation
486
651
  */
487
- loadModule(info: Module, parent?: string): void;
652
+ loadModule(module: Module, parent?: string): Promise<void>;
488
653
  /**
489
654
  * Return the full name including namespace
490
655
  *
@@ -502,13 +667,4 @@ export declare class Application {
502
667
  * @param className
503
668
  */
504
669
  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
670
  }