@rxap/workspace-open-api 19.0.3-dev.0 → 19.0.3-dev.2

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 (107) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +7 -5
  3. package/src/generators/init/generator.d.ts +4 -0
  4. package/src/generators/init/generator.js +106 -0
  5. package/src/generators/init/generator.js.map +1 -0
  6. package/src/lib/create-directive.d.ts +31 -0
  7. package/src/lib/create-directive.js +39 -0
  8. package/src/lib/create-directive.js.map +1 -1
  9. package/src/lib/generate-components.d.ts +9 -0
  10. package/src/lib/generate-components.js +32 -0
  11. package/src/lib/generate-components.js.map +1 -1
  12. package/src/lib/generate-data-source.d.ts +21 -0
  13. package/src/lib/generate-data-source.js +21 -0
  14. package/src/lib/generate-data-source.js.map +1 -1
  15. package/src/lib/generate-directives.d.ts +23 -0
  16. package/src/lib/generate-directives.js +23 -0
  17. package/src/lib/generate-directives.js.map +1 -1
  18. package/src/lib/generate-index-exports.d.ts +15 -0
  19. package/src/lib/generate-index-exports.js +15 -0
  20. package/src/lib/generate-index-exports.js.map +1 -1
  21. package/src/lib/generate-interfaces.d.ts +17 -0
  22. package/src/lib/generate-interfaces.js +17 -0
  23. package/src/lib/generate-interfaces.js.map +1 -1
  24. package/src/lib/generate-operation-command.d.ts +29 -0
  25. package/src/lib/generate-operation-command.js +29 -0
  26. package/src/lib/generate-operation-command.js.map +1 -1
  27. package/src/lib/generate-operation.d.ts +20 -0
  28. package/src/lib/generate-operation.js +41 -0
  29. package/src/lib/generate-operation.js.map +1 -1
  30. package/src/lib/generate-parameters.d.ts +27 -0
  31. package/src/lib/generate-parameters.js +27 -0
  32. package/src/lib/generate-parameters.js.map +1 -1
  33. package/src/lib/generate-remote-method.d.ts +25 -0
  34. package/src/lib/generate-remote-method.js +25 -0
  35. package/src/lib/generate-remote-method.js.map +1 -1
  36. package/src/lib/generate-request-body.d.ts +16 -0
  37. package/src/lib/generate-request-body.js +16 -0
  38. package/src/lib/generate-request-body.js.map +1 -1
  39. package/src/lib/generate-response.d.ts +23 -0
  40. package/src/lib/generate-response.js +23 -0
  41. package/src/lib/generate-response.js.map +1 -1
  42. package/src/lib/load-open-api-config.d.ts +17 -0
  43. package/src/lib/load-open-api-config.js +17 -0
  44. package/src/lib/load-open-api-config.js.map +1 -1
  45. package/src/lib/resolve-ref.d.ts +10 -0
  46. package/src/lib/resolve-ref.js +10 -0
  47. package/src/lib/resolve-ref.js.map +1 -1
  48. package/src/lib/types.d.ts +40 -0
  49. package/src/lib/types.js +40 -0
  50. package/src/lib/types.js.map +1 -1
  51. package/src/lib/utilities/any-schema-object.d.ts +9 -0
  52. package/src/lib/utilities/any-schema-object.js +9 -0
  53. package/src/lib/utilities/any-schema-object.js.map +1 -1
  54. package/src/lib/utilities/create-component-type-alias-source-file.d.ts +19 -0
  55. package/src/lib/utilities/create-component-type-alias-source-file.js +19 -0
  56. package/src/lib/utilities/create-component-type-alias-source-file.js.map +1 -1
  57. package/src/lib/utilities/get-parameter-type.d.ts +10 -0
  58. package/src/lib/utilities/get-parameter-type.js +10 -0
  59. package/src/lib/utilities/get-parameter-type.js.map +1 -1
  60. package/src/lib/utilities/get-reqeust-body.d.ts +12 -0
  61. package/src/lib/utilities/get-reqeust-body.js +12 -0
  62. package/src/lib/utilities/get-reqeust-body.js.map +1 -1
  63. package/src/lib/utilities/get-request-body-type.d.ts +19 -0
  64. package/src/lib/utilities/get-request-body-type.js +19 -0
  65. package/src/lib/utilities/get-request-body-type.js.map +1 -1
  66. package/src/lib/utilities/get-response-type.d.ts +15 -0
  67. package/src/lib/utilities/get-response-type.js +15 -0
  68. package/src/lib/utilities/get-response-type.js.map +1 -1
  69. package/src/lib/utilities/get-response.d.ts +13 -0
  70. package/src/lib/utilities/get-response.js +13 -0
  71. package/src/lib/utilities/get-response.js.map +1 -1
  72. package/src/lib/utilities/get-type-parameters.d.ts +14 -0
  73. package/src/lib/utilities/get-type-parameters.js +14 -0
  74. package/src/lib/utilities/get-type-parameters.js.map +1 -1
  75. package/src/lib/utilities/has-operation-paramters.d.ts +10 -0
  76. package/src/lib/utilities/has-operation-paramters.js +10 -0
  77. package/src/lib/utilities/has-operation-paramters.js.map +1 -1
  78. package/src/lib/utilities/has-operation-request-body.d.ts +10 -0
  79. package/src/lib/utilities/has-operation-request-body.js +10 -0
  80. package/src/lib/utilities/has-operation-request-body.js.map +1 -1
  81. package/src/lib/utilities/http-request.d.ts +30 -0
  82. package/src/lib/utilities/http-request.js +30 -0
  83. package/src/lib/utilities/http-request.js.map +1 -1
  84. package/src/lib/utilities/ignore-operation.d.ts +11 -0
  85. package/src/lib/utilities/ignore-operation.js +11 -0
  86. package/src/lib/utilities/ignore-operation.js.map +1 -1
  87. package/src/lib/utilities/is-collection-response.d.ts +13 -0
  88. package/src/lib/utilities/is-collection-response.js +13 -0
  89. package/src/lib/utilities/is-collection-response.js.map +1 -1
  90. package/src/lib/utilities/is-http-method.d.ts +14 -0
  91. package/src/lib/utilities/is-http-method.js +14 -0
  92. package/src/lib/utilities/is-http-method.js.map +1 -1
  93. package/src/lib/utilities/is-open-api-schema-from-path.d.ts +11 -0
  94. package/src/lib/utilities/is-open-api-schema-from-path.js +11 -0
  95. package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -1
  96. package/src/lib/utilities/is-operation-object.d.ts +16 -0
  97. package/src/lib/utilities/is-operation-object.js +16 -0
  98. package/src/lib/utilities/is-operation-object.js.map +1 -1
  99. package/src/lib/utilities/is-reference-object.d.ts +22 -0
  100. package/src/lib/utilities/is-reference-object.js +22 -0
  101. package/src/lib/utilities/is-reference-object.js.map +1 -1
  102. package/src/lib/utilities/is-without-parameters.d.ts +10 -0
  103. package/src/lib/utilities/is-without-parameters.js +10 -0
  104. package/src/lib/utilities/is-without-parameters.js.map +1 -1
  105. package/src/lib/utilities/ref-schema-object.d.ts +26 -0
  106. package/src/lib/utilities/ref-schema-object.js +26 -0
  107. package/src/lib/utilities/ref-schema-object.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [19.0.3-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/workspace-open-api@19.0.3-dev.1...@rxap/workspace-open-api@19.0.3-dev.2) (2024-06-21)
