@postxl/generator 0.49.1 → 0.49.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/dist/generator.js
CHANGED
|
@@ -314,11 +314,10 @@ function generate({ models, enums, config, prismaClientPath, logger, }) {
|
|
|
314
314
|
let prettierConfig = null;
|
|
315
315
|
const prettierConfigFilePath = yield prettier.resolveConfigFile(process.cwd());
|
|
316
316
|
if (prettierConfigFilePath) {
|
|
317
|
-
console.log(`Found prettier config file at ${prettierConfigFilePath}!`);
|
|
318
317
|
prettierConfig = yield prettier.resolveConfig(prettierConfigFilePath);
|
|
319
318
|
}
|
|
320
319
|
if (!prettierConfig) {
|
|
321
|
-
console.
|
|
320
|
+
console.warn(`Could not find Prettier configuration! Formatting files with default config!`);
|
|
322
321
|
}
|
|
323
322
|
yield generated.formatUTF8Files(prettierConfig);
|
|
324
323
|
// -------------------------------------------------------------------------
|
|
@@ -128,7 +128,7 @@ export class ${meta.importExport.importService.name} {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* Generic function to determine
|
|
131
|
+
* Generic function to determine what action (create/update/delete/unchanged) to take with an item
|
|
132
132
|
* In case the type is update it also includes the delta for a given item. In case of delete, it also includes
|
|
133
133
|
* the existing item.
|
|
134
134
|
*
|
|
@@ -43,6 +43,10 @@ const ${singular}ExcelRowImportDecoder = ${singular}ExcelRowImportDecoderInput.t
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* The decoder to identify blank rows in the ${userFriendly} table
|
|
46
|
+
*
|
|
47
|
+
* Excel tables often contain blank rows - esp. when the table has 0 entries, the table in Excel contains a single row with empty values.
|
|
48
|
+
* This decoder identifies these rows and converts them to undefined.
|
|
49
|
+
* 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.
|
|
46
50
|
*/
|
|
47
51
|
const blank${singularCapitalized}ExcelRowImportDecoderInput = z
|
|
48
52
|
.object({
|
|
@@ -52,6 +56,8 @@ const blank${singularCapitalized}ExcelRowImportDecoderInput = z
|
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* The decoder for an Excel table that contains ${userFriendly} entries
|
|
59
|
+
*
|
|
60
|
+
* 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.
|
|
55
61
|
*/
|
|
56
62
|
export const ${tableImportDecoder} = z
|
|
57
63
|
.array(blank${singularCapitalized}ExcelRowImportDecoderInput.or(${singular}ExcelRowImportDecoder))
|
package/dist/prisma/parse.js
CHANGED
|
@@ -158,7 +158,7 @@ function parseModel({ dmmfModel, enums, models, config, }) {
|
|
|
158
158
|
if (dmmfField.relationOnDelete && dmmfField.relationOnDelete !== 'NoAction') {
|
|
159
159
|
(0, error_1.throwError)(`Investigate model ${highlight(dmmfModel.name)}: "onDelete" attribute for relationship ${highlight(dmmfField.relationName)} must be "NoAction": any deletes must be handled in the application layer, e.g. to update repository and search caches!`);
|
|
160
160
|
}
|
|
161
|
-
//
|
|
161
|
+
// NOTE: At this point, we only have the `ModelCore`. After all models are parsed, we need to updated
|
|
162
162
|
// the relations with the full `Model`. This is done in the `linkModels` function.
|
|
163
163
|
relations[dmmfField.relationFromFields[0]] = referencedModel;
|
|
164
164
|
}
|