gg-express 1.0.70 → 1.0.73

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.
@@ -67,19 +67,19 @@ export default class GGExpress<appName extends string> {
67
67
  appName: string;
68
68
  constructor(app: Express.Express, appName: appName, outputPath: string[]);
69
69
  private rootMethod;
70
- get<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[], options: {
70
+ get<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName | "seed"}/${string}` | `/api/${appName | "seed"}/${string}`[], options: {
71
71
  requireParams: M;
72
72
  responseStructure: R;
73
73
  }, ...middlewares: Array<(req: MyRequest<M["dataType"], T, K, P, J, L>, res: MyResponse<R["dataType"], RS, KR, PP, J>, next: NextFunction) => any>): Express.Express;
74
- post<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[], options: {
74
+ post<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName | "seed"}/${string}` | `/api/${appName | "seed"}/${string}`[], options: {
75
75
  requireParams: M;
76
76
  responseStructure: R;
77
77
  }, ...middlewares: Array<(req: MyRequest<M["dataType"], T, K, P, J, L>, res: MyResponse<R["dataType"], RS, KR, PP, J>, next: NextFunction) => any>): Express.Express;
78
- put<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[], options: {
78
+ put<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName | "seed"}/${string}` | `/api/${appName | "seed"}/${string}`[], options: {
79
79
  requireParams: M;
80
80
  responseStructure: R;
81
81
  }, ...middlewares: Array<(req: MyRequest<M["dataType"], T, K, P, J, L>, res: MyResponse<R["dataType"], RS, KR, PP, J>, next: NextFunction) => any>): Express.Express;
82
- delete<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[], options: {
82
+ delete<M extends requireParamsStructure, T extends M["structure"], K extends keyof T, R extends responseStructure, RS extends R["structure"], KR extends keyof RS, P extends M["parameter"], PP extends R["parameter"], J extends M["isPartialStructure"], L extends M["isPartialParameter"]>(url: `/api/${appName | "seed"}/${string}` | `/api/${appName | "seed"}/${string}`[], options: {
83
83
  requireParams: M;
84
84
  responseStructure: R;
85
85
  }, ...middlewares: Array<(req: MyRequest<M["dataType"], T, K, P, J, L>, res: MyResponse<R["dataType"], RS, KR, PP, J>, next: NextFunction) => any>): Express.Express;
package/dist/GGExpress.js CHANGED
@@ -150,15 +150,26 @@ class GGExpress {
150
150
  let requireParamCode = `{${[requireParameterCode(), requireDataCode()]
151
151
  .filter((row) => row.length > 0)
152
152
  .join(",")}}`;
153
- return ` "${row.url}" : {
154
- requireParams : ${requireParamCode},
155
- responseStructure : {
156
- status : "SUCCESS" | "ERROR",
157
- message : string,
158
- parameter : {${genParamCodeParameter(row.responseStructure)}}, data : { ${genDataParamCode(row.responseStructure)} } ${isArray(row.responseStructure)}}
159
- } `;
153
+ let tempURL;
154
+ if (Array.isArray(row.url)) {
155
+ tempURL = row.url;
156
+ }
157
+ else {
158
+ tempURL = [tempURL];
159
+ }
160
+ return tempURL
161
+ .map((url) => {
162
+ return ` "${url}" : {
163
+ requireParams : ${requireParamCode},
164
+ responseStructure : {
165
+ status : "SUCCESS" | "ERROR",
166
+ message : string,
167
+ parameter : {${genParamCodeParameter(row.responseStructure)}}, data : { ${genDataParamCode(row.responseStructure)} } ${isArray(row.responseStructure)}}
168
+ } `;
169
+ })
170
+ .join(",");
160
171
  })
161
- .join(",");
172
+ .join(" , ");
162
173
  return rawString;
163
174
  };
164
175
  const getRoute = myExpressRouteList.filter((row) => row.method === "get");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg-express",
3
- "version": "1.0.70",
3
+ "version": "1.0.73",
4
4
  "description": "",
5
5
  "main": "dist/GGExpress.js",
6
6
  "scripts": {
package/src/GGExpress.ts CHANGED
@@ -178,7 +178,9 @@ export default class GGExpress<appName extends string> {
178
178
  J extends M["isPartialStructure"],
179
179
  L extends M["isPartialParameter"]
180
180
  >(
181
- url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[],
181
+ url:
182
+ | `/api/${appName | "seed"}/${string}`
183
+ | `/api/${appName | "seed"}/${string}`[],
182
184
  options: {
183
185
  requireParams: M
184
186
  responseStructure: R
@@ -206,7 +208,9 @@ export default class GGExpress<appName extends string> {
206
208
  J extends M["isPartialStructure"],
207
209
  L extends M["isPartialParameter"]
208
210
  >(
209
- url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[],
211
+ url:
212
+ | `/api/${appName | "seed"}/${string}`
213
+ | `/api/${appName | "seed"}/${string}`[],
210
214
  options: {
211
215
  requireParams: M
212
216
  responseStructure: R
@@ -233,7 +237,9 @@ export default class GGExpress<appName extends string> {
233
237
  J extends M["isPartialStructure"],
234
238
  L extends M["isPartialParameter"]
235
239
  >(
236
- url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[],
240
+ url:
241
+ | `/api/${appName | "seed"}/${string}`
242
+ | `/api/${appName | "seed"}/${string}`[],
237
243
  options: {
238
244
  requireParams: M
239
245
  responseStructure: R
@@ -260,7 +266,9 @@ export default class GGExpress<appName extends string> {
260
266
  J extends M["isPartialStructure"],
261
267
  L extends M["isPartialParameter"]
262
268
  >(
263
- url: `/api/${appName}/${string}` | `/api/${appName}/${string}`[],
269
+ url:
270
+ | `/api/${appName | "seed"}/${string}`
271
+ | `/api/${appName | "seed"}/${string}`[],
264
272
  options: {
265
273
  requireParams: M
266
274
  responseStructure: R
@@ -381,19 +389,30 @@ export default class GGExpress<appName extends string> {
381
389
  .filter((row) => row.length > 0)
382
390
  .join(",")}}`
383
391
 
384
- return ` "${row.url}" : {
385
- requireParams : ${requireParamCode},
386
- responseStructure : {
387
- status : "SUCCESS" | "ERROR",
388
- message : string,
389
- parameter : {${genParamCodeParameter(
390
- row.responseStructure
391
- )}}, data : { ${genDataParamCode(row.responseStructure)} } ${isArray(
392
- row.responseStructure
393
- )}}
394
- } `
392
+ let tempURL
393
+ if (Array.isArray(row.url)) {
394
+ tempURL = row.url
395
+ } else {
396
+ tempURL = [tempURL]
397
+ }
398
+ return tempURL
399
+ .map((url) => {
400
+ return ` "${url}" : {
401
+ requireParams : ${requireParamCode},
402
+ responseStructure : {
403
+ status : "SUCCESS" | "ERROR",
404
+ message : string,
405
+ parameter : {${genParamCodeParameter(
406
+ row.responseStructure
407
+ )}}, data : { ${genDataParamCode(
408
+ row.responseStructure
409
+ )} } ${isArray(row.responseStructure)}}
410
+ } `
411
+ })
412
+ .join(",")
395
413
  })
396
- .join(",")
414
+ .join(" , ")
415
+
397
416
  return rawString
398
417
  }
399
418