@postxl/generator 0.60.6 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generator.js +29 -36
- package/dist/generators/indices/businesslogic-actiontypes.generator.js +6 -6
- package/dist/generators/indices/businesslogic-update-clonecontext.generator.js +3 -3
- package/dist/generators/indices/businesslogic-update-module.generator.js +9 -9
- package/dist/generators/indices/businesslogic-update-service.generator.js +6 -6
- package/dist/generators/indices/businesslogic-view-module.generator.js +8 -8
- package/dist/generators/indices/businesslogic-view-service.generator.js +6 -6
- package/dist/generators/indices/data-types.generator.js +1 -1
- package/dist/generators/indices/datamock-module.generator.js +8 -32
- package/dist/generators/indices/datamocker.generator.js +3 -3
- package/dist/generators/indices/datamodule.generator.js +5 -4
- package/dist/generators/indices/dataservice.generator.js +4 -4
- package/dist/generators/indices/dispatcher-service.generator.js +11 -10
- package/dist/generators/indices/importexport-convert-import-functions.generator.js +7 -7
- package/dist/generators/indices/importexport-exporter-class.generator.js +6 -6
- package/dist/generators/indices/importexport-import-service.generator.js +14 -12
- package/dist/generators/indices/importexport-types.generator.js +2 -2
- package/dist/generators/indices/repositories.generator.d.ts +0 -7
- package/dist/generators/indices/repositories.generator.js +2 -16
- package/dist/generators/indices/seed-migration.generator.js +6 -4
- package/dist/generators/indices/testdata-service.generator.js +7 -7
- package/dist/generators/models/businesslogic-update.generator.js +24 -23
- package/dist/generators/models/businesslogic-view.generator.js +8 -9
- package/dist/generators/models/importexport-decoder.generator.d.ts +0 -7
- package/dist/generators/models/importexport-decoder.generator.js +2 -16
- package/dist/generators/models/repository.generator.js +5 -7
- package/dist/generators/models/route.generator.js +3 -3
- package/dist/generators/models/seed.generator.js +2 -2
- package/dist/generators/models/stub.generator.js +1 -1
- package/dist/lib/meta.d.ts +189 -231
- package/dist/lib/meta.js +78 -91
- package/dist/lib/schema/schema.d.ts +10 -3
- package/dist/lib/schema/types.d.ts +27 -0
- package/dist/lib/schema/types.js +28 -1
- package/package.json +1 -1
- package/dist/generators/indices/businesslogic-update-index.generator.d.ts +0 -9
- package/dist/generators/indices/businesslogic-update-index.generator.js +0 -23
- package/dist/generators/indices/businesslogic-view-index.generator.d.ts +0 -9
- package/dist/generators/indices/businesslogic-view-index.generator.js +0 -19
- package/dist/generators/indices/stubs.generator.d.ts +0 -16
- package/dist/generators/indices/stubs.generator.js +0 -29
package/dist/lib/meta.js
CHANGED
|
@@ -57,78 +57,74 @@ function getSchemaMetadata({ config }) {
|
|
|
57
57
|
importPath: Types.toBackendModulePath(`@backend/auth`),
|
|
58
58
|
},
|
|
59
59
|
db: {
|
|
60
|
-
|
|
60
|
+
moduleName: Types.toClassName(`DatabaseModule`),
|
|
61
|
+
moduleLocation: Types.toModuleLocation(`db`, `${config.paths.dbLibPath}database.module`),
|
|
62
|
+
typesImportPath: Types.toBackendModulePath(`@backend/db`),
|
|
61
63
|
databaseService: {
|
|
62
64
|
name: Types.toClassName(`DatabaseService`),
|
|
65
|
+
location: Types.toModuleLocation('db', `${config.paths.dbLibPath}database.service`),
|
|
63
66
|
},
|
|
64
67
|
},
|
|
65
68
|
http: {
|
|
66
|
-
|
|
69
|
+
moduleImportPath: Types.toBackendModulePath(`@backend/http/http.module`),
|
|
67
70
|
},
|
|
68
71
|
i18n: {
|
|
69
|
-
|
|
72
|
+
moduleImportPath: Types.toBackendModulePath(`@backend/i18n/i18n.module`),
|
|
70
73
|
},
|
|
71
74
|
s3: {
|
|
72
|
-
|
|
75
|
+
moduleImportPath: Types.toBackendModulePath(`@backend/s3/s3.module`),
|
|
73
76
|
},
|
|
74
77
|
upload: {
|
|
75
|
-
|
|
78
|
+
moduleImportPath: Types.toBackendModulePath(`@backend/upload/upload.module`),
|
|
76
79
|
},
|
|
77
80
|
xlport: {
|
|
78
|
-
|
|
81
|
+
moduleImportPart: Types.toBackendModulePath(`@backend/xlport/xlport.module`),
|
|
79
82
|
},
|
|
80
83
|
},
|
|
81
84
|
actions: {
|
|
82
85
|
moduleName: Types.toClassName(`ActionModule`),
|
|
83
|
-
|
|
86
|
+
moduleLocation: Types.toModuleLocation(`actions`, `${config.paths.actionsPath}actions.module`),
|
|
84
87
|
execution: {
|
|
85
|
-
interface: Types.toClassName(`IActionExecution`),
|
|
86
88
|
class: Types.toClassName(`ActionExecution`),
|
|
89
|
+
classLocation: Types.toModuleLocation(`actions`, `${config.paths.actionsPath}execution/action`),
|
|
90
|
+
interface: Types.toClassName(`IActionExecution`),
|
|
91
|
+
interfaceLocation: Types.toModuleLocation(`actions`, `${config.paths.actionsPath}execution/types`),
|
|
87
92
|
mock: Types.toClassName(`MockActionExecution`),
|
|
93
|
+
mockLocation: Types.toModuleLocation(`actions`, `${config.paths.actionsPath}execution/mock`),
|
|
88
94
|
},
|
|
89
95
|
dispatcher: {
|
|
90
|
-
|
|
96
|
+
classLocation: Types.toModuleLocation('actions', `${config.paths.actionsPath}dispatcher.service`),
|
|
91
97
|
class: Types.toClassName(`DispatcherService`),
|
|
98
|
+
definitionLocation: Types.toModuleLocation('actions', `${config.paths.actionsPath}dispatcher.interface`),
|
|
92
99
|
definition: Types.toTypeName('IDispatcherDefinition'),
|
|
93
100
|
},
|
|
94
101
|
definition: {
|
|
102
|
+
importPath: Types.toBackendModulePath('@backend/actions/utils'),
|
|
95
103
|
schema: Types.toTypeName('ActionDef'),
|
|
96
104
|
payload: Types.toTypeName('ActionDefPayload'),
|
|
97
105
|
result: Types.toTypeName('ActionDefResult'),
|
|
98
106
|
resultDict: Types.toTypeName('ActionDefResultDict'),
|
|
99
107
|
},
|
|
100
108
|
},
|
|
101
|
-
|
|
102
|
-
moduleName: Types.toClassName(`
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
importPath: Types.toBackendModulePath(`@backend/business-logic/update`),
|
|
117
|
-
indexFilePath: Types.toPath(`${config.paths.businessLogicPath}update/index`),
|
|
118
|
-
moduleFilePath: Types.toPath(`${config.paths.businessLogicPath}update/update.module`),
|
|
119
|
-
serviceClassName: Types.toClassName(`UpdateService`),
|
|
120
|
-
serviceFilePath: Types.toPath(`${config.paths.businessLogicPath}update/update.service`),
|
|
121
|
-
actionTypesFilePath: Types.toPath(`${config.paths.businessLogicPath}update/actions`),
|
|
122
|
-
cloneContextFilePath: Types.toPath(`${config.paths.businessLogicPath}update/clone.context`),
|
|
123
|
-
cloneContextType: Types.toTypeName(`CloneContext`),
|
|
124
|
-
cloneContextCreateMethod: Types.toFunctionName(`createCloneContext`),
|
|
125
|
-
},
|
|
109
|
+
view: {
|
|
110
|
+
moduleName: Types.toClassName(`ViewModule`),
|
|
111
|
+
moduleLocation: Types.toModuleLocation(`view`, `${config.paths.businessViewLogicPath}view.module`),
|
|
112
|
+
serviceClassName: Types.toClassName(`ViewService`),
|
|
113
|
+
serviceLocation: Types.toModuleLocation(`view`, `${config.paths.businessViewLogicPath}view.service`),
|
|
114
|
+
},
|
|
115
|
+
update: {
|
|
116
|
+
moduleName: Types.toClassName(`UpdateModule`),
|
|
117
|
+
moduleLocation: Types.toModuleLocation(`update`, `${config.paths.businessUpdateLogicPath}update.module`),
|
|
118
|
+
serviceClassName: Types.toClassName(`UpdateService`),
|
|
119
|
+
serviceLocation: Types.toModuleLocation(`update`, `${config.paths.businessUpdateLogicPath}update.service`),
|
|
120
|
+
actionTypesFilePath: Types.toPath(`${config.paths.businessUpdateLogicPath}actions`),
|
|
121
|
+
cloneContextFilePath: Types.toPath(`${config.paths.businessUpdateLogicPath}clone.context`),
|
|
122
|
+
cloneContextType: Types.toTypeName(`CloneContext`),
|
|
123
|
+
cloneContextCreateMethod: Types.toFunctionName(`createCloneContext`),
|
|
126
124
|
},
|
|
127
125
|
data: {
|
|
128
126
|
moduleName: Types.toClassName(`DataModule`),
|
|
129
|
-
|
|
130
|
-
dataModuleFilePath: Types.toPath(`${config.paths.dataLibPath}data.module`),
|
|
131
|
-
dataMockModuleFilePath: Types.toPath(`${config.paths.dataLibPath}data.mock.module`),
|
|
127
|
+
moduleLocation: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}data.module`),
|
|
132
128
|
emptyDbCommandFilePath: Types.toPath(`${config.paths.dbLibPath}wipe-database.sql`),
|
|
133
129
|
repository: {
|
|
134
130
|
typeFilePath: Types.toPath(`${config.paths.dataLibPath}repository.type`),
|
|
@@ -137,60 +133,58 @@ function getSchemaMetadata({ config }) {
|
|
|
137
133
|
indexFilePath: Types.toPath(`${config.paths.dataLibPath}repositories/index`),
|
|
138
134
|
},
|
|
139
135
|
types: {
|
|
140
|
-
|
|
136
|
+
location: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}types`),
|
|
141
137
|
bulkMutation: Types.toTypeName(`BulkMutation`),
|
|
142
138
|
bulkMutationForModel: Types.toTypeName(`BulkMutationForModel`),
|
|
143
139
|
},
|
|
144
140
|
dataService: {
|
|
145
|
-
|
|
141
|
+
location: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}data.service`),
|
|
146
142
|
class: Types.toClassName(`DataService`),
|
|
147
143
|
executeBulkMutations: Types.toFunctionName(`executeBulkMutations`),
|
|
148
144
|
executeBulkMutation: Types.toFunctionName(`executeBulkMutation`),
|
|
149
145
|
},
|
|
150
146
|
stubIndexFilePath: Types.toPath(`${config.paths.dataLibPath}stubs/index`),
|
|
151
147
|
testDataServiceFilePath: Types.toPath(`${config.paths.e2eLibPath}test-data.service`),
|
|
152
|
-
|
|
148
|
+
mockModule: {
|
|
149
|
+
location: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}data.mock.module`),
|
|
150
|
+
name: Types.toClassName(`DataMockModule`),
|
|
151
|
+
},
|
|
153
152
|
dataMockDataType: Types.toTypeName(`MockData`),
|
|
154
153
|
},
|
|
155
154
|
e2e: {
|
|
156
|
-
|
|
157
|
-
filePath: Types.toPath(`${config.paths.playwrightPath}support/data-mocker.class`),
|
|
158
|
-
stubImportPath: Types.toPath(`${config.paths.playwrightPath}support/stubs`),
|
|
159
|
-
stubIndexFilePath: Types.toPath(`${config.paths.playwrightPath}support/stubs/index`),
|
|
160
|
-
},
|
|
155
|
+
dataMockerLocation: Types.toModuleLocation(`e2e`, `${config.paths.playwrightPath}support/data-mocker.class`),
|
|
161
156
|
selectorsFilePath: Types.toPath(`${config.paths.playwrightPath}support/selectors`),
|
|
162
157
|
},
|
|
163
158
|
importExport: {
|
|
164
|
-
|
|
159
|
+
moduleLocation: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}import-export.module`),
|
|
165
160
|
decoder: {
|
|
166
|
-
|
|
167
|
-
fullDecoderFilePath: Types.toPath(`${config.paths.importExportPath}decoders/data.decoder`),
|
|
161
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}decoders/data.decoder`),
|
|
168
162
|
fullDecoderName: Types.toFunctionName(`excelDataDecoder`),
|
|
169
163
|
fullEncoderFunctionName: Types.toFunctionName(`encodeExcelData`),
|
|
170
164
|
encodedExcelDataTypeName: Types.toTypeName(`EncodedExcelData`),
|
|
171
165
|
decodedPXLModelDataTypeName: Types.toTypeName(`DecodedPXLModelData`),
|
|
172
166
|
},
|
|
173
167
|
exporterClass: {
|
|
174
|
-
|
|
168
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}exporter.class`),
|
|
175
169
|
name: Types.toClassName(`Exporter`),
|
|
176
170
|
},
|
|
177
171
|
exportService: {
|
|
178
|
-
|
|
172
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}export.service`),
|
|
179
173
|
name: Types.toClassName(`ExportService`),
|
|
180
174
|
},
|
|
181
175
|
importService: {
|
|
182
|
-
|
|
176
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}import.service`),
|
|
183
177
|
name: Types.toClassName(`ImportService`),
|
|
184
178
|
sharedName: Types.toVariableName(`importService`),
|
|
185
179
|
},
|
|
186
180
|
converterFunctions: {
|
|
187
|
-
|
|
181
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}convert-import.functions`),
|
|
188
182
|
importedDataToBulkMutations: Types.toFunctionName(`importToBulkMutations`),
|
|
189
183
|
deltaToBulkMutations: Types.toFunctionName(`deltaToBulkMutations`),
|
|
190
184
|
mockDataToBulkMutations: Types.toFunctionName(`mockDataToBulkMutations`),
|
|
191
185
|
},
|
|
192
186
|
types: {
|
|
193
|
-
|
|
187
|
+
location: Types.toModuleLocation(`import-export`, `${config.paths.importExportPath}types`),
|
|
194
188
|
delta_Model: {
|
|
195
189
|
type: Types.toTypeName(`Delta_Model`),
|
|
196
190
|
create: {
|
|
@@ -244,17 +238,16 @@ function getSchemaMetadata({ config }) {
|
|
|
244
238
|
},
|
|
245
239
|
},
|
|
246
240
|
seedData: {
|
|
247
|
-
|
|
248
|
-
initialMigrationFilePath: Types.toPath(`${config.paths.seedDataPath}001-base-data/001-seed.migration`),
|
|
241
|
+
initialMigrationLocation: Types.toModuleLocation(`seed-data`, `${config.paths.seedDataPath}001-base-data/001-seed.migration`),
|
|
249
242
|
templateExcelFilePath: Types.toPath(`${config.paths.seedDataPath}002-excel-example/template.xlsx`),
|
|
250
243
|
},
|
|
251
244
|
seed: {
|
|
252
245
|
serviceClassName: Types.toClassName(`SeedService`),
|
|
253
|
-
|
|
246
|
+
serviceLocation: Types.toModuleLocation(`seed`, `${config.paths.seedLibPath}seed.service`),
|
|
247
|
+
actionsLocation: Types.toModuleLocation(`seed`, `${config.paths.seedLibPath}actions`),
|
|
254
248
|
},
|
|
255
249
|
trpc: {
|
|
256
250
|
routesFilePath: Types.toPath(`${config.paths.trpcRoutesFolderPath}index`),
|
|
257
|
-
importPath: Types.toBackendModulePath(`@backend/trpc`),
|
|
258
251
|
},
|
|
259
252
|
types: {
|
|
260
253
|
indexFilePath: Types.toPath(`${config.paths.modelTypeDefinitionsPath}index`),
|
|
@@ -293,25 +286,24 @@ function getModelMetadata({ model }) {
|
|
|
293
286
|
importPath: Types.toBackendModulePath(`@backend/data`),
|
|
294
287
|
mockDataPropertyName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
295
288
|
repository: {
|
|
296
|
-
|
|
297
|
-
filePath: Types.toPath(`${config.paths.dataLibPath}repositories/${camelCase}.repository`),
|
|
289
|
+
location: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}repositories/${camelCase}.repository`),
|
|
298
290
|
className: Types.toClassName(`${PascalCase}Repository`),
|
|
299
291
|
decoderFnName: Types.toFunctionName(`to${PascalCase}`),
|
|
300
292
|
getMethodFnName: Types.toFunctionName(`${camelCase}`),
|
|
301
293
|
},
|
|
302
294
|
mockRepository: {
|
|
303
|
-
|
|
304
|
-
filePath: Types.toPath(`${config.paths.dataLibPath}repositories/mock/${camelCase}.mock.repository`),
|
|
295
|
+
location: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}repositories/mock/${camelCase}.mock.repository`),
|
|
305
296
|
className: Types.toClassName(`Mock${PascalCase}Repository`),
|
|
306
297
|
},
|
|
307
|
-
|
|
298
|
+
stubLocation: Types.toModuleLocation(`data`, `${config.paths.dataLibPath}stubs/${camelCase}.stub`),
|
|
308
299
|
stubGenerationFnName: Types.toFunctionName(`stub${PascalCase}`),
|
|
309
300
|
defaultStubConstantName: Types.toVariableName(`${camelCase}DefaultStub`),
|
|
310
301
|
dataServiceName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
311
302
|
dataServiceIdName: Types.toVariableName(`${uncapitalized}`),
|
|
312
303
|
},
|
|
313
304
|
e2e: {
|
|
314
|
-
|
|
305
|
+
stubGenerationFnName: Types.toFunctionName(`stub${PascalCase}`),
|
|
306
|
+
stubLocation: Types.toModuleLocation(`e2e`, `${config.paths.playwrightPath}support/stubs/${camelCase}.stub`),
|
|
315
307
|
},
|
|
316
308
|
importExport: {
|
|
317
309
|
exportDataPropertyName: Types.toVariableName(`${capitalizedPlural}`),
|
|
@@ -330,39 +322,34 @@ function getModelMetadata({ model }) {
|
|
|
330
322
|
decodedModelArrayName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
331
323
|
},
|
|
332
324
|
},
|
|
333
|
-
|
|
325
|
+
view: {
|
|
334
326
|
scopeName: Types.toVariableName(`${camelCase}`),
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
clone: Types.toFunctionName(`${camelCase}CloneDecoder`),
|
|
357
|
-
},
|
|
358
|
-
cloneContextMap: Types.toVariableName(`${camelCase}`),
|
|
359
|
-
},
|
|
327
|
+
serviceClassName: Types.toClassName(`${PascalCase}ViewService`),
|
|
328
|
+
serviceVariableName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
329
|
+
serviceLocation: Types.toModuleLocation(`view`, `${config.paths.businessViewLogicPath}${camelCase}.view.service`),
|
|
330
|
+
dataRepositoryVariableName: Types.toVariableName(`data`),
|
|
331
|
+
},
|
|
332
|
+
update: {
|
|
333
|
+
scopeName: Types.toVariableName(`${camelCase}`),
|
|
334
|
+
moduleLocation: Types.toModuleLocation('update', `${config.paths.businessUpdateLogicPath}${camelCase}.update.module`),
|
|
335
|
+
serviceClassName: Types.toClassName(`${PascalCase}UpdateService`),
|
|
336
|
+
serviceClassLocation: Types.toModuleLocation('update', `${config.paths.businessUpdateLogicPath}${camelCase}.update.service`),
|
|
337
|
+
serviceInterfaceName: Types.toTypeName(`I${PascalCase}UpdateService`),
|
|
338
|
+
serviceVariableName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
339
|
+
actionModelDiscriminantName: Types.toVariableName(`${camelCase}`),
|
|
340
|
+
decoders: {
|
|
341
|
+
name: Types.toVariableName(`${camelCase}Decoders`),
|
|
342
|
+
create: Types.toFunctionName(`${camelCase}CreateDecoder`),
|
|
343
|
+
update: Types.toFunctionName(`${camelCase}UpdateDecoder`),
|
|
344
|
+
upsert: Types.toFunctionName(`${camelCase}UpsertDecoder`),
|
|
345
|
+
clone: Types.toFunctionName(`${camelCase}CloneDecoder`),
|
|
346
|
+
},
|
|
347
|
+
cloneContextMap: Types.toVariableName(`${camelCase}`),
|
|
360
348
|
dataRepositoryVariableName: Types.toVariableName(`data`),
|
|
361
349
|
},
|
|
362
350
|
seed: {
|
|
363
|
-
|
|
351
|
+
location: Types.toModuleLocation('seed-data', `${config.paths.seedDataPath}001-base-data/${uncapitalizedPlural}.seed`),
|
|
364
352
|
constantName: Types.toVariableName(`${uncapitalizedPlural}`),
|
|
365
|
-
importPath: Types.toBackendModulePath(`@backend/seed`),
|
|
366
353
|
},
|
|
367
354
|
react: {
|
|
368
355
|
folderName: Types.toFolderName(`${PascalCase}`),
|
|
@@ -16,12 +16,19 @@ export type SchemaConfig = {
|
|
|
16
16
|
*/
|
|
17
17
|
actionsPath: Types.FilePath;
|
|
18
18
|
/**
|
|
19
|
-
* Path to the directory containing business logic.
|
|
19
|
+
* Path to the directory containing business view logic.
|
|
20
20
|
*
|
|
21
21
|
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
22
|
-
* may reference mock data using `@backend/
|
|
22
|
+
* may reference mock data using `@backend/view` import.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
businessViewLogicPath: Types.FilePath;
|
|
25
|
+
/**
|
|
26
|
+
* Path to the directory containing business update logic.
|
|
27
|
+
*
|
|
28
|
+
* NOTE: Metadata assumes that project is set up so that certain parts of the code
|
|
29
|
+
* may reference mock data using `@backend/update` import.
|
|
30
|
+
*/
|
|
31
|
+
businessUpdateLogicPath: Types.FilePath;
|
|
25
32
|
/**
|
|
26
33
|
* Path to the directory containing Playwright project.
|
|
27
34
|
*/
|
|
@@ -133,6 +133,33 @@ export declare const toFolderName: (t: string) => FolderName;
|
|
|
133
133
|
export type FilePath = string & {
|
|
134
134
|
readonly ___type: 'FilePath';
|
|
135
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* The combination of a file path and the import path to the file in a module.
|
|
138
|
+
*/
|
|
139
|
+
export type ModuleLocation = {
|
|
140
|
+
/**
|
|
141
|
+
* The path to the file, e.g. `/backend/libs/update/src/update.module`.
|
|
142
|
+
*/
|
|
143
|
+
path: FilePath;
|
|
144
|
+
/**
|
|
145
|
+
* The import path to the file, e.g. `@backend/update/update.module`.
|
|
146
|
+
*/
|
|
147
|
+
import: BackendModulePath;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Converts a absolute module file path and a module name to a concrete location.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
*
|
|
154
|
+
* ```ts
|
|
155
|
+
* toModuleLocation(`actions`, `./backend/libs/actions/src/dispatcher.service`)
|
|
156
|
+
* // {
|
|
157
|
+
* // path: '/backend/libs/actions/src/dispatcher.service',
|
|
158
|
+
* // import: '@backend/actions/dispatcher.service'
|
|
159
|
+
* // }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export declare const toModuleLocation: (moduleName: string, absoluteFilePath: string) => ModuleLocation;
|
|
136
163
|
/**
|
|
137
164
|
* Converts a string to a branded BackendModulePath.
|
|
138
165
|
*/
|
package/dist/lib/schema/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// MARK: - Generated content related types
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.toPath = exports.toBackendModulePath = exports.toFolderName = exports.toFileName = exports.toVariableName = exports.toFunctionName = exports.toEnumName = exports.toFieldName = exports.isAnnotatedTypeName = exports.toAnnotatedTypeName = exports.toTypeName = exports.toModelName = exports.toDiscriminantName = exports.toClassName = void 0;
|
|
4
|
+
exports.toPath = exports.toBackendModulePath = exports.toModuleLocation = exports.toFolderName = exports.toFileName = exports.toVariableName = exports.toFunctionName = exports.toEnumName = exports.toFieldName = exports.isAnnotatedTypeName = exports.toAnnotatedTypeName = exports.toTypeName = exports.toModelName = exports.toDiscriminantName = exports.toClassName = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* Converts a raw string to a branded ClassName.
|
|
7
7
|
*/
|
|
@@ -67,6 +67,33 @@ exports.toFileName = toFileName;
|
|
|
67
67
|
*/
|
|
68
68
|
const toFolderName = (t) => t;
|
|
69
69
|
exports.toFolderName = toFolderName;
|
|
70
|
+
/**
|
|
71
|
+
* Converts a absolute module file path and a module name to a concrete location.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* toModuleLocation(`actions`, `./backend/libs/actions/src/dispatcher.service`)
|
|
77
|
+
* // {
|
|
78
|
+
* // path: '/backend/libs/actions/src/dispatcher.service',
|
|
79
|
+
* // import: '@backend/actions/dispatcher.service'
|
|
80
|
+
* // }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
const toModuleLocation = (moduleName, absoluteFilePath) => {
|
|
84
|
+
// NOTE: We assume that the file path contains the backend path and a module name
|
|
85
|
+
// and a file is located in the `src` or `e2e` folder.
|
|
86
|
+
const TEST = new RegExp(`(^.+/${moduleName}/src/)|(^.+/e2e/)`);
|
|
87
|
+
if (!absoluteFilePath.match(TEST)) {
|
|
88
|
+
throw new Error(`The file path "${absoluteFilePath}" does not contain the module name "${moduleName}" or is not located in the "src" or "e2e" folder!`);
|
|
89
|
+
}
|
|
90
|
+
const importPath = absoluteFilePath.replace(TEST, `${moduleName}/`);
|
|
91
|
+
return {
|
|
92
|
+
path: (0, exports.toPath)(absoluteFilePath),
|
|
93
|
+
import: (0, exports.toBackendModulePath)(`@backend/${importPath}`),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.toModuleLocation = toModuleLocation;
|
|
70
97
|
/**
|
|
71
98
|
* Converts a string to a branded BackendModulePath.
|
|
72
99
|
*/
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SchemaMetaData } from '../../lib/meta';
|
|
2
|
-
import { Model } from '../../lib/schema/schema';
|
|
3
|
-
/**
|
|
4
|
-
* Generates index file for all businessLogic update files.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateBusinessLogicUpdateIndex({ models, meta }: {
|
|
7
|
-
models: Model[];
|
|
8
|
-
meta: SchemaMetaData;
|
|
9
|
-
}): string;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateBusinessLogicUpdateIndex = void 0;
|
|
4
|
-
const exports_1 = require("../../lib/exports");
|
|
5
|
-
const meta_1 = require("../../lib/meta");
|
|
6
|
-
/**
|
|
7
|
-
* Generates index file for all businessLogic update files.
|
|
8
|
-
*/
|
|
9
|
-
function generateBusinessLogicUpdateIndex({ models, meta }) {
|
|
10
|
-
const exports = exports_1.ExportsGenerator.from(meta.businessLogic.update.indexFilePath);
|
|
11
|
-
exports.exportEverythingFromPath(meta.businessLogic.update.serviceFilePath);
|
|
12
|
-
exports.exportEverythingFromPath(meta.businessLogic.update.moduleFilePath);
|
|
13
|
-
exports.exportEverythingFromPath(meta.businessLogic.update.actionTypesFilePath);
|
|
14
|
-
for (const model of models) {
|
|
15
|
-
const meta = (0, meta_1.getModelMetadata)({ model });
|
|
16
|
-
exports.exportSelectionFromPath(meta.businessLogic.update.serviceFilePath, [
|
|
17
|
-
meta.businessLogic.update.serviceClassName,
|
|
18
|
-
meta.businessLogic.update.decoders.name,
|
|
19
|
-
]);
|
|
20
|
-
}
|
|
21
|
-
return exports.generate();
|
|
22
|
-
}
|
|
23
|
-
exports.generateBusinessLogicUpdateIndex = generateBusinessLogicUpdateIndex;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SchemaMetaData } from '../../lib/meta';
|
|
2
|
-
import { Model } from '../../lib/schema/schema';
|
|
3
|
-
/**
|
|
4
|
-
* Generates index file for all businessLogic view files.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateBusinessLogicViewIndex({ models, meta }: {
|
|
7
|
-
models: Model[];
|
|
8
|
-
meta: SchemaMetaData;
|
|
9
|
-
}): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateBusinessLogicViewIndex = void 0;
|
|
4
|
-
const exports_1 = require("../../lib/exports");
|
|
5
|
-
const meta_1 = require("../../lib/meta");
|
|
6
|
-
/**
|
|
7
|
-
* Generates index file for all businessLogic view files.
|
|
8
|
-
*/
|
|
9
|
-
function generateBusinessLogicViewIndex({ models, meta }) {
|
|
10
|
-
const exports = exports_1.ExportsGenerator.from(meta.businessLogic.view.indexFilePath);
|
|
11
|
-
exports.exportEverythingFromPath(meta.businessLogic.view.serviceFilePath);
|
|
12
|
-
exports.exportEverythingFromPath(meta.businessLogic.view.moduleFilePath);
|
|
13
|
-
for (const model of models) {
|
|
14
|
-
const meta = (0, meta_1.getModelMetadata)({ model });
|
|
15
|
-
exports.exportEverythingFromPath(meta.businessLogic.view.serviceFilePath);
|
|
16
|
-
}
|
|
17
|
-
return exports.generate();
|
|
18
|
-
}
|
|
19
|
-
exports.generateBusinessLogicViewIndex = generateBusinessLogicViewIndex;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SchemaMetaData } from '../../lib/meta';
|
|
2
|
-
import { Model } from '../../lib/schema/schema';
|
|
3
|
-
/**
|
|
4
|
-
* Generates an index file that exports all stubs.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateStubsIndex({ models, meta }: {
|
|
7
|
-
models: Model[];
|
|
8
|
-
meta: SchemaMetaData;
|
|
9
|
-
}): string;
|
|
10
|
-
/**
|
|
11
|
-
* Generates an index file that exports all stubs for the data mocker.
|
|
12
|
-
*/
|
|
13
|
-
export declare function generateDataMockerStubsIndex({ models, meta }: {
|
|
14
|
-
models: Model[];
|
|
15
|
-
meta: SchemaMetaData;
|
|
16
|
-
}): string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateDataMockerStubsIndex = exports.generateStubsIndex = void 0;
|
|
4
|
-
const exports_1 = require("../../lib/exports");
|
|
5
|
-
const meta_1 = require("../../lib/meta");
|
|
6
|
-
/**
|
|
7
|
-
* Generates an index file that exports all stubs.
|
|
8
|
-
*/
|
|
9
|
-
function generateStubsIndex({ models, meta }) {
|
|
10
|
-
const exports = exports_1.ExportsGenerator.from(meta.data.stubIndexFilePath);
|
|
11
|
-
for (const model of models) {
|
|
12
|
-
const meta = (0, meta_1.getModelMetadata)({ model });
|
|
13
|
-
exports.exportEverythingFromPath(meta.data.stubFilePath);
|
|
14
|
-
}
|
|
15
|
-
return exports.generate();
|
|
16
|
-
}
|
|
17
|
-
exports.generateStubsIndex = generateStubsIndex;
|
|
18
|
-
/**
|
|
19
|
-
* Generates an index file that exports all stubs for the data mocker.
|
|
20
|
-
*/
|
|
21
|
-
function generateDataMockerStubsIndex({ models, meta }) {
|
|
22
|
-
const exports = exports_1.ExportsGenerator.from(meta.e2e.dataMocker.stubIndexFilePath);
|
|
23
|
-
for (const model of models) {
|
|
24
|
-
const meta = (0, meta_1.getModelMetadata)({ model });
|
|
25
|
-
exports.exportEverythingFromPath(meta.e2e.dataMockerStubFilePath);
|
|
26
|
-
}
|
|
27
|
-
return exports.generate();
|
|
28
|
-
}
|
|
29
|
-
exports.generateDataMockerStubsIndex = generateDataMockerStubsIndex;
|