prisma-generator-accel-record
Advanced tools
Comparing version 1.10.1 to 1.11.0
@@ -59,2 +59,3 @@ "use strict"; | ||
export interface ${model.persistedModel} extends ${model.baseModel} {${columnForPersist(model)}}; | ||
type ${model.associationKey} = ${associationKey(model)}; | ||
type ${model.collection}<T extends ${model.baseModel}> = Collection<T, ${model.meta}> | Collection<${model.persistedModel}, ${model.meta}>; | ||
@@ -65,3 +66,4 @@ type ${model.meta} = { | ||
Persisted: ${model.persistedModel}; | ||
AssociationKey: ${associationKey(model)}; | ||
AssociationKey: ${model.associationKey}; | ||
JoinInput: ${model.associationKey} | ${model.associationKey}[]${joinInputs(model)}; | ||
Column: {${columnMeta(model)}}; | ||
@@ -186,19 +188,25 @@ CreateInput: {${createInputs(model)}}${associationColumns}; | ||
const whereInputs = (model) => model.fields | ||
.filter((field) => { | ||
var _a, _b; | ||
return field.relationName == undefined || | ||
((_b = (_a = field.relationFromFields) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0; | ||
}) | ||
.filter((field) => field.type != "Json") | ||
.map((field) => { | ||
const type = field.typeName; | ||
const filter = getFilterType(type); | ||
if (field.relationName) { | ||
if (field.name == "posts") | ||
console.log(field); | ||
return `\n ${field.name}?: ${field.type} | ${field.type}[];`; | ||
var _a, _b; | ||
if (!field.relationName) { | ||
const type = field.typeName; | ||
const filter = getFilterType(type); | ||
return `\n ${field.name}?: ${type} | ${type}[] | ${filter} | null;`; | ||
} | ||
return `\n ${field.name}?: ${type} | ${type}[] | ${filter} | null;`; | ||
if (((_b = (_a = field.relationFromFields) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) == 0) { | ||
return `\n ${field.name}?: ${field.model.meta}['WhereInput'];`; | ||
} | ||
return `\n ${field.name}?: ${field.type} | ${field.type}[] | ${field.model.meta}['WhereInput'];`; | ||
}) | ||
.join("") + "\n "; | ||
const joinInputs = (model) => { | ||
const fields = model.fields.filter((field) => field.relationName); | ||
if (fields.length == 0) | ||
return ""; | ||
const types = fields | ||
.map((f) => `\n ${f.name}?: Meta<${f.model.persistedModel}>['JoinInput'];`) | ||
.join(""); | ||
return ` | {${types}\n }`; | ||
}; | ||
//# sourceMappingURL=type.js.map |
@@ -74,2 +74,5 @@ "use strict"; | ||
} | ||
get associationKey() { | ||
return `${this.model.name}AssociationKey`; | ||
} | ||
get fileName() { | ||
@@ -76,0 +79,0 @@ return (0, _1.toCamelCase)(this.model.name); |
{ | ||
"name": "prisma-generator-accel-record", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/generator.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122657
63
2359
31
2
2
31