@webda/compiler 4.0.0-beta.3
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/LICENSE +166 -0
- package/README.md +125 -0
- package/lib/compiler.d.ts +88 -0
- package/lib/compiler.d.ts.map +1 -0
- package/lib/compiler.js +230 -0
- package/lib/compiler.js.map +1 -0
- package/lib/configuration.d.ts +35 -0
- package/lib/configuration.d.ts.map +1 -0
- package/lib/configuration.js +170 -0
- package/lib/configuration.js.map +1 -0
- package/lib/definition.d.ts +787 -0
- package/lib/definition.d.ts.map +1 -0
- package/lib/definition.js +189 -0
- package/lib/definition.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/module.d.ts +36 -0
- package/lib/module.d.ts.map +1 -0
- package/lib/module.js +119 -0
- package/lib/module.js.map +1 -0
- package/lib/morpher/capabilities.d.ts +35 -0
- package/lib/morpher/capabilities.d.ts.map +1 -0
- package/lib/morpher/capabilities.js +66 -0
- package/lib/morpher/capabilities.js.map +1 -0
- package/lib/morpher/imports.d.ts +10 -0
- package/lib/morpher/imports.d.ts.map +1 -0
- package/lib/morpher/imports.js +97 -0
- package/lib/morpher/imports.js.map +1 -0
- package/lib/morpher/morpher.d.ts +34 -0
- package/lib/morpher/morpher.d.ts.map +1 -0
- package/lib/morpher/morpher.js +87 -0
- package/lib/morpher/morpher.js.map +1 -0
- package/lib/operations.d.ts +29 -0
- package/lib/operations.d.ts.map +1 -0
- package/lib/operations.js +197 -0
- package/lib/operations.js.map +1 -0
- package/lib/schema-backend.d.ts +55 -0
- package/lib/schema-backend.d.ts.map +1 -0
- package/lib/schema-backend.js +86 -0
- package/lib/schema-backend.js.map +1 -0
- package/lib/session-types.d.ts +14 -0
- package/lib/session-types.d.ts.map +1 -0
- package/lib/session-types.js +79 -0
- package/lib/session-types.js.map +1 -0
- package/lib/shell-build-dispatch.d.ts +54 -0
- package/lib/shell-build-dispatch.d.ts.map +1 -0
- package/lib/shell-build-dispatch.js +77 -0
- package/lib/shell-build-dispatch.js.map +1 -0
- package/lib/shell.d.ts +3 -0
- package/lib/shell.d.ts.map +1 -0
- package/lib/shell.js +297 -0
- package/lib/shell.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
import { WorkerLogLevel, WorkerOutput } from "@webda/workout";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
export type ModelGraphBinaryDefinition = {
|
|
4
|
+
attribute: string;
|
|
5
|
+
cardinality: "ONE" | "MANY";
|
|
6
|
+
metadata?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ModelGraphBehaviorDefinition = {
|
|
9
|
+
/** Property name on the parent model. */
|
|
10
|
+
attribute: string;
|
|
11
|
+
/** Identifier of the Behavior class (e.g. "Webda/MFA"). */
|
|
12
|
+
behavior: string;
|
|
13
|
+
};
|
|
14
|
+
export type ModelRelation = {
|
|
15
|
+
attribute: string;
|
|
16
|
+
model: string;
|
|
17
|
+
type: "LINK" | "LINKS_MAP" | "LINKS_ARRAY" | "LINKS_SIMPLE_ARRAY";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Defined relationship for one model
|
|
21
|
+
*/
|
|
22
|
+
export type ModelGraph = {
|
|
23
|
+
/**
|
|
24
|
+
* Model names of the parent of the parent, etc...
|
|
25
|
+
*/
|
|
26
|
+
ancestors?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* If the model has a parent
|
|
29
|
+
*/
|
|
30
|
+
parent?: Omit<ModelRelation, "type">;
|
|
31
|
+
/**
|
|
32
|
+
* This contains links to other models.
|
|
33
|
+
* These links are low cardinality as ids and
|
|
34
|
+
* their selected attributes are stored in the
|
|
35
|
+
* current model.
|
|
36
|
+
*/
|
|
37
|
+
links?: ModelRelation[];
|
|
38
|
+
/**
|
|
39
|
+
* Target other models with a new query
|
|
40
|
+
* This is usually our foreign keys
|
|
41
|
+
*
|
|
42
|
+
* This will generate queries for you:
|
|
43
|
+
* SELECT * FROM 'model' WHERE 'targetAttribute' = 'this[attribute]'
|
|
44
|
+
*/
|
|
45
|
+
queries?: {
|
|
46
|
+
/**
|
|
47
|
+
* Attribute in the model
|
|
48
|
+
*/
|
|
49
|
+
attribute: string;
|
|
50
|
+
/**
|
|
51
|
+
* Targeted model
|
|
52
|
+
*/
|
|
53
|
+
model: string;
|
|
54
|
+
/**
|
|
55
|
+
* Targeted model attribute
|
|
56
|
+
*/
|
|
57
|
+
targetAttribute: string;
|
|
58
|
+
}[];
|
|
59
|
+
/**
|
|
60
|
+
* Maps are deduplication of data in your model
|
|
61
|
+
* They are managed automatically by a service like `ModelMapper`
|
|
62
|
+
*
|
|
63
|
+
* They are useful in NoSQL environment like DynamoDB or Firebase
|
|
64
|
+
*/
|
|
65
|
+
maps?: {
|
|
66
|
+
/**
|
|
67
|
+
* Attribute in the model
|
|
68
|
+
*/
|
|
69
|
+
attribute: string;
|
|
70
|
+
/**
|
|
71
|
+
* Target model
|
|
72
|
+
*/
|
|
73
|
+
model: string;
|
|
74
|
+
/**
|
|
75
|
+
* Target model attributes to duplicate
|
|
76
|
+
*/
|
|
77
|
+
targetAttributes: string[];
|
|
78
|
+
targetLink: string;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
cascadeDelete: boolean;
|
|
83
|
+
}[];
|
|
84
|
+
/**
|
|
85
|
+
* References to every model that declare this model
|
|
86
|
+
* as a parent
|
|
87
|
+
*/
|
|
88
|
+
children?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* Binaries attribute, in the model you can declare
|
|
91
|
+
* attributes as Binary, so users can upload binaries that
|
|
92
|
+
* will be linked to this object with some metadata
|
|
93
|
+
*/
|
|
94
|
+
binaries?: ModelGraphBinaryDefinition[];
|
|
95
|
+
/**
|
|
96
|
+
* Behavior attributes — properties whose type is a class marked with
|
|
97
|
+
* `@Behavior()`. The Behavior class is referenced by Identifier so that
|
|
98
|
+
* the Behavior's actions can be looked up in the top-level `behaviors`
|
|
99
|
+
* map of the module.
|
|
100
|
+
*/
|
|
101
|
+
behaviors?: ModelGraphBehaviorDefinition[];
|
|
102
|
+
};
|
|
103
|
+
export interface ModelMetadata {
|
|
104
|
+
/**
|
|
105
|
+
* Model identifier
|
|
106
|
+
*/
|
|
107
|
+
Identifier: string;
|
|
108
|
+
/**
|
|
109
|
+
* File to import
|
|
110
|
+
*/
|
|
111
|
+
Import: string;
|
|
112
|
+
/**
|
|
113
|
+
* Specific plurals for a model
|
|
114
|
+
*/
|
|
115
|
+
Plural: string;
|
|
116
|
+
/**
|
|
117
|
+
* Schemas defining the model
|
|
118
|
+
*/
|
|
119
|
+
Schemas: {
|
|
120
|
+
/**
|
|
121
|
+
* Schema for input validation
|
|
122
|
+
*/
|
|
123
|
+
Input?: JSONSchema7;
|
|
124
|
+
/**
|
|
125
|
+
* Schema for output validation
|
|
126
|
+
*/
|
|
127
|
+
Output?: JSONSchema7;
|
|
128
|
+
/**
|
|
129
|
+
* Schema for stored data validation
|
|
130
|
+
*/
|
|
131
|
+
Stored?: JSONSchema7;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* If model have a short name
|
|
135
|
+
*/
|
|
136
|
+
ShortName?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Models graph
|
|
139
|
+
*
|
|
140
|
+
* Typescript does not have reflection, we therefore deduct the
|
|
141
|
+
* relations on compilation time and inject in the module
|
|
142
|
+
*
|
|
143
|
+
* The parent is define by a ModelParent type on the model
|
|
144
|
+
* The links are attribute of types ModelLink
|
|
145
|
+
*/
|
|
146
|
+
Relations: ModelGraph;
|
|
147
|
+
/**
|
|
148
|
+
* Ancestors of the model
|
|
149
|
+
*
|
|
150
|
+
* Ordered from the closest to the farest
|
|
151
|
+
* CoreModel is ignored
|
|
152
|
+
*
|
|
153
|
+
* class Test extends Parent extends GrandParent extends CoreModel
|
|
154
|
+
* ["Parent", "GrandParent"]
|
|
155
|
+
*/
|
|
156
|
+
Ancestors: string[];
|
|
157
|
+
/**
|
|
158
|
+
* Direct Subclasses of the model
|
|
159
|
+
*/
|
|
160
|
+
Subclasses: string[];
|
|
161
|
+
/**
|
|
162
|
+
* Return the primary key
|
|
163
|
+
*/
|
|
164
|
+
PrimaryKey: string[];
|
|
165
|
+
/**
|
|
166
|
+
* Separator for the primary key to serialize it
|
|
167
|
+
*/
|
|
168
|
+
PrimaryKeySeparator?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Return all events for the model
|
|
171
|
+
*/
|
|
172
|
+
Events: string[];
|
|
173
|
+
/**
|
|
174
|
+
* Fields reflection
|
|
175
|
+
*/
|
|
176
|
+
Reflection: {
|
|
177
|
+
[field: string]: {
|
|
178
|
+
type: string;
|
|
179
|
+
typeParameters?: string[];
|
|
180
|
+
required: boolean;
|
|
181
|
+
description?: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Actions defined for the model
|
|
186
|
+
*/
|
|
187
|
+
Actions: {
|
|
188
|
+
[action: string]: {
|
|
189
|
+
method?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Method implementing the action, when exposed under another name with `@Action({ name })`
|
|
192
|
+
*/
|
|
193
|
+
handler?: string;
|
|
194
|
+
path?: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
summary?: string;
|
|
197
|
+
/**
|
|
198
|
+
* If true, the action is global (static method) rather than per-instance
|
|
199
|
+
*/
|
|
200
|
+
global?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Behavior-only: per-action REST hint that overrides the default
|
|
203
|
+
* `{prefix}/{uuid}/{attribute}.{actionName}` PUT mapping.
|
|
204
|
+
*
|
|
205
|
+
* - `route === "."` → URL is the bare attribute path
|
|
206
|
+
* `{prefix}/{uuid}/{attribute}`.
|
|
207
|
+
* - `route === "<suffix>"` → URL is
|
|
208
|
+
* `{prefix}/{uuid}/{attribute}/<suffix>`. Path templates such as
|
|
209
|
+
* `"{hash}"` or `"{index}/{hash}"` are passed through unchanged so
|
|
210
|
+
* the router treats them as path variables.
|
|
211
|
+
* - `route === undefined` → URL falls back to the dot-notation default.
|
|
212
|
+
*
|
|
213
|
+
* `method` defaults to `"PUT"`.
|
|
214
|
+
*/
|
|
215
|
+
rest?: {
|
|
216
|
+
route?: string;
|
|
217
|
+
method?: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Compile-time metadata for a class marked with `@Behavior()`.
|
|
224
|
+
*/
|
|
225
|
+
export interface BehaviorMetadata {
|
|
226
|
+
/** Identifier of the Behavior (e.g. "Webda/MFA"). */
|
|
227
|
+
Identifier: string;
|
|
228
|
+
/** Module-relative path used at runtime to import the class. */
|
|
229
|
+
Import: string;
|
|
230
|
+
/**
|
|
231
|
+
* Behavior actions discovered from `@Action` / `@Operation` methods.
|
|
232
|
+
* Same shape as `ModelMetadata.Actions`.
|
|
233
|
+
*/
|
|
234
|
+
Actions: ModelMetadata["Actions"];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Definition of a single CLI argument for a {@link CommandDefinition}.
|
|
238
|
+
*
|
|
239
|
+
* Generated by the compiler from method parameter analysis:
|
|
240
|
+
* - `type` from TypeScript type annotation
|
|
241
|
+
* - `default` from parameter initializer
|
|
242
|
+
* - `required` when no default and no `?` modifier
|
|
243
|
+
* - `alias`, `description`, `deprecated` from JSDoc tags on the parameter
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```json
|
|
247
|
+
* {
|
|
248
|
+
* "type": "number",
|
|
249
|
+
* "default": 18080,
|
|
250
|
+
* "alias": "p",
|
|
251
|
+
* "description": "Port to listen on"
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export type CommandArgDefinition = {
|
|
256
|
+
/**
|
|
257
|
+
* The argument type, determining how the CLI parses the value.
|
|
258
|
+
* Mapped from the TypeScript type annotation on the method parameter.
|
|
259
|
+
*/
|
|
260
|
+
type: "string" | "number" | "boolean";
|
|
261
|
+
/**
|
|
262
|
+
* Default value from the method parameter initializer.
|
|
263
|
+
* Omitted if the parameter has no default.
|
|
264
|
+
*/
|
|
265
|
+
default?: any;
|
|
266
|
+
/**
|
|
267
|
+
* `true` if the parameter has no default value and no `?` modifier,
|
|
268
|
+
* meaning the user must provide this argument. Omitted when `false`.
|
|
269
|
+
*/
|
|
270
|
+
required?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Single-character alias for the flag (e.g., `"p"` for `--port`).
|
|
273
|
+
* Extracted from the `@alias` JSDoc tag on the parameter.
|
|
274
|
+
*/
|
|
275
|
+
alias?: string;
|
|
276
|
+
/**
|
|
277
|
+
* Help text displayed in `--help` output for this argument.
|
|
278
|
+
* Extracted from the `@description` JSDoc tag on the parameter.
|
|
279
|
+
*/
|
|
280
|
+
description?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Deprecation message. When present, the CLI warns users that
|
|
283
|
+
* this flag is deprecated. Extracted from the `@deprecated` JSDoc tag.
|
|
284
|
+
*/
|
|
285
|
+
deprecated?: string;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Definition of a CLI command declared via the `@Command` decorator on a service method.
|
|
289
|
+
*
|
|
290
|
+
* Written into `webda.module.json` under `moddas[serviceName].commands` or
|
|
291
|
+
* `beans[serviceName].commands` by the {@link CommandsMetadata} compiler plugin.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```json
|
|
295
|
+
* {
|
|
296
|
+
* "description": "Start the HTTP server",
|
|
297
|
+
* "method": "serve",
|
|
298
|
+
* "args": {
|
|
299
|
+
* "bind": { "type": "string", "default": "127.0.0.1", "alias": "b" },
|
|
300
|
+
* "port": { "type": "number", "default": 18080, "alias": "p" }
|
|
301
|
+
* }
|
|
302
|
+
* }
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
export type CommandDefinition = {
|
|
306
|
+
/**
|
|
307
|
+
* Human-readable description of the command, displayed in CLI help output.
|
|
308
|
+
* Extracted from the `description` option in `@Command("name", { description: "..." })`.
|
|
309
|
+
*/
|
|
310
|
+
description: string;
|
|
311
|
+
/**
|
|
312
|
+
* Name of the method on the service class that handles this command.
|
|
313
|
+
* The shell calls `service[method](...args)` when the command is invoked.
|
|
314
|
+
*/
|
|
315
|
+
method: string;
|
|
316
|
+
/**
|
|
317
|
+
* Map of argument name to its definition. Keys are method parameter names,
|
|
318
|
+
* which become `--flag` names in the CLI.
|
|
319
|
+
*/
|
|
320
|
+
args: {
|
|
321
|
+
[name: string]: CommandArgDefinition;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Capabilities required by this command.
|
|
325
|
+
* The CLI resolves these against the capabilities map and auto-injects
|
|
326
|
+
* missing services before booting Core.
|
|
327
|
+
*/
|
|
328
|
+
requires?: string[];
|
|
329
|
+
/**
|
|
330
|
+
* Lifecycle phase at which this command runs.
|
|
331
|
+
* - `"initialized"` (default when omitted): after `Core.init()`.
|
|
332
|
+
* - `"resolved"`: after `Core.resolve()` only. No service.init() called.
|
|
333
|
+
* Used for build-time hooks (e.g. `@BuildCommand`).
|
|
334
|
+
*/
|
|
335
|
+
phase?: "resolved" | "initialized";
|
|
336
|
+
};
|
|
337
|
+
export type ServiceMetadata = {
|
|
338
|
+
/**
|
|
339
|
+
* File to import
|
|
340
|
+
*/
|
|
341
|
+
Import: string;
|
|
342
|
+
/**
|
|
343
|
+
* Schema defining the service
|
|
344
|
+
*/
|
|
345
|
+
Schema?: JSONSchema7;
|
|
346
|
+
/**
|
|
347
|
+
* Configuration for the service
|
|
348
|
+
*/
|
|
349
|
+
Configuration?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Capability names provided by this service, detected at compile-time.
|
|
352
|
+
*
|
|
353
|
+
* The compiler inspects which interfaces the service class implements.
|
|
354
|
+
* If an interface has a `@WebdaCapability <name>` JSDoc tag, that name
|
|
355
|
+
* is added to this array. At runtime, the framework uses these to
|
|
356
|
+
* auto-discover services (e.g., registering request filters with the Router).
|
|
357
|
+
*
|
|
358
|
+
* @example `["request-filter", "cors-filter"]`
|
|
359
|
+
*/
|
|
360
|
+
capabilities?: string[];
|
|
361
|
+
/**
|
|
362
|
+
* CLI commands declared via `@Command` decorator on service methods.
|
|
363
|
+
*
|
|
364
|
+
* Keys are command names (space-separated for subcommands, e.g., `"aws s3"`).
|
|
365
|
+
* Values describe the command handler and its arguments.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```json
|
|
369
|
+
* {
|
|
370
|
+
* "serve": { "description": "Start server", "method": "serve", "args": { ... } },
|
|
371
|
+
* "aws s3": { "description": "Manage S3", "method": "s3", "args": { ... } }
|
|
372
|
+
* }
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
commands?: {
|
|
376
|
+
[name: string]: CommandDefinition;
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* A Webda module is a NPM package
|
|
381
|
+
*
|
|
382
|
+
* It contains one or more Modda to provide features
|
|
383
|
+
*/
|
|
384
|
+
export interface WebdaModule {
|
|
385
|
+
/**
|
|
386
|
+
* Schema version
|
|
387
|
+
*/
|
|
388
|
+
$schema?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Services provided by the module
|
|
391
|
+
*/
|
|
392
|
+
moddas?: {
|
|
393
|
+
[key: string]: ServiceMetadata;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Beans
|
|
397
|
+
*/
|
|
398
|
+
beans?: {
|
|
399
|
+
[key: string]: ServiceMetadata;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Deployers provided by this module
|
|
403
|
+
*/
|
|
404
|
+
deployers?: {
|
|
405
|
+
[key: string]: ServiceMetadata;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Additional schemas defined by the module
|
|
409
|
+
* Not through a CoreModel or a ServiceParameters
|
|
410
|
+
*/
|
|
411
|
+
schemas: {
|
|
412
|
+
[key: string]: JSONSchema7;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* Models provided by the module
|
|
416
|
+
*/
|
|
417
|
+
models: {
|
|
418
|
+
/**
|
|
419
|
+
* Models provided by the module
|
|
420
|
+
*/
|
|
421
|
+
[key: string]: ModelMetadata;
|
|
422
|
+
};
|
|
423
|
+
/** Behavior classes provided by the module. */
|
|
424
|
+
behaviors?: {
|
|
425
|
+
[key: string]: BehaviorMetadata;
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Default capability providers declared by this package.
|
|
429
|
+
* Maps capability names to service type names.
|
|
430
|
+
* Merged from dependencies at build/load time; project-level values override.
|
|
431
|
+
*/
|
|
432
|
+
capabilities?: {
|
|
433
|
+
[name: string]: string;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Webda specific metadata for the project
|
|
438
|
+
*/
|
|
439
|
+
export interface WebdaPackageDescriptor {
|
|
440
|
+
/**
|
|
441
|
+
* Webda namespace
|
|
442
|
+
*/
|
|
443
|
+
namespace?: string;
|
|
444
|
+
/**
|
|
445
|
+
* Logo to display within the shell tty
|
|
446
|
+
*/
|
|
447
|
+
logo?: string;
|
|
448
|
+
/**
|
|
449
|
+
* Service to replace default launcher
|
|
450
|
+
*/
|
|
451
|
+
launcher?: {
|
|
452
|
+
/**
|
|
453
|
+
* Service to use for launch
|
|
454
|
+
*/
|
|
455
|
+
service: string;
|
|
456
|
+
/**
|
|
457
|
+
* Method to use
|
|
458
|
+
*/
|
|
459
|
+
method: string;
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* Default capability providers for this package.
|
|
463
|
+
* Maps capability names to service type names.
|
|
464
|
+
*/
|
|
465
|
+
capabilities?: {
|
|
466
|
+
[name: string]: string;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Information on the workspace
|
|
470
|
+
*/
|
|
471
|
+
workspaces?: {
|
|
472
|
+
packages: string[];
|
|
473
|
+
parent: PackageDescriptor;
|
|
474
|
+
path: string;
|
|
475
|
+
};
|
|
476
|
+
[key: string]: any;
|
|
477
|
+
}
|
|
478
|
+
export type PackageDescriptorAuthor = string | {
|
|
479
|
+
name?: string;
|
|
480
|
+
email?: string;
|
|
481
|
+
url?: string;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* Some package exists but seems pretty big for this
|
|
485
|
+
* https://classic.yarnpkg.com/en/docs/package-json
|
|
486
|
+
*/
|
|
487
|
+
export interface PackageDescriptor {
|
|
488
|
+
/**
|
|
489
|
+
* The name of the package.
|
|
490
|
+
*/
|
|
491
|
+
name?: string;
|
|
492
|
+
/**
|
|
493
|
+
* The version of the package.
|
|
494
|
+
*/
|
|
495
|
+
version?: string;
|
|
496
|
+
/**
|
|
497
|
+
* A brief description of the package.
|
|
498
|
+
*/
|
|
499
|
+
description?: string;
|
|
500
|
+
/**
|
|
501
|
+
* Keywords that describe the package.
|
|
502
|
+
*/
|
|
503
|
+
keywords?: string[];
|
|
504
|
+
/**
|
|
505
|
+
* The license for the package.
|
|
506
|
+
*/
|
|
507
|
+
license?: string | {
|
|
508
|
+
name: string;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* The homepage URL for the package.
|
|
512
|
+
*/
|
|
513
|
+
homepage?: string;
|
|
514
|
+
/**
|
|
515
|
+
* The URL to the package's issue tracker.
|
|
516
|
+
*/
|
|
517
|
+
bugs?: string;
|
|
518
|
+
/**
|
|
519
|
+
* The URL to the package's repository.
|
|
520
|
+
*/
|
|
521
|
+
repository?: string;
|
|
522
|
+
/**
|
|
523
|
+
* The author of the package.
|
|
524
|
+
*/
|
|
525
|
+
author?: PackageDescriptorAuthor;
|
|
526
|
+
/**
|
|
527
|
+
* The contributors to the package.
|
|
528
|
+
*/
|
|
529
|
+
contributors?: string[] | PackageDescriptorAuthor[];
|
|
530
|
+
/**
|
|
531
|
+
* The files included in the package.
|
|
532
|
+
*/
|
|
533
|
+
files?: string[];
|
|
534
|
+
/**
|
|
535
|
+
* The entry point to the package.
|
|
536
|
+
*/
|
|
537
|
+
main?: string;
|
|
538
|
+
/**
|
|
539
|
+
* The executable files for the package.
|
|
540
|
+
*/
|
|
541
|
+
bin?: string | {
|
|
542
|
+
[key: string]: string;
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* The manual pages for the package.
|
|
546
|
+
*/
|
|
547
|
+
man?: string | string[];
|
|
548
|
+
/**
|
|
549
|
+
* The directories in the package.
|
|
550
|
+
*/
|
|
551
|
+
directories?: {
|
|
552
|
+
[key: string]: string;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* The scripts that can be run for the package.
|
|
556
|
+
*/
|
|
557
|
+
scripts?: {
|
|
558
|
+
[key: string]: string;
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* Configuration options for the package.
|
|
562
|
+
*/
|
|
563
|
+
config?: any;
|
|
564
|
+
/**
|
|
565
|
+
* The dependencies of the package.
|
|
566
|
+
*/
|
|
567
|
+
dependencies?: {
|
|
568
|
+
[key: string]: string;
|
|
569
|
+
};
|
|
570
|
+
/**
|
|
571
|
+
* The development dependencies of the package.
|
|
572
|
+
*/
|
|
573
|
+
devDependencies?: {
|
|
574
|
+
[key: string]: string;
|
|
575
|
+
};
|
|
576
|
+
/**
|
|
577
|
+
* The peer dependencies of the package.
|
|
578
|
+
*/
|
|
579
|
+
peerDependencies?: {
|
|
580
|
+
[key: string]: string;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Metadata for peer dependencies.
|
|
584
|
+
*/
|
|
585
|
+
peerDependenciesMeta?: {
|
|
586
|
+
[key: string]: {
|
|
587
|
+
optional: boolean;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* The optional dependencies of the package.
|
|
592
|
+
*/
|
|
593
|
+
optionalDependencies?: {
|
|
594
|
+
[key: string]: string;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* The bundled dependencies of the package.
|
|
598
|
+
*/
|
|
599
|
+
bundledDependencies?: string[];
|
|
600
|
+
/**
|
|
601
|
+
* If true, the package will be installed with a flat node_modules structure.
|
|
602
|
+
*/
|
|
603
|
+
flat?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Resolutions for dependencies.
|
|
606
|
+
*/
|
|
607
|
+
resolutions?: {
|
|
608
|
+
[key: string]: string;
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* The engines that the package is compatible with.
|
|
612
|
+
*/
|
|
613
|
+
engines?: {
|
|
614
|
+
[key: string]: string;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* The operating systems that the package is compatible with.
|
|
618
|
+
*/
|
|
619
|
+
os?: string[];
|
|
620
|
+
/**
|
|
621
|
+
* The CPU architectures that the package is compatible with.
|
|
622
|
+
*/
|
|
623
|
+
cpu?: string[];
|
|
624
|
+
/**
|
|
625
|
+
* If true, the package is private and cannot be published.
|
|
626
|
+
*/
|
|
627
|
+
private?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Configuration for publishing the package.
|
|
630
|
+
*/
|
|
631
|
+
publishConfig?: any;
|
|
632
|
+
/**
|
|
633
|
+
* Webda specific metadata for the package.
|
|
634
|
+
*/
|
|
635
|
+
webda?: Partial<WebdaPackageDescriptor>;
|
|
636
|
+
/**
|
|
637
|
+
* The terms of service for the package.
|
|
638
|
+
*/
|
|
639
|
+
termsOfService?: string;
|
|
640
|
+
/**
|
|
641
|
+
* The title of the package.
|
|
642
|
+
*/
|
|
643
|
+
title?: string;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Return the gather information from the repository
|
|
647
|
+
* @mermaid Make TypeDoc easy to use with mermaid.js
|
|
648
|
+
* graph TB
|
|
649
|
+
* mermaid.js --> TypeDoc;
|
|
650
|
+
*/
|
|
651
|
+
export interface GitInformation {
|
|
652
|
+
/**
|
|
653
|
+
* Current commit reference
|
|
654
|
+
*
|
|
655
|
+
* `git rev-parse HEAD`
|
|
656
|
+
*/
|
|
657
|
+
commit: string;
|
|
658
|
+
/**
|
|
659
|
+
* Current branch
|
|
660
|
+
*
|
|
661
|
+
* `git symbolic-ref --short HEAD`
|
|
662
|
+
*/
|
|
663
|
+
branch: string;
|
|
664
|
+
/**
|
|
665
|
+
* Current commit short reference
|
|
666
|
+
*
|
|
667
|
+
* `git rev-parse --short HEAD`
|
|
668
|
+
*/
|
|
669
|
+
short: string;
|
|
670
|
+
/**
|
|
671
|
+
* Current tag name that match the package version
|
|
672
|
+
*/
|
|
673
|
+
tag: string;
|
|
674
|
+
/**
|
|
675
|
+
* Return all tags that point to the current HEAD
|
|
676
|
+
*
|
|
677
|
+
* `git tag --points-at HEAD`
|
|
678
|
+
*/
|
|
679
|
+
tags: string[];
|
|
680
|
+
/**
|
|
681
|
+
* Current version as return by package.json with auto snapshot
|
|
682
|
+
*
|
|
683
|
+
* If the version return by package is not in the current `tags`, the version is
|
|
684
|
+
* incremented to the next patch version with a +{date}
|
|
685
|
+
*
|
|
686
|
+
* Example:
|
|
687
|
+
*
|
|
688
|
+
* with package.json version = "1.1.0" name = "mypackage"
|
|
689
|
+
* if a tag "v1.1.0" or "mypackage@1.1.0" then version = "1.1.0"
|
|
690
|
+
* else version = "1.1.1+20201110163014178"
|
|
691
|
+
*/
|
|
692
|
+
version: string;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Information on the whole project
|
|
696
|
+
*/
|
|
697
|
+
export interface ProjectInformation {
|
|
698
|
+
/**
|
|
699
|
+
* package.json information
|
|
700
|
+
*/
|
|
701
|
+
package: PackageDescriptor;
|
|
702
|
+
/**
|
|
703
|
+
* Webda project information
|
|
704
|
+
*
|
|
705
|
+
* It is the aggregation of webda information contained in package
|
|
706
|
+
* and its workspace meta
|
|
707
|
+
*/
|
|
708
|
+
webda: WebdaPackageDescriptor;
|
|
709
|
+
/**
|
|
710
|
+
* Git information gathered
|
|
711
|
+
*/
|
|
712
|
+
git: GitInformation;
|
|
713
|
+
/**
|
|
714
|
+
* Deployment information
|
|
715
|
+
*/
|
|
716
|
+
deployment: {
|
|
717
|
+
name: string;
|
|
718
|
+
[key: string]: any;
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
/** Represents a Webda project on disk, providing access to package metadata and project paths */
|
|
722
|
+
export declare class WebdaProject {
|
|
723
|
+
protected folder: string;
|
|
724
|
+
protected output: WorkerOutput;
|
|
725
|
+
namespace: string;
|
|
726
|
+
packageDescription: PackageDescriptor;
|
|
727
|
+
/** Create a new WebdaProject.
|
|
728
|
+
* @param folder - path to the project root
|
|
729
|
+
* @param output - worker output for logging
|
|
730
|
+
*/
|
|
731
|
+
constructor(folder: string, output?: WorkerOutput);
|
|
732
|
+
/**
|
|
733
|
+
* Check if the project is a webda application
|
|
734
|
+
* @returns true if a webda.config file exists
|
|
735
|
+
*/
|
|
736
|
+
isApplication(): boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Mix the running @webda/compiler's package.json + lib/ contents into the
|
|
739
|
+
* digest. Catches both published version bumps (via package.json) and
|
|
740
|
+
* local rebuilds of a linked workspace dep (via lib/ files), since neither
|
|
741
|
+
* project source nor tsconfig change when a framework dep updates.
|
|
742
|
+
*
|
|
743
|
+
* @param hash - the digest accumulator to update
|
|
744
|
+
*/
|
|
745
|
+
private hashCompilerPackage;
|
|
746
|
+
/**
|
|
747
|
+
* Compute digest of the source files
|
|
748
|
+
* @returns the MD5 hex digest of the source
|
|
749
|
+
*/
|
|
750
|
+
getDigest(): string;
|
|
751
|
+
/**
|
|
752
|
+
* Ensure a dependency is declared
|
|
753
|
+
* @param name - the package name to check
|
|
754
|
+
*/
|
|
755
|
+
ensureDependency(name: string): void;
|
|
756
|
+
/**
|
|
757
|
+
* Subscribe to output events
|
|
758
|
+
* @param event - event name
|
|
759
|
+
* @param listener - callback function
|
|
760
|
+
*/
|
|
761
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
762
|
+
/**
|
|
763
|
+
* Emit an output event
|
|
764
|
+
* @param event - event name
|
|
765
|
+
* @param args - event arguments
|
|
766
|
+
*/
|
|
767
|
+
emit(event: string, ...args: any[]): void;
|
|
768
|
+
/**
|
|
769
|
+
* Get an absolute path within the project folder, or the project root if no path given
|
|
770
|
+
* @param path - relative path within the project
|
|
771
|
+
* @returns the absolute path
|
|
772
|
+
*/
|
|
773
|
+
getAppPath(path?: string): string;
|
|
774
|
+
/**
|
|
775
|
+
* Log a message at the specified level through the worker output
|
|
776
|
+
* @param level - log level
|
|
777
|
+
* @param args - log arguments
|
|
778
|
+
*/
|
|
779
|
+
log(level: WorkerLogLevel, ...args: any[]): void;
|
|
780
|
+
/**
|
|
781
|
+
* Prefix a name with the project namespace if it does not already contain one
|
|
782
|
+
* @param name - the name to prefix
|
|
783
|
+
* @returns the namespaced name
|
|
784
|
+
*/
|
|
785
|
+
completeNamespace(name: string): string;
|
|
786
|
+
}
|
|
787
|
+
//# sourceMappingURL=definition.d.ts.map
|