routesync 1.0.18 → 1.0.19
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/cli.js +6 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8813,11 +8813,13 @@ var TypeGenerator = class {
|
|
|
8813
8813
|
if (model.hidden && model.hidden.includes(col.name)) continue;
|
|
8814
8814
|
const tsType = this.mapSqlTypeToTs(col.type);
|
|
8815
8815
|
const isOptional = col.nullable ? "?" : "";
|
|
8816
|
-
|
|
8816
|
+
const safeName = camelCase(col.name).match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/) ? camelCase(col.name) : `"${camelCase(col.name)}"`;
|
|
8817
|
+
lines.push(` ${safeName}${isOptional}: ${tsType}`);
|
|
8817
8818
|
}
|
|
8818
8819
|
if (model.appends && model.appends.length > 0) {
|
|
8819
8820
|
for (const append of model.appends) {
|
|
8820
|
-
|
|
8821
|
+
const safeAppend = camelCase(append).match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/) ? camelCase(append) : `"${camelCase(append)}"`;
|
|
8822
|
+
lines.push(` ${safeAppend}?: unknown`);
|
|
8821
8823
|
}
|
|
8822
8824
|
}
|
|
8823
8825
|
lines.push(`}`);
|
|
@@ -8832,8 +8834,8 @@ var TypeGenerator = class {
|
|
|
8832
8834
|
lines.push(`export interface ${typeName} {`);
|
|
8833
8835
|
lines.push(` id: number`);
|
|
8834
8836
|
lines.push(` // TODO: Add ${resource} fields`);
|
|
8835
|
-
lines.push(`
|
|
8836
|
-
lines.push(`
|
|
8837
|
+
lines.push(` createdAt?: string`);
|
|
8838
|
+
lines.push(` updatedAt?: string`);
|
|
8837
8839
|
lines.push(`}`);
|
|
8838
8840
|
lines.push(``);
|
|
8839
8841
|
}
|