@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
@@ -1,2 +1,31 @@
1
1
  import { GenerateParameter, OpenApiSchemaBase } from './types';
2
+ /**
3
+ *
4
+ *
5
+ * Asynchronously generates a TypeScript source file for an operation command based on the provided OpenAPI schema.
6
+ * The function constructs the file name and path from the operation ID, imports necessary modules and types,
7
+ * and creates a new class that extends `OpenApiOperationCommand` with appropriate decorators and methods.
8
+ *
9
+ * @param parameter - An object containing the operation ID, project reference, and additional options necessary
10
+ * for generating the operation command. The `GenerateParameter` type is expected to be a generic
11
+ * type that includes `OpenApiSchemaBase`.
12
+ * @returns A promise that resolves when the file has been created and all modifications are applied.
13
+ *
14
+ * The function performs the following steps:
15
+ * 1. Constructs the file name from the operation ID and predefined suffixes.
16
+ * 2. Creates a new TypeScript source file in the specified command base path.
17
+ * 3. Dynamically imports necessary decorators and types based on the operation's response type, parameter type,
18
+ * and request body type.
19
+ * 4. Defines a new class with the `Injectable` and `OperationCommand` decorators.
20
+ * - `Injectable` marks the class as a candidate for dependency injection.
21
+ * - `OperationCommand` configures the operation-specific metadata like server ID and operation ID.
22
+ * 5. Adds an `execute` method to the class, which overrides the base class method and handles the operation execution.
23
+ * 6. The class is structured to handle different scenarios based on whether the operation has parameters, a request body,
24
+ * or neither.
25
+ *
26
+ * Note: This function assumes the presence of certain global constants and functions like `COMMAND_FILE_SUFFIX`,
27
+ * `COMMAND_BASE_PATH`, `dasherize`, `GetResponseType`, `GetParameterType`, `GetRequestBodyType`, and
28
+ * `GenerateParameterToOperationObjectWithMetadata`, which are used to configure and structure the generated command class.
29
+ *
30
+ */
2
31
  export declare function GenerateOperationCommand(parameter: GenerateParameter<OpenApiSchemaBase>): Promise<void>;
@@ -10,6 +10,35 @@ const types_1 = require("./types");
10
10
  const get_parameter_type_1 = require("./utilities/get-parameter-type");
11
11
  const get_request_body_type_1 = require("./utilities/get-request-body-type");
12
12
  const get_response_type_1 = require("./utilities/get-response-type");
13
+ /**
14
+ *
15
+ *
16
+ * Asynchronously generates a TypeScript source file for an operation command based on the provided OpenAPI schema.
17
+ * The function constructs the file name and path from the operation ID, imports necessary modules and types,
18
+ * and creates a new class that extends `OpenApiOperationCommand` with appropriate decorators and methods.
19
+ *
20
+ * @param parameter - An object containing the operation ID, project reference, and additional options necessary
21
+ * for generating the operation command. The `GenerateParameter` type is expected to be a generic
22
+ * type that includes `OpenApiSchemaBase`.
23
+ * @returns A promise that resolves when the file has been created and all modifications are applied.
24
+ *
25
+ * The function performs the following steps:
26
+ * 1. Constructs the file name from the operation ID and predefined suffixes.
27
+ * 2. Creates a new TypeScript source file in the specified command base path.
28
+ * 3. Dynamically imports necessary decorators and types based on the operation's response type, parameter type,
29
+ * and request body type.
30
+ * 4. Defines a new class with the `Injectable` and `OperationCommand` decorators.
31
+ * - `Injectable` marks the class as a candidate for dependency injection.
32
+ * - `OperationCommand` configures the operation-specific metadata like server ID and operation ID.
33
+ * 5. Adds an `execute` method to the class, which overrides the base class method and handles the operation execution.
34
+ * 6. The class is structured to handle different scenarios based on whether the operation has parameters, a request body,
35
+ * or neither.
36
+ *
37
+ * Note: This function assumes the presence of certain global constants and functions like `COMMAND_FILE_SUFFIX`,
38
+ * `COMMAND_BASE_PATH`, `dasherize`, `GetResponseType`, `GetParameterType`, `GetRequestBodyType`, and
39
+ * `GenerateParameterToOperationObjectWithMetadata`, which are used to configure and structure the generated command class.
40
+ *
41
+ */
13
42
  function GenerateOperationCommand(parameter) {
14
43
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
44
  var _a, _b, _c;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-operation-command.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-operation-command.ts"],"names":[],"mappings":";;;;AAAA,+CAGyB;AACzB,+BAA4B;AAC5B,uCAOkB;AAClB,mCAGiB;AACjB,mCAIiB;AACjB,uEAAkE;AAClE,6EAAuE;AACvE,qEAAgE;AAEhE,SAAsB,wBAAwB,CAC5C,SAA+C;;;QAE/C,MAAM,WAAW,G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ClB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBAC3B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnB,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;gBAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;YACD,UAAU,EAAE,IAAI;SACjB,CAAC;QAEF,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAEpC,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC;CAAA;AAzID,4DAyIC"}
1
+ {"version":3,"file":"generate-operation-command.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-operation-command.ts"],"names":[],"mappings":";;;;AAAA,+CAGyB;AACzB,+BAA4B;AAC5B,uCAOkB;AAClB,mCAGiB;AACjB,mCAIiB;AACjB,uEAAkE;AAClE,6EAAuE;AACvE,qEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAsB,wBAAwB,CAC5C,SAA+C;;;QAE/C,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,2BAAmB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5D,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,yBAAiB,EAAE,IAAA,qBAAS,EAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAElE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEhE,MAAM,gBAAgB,GAAoD;YACxE;gBACE,eAAe,EAAE,qBAAqB;gBACtC,YAAY,EAAE;oBACZ,EAAE,IAAI,EAAE,yB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BAAgB,CAAC,CAAC;IACrD,CAAC;CAAA;AAzID,4DAyIC"}
@@ -1,4 +1,24 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
3
  import { GeneratorFunction, OpenApiSchemaBase } from './types';
