@postxl/generator 0.70.3 → 0.71.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.
Files changed (26) hide show
  1. package/dist/generator.js +36 -27
  2. package/dist/generators/indices/data/service.generator.js +1 -1
  3. package/dist/generators/indices/dispatcher-service.generator.js +3 -3
  4. package/dist/generators/indices/{import-export/importexport-import-service.generator.d.ts → export/class.generator.d.ts} +2 -2
  5. package/dist/generators/indices/{import-export/importexport-exporter-class.generator.js → export/class.generator.js} +19 -19
  6. package/dist/generators/indices/{import-export/importexport-exporter-class.generator.d.ts → export/encoder.generator.d.ts} +2 -2
  7. package/dist/generators/indices/export/encoder.generator.js +50 -0
  8. package/dist/generators/indices/{import-export/importexport-convert-import-functions.generator.d.ts → import/convert-functions.generator.d.ts} +2 -2
  9. package/dist/generators/indices/{import-export/importexport-convert-import-functions.generator.js → import/convert-functions.generator.js} +15 -17
  10. package/dist/generators/indices/import/decoder.generator.d.ts +9 -0
  11. package/dist/generators/indices/import/decoder.generator.js +40 -0
  12. package/dist/generators/indices/import/service.generator.d.ts +9 -0
  13. package/dist/generators/indices/{import-export/importexport-import-service.generator.js → import/service.generator.js} +20 -20
  14. package/dist/generators/indices/{import-export/importexport-types.generator.d.ts → import/types.generator.d.ts} +2 -2
  15. package/dist/generators/indices/{import-export/importexport-types.generator.js → import/types.generator.js} +7 -7
  16. package/dist/generators/indices/seed-migration.generator.js +2 -4
  17. package/dist/generators/indices/seed-template.generator.js +1 -1
  18. package/dist/generators/models/export/encoder.generator.d.ts +9 -0
  19. package/dist/generators/models/export/encoder.generator.js +42 -0
  20. package/dist/generators/models/import/decoder.generator.d.ts +9 -0
  21. package/dist/generators/models/{importexport-decoder.generator.js → import/decoder.generator.js} +24 -97
  22. package/dist/lib/meta.d.ts +91 -55
  23. package/dist/lib/meta.js +35 -23
  24. package/dist/lib/schema/schema.d.ts +10 -3
  25. package/package.json +1 -1
  26. package/dist/generators/models/importexport-decoder.generator.d.ts +0 -16
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateImportExportImportService = void 0;
3
+ exports.generateImportService = void 0;
4
4
  const imports_1 = require("../../../lib/imports");
5
5
  const meta_1 = require("../../../lib/meta");
6
6
  const types_1 = require("../../../lib/schema/types");
7
7
  const string_1 = require("../../../lib/utils/string");
8
8
  /**
9
- * Generates the Exporter class for the Import-Export module
9
+ * Generates the Import Service class for the Import module
10
10
  */