7
+
8
+ **Note:** Version bump only for package @rxap/workspace-open-api
9
+
10
+ ## [19.0.3-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/workspace-open-api@19.0.3-dev.0...@rxap/workspace-open-api@19.0.3-dev.1) (2024-06-20)
11
+
12
+ **Note:** Version bump only for package @rxap/workspace-open-api
13
+
6
14
  ## [19.0.3-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/workspace-open-api@19.0.2...@rxap/workspace-open-api@19.0.3-dev.0) (2024-06-18)
7
15
 
8
16
  **Note:** Version bump only for package @rxap/workspace-open-api
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
- "version": "19.0.3-dev.0",
2
+ "version": "19.0.3-dev.2",
3
3
  "name": "@rxap/workspace-open-api",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
6
6
  "@angular-devkit/core": "18.0.2",
7
- "@rxap/json-schema-to-typescript": "^16.0.5",
8
- "@rxap/utilities": "^16.2.3",
9
- "@rxap/workspace-utilities": "^19.2.1-dev.0",
7
+ "@nx/devkit": "19.3.0",
8
+ "@rxap/json-schema-to-typescript": "^16.0.6-dev.1",
9
+ "@rxap/utilities": "^16.2.4-dev.1",
10
+ "@rxap/workspace-utilities": "^19.3.0-dev.1",
10
11
  "openapi-types": "10.0.0",
11
12
  "ts-morph": "18.0.0",
12
13
  "tslib": "2.6.2",
@@ -20,6 +21,7 @@
20
21
  "url": "https://gitlab.com/rxap/packages/-/issues",
21
22
  "email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
22
23
  },
24
+ "generators": "./generators.json",
23
25
  "homepage": "https:/gitlab.com/rxap/packages/packages/workspace/open-api",
24
26
  "keywords": [
25
27
  "packages",
@@ -38,6 +40,6 @@
38
40
  "directory": "packages/workspace/open-api"
39
41
  },
40
42
  "type": "commonjs",
41
- "gitHead": "ffe854d3d7cf69a737411c0798157c1c945e3b5c",
43
+ "gitHead": "bbecc3ca89ac11dedf7969bed08705f22dfaa186",
42
44
  "main": "./src/index.js"