4
+ /**
5
+ * Processes and generates operations based on the provided OpenAPI specification.
6
+ *
7
+ * This function iterates over each path and method in the OpenAPI document, executing a list of generator functions
8
+ * for operations that are not marked as 'hidden' and have an operation ID. It handles the generation of API operations
9
+ * by utilizing custom generator functions provided by the user, which can manipulate or utilize the operation data.
10
+ *
11
+ * @param openapi - The OpenAPI version 3 document which contains the API specification.
12
+ * @param project - The project context in which the operations are being generated.
13
+ * @param options - Configuration options specific to the generation process, extending from a base schema.
14
+ * @param generatorFunctionList - An array of generator functions that take the operation data and perform tasks such as code generation.
15
+ *
16
+ * @typeParam Options - A generic type parameter extending from `OpenApiSchemaBase` which dictates the shape of the options parameter.
17
+ *
18
+ * @remarks
19
+ * - The function logs a message for operations marked as 'hidden'.
20
+ * - It warns if an operation does not have an operation ID.
21
+ * - The function assumes the presence of either `components` or `definitions` in the OpenAPI document for schema references.
22
+ * - It filters out non-HTTP methods from the paths object, ensuring that only valid HTTP operations are processed.
23
+ */
4
24
  export declare function GenerateOperation<Options extends OpenApiSchemaBase = OpenApiSchemaBase>(openapi: OpenAPIV3.Document, project: Project, options: Options, generatorFunctionList: GeneratorFunction<Options>[]): void;
@@ -5,6 +5,27 @@ const types_1 = require("./types");
5
5
  const ignore_operation_1 = require("./utilities/ignore-operation");
6
6
  const is_http_method_1 = require("./utilities/is-http-method");
7
7
  const is_operation_object_1 = require("./utilities/is-operation-object");
