gg-mysql-connector 1.0.34 → 1.0.36

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)}",`;
@@ -248,15 +253,7 @@ class ModelGenerator {
248
253
  }
249
254
  const fileName = `${params.appName}_model_const.ts`;
250
255
  const code = `
251
- type paramType = "number" | "string" | "any" | string[] | number[]
252
- interface constInterface {
253
- [keytable: string]: {
254
- [key: string]: paramType
255
- }
256
- }
257
-
258
-
259
- export const ${params.appName}_model_const : constInterface = { ${array.join(",")} }`;
256
+ export const ${params.appName}_model_const = { ${array.join(",")} } as const`;
260
257
  for (let row of params.outputDirectory) {
261
258
  const serverFilePath = path_1.default.join(row, fileName);
262
259
  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.34",
3
+ "version": "1.0.36",
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
@@ -316,17 +319,9 @@ export default class ModelGenerator {
316
319
  }
317
320
  const fileName = `${params.appName}_model_const.ts`
318
321
  const code = `
319
- type paramType = "number" | "string" | "any" | string[] | number[]
320
- interface constInterface {
321
- [keytable: string]: {
322
- [key: string]: paramType
323
- }
324
- }
325
-
326
-
327
- export const ${
328
- params.appName
329
- }_model_const : constInterface = { ${array.join(",")} }`
322
+ export const ${params.appName}_model_const = { ${array.join(
323
+ ","
324
+ )} } as const`
330
325
 
331
326
  for (let row of params.outputDirectory) {
332
327
  const serverFilePath = path.join(row, fileName)