43
45
  }
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { InitGeneratorSchema } from './schema';
3
+ export declare function initGenerator(tree: Tree, options: InitGeneratorSchema): Promise<void>;
4
+ export default initGenerator;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const path_1 = require("path");
7
+ function initGenerator(tree, options) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ var _a, _b, _c, _d, _e;
10
+ const packageJsonFilePath = (0, path_1.relative)(tree.root, (0, path_1.join)(__dirname, '..', '..', '..', 'package.json'));
11
+ if (!tree.exists(packageJsonFilePath)) {
12
+ console.error('package.json not found in: ' + packageJsonFilePath);
13
+ return;
14
+ }
15
+ const { peerDependencies, name: packageName } = JSON.parse(tree.read(packageJsonFilePath, 'utf-8'));
16
+ console.log(`Coerce peer dependencies for package: ${packageName}`);
17
+ if (!peerDependencies || !Object.keys(peerDependencies).length) {
18
+ console.log('No peer dependencies found');
19
+ return;
20
+ }
21
+ console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
22
+ const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8'));
23
+ let isDevDependency = !!((_a = rootPackageJson.devDependencies) === null || _a === void 0 ? void 0 : _a[packageName]);
24
+ if (isDevDependency &&
25
+ [/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))) {
26
+ (_b = rootPackageJson.dependencies) !== null && _b !== void 0 ? _b : (rootPackageJson.dependencies = {});
27
+ rootPackageJson.dependencies[packageName] =
28
+ rootPackageJson.devDependencies[packageName];
29
+ delete rootPackageJson.devDependencies[packageName];
30
+ isDevDependency = false;
31
+ tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
32
+ }
33
+ if (!isDevDependency && [
34
+ /^@rxap\/plugin/,
35
+ /^@rxap\/workspace/,
36
+ /@rxap\/schematic/,
37
+ ]) {
38
+ (_c = rootPackageJson.devDependencies) !== null && _c !== void 0 ? _c : (rootPackageJson.devDependencies = {});
39
+ rootPackageJson.devDependencies[packageName] =
40
+ rootPackageJson.dependencies[packageName];
41
+ delete rootPackageJson.dependencies[packageName];
42
+ isDevDependency = true;
43
+ tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
44
+ }
45
+ const missingPeerDependencies = Object.entries(peerDependencies)
46
+ .filter(([dep]) => {
47
+ var _a, _b;
48
+ return !((_a = rootPackageJson.dependencies) === null || _a === void 0 ? void 0 : _a[dep]) &&
49
+ !((_b = rootPackageJson.devDependencies) === null || _b === void 0 ? void 0 : _b[dep]);
50
+ })
51
+ .reduce((acc, [dep, version]) => (Object.assign(Object.assign({}, acc), { [dep]: version })), {});
52
+ if (!Object.keys(missingPeerDependencies).length) {
53
+ console.log('No missing peer dependencies');
54
+ return;
55
+ }
56
+ if (isDevDependency) {
57
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingPeerDependencies);
58
+ }
59
+ else {
60
+ (0, devkit_1.addDependenciesToPackageJson)(tree, missingPeerDependencies, {});
61
+ }
62
+ yield (0, devkit_1.formatFiles)(tree);
63
+ (0, devkit_1.installPackagesTask)(tree);
64
+ for (const peer of Object.keys(missingPeerDependencies)) {
65
+ console.log(`Peer dependency ${peer} added to package.json`);
66
+ const peerPackageJsonFilePath = (0, path_1.join)('node_modules', ...peer.split('/'), 'package.json');
67
+ if (!tree.exists(peerPackageJsonFilePath)) {
68
+ console.log(`Peer dependency ${peer} has no package.json`);
69
+ continue;
70
+ }
71
+ const { generators, schematics } = JSON.parse(tree.read(peerPackageJsonFilePath, 'utf-8'));
72
+ if (!generators && !schematics) {
73
+ console.log(`Peer dependency ${peer} has no generators or schematics`);
74
+ continue;
75
+ }
76
+ const configFile = generators || schematics;
77
+ if (!tree.exists((0, path_1.join)('node_modules', ...peer.split('/'), configFile))) {
78
+ console.log(`Peer dependency ${peer} has no generators or schematics file`);
79
+ continue;
80
+ }
81
+ const config = JSON.parse(tree.read((0, path_1.join)('node_modules', ...peer.split('/'), configFile), 'utf-8'));
82
+ if (!((_d = config.generators) === null || _d === void 0 ? void 0 : _d.init)) {
83
+ console.log(`Peer dependency ${peer} has no init generator`);
84
+ continue;
85
+ }
86
+ const initGeneratorFilePath = config.generators.init.factory;
87
+ const fullInitGeneratorFilePath = (0, path_1.join)('node_modules', ...peer.split('/'), initGeneratorFilePath) + '.js';
88
+ if (!tree.exists(fullInitGeneratorFilePath)) {
89
+ console.log(`Peer dependency ${peer} has no init generator file: ` +
90
+ fullInitGeneratorFilePath);
91
+ continue;
92
+ }
93
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
94
+ const initGenerator = (_e = require((0, path_1.join)('node_modules', ...peer.split('/'), initGeneratorFilePath))) === null || _e === void 0 ? void 0 : _e.default;
95
+ if (typeof initGenerator !== 'function') {
96
+ console.log(`Peer dependency ${peer} has no init generator function`);
97
+ continue;
98
+ }
99
+ console.log(`Run init generator for peer dependency ${peer}`);
100
+ yield initGenerator(tree, options);
101
+ }
102
+ });
103
+ }
104
+ exports.initGenerator = initGenerator;
105
+ exports.default = initGenerator;
106
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/generators/init/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAKoB;AACpB,+BAAsC;AAGtC,SAAsB,aAAa,CAAC,IAAU,EAAE,OAA4B;;;QAC1E,M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AAI,iCAAiC,CAAC,CAAC;gBACtE,SAAS;YACX,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;YAC9D,MAAM,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CAAA;AAhID,sCAgIC;AAED,kBAAe,aAAa,CAAC"}
@@ -1,2 +1,33 @@
1
1
  import { CreateDirectiveOptions } from './options';
2
+ /**
3
+ *
4
+ *
5
+ * Dynamically creates and registers an Angular directive for a remote method invocation based on the provided options.
6
+ * The directive can optionally handle templates and collections, and is configured to be injectable with necessary services.
7
+ *
8
+ * @param {CreateDirectiveOptions} options - Configuration options for creating the directive, including:
9
+ * - `filePath`: The file path where the directive is to be added.
10
+ * - `sourceFile`: The TypeScript source file object to which the directive will be added.
11
+ * - `name`: The base name for the directive, used in naming and selector generation.
12
+ * - `prefix`: Optional prefix for the directive selector.
13
+ * - `parametersType`: The TypeScript type of the parameters that the directive accepts.
14
+ * - `returnType`: The TypeScript type of the value returned by the remote method.
15
+ * - `template`: Boolean indicating whether the directive uses a template.
16
+ * - `collection`: Boolean indicating whether the directive handles a collection of items.
17
+ * - `withoutParameters`: Boolean indicating if the directive operates without parameters.
18
+ *
19
+ * The function constructs the directive by defining its class, imports, selector, and injectable services based on the options.
20
+ * It checks for existing class declarations with the same name to avoid duplicates. If a duplicate is found, a warning is logged
21
+ * and the function exits early. Otherwise, it proceeds to set up the directive's metadata, constructor, and class properties.
22
+ *
23
+ * The directive's selector is built using the provided `name`, `prefix`, and other options. The class is decorated with `@Directive`
24
+ * and configured with properties and dependency injections as needed for operation.
25
+ *
26
+ * If `template` is true, additional configurations are applied to handle templates, including setting up input properties for
27
+ * parameters, error templates, and empty states. Depending on whether `collection` is true, the directive is extended from either
28
+ * `RemoteMethodTemplateDirective` or `RemoteMethodTemplateCollectionDirective`.
29
+ *
30
+ * Finally, the newly created directive class is added to the source file along with necessary Angular and custom imports.
31
+ *
32
+ */
2
33
  export declare function CreateDirective({ filePath, sourceFile, name, prefix, parametersType, returnType, template, collection, withoutParameters, }: CreateDirectiveOptions): void;
@@ -4,12 +4,51 @@ exports.CreateDirective = void 0;
4
4
  const core_1 = require("@angular-devkit/core");
5
5
  const ts_morph_1 = require("ts-morph");
6
6
  const const_1 = require("./const");
