@ayasofyazilim/saas 0.0.27 → 0.0.29

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.
Files changed (58) hide show
  1. package/AccountService/core/ApiRequestOptions.ts +12 -12
  2. package/AccountService/core/BaseHttpRequest.ts +9 -9
  3. package/AccountService/core/FetchHttpRequest.ts +21 -21
  4. package/AccountService/core/OpenAPI.ts +55 -55
  5. package/AccountService/core/request.ts +340 -340
  6. package/AdministrationService/core/ApiRequestOptions.ts +12 -12
  7. package/AdministrationService/core/BaseHttpRequest.ts +9 -9
  8. package/AdministrationService/core/FetchHttpRequest.ts +21 -21
  9. package/AdministrationService/core/OpenAPI.ts +55 -55
  10. package/AdministrationService/core/request.ts +340 -340
  11. package/AdministrationService/index.ts +8 -8
  12. package/BackerService/BackerServiceClient.ts +50 -50
  13. package/BackerService/core/ApiRequestOptions.ts +12 -12
  14. package/BackerService/core/BaseHttpRequest.ts +9 -9
  15. package/BackerService/core/FetchHttpRequest.ts +21 -21
  16. package/BackerService/core/OpenAPI.ts +55 -55
  17. package/BackerService/core/request.ts +340 -340
  18. package/BackerService/schemas.gen.ts +12444 -12444
  19. package/BackerService/services.gen.ts +866 -866
  20. package/FundraiserService/FundraiserServiceClient.ts +47 -47
  21. package/FundraiserService/core/ApiError.ts +20 -20
  22. package/FundraiserService/core/ApiResult.ts +6 -6
  23. package/FundraiserService/core/CancelablePromise.ts +125 -125
  24. package/FundraiserService/index.ts +8 -8
  25. package/FundraiserService/schemas.gen.ts +11548 -11548
  26. package/FundraiserService/services.gen.ts +627 -627
  27. package/IdentityService/core/ApiRequestOptions.ts +12 -12
  28. package/IdentityService/core/BaseHttpRequest.ts +9 -9
  29. package/IdentityService/core/FetchHttpRequest.ts +21 -21
  30. package/IdentityService/core/OpenAPI.ts +55 -55
  31. package/IdentityService/core/request.ts +340 -340
  32. package/MerchantService/MerchantServiceClient.ts +77 -77
  33. package/MerchantService/core/ApiRequestOptions.ts +12 -12
  34. package/MerchantService/core/BaseHttpRequest.ts +9 -9
  35. package/MerchantService/core/FetchHttpRequest.ts +21 -21
  36. package/MerchantService/core/OpenAPI.ts +55 -55
  37. package/MerchantService/core/request.ts +340 -340
  38. package/MerchantService/schemas.gen.ts +14764 -14764
  39. package/MerchantService/services.gen.ts +1602 -1602
  40. package/ProjectService/ProjectServiceClient.ts +47 -47
  41. package/ProjectService/core/ApiRequestOptions.ts +12 -12
  42. package/ProjectService/core/BaseHttpRequest.ts +9 -9
  43. package/ProjectService/core/FetchHttpRequest.ts +21 -21
  44. package/ProjectService/core/OpenAPI.ts +55 -55
  45. package/ProjectService/core/request.ts +340 -340
  46. package/ProjectService/schemas.gen.ts +5147 -5147
  47. package/ProjectService/services.gen.ts +492 -492
  48. package/SaasService/core/ApiRequestOptions.ts +12 -12
  49. package/SaasService/core/BaseHttpRequest.ts +9 -9
  50. package/SaasService/core/FetchHttpRequest.ts +21 -21
  51. package/SaasService/core/OpenAPI.ts +55 -55
  52. package/SaasService/core/request.ts +340 -340
  53. package/SettingService/index.ts +2 -2
  54. package/SettingService/schemas.gen.ts +5779 -5779
  55. package/SettingService/services.gen.ts +787 -787
  56. package/SettingService/types.gen.ts +1862 -6827
  57. package/generator.mjs +77 -24
  58. package/package.json +6 -2
package/generator.mjs CHANGED
@@ -1,10 +1,11 @@
1
+ #! /usr/bin/env node
1
2
  import { createClient } from "@hey-api/openapi-ts";
2
3
  import SwaggerParser from "@apidevtools/swagger-parser";
3
4
  import fs from "fs";
4
5
 
5
6
  const BASE_URL = "http://192.168.1.105:";
6
7
  const WEBGATEWAY_PORT = 44336;
