gg-mysql-connector 1.0.33 → 1.0.35

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.
@@ -230,8 +230,13 @@ class ModelGenerator {
230
230
  const possibleValue = getPossibleColumnValue(cRow.TABLE_NAME, cRow.COLUMN_NAME);
231
231
  if (possibleValue) {
232
232
  value = `${value} \n ${cRow.COLUMN_NAME}: [${possibleValue
233
- .map((row) => `"${row}"`)
234
- .join(" , ")}],`;
233
+ .map((row) => {
234
+ if (typeof row === "string")
235
+ return `"${row}"`;
236
+ else if (typeof row === "number")
237
+ return `${row}`;
238
+ })
239
+ .join(" , ")}] as ${typeof possibleValue[0]}[],`;
235
240
  }
236
241
  else {
237
242
  value = `${value} \n ${cRow.COLUMN_NAME}: "${convertDataType(cRow.DATA_TYPE)}",`;
@@ -247,7 +252,16 @@ class ModelGenerator {
247
252
  }
248
253
  }
249
254
  const fileName = `${params.appName}_model_const.ts`;
250
- const code = `export const ${params.appName}_model_const = { ${array.join(",")} }`;
255
+ const code = `
256
+ type paramType = "number" | "string" | "any" | string[] | number[]
257
+ interface constInterface {
258
+ [keytable: string]: {
259
+ [key: string]: paramType
260
+ }
261
+ }
262
+
263
+
264
+ export const ${params.appName}_model_const : constInterface = { ${array.join(",")} } as const`;
251
265
  for (let row of params.outputDirectory) {
252
266
  const serverFilePath = path_1.default.join(row, fileName);
253
267
  await fs_1.default.writeFileSync(serverFilePath, code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg-mysql-connector",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -297,8 +297,11 @@ export default class ModelGenerator {
297
297
  )
298
298
  if (possibleValue) {
299
299
  value = `${value} \n ${cRow.COLUMN_NAME}: [${possibleValue
300
- .map((row) => `"${row}"`)
301
- .join(" , ")}],`
300
+ .map((row) => {
301
+ if (typeof row === "string") return `"${row}"`
302
+ else if (typeof row === "number") return `${row}`
303
+ })
304
+ .join(" , ")}] as ${typeof possibleValue[0]}[],`
302
305
  } else {
303
306
  value = `${value} \n ${cRow.COLUMN_NAME}: "${convertDataType(
304
307
  cRow.DATA_TYPE
@@ -315,9 +318,18 @@ export default class ModelGenerator {
315
318
  }
316
319
  }
317
320
  const fileName = `${params.appName}_model_const.ts`
318
- const code = `export const ${params.appName}_model_const = { ${array.join(
319
- ","
320
- )} }`
321
+ const code = `
322
+ type paramType = "number" | "string" | "any" | string[] | number[]
323
+ interface constInterface {
324
+ [keytable: string]: {
325
+ [key: string]: paramType
326
+ }
327
+ }
328
+
329
+
330
+ export const ${
331
+ params.appName
332
+ }_model_const : constInterface = { ${array.join(",")} } as const`
321
333
 
322
334
  for (let row of params.outputDirectory) {
323
335
  const serverFilePath = path.join(row, fileName)