11
- function generateImportExportImportService({ models, meta }) {
12
- const imports = imports_1.ImportsGenerator.from(meta.importExport.importService.location.path);
13
- const { types, decoder, converterFunctions } = meta.importExport;
11
+ function generateImportService({ models, meta }) {
12
+ const imports = imports_1.ImportsGenerator.from(meta.import.importService.location.path);
13
+ const { types, decoder, converterFunctions } = meta.import;
14
14
  const { delta_Fields, delta, delta_Model } = types;
15
15
  const { create, errors, unchanged, update } = delta_Model;
16
16
  const { nonUnique, invalidReference, invalidType, isRequiredDependency, missingField } = errors;
@@ -60,15 +60,15 @@ type Delta_Result<Model extends ${dto.genericModel}<ID>, ID extends ${dto.idType
60
60
  | { type: '${unchanged.discriminant}' }
61
61
 
62
62
  @Injectable()
63
- export class ${meta.importExport.importService.name} {
63
+ export class ${meta.import.importService.name} {
64
64
  constructor(
65
65
  private readonly data: ${meta.data.dataService.class},
66
66
  private readonly dispatcher: ${meta.actions.dispatcher.class},
67
67
  ) {
68
- // We have a circular dependency between DispatcherService and ${meta.importExport.importService.name}.
68
+ // We have a circular dependency between DispatcherService and ${meta.import.importService.name}.
69
69
  // In order to avoid trouble, instead of using Nest's forwardRef(), we inject the dispatcher service here
70
- // and set the dispatcher's ${meta.importExport.importService.sharedName} to this instance.
71
- this.dispatcher.${meta.importExport.importService.sharedName} =this
70
+ // and set the dispatcher's ${meta.import.importService.sharedName} to this instance.
71
+ this.dispatcher.${meta.import.importService.sharedName} =this
72
72
  }
73
73
 
74
74
 
@@ -122,7 +122,7 @@ export class ${meta.importExport.importService.name} {
122
122
  data,
123
123
  execution
124
124
  }: {
125
- data: ${meta.importExport.decoder.decodedPXLModelDataTypeName};
125
+ data: ${meta.import.decoder.decodedPXLModelDataTypeName};
126
126
  execution: ${meta.actions.execution.interface}
127
127
  }) {
128
128
  const { bulkMutations } = await this.detectDelta(data)
@@ -445,15 +445,15 @@ function deltaToUpdateDtoFunction<Model extends ${dto.genericModel}<ID>, ID exte
445
445
  return updateDTO
446
446
  }`;
447
447
  }
448
- exports.generateImportExportImportService = generateImportExportImportService;
448
+ exports.generateImportService = generateImportService;
449
449
  function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imports, }) {
450
- const { types } = schemaMeta.importExport;
450
+ const { types } = schemaMeta.import;
451
451
  const { delta_Model } = types;
452
452
  imports.addTypeImport({
453
453
  from: types.location.path,
454
- items: [modelMeta.importExport.delta_Model_Errors],
454
+ items: [modelMeta.import.delta_Model_Errors],
455
455
  });
456
- const returnType = `${delta_Model.type}<${model.typeName}, ${modelMeta.types.brandedIdType}, ${modelMeta.importExport.delta_Model_Errors}>[]`;
456
+ const returnType = `${delta_Model.type}<${model.typeName}, ${modelMeta.types.brandedIdType}, ${modelMeta.import.delta_Model_Errors}>[]`;
457
457
  const sharedValidations = [];
458
458
  const requiredFields = [];
459
459
  const fieldNames = [];
@@ -472,7 +472,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
472
472
  if (field.kind === 'scalar') {
473
473
  if (field.isUnique) {
474
474
  imports.addTypeImport({
475
- from: schemaMeta.importExport.types.location.path,
475
+ from: schemaMeta.import.types.location.path,
476
476
  items: [delta_Model.errors.nonUnique.type],
477
477
  });
478
478
  const getByName = `getBy${(0, string_1.toPascalCase)(fieldName)}`;
@@ -484,7 +484,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
484
484
  }
485
485
  if (field.validation && field.validation.type === 'int') {
486
486
  imports.addTypeImport({
487
- from: schemaMeta.importExport.types.location.path,
487
+ from: schemaMeta.import.types.location.path,
488
488
  items: [delta_Model.errors.invalidType.type],
489
489
  });
490
490
  sharedValidations.push(`this.validateInt({item, fieldName: '${fieldName}'})`);
@@ -493,7 +493,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
493
493
  else if (field.kind === 'relation') {
494
494
  const relatedModelMeta = (0, meta_1.getModelMetadata)({ model: field.relationToModel });
495
495
  imports.addTypeImport({
496
- from: schemaMeta.importExport.types.location.path,
496
+ from: schemaMeta.import.types.location.path,
497
497
  items: [delta_Model.errors.invalidReference.type],
498
498
  });
499
499
  sharedValidations.push(`this.validateReferenceField({
@@ -516,7 +516,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
516
516
  continue;
517
517
  }
518
518
  imports.addTypeImport({
519
- from: schemaMeta.importExport.types.location.path,
519
+ from: schemaMeta.import.types.location.path,
520
520
  items: [delta_Model.errors.isRequiredDependency.type],
521
521
  });
522
522
  const relatedModelMeta = (0, meta_1.getModelMetadata)({ model: relatedModel });
@@ -534,7 +534,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
534
534
  }
535
535
  if (requiredFields.length > 0) {
536
536
  imports.addTypeImport({
537
- from: schemaMeta.importExport.types.location.path,
537
+ from: schemaMeta.import.types.location.path,
538
538
  items: [delta_Model.errors.missingField.type],
539
539
  });
540
540
  }
@@ -554,7 +554,7 @@ function generateDetectDeltaFunction({ model, modelMeta, models, schemaMeta, imp
554
554
  private async detect${modelMeta.internalSingularNameCapitalized}Delta(
555
555
  items?: ${model.typeName}[]
556
556
  ): Promise<${returnType}> {
557
- const sharedValidations: (item: ${model.name}) => Promise<(${modelMeta.importExport.delta_Model_Errors} | undefined)[]> =
557
+ const sharedValidations: (item: ${model.name}) => Promise<(${modelMeta.import.delta_Model_Errors} | undefined)[]> =
558
558
  ${sharedValidationsFunction}
559
559
 
560
560
  return this.detectModelDelta({
@@ -1,9 +1,9 @@
1
1
  import { SchemaMetaData } from '../../../lib/meta';
2
2
  import { Model } from '../../../lib/schema/schema';
3
3
  /**
4
- * Generates types for import export module.
4
+ * Generates types for import module.
5
5
  */
6
- export declare function generateImportExportTypes({ models, meta }: {
6
+ export declare function generateImportTypes({ models, meta }: {
7
7
  models: Model[];
8
8
  meta: SchemaMetaData;
9
9
  }): string;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateImportExportTypes = void 0;
3
+ exports.generateImportTypes = void 0;
4
4
  const imports_1 = require("../../../lib/imports");
5
5
  const meta_1 = require("../../../lib/meta");
6
6
  /**
7
- * Generates types for import export module.
7
+ * Generates types for import module.
8
8
  */
9
- function generateImportExportTypes({ models, meta }) {
10
- const { types } = meta.importExport;
9
+ function generateImportTypes({ models, meta }) {
10
+ const { types } = meta.import;
11
11
  const imports = imports_1.ImportsGenerator.from(types.location.path);
12
12
  const dto = meta.types.dto;
13
13
  imports
@@ -93,11 +93,11 @@ function generateImportExportTypes({ models, meta }) {
93
93
  if (modelErrorTypes.length === 0) {
94
94
  modelErrorTypes.push(`never`);
95
95
  }
96
- errorTypes.push(`export type ${modelMeta.importExport.delta_Model_Errors} = ${modelErrorTypes.join('\n| ')}`);
96
+ errorTypes.push(`export type ${modelMeta.import.delta_Model_Errors} = ${modelErrorTypes.join('\n| ')}`);
97
97
  deltaTypes.push(`${modelMeta.seed.constantName}?: ${types.delta_Model.type}<
98
98
  ${modelMeta.types.typeName},
99
99
  ${modelMeta.types.brandedIdType},
100
- ${modelMeta.importExport.delta_Model_Errors}
100
+ ${modelMeta.import.delta_Model_Errors}
101
101
  >[]`);
102
102
  }
103
103
  return /* ts */ `
@@ -239,4 +239,4 @@ export type DataChanges = {
239
239
  bulkMutations: ${meta.data.types.bulkMutation}[]
240
240
  }`;
241
241
  }
242
- exports.generateImportExportTypes = generateImportExportTypes;
242
+ exports.generateImportTypes = generateImportTypes;
@@ -14,9 +14,7 @@ function generateSeedMigration({ models, meta }) {
14
14
  const modelMeta = (0, meta_1.getModelMetadata)({ model });
15
15
  imports.addImports({
16
16
  [modelMeta.seed.location.path]: [modelMeta.seed.constantName],
17
- [meta.importExport.converterFunctions.location.import]: [
18
- meta.importExport.converterFunctions.importedDataToBulkMutations,
19
- ],
17
+ [meta.import.converterFunctions.location.import]: [meta.import.converterFunctions.importedDataToBulkMutations],
20
18
  [meta.seed.actionsLocation.import]: [(0, types_1.toTypeName)('Action_Seed_Data')],
21
19
  });
22
20
  modelTypes.push(`${modelMeta.seed.constantName}`);
@@ -29,7 +27,7 @@ export const MIGRATION_001_BASEDATA: Action_Seed_Data = {
29
27
  type: 'data',
30
28
  name: 'Base data',
31
29
  order: 1,
32
- payload: ${meta.importExport.converterFunctions.importedDataToBulkMutations}({
30
+ payload: ${meta.import.converterFunctions.importedDataToBulkMutations}({
33
31
  ${modelTypes.join(',\n')}
34
32
  }),
35
33
  }
@@ -62,7 +62,7 @@ function initializeWorkbook() {
62
62
  function addModel({ model, meta, wb }) {
63
63
  const ws = wb.addWorksheet(model.name);
64
64
  const table = ws.addTable({
65
- name: meta.importExport.tableName,
65
+ name: meta.import.tableName,
66
66
  ref: 'A1',
67
67
  headerRow: true,
68
68
  totalsRow: false,
@@ -0,0 +1,9 @@
1
+ import { ModelMetaData } from '../../../lib/meta';
2
+ import { Model } from '../../../lib/schema/schema';
3
+ /**
4
+ * Creates an encoder for the Seed Excel template.
5
+ */
6
+ export declare function generateModelExportEncoder({ model, meta }: {
7
+ model: Model;
8
+ meta: ModelMetaData;
9
+ }): string;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateModelExportEncoder = void 0;
4
+ const imports_1 = require("../../../lib/imports");
5
+ const types_1 = require("../../../lib/schema/types");
6
+ /**
7
+ * Creates an encoder for the Seed Excel template.
8
+ */
9
+ function generateModelExportEncoder({ model, meta }) {
10
+ const { location, itemEncoderFunctionName, encodedExcelType, arrayEncoderFunctionName } = meta.export.encoder;
11
+ const imports = imports_1.ImportsGenerator.from(location.path).addImports({
12
+ [meta.types.importPath]: [(0, types_1.toAnnotatedTypeName)(meta.types.typeName)],
13
+ [meta.import.decoder.location.import]: [meta.import.decoder.rowDecoderName],
14
+ });
15
+ const { userFriendlyName: userFriendly, userFriendlyNamePlural: userFriendlyPlural } = meta;
16
+ /* prettier-ignore */
17
+ return `
18
+ import * as z from 'zod'
19
+
20
+ import { capitalizeKeys } from '@postxl/runtime'
21
+
22
+ ${imports.generate()}
23
+
24
+
25
+ /**
26
+ * The type for rows in the ${userFriendly} table
27
+ */
28
+ export type ${encodedExcelType} = z.infer<typeof ${meta.import.decoder.rowDecoderName}>
29
+
30
+
31
+ /**
32
+ * Converts a ${userFriendly} to an Excel row
33
+ */
34
+ export const ${itemEncoderFunctionName} = (item: ${model.typeName}): ${encodedExcelType} => capitalizeKeys(item)
35
+
36
+ /**
37
+ * Converts a list of ${userFriendlyPlural} to an Excel table
38
+ */
39
+ export const ${arrayEncoderFunctionName} = (items: ${model.typeName}[]): ${encodedExcelType}[] => items.map(${itemEncoderFunctionName})
40
+ `;
41
+ }
42
+ exports.generateModelExportEncoder = generateModelExportEncoder;
@@ -0,0 +1,9 @@
1
+ import { ModelMetaData } from '../../../lib/meta';
2
+ import { Model } from '../../../lib/schema/schema';
3
+ /**
4
+ * Creates a decoder for the Seed Excel template.
5
+ */
6
+ export declare function generateModelImportDecoder({ model, meta }: {
7
+ model: Model;
8
+ meta: ModelMetaData;
9
+ }): string;
@@ -1,78 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateImportExportDecoder = exports.generateModelImportExportDecoder = void 0;
4
- const imports_1 = require("../../lib/imports");
5
- const meta_1 = require("../../lib/meta");
6
- const types_1 = require("../../lib/schema/types");
7
- const types_2 = require("../../lib/types");
3
+ exports.generateModelImportDecoder = void 0;
4
+ const imports_1 = require("../../../lib/imports");
5
+ const meta_1 = require("../../../lib/meta");
6
+ const types_1 = require("../../../lib/schema/types");
7
+ const types_2 = require("../../../lib/types");
8
8
  const zodPackageName = (0, types_1.toPackageName)('@postxl/zod');
9
9
  /**
10
10
  * Creates a decoder for the Seed Excel template.
11
11
  */
12
- function generateModelImportExportDecoder({ model, meta }) {
13
- const { filePath: decoderFilePath, itemEncoderFunctionName: rowExportFunctionName, encodedExcelType: excelType, arrayEncoderFunctionName: tableExportFunctionName, tableDecoder: tableImportDecoder, } = meta.importExport.decoder;
14
- const imports = imports_1.ImportsGenerator.from(decoderFilePath).addImports({
12
+ function generateModelImportDecoder({ model, meta }) {
13
+ const { tableDecoder: tableImportDecoder } = meta.import.decoder;
14
+ const imports = imports_1.ImportsGenerator.from(meta.import.decoder.location.path).addImports({
15
15
  [zodPackageName]: [(0, types_1.toFunctionName)('excelNullOrBlankDecoder')],
16
16
  [meta.types.importPath]: [(0, types_1.toAnnotatedTypeName)(meta.types.typeName)],
17
17
  });
18
- const { userFriendlyName: userFriendly, userFriendlyNamePlural: userFriendlyPlural, internalSingularName: singular, internalSingularNameCapitalized: singularCapitalized, } = meta;
18
+ const { userFriendlyName: userFriendly, internalSingularNameCapitalized: singularCapitalized } = meta;
19
19
  const { fieldDecoders, blankFieldDecoders } = generateFieldDecoders({ model, meta, imports });
20
20
  return `
21
21
  import * as z from 'zod'
22
22
 
23
- import { uncapitalizeKeys, capitalizeKeys } from '@postxl/runtime'
23
+ import { uncapitalizeKeys } from '@postxl/runtime'
24
24
 
25
25
  ${imports.generate()}
26
26
 
27
27
  /**
28
28
  * The decoder for an Excel row containing a ${userFriendly} entry
29
29
  */
30
- const ${singular}ExcelRowImportDecoderInput = z.object({
30
+ export const ${meta.import.decoder.rowDecoderName} = z.object({
31
31
  ${fieldDecoders.join(',\n')}
32
32
  })
33
33
 
34
-
35
- /**
36
- * The type for rows in the ${userFriendly} table
37
- */
38
- export type ${excelType} = z.infer<typeof ${singular}ExcelRowImportDecoderInput>
39
-
40
- const ${singular}ExcelRowImportDecoder = ${singular}ExcelRowImportDecoderInput.transform(uncapitalizeKeys)
41
-
42
34
  /**
43
35
  * The decoder to identify blank rows in the ${userFriendly} table
44
36
  *
45
37
  * Excel tables often contain blank rows - esp. when the table has 0 entries, the table in Excel contains a single row with empty values.
46
38
  * This decoder identifies these rows and converts them to undefined.
47
39
  * In the table decoder, we use a union of the blank row decoder and the actual row decoder to not throw on blank rows - but instead filter them out.
48
- */
49
- const blank${singularCapitalized}ExcelRowImportDecoderInput = z
50
- .object({
51
- ${blankFieldDecoders.join(',\n')}
52
- })
53
- .transform(() => undefined)
40
+ */
41
+ const blank${singularCapitalized}RowDecoder = z
42
+ .object({
43
+ ${blankFieldDecoders.join(',\n')}
44
+ })
45
+ .transform(() => undefined)
54
46
 
55
47
  /**
56
48
  * The decoder for an Excel table that contains ${userFriendly} entries
57
49
  *
58
50
  * We use a union of the blank row decoder and the actual row decoder to not throw on blank rows - but instead filter them out.
59
- */
51
+ */
60
52
  export const ${tableImportDecoder} = z
61
- .array(blank${singularCapitalized}ExcelRowImportDecoderInput.or(${singular}ExcelRowImportDecoder))
62
- .transform((items) => items.filter(Boolean) as ${model.typeName}[])
63
-
64
- /**
65
- * Converts a ${userFriendly} to an Excel row
66
- */
67
- export const ${rowExportFunctionName} = (item: ${model.typeName}): ${excelType} => capitalizeKeys(item)
68
-
69
- /**
70
- * Converts a list of ${userFriendlyPlural} to an Excel table
71
- */
72
- export const ${tableExportFunctionName} = (items: ${model.typeName}[]): ${excelType}[] => items.map(${rowExportFunctionName})
73
- `;
53
+ .array(
54
+ blank${singularCapitalized}RowDecoder
55
+ .or(${meta.import.decoder.rowDecoderName}.transform(uncapitalizeKeys))
56
+ )
57
+ .transform((items) => items.filter(Boolean) as ${model.typeName}[])`;
74
58
  }
75
- exports.generateModelImportExportDecoder = generateModelImportExportDecoder;
59
+ exports.generateModelImportDecoder = generateModelImportDecoder;
76
60
  function generateFieldDecoders({ model, meta, imports, }) {
77
61
  const fieldDecoders = [];
78
62
  const blankFieldDecoders = [];
@@ -152,60 +136,3 @@ function toExcelDecoder({ tsTypeName, nullable, imports, }) {
152
136
  throw new Error('Unknown type');
153
137
  }
154
138
  }
155
- /**
156
- * Generates the data decoder, aggregating all the models.
157
- */
158
- function generateImportExportDecoder({ models, meta }) {
159
- const { decodedPXLModelDataTypeName, encodedExcelDataTypeName, fullDecoderName, fullEncoderFunctionName } = meta.importExport.decoder;
160
- const imports = imports_1.ImportsGenerator.from(meta.importExport.decoder.location.path);
161
- const importTypes = [];
162
- const decoderEntries = [];
163
- const exportFields = [];
164
- for (const model of models) {
165
- const modelMeta = (0, meta_1.getModelMetadata)({ model });
166
- imports.addImport({
167
- from: modelMeta.importExport.decoder.filePath,
168
- items: [
169
- modelMeta.importExport.decoder.tableDecoder,
170
- modelMeta.importExport.decoder.arrayEncoderFunctionName,
171
- (0, types_1.toAnnotatedTypeName)(modelMeta.importExport.decoder.encodedExcelType),
172
- ],
173
- });
174
- importTypes.push(`${modelMeta.importExport.tableName}?: ${modelMeta.importExport.decoder.encodedExcelType}[]`);
175
- decoderEntries.push(`${modelMeta.importExport.tableName}: ${modelMeta.importExport.decoder.tableDecoder}.optional()`);
176
- exportFields.push(`${modelMeta.importExport.tableName}:
177
- data.${modelMeta.importExport.exportDataFullPropertyName} !== undefined ?
178
- ${modelMeta.importExport.decoder.arrayEncoderFunctionName}(data.${modelMeta.importExport.exportDataFullPropertyName})
179
- : undefined`);
180
- }
181
- return `
182
- import * as z from 'zod'
183
-
184
- import { uncapitalizeKeys } from '@postxl/runtime'
185
-
186
- ${imports.generate()}
187
-
188
- export type ${encodedExcelDataTypeName} = {
189
- ${importTypes.join(',\n')}
190
- }
191
-
192
- /**
193
- * Decoder that converts Excel data to model data
194
- */
195
- export const ${fullDecoderName} = z
196
- .object({
197
- ${decoderEntries.join(',\n')}
198
- })
199
- .transform(uncapitalizeKeys)
200
-
201
- export type ${decodedPXLModelDataTypeName} = z.infer<typeof excelDataDecoder>
202
-
203
- /**
204
- * Converts the model data to Excel format
205
- */
206
- export const ${fullEncoderFunctionName} = (data: ${decodedPXLModelDataTypeName}): ${encodedExcelDataTypeName} => ({
207
- ${exportFields.join(',\n')}
208
- })
209
- `;
210
- }
211
- exports.generateImportExportDecoder = generateImportExportDecoder;
@@ -219,11 +219,11 @@ export type SchemaMetaData = {
219
219
  stubIndexFilePath: Types.FilePath;
220
220
  };
221
221
  /**
222
- * Meta data for import/export operations.
222
+ * Meta data for import operations.
223
223
  */
224
- importExport: {
224
+ import: {
225
225
  /**
226
- * Path that may be used to import from the import-export module.
226
+ * Path that may be used to import from the import module.
227
227
  */
228
228
  moduleLocation: Types.ModuleLocation;
229
229
  /**
@@ -238,42 +238,11 @@ export type SchemaMetaData = {
238
238
  * Name of the data decoder function
239
239
  */
240
240
  fullDecoderName: Types.FunctionName;
241
- /**
242
- * Name of the data encoder function
243
- */
244
- fullEncoderFunctionName: Types.FunctionName;
245
- /**
246
- * Name of the type that represents the data in encoded Excel format
247
- */
248
- encodedExcelDataTypeName: Types.TypeName;
249
241
  /**
250
242
  * Name of the type that represents the data in the PXL model format
251
243
  */
252
244
  decodedPXLModelDataTypeName: Types.TypeName;
253
245
  };
254
- /**
255
- * Meta data for the exporter class.
256
- */
257
- exporterClass: {
258
- /**
259
- * Path to the file containing the exporter class.
260
- */
261
- location: Types.ModuleLocation;
262
- /**
263
- * The name of the exporter class.
264
- */
265
- name: Types.ClassName;
266
- };
267
- exportService: {
268
- /**
269
- * Path to the file containing the export service class.
270
- */
271
- location: Types.ModuleLocation;
272
- /**
273
- * The name of the export service class.
274
- */
275
- name: Types.ClassName;
276
- };
277
246
  importService: {
278
247
  /**
279
248
  * Path to the file containing the import service class.
@@ -469,6 +438,55 @@ export type SchemaMetaData = {
469
438
  delta_Fields: Types.TypeName;
470
439
  };
471
440
  };
441
+ /**
442
+ * Meta data for export operations.
443
+ */
444
+ export: {
445
+ /**
446
+ * Path that may be used to import from the export module.
447
+ */
448
+ moduleLocation: Types.ModuleLocation;
449
+ /**
450
+ * Meta data for the exporter class.
451
+ */
452
+ exporterClass: {
453
+ /**
454
+ * Path to the file containing the exporter class.
455
+ */
456
+ location: Types.ModuleLocation;
457
+ /**
458
+ * The name of the exporter class.
459
+ */
460
+ name: Types.ClassName;
461
+ };
462
+ exportService: {
463
+ /**
464
+ * Path to the file containing the export service class.
465
+ */
466
+ location: Types.ModuleLocation;
467
+ /**
468
+ * The name of the export service class.
469
+ */
470
+ name: Types.ClassName;
471
+ };
472
+ /**
473
+ * Meta data for decoder functions.
474
+ */
475
+ encoder: {
476
+ /**
477
+ * Path to the file containing the data encoder
478
+ */
479
+ location: Types.ModuleLocation;
480
+ /**
481
+ * Name of the data encoder function
482
+ */
483
+ fullEncoderFunctionName: Types.FunctionName;
484
+ /**
485
+ * Name of the type that represents the data in encoded Excel format
486
+ */
487
+ encodedExcelDataTypeName: Types.TypeName;
488
+ };
489
+ };
472
490
  view: {
473
491
  /**
474
492
  * The name of the module class
@@ -730,9 +748,43 @@ export type ModelMetaData = {
730
748
  };
731
749
  };
732
750
  /**
733
- * Properties provided by the `importExport` generators
751
+ * Properties provided by the `import` generators
752
+ */
753
+ import: {
754
+ /**
755
+ * The name of the export Excel table (e.g. `Aggregations`).
756
+ */
757
+ tableName: string;
758
+ /**
759
+ * Name of the model specific error type
760
+ */
761
+ delta_Model_Errors: Types.TypeName;
762
+ /**
763
+ * Meta data of the model's Excel decoders
764
+ */
765
+ decoder: {
766
+ /**
767
+ * Location of the file containing the model's Excel decoders.
768
+ */
769
+ location: Types.ModuleLocation;
770
+ /**
771
+ * Name of the decoder function that represents the Excel table import type (e.g. `aggregationExcelTableDecoder`.)
772
+ */
773
+ tableDecoder: Types.FunctionName;
774
+ /**
775
+ * Name of the array in the decoded data containing all entities of this model (e.g. `aggregations`.)
776
+ */
777
+ decodedModelArrayName: Types.VariableName;
778
+ /**
779
+ * Name of the function that decodes a model Excel row (not blank!) to a fully typed object
780
+ */
781
+ rowDecoderName: Types.FunctionName;
782
+ };
783
+ };
784
+ /**
785
+ * Properties provided by the `export` generators
734
786
  */
735
- importExport: {
787
+ export: {
736
788
  /**
737
789
  * Name of the data exports model property (e.g. `Aggregations`).
738
790
  */
@@ -753,30 +805,18 @@ export type ModelMetaData = {
753
805
  * The name of the export Excel table (e.g. `Aggregations`).
754
806
  */
755
807
  tableName: string;
756
- /**
757
- * Name of the model specific error type
758
- */
759
- delta_Model_Errors: Types.TypeName;
760
808
  /**
761
809
  * Meta data of the model's Excel decoders
762
810
  */
763
- decoder: {
811
+ encoder: {
764
812
  /**
765
- * Name of the file containing the model's Excel decoders.
813
+ * Location of the file containing the model's Excel encoders.
766
814
  */
767
- fileName: Types.FileName;
768
- /**
769
- * Path to the file containing the model's Excel decoders.
770
- */
771
- filePath: Types.FilePath;
815
+ location: Types.ModuleLocation;
772
816
  /**
773
817
  * Name of the type that represents the model in Excel import/export (e.g. `Aggregation_EncodedExcelData`.)
774
818
  */
775
819
  encodedExcelType: Types.TypeName;
776
- /**
777
- * Name of the decoder function that represents the Excel table import type (e.g. `aggregationExcelTableDecoder`.)
778
- */
779
- tableDecoder: Types.FunctionName;
780
820
  /**
781
821
  * Name of the function that converts a model item to the Excel format (e.g. `encodeAggregation`.)
782
822
  */
@@ -785,10 +825,6 @@ export type ModelMetaData = {
785
825
  * Name of the function that converts an array of model items to the Excel format (e.g. `encodeAggregations`.)
786
826
  */
787
827
  arrayEncoderFunctionName: Types.FunctionName;
788
- /**
789
- * Name of the array in the decoded data containing all entities of this model (e.g. `aggregations`.)
790
- */
791
- decodedModelArrayName: Types.VariableName;
792
828
  };
793
829
  };
794
830
  /**