gg-express 1.0.155 → 1.0.157
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/main.d.ts +2 -3
- package/dist/main.js +2 -5
- package/dist/v2/generateGGApi_v2.js +1 -1
- package/dist/v3/GGExpressV3.js +1 -1
- package/dist/v3/test.js +2 -2
- package/package.json +1 -1
- package/src/main.ts +3 -3
- package/src/v3/GGExpressV3.ts +1 -1
- package/src/v3/generateStaticRouteFileV3.ts +0 -1
- package/src/v3/test.ts +2 -2
- package/src/GGApi.ts +0 -91
- package/src/GGExpress.ts +0 -537
- package/src/apiConnector_hotel.ts +0 -72
- package/src/helperFunction.ts +0 -3
- package/src/hotel_model_const_temp.ts +0 -23
- package/src/run.test.ts +0 -128
- package/src/staticRouteInterface.ts +0 -29
- package/src/staticRouteInterface_hotel.ts +0 -30
- package/src/v2/GGExpressV2.ts +0 -314
- package/src/v2/generateGGApi_v2.ts +0 -86
- package/src/v2/generateStaticRouteFileV2.ts +0 -175
- package/src/v2/output/apiConnector_hotel_v2.ts +0 -77
- package/src/v2/output/staticRouteInterface_hotel_v2.ts +0 -35
- package/src/v2/run_v2.test.ts +0 -76
- package/src/v2/test_typeResolver.ts +0 -44
- package/src/v2/typeResolver.ts +0 -72
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -3,10 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GGExpressV3 =
|
|
7
|
-
const GGExpress_1 = __importDefault(require("./GGExpress"));
|
|
8
|
-
exports.GGExpress = GGExpress_1.default;
|
|
9
|
-
const GGExpressV2_1 = __importDefault(require("./v2/GGExpressV2"));
|
|
10
|
-
exports.GGExpressV2 = GGExpressV2_1.default;
|
|
6
|
+
exports.GGExpressV3 = void 0;
|
|
11
7
|
const GGExpressV3_1 = __importDefault(require("./v3/GGExpressV3"));
|
|
12
8
|
exports.GGExpressV3 = GGExpressV3_1.default;
|
|
9
|
+
exports.default = GGExpressV3_1.default;
|
|
@@ -9,7 +9,7 @@ function generateGGApi_v2(appName, filePathWithFileName) {
|
|
|
9
9
|
const tempInterfaceName = `staticRouteInterface_${appName}_v2`;
|
|
10
10
|
const code = `
|
|
11
11
|
import axios from "axios"
|
|
12
|
-
import { ${tempInterfaceName} } from "./${tempInterfaceName}"
|
|
12
|
+
import type{ ${tempInterfaceName} } from "./${tempInterfaceName}"
|
|
13
13
|
|
|
14
14
|
export class GGApi_v2 {
|
|
15
15
|
urlPrefix : string
|
package/dist/v3/GGExpressV3.js
CHANGED
|
@@ -91,7 +91,7 @@ class GGExpressV3 {
|
|
|
91
91
|
generateAPIFiles() {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
yield this.generateStaticRouteFile();
|
|
94
|
-
console.log(`
|
|
94
|
+
console.log(`GGExpressV3.ts : ${this.appName} - generate staticRoute done.`);
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
generateStaticRouteFile() {
|
package/dist/v3/test.js
CHANGED
|
@@ -131,7 +131,7 @@ function run() {
|
|
|
131
131
|
console.log(error);
|
|
132
132
|
});
|
|
133
133
|
// api
|
|
134
|
-
// .get("/api/
|
|
134
|
+
// .get("/api/v3/hotel/users/id", {
|
|
135
135
|
// data: {
|
|
136
136
|
// name: "tin",
|
|
137
137
|
// age: 31,
|
|
@@ -139,7 +139,7 @@ function run() {
|
|
|
139
139
|
// })
|
|
140
140
|
// .catch((error) => {})
|
|
141
141
|
// api
|
|
142
|
-
// .get("/api/
|
|
142
|
+
// .get("/api/v3/hotel/users/empty", {
|
|
143
143
|
// data: {},
|
|
144
144
|
// })
|
|
145
145
|
// .catch((error) => {
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
package/src/v3/GGExpressV3.ts
CHANGED
|
@@ -238,7 +238,7 @@ export default class GGExpressV3<
|
|
|
238
238
|
|
|
239
239
|
public async generateAPIFiles() {
|
|
240
240
|
await this.generateStaticRouteFile()
|
|
241
|
-
console.log(`
|
|
241
|
+
console.log(`GGExpressV3.ts : ${this.appName} - generate staticRoute done.`)
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
private async generateStaticRouteFile() {
|
package/src/v3/test.ts
CHANGED
|
@@ -131,7 +131,7 @@ function run() {
|
|
|
131
131
|
console.log(error)
|
|
132
132
|
})
|
|
133
133
|
// api
|
|
134
|
-
// .get("/api/
|
|
134
|
+
// .get("/api/v3/hotel/users/id", {
|
|
135
135
|
// data: {
|
|
136
136
|
// name: "tin",
|
|
137
137
|
// age: 31,
|
|
@@ -139,7 +139,7 @@ function run() {
|
|
|
139
139
|
// })
|
|
140
140
|
// .catch((error) => {})
|
|
141
141
|
// api
|
|
142
|
-
// .get("/api/
|
|
142
|
+
// .get("/api/v3/hotel/users/empty", {
|
|
143
143
|
// data: {},
|
|
144
144
|
// })
|
|
145
145
|
// .catch((error) => {
|
package/src/GGApi.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import axios from "axios"
|
|
2
|
-
import { staticRouteInterface } from "./staticRouteInterface"
|
|
3
|
-
|
|
4
|
-
export class GGApi {
|
|
5
|
-
constructor() {}
|
|
6
|
-
|
|
7
|
-
get<T extends keyof staticRouteInterface["get"]>(
|
|
8
|
-
url: T,
|
|
9
|
-
requireParams: staticRouteInterface["get"][T]["requireParams"]
|
|
10
|
-
): Promise<staticRouteInterface["get"][T]["responseStructure"]> {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
axios
|
|
13
|
-
.get(url as string, { params: { data: requireParams } })
|
|
14
|
-
.then((response) => {
|
|
15
|
-
resolve(response.data)
|
|
16
|
-
})
|
|
17
|
-
.catch((error) => {
|
|
18
|
-
reject(error)
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
post<T extends keyof staticRouteInterface["post"]>(
|
|
24
|
-
url: T,
|
|
25
|
-
requireParams: staticRouteInterface["post"][T]["requireParams"]
|
|
26
|
-
): Promise<staticRouteInterface["post"][T]["responseStructure"]> {
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
axios
|
|
29
|
-
.post(url as string, { data: requireParams })
|
|
30
|
-
.then((response) => {
|
|
31
|
-
resolve(response.data)
|
|
32
|
-
})
|
|
33
|
-
.catch((error) => {
|
|
34
|
-
reject(error)
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
put<T extends keyof staticRouteInterface["put"]>(
|
|
39
|
-
url: T,
|
|
40
|
-
requireParams: staticRouteInterface["put"][T]["requireParams"]
|
|
41
|
-
): Promise<staticRouteInterface["put"][T]["responseStructure"]> {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
axios
|
|
44
|
-
.put(url as string, { data: requireParams })
|
|
45
|
-
.then((response) => {
|
|
46
|
-
resolve(response.data)
|
|
47
|
-
})
|
|
48
|
-
.catch((error) => {
|
|
49
|
-
reject(error)
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
delete<T extends keyof staticRouteInterface["delete"]>(
|
|
54
|
-
url: T,
|
|
55
|
-
requireParams: staticRouteInterface["delete"][T]["requireParams"]
|
|
56
|
-
): Promise<staticRouteInterface["delete"][T]["responseStructure"]> {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
axios
|
|
59
|
-
.delete(url as string, { data: { data: requireParams } })
|
|
60
|
-
.then((response) => {
|
|
61
|
-
resolve(response.data)
|
|
62
|
-
})
|
|
63
|
-
.catch((error) => {
|
|
64
|
-
reject(error)
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function run() {
|
|
71
|
-
const api = new GGApi()
|
|
72
|
-
// const data = await api.post("/api/item", {
|
|
73
|
-
// parameter: { lotNumber: 1223 },
|
|
74
|
-
// data: [],
|
|
75
|
-
// })
|
|
76
|
-
|
|
77
|
-
// const data2 = await api.get(
|
|
78
|
-
// ("http://localhost:3002" + "/api/users/id") as any,
|
|
79
|
-
// {
|
|
80
|
-
// data: [{ id: 2 }, { id: 3 }, { id: 20 }],
|
|
81
|
-
// }
|
|
82
|
-
// )
|
|
83
|
-
const data2 = await api.get("/api/gg/users/id", { data: [{ id: 2 }] })
|
|
84
|
-
api.post("/api/gg/item", {
|
|
85
|
-
data: { id: 1, name: "item-1", price: 2 },
|
|
86
|
-
parameter: {
|
|
87
|
-
lotNumber: 2,
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
run()
|