8
+ /**
9
+ * Executes a generator function with the provided parameters to handle OpenAPI operations.
10
+ *
11
+ * This function is designed to execute a specific generator function that processes OpenAPI operations
12
+ * based on the provided project, options, path, method, components, and operation details. It constructs
13
+ * a parameter object that aggregates all these inputs and passes it to the generator function. If the
14
+ * generator function fails, it logs an error message detailing the failure.
15
+ *
16
+ * @param project - The project context in which the generator operates.
17
+ * @param options - Configuration options specific to the generator, constrained by OpenApiSchemaBase.
18
+ * @param path - The API path that is associated with the operation (e.g., '/users/{userId}').
19
+ * @param method - The HTTP method (e.g., 'GET', 'POST') for the operation.
20
+ * @param generatorFunction - The generator function to be executed. It should accept a single argument
21
+ * of type GenerateParameter<Options>.
22
+ * @param components - The OpenAPI components object that may include schemas, responses, parameters, etc.
23
+ * @param operation - The specific OpenAPI operation object that the generator will process.
24
+ *
25
+ * @template Options - A type parameter that extends OpenApiSchemaBase, used to type the options parameter.
26
+ *
27
+ * @throws Will log an error if the generator function throws an exception during execution.
28
+ */
8
29
  function executeGenerator(project, options, path, method, generatorFunction, components, operation) {
9
30
  try {
10
31
  const parameters = Object.assign(Object.assign({}, operation), { components,
@@ -18,6 +39,26 @@ function executeGenerator(project, options, path, method, generatorFunction, com
18
39
  console.error(`Failed to generate [${generatorFunction === null || generatorFunction === void 0 ? void 0 : generatorFunction.name}] for operation: ${operation.operationId}: ${e.message}`);
19
40
  }
20
41
  }
42
+ /**
43
+ * Processes and generates operations based on the provided OpenAPI specification.
44
+ *
45
+ * This function iterates over each path and method in the OpenAPI document, executing a list of generator functions
46
+ * for operations that are not marked as 'hidden' and have an operation ID. It handles the generation of API operations
47
+ * by utilizing custom generator functions provided by the user, which can manipulate or utilize the operation data.
48
+ *
49
+ * @param openapi - The OpenAPI version 3 document which contains the API specification.
50
+ * @param project - The project context in which the operations are being generated.
51
+ * @param options - Configuration options specific to the generation process, extending from a base schema.
52
+ * @param generatorFunctionList - An array of generator functions that take the operation data and perform tasks such as code generation.
53
+ *
54
+ * @typeParam Options - A generic type parameter extending from `OpenApiSchemaBase` which dictates the shape of the options parameter.
55
+ *
56
+ * @remarks
57
+ * - The function logs a message for operations marked as 'hidden'.
58
+ * - It warns if an operation does not have an operation ID.
59
+ * - The function assumes the presence of either `components` or `definitions` in the OpenAPI document for schema references.
60
+ * - It filters out non-HTTP methods from the paths object, ensuring that only valid HTTP operations are processed.
61
+ */
21
62
  function GenerateOperation(openapi, project, options, generatorFunctionList) {
22
63
  var _a, _b;
23
64
  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-operation.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":";;;AAEA,mCAMiB;AACjB,mEAA+D;AAC/D,+DAA0D;AAC1D,yEAAoE;AAEpE,SAAS,gBAAgB,CACvB,OAAgB,EAChB,OAAgB,EAChB,IAAY,EACZ,MAAc,EACd,iBAA6C,EAC7C,UAAsC,EACtC,SAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,UAAU,mCACX,SAAS,KACZ,UAAU;YACV,MAAM;YACN,IAAI;YACJ,OAAO;YACP,OAAO,GACR,CAAC;QACF,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,uBAAwB,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAK,oBAAqB,SAAS,CAAC,WAAY,KAAM,CAAC,CAAC,OAAQ,EAAE,CAAC,CAAC;IAC/H,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAC/B,OAA2B,EAC3B,OAAgB,EAChB,OAAgB,EAChB,qBAAmD;;IAEnD,MAAM,UAAU,GAA+B,MAAA,MAAC,OAAe,CAAC,UAAU,mCAAK,OAAe,CAAC,WAAW,mCAAI,EAAE,CAAC;IAEjH,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,KAAK,MAAM,iBAAiB,IAAI,qBAAqB,EAAE,CAAC;gCAEtD,gBAAgB,CACd,OAAO,EACP,OAAO,EACP,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,UAAU,EACV,SAAS,CACV,CAAC;4BAEJ,CAAC;wBAEH,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;AAtDD,8CAsDC"}
1
+ {"version":3,"file":"generate-operation.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-operation.ts"],"names":[],"mappings":";;;AAEA,mCAMiB;AACjB,mEAA+D;AAC/D,+DAA0D;AAC1D,yEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,gBAAgB,CACvB,OAAgB,EAChB,OAAgB,EAChB,IAAY,EACZ,MAAc,EACd,iBAA6C,EAC7C,UAAsC,EACtC,SAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,UAAU,mCACX,SAAS,KACZ,UAAU;YACV,MAAM;YACN,IAAI;YACJ,OAAO;YACP,OAAO,GACR,CAAC;QACF,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO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BAAM,CAAC;4BACN,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;wBAC5D,CAAC;oBAEH,CAAC;gBAEH,CAAC;YAEH,CAAC;QAEH,CAAC;IAEH,CAAC;AAEH,CAAC;AAtDD,8CAsDC"}
@@ -1,3 +1,30 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
+ /**
4
+ * Generates TypeScript interfaces for the parameters of a given OpenAPI operation object.
5
+ * This function processes the parameters of the operation, excluding those in the 'header',
6
+ * and generates TypeScript interfaces using the TypescriptInterfaceGenerator.
7
+ *
8
+ * @param operation - The OpenAPI operation object containing details about the API operation.
9
+ * @param project - The project context in which the interfaces are generated.
10
+ * @param components - The OpenAPI components object used for resolving any $ref references in the parameters.
11
+ *
12
+ * @remarks
13
+ * This function filters out header parameters and processes only path, query, and cookie parameters.
14
+ * It handles both direct parameter objects and referenced objects found in the components section of the OpenAPI spec.
15
+ * If a referenced object is encountered, it resolves the reference and includes the resolved object in the parameter list.
16
+ * The function throws errors if references are incorrectly formatted or unresolved.
17
+ *
18
+ * The function constructs a schema object that describes the structure of the parameters using the properties and required fields.
19
+ * This schema object is then used by the TypescriptInterfaceGenerator to generate the appropriate TypeScript interfaces.
20
+ *
21
+ * Errors during the generation process are logged to the console.
22
+ *
23
+ * @example
24
+ * // Assuming operation, project, and components are already defined:
25
+ * GenerateParameters(operation, project, components);
26
+ *
27
+ * @throws {Error} If the $ref is malformed or cannot be resolved within the components object.
28
+ * @throws {Error} If reference objects are still present after processing, indicating unresolved references.
29
+ */
3
30
  export declare function GenerateParameters(operation: OpenAPIV3.OperationObject, project: Project, components: OpenAPIV3.ComponentsObject): void;
@@ -4,6 +4,33 @@ exports.GenerateParameters = void 0;
4
4
  const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
5
5
  const config_1 = require("./config");
6
6
  const is_reference_object_1 = require("./utilities/is-reference-object");
7
+ /**
8
+ * Generates TypeScript interfaces for the parameters of a given OpenAPI operation object.
9
+ * This function processes the parameters of the operation, excluding those in the 'header',
10
+ * and generates TypeScript interfaces using the TypescriptInterfaceGenerator.
11
+ *
12
+ * @param operation - The OpenAPI operation object containing details about the API operation.
13
+ * @param project - The project context in which the interfaces are generated.
14
+ * @param components - The OpenAPI components object used for resolving any $ref references in the parameters.
15
+ *
16
+ * @remarks
17
+ * This function filters out header parameters and processes only path, query, and cookie parameters.
18
+ * It handles both direct parameter objects and referenced objects found in the components section of the OpenAPI spec.
19
+ * If a referenced object is encountered, it resolves the reference and includes the resolved object in the parameter list.
20
+ * The function throws errors if references are incorrectly formatted or unresolved.
21
+ *
22
+ * The function constructs a schema object that describes the structure of the parameters using the properties and required fields.
23
+ * This schema object is then used by the TypescriptInterfaceGenerator to generate the appropriate TypeScript interfaces.
24
+ *
25
+ * Errors during the generation process are logged to the console.
26
+ *
27
+ * @example
28
+ * // Assuming operation, project, and components are already defined:
29
+ * GenerateParameters(operation, project, components);
30
+ *
31
+ * @throws {Error} If the $ref is malformed or cannot be resolved within the components object.
32
+ * @throws {Error} If reference objects are still present after processing, indicating unresolved references.
33
+ */
7
34
  function GenerateParameters(operation, project, components) {
8
35
  var _a;
9
36
  if (operation.parameters && operation.parameters.length && operation.operationId) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAElB,yEAAoE;AAEpE,SAAgB,kBAAkB,CAChC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;;IAGtC,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAEjF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,UAAU,GAAyF,EAAE,CAAC;QAC5G,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9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AAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,+CAAgD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/F,CAAC;IAEH,CAAC;AAEH,CAAC;AAzFD,gDAyFC"}
1
+ {"version":3,"file":"generate-parameters.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-parameters.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAElB,yEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,kBAAkB,CAChC,SAAoC,EACpC,OAAgB,EAChB,UAAsC;;IAGtC,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAEjF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,UAAU,GAAyF,EAAE,CAAC;QAC5G,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAA,uCAAiB,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;QAE5G,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAA,uCAAiB,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACvF,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,EAAE,CAAC;gBACjC,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC;gBAC3B,MAAM,QAAQ,GAAa,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACjC,MAAM,iBAAiB,GAAG,QAAQ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AS,CAAC,IAAI,CAAC,GAAG,MAAA,SAAS,CAAC,MAAM,mCAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAEjE,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACvB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QAEH,CAAC;QAED,MAAM,gBAAgB,GAA2B;YAC/C,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,UAAiB;YAC7B,QAAQ;SACT,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,gBAAgB,KACnB,UAAU,KAEZ;YACE,MAAM,EAAE,8BAAqB;YAC7B,QAAQ,EAAE,4BAAmB;YAC7B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,qCAAsC,WAAY,EAAE,CAAC,CAAC;QAEpE,IAAI,CAAC;YAEH,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAEnC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,+CAAgD,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/F,CAAC;IAEH,CAAC;AAEH,CAAC;AAzFD,gDAyFC"}
@@ -1,2 +1,27 @@
1
1
  import { GenerateParameter, OpenApiSchemaBase } from './types';
2
+ /**
3
+ *
4
+ *
5
+ * Generates a TypeScript source file for a remote method based on the provided OpenAPI schema.
6
+ * This function constructs a class that extends `OpenApiRemoteMethod` and is decorated with `Injectable` and `RxapOpenApiRemoteMethod`.
7
+ * The generated class includes a `call` method that can be used to execute the remote method.
8
+ *
9
+ * @param parameter - An object containing options and metadata necessary for generating the remote method.
10
+ * The `parameter` object must include:
11
+ * - `operationId`: A unique identifier for the operation.
12
+ * - `project`: A project within which the source file will be created.
13
+ * - `options`: Additional options such as `serverId` and `packageName` for customizing the generated method.
14
+ *
15
+ * The function performs the following steps:
16
+ * 1. Constructs the file name from the `operationId` and predefined suffixes.
17
+ * 2. Creates a new TypeScript source file in the specified project.
18
+ * 3. Dynamically constructs import statements based on the response type, parameter type, and request body type.
19
+ * 4. Defines a class that extends `OpenApiRemoteMethod` with appropriate type parameters and decorators.
20
+ * 5. Adds a `call` method to the class, which overrides the base method to execute the remote operation.
21
+ * 6. Organizes imports and ensures proper formatting of the generated source file.
22
+ *
23
+ * The generated class is decorated with `@Injectable` to facilitate its usage within Angular's dependency injection system,
24
+ * and `@RxapOpenApiRemoteMethod` to configure it with metadata about the remote operation.
25
+ *
26
+ */
2
27
  export declare function GenerateRemoteMethod(parameter: GenerateParameter<OpenApiSchemaBase>): void;
@@ -11,6 +11,31 @@ const get_request_body_type_1 = require("./utilities/get-request-body-type");
11
11
  const get_response_type_1 = require("./utilities/get-response-type");
12
12
  const get_type_parameters_1 = require("./utilities/get-type-parameters");
13
13
  const { dasherize, classify, } = core_1.strings;
14
+ /**
15
+ *
16
+ *
17
+ * Generates a TypeScript source file for a remote method based on the provided OpenAPI schema.
18
+ * This function constructs a class that extends `OpenApiRemoteMethod` and is decorated with `Injectable` and `RxapOpenApiRemoteMethod`.
19
+ * The generated class includes a `call` method that can be used to execute the remote method.
20
+ *
21
+ * @param parameter - An object containing options and metadata necessary for generating the remote method.
22
+ * The `parameter` object must include:
23
+ * - `operationId`: A unique identifier for the operation.
24
+ * - `project`: A project within which the source file will be created.
25
+ * - `options`: Additional options such as `serverId` and `packageName` for customizing the generated method.
26
+ *
27
+ * The function performs the following steps:
28
+ * 1. Constructs the file name from the `operationId` and predefined suffixes.
29
+ * 2. Creates a new TypeScript source file in the specified project.
30
+ * 3. Dynamically constructs import statements based on the response type, parameter type, and request body type.
31
+ * 4. Defines a class that extends `OpenApiRemoteMethod` with appropriate type parameters and decorators.
32
+ * 5. Adds a `call` method to the class, which overrides the base method to execute the remote operation.
33
+ * 6. Organizes imports and ensures proper formatting of the generated source file.
34
+ *
35
+ * The generated class is decorated with `@Injectable` to facilitate its usage within Angular's dependency injection system,
36
+ * and `@RxapOpenApiRemoteMethod` to configure it with metadata about the remote operation.
37
+ *
38
+ */
14
39
  function GenerateRemoteMethod(parameter) {
15
40
  var _a, _b, _c;
16
41
  const operationId = parameter.operationId;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-remote-method.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-remote-method.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,+BAA4B;AAC5B,uCAOkB;AAClB,mCAGiB;AACjB,mCAIiB;AACjB,uEAAkE;AAClE,6EAAuE;AACvE,qEAAgE;AAChE,yEAAoE;AAEpE,MAAM,EACJ,SAAS,EACT,QAAQ,GACT,GAAG,cAAO,CAAC;AAEZ,SAAgB,oBAAoB,CAAC,SAA+C;;IAClF,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAE1C,MAAM,IAAI,GAAG,CAAE,WAAW,EAAE,iCAAyB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,+BAAuB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAExE,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;KACF,CAAC;IAEF,gBAAgB,CAAC,IAAI,CAAC;QACpB,eAAe,EAAE,8BAA8B;QAC/C,YAAY,EAAE,CAAE,EAAE,IAAI,EAAE,qBA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,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;wBACjG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACf,CAAC;iBACF,CAAC,CAAC,MAAM,CAAC;aACX;SACF;QACD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,oBAAoB;gBAChC,KAAK,EAAE,gBAAK,CAAC,MAAM;gBACnB,UAAU,EAAE,WAAY,YAAa,GAAG;gBACxC,kBAAkB,EAAE,IAAI;gBACxB,UAAU,EAAE;oBACV,qBAAsB,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAa,IAAI;iBAC/E;aACF;SACF;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACpC,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,IAAI,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,UAAU,CAAC,eAAe,CAAC;QACzB,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;AACL,CAAC;AA5HD,oDA4HC"}
1
+ {"version":3,"file":"generate-remote-method.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-remote-method.ts"],"names":[],"mappings":";;;A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AC,MAAM;gBACnB,UAAU,EAAE,WAAY,YAAa,GAAG;gBACxC,kBAAkB,EAAE,IAAI;gBACxB,UAAU,EAAE;oBACV,qBAAsB,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAa,IAAI;iBAC/E;aACF;SACF;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACpC,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,IAAI,CAAC,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,UAAU,CAAC,eAAe,CAAC;QACzB,wBAAwB,EAAE,IAAI;KAC/B,CAAC,CAAC;AACL,CAAC;AA5HD,oDA4HC"}
@@ -1,3 +1,19 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
+ /**
4
+ * Generates TypeScript interfaces or type aliases for the request body of an API operation defined in an OpenAPI specification.
5
+ *
6
+ * This function examines the `operation` object to determine the schema of the request body. Depending on the type of schema
7
+ * (reference, array of references, or a direct schema object), it either generates a type alias directly from the reference
8
+ * or invokes a TypeScript interface generator to create interfaces.
9
+ *
10
+ * If the schema is a reference or an array of references, the function will log a debug message and create a type alias
11
+ * in the specified project directory. If the schema is a direct object, it will use the `TypescriptInterfaceGenerator` to
12
+ * generate and build the interface synchronously, handling any errors that occur during the generation process.
13
+ *
14
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the request body definition.
15
+ * @param {Project} project - The TypeScript project where the generated files will be added.
16
+ * @param {OpenAPIV3.ComponentsObject} components - The OpenAPI components object used for resolving `$ref` references within schemas.
17
+ *
18
+ */
3
19
  export declare function GenerateRequestBody(operation: OpenAPIV3.OperationObject, project: Project, components: OpenAPIV3.ComponentsObject): void;
@@ -7,6 +7,22 @@ const any_schema_object_1 = require("./utilities/any-schema-object");
7
7
  const create_component_type_alias_source_file_1 = require("./utilities/create-component-type-alias-source-file");
8
8
  const get_reqeust_body_1 = require("./utilities/get-reqeust-body");
9
9
  const ref_schema_object_1 = require("./utilities/ref-schema-object");
10
+ /**
11
+ * Generates TypeScript interfaces or type aliases for the request body of an API operation defined in an OpenAPI specification.
12
+ *
13
+ * This function examines the `operation` object to determine the schema of the request body. Depending on the type of schema
14
+ * (reference, array of references, or a direct schema object), it either generates a type alias directly from the reference
15
+ * or invokes a TypeScript interface generator to create interfaces.
16
+ *
17
+ * If the schema is a reference or an array of references, the function will log a debug message and create a type alias
18
+ * in the specified project directory. If the schema is a direct object, it will use the `TypescriptInterfaceGenerator` to
19
+ * generate and build the interface synchronously, handling any errors that occur during the generation process.
20
+ *
21
+ * @param {OpenAPIV3.OperationObject} operation - The OpenAPI operation object containing the request body definition.
22
+ * @param {Project} project - The TypeScript project where the generated files will be added.
23
+ * @param {OpenAPIV3.ComponentsObject} components - The OpenAPI components object used for resolving `$ref` references within schemas.
24
+ *
25
+ */
10
26
  function GenerateRequestBody(operation, project, components) {
11
27
  const requestBodySchema = (0, get_reqeust_body_1.GetRequestBody)(operation);
12
28
  if (requestBodySchema && !(0, any_schema_object_1.IsAnySchemaObject)(requestBodySchema) && operation.operationId) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-request-body.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-request-body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AC;AApDD,kDAoDC"}
@@ -1,3 +1,26 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
2
  import { Project } from 'ts-morph';
3
+ /**
4
+ * Generates TypeScript interfaces or type aliases for API responses based on the provided OpenAPI operation object.
5
+ * This function determines the appropriate response schema from the operation object and decides whether to generate
6
+ * a new TypeScript interface or to reuse an existing type alias based on the schema's complexity and references.
7
+ *
8
+ * @param operation - The OpenAPI operation object containing the details and specifications of an API operation.
9
+ * @param project - The TypeScript project context where the generated files will be added.
10
+ * @param components - The OpenAPI components object which may contain reusable schemas referenced by the operation.
11
+ *
12
+ * The function performs the following steps:
13
+ * 1. Retrieves the appropriate response schema from the operation object.
14
+ * 2. Checks if the response schema is a simple type, a reference, or an array of references.
15
+ * 3. If the response schema is a reference or an array of references, it logs a debug message and creates a type alias
16
+ * in the project without generating a new interface.
17
+ * 4. If the response schema is neither a reference nor an array of references, it initializes a TypeScript interface
18
+ * generator with the response schema and additional configuration options.
19
+ * 5. Attempts to generate and build the TypeScript interface synchronously. If an error occurs during generation,
20
+ * it logs the error.
21
+ *
22
+ * Note: This function uses console.debug for logging skipped operations and console.error for logging errors during
23
+ * interface generation. It assumes the existence of constants `RESPONSE_BASE_PATH` and `RESPONSE_FILE_SUFFIX` for
24
+ * file path configuration.
25
+ */
3
26
  export declare function GenerateResponse(operation: OpenAPIV3.OperationObject, project: Project, components: OpenAPIV3.ComponentsObject): void;
@@ -7,6 +7,29 @@ const any_schema_object_1 = require("./utilities/any-schema-object");
7
7
  const create_component_type_alias_source_file_1 = require("./utilities/create-component-type-alias-source-file");
8
8
  const get_response_1 = require("./utilities/get-response");
9
9
  const ref_schema_object_1 = require("./utilities/ref-schema-object");
10
+ /**
11
+ * Generates TypeScript interfaces or type aliases for API responses based on the provided OpenAPI operation object.
12
+ * This function determines the appropriate response schema from the operation object and decides whether to generate
13
+ * a new TypeScript interface or to reuse an existing type alias based on the schema's complexity and references.
14
+ *
15
+ * @param operation - The OpenAPI operation object containing the details and specifications of an API operation.
16
+ * @param project - The TypeScript project context where the generated files will be added.
17
+ * @param components - The OpenAPI components object which may contain reusable schemas referenced by the operation.
18
+ *
19
+ * The function performs the following steps:
20
+ * 1. Retrieves the appropriate response schema from the operation object.
21
+ * 2. Checks if the response schema is a simple type, a reference, or an array of references.
22
+ * 3. If the response schema is a reference or an array of references, it logs a debug message and creates a type alias
23
+ * in the project without generating a new interface.
24
+ * 4. If the response schema is neither a reference nor an array of references, it initializes a TypeScript interface
25
+ * generator with the response schema and additional configuration options.
26
+ * 5. Attempts to generate and build the TypeScript interface synchronously. If an error occurs during generation,
27
+ * it logs the error.
28
+ *
29
+ * Note: This function uses console.debug for logging skipped operations and console.error for logging errors during
30
+ * interface generation. It assumes the existence of constants `RESPONSE_BASE_PATH` and `RESPONSE_FILE_SUFFIX` for
31
+ * file path configuration.
32
+ */
10
33
  function GenerateResponse(operation, project, components) {
11
34
  const response = (0, get_response_1.GetResponse)(operation);
12
35
  if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response) && operation.operationId) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-response.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAClB,qEAAkE;AAClE,iHAAyG;AACzG,2DAAuD;AACvD,qEAGuC;AAEvC,SAAgB,gBAAgB,CAC9B,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACtE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,IAAI,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,IAAA,0CAAsB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAEpE,OAAO,CAAC,KAAK,CAAC,2CAA4C,WAAY,EAAE,CAAC,CAAC;YAE1E,IAAA,4EAAkC,EAChC,OAAO,EACP,WAAW,EACX,QAAQ,EACR,2BAAkB,EAClB,6BAAoB,CACrB,CAAC;QAEJ,CAAC;aAAM,CAAC;YAEN,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,QAAQ,KACX,UAAU,KAEZ;gBACE,MAAM,EAAE,6BAAoB;gBAC5B,QAAQ,EAAE,2BAAkB;gBAC5B,UAAU,EAAE,IAAI;aACjB,EACD,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,KAAK,CAAC,oCAAqC,WAAY,EAAE,CAAC,CAAC;YAEnE,IAAI,CAAC;gBAEH,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAEnC,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,8CAA+C,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9F,CAAC;QAEH,CAAC;IAEH,CAAC;AAEH,CAAC;AApDD,4CAoDC"}
1
+ {"version":3,"file":"generate-response.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/generate-response.ts"],"names":[],"mappings":";;;AAAA,+EAA+E;AAG/E,qCAGkB;AAClB,qEAAkE;AAClE,iHAAyG;AACzG,2DAAuD;AACvD,qEAGuC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,gBAAgB,CAC9B,SAAoC,EACpC,OAAgB,EAChB,UAAsC;IAGtC,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACtE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,IAAI,IAAA,qCAAiB,EAAC,QAAQ,CAAC,IAAI,IAAA,0CAAsB,EAAC,QAAQ,CAAC,EAAE,CAAC;YAEpE,OAAO,CAAC,KAAK,CAAC,2CAA4C,WAAY,EAAE,CAAC,CAAC;YAE1E,IAAA,4EAAkC,EAChC,OAAO,EACP,WAAW,EACX,QAAQ,EACR,2BAAkB,EAClB,6BAAoB,CACrB,CAAC;QAEJ,CAAC;aAAM,CAAC;YAEN,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,QAAQ,KACX,UAAU,KAEZ;gBACE,MAAM,EAAE,6BAAoB;gBAC5B,QAAQ,EAAE,2BAAkB;gBAC5B,UAAU,EAAE,IAAI;aACjB,EACD,OAAO,CACR,CAAC;YAEF,OAAO,CAAC,KAAK,CAAC,oCAAqC,WAAY,EAAE,CAAC,CAAC;YAEnE,IAAI,CAAC;gBAEH,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAEnC,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,8CAA+C,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9F,CAAC;QAEH,CAAC;IAEH,CAAC;AAEH,CAAC;AApDD,4CAoDC"}
@@ -1,4 +1,21 @@
1
1
  import { TreeLike } from '@rxap/workspace-utilities';
2
2
  import { OpenAPIV3 } from 'openapi-types';
3
3
  import { OpenApiSchema } from './types';
4
+ /**
5
+ * Asynchronously loads an OpenAPI configuration from a specified path or URL.
6
+ *
7
+ * This function attempts to load an OpenAPI document based on the provided `options`. If the `options` specify a `path`,
8
+ * the function checks if the file exists in the provided `host` filesystem-like structure. Depending on the file extension,
9
+ * it parses the file as JSON or YAML to construct the OpenAPI document. If the file does not exist or has an unsupported extension,
10
+ * it throws an error.
11
+ *
12
+ * If the `options` specify a `url`, the function performs an HTTP request to fetch the OpenAPI document.
13
+ *
14
+ * @param host - A `TreeLike` object representing a filesystem-like structure where the OpenAPI file might be located.
15
+ * @param options - An `OpenApiSchema` object containing either a `path` or a `url` from which to load the OpenAPI document.
16
+ * The `path` should be a string pointing to a local file in the `host` structure, and the `url` should be a string URL pointing to a remote OpenAPI document.
17
+ * @returns A Promise that resolves to an `OpenAPIV3.Document` object representing the loaded OpenAPI configuration.
18
+ * @throws {Error} Throws an error if neither a valid `path` nor `url` is provided in `options`, if the specified file does not exist,
19
+ * if the file has an unsupported extension, or if any other loading errors occur.
20
+ */
4
21
  export declare function LoadOpenApiConfig(host: TreeLike, options: OpenApiSchema): Promise<OpenAPIV3.Document>;
@@ -6,6 +6,23 @@ const workspace_utilities_1 = require("@rxap/workspace-utilities");
6
6
  const yaml_1 = require("yaml");
7
7
  const http_request_1 = require("./utilities/http-request");
8
8
  const is_open_api_schema_from_path_1 = require("./utilities/is-open-api-schema-from-path");
9
+ /**
10
+ * Asynchronously loads an OpenAPI configuration from a specified path or URL.
11
+ *
12
+ * This function attempts to load an OpenAPI document based on the provided `options`. If the `options` specify a `path`,
13
+ * the function checks if the file exists in the provided `host` filesystem-like structure. Depending on the file extension,
14
+ * it parses the file as JSON or YAML to construct the OpenAPI document. If the file does not exist or has an unsupported extension,
15
+ * it throws an error.
16
+ *
17
+ * If the `options` specify a `url`, the function performs an HTTP request to fetch the OpenAPI document.
18
+ *
19
+ * @param host - A `TreeLike` object representing a filesystem-like structure where the OpenAPI file might be located.
20
+ * @param options - An `OpenApiSchema` object containing either a `path` or a `url` from which to load the OpenAPI document.
21
+ * The `path` should be a string pointing to a local file in the `host` structure, and the `url` should be a string URL pointing to a remote OpenAPI document.
22
+ * @returns A Promise that resolves to an `OpenAPIV3.Document` object representing the loaded OpenAPI configuration.
23
+ * @throws {Error} Throws an error if neither a valid `path` nor `url` is provided in `options`, if the specified file does not exist,
24
+ * if the file has an unsupported extension, or if any other loading errors occur.
25
+ */
9
26
  function LoadOpenApiConfig(host, options) {
10
27
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
28
  let openapi;
@@ -1 +1 @@
1
- {"version":3,"file":"load-open-api-config.js","sourceRoot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O,CAAC;IACjB,CAAC;CAAA;AA1BD,8CA0BC"}
1
+ {"version":3,"file":"load-open-api-config.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/load-open-api-config.ts"],"names":[],"mappings":";;;;AAAA,mEAGmC;AAEnC,+BAA6B;AAE7B,2DAAuD;AACvD,2FAAmF;AAEnF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAsB,iBAAiB,CAAC,IAAc,EAAE,OAAsB;;QAC5E,IAAI,OAA2B,CAAC;QAChC,IAAI,IAAA,sDAAuB,EAAC,OAAO,CAAC,EAAE,CAAC;YAErC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,iCAAW,CAAC,IAAI,CAAC,CAAC;YAE1C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAE,CAAC;YAEzD,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;iBAAM,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3E,OAAO,GAAG,IAAA,YAAK,EAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YACjE,CAAC;QAEH,CAAC;aAAM,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACvB,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAqB,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AA1BD,8CA0BC"}
@@ -1,2 +1,12 @@
1
1
  import { OpenAPIV3 } from 'openapi-types';
2
+ /**
3
+ * Resolves JSON Reference (`$ref`) within an OpenAPI specification document to their corresponding schema definitions.
4
+ * This function mutates the original OpenAPI specification object by replacing `$ref` nodes with the actual schema
5
+ * definitions they refer to, if found within the `components/schemas` section of the specification.
6
+ *
7
+ * @param openApiSpec - The OpenAPI specification object (version 3.x) which includes potential `$ref` references and schema definitions.
8
+ * @param node - The current node in the OpenAPI specification object being examined. This can be any part of the specification.
9
+ * @param parent - The parent object of the current node. This is used to replace the reference with the actual schema.
10
+ * @param key - The key in the parent object that corresponds to the current node. This is used to update the parent object with the resolved schema.
11
+ */
2
12
  export declare function ResolveRef(openApiSpec: OpenAPIV3.Document, node: any, parent?: any, key?: string): void;
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResolveRef = void 0;
4
+ /**
5
+ * Resolves JSON Reference (`$ref`) within an OpenAPI specification document to their corresponding schema definitions.
6
+ * This function mutates the original OpenAPI specification object by replacing `$ref` nodes with the actual schema
7
+ * definitions they refer to, if found within the `components/schemas` section of the specification.
8
+ *
9
+ * @param openApiSpec - The OpenAPI specification object (version 3.x) which includes potential `$ref` references and schema definitions.
10
+ * @param node - The current node in the OpenAPI specification object being examined. This can be any part of the specification.
11
+ * @param parent - The parent object of the current node. This is used to replace the reference with the actual schema.
12
+ * @param key - The key in the parent object that corresponds to the current node. This is used to update the parent object with the resolved schema.
13
+ */
4
14
  function ResolveRef(openApiSpec, node, parent, key) {
5
15
  var _a;
6
16
  if (typeof node !== 'object' || node === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-ref.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/resolve-ref.ts"],"names":[],"mappings":";;;AAEA,SAAgB,UAAU,CAAC,WAA+B,EAAE,IAAS,EAAE,MAAY,EAAE,GAAY;;IAC/F,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;YAC5D,IAAI,MAAM,IAAI,GAAG,KAAI,MAAA,WAAW,CAAC,UAAU,0CAAE,OAAO,CAAA,EAAE,CAAC;gBACrD,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,CAAE,CAAC,EAAE,CAAC,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC;AAhBD,gCAgBC"}
1
+ {"version":3,"file":"resolve-ref.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/resolve-ref.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,WAA+B,EAAE,IAAS,EAAE,MAAY,EAAE,GAAY;;IAC/F,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;YAC5D,IAAI,MAAM,IAAI,GAAG,KAAI,MAAA,WAAW,CAAC,UAAU,0CAAE,OAAO,CAAA,EAAE,CAAC;gBACrD,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,CAAE,CAAC,EAAE,CAAC,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC;AAhBD,gCAgBC"}