@rxap/workspace-open-api 0.0.2-dev.0

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 (111) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/GETSTARTED.md +0 -0
  3. package/GUIDES.md +0 -0
  4. package/LICENSE.md +621 -0
  5. package/README.md +21 -0
  6. package/package.json +65 -0
  7. package/src/index.d.ts +34 -0
  8. package/src/index.js +42 -0
  9. package/src/index.js.map +1 -0
  10. package/src/lib/config.d.ts +7 -0
  11. package/src/lib/config.js +11 -0
  12. package/src/lib/config.js.map +1 -0
  13. package/src/lib/const.d.ts +8 -0
  14. package/src/lib/const.js +12 -0
  15. package/src/lib/const.js.map +1 -0
  16. package/src/lib/create-directive.d.ts +2 -0
  17. package/src/lib/create-directive.js +279 -0
  18. package/src/lib/create-directive.js.map +1 -0
  19. package/src/lib/generate-components.d.ts +3 -0
  20. package/src/lib/generate-components.js +27 -0
  21. package/src/lib/generate-components.js.map +1 -0
  22. package/src/lib/generate-data-source.d.ts +2 -0
  23. package/src/lib/generate-data-source.js +75 -0
  24. package/src/lib/generate-data-source.js.map +1 -0
  25. package/src/lib/generate-directives.d.ts +2 -0
  26. package/src/lib/generate-directives.js +105 -0
  27. package/src/lib/generate-directives.js.map +1 -0
  28. package/src/lib/generate-index-exports.d.ts +2 -0
  29. package/src/lib/generate-index-exports.js +14 -0
  30. package/src/lib/generate-index-exports.js.map +1 -0
  31. package/src/lib/generate-interfaces.d.ts +3 -0
  32. package/src/lib/generate-interfaces.js +40 -0
  33. package/src/lib/generate-interfaces.js.map +1 -0
  34. package/src/lib/generate-operation-command.d.ts +2 -0
  35. package/src/lib/generate-operation-command.js +120 -0
  36. package/src/lib/generate-operation-command.js.map +1 -0
  37. package/src/lib/generate-operation.d.ts +4 -0
  38. package/src/lib/generate-operation.js +48 -0
  39. package/src/lib/generate-operation.js.map +1 -0
  40. package/src/lib/generate-parameters.d.ts +3 -0
  41. package/src/lib/generate-parameters.js +70 -0
  42. package/src/lib/generate-parameters.js.map +1 -0
  43. package/src/lib/generate-remote-method.d.ts +2 -0
  44. package/src/lib/generate-remote-method.js +112 -0
  45. package/src/lib/generate-remote-method.js.map +1 -0
  46. package/src/lib/generate-request-body.d.ts +3 -0
  47. package/src/lib/generate-request-body.js +27 -0
  48. package/src/lib/generate-request-body.js.map +1 -0
  49. package/src/lib/generate-response.d.ts +3 -0
  50. package/src/lib/generate-response.js +27 -0
  51. package/src/lib/generate-response.js.map +1 -0
  52. package/src/lib/load-open-api-config.d.ts +4 -0
  53. package/src/lib/load-open-api-config.js +28 -0
  54. package/src/lib/load-open-api-config.js.map +1 -0
  55. package/src/lib/options.d.ts +14 -0
  56. package/src/lib/options.js +3 -0
  57. package/src/lib/options.js.map +1 -0
  58. package/src/lib/resolve-ref.d.ts +2 -0
  59. package/src/lib/resolve-ref.js +24 -0
  60. package/src/lib/resolve-ref.js.map +1 -0
  61. package/src/lib/types.d.ts +37 -0
  62. package/src/lib/types.js +47 -0
  63. package/src/lib/types.js.map +1 -0
  64. package/src/lib/utilities/any-schema-object.d.ts +4 -0
  65. package/src/lib/utilities/any-schema-object.js +8 -0
  66. package/src/lib/utilities/any-schema-object.js.map +1 -0
  67. package/src/lib/utilities/get-parameter-type.d.ts +2 -0
  68. package/src/lib/utilities/get-parameter-type.js +14 -0
  69. package/src/lib/utilities/get-parameter-type.js.map +1 -0
  70. package/src/lib/utilities/get-reqeust-body.d.ts +3 -0
  71. package/src/lib/utilities/get-reqeust-body.js +29 -0
  72. package/src/lib/utilities/get-reqeust-body.js.map +1 -0
  73. package/src/lib/utilities/get-request-body-type.d.ts +2 -0
  74. package/src/lib/utilities/get-request-body-type.js +25 -0
  75. package/src/lib/utilities/get-request-body-type.js.map +1 -0
  76. package/src/lib/utilities/get-response-type.d.ts +2 -0
  77. package/src/lib/utilities/get-response-type.js +23 -0
  78. package/src/lib/utilities/get-response-type.js.map +1 -0
  79. package/src/lib/utilities/get-response.d.ts +3 -0
  80. package/src/lib/utilities/get-response.js +34 -0
  81. package/src/lib/utilities/get-response.js.map +1 -0
  82. package/src/lib/utilities/has-operation-paramters.d.ts +3 -0
  83. package/src/lib/utilities/has-operation-paramters.js +8 -0
  84. package/src/lib/utilities/has-operation-paramters.js.map +1 -0
  85. package/src/lib/utilities/has-operation-request-body.d.ts +3 -0
  86. package/src/lib/utilities/has-operation-request-body.js +8 -0
  87. package/src/lib/utilities/has-operation-request-body.js.map +1 -0
  88. package/src/lib/utilities/http-request.d.ts +1 -0
  89. package/src/lib/utilities/http-request.js +57 -0
  90. package/src/lib/utilities/http-request.js.map +1 -0
  91. package/src/lib/utilities/ignore-operation.d.ts +2 -0
  92. package/src/lib/utilities/ignore-operation.js +14 -0
  93. package/src/lib/utilities/ignore-operation.js.map +1 -0
  94. package/src/lib/utilities/is-collection-response.d.ts +2 -0
  95. package/src/lib/utilities/is-collection-response.js +17 -0
  96. package/src/lib/utilities/is-collection-response.js.map +1 -0
  97. package/src/lib/utilities/is-http-method.d.ts +1 -0
  98. package/src/lib/utilities/is-http-method.js +8 -0
  99. package/src/lib/utilities/is-http-method.js.map +1 -0
  100. package/src/lib/utilities/is-open-api-schema-from-path.d.ts +2 -0
  101. package/src/lib/utilities/is-open-api-schema-from-path.js +9 -0
  102. package/src/lib/utilities/is-open-api-schema-from-path.js.map +1 -0
  103. package/src/lib/utilities/is-operation-object.d.ts +2 -0
  104. package/src/lib/utilities/is-operation-object.js +8 -0
  105. package/src/lib/utilities/is-operation-object.js.map +1 -0
  106. package/src/lib/utilities/is-reference-object.d.ts +2 -0
  107. package/src/lib/utilities/is-reference-object.js +8 -0
  108. package/src/lib/utilities/is-reference-object.js.map +1 -0
  109. package/src/lib/utilities/is-without-parameters.d.ts +3 -0
  110. package/src/lib/utilities/is-without-parameters.js +8 -0
  111. package/src/lib/utilities/is-without-parameters.js.map +1 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerateResponse = void 0;
