@ayasofyazilim/saas 0.0.12 → 0.0.14

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 (41) hide show
  1. package/AccountService/schemas.gen.ts +11 -4
  2. package/AccountService/types.gen.ts +8 -0
  3. package/AdministrationService/schemas.gen.ts +11 -7
  4. package/AdministrationService/types.gen.ts +5 -0
  5. package/BackerService/BackerServiceClient.ts +44 -0
  6. package/BackerService/core/ApiError.ts +21 -0
  7. package/BackerService/core/ApiRequestOptions.ts +13 -0
  8. package/BackerService/core/ApiResult.ts +7 -0
  9. package/BackerService/core/BaseHttpRequest.ts +10 -0
  10. package/BackerService/core/CancelablePromise.ts +126 -0
  11. package/BackerService/core/FetchHttpRequest.ts +22 -0
  12. package/BackerService/core/OpenAPI.ts +56 -0
  13. package/BackerService/core/request.ts +341 -0
  14. package/BackerService/index.ts +9 -0
  15. package/BackerService/schemas.gen.ts +8991 -0
  16. package/BackerService/services.gen.ts +270 -0
  17. package/BackerService/types.gen.ts +6611 -0
  18. package/IdentityService/schemas.gen.ts +28 -10
  19. package/IdentityService/types.gen.ts +30 -0
  20. package/ProjectService/ProjectServiceClient.ts +3 -9
  21. package/ProjectService/schemas.gen.ts +26 -723
  22. package/ProjectService/services.gen.ts +8 -348
  23. package/ProjectService/types.gen.ts +36 -2252
  24. package/ProjectService.json +2937 -2937
  25. package/SaasService/schemas.gen.ts +5 -5
  26. package/SettingService/SettingServiceClient.ts +53 -0
  27. package/SettingService/core/ApiError.ts +21 -0
  28. package/SettingService/core/ApiRequestOptions.ts +13 -0
  29. package/SettingService/core/ApiResult.ts +7 -0
  30. package/SettingService/core/BaseHttpRequest.ts +10 -0
  31. package/SettingService/core/CancelablePromise.ts +126 -0
  32. package/SettingService/core/FetchHttpRequest.ts +22 -0
  33. package/SettingService/core/OpenAPI.ts +56 -0
  34. package/SettingService/core/request.ts +341 -0
  35. package/SettingService/index.ts +9 -0
  36. package/SettingService/schemas.gen.ts +1522 -0
  37. package/SettingService/services.gen.ts +317 -0
  38. package/SettingService/types.gen.ts +981 -0
  39. package/generator.mjs +55 -25
  40. package/package.json +4 -2
  41. package/swagger.json +4794 -4794
package/generator.mjs CHANGED
@@ -7,34 +7,40 @@ const WEBGATEWAY_PORT = 44325;
7
7
  const api_list = [
8
8
  {
9
9
  input: 'swagger-json/AuthServer',
10
- output: 'AccountService',
11
- name: 'AccountServiceClient',
12
- client: 'fetch'
10
+ output: 'Account',
11
+ dereference: true
13
12
  },
14
13
  {
15
14
  input: "",
16
- output: 'ProjectService',
17
- name: 'ProjectServiceClient',
18
- client: 'fetch',
19
- port: 45185
15
+ output: 'Project',
16
+ port: 44325,
17
+ dereference: true
18
+ },
19
+ {
20
+ input: "swagger-json/Backer",
21
+ output: 'Backer',
22
+ dereference: true
20
23
  },
21
24
  {
22
25
  input: "swagger-json/Administration",
23
- output: 'AdministrationService',
24
- name: 'AdministrationServiceClient',
25
- client: 'fetch'
26
+ output: 'Administration',
27
+ dereference: true
26
28
  },
27
29
  {
28
30
  input: "swagger-json/Identity",
29
- output: 'IdentityService',
30
- name: 'IdentityServiceClient',
31
- client: 'fetch'
31
+ output: 'Identity',
32
+ dereference: true
32
33
  },
33
34
  {
34
35
  input: "swagger-json/Saas",
35
- output: 'SaasService',
36
- name: 'SaasServiceClient',
37
- client: 'fetch'
36
+ output: 'Saas',
37
+ dereference: true
38
+ },
39
+ {
40
+ input: "",
41
+ output: 'Setting',
42
+ port: 44515,
43
+ dereference: false
38
44
  }
39
45
  ]
40
46
 
@@ -42,20 +48,44 @@ function clean_URL(url) {
42
48
  return url.replace(/\/\//g, '/').replace(/:\//g, '://');
43
49
  }
44
50
 
51
+ function getCircularReplacer() {
52
+ const ancestors = [];
53
+ return function (key, value) {
54
+ if (typeof value !== "object" || value === null) {
55
+ return value;
56
+ }
57
+ // `this` is the object that value is contained in,
58
+ // i.e., its direct parent.
59
+ while (ancestors.length > 0 && ancestors.at(-1) !== this) {
60
+ ancestors.pop();
61
+ }
62
+ if (ancestors.includes(value)) {
63
+ return "[Circular]";
64
+ }
65
+ ancestors.push(value);
66
+ return value;
67
+ };
68
+ }
69
+
45
70
  for (const api of api_list) {
46
- console.log(`✨ Processing ${api.name}...`);
71
+ console.log(`✨ Processing ${api.output}...`);
47
72
  const port = api?.port ? api.port : WEBGATEWAY_PORT;
48
73
  const apiURL = clean_URL(`${BASE_URL + port}/${api.input}` + "/swagger/v1/swagger.json");
49
74
  const swaggerText = await SwaggerParser.dereference(apiURL);
50
- console.log(`✨ Dereferencing ${api.name} is done.`);
51
- const temp_swagger = `temp_${api.name}_swagger.json`;
52
- fs.writeFileSync(temp_swagger, JSON.stringify(swaggerText));
75
+ let temp_swagger = apiURL;
76
+ if (api.dereference) {
77
+ console.log(typeof swaggerText)
78
+ console.log(`🎁 Dereferencing ${api.output} is from ${apiURL} done.`);
79
+ temp_swagger = `temp_${api.output}_swagger.json`;
80
+ fs.writeFileSync(temp_swagger, JSON.stringify(swaggerText, getCircularReplacer()));
81
+ }
53
82
  await createClient({
54
83
  input: temp_swagger,
55
- output: api.output,
56
- name: api.name,
57
- client: api.client
84
+ output: api.output + "Service",
85
+ name: api.output + "ServiceClient",
86
+ client: "fetch"
58
87
  });
59
- fs.unlinkSync(temp_swagger);
60
- console.log(`✨ Generating ${api.name} is done.`);
88
+ if (api.dereference)
89
+ fs.unlinkSync(temp_swagger);
90
+ console.log(`✅ Generating ${api.output} is done.`);
61
91
  }
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@ayasofyazilim/saas",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Ayasofyazılım SAAS",
5
5
  "exports": {
6
6
  "./AccountService": "./AccountService/index.ts",
7
7
  "./ProjectService": "./ProjectService/index.ts",
8
8
  "./AdministrationService": "./AdministrationService/index.ts",
9
9
  "./IdentityService": "./IdentityService/index.ts",
10
- "./SaasService": "./SaasService/index.ts"
10
+ "./SaasService": "./SaasService/index.ts",
11
+ "./SettingService": "./SettingService/index.ts",
12
+ "./BackerService": "./BackerService/index.ts"
11
13
  },
12
14
  "scripts": {
13
15
  "gen:all": "node generator.mjs",