velocious 1.0.450 → 1.0.451
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/README.md +1 -1
- package/build/configuration-types.js +3 -1
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +785 -47
- package/build/frontend-models/base.js +1 -1
- package/build/src/configuration-types.d.ts +12 -2
- package/build/src/configuration-types.d.ts.map +1 -1
- package/build/src/configuration-types.js +4 -2
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +271 -13
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +666 -49
- package/build/src/frontend-models/base.d.ts +1 -1
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +2 -2
- package/package.json +1 -1
- package/src/configuration-types.js +3 -1
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +785 -47
- package/src/frontend-models/base.js +1 -1
|
@@ -5,17 +5,23 @@
|
|
|
5
5
|
* @property {string} [columnType] - Column type.
|
|
6
6
|
* @property {string} [sqlType] - SQL type.
|
|
7
7
|
* @property {string} [dataType] - Data type.
|
|
8
|
+
* @property {string} [jsDocType] - Exact JSDoc type.
|
|
8
9
|
* @property {string} [name] - Attribute name when configured as an array entry.
|
|
9
10
|
* @property {boolean} [null] - Whether null is allowed.
|
|
11
|
+
* @property {boolean} [selectedByDefault] - Whether the attribute is selected by default.
|
|
10
12
|
* @property {() => string} [getType] - Returns column type.
|
|
11
13
|
* @property {() => boolean} [getNull] - Returns whether null is allowed.
|
|
12
14
|
*/
|
|
13
15
|
/**
|
|
14
16
|
* Permit spec returned by frontend-model resources during generation.
|
|
15
|
-
* @typedef {Array<string | Record<string,
|
|
17
|
+
* @typedef {Array<string | Record<string, FrontendModelGeneratorPermitSpec>>} FrontendModelGeneratorPermitSpec
|
|
16
18
|
*/
|
|
17
19
|
/** Node CLI command that generates frontend model classes from backend project resource config. */
|
|
18
20
|
export default class DbGenerateFrontendModels extends BaseCommand {
|
|
21
|
+
/** @type {Map<string, string> | null} */
|
|
22
|
+
_resourceMethodReturnTypes: Map<string, string> | null;
|
|
23
|
+
/** @type {Map<string, string[]> | null} */
|
|
24
|
+
_resourceMethodParameterTypes: Map<string, string[]> | null;
|
|
19
25
|
/**
|
|
20
26
|
* Runs execute.
|
|
21
27
|
* @returns {Promise<void>} - Resolves when files are generated.
|
|
@@ -70,7 +76,7 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
70
76
|
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
71
77
|
* @param {import("../../../../../configuration-types.js").NormalizedFrontendModelResourceConfiguration} args.modelConfig - Model configuration.
|
|
72
78
|
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null} [args.resourceClass] - Resource class.
|
|
73
|
-
* @returns {string} - Generated file content.
|
|
79
|
+
* @returns {Promise<string>} - Generated file content.
|
|
74
80
|
*/
|
|
75
81
|
buildModelFileContent({ className, importPath, modelClass, modelConfig, resourceClass }: {
|
|
76
82
|
className: string;
|
|
@@ -78,7 +84,7 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
78
84
|
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
79
85
|
modelConfig: import("../../../../../configuration-types.js").NormalizedFrontendModelResourceConfiguration;
|
|
80
86
|
resourceClass?: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
81
|
-
}): string
|
|
87
|
+
}): Promise<string>;
|
|
82
88
|
/**
|
|
83
89
|
* Runs build index file content.
|
|
84
90
|
* @param {Array<{className: string, fileName: string}>} generatedFiles - Generated model files.
|
|
@@ -104,11 +110,12 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
104
110
|
* @param {string} args.attributesTypeName - Generated read attributes typedef name.
|
|
105
111
|
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
106
112
|
* @param {Array<{attributes: Array<{name: string, type: string}>, relationshipName: string, typeName: string}>} args.nestedWriteTypes - Nested write typedefs.
|
|
107
|
-
* @param {
|
|
113
|
+
* @param {FrontendModelGeneratorPermitSpec} args.permittedParams - Resource permitted params spec.
|
|
114
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined} args.resourceClass - Resource class.
|
|
108
115
|
* @param {string} args.typeName - Typedef name.
|
|
109
|
-
* @returns {string} - Generated typedef source.
|
|
116
|
+
* @returns {Promise<string>} - Generated typedef source.
|
|
110
117
|
*/
|
|
111
|
-
writeAttributesTypedef({ attributes, attributesTypeName, modelClass, nestedWriteTypes, permittedParams, typeName }: {
|
|
118
|
+
writeAttributesTypedef({ attributes, attributesTypeName, modelClass, nestedWriteTypes, permittedParams, resourceClass, typeName }: {
|
|
112
119
|
attributes: Array<{
|
|
113
120
|
jsDocType: string;
|
|
114
121
|
name: string;
|
|
@@ -123,9 +130,39 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
123
130
|
relationshipName: string;
|
|
124
131
|
typeName: string;
|
|
125
132
|
}>;
|
|
126
|
-
permittedParams:
|
|
133
|
+
permittedParams: FrontendModelGeneratorPermitSpec;
|
|
134
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
127
135
|
typeName: string;
|
|
128
|
-
}): string
|
|
136
|
+
}): Promise<string>;
|
|
137
|
+
/**
|
|
138
|
+
* Runs frontend write attribute type.
|
|
139
|
+
* @param {{attribute: {jsDocType: string, name: string} | undefined, attributeName: string, attributesTypeName: string, resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined}} args - Arguments.
|
|
140
|
+
* @returns {Promise<string>} - JSDoc type for the permitted write field.
|
|
141
|
+
*/
|
|
142
|
+
frontendWriteAttributeType({ attribute, attributeName, attributesTypeName, resourceClass }: {
|
|
143
|
+
attribute: {
|
|
144
|
+
jsDocType: string;
|
|
145
|
+
name: string;
|
|
146
|
+
} | undefined;
|
|
147
|
+
attributeName: string;
|
|
148
|
+
attributesTypeName: string;
|
|
149
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
150
|
+
}): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Runs frontend write attribute setter parameter type.
|
|
153
|
+
* @param {{attributeName: string, resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined}} args - Arguments.
|
|
154
|
+
* @returns {Promise<string | null>} - Setter value parameter type when it is useful for generation.
|
|
155
|
+
*/
|
|
156
|
+
frontendWriteAttributeSetterParameterType({ attributeName, resourceClass }: {
|
|
157
|
+
attributeName: string;
|
|
158
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
159
|
+
}): Promise<string | null>;
|
|
160
|
+
/**
|
|
161
|
+
* Runs is broad generated type.
|
|
162
|
+
* @param {string} jsDocType - JSDoc type.
|
|
163
|
+
* @returns {boolean} - Whether the type is too broad to improve generated write typing.
|
|
164
|
+
*/
|
|
165
|
+
isBroadGeneratedType(jsDocType: string): boolean;
|
|
129
166
|
/**
|
|
130
167
|
* Resolves a permitted write attribute to the generated frontend attribute name.
|
|
131
168
|
* @param {{attributeName: string, attributesByName: Map<string, {jsDocType: string, name: string}>, modelClass: typeof import("../../../../../database/record/index.js").default | undefined}} args - Arguments.
|
|
@@ -249,17 +286,63 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
249
286
|
/**
|
|
250
287
|
* Runs attribute definitions for model.
|
|
251
288
|
* @param {object} args - Arguments.
|
|
289
|
+
* @param {string} args.className - Frontend model class name.
|
|
252
290
|
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
253
291
|
* @param {import("../../../../../configuration-types.js").NormalizedFrontendModelResourceConfiguration} args.modelConfig - Model configuration.
|
|
254
|
-
* @
|
|
292
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null} [args.resourceClass] - Resource class.
|
|
293
|
+
* @returns {Promise<Array<{jsDocType: string, name: string}>>} - Attribute definitions.
|
|
255
294
|
*/
|
|
256
|
-
attributeDefinitionsForModel({ modelClass, modelConfig }: {
|
|
295
|
+
attributeDefinitionsForModel({ className, modelClass, modelConfig, resourceClass }: {
|
|
296
|
+
className: string;
|
|
257
297
|
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
258
298
|
modelConfig: import("../../../../../configuration-types.js").NormalizedFrontendModelResourceConfiguration;
|
|
259
|
-
|
|
299
|
+
resourceClass?: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
300
|
+
}): Promise<Array<{
|
|
260
301
|
jsDocType: string;
|
|
261
302
|
name: string;
|
|
262
|
-
}
|
|
303
|
+
}>>;
|
|
304
|
+
/**
|
|
305
|
+
* Runs frontend attribute config for generated attribute.
|
|
306
|
+
* @param {{attributeConfig: FrontendAttributeConfig, attributeName: string, modelClass: typeof import("../../../../../database/record/index.js").default | undefined}} args - Arguments.
|
|
307
|
+
* @returns {FrontendAttributeConfig} - Attribute config used for generated JSDoc.
|
|
308
|
+
*/
|
|
309
|
+
frontendAttributeConfigForGeneratedAttribute({ attributeConfig, attributeName, modelClass }: {
|
|
310
|
+
attributeConfig: FrontendAttributeConfig;
|
|
311
|
+
attributeName: string;
|
|
312
|
+
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
313
|
+
}): FrontendAttributeConfig;
|
|
314
|
+
/**
|
|
315
|
+
* Runs frontend attribute is model primary key.
|
|
316
|
+
* @param {{attributeName: string, modelClass: typeof import("../../../../../database/record/index.js").default | undefined}} args - Arguments.
|
|
317
|
+
* @returns {boolean} - Whether the attribute is the model primary key.
|
|
318
|
+
*/
|
|
319
|
+
frontendAttributeIsModelPrimaryKey({ attributeName, modelClass }: {
|
|
320
|
+
attributeName: string;
|
|
321
|
+
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
322
|
+
}): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Resolves frontend attribute config from explicit metadata, resource methods, model columns, translated columns, or model accessor JSDoc.
|
|
325
|
+
* @param {object} args - Arguments.
|
|
326
|
+
* @param {string} args.attributeName - Frontend attribute name.
|
|
327
|
+
* @param {string} args.className - Frontend model class name.
|
|
328
|
+
* @param {FrontendAttributeConfig | null} args.configuredAttributeConfig - Resource-provided attribute config.
|
|
329
|
+
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
330
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined} args.resourceClass - Resource class.
|
|
331
|
+
* @returns {Promise<FrontendAttributeConfig>} - Resolved frontend attribute config.
|
|
332
|
+
*/
|
|
333
|
+
resolvedFrontendAttributeConfig({ attributeName, className, configuredAttributeConfig, modelClass, resourceClass }: {
|
|
334
|
+
attributeName: string;
|
|
335
|
+
className: string;
|
|
336
|
+
configuredAttributeConfig: FrontendAttributeConfig | null;
|
|
337
|
+
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
338
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
339
|
+
}): Promise<FrontendAttributeConfig>;
|
|
340
|
+
/**
|
|
341
|
+
* Runs frontend attribute config has type.
|
|
342
|
+
* @param {FrontendAttributeConfig | null | undefined} attributeConfig - Attribute config.
|
|
343
|
+
* @returns {boolean} - Whether the config declares a type source.
|
|
344
|
+
*/
|
|
345
|
+
frontendAttributeConfigHasType(attributeConfig: FrontendAttributeConfig | null | undefined): boolean;
|
|
263
346
|
/**
|
|
264
347
|
* Runs js doc type for frontend attribute.
|
|
265
348
|
* @param {object} args - Arguments.
|
|
@@ -287,6 +370,164 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
287
370
|
* @returns {string | null} - Normalized column type.
|
|
288
371
|
*/
|
|
289
372
|
frontendAttributeTypeValue(attributeConfig: FrontendAttributeConfig | null | undefined): string | null;
|
|
373
|
+
/**
|
|
374
|
+
* Runs frontend attribute config for resource attribute.
|
|
375
|
+
* @param {object} args - Arguments.
|
|
376
|
+
* @param {string} args.attributeName - Frontend model attribute name.
|
|
377
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined} args.resourceClass - Resource class.
|
|
378
|
+
* @returns {Promise<FrontendAttributeConfig | null>} - Attribute config inferred from resource method JSDoc.
|
|
379
|
+
*/
|
|
380
|
+
frontendAttributeConfigForResourceAttribute({ attributeName, resourceClass }: {
|
|
381
|
+
attributeName: string;
|
|
382
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
383
|
+
}): Promise<FrontendAttributeConfig | null>;
|
|
384
|
+
/**
|
|
385
|
+
* Runs frontend attribute config for translated attribute.
|
|
386
|
+
* @param {object} args - Arguments.
|
|
387
|
+
* @param {string} args.attributeName - Frontend model attribute name.
|
|
388
|
+
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
389
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined} args.resourceClass - Resource class.
|
|
390
|
+
* @returns {FrontendAttributeConfig | null} - Attribute config inferred from translated attribute columns.
|
|
391
|
+
*/
|
|
392
|
+
frontendAttributeConfigForTranslatedAttribute({ attributeName, modelClass, resourceClass }: {
|
|
393
|
+
attributeName: string;
|
|
394
|
+
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
395
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
396
|
+
}): FrontendAttributeConfig | null;
|
|
397
|
+
/**
|
|
398
|
+
* Runs frontend attribute is translated.
|
|
399
|
+
* @param {object} args - Arguments.
|
|
400
|
+
* @param {string} args.attributeName - Frontend model attribute name.
|
|
401
|
+
* @param {typeof import("../../../../../database/record/index.js").default} args.modelClass - Backend model class.
|
|
402
|
+
* @param {import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined} args.resourceClass - Resource class.
|
|
403
|
+
* @returns {boolean} - Whether the frontend attribute is translated.
|
|
404
|
+
*/
|
|
405
|
+
frontendAttributeIsTranslated({ attributeName, modelClass, resourceClass }: {
|
|
406
|
+
attributeName: string;
|
|
407
|
+
modelClass: typeof import("../../../../../database/record/index.js").default;
|
|
408
|
+
resourceClass: import("../../../../../configuration-types.js").FrontendModelResourceClassType | null | undefined;
|
|
409
|
+
}): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Runs frontend attribute config for model accessor.
|
|
412
|
+
* @param {object} args - Arguments.
|
|
413
|
+
* @param {string} args.attributeName - Frontend model attribute name.
|
|
414
|
+
* @param {typeof import("../../../../../database/record/index.js").default | undefined} args.modelClass - Backend model class.
|
|
415
|
+
* @returns {Promise<FrontendAttributeConfig | null>} - Attribute config inferred from model accessor JSDoc.
|
|
416
|
+
*/
|
|
417
|
+
frontendAttributeConfigForModelAccessor({ attributeName, modelClass }: {
|
|
418
|
+
attributeName: string;
|
|
419
|
+
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
420
|
+
}): Promise<FrontendAttributeConfig | null>;
|
|
421
|
+
/**
|
|
422
|
+
* Runs unwrapped promise js doc type.
|
|
423
|
+
* @param {object} args - Arguments.
|
|
424
|
+
* @param {string} args.jsDocType - JSDoc type to normalize.
|
|
425
|
+
* @returns {string} - The resolved value type for serialized frontend attributes.
|
|
426
|
+
*/
|
|
427
|
+
unwrappedPromiseJsDocType({ jsDocType }: {
|
|
428
|
+
jsDocType: string;
|
|
429
|
+
}): string;
|
|
430
|
+
/**
|
|
431
|
+
* Runs method owner class name.
|
|
432
|
+
* @param {object} args - Arguments.
|
|
433
|
+
* @param {string} args.methodName - Method name.
|
|
434
|
+
* @param {typeof import("../../../../../database/record/index.js").default | import("../../../../../configuration-types.js").FrontendModelResourceClassType} args.targetClass - Target class.
|
|
435
|
+
* @returns {string | null} - Class name that declares the method.
|
|
436
|
+
*/
|
|
437
|
+
methodOwnerClassName({ methodName, targetClass }: {
|
|
438
|
+
methodName: string;
|
|
439
|
+
targetClass: typeof import("../../../../../database/record/index.js").default | import("../../../../../configuration-types.js").FrontendModelResourceClassType;
|
|
440
|
+
}): string | null;
|
|
441
|
+
/**
|
|
442
|
+
* Runs resource method return type.
|
|
443
|
+
* @param {object} args - Arguments.
|
|
444
|
+
* @param {string} args.methodName - Method name.
|
|
445
|
+
* @param {string} args.sourceClassName - Source class name.
|
|
446
|
+
* @returns {Promise<string | null>} - JSDoc return type when documented.
|
|
447
|
+
*/
|
|
448
|
+
resourceMethodReturnType({ methodName, sourceClassName }: {
|
|
449
|
+
methodName: string;
|
|
450
|
+
sourceClassName: string;
|
|
451
|
+
}): Promise<string | null>;
|
|
452
|
+
/**
|
|
453
|
+
* Runs resource method parameter type.
|
|
454
|
+
* @param {{methodName: string, parameterIndex: number, sourceClassName: string}} args - Arguments.
|
|
455
|
+
* @returns {Promise<string | null>} - JSDoc parameter type when documented.
|
|
456
|
+
*/
|
|
457
|
+
resourceMethodParameterType({ methodName, parameterIndex, sourceClassName }: {
|
|
458
|
+
methodName: string;
|
|
459
|
+
parameterIndex: number;
|
|
460
|
+
sourceClassName: string;
|
|
461
|
+
}): Promise<string | null>;
|
|
462
|
+
/**
|
|
463
|
+
* Runs resource method return types.
|
|
464
|
+
* @returns {Promise<Map<string, string>>} - Resource method return types keyed by ClassName.methodName.
|
|
465
|
+
*/
|
|
466
|
+
resourceMethodReturnTypes(): Promise<Map<string, string>>;
|
|
467
|
+
/**
|
|
468
|
+
* Runs resource method parameter types.
|
|
469
|
+
* @returns {Promise<Map<string, string[]>>} - Resource method parameter types keyed by ClassName.methodName.
|
|
470
|
+
*/
|
|
471
|
+
resourceMethodParameterTypes(): Promise<Map<string, string[]>>;
|
|
472
|
+
/**
|
|
473
|
+
* Runs frontend model JSDoc source files.
|
|
474
|
+
* @returns {Promise<string[]>} - JavaScript source files that can define frontend-model resources and model accessors.
|
|
475
|
+
*/
|
|
476
|
+
frontendModelJsDocSourceFiles(): Promise<string[]>;
|
|
477
|
+
/**
|
|
478
|
+
* Runs frontend model JSDoc source directories.
|
|
479
|
+
* @returns {string[]} - Source directories to scan for generated frontend-model JSDoc.
|
|
480
|
+
*/
|
|
481
|
+
frontendModelJsDocSourceDirectories(): string[];
|
|
482
|
+
/**
|
|
483
|
+
* Adds resource method return types from source.
|
|
484
|
+
* @param {object} args - Arguments.
|
|
485
|
+
* @param {Map<string, string>} args.returnTypes - Mutable return types map.
|
|
486
|
+
* @param {string} args.sourceText - Source text.
|
|
487
|
+
* @returns {void}
|
|
488
|
+
*/
|
|
489
|
+
addResourceMethodReturnTypesFromSource({ returnTypes, sourceText }: {
|
|
490
|
+
returnTypes: Map<string, string>;
|
|
491
|
+
sourceText: string;
|
|
492
|
+
}): void;
|
|
493
|
+
/**
|
|
494
|
+
* Adds resource method parameter types from source.
|
|
495
|
+
* @param {{parameterTypes: Map<string, string[]>, sourceText: string}} args - Arguments.
|
|
496
|
+
* @returns {void}
|
|
497
|
+
*/
|
|
498
|
+
addResourceMethodParameterTypesFromSource({ parameterTypes, sourceText }: {
|
|
499
|
+
parameterTypes: Map<string, string[]>;
|
|
500
|
+
sourceText: string;
|
|
501
|
+
}): void;
|
|
502
|
+
/**
|
|
503
|
+
* Runs js doc return type.
|
|
504
|
+
* @param {string} jsDocText - JSDoc text inside comment markers.
|
|
505
|
+
* @returns {string | null} - JSDoc return type when present.
|
|
506
|
+
*/
|
|
507
|
+
jsDocReturnType(jsDocText: string): string | null;
|
|
508
|
+
/**
|
|
509
|
+
* Runs js doc parameter types.
|
|
510
|
+
* @param {string} jsDocText - JSDoc text inside comment markers.
|
|
511
|
+
* @returns {string[]} - JSDoc parameter types in declaration order.
|
|
512
|
+
*/
|
|
513
|
+
jsDocParameterTypes(jsDocText: string): string[];
|
|
514
|
+
/**
|
|
515
|
+
* Runs javascript files in directory.
|
|
516
|
+
* @param {string} directory - Directory path.
|
|
517
|
+
* @returns {Promise<string[]>} - JavaScript source file paths.
|
|
518
|
+
*/
|
|
519
|
+
javascriptFilesInDirectory(directory: string): Promise<string[]>;
|
|
520
|
+
/**
|
|
521
|
+
* Finds a matching closing brace while respecting JavaScript strings and comments.
|
|
522
|
+
* @param {object} args - Arguments.
|
|
523
|
+
* @param {number} args.openIndex - Opening brace index.
|
|
524
|
+
* @param {string} args.sourceText - Source text.
|
|
525
|
+
* @returns {number | null} - Closing brace index when found.
|
|
526
|
+
*/
|
|
527
|
+
matchingBraceIndex({ openIndex, sourceText }: {
|
|
528
|
+
openIndex: number;
|
|
529
|
+
sourceText: string;
|
|
530
|
+
}): number | null;
|
|
290
531
|
/**
|
|
291
532
|
* Runs frontend attribute config for model attribute.
|
|
292
533
|
* @param {object} args - Arguments.
|
|
@@ -298,6 +539,15 @@ export default class DbGenerateFrontendModels extends BaseCommand {
|
|
|
298
539
|
attributeName: string;
|
|
299
540
|
modelClass: typeof import("../../../../../database/record/index.js").default | undefined;
|
|
300
541
|
}): FrontendAttributeConfig | null;
|
|
542
|
+
/**
|
|
543
|
+
* Runs frontend attribute config for column.
|
|
544
|
+
* @param {object} args - Arguments.
|
|
545
|
+
* @param {import("../../../../../database/drivers/base-column.js").default} args.column - Database column.
|
|
546
|
+
* @returns {FrontendAttributeConfig} - Attribute config inferred from the database column.
|
|
547
|
+
*/
|
|
548
|
+
frontendAttributeConfigForColumn({ column }: {
|
|
549
|
+
column: import("../../../../../database/drivers/base-column.js").default;
|
|
550
|
+
}): FrontendAttributeConfig;
|
|
301
551
|
/**
|
|
302
552
|
* Runs relationships for model.
|
|
303
553
|
* @param {object} args - Arguments.
|
|
@@ -357,6 +607,10 @@ export type FrontendAttributeConfig = {
|
|
|
357
607
|
* - Data type.
|
|
358
608
|
*/
|
|
359
609
|
dataType?: string | undefined;
|
|
610
|
+
/**
|
|
611
|
+
* - Exact JSDoc type.
|
|
612
|
+
*/
|
|
613
|
+
jsDocType?: string | undefined;
|
|
360
614
|
/**
|
|
361
615
|
* - Attribute name when configured as an array entry.
|
|
362
616
|
*/
|
|
@@ -365,6 +619,10 @@ export type FrontendAttributeConfig = {
|
|
|
365
619
|
* - Whether null is allowed.
|
|
366
620
|
*/
|
|
367
621
|
null?: boolean | undefined;
|
|
622
|
+
/**
|
|
623
|
+
* - Whether the attribute is selected by default.
|
|
624
|
+
*/
|
|
625
|
+
selectedByDefault?: boolean | undefined;
|
|
368
626
|
/**
|
|
369
627
|
* - Returns column type.
|
|
370
628
|
*/
|
|
@@ -377,6 +635,6 @@ export type FrontendAttributeConfig = {
|
|
|
377
635
|
/**
|
|
378
636
|
* Permit spec returned by frontend-model resources during generation.
|
|
379
637
|
*/
|
|
380
|
-
export type FrontendModelGeneratorPermitSpec = Array<string | Record<string,
|
|
638
|
+
export type FrontendModelGeneratorPermitSpec = Array<string | Record<string, FrontendModelGeneratorPermitSpec>>;
|
|
381
639
|
import BaseCommand from "../../../../../cli/base-command.js";
|
|
382
640
|
//# sourceMappingURL=frontend-models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-models.d.ts","sourceRoot":"","sources":["../../../../../../../src/environment-handlers/node/cli/commands/generate/frontend-models.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"frontend-models.d.ts","sourceRoot":"","sources":["../../../../../../../src/environment-handlers/node/cli/commands/generate/frontend-models.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH;;;GAGG;AAEH,mGAAmG;AACnG;IACE,yCAAyC;IACzC,4BADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CACJ;IAEjC,2CAA2C;IAC3C,+BADW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CACH;IAEpC;;;OAGG;IACH,WAFa,OAAO,CAAC,IAAI,CAAC,CA8GzB;IAED;;;;;;;;OAQG;IACH,iGANG;QAA0B,gCAAgC,EAAlD,GAAG,CAAC,MAAM,CAAC;QACE,SAAS,EAAtB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