4
+ const json_schema_to_typescript_1 = require("@rxap/json-schema-to-typescript");
5
+ const config_1 = require("./config");
6
+ const any_schema_object_1 = require("./utilities/any-schema-object");
7
+ const get_response_1 = require("./utilities/get-response");
8
+ function GenerateResponse(operation, project, components) {
9
+ const response = (0, get_response_1.GetResponse)(operation);
10
+ if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response) && operation.operationId) {
11
+ const operationId = operation.operationId;
12
+ const generator = new json_schema_to_typescript_1.TypescriptInterfaceGenerator(Object.assign(Object.assign({}, response), { components }), {
13
+ suffix: config_1.RESPONSE_FILE_SUFFIX,
14
+ basePath: config_1.RESPONSE_BASE_PATH,
15
+ addImports: true,
16
+ }, project);
17
+ console.debug(`Generate response interface for: ${operationId}`);
18
+ try {
19
+ generator.buildSync(operationId);
20
+ }
21
+ catch (error) {
22
+ console.error(`Failed to generate response interface for: ${operationId}`, error.message);
23
+ }
24
+ }
25
+ }
26
+ exports.GenerateResponse = GenerateResponse;
27
+ //# sourceMappingURL=generate-response.js.map
@@ -0,0 +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,2DAAuD;AAEvD,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;QACrE,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,wDAA4B,iCAE3C,QAAQ,KACX,UAAU,KAEZ;YACE,MAAM,EAAE,6BAAoB;YAC5B,QAAQ,EAAE,2BAAkB;YAC5B,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,oCAAqC,WAAY,EAAE,CAAC,CAAC;QAEnE,IAAI;YAEF,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAElC;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,8CAA+C,WAAY,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SAC7F;KAEF;AAEH,CAAC;AApCD,4CAoCC"}
@@ -0,0 +1,4 @@
1
+ import { TreeLike } from '@rxap/workspace-utilities';
2
+ import { OpenAPIV3 } from 'openapi-types';
3
+ import { OpenApiSchema } from './types';
4
+ export declare function LoadOpenApiConfig(host: TreeLike, options: OpenApiSchema): Promise<OpenAPIV3.Document>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoadOpenApiConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const workspace_utilities_1 = require("@rxap/workspace-utilities");
6
+ const http_request_1 = require("./utilities/http-request");
7
+ const is_open_api_schema_from_path_1 = require("./utilities/is-open-api-schema-from-path");
8
+ function LoadOpenApiConfig(host, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ let openapi;
11
+ if ((0, is_open_api_schema_from_path_1.IsOpenApiSchemaFromPath)(options)) {
12
+ if (!host.exists(options.path)) {
13
+ throw new Error('Could not find openapi file.');
14
+ }
15
+ const treeAdapter = new workspace_utilities_1.TreeAdapter(host);
16
+ openapi = JSON.parse(treeAdapter.read(options.path).toString('utf-8'));
17
+ }
18
+ else if (options.url) {
19
+ openapi = yield (0, http_request_1.HttpRequest)(options.url);
20
+ }
21
+ else {
22
+ throw new Error('Either the path or url must be defined');
23
+ }
24
+ return openapi;
25
+ });
26
+ }
27
+ exports.LoadOpenApiConfig = LoadOpenApiConfig;
28
+ //# sourceMappingURL=load-open-api-config.js.map
@@ -0,0 +1 @@
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;AAGnC,2DAAuD;AACvD,2FAAmF;AAEnF,SAAsB,iBAAiB,CAAC,IAAc,EAAE,OAAsB;;QAC5E,IAAI,OAA2B,CAAC;QAChC,IAAI,IAAA,sDAAuB,EAAC,OAAO,CAAC,EAAE;YAEpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC9B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACjD;YAED,MAAM,WAAW,GAAG,IAAI,iCAAW,CAAC,IAAI,CAAC,CAAC;YAE1C,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAEzE;aAAM,IAAI,OAAO,CAAC,GAAG,EAAE;YAEtB,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAqB,OAAO,CAAC,GAAG,CAAC,CAAC;SAE9D;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AApBD,8CAoBC"}
@@ -0,0 +1,14 @@
1
+ import { SourceFile } from 'ts-morph';
2
+ export interface CreateDirectiveRuleOptions {
3
+ filePath: string;
4
+ name: string;
5
+ prefix?: string;
6
+ parametersType: string;
7
+ returnType: string;
8
+ template: boolean;
9
+ collection: boolean;
10
+ }
11
+ export interface CreateDirectiveOptions extends CreateDirectiveRuleOptions {
12
+ sourceFile: SourceFile;
13
+ withoutParameters: boolean;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function ResolveRef(openApiSpec: OpenAPIV3.Document, node: any, parent?: any, key?: string): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResolveRef = void 0;
4
+ function ResolveRef(openApiSpec, node, parent, key) {
5
+ var _a;
6
+ if (typeof node !== 'object' || node === null) {
7
+ return;
8
+ }
9
+ if (node['$ref']) {
10
+ if (node.$ref.startsWith('#/components/schemas')) {
11
+ const name = node.$ref.replace('#/components/schemas/', '');
12
+ if (parent && key && ((_a = openApiSpec.components) === null || _a === void 0 ? void 0 : _a.schemas)) {
13
+ parent[key] = openApiSpec.components.schemas[name];
14
+ }
15
+ }
16
+ }
17
+ else {
18
+ for (const [k, v] of Object.entries(node)) {
19
+ ResolveRef(openApiSpec, v, node, k);
20
+ }
21
+ }
22
+ }
23
+ exports.ResolveRef = ResolveRef;
24
+ //# sourceMappingURL=resolve-ref.js.map
@@ -0,0 +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;QAC7C,OAAO;KACR;IACD,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;QAChB,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE;YAChD,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;gBACpD,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aACpD;SACF;KACF;SAAM;QACL,KAAK,MAAM,CAAE,CAAC,EAAE,CAAC,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC3C,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;SACrC;KACF;AACH,CAAC;AAhBD,gCAgBC"}
@@ -0,0 +1,37 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ import { Project } from 'ts-morph';
3
+ export type OperationObject = Omit<OpenAPIV3.OperationObject, 'operationId'> & {
4
+ operationId: string;
5
+ };
6
+ export interface GenerateParameter<Options extends OpenApiSchemaBase = OpenApiSchemaBase> extends OperationObject {
7
+ method: string;
8
+ path: string;
9
+ project: Project;
10
+ components: OpenAPIV3.ComponentsObject;
11
+ options: Options;
12
+ }
13
+ export interface OperationObjectWithMetadata extends OpenAPIV3.OperationObject {
14
+ path: string;
15
+ method: string;
16
+ }
17
+ export declare function GenerateParameterToOperationObjectWithMetadata(parameter: GenerateParameter): OperationObjectWithMetadata;
18
+ export declare function HasOperationId(operation: OpenAPIV3.OperationObject): operation is OperationObject;
19
+ export declare function AssertWithOperationId(operation: OpenAPIV3.OperationObject): asserts operation is OperationObject;
20
+ export type GeneratorFunction<Options extends OpenApiSchemaBase = OpenApiSchemaBase> = (parameters: GenerateParameter<Options>) => void;
21
+ export interface OpenApiSchemaBase {
22
+ debug?: boolean;
23
+ /**
24
+ * If the packageName property is set.
25
+ * The generation of the open api client sdk will be done to be published as a npm package.
26
+ */
27
+ packageName?: string;
28
+ serverId?: string;
29
+ prefix?: string;
30
+ }
31
+ export interface OpenApiSchemaFromPath extends OpenApiSchemaBase {
32
+ path: string;
33
+ }
34
+ export interface OpenApiSchemaFromUrl extends OpenApiSchemaBase {
35
+ url: string;
36
+ }
37
+ export type OpenApiSchema = OpenApiSchemaFromPath | OpenApiSchemaFromUrl;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssertWithOperationId = exports.HasOperationId = exports.GenerateParameterToOperationObjectWithMetadata = void 0;
4
+ function GenerateParameterToOperationObjectWithMetadata(parameter) {
5
+ const whitelist = ['method', 'path', 'operationId', 'parameters', 'responses', 'requestBody'];
6
+ const copy = {};
7
+ for (const key of Object.keys(parameter).filter(k => whitelist.includes(k))) {
8
+ copy[key] = parameter[key];
9
+ }
10
+ if (parameter.responses) {
11
+ copy.responses = {};
12
+ for (const status of Object.keys(parameter.responses).filter(status => Number(status) >= 200 && Number(status) < 300)) {
13
+ copy.responses[status] = parameter.responses[status];
14
+ }
15
+ }
16
+ function removeHumanProperties(obj) {
17
+ if (obj && typeof obj === 'object') {
18
+ if (Array.isArray(obj)) {
19
+ return obj.map(item => removeHumanProperties(item));
20
+ }
21
+ }
22
+ else {
23
+ return obj;
24
+ }
25
+ const clean = {};
26
+ const blacklist = ['description', 'example', 'summary'];
27
+ for (const [key, value] of Object.entries(obj)) {
28
+ if (!blacklist.includes(key)) {
29
+ clean[key] = removeHumanProperties(value);
30
+ }
31
+ }
32
+ return clean;
33
+ }
34
+ return removeHumanProperties(copy);
35
+ }
36
+ exports.GenerateParameterToOperationObjectWithMetadata = GenerateParameterToOperationObjectWithMetadata;
37
+ function HasOperationId(operation) {
38
+ return !!operation.operationId;
39
+ }
40
+ exports.HasOperationId = HasOperationId;
41
+ function AssertWithOperationId(operation) {
42
+ if (!HasOperationId(operation)) {
43
+ throw new Error('Ensure all operation have a operation id.');
44
+ }
45
+ }
46
+ exports.AssertWithOperationId = AssertWithOperationId;
47
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/workspace/open-api/src/lib/types.ts"],"names":[],"mappings":";;;AAkBA,SAAgB,8CAA8C,CAAC,SAA4B;IACzF,MAAM,SAAS,GAAG,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAE,CAAC;IAChG,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3E,IAAI,CAAC,GAAG,CAAC,GAAI,SAAiB,CAAC,GAAG,CAAC,CAAC;KACrC;IACD,IAAI,SAAS,CAAC,SAAS,EAAE;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IACf,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE;YAClG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACtD;KACF;IAED,SAAS,qBAAqB,CAAC,GAAQ;QACrC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAClC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACtB,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;aACrD;SACF;aAAM;YACL,OAAO,GAAG,CAAC;SACZ;QACD,MAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,CAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAE,CAAC;QAC1D,KAAK,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAChD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAC5B,KAAK,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;aAC3C;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAjCD,wGAiCC;AAED,SAAgB,cAAc,CAAC,SAAoC;IACjE,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,wCAEC;AAED,SAAgB,qBAAqB,CAAC,SAAoC;IACxE,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;AACH,CAAC;AAJD,sDAIC"}
@@ -0,0 +1,4 @@
1
+ export interface AnySchemaObject {
2
+ type: 'any';
3
+ }
4
+ export declare function IsAnySchemaObject(obj: any): obj is AnySchemaObject;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsAnySchemaObject = void 0;
4
+ function IsAnySchemaObject(obj) {
5
+ return obj && obj['type'] && obj.type === 'any';
6
+ }
7
+ exports.IsAnySchemaObject = IsAnySchemaObject;
8
+ //# sourceMappingURL=any-schema-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any-schema-object.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/any-schema-object.ts"],"names":[],"mappings":";;;AAIA,SAAgB,iBAAiB,CAAC,GAAQ;IACxC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AAClD,CAAC;AAFD,8CAEC"}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function GetParameterType(operation: OpenAPIV3.OperationObject): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetParameterType = void 0;
4
+ const utilities_1 = require("@rxap/utilities");
5
+ const config_1 = require("../config");
6
+ function GetParameterType(operation) {
7
+ let parameterType = 'void';
8
+ if (operation.parameters && operation.parameters.length && operation.operationId) {
9
+ parameterType = (0, utilities_1.classify)([operation.operationId, config_1.PARAMETER_FILE_SUFFIX].join('-'));
10
+ }
11
+ return parameterType;
12
+ }
13
+ exports.GetParameterType = GetParameterType;
14
+ //# sourceMappingURL=get-parameter-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-parameter-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-parameter-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAkD;AAElD,SAAgB,gBAAgB,CAAC,SAAoC;IAEnE,IAAI,aAAa,GAAG,MAAM,CAAC;IAE3B,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,IAAI,SAAS,CAAC,WAAW,EAAE;QAChF,aAAa,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,8BAAqB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,aAAa,CAAC;AAEvB,CAAC;AAVD,4CAUC"}
@@ -0,0 +1,3 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ import { AnySchemaObject } from './any-schema-object';
3
+ export declare function GetRequestBody(operation: OpenAPIV3.OperationObject): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetRequestBody = void 0;
4
+ const utilities_1 = require("@rxap/utilities");
5
+ const is_reference_object_1 = require("./is-reference-object");
6
+ function GetRequestBody(operation) {
7
+ if (operation.requestBody) {
8
+ if ((0, is_reference_object_1.IsReferenceObject)(operation.requestBody)) {
9
+ throw new Error('Reference object are not supported in operation requestBody!');
10
+ }
11
+ const requestBodies = operation.requestBody.content;
12
+ if ((0, utilities_1.IsRecord)(requestBodies)) {
13
+ if ((0, is_reference_object_1.IsReferenceObject)(requestBodies)) {
14
+ console.warn('Reference object are not supported in operation requestBody!');
15
+ }
16
+ else {
17
+ if (requestBodies['application/json']) {
18
+ const schema = requestBodies['application/json']['schema'];
19
+ if (schema) {
20
+ return schema;
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ return null;
27
+ }
28
+ exports.GetRequestBody = GetRequestBody;
29
+ //# sourceMappingURL=get-reqeust-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-reqeust-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-reqeust-body.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,+DAA0D;AAE1D,SAAgB,cAAc,CAAC,SAAoC;IAEjE,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,IAAI,IAAA,uCAAiB,EAAC,SAAS,CAAC,WAAW,CAAC,EAAE;YAC5C,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;SACjF;QAED,MAAM,aAAa,GAA0D,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAE3G,IAAI,IAAA,oBAAQ,EAAC,aAAa,CAAC,EAAE;YAE3B,IAAI,IAAA,uCAAiB,EAAC,aAAa,CAAC,EAAE;gBACpC,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;aAC9E;iBAAM;gBACL,IAAI,aAAa,CAAC,kBAAkB,CAAC,EAAE;oBACrC,MAAM,MAAM,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE;wBACV,OAAO,MAAM,CAAC;qBACf;iBACF;aACF;SAEF;KAEF;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AA7BD,wCA6BC"}
@@ -0,0 +1,2 @@
1
+ import { GenerateParameter } from '../types';
2
+ export declare function GetRequestBodyType(operation: GenerateParameter<any>): string;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetRequestBodyType = void 0;
4
+ const utilities_1 = require("@rxap/utilities");
5
+ const config_1 = require("../config");
6
+ const any_schema_object_1 = require("./any-schema-object");
7
+ const get_reqeust_body_1 = require("./get-reqeust-body");
8
+ function GetRequestBodyType(operation) {
9
+ let requestBodyType = 'void';
10
+ if (operation.operationId) {
11
+ const requestBody = (0, get_reqeust_body_1.GetRequestBody)(operation);
12
+ if (requestBody === null) {
13
+ requestBodyType = 'void';
14
+ }
15
+ else if (!(0, any_schema_object_1.IsAnySchemaObject)(requestBody)) {
16
+ requestBodyType = (0, utilities_1.classify)([operation.operationId, config_1.REQUEST_BODY_FILE_SUFFIX].join('-'));
17
+ }
18
+ else {
19
+ requestBodyType = 'any';
20
+ }
21
+ }
22
+ return requestBodyType;
23
+ }
24
+ exports.GetRequestBodyType = GetRequestBodyType;
25
+ //# sourceMappingURL=get-request-body-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-request-body-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-request-body-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,sCAAqD;AAErD,2DAAwD;AACxD,yDAAoD;AAEpD,SAAgB,kBAAkB,CAAC,SAAiC;IAElE,IAAI,eAAe,GAAG,MAAM,CAAC;IAE7B,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,SAAS,CAAC,CAAC;QAE9C,IAAI,WAAW,KAAK,IAAI,EAAE;YACxB,eAAe,GAAG,MAAM,CAAC;SAC1B;aAAM,IAAI,CAAC,IAAA,qCAAiB,EAAC,WAAW,CAAC,EAAE;YAC1C,eAAe,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,iCAAwB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC3F;aAAM;YACL,eAAe,GAAG,KAAK,CAAC;SACzB;KAEF;IAED,OAAO,eAAe,CAAC;AAEzB,CAAC;AApBD,gDAoBC"}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function GetResponseType(operation: OpenAPIV3.OperationObject): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetResponseType = void 0;
4
+ const utilities_1 = require("@rxap/utilities");
5
+ const config_1 = require("../config");
6
+ const any_schema_object_1 = require("./any-schema-object");
7
+ const get_response_1 = require("./get-response");
8
+ function GetResponseType(operation) {
9
+ let responseType = 'void';
10
+ if (operation.operationId) {
11
+ const response = (0, get_response_1.GetResponse)(operation);
12
+ // only generate the response interface if the type is not any
13
+ if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response)) {
14
+ responseType = (0, utilities_1.classify)([operation.operationId, config_1.RESPONSE_FILE_SUFFIX].join('-'));
15
+ }
16
+ else {
17
+ responseType = 'void';
18
+ }
19
+ }
20
+ return responseType;
21
+ }
22
+ exports.GetResponseType = GetResponseType;
23
+ //# sourceMappingURL=get-response-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-response-type.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response-type.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,sCAAiD;AACjD,2DAAwD;AACxD,iDAA6C;AAE7C,SAAgB,eAAe,CAAC,SAAoC;IAElE,IAAI,YAAY,GAAG,MAAM,CAAC;IAE1B,IAAI,SAAS,CAAC,WAAW,EAAE;QAEzB,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;QAExC,8DAA8D;QAC9D,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE;YAC5C,YAAY,GAAG,IAAA,oBAAQ,EAAC,CAAE,SAAS,CAAC,WAAW,EAAE,6BAAoB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACpF;aAAM;YACL,YAAY,GAAG,MAAM,CAAC;SACvB;KAEF;IAED,OAAO,YAAY,CAAC;AAEtB,CAAC;AAnBD,0CAmBC"}
@@ -0,0 +1,3 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ import { AnySchemaObject } from './any-schema-object';
3
+ export declare function GetResponse(operation: OpenAPIV3.OperationObject): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject | AnySchemaObject | null;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetResponse = void 0;
4
+ const is_reference_object_1 = require("./is-reference-object");
5
+ function GetResponse(operation) {
6
+ if (operation.responses) {
7
+ let response = undefined;
8
+ if (operation.responses['default']) {
9
+ response = operation.responses['default'];
10
+ }
11
+ else if (operation.responses['200']) {
12
+ response = operation.responses['200'];
13
+ }
14
+ else if (operation.responses['201']) {
15
+ response = operation.responses['201'];
16
+ }
17
+ if (response) {
18
+ if ((0, is_reference_object_1.IsReferenceObject)(response)) {
19
+ console.warn('Reference object are not supported in operation responses!');
20
+ }
21
+ else {
22
+ if (response.content && response.content['application/json']) {
23
+ const schema = response.content['application/json'].schema;
24
+ if (schema) {
25
+ return schema;
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ exports.GetResponse = GetResponse;
34
+ //# sourceMappingURL=get-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/get-response.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAE1D,SAAgB,WAAW,CAAC,SAAoC;IAE9D,IAAI,SAAS,CAAC,SAAS,EAAE;QAEvB,IAAI,QAAQ,GAAqE,SAAS,CAAC;QAE3F,IAAI,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;YAClC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAC3C;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YACrC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACvC;aAAM,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YACrC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACvC;QAED,IAAI,QAAQ,EAAE;YAEZ,IAAI,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE;gBAC/B,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;aAC5E;iBAAM;gBACL,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;oBAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;oBAC3D,IAAI,MAAM,EAAE;wBACV,OAAO,MAAM,CAAC;qBACf;iBACF;aACF;SAEF;KAEF;IAED,OAAO,IAAI,CAAC;AAEd,CAAC;AAjCD,kCAiCC"}
@@ -0,0 +1,3 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export type OperationObjectWithParameters = Omit<OpenAPIV3.OperationObject, 'parameters'> & Required<Pick<OpenAPIV3.OperationObject, 'parameters'>>;
3
+ export declare function HasOperationParameters(operation: OpenAPIV3.OperationObject): operation is OperationObjectWithParameters;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasOperationParameters = void 0;
4
+ function HasOperationParameters(operation) {
5
+ return Array.isArray(operation.parameters) && operation.parameters.length !== 0;
6
+ }
7
+ exports.HasOperationParameters = HasOperationParameters;
8
+ //# sourceMappingURL=has-operation-paramters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-operation-paramters.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-paramters.ts"],"names":[],"mappings":";;;AAMA,SAAgB,sBAAsB,CAAC,SAAoC;IACzE,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;AAClF,CAAC;AAFD,wDAEC"}
@@ -0,0 +1,3 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export type OperationObjectWithRequestBody = Omit<OpenAPIV3.OperationObject, 'requestBody'> & Required<Pick<OpenAPIV3.OperationObject, 'requestBody'>>;
3
+ export declare function HasOperationRequestBody(operation: OpenAPIV3.OperationObject): operation is OperationObjectWithRequestBody;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasOperationRequestBody = void 0;
4
+ function HasOperationRequestBody(operation) {
5
+ return !!operation.requestBody;
6
+ }
7
+ exports.HasOperationRequestBody = HasOperationRequestBody;
8
+ //# sourceMappingURL=has-operation-request-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-operation-request-body.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/has-operation-request-body.ts"],"names":[],"mappings":";;;AAMA,SAAgB,uBAAuB,CAAC,SAAoC;IAC1E,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC;AACjC,CAAC;AAFD,0DAEC"}
@@ -0,0 +1 @@
1
+ export declare function HttpRequest<T>(url: string): Promise<T>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpRequest = void 0;
4
+ const http = require("http");
5
+ const https = require("https");
6
+ function HttpRequest(url) {
7
+ function callback(resolve, reject) {
8
+ return function (res) {
9
+ const { statusCode } = res;
10
+ const contentType = res.headers['content-type'];
11
+ let error;
12
+ // Any 2xx status code signals a successful response but
13
+ // here we're only checking for 200.
14
+ if (statusCode !== 200) {
15
+ error = new Error('Request Failed.\n' +
16
+ `Status Code: ${statusCode}`);
17
+ }
18
+ else if (contentType && !/^application\/json/.test(contentType)) {
19
+ error = new Error('Invalid content-type.\n' +
20
+ `Expected application/json but received ${contentType}`);
21
+ }
22
+ if (error) {
23
+ // Consume response data to free up memory
24
+ res.resume();
25
+ console.error(error.message);
26
+ reject(error.message);
27
+ return;
28
+ }
29
+ res.setEncoding('utf8');
30
+ let rawData = '';
31
+ res.on('data', (chunk) => {
32
+ rawData += chunk;
33
+ });
34
+ res.on('end', () => {
35
+ try {
36
+ resolve(JSON.parse(rawData));
37
+ }
38
+ catch (e) {
39
+ console.error(e.message);
40
+ reject(e.message);
41
+ }
42
+ });
43
+ };
44
+ }
45
+ if (url.match(/^https/)) {
46
+ return new Promise((resolve, reject) => {
47
+ https.get(url, callback(resolve, reject)).on('error', e => reject(e.message));
48
+ });
49
+ }
50
+ else {
51
+ return new Promise((resolve, reject) => {
52
+ http.get(url, callback(resolve, reject)).on('error', e => reject(e.message));
53
+ });
54
+ }
55
+ }
56
+ exports.HttpRequest = HttpRequest;
57
+ //# sourceMappingURL=http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/http-request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+BAA+B;AAE/B,SAAgB,WAAW,CAAI,GAAW;IAExC,SAAS,QAAQ,CAAC,OAA6B,EAAE,MAA4B;QAE3E,OAAO,UAAU,GAAyB;YAExC,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;YAC3B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAEhD,IAAI,KAAK,CAAC;YACV,wDAAwD;YACxD,oCAAoC;YACpC,IAAI,UAAU,KAAK,GAAG,EAAE;gBACtB,KAAK,GAAG,IAAI,KAAK,CAAC,mBAAmB;oBACnC,gBAAiB,UAAW,EAAE,CAAC,CAAC;aACnC;iBAAM,IAAI,WAAW,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;gBACjE,KAAK,GAAG,IAAI,KAAK,CAAC,yBAAyB;oBACzC,0CAA2C,WAAY,EAAE,CAAC,CAAC;aAC9D;YACD,IAAI,KAAK,EAAE;gBACT,0CAA0C;gBAC1C,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC7B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO;aACR;YAED,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,OAAO,IAAI,KAAK,CAAC;YACnB,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACjB,IAAI;oBACF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;iBAC9B;gBAAC,OAAO,CAAM,EAAE;oBACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACzB,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;iBACnB;YACH,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC;IAEJ,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QACvB,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;KACJ;AAEH,CAAC;AAvDD,kCAuDC"}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function IgnoreOperation(tags?: string[]): (operation: OpenAPIV3.OperationObject) => boolean;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IgnoreOperation = void 0;
4
+ function IgnoreOperation(tags = []) {
5
+ return operation => {
6
+ var _a;
7
+ if ((_a = operation === null || operation === void 0 ? void 0 : operation.tags) === null || _a === void 0 ? void 0 : _a.length) {
8
+ return operation.tags.some(tag => tags.includes(tag));
9
+ }
10
+ return false;
11
+ };
12
+ }
13
+ exports.IgnoreOperation = IgnoreOperation;
14
+ //# sourceMappingURL=ignore-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore-operation.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/ignore-operation.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,OAAiB,EAAE;IACjD,OAAO,SAAS,CAAC,EAAE;;QAEjB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,MAAM,EAAE;YAC3B,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,KAAK,CAAC;IAEf,CAAC,CAAC;AACJ,CAAC;AAVD,0CAUC"}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function IsCollectionResponse(operation: OpenAPIV3.OperationObject): boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsCollectionResponse = void 0;
4
+ const any_schema_object_1 = require("./any-schema-object");
5
+ const get_response_1 = require("./get-response");
6
+ const is_reference_object_1 = require("./is-reference-object");
7
+ function IsCollectionResponse(operation) {
8
+ const response = (0, get_response_1.GetResponse)(operation);
9
+ if (response && !(0, any_schema_object_1.IsAnySchemaObject)(response)) {
10
+ if (!(0, is_reference_object_1.IsReferenceObject)(response)) {
11
+ return response.type === 'array';
12
+ }
13
+ }
14
+ return false;
15
+ }
16
+ exports.IsCollectionResponse = IsCollectionResponse;
17
+ //# sourceMappingURL=is-collection-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-collection-response.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-collection-response.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AACxD,iDAA6C;AAC7C,+DAA0D;AAE1D,SAAgB,oBAAoB,CAAC,SAAoC;IAEvE,MAAM,QAAQ,GAAG,IAAA,0BAAW,EAAC,SAAS,CAAC,CAAC;IAExC,IAAI,QAAQ,IAAI,CAAC,IAAA,qCAAiB,EAAC,QAAQ,CAAC,EAAE;QAC5C,IAAI,CAAC,IAAA,uCAAiB,EAAC,QAAQ,CAAC,EAAE;YAChC,OAAO,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;SAClC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAXD,oDAWC"}
@@ -0,0 +1 @@
1
+ export declare function IsHttpMethod(method: string): method is 'get' | 'put' | 'post' | 'delete' | 'patch';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsHttpMethod = void 0;
4
+ function IsHttpMethod(method) {
5
+ return ['get', 'put', 'post', 'delete', 'patch'].includes(method);
6
+ }
7
+ exports.IsHttpMethod = IsHttpMethod;
8
+ //# sourceMappingURL=is-http-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-http-method.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-http-method.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,CAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,oCAEC"}
@@ -0,0 +1,2 @@
1
+ import { OpenApiSchema, OpenApiSchemaFromPath } from '../types';
2
+ export declare function IsOpenApiSchemaFromPath(options: OpenApiSchema): options is OpenApiSchemaFromPath;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IsOpenApiSchemaFromPath = void 0;
4
+ const utilities_1 = require("@rxap/utilities");
5
+ function IsOpenApiSchemaFromPath(options) {
6
+ return !!options && (0, utilities_1.hasIndexSignature)(options) && !!options['path'];
7
+ }
8
+ exports.IsOpenApiSchemaFromPath = IsOpenApiSchemaFromPath;
9
+ //# sourceMappingURL=is-open-api-schema-from-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-open-api-schema-from-path.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/open-api/src/lib/utilities/is-open-api-schema-from-path.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAMpD,SAAgB,uBAAuB,CAAC,OAAsB;IAC5D,OAAO,CAAC,CAAC,OAAO,IAAI,IAAA,6BAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAFD,0DAEC"}
@@ -0,0 +1,2 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ export declare function IsOperationObject(obj: any): obj is OpenAPIV3.OperationObject;