@ayasofyazilim/saas 0.0.28 → 0.0.30
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/AccountService/AccountServiceClient.ts +65 -65
- package/AccountService/schemas.gen.ts +5103 -5103
- package/AccountService/services.gen.ts +1452 -1452
- package/AccountService/types.gen.ts +9896 -9896
- package/AdministrationService/AdministrationServiceClient.ts +74 -74
- package/AdministrationService/schemas.gen.ts +5897 -5897
- package/AdministrationService/services.gen.ts +1332 -1332
- package/AdministrationService/types.gen.ts +9024 -9024
- package/BackerService/BackerServiceClient.ts +50 -50
- package/BackerService/services.gen.ts +866 -866
- package/CRMService/CRMServiceClient.ts +71 -0
- package/CRMService/core/ApiError.ts +21 -0
- package/CRMService/core/ApiRequestOptions.ts +13 -0
- package/CRMService/core/ApiResult.ts +7 -0
- package/CRMService/core/BaseHttpRequest.ts +10 -0
- package/CRMService/core/CancelablePromise.ts +126 -0
- package/CRMService/core/FetchHttpRequest.ts +22 -0
- package/CRMService/core/OpenAPI.ts +56 -0
- package/CRMService/core/request.ts +341 -0
- package/CRMService/index.ts +9 -0
- package/CRMService/schemas.gen.ts +14633 -0
- package/CRMService/services.gen.ts +1422 -0
- package/CRMService/types.gen.ts +3112 -0
- package/IdentityService/IdentityServiceClient.ts +77 -77
- package/IdentityService/schemas.gen.ts +6573 -6573
- package/IdentityService/services.gen.ts +2839 -2839
- package/IdentityService/types.gen.ts +17446 -17446
- package/MerchantService/MerchantServiceClient.ts +77 -77
- package/ProjectService/ProjectServiceClient.ts +47 -47
- package/ProjectService.json +2937 -2937
- package/SaasService/schemas.gen.ts +5278 -5278
- package/SaasService/services.gen.ts +1325 -1325
- package/SaasService/types.gen.ts +9052 -9052
- package/SettingService/SettingServiceClient.ts +62 -62
- package/SettingService/index.ts +9 -9
- package/SettingService/services.gen.ts +21 -21
- package/SettingService/types.gen.ts +315 -5280
- package/generator.mjs +55 -19
- package/package.json +1 -1
- package/swagger.json +4794 -4794
package/generator.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
1
|
+
#! /usr/bin/env node
|
|
2
2
|
import { createClient } from "@hey-api/openapi-ts";
|
|
3
3
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
4
4
|
import fs from "fs";
|
|
@@ -51,8 +51,8 @@ var initial_api_list = [
|
|
|
51
51
|
dereference: true,
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
input: "swagger-json/
|
|
55
|
-
output: "
|
|
54
|
+
input: "swagger-json/CRM",
|
|
55
|
+
output: "CRM",
|
|
56
56
|
port: 44335,
|
|
57
57
|
dereference: true,
|
|
58
58
|
},
|
|
@@ -80,6 +80,7 @@ function getCircularReplacer() {
|
|
|
80
80
|
return value;
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
+
|
|
83
84
|
async function generateApi(api_list) {
|
|
84
85
|
for (const api of api_list) {
|
|
85
86
|
console.log(`✨ Processing ${api.output}...`);
|
|
@@ -97,34 +98,69 @@ async function generateApi(api_list) {
|
|
|
97
98
|
temp_swagger,
|
|
98
99
|
JSON.stringify(swaggerText, getCircularReplacer()),
|
|
99
100
|
);
|
|
101
|
+
|
|
102
|
+
await createClient({
|
|
103
|
+
input: temp_swagger,
|
|
104
|
+
output: api.output + "Service",
|
|
105
|
+
name: api.output + "ServiceClient",
|
|
106
|
+
client: "fetch",
|
|
107
|
+
types: false,
|
|
108
|
+
services: false,
|
|
109
|
+
});
|
|
110
|
+
//types
|
|
111
|
+
await createClient({
|
|
112
|
+
input: apiURL,
|
|
113
|
+
output: api.output + "Service",
|
|
114
|
+
name: api.output + "ServiceClient",
|
|
115
|
+
client: "fetch",
|
|
116
|
+
schemas: false,
|
|
117
|
+
types: {
|
|
118
|
+
// dates: "types+transform" TODO implement this
|
|
119
|
+
// name: "PascalCase" TODO implement this
|
|
120
|
+
tree: true,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
fs.unlinkSync(temp_swagger);
|
|
124
|
+
fs.writeFileSync(
|
|
125
|
+
`${api.output}Service/index.ts`,
|
|
126
|
+
`\nexport * from './schemas.gen';`,
|
|
127
|
+
{ flag: "a" },
|
|
128
|
+
);
|
|
129
|
+
} else {
|
|
130
|
+
await createClient({
|
|
131
|
+
input: temp_swagger,
|
|
132
|
+
output: api.output + "Service",
|
|
133
|
+
name: api.output + "ServiceClient",
|
|
134
|
+
client: "fetch",
|
|
135
|
+
});
|
|
100
136
|
}
|
|
101
|
-
await createClient({
|
|
102
|
-
input: temp_swagger,
|
|
103
|
-
output: api.output + "Service",
|
|
104
|
-
name: api.output + "ServiceClient",
|
|
105
|
-
client: "fetch",
|
|
106
|
-
});
|
|
107
|
-
if (api.dereference) fs.unlinkSync(temp_swagger);
|
|
108
137
|
console.log(`✅ Generating ${api.output} is done.`);
|
|
109
138
|
}
|
|
110
139
|
}
|
|
111
140
|
|
|
112
|
-
const args = process.argv.filter(val => val.startsWith(
|
|
113
|
-
const isAll = args.filter(val => val ===
|
|
114
|
-
const hasFilter = args.filter(val => val.startsWith(
|
|
141
|
+
const args = process.argv.filter((val) => val.startsWith("--"));
|
|
142
|
+
const isAll = args.filter((val) => val === "--all").length > 0;
|
|
143
|
+
const hasFilter = args.filter((val) => val.startsWith("--filter")).length > 0;
|
|
115
144
|
const knownArgs = ["--all", "--filter"];
|
|
116
|
-
const unknownArgs = args.filter(
|
|
145
|
+
const unknownArgs = args.filter(
|
|
146
|
+
(val) =>
|
|
147
|
+
!knownArgs.includes(val) && !knownArgs.includes(val.split("=").at(0)),
|
|
148
|
+
);
|
|
117
149
|
async function init() {
|
|
118
150
|
if (unknownArgs.length > 0) {
|
|
119
|
-
return console.error(`❌ Unknown arguments: ${unknownArgs.join(
|
|
151
|
+
return console.error(`❌ Unknown arguments: ${unknownArgs.join(", ")}`);
|
|
120
152
|
}
|
|
121
153
|
if (isAll && hasFilter) {
|
|
122
154
|
return console.error(`❌ Cannot use --all and --filter at the same time.`);
|
|
123
155
|
}
|
|
124
156
|
if (hasFilter) {
|
|
125
|
-
const filter = args
|
|
126
|
-
|
|
127
|
-
|
|
157
|
+
const filter = args
|
|
158
|
+
.filter((val) => val.startsWith("--filter"))[0]
|
|
159
|
+
.split("=")[1];
|
|
160
|
+
const filterArgs = filter.split(",");
|
|
161
|
+
initial_api_list = initial_api_list.filter((val) =>
|
|
162
|
+
filterArgs.includes(val.output),
|
|
163
|
+
);
|
|
128
164
|
if (initial_api_list.length === 0) {
|
|
129
165
|
return console.error(`❌ Unknown filter: ${filter}`);
|
|
130
166
|
}
|
|
@@ -132,4 +168,4 @@ async function init() {
|
|
|
132
168
|
}
|
|
133
169
|
await generateApi(initial_api_list);
|
|
134
170
|
}
|
|
135
|
-
init()
|
|
171
|
+
init();
|