7
- const api_list = [
8
+ var initial_api_list = [
8
9
  {
9
10
  input: "swagger-json/AuthServer",
10
11
  output: "Account",
@@ -80,29 +81,81 @@ function getCircularReplacer() {
80
81
  };
81
82
  }
82
83
 
83
- for (const api of api_list) {
84
- console.log(`✨ Processing ${api.output}...`);
85
- const port = api?.port ? api.port : WEBGATEWAY_PORT;
86
- const apiURL = clean_URL(
87
- `${BASE_URL + port}/${api.input}` + "/swagger/v1/swagger.json",
88
- );
89
- const swaggerText = await SwaggerParser.dereference(apiURL);
90
- let temp_swagger = apiURL;
91
- if (api.dereference) {
92
- console.log(typeof swaggerText);
93
- console.log(`🎁 Dereferencing ${api.output} is from ${apiURL} done.`);
94
- temp_swagger = `temp_${api.output}_swagger.json`;
95
- fs.writeFileSync(
96
- temp_swagger,
97
- JSON.stringify(swaggerText, getCircularReplacer()),
84
+ async function generateApi(api_list) {
85
+ for (const api of api_list) {
86
+ console.log(`✨ Processing ${api.output}...`);
87
+ const port = api?.port ? api.port : WEBGATEWAY_PORT;
88
+ const apiURL = clean_URL(
89
+ `${BASE_URL + port}/${api.input}` + "/swagger/v1/swagger.json",
98
90
  );
91
+ const swaggerText = await SwaggerParser.dereference(apiURL);
92
+ let temp_swagger = apiURL;
93
+ if (api.dereference) {
94
+ console.log(typeof swaggerText);
95
+ console.log(`🎁 Dereferencing ${api.output} is from ${apiURL} done.`);
96
+ temp_swagger = `temp_${api.output}_swagger.json`;
97
+ fs.writeFileSync(
98
+ temp_swagger,
99
+ JSON.stringify(swaggerText, getCircularReplacer()),
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(`${api.output}Service/index.ts`, `\nexport * from './schemas.gen';`, { flag: 'a' });
125
+ } else {
126
+
127
+ await createClient({
128
+ input: temp_swagger,
129
+ output: api.output + "Service",
130
+ name: api.output + "ServiceClient",
131
+ client: "fetch",
132
+ });
133
+ }
134
+ console.log(`✅ Generating ${api.output} is done.`);
135
+ }
136
+ }
137
+
138
+ const args = process.argv.filter(val => val.startsWith('--'));
139
+ const isAll = args.filter(val => val === '--all').length > 0;
140
+ const hasFilter = args.filter(val => val.startsWith('--filter')).length > 0;
141
+ const knownArgs = ["--all", "--filter"];
142
+ const unknownArgs = args.filter(val => !knownArgs.includes(val) && !knownArgs.includes(val.split('=').at(0)));
143
+ async function init() {
144
+ if (unknownArgs.length > 0) {
145
+ return console.error(`❌ Unknown arguments: ${unknownArgs.join(', ')}`);
146
+ }
147
+ if (isAll && hasFilter) {
148
+ return console.error(`❌ Cannot use --all and --filter at the same time.`);
149
+ }
150
+ if (hasFilter) {
151
+ const filter = args.filter(val => val.startsWith('--filter'))[0].split('=')[1];
152
+ const filterArgs = filter.split(',');
153
+ initial_api_list = initial_api_list.filter(val => filterArgs.includes(val.output))
154
+ if (initial_api_list.length === 0) {
155
+ return console.error(`❌ Unknown filter: ${filter}`);
156
+ }
157
+ console.log(`📃 Generating with filters: ${filter}`);
99
158
  }
100
- await createClient({
101
- input: temp_swagger,
102
- output: api.output + "Service",
103
- name: api.output + "ServiceClient",
104
- client: "fetch",
105
- });
106
- if (api.dereference) fs.unlinkSync(temp_swagger);
107
- console.log(`✅ Generating ${api.output} is done.`);
159
+ await generateApi(initial_api_list);
108
160
  }
161
+ init()
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@ayasofyazilim/saas",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "Ayasofyazılım SAAS",
5
+ "main": "generator.mjs",
6
+ "bin": {
7
+ "generate": "generator.mjs"
8
+ },
5
9
  "exports": {
6
10
  "./AccountService": "./AccountService/index.ts",
7
11
  "./ProjectService": "./ProjectService/index.ts",
@@ -14,7 +18,7 @@
14
18
  "./MerchantService": "./MerchantService/index.ts"
15
19
  },
16
20
  "scripts": {
17
- "gen:all": "node generator.mjs",
21
+ "gen:all": "node generator.mjs --all",
18
22
  "init-release": "publish --access public",
19
23
  "release": "release-it"
20
24
  },