7
+ /**
8
+ * Asserts that the given object is an array of `OptionalKind<ImportSpecifierStructure>`.
9
+ * This function is a type guard that narrows the type of `obj` from `any` to `Array<OptionalKind<ImportSpecifierStructure>>`
10
+ * by asserting the specific structure expected in the array elements.
11
+ *
12
+ * @param obj - The object to be checked.
13
+ * @throws {Error} Throws an error if `obj` is not an array or if it does not match the expected structure.
14
+ */
7
15
  function AssertImportSpecifierStructureArray(obj) {
8
16
  if (!obj || !Array.isArray(obj)) {
9
17
  throw new Error('Should be a array of OptionalKind<ImportSpecifierStructure>');
10
18
  }
11
19
  }
12
20
  const { classify, camelize, } = core_1.strings;
21
+ /**
22
+ *
23
+ *
24
+ * Dynamically creates and registers an Angular directive for a remote method invocation based on the provided options.
25
+ * The directive can optionally handle templates and collections, and is configured to be injectable with necessary services.
26
+ *
27
+ * @param {CreateDirectiveOptions} options - Configuration options for creating the directive, including:
28
+ * - `filePath`: The file path where the directive is to be added.
29
+ * - `sourceFile`: The TypeScript source file object to which the directive will be added.
30
+ * - `name`: The base name for the directive, used in naming and selector generation.
31
+ * - `prefix`: Optional prefix for the directive selector.
32
+ * - `parametersType`: The TypeScript type of the parameters that the directive accepts.
33
+ * - `returnType`: The TypeScript type of the value returned by the remote method.
34
+ * - `template`: Boolean indicating whether the directive uses a template.
35
+ * - `collection`: Boolean indicating whether the directive handles a collection of items.
36
+ * - `withoutParameters`: Boolean indicating if the directive operates without parameters.
37
+ *
38
+ * The function constructs the directive by defining its class, imports, selector, and injectable services based on the options.
39
+ * It checks for existing class declarations with the same name to avoid duplicates. If a duplicate is found, a warning is logged
40
+ * and the function exits early. Otherwise, it proceeds to set up the directive's metadata, constructor, and class properties.
41
+ *
42
+ * The directive's selector is built using the provided `name`, `prefix`, and other options. The class is decorated with `@Directive`
43
+ * and configured with properties and dependency injections as needed for operation.
44
+ *
45
+ * If `template` is true, additional configurations are applied to handle templates, including setting up input properties for
46
+ * parameters, error templates, and empty states. Depending on whether `collection` is true, the directive is extended from either
47
+ * `RemoteMethodTemplateDirective` or `RemoteMethodTemplateCollectionDirective`.
48
+ *
49
+ * Finally, the newly created directive class is added to the source file along with necessary Angular and custom imports.
50
+ *
51
+ */
13
52
  function CreateDirective({ filePath, sourceFile, name, prefix, parametersType, returnType, template, collection, withoutParameters, }) {
14
53
  const remoteMethodName = classify([name, const_1.REMOTE_METHOD_FILE_SUFFIX].join('-'));
15
54
  const directiveNameParts = [remoteMethodName];
@@ -1 +1 @@
1
- {"version":3,"file":"create-directive.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/create-directive.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uCAWkB;AAClB,mCAAoD;AAGpD,SAAS,mCAAmC,CAAC,GAAQ;IACnD,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,MAAM,EACJ,QAAQ,EACR,QAAQ,GACT,GAAG,cAAO,CAAC;AAEZ,SAAgB,eAAe,CAAC,EACE,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,GACM;IACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAE,IAAI,EAAE,iCAAyB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjF,MAAM,kBAAkB,GAAG,CAAE,gBAAgB,CAAE,CAAC;IAEhD,IAAI,QAAQ,EAAE,CAAC;QACb,kBAAkB,CAAC,IA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AI;KACjB,CAAC;IAEF,UAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IAC7C,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;AACpD,CAAC;AAlUD,0CAkUC"}
1
+ {"version":3,"file":"create-directive.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/create-directive.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uCAWkB;AAClB,mCAAoD;AAGpD;;;;;;;GAOG;AACH,SAAS,mCAAmC,CAAC,GAAQ;IACnD,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,MAAM,EACJ,QAAQ,EACR,QAAQ,GACT,GAAG,cAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,eAAe,CAAC,EACE,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,GACM;IACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,CAAE,IAAI,EAAE,iCAAyB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjF,MAAM,kBAAkB,GAAG,CAAE,gBAAgB,CAAE,CAAC;IAEhD,IAAI,QAAQ,EAAE,CAAC;QACb,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAErC,MAAM,aAAa,GAAG,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE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A0B,CAAC,YAAY,CAAC,IAAI,CAC1C,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAC7B,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAC5B,EAAE,IAAI,EAAE,OAAO,EAAE,CAClB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,qBAAqB,GAAG,yBAA0B,UAAW,KAAM,cAAe,GAAG,CAAC;QACtF,oCAAoC,CAAC,YAAY,CAAC,IAAI,CAAC;YACrD,IAAI,EAAE,uBAAuB;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,MAAM,uBAAuB,GAA4C;QACvE,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,WAAW;gBACjB,SAAS,EAAE,kBAAO,CAAC,MAAM,CAAC;oBACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAK,QAAS,GAAG,CAAC;oBACrD,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;oBAC5C,UAAU,EAAE,MAAM;iBACnB,CAAC;aACH;SACF;QACD,OAAO,EAAE,qBAAqB;QAC9B,KAAK,EAAE;YACL;gBACE,UAAU,EAAE,eAAe;gBAC3B,UAAU,EAAE;oBACV,SAAU,yBAA0B,IAAI,EAAE,8CAA8C,EAAE,GAAG,eAAe;iBAC7G;aACF;SACF;QACD,YAAY,EAAE,0BAA0B;QACxC,UAAU,EAAE,wBAAwB;QACpC,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,UAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IAC7C,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;AACpD,CAAC;AAlUD,0CAkUC"}
@@ -1,3 +1,12 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
+ /**
4
+ * Processes and generates TypeScript interfaces for the given OpenAPI components within a specified project.
5
+ *
6
+ * This function iterates over the `schemas` property of the provided OpenAPI components object. For each schema,
7
+ * it invokes a function to build and integrate the corresponding TypeScript interface into the given project.
8
+ *
9
+ * @param {OpenAPIV3.ComponentsObject} components - An object containing OpenAPI component definitions, which should include schemas for interface generation.
10
+ * @param {Project} project - The project context where the generated interfaces will be added.
11
+ */
3
12
  export declare function GenerateComponents(components: OpenAPIV3.ComponentsObject, project: Project): void;
@@ -3,6 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GenerateComponents = void 0;
4
4
  const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
5
5
  const config_1 = require("./config");
6
+ /**
7
+ * Generates TypeScript interfaces for specified components based on the OpenAPI schema.
8
+ *
9
+ * This function initializes a TypeScript interface generator with provided schema and components,
10
+ * then attempts to generate a TypeScript interface synchronously. It logs the process and captures
11
+ * any errors that occur during the generation process.
12
+ *
13
+ * @param {OpenAPIV3.ComponentsObject} components - The components object from the OpenAPI specification
14
+ * which includes definitions of objects used across multiple APIs.
15
+ * @param {Project} project - The project context in which the interfaces are being generated, typically
16
+ * including configuration and environment-specific details.
17
+ * @param {any} schema - The complete schema object of the API from which TypeScript interfaces will be
18
+ * generated. This should comply with the OpenAPI specification.
19
+ * @param {string} name - The name of the component for which the interface is to be generated. This name
20
+ * is used both in logging and as an identifier in the generation process.
21
+ *
22
+ * @remarks
23
+ * The function uses `TypescriptInterfaceGenerator` to handle the interface generation. The generator
24
+ * is configured to include imports and to use a predefined base path for components.
25
+ *
26
+ * @example
27
+ * executeInterfaceBuild(apiComponents, myProject, apiSchema, 'User');
28
+ */
6
29
  function executeInterfaceBuild(components, project, schema, name) {
7
30
  const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, schema), { components }), {
8
31
  basePath: config_1.COMPONENTS_BASE_PATH,
@@ -16,6 +39,15 @@ function executeInterfaceBuild(components, project, schema, name) {
16
39
  console.error(`Failed to generate response interface for: ${name}`, error.message);
17
40
  }
18
41
  }
42
+ /**
43
+ * Processes and generates TypeScript interfaces for the given OpenAPI components within a specified project.
44
+ *
45
+ * This function iterates over the `schemas` property of the provided OpenAPI components object. For each schema,
46
+ * it invokes a function to build and integrate the corresponding TypeScript interface into the given project.
47
+ *
48
+ * @param {OpenAPIV3.ComponentsObject} components - An object containing OpenAPI component definitions, which should include schemas for interface generation.
49
+ * @param {Project} project - The project context where the generated interfaces will be added.
50
+ */
19
51
  function GenerateComponents(components, project) {
20
52
  if (components.schemas) {
21
53
  for (const [name, schema] of Object.entries(components.schemas)) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-components.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAI/E,qCAAgD;AAEhD,SAAS,qBAAqB,CAC5B,UAAsC,EACtC,OAAgB,EAChB,MAAW,EACX,IAAY;IAGZ,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,MAAM,KACT,UAAU,KAEZ;QACE,QAAQ,EAAE,6BAAoB;QAC9B,UAAU,EAAE,IAAI;KACjB,EACD,OAAO,CACR,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,IAAK,EAAE,CAAC,CAAC;IAE7D,IAAI,CAAC;QAEH,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAE5B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,8CAA+C,IAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,UAAsC,EACtC,OAAgB;IAGhB,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,MAAM,CAAE,IAAI,EAAE,MAAM,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAClE,qBAAqB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AAEH,CAAC;AAXD,gDAWC"}
1
+ {"version":3,"file":"generate-components.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-components.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAI/E,qCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,qBAAqB,CAC5B,UAAsC,EACtC,OAAgB,EAChB,MAAW,EACX,IAAY;IAGZ,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,MAAM,KACT,UAAU,KAEZ;QACE,QAAQ,EAAE,6BAAoB;QAC9B,UAAU,EAAE,IAAI;KACjB,EACD,OAAO,CACR,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,IAAK,EAAE,CAAC,CAAC;IAE7D,IAAI,CAAC;QAEH,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAE5B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,8CAA+C,IAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAChC,UAAsC,EACtC,OAAgB;IAGhB,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,MAAM,CAAE,IAAI,EAAE,MAAM,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAClE,qBAAqB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AAEH,CAAC;AAXD,gDAWC"}
@@ -1,2 +1,23 @@
1
1
  import { GenerateParameter } from './types';
2
+ /**
3
+ * Generates a TypeScript source file for an OpenAPI data source class based on the provided parameters.
4
+ * This function only processes GET methods and creates a new source file in a specified base path with necessary imports and a class definition.
5
+ *
6
+ * @param {GenerateParameter} parameter - The parameters required to generate the data source, including:
7
+ * - `method`: The HTTP method (only 'GET' is processed).
8
+ * - `operationId`: The unique identifier for the operation.
9
+ * - `project`: The project within which the source file will be created.
10
+ * - `options`: Additional options such as package name for custom imports.
11
+ *
12
+ * The function performs the following steps:
13
+ * 1. Validates if the HTTP method is 'GET'. If not, the function returns immediately.
14
+ * 2. Constructs the file name using the operation ID and predefined suffixes and paths.
15
+ * 3. Creates a new TypeScript source file in the specified project directory.
16
+ * 4. Determines the response and parameter types for the data source and adds necessary imports.
17
+ * 5. Defines a class that extends `OpenApiDataSource` with decorators for dependency injection and OpenAPI integration.
18
+ * 6. Writes the newly defined class and imports to the source file.
19
+ *
20
+ * Note: The function assumes the presence of utility functions like `dasherize` and `classify` for naming conventions,
21
+ * and constants like `DATA_SOURCE_FILE_SUFFIX` and `DATA_SOURCE_BASE_PATH` for file naming and location.
22
+ */
2
23
  export declare function GenerateDataSource(parameter: GenerateParameter): void;
@@ -8,6 +8,27 @@ const const_1 = require("./const");
8
8
  const get_parameter_type_1 = require("./utilities/get-parameter-type");
9
9
  const get_response_type_1 = require("./utilities/get-response-type");
10
10
  const { dasherize, classify, } = core_1.strings;
11
+ /**
12
+ * Generates a TypeScript source file for an OpenAPI data source class based on the provided parameters.
13
+ * This function only processes GET methods and creates a new source file in a specified base path with necessary imports and a class definition.
14
+ *
15
+ * @param {GenerateParameter} parameter - The parameters required to generate the data source, including:
16
+ * - `method`: The HTTP method (only 'GET' is processed).
17
+ * - `operationId`: The unique identifier for the operation.
18
+ * - `project`: The project within which the source file will be created.
19
+ * - `options`: Additional options such as package name for custom imports.
20
+ *
21
+ * The function performs the following steps:
22
+ * 1. Validates if the HTTP method is 'GET'. If not, the function returns immediately.
23
+ * 2. Constructs the file name using the operation ID and predefined suffixes and paths.
24
+ * 3. Creates a new TypeScript source file in the specified project directory.
25
+ * 4. Determines the response and parameter types for the data source and adds necessary imports.
26
+ * 5. Defines a class that extends `OpenApiDataSource` with decorators for dependency injection and OpenAPI integration.
27
+ * 6. Writes the newly defined class and imports to the source file.
28
+ *
29
+ * Note: The function assumes the presence of utility functions like `dasherize` and `classify` for naming conventions,
30
+ * and constants like `DATA_SOURCE_FILE_SUFFIX` and `DATA_SOURCE_BASE_PATH` for file naming and location.
31
+ */
11
32
  function GenerateDataSource(parameter) {
12
33
  var _a, _b;
13
34
  if (parameter.method.toUpperCase() !== 'GET') {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-data-source.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-data-source.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,+BAA4B;AAC5B,uCAKkB;AAClB,mCAGiB;AAEjB,uEAAkE;AAClE,qEAAgE;AAEhE,MAAM,EACJ,SAAS,EACT,QAAQ,GACT,GAAG,cAAO,CAAC;AAEZ,SAAgB,kBAAkB,CAChC,SAA4B;;IAE5B,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,+BAAuB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,6BAAqB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAEtE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEhE,MAAM,gBAAgB,GAAoD;QACxE;YACE,eAAe,EAAE,4BAA4B;YAC7C,YAAY,EAAE;gBACZ,EAAE,IAAI,EAAE,uBAAuB,EAAE;gBACjC,EAAE,IAAI,EAAE,mBAAmB,EAAE;aAC9B;SACF;QACD;YACE,eAAe,EAAE,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I,EAAE,uBAAuB;gBAC7B,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;aACjD;SACF;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACnD,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AACtC,CAAC;AA7ED,gDA6EC"}
1
+ {"version":3,"file":"generate-data-source.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-data-source.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,+BAA4B;AAC5B,uCAKkB;AAClB,mCAGiB;AAEjB,uEAAkE;AAClE,qEAAgE;AAEhE,MAAM,EACJ,SAAS,EACT,QAAQ,GACT,GAAG,cAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,kBAAkB,CAChC,SAA4B;;IAE5B,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,+BAAuB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,6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AAC;IACL,CAAC;IAED,MAAM,cAAc,GAA4C;QAC9D,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACxC,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,YAAY;gBAClB,SAAS,EAAE,kBAAO,CAAC,MAAM,CAAC;oBACxB,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;iBAC7C,CAAC;aACH;YACD;gBACE,IAAI,EAAE,uBAAuB;gBAC7B,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;aACjD;SACF;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACnD,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AACtC,CAAC;AA7ED,gDA6EC"}
@@ -1,2 +1,25 @@
1
1
  import { GenerateParameter, OpenApiSchemaBase } from './types';
2
+ /**
3
+ * Generates TypeScript directive files for handling API operations defined in an OpenAPI specification.
4
+ * This function creates one or more directive files based on the provided operation details, handling
5
+ * different scenarios such as response collections and parameter requirements.
6
+ *
7
+ * @param parameter - An object of type `GenerateParameter<OpenApiSchemaBase>` containing all necessary
8
+ * information to generate the directive files. This includes the operation ID, project context, and
9
+ * additional options such as response and parameter types.
10
+ *
11
+ * The function performs the following steps:
12
+ * 1. Constructs the file name from the operation ID and predefined suffixes.
13
+ * 2. Initializes a new source file in the project for the directive.
14
+ * 3. Dynamically constructs import statements based on the operation's requirements, such as response
15
+ * types, parameter types, and request body types.
16
+ * 4. Determines if the operation's response is a collection and adjusts the directive accordingly.
17
+ * 5. Creates one or more directives in the source file to handle the API operation, considering whether
18
+ * the operation requires parameters and if it should be treated as a collection.
19
+ * 6. Organizes and adds all necessary import declarations to the source file.
20
+ * 7. Ensures proper formatting and organization of imports in the created source file.
21
+ *
22
+ * This function is designed to automate the boilerplate creation of TypeScript directives for API operations,
23
+ * facilitating easier and more maintainable API integration within projects using the OpenAPI specification.
24
+ */
2
25
  export declare function GenerateDirectives(parameter: GenerateParameter<OpenApiSchemaBase>): void;
@@ -10,6 +10,29 @@ const get_request_body_type_1 = require("./utilities/get-request-body-type");
10
10
  const get_response_type_1 = require("./utilities/get-response-type");
11
11
  const is_collection_response_1 = require("./utilities/is-collection-response");
12
12
  const is_without_parameters_1 = require("./utilities/is-without-parameters");
13
+ /**
14
+ * Generates TypeScript directive files for handling API operations defined in an OpenAPI specification.
15
+ * This function creates one or more directive files based on the provided operation details, handling
16
+ * different scenarios such as response collections and parameter requirements.
17
+ *
18
+ * @param parameter - An object of type `GenerateParameter<OpenApiSchemaBase>` containing all necessary
19
+ * information to generate the directive files. This includes the operation ID, project context, and
20
+ * additional options such as response and parameter types.
21
+ *
22
+ * The function performs the following steps:
23
+ * 1. Constructs the file name from the operation ID and predefined suffixes.
24
+ * 2. Initializes a new source file in the project for the directive.
25
+ * 3. Dynamically constructs import statements based on the operation's requirements, such as response
26
+ * types, parameter types, and request body types.
27
+ * 4. Determines if the operation's response is a collection and adjusts the directive accordingly.
28
+ * 5. Creates one or more directives in the source file to handle the API operation, considering whether
29
+ * the operation requires parameters and if it should be treated as a collection.
30
+ * 6. Organizes and adds all necessary import declarations to the source file.
31
+ * 7. Ensures proper formatting and organization of imports in the created source file.
32
+ *
33
+ * This function is designed to automate the boilerplate creation of TypeScript directives for API operations,
34
+ * facilitating easier and more maintainable API integration within projects using the OpenAPI specification.
35
+ */
13
36
  function GenerateDirectives(parameter) {
14
37
  var _a, _b, _c;
15
38
  const operationId = parameter.operationId;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-directives.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-directives.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,+BAA4B;AAK5B,mCAIiB;AACjB,yDAAqD;AAKrD,uEAAkE;AAClE,6EAAuE;AACvE,qEAAgE;AAChE,+EAA0E;AAC1E,6EAAwE;AAExE,SAAgB,kBAAkB,CAAC,SAA+C;;IAChF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,6BAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,2BAAmB,EAAE,IAAA,qBAAS,EAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAEpE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEhE,MAAM,gBAAgB,GAAoD;QACxE;YACE,eAAe,EAAE,8BAA8B;YAC/C,YAAY,EAAE;gBACZ,EAAE,IAAI,EAAE,yBAAyB,EAAE,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;aAC9E;SACF,EAAE;YACD,eAAe,EAAE,eAAe;YAChC,YAAY,EAAE,CAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAE;SACzC;QACD;YACE,eAAe,EAAE,qBAAsB,IAAA,qBAAS,EAAC,WAAW,CAAE,IAAK,iCAA0B,EAAE;YAC/F,YAAY,EAAE,CAAE,IAAA,oBAAQ,EAAC,CAAE,WAAW,EAAE,iCAAyB,CAAE,CAAC,IAAI,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AAM,eAAgB,GAAG;QACxF,UAAU,EAAE,YAAY;QACxB,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;QACjB,UAAU;QACV,iBAAiB;KAClB,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,UAAU,CAAC,eAAe,CAAC;QACzB,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;AAEL,CAAC;AAjHD,gDAiHC"}
1
+ {"version":3,"file":"generate-directives.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-directives.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,+BAA4B;AAK5B,mCAIiB;AACjB,yDAAqD;AAKrD,uEAAkE;AAClE,6EAAuE;AACvE,qEAAgE;AAChE,+EAA0E;AAC1E,6EAAwE;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,kBAAkB,CAAC,SAA+C;;IAChF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,6BAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,2BAAmB,EAAE,IAAA,qBAAS,EAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAEpE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEhE,MAAM,gBAAgB,GAAoD;QACxE;YACE,eAAe,EAAE,8BAA8B;YAC/C,YAAY,EAAE;gBACZ,EAAE,IAAI,EAAE,yBAAyB,EAAE,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;aAC9E;SACF,EAAE;YACD,eAAe,EAAE,eAAe;YAChC,YAAY,EAAE,CAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAE;SACzC;QACD;YACE,eAAe,EAAE,qBAAsB,I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Ae,EAAC;QACd,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM;QAChC,cAAc,EAAE,gCAAiC,aAAc,KAAM,eAAgB,GAAG;QACxF,UAAU,EAAE,YAAY;QACxB,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;QACjB,UAAU;QACV,iBAAiB;KAClB,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,UAAU,CAAC,eAAe,CAAC;QACzB,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;AAEL,CAAC;AAjHD,gDAiHC"}
@@ -1,2 +1,17 @@
1
1
  import { Project } from 'ts-morph';
2
+ /**
3
+ * Generates a string of export statements for all source files within a given project.
4
+ * Each export statement is formatted to export all members from the respective source file.
5
+ *
6
+ * @param {Project} project - The project from which to generate export statements.
7
+ * @returns {string} A single string containing newline-separated export statements for each source file in the project.
8
+ *
9
+ * @example
10
+ * // Assuming the project has source files in 'src/lib/Example.ts' and 'src/lib/Utils.ts'
11
+ * const projectExports = GenerateIndexExports(project);
12
+ * console.log(projectExports);
13
+ * // Output:
14
+ * // export * from './lib/Example';
15
+ * // export * from './lib/Utils';
16
+ */
2
17
  export declare function GenerateIndexExports(project: Project): string;
@@ -2,6 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GenerateIndexExports = void 0;
4
4
  const path_1 = require("path");
5
+ /**
6
+ * Generates a string of export statements for all source files within a given project.
7
+ * Each export statement is formatted to export all members from the respective source file.
8
+ *
9
+ * @param {Project} project - The project from which to generate export statements.
10
+ * @returns {string} A single string containing newline-separated export statements for each source file in the project.
11
+ *
12
+ * @example
13
+ * // Assuming the project has source files in 'src/lib/Example.ts' and 'src/lib/Utils.ts'
14
+ * const projectExports = GenerateIndexExports(project);
15
+ * console.log(projectExports);
16
+ * // Output:
17
+ * // export * from './lib/Example';
18
+ * // export * from './lib/Utils';
19
+ */
5
20
  function GenerateIndexExports(project) {
6
21
  const exports = [];
7
22
  for (const sourceFile of project.getSourceFiles()) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAG5B,SAAgB,oBAAoB,CAAC,OAAgB;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAElD,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,mBAAoB,IAAA,WAAI,EACnC,MAAM,EACN,UAAU,CAAC,gBAAgB,EAAE,EAC7B,UAAU,CAAC,2BAA2B,EAAE,CACxC,IAAI,CAAC,CAAC;IAEV,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5B,CAAC;AAlBD,oDAkBC"}
1
+ {"version":3,"file":"generate-index-exports.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-index-exports.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAG5B;;;;;;;;;;;;;;GAcG;AACH,SAAgB,oBAAoB,CAAC,OAAgB;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAElD,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,mBAAoB,IAAA,WAAI,EACnC,MAAM,EACN,UAAU,CAAC,gBAAgB,EAAE,EAC7B,UAAU,CAAC,2BAA2B,EAAE,CACxC,IAAI,CAAC,CAAC;IAEV,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5B,CAAC;AAlBD,oDAkBC"}
@@ -1,3 +1,20 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
+ /**
4
+ * Generates TypeScript interfaces for a given OpenAPI 3.0 document within a specified project context.
5
+ * This function processes both the components and paths defined in the OpenAPI document to create corresponding TypeScript interfaces.
6
+ *
7
+ * @param openapi - The OpenAPI 3.0 document object which includes the API specification.
8
+ * @param project - The project context where the generated interfaces will be used or stored.
9
+ *
10
+ * The function performs the following steps:
11
+ * 1. Extracts the components object from the OpenAPI document. If not present, it attempts to retrieve the deprecated 'definitions' object, defaulting to an empty object if neither are available.
12
+ * 2. Invokes `GenerateComponents` to create interfaces for the components (schemas) defined in the OpenAPI document.
13
+ * 3. Iterates over each path in the OpenAPI document. For each path, it processes the HTTP methods associated with it.
14
+ * 4. For each method, it checks if the operation should be ignored based on custom criteria (e.g., tagged as 'hidden').
15
+ * 5. If the operation is not ignored and has an operation ID, it generates TypeScript interfaces for the parameters, request body, and responses of the operation using respective generator functions.
16
+ * 6. Logs a warning if an operation lacks an operation ID, which is essential for generating accurate and meaningful interfaces.
17
+ *
18
+ * Note: This function directly logs to the console for operations that are ignored or lack an operation ID, which might be used for debugging or informational purposes.
19
+ */
3
20
  export declare function GenerateInterfaces(openapi: OpenAPIV3.Document, project: Project): void;
@@ -9,6 +9,23 @@ const types_1 = require("./types");
9
9
  const ignore_operation_1 = require("./utilities/ignore-operation");
10
10
  const is_http_method_1 = require("./utilities/is-http-method");
11
11
  const is_operation_object_1 = require("./utilities/is-operation-object");
12
+ /**
13
+ * Generates TypeScript interfaces for a given OpenAPI 3.0 document within a specified project context.
14
+ * This function processes both the components and paths defined in the OpenAPI document to create corresponding TypeScript interfaces.
15
+ *
16
+ * @param openapi - The OpenAPI 3.0 document object which includes the API specification.
17
+ * @param project - The project context where the generated interfaces will be used or stored.
18
+ *
19
+ * The function performs the following steps:
20
+ * 1. Extracts the components object from the OpenAPI document. If not present, it attempts to retrieve the deprecated 'definitions' object, defaulting to an empty object if neither are available.
21
+ * 2. Invokes `GenerateComponents` to create interfaces for the components (schemas) defined in the OpenAPI document.
22
+ * 3. Iterates over each path in the OpenAPI document. For each path, it processes the HTTP methods associated with it.
23
+ * 4. For each method, it checks if the operation should be ignored based on custom criteria (e.g., tagged as 'hidden').
24
+ * 5. If the operation is not ignored and has an operation ID, it generates TypeScript interfaces for the parameters, request body, and responses of the operation using respective generator functions.
25
+ * 6. Logs a warning if an operation lacks an operation ID, which is essential for generating accurate and meaningful interfaces.
26
+ *
27
+ * Note: This function directly logs to the console for operations that are ignored or lack an operation ID, which might be used for debugging or informational purposes.
28
+ */
12
29
  function GenerateInterfaces(openapi, project) {
13
30
  var _a, _b;
14
31
  const components = (_b = (_a = openapi.components) !== null && _a !== void 0 ? _a : openapi.definitions) !== null && _b !== void 0 ? _b : {};
@@ -1 +1 @@
1
- {"version":3,"file":"generate-interfaces.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-interfaces.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,+DAA2D;AAC3D,mEAA8D;AAC9D,2DAAuD;AACvD,mCAAyC;AACzC,mEAA+D;AAC/D,+DAA0D;AAC1D,yEAAoE;AAEpE,SAAgB,kBAAkB,CAChC,OAA2B,EAC3B,OAAgB;;IAEhB,MAAM,UAAU,GAA+B,MAAA,MAAC,OAAe,CAAC,UAAU,mCAAK,OAAe,CAAC,WAAW,mCAAI,EAAE,CAAC;IAEjH,IAAA,wCAAkB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAExC,KAAK,MAAM,CAAE,IAAI,EAAE,OAAO,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAE9D,IAAI,OAAO,EAAE,CAAC;YAEZ,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE,CAAC;gBAE/D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;gBAElC,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,EAAE,CAAC;oBAEjC,IAAI,IAAA,kCAAe,EAAC,CAAE,QAAQ,CAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;wBAE7C,OAAO,CAAC,GAAG,CAAC,qBAAsB,SAAS,CAAC,WAAY,GAAG,CAAC,CAAC;oBAE/D,CAAC;yBAAM,CAAC;wBAEN,IAAI,IAAA,sBAAc,EAAC,SAAS,CAAC,EAAE,CAAC;4BAE9B,IAAA,wCAAkB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;4BACnD,IAAA,2CAAmB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;4BACpD,IAAA,oCAAgB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;wBAEnD,CAAC;6BAAM,CAAC;4BACN,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;wBAC5D,CAAC;oBAEH,CAAC;gBAEH,CAAC;YAEH,CAAC;QAEH,CAAC;IAEH,CAAC;AAEH,CAAC;AA5CD,gDA4CC"}
1
+ {"version":3,"file":"generate-interfaces.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-interfaces.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,+DAA2D;AAC3D,mEAA8D;AAC9D,2DAAuD;AACvD,mCAAyC;AACzC,mEAA+D;AAC/D,+DAA0D;AAC1D,yEAAoE;AAEpE;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,kBAAkB,CAChC,OAA2B,EAC3B,OAAgB;;IAEhB,MAAM,UAAU,GAA+B,MAAA,MAAC,OAAe,CAAC,UAAU,mCAAK,OAAe,CAAC,WAAW,mCAAI,EAAE,CAAC;IAEjH,IAAA,wCAAkB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAExC,KAAK,MAAM,CAAE,IAAI,EAAE,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