@scalar/openapi-parser 0.14.0 → 0.16.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 (93) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +26 -1
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/index.js.map +2 -2
  7. package/dist/plugins-browser.d.ts +2 -0
  8. package/dist/plugins-browser.d.ts.map +1 -0
  9. package/dist/plugins-browser.js +5 -0
  10. package/dist/plugins-browser.js.map +7 -0
  11. package/dist/plugins.d.ts +3 -0
  12. package/dist/plugins.d.ts.map +1 -0
  13. package/dist/plugins.js +7 -0
  14. package/dist/plugins.js.map +7 -0
  15. package/dist/utils/bundle/bundle.d.ts +94 -8
  16. package/dist/utils/bundle/bundle.d.ts.map +1 -1
  17. package/dist/utils/bundle/bundle.js +24 -6
  18. package/dist/utils/bundle/bundle.js.map +2 -2
  19. package/dist/utils/bundle/plugins/{fetch-urls.d.ts → fetch-urls/index.d.ts} +3 -2
  20. package/dist/utils/bundle/plugins/fetch-urls/index.d.ts.map +1 -0
  21. package/dist/utils/bundle/plugins/{fetch-urls.js → fetch-urls/index.js} +6 -5
  22. package/dist/utils/bundle/plugins/fetch-urls/index.js.map +7 -0
  23. package/dist/utils/bundle/plugins/{read-files.d.ts → read-files/index.d.ts} +2 -2
  24. package/dist/utils/bundle/plugins/read-files/index.d.ts.map +1 -0
  25. package/dist/utils/bundle/plugins/{read-files.js → read-files/index.js} +4 -4
  26. package/dist/utils/bundle/plugins/read-files/index.js.map +7 -0
  27. package/dist/utils/openapi/actions/details.d.ts +7 -0
  28. package/dist/utils/openapi/actions/details.d.ts.map +1 -0
  29. package/dist/utils/openapi/actions/details.js +11 -0
  30. package/dist/utils/openapi/actions/details.js.map +7 -0
  31. package/dist/utils/openapi/actions/files.d.ts +6 -0
  32. package/dist/utils/openapi/actions/files.d.ts.map +1 -0
  33. package/dist/utils/openapi/actions/files.js +9 -0
  34. package/dist/utils/openapi/actions/files.js.map +7 -0
  35. package/dist/utils/openapi/actions/get.d.ts +6 -0
  36. package/dist/utils/openapi/actions/get.d.ts.map +1 -0
  37. package/dist/utils/openapi/actions/get.js +11 -0
  38. package/dist/utils/openapi/actions/get.js.map +7 -0
  39. package/dist/utils/openapi/actions/toJson.d.ts +6 -0
  40. package/dist/utils/openapi/actions/toJson.d.ts.map +1 -0
  41. package/dist/utils/openapi/actions/toJson.js +11 -0
  42. package/dist/utils/openapi/actions/toJson.js.map +7 -0
  43. package/dist/utils/openapi/actions/toYaml.d.ts +6 -0
  44. package/dist/utils/openapi/actions/toYaml.d.ts.map +1 -0
  45. package/dist/utils/openapi/actions/toYaml.js +11 -0
  46. package/dist/utils/openapi/actions/toYaml.js.map +7 -0
  47. package/dist/utils/openapi/commands/dereferenceCommand.d.ts +27 -0
  48. package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +1 -0
  49. package/dist/utils/openapi/commands/dereferenceCommand.js +27 -0
  50. package/dist/utils/openapi/commands/dereferenceCommand.js.map +7 -0
  51. package/dist/utils/openapi/commands/filterCommand.d.ts +41 -0
  52. package/dist/utils/openapi/commands/filterCommand.d.ts.map +1 -0
  53. package/dist/utils/openapi/commands/filterCommand.js +26 -0
  54. package/dist/utils/openapi/commands/filterCommand.js.map +7 -0
  55. package/dist/utils/openapi/commands/loadCommand.d.ts +8321 -0
  56. package/dist/utils/openapi/commands/loadCommand.d.ts.map +1 -0
  57. package/dist/utils/openapi/commands/loadCommand.js +42 -0
  58. package/dist/utils/openapi/commands/loadCommand.js.map +7 -0
  59. package/dist/utils/openapi/commands/upgradeCommand.d.ts +3406 -0
  60. package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +1 -0
  61. package/dist/utils/openapi/commands/upgradeCommand.js +29 -0
  62. package/dist/utils/openapi/commands/upgradeCommand.js.map +7 -0
  63. package/dist/utils/openapi/commands/validateCommand.d.ts +3451 -0
  64. package/dist/utils/openapi/commands/validateCommand.d.ts.map +1 -0
  65. package/dist/utils/openapi/commands/validateCommand.js +33 -0
  66. package/dist/utils/openapi/commands/validateCommand.js.map +7 -0
  67. package/dist/utils/openapi/openapi.d.ts +1272 -0
  68. package/dist/utils/openapi/openapi.d.ts.map +1 -0
  69. package/dist/utils/openapi/openapi.js +15 -0
  70. package/dist/utils/openapi/openapi.js.map +7 -0
  71. package/dist/utils/openapi/openapi.test-d.d.ts +2 -0
  72. package/dist/utils/openapi/openapi.test-d.d.ts.map +1 -0
  73. package/dist/utils/openapi/openapi.test-d.js +14 -0
  74. package/dist/utils/openapi/openapi.test-d.js.map +7 -0
  75. package/dist/utils/openapi/utils/queueTask.d.ts +6 -0
  76. package/dist/utils/openapi/utils/queueTask.d.ts.map +1 -0
  77. package/dist/utils/openapi/utils/queueTask.js +10 -0
  78. package/dist/utils/openapi/utils/queueTask.js.map +7 -0
  79. package/dist/utils/openapi/utils/workThroughQueue.d.ts +6 -0
  80. package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +1 -0
  81. package/dist/utils/openapi/utils/workThroughQueue.js +52 -0
  82. package/dist/utils/openapi/utils/workThroughQueue.js.map +7 -0
  83. package/dist/utils/upgrade-from-two-to-three.js +45 -1
  84. package/dist/utils/upgrade-from-two-to-three.js.map +2 -2
  85. package/package.json +15 -6
  86. package/dist/utils/bundle/index.d.ts +0 -4
  87. package/dist/utils/bundle/index.d.ts.map +0 -1
  88. package/dist/utils/bundle/index.js +0 -9
  89. package/dist/utils/bundle/index.js.map +0 -7
  90. package/dist/utils/bundle/plugins/fetch-urls.d.ts.map +0 -1
  91. package/dist/utils/bundle/plugins/fetch-urls.js.map +0 -7
  92. package/dist/utils/bundle/plugins/read-files.d.ts.map +0 -1
  93. package/dist/utils/bundle/plugins/read-files.js.map +0 -7
@@ -1,12 +1,13 @@
1
- import { normalize } from "../../../utils/normalize.js";
2
- import { isRemoteUrl } from "../../../utils/bundle/bundle.js";
3
- import { createLimiter } from "../../../utils/bundle/create-limiter.js";
1
+ import { normalize } from "../../../../utils/normalize.js";
2
+ import { isRemoteUrl } from "../../../../utils/bundle/bundle.js";
3
+ import { createLimiter } from "../../../../utils/bundle/create-limiter.js";
4
4
  async function fetchUrl(url, limiter, config) {
5
5
  try {
6
6
  const domain = new URL(url).host;
7
7
  const headers = config?.headers?.find((a) => a.domains.find((d) => d === domain) !== void 0)?.headers;
8
+ const exec = config?.fetch ?? fetch;
8
9
  const result = await limiter(
9
- () => fetch(url, {
10
+ () => exec(url, {
10
11
  headers
11
12
  })
12
13
  );
@@ -37,4 +38,4 @@ export {
37
38
  fetchUrl,
38
39
  fetchUrls
39
40
  };
40
- //# sourceMappingURL=fetch-urls.js.map
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/utils/bundle/plugins/fetch-urls/index.ts"],
4
+ "sourcesContent": ["import { normalize } from '@/utils/normalize'\nimport { isRemoteUrl, type Plugin, type ResolveResult } from '@/utils/bundle/bundle'\nimport { createLimiter } from '@/utils/bundle/create-limiter'\n\ntype FetchConfig = Partial<{\n headers: { headers: HeadersInit; domains: string[] }[]\n fetch: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>\n}>\n\n/**\n * Fetches and normalizes data from a remote URL\n * @param url - The URL to fetch data from\n * @returns A promise that resolves to either the normalized data or an error result\n * @example\n * ```ts\n * const result = await fetchUrl('https://api.example.com/data.json')\n * if (result.ok) {\n * console.log(result.data) // The normalized data\n * } else {\n * console.log('Failed to fetch data')\n * }\n * ```\n */\nexport async function fetchUrl(\n url: string,\n limiter: <T>(fn: () => Promise<T>) => Promise<T>,\n config?: FetchConfig,\n): Promise<ResolveResult> {\n try {\n const domain = new URL(url).host\n\n // Get the headers that match the domain\n const headers = config?.headers?.find((a) => a.domains.find((d) => d === domain) !== undefined)?.headers\n\n const exec = config?.fetch ?? fetch\n\n const result = await limiter(() =>\n exec(url, {\n headers,\n }),\n )\n\n if (result.ok) {\n const body = await result.text()\n\n return {\n ok: true,\n data: normalize(body),\n }\n }\n\n return {\n ok: false,\n }\n } catch {\n return {\n ok: false,\n }\n }\n}\n\n/**\n * Creates a plugin for handling remote URL references.\n * This plugin validates and fetches data from HTTP/HTTPS URLs.\n *\n * @returns A plugin object with validate and exec functions\n * @example\n * const urlPlugin = fetchUrls()\n * if (urlPlugin.validate('https://example.com/schema.json')) {\n * const result = await urlPlugin.exec('https://example.com/schema.json')\n * }\n */\nexport function fetchUrls(config?: FetchConfig & Partial<{ limit: number | null }>): Plugin {\n // If there is a limit specified we limit the number of concurrent calls\n const limiter = config?.limit ? createLimiter(config.limit) : <T>(fn: () => Promise<T>) => fn()\n\n return {\n validate: (value) => isRemoteUrl(value),\n exec: (value) => fetchUrl(value, limiter, config),\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAoD;AAC7D,SAAS,qBAAqB;AAqB9B,eAAsB,SACpB,KACA,SACA,QACwB;AACxB,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,GAAG,EAAE;AAG5B,UAAM,UAAU,QAAQ,SAAS,KAAK,CAAC,MAAM,EAAE,QAAQ,KAAK,CAAC,MAAM,MAAM,MAAM,MAAM,MAAS,GAAG;AAEjG,UAAM,OAAO,QAAQ,SAAS;AAE9B,UAAM,SAAS,MAAM;AAAA,MAAQ,MAC3B,KAAK,KAAK;AAAA,QACR;AAAA,MACF,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,IAAI;AACb,YAAM,OAAO,MAAM,OAAO,KAAK;AAE/B,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,MAAM,UAAU,IAAI;AAAA,MACtB;AAAA,IACF;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,IACN;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,MACL,IAAI;AAAA,IACN;AAAA,EACF;AACF;AAaO,SAAS,UAAU,QAAkE;AAE1F,QAAM,UAAU,QAAQ,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAI,OAAyB,GAAG;AAE9F,SAAO;AAAA,IACL,UAAU,CAAC,UAAU,YAAY,KAAK;AAAA,IACtC,MAAM,CAAC,UAAU,SAAS,OAAO,SAAS,MAAM;AAAA,EAClD;AACF;",
6
+ "names": []
7
+ }
@@ -1,4 +1,4 @@
1
- import { type Plugin, type ResolveResult } from '../../../utils/bundle/bundle.js';
1
+ import { type Plugin, type ResolveResult } from '../../../../utils/bundle/bundle.js';
2
2
  /**
3
3
  * Reads and normalizes data from a local file
4
4
  * @param path - The file path to read from
@@ -26,4 +26,4 @@ export declare function readFile(path: string): Promise<ResolveResult>;
26
26
  * }
27
27
  */
28
28
  export declare function readFiles(): Plugin;
29
- //# sourceMappingURL=read-files.d.ts.map
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bundle/plugins/read-files/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAEpF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC"}
@@ -1,7 +1,7 @@
1
- import { normalize } from "../../../utils/normalize.js";
2
- import { isRemoteUrl } from "../../../utils/bundle/bundle.js";
3
- const fs = typeof window === "undefined" ? await import("node:fs/promises") : void 0;
1
+ import { normalize } from "../../../../utils/normalize.js";
2
+ import { isRemoteUrl } from "../../../../utils/bundle/bundle.js";
4
3
  async function readFile(path) {
4
+ const fs = typeof window === "undefined" ? await import("node:fs/promises") : void 0;
5
5
  if (fs === void 0) {
6
6
  throw "Can not use readFiles plugin outside of a node environment";
7
7
  }
@@ -27,4 +27,4 @@ export {
27
27
  readFile,
28
28
  readFiles
29
29
  };
30
- //# sourceMappingURL=read-files.js.map
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/utils/bundle/plugins/read-files/index.ts"],
4
+ "sourcesContent": ["import { normalize } from '@/utils/normalize'\nimport { isRemoteUrl, type Plugin, type ResolveResult } from '@/utils/bundle/bundle'\n\n/**\n * Reads and normalizes data from a local file\n * @param path - The file path to read from\n * @returns A promise that resolves to either the normalized data or an error result\n * @example\n * ```ts\n * const result = await readFile('./schemas/user.json')\n * if (result.ok) {\n * console.log(result.data) // The normalized data\n * } else {\n * console.log('Failed to read file')\n * }\n * ```\n */\nexport async function readFile(path: string): Promise<ResolveResult> {\n const fs = typeof window === 'undefined' ? await import('node:fs/promises') : undefined\n\n if (fs === undefined) {\n throw 'Can not use readFiles plugin outside of a node environment'\n }\n\n try {\n const fileContents = await fs.readFile(path, { encoding: 'utf-8' })\n\n return {\n ok: true,\n data: normalize(fileContents),\n }\n } catch {\n return {\n ok: false,\n }\n }\n}\n\n/**\n * Creates a plugin for handling local file references.\n * This plugin validates and reads data from local filesystem paths.\n *\n * @returns A plugin object with validate and exec functions\n * @example\n * const filePlugin = readFiles()\n * if (filePlugin.validate('./local-schema.json')) {\n * const result = await filePlugin.exec('./local-schema.json')\n * }\n */\nexport function readFiles(): Plugin {\n return {\n validate: (value) => !isRemoteUrl(value),\n exec: (value) => readFile(value),\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAoD;AAgB7D,eAAsB,SAAS,MAAsC;AACnE,QAAM,KAAK,OAAO,WAAW,cAAc,MAAM,OAAO,kBAAkB,IAAI;AAE9E,MAAI,OAAO,QAAW;AACpB,UAAM;AAAA,EACR;AAEA,MAAI;AACF,UAAM,eAAe,MAAM,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ,CAAC;AAElE,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,MAAM,UAAU,YAAY;AAAA,IAC9B;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,MACL,IAAI;AAAA,IACN;AAAA,EACF;AACF;AAaO,SAAS,YAAoB;AAClC,SAAO;AAAA,IACL,UAAU,CAAC,UAAU,CAAC,YAAY,KAAK;AAAA,IACvC,MAAM,CAAC,UAAU,SAAS,KAAK;AAAA,EACjC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Queue, Task } from '../../../types/index.js';
2
+ import { details as detailsUtility } from '../../../utils/details.js';
3
+ /**
4
+ * Run the chained tasks and return just some basic information about the OpenAPI document
5
+ */
6
+ export declare function details<T extends Task[]>(queue: Queue<T>): Promise<ReturnType<typeof detailsUtility>>;
7
+ //# sourceMappingURL=details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/details.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAG3D;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAI3G"}
@@ -0,0 +1,11 @@
1
+ import { getEntrypoint } from "../../../utils/get-entrypoint.js";
2
+ import { details as detailsUtility } from "../../../utils/details.js";
3
+ import { workThroughQueue } from "../utils/workThroughQueue.js";
4
+ async function details(queue) {
5
+ const { filesystem } = await workThroughQueue(queue);
6
+ return detailsUtility(getEntrypoint(filesystem).specification);
7
+ }
8
+ export {
9
+ details
10
+ };
11
+ //# sourceMappingURL=details.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/actions/details.ts"],
4
+ "sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { details as detailsUtility } from '@/utils/details'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return just some basic information about the OpenAPI document\n */\nexport async function details<T extends Task[]>(queue: Queue<T>): Promise<ReturnType<typeof detailsUtility>> {\n const { filesystem } = await workThroughQueue(queue)\n\n return detailsUtility(getEntrypoint(filesystem).specification)\n}\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,WAAW,sBAAsB;AAC1C,SAAS,wBAAwB;AAKjC,eAAsB,QAA0B,OAA6D;AAC3G,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,eAAe,cAAc,UAAU,EAAE,aAAa;AAC/D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { Filesystem, Queue, Task } from '../../../types/index.js';
2
+ /**
3
+ * Run the chained tasks and return just the filesystem
4
+ */
5
+ export declare function files<T extends Task[]>(queue: Queue<T>): Promise<Filesystem>;
6
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG5D;;GAEG;AACH,wBAAsB,KAAK,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAIlF"}
@@ -0,0 +1,9 @@
1
+ import { workThroughQueue } from "../utils/workThroughQueue.js";
2
+ async function files(queue) {
3
+ const { filesystem } = await workThroughQueue(queue);
4
+ return filesystem;
5
+ }
6
+ export {
7
+ files
8
+ };
9
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/actions/files.ts"],
4
+ "sourcesContent": ["import type { Filesystem, Queue, Task } from '@/types/index'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return just the filesystem\n */\nexport async function files<T extends Task[]>(queue: Queue<T>): Promise<Filesystem> {\n const { filesystem } = await workThroughQueue(queue)\n\n return filesystem\n}\n"],
5
+ "mappings": "AACA,SAAS,wBAAwB;AAKjC,eAAsB,MAAwB,OAAsC;AAClF,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { CommandChain, Queue, Task } from '../../../types/index.js';
2
+ /**
3
+ * Run the chained tasks and return the results
4
+ */
5
+ export declare function get<T extends Task[]>(queue: Queue<T>): Promise<CommandChain<T>>;
6
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG9D;;GAEG;AACH,wBAAsB,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAKrF"}
@@ -0,0 +1,11 @@
1
+ import { workThroughQueue } from "../utils/workThroughQueue.js";
2
+ async function get(queue) {
3
+ return {
4
+ filesystem: [],
5
+ ...await workThroughQueue(queue)
6
+ };
7
+ }
8
+ export {
9
+ get
10
+ };
11
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/actions/get.ts"],
4
+ "sourcesContent": ["import type { CommandChain, Queue, Task } from '@/types/index'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function get<T extends Task[]>(queue: Queue<T>): Promise<CommandChain<T>> {\n return {\n filesystem: [],\n ...(await workThroughQueue(queue)),\n }\n}\n"],
5
+ "mappings": "AACA,SAAS,wBAAwB;AAKjC,eAAsB,IAAsB,OAA2C;AACrF,SAAO;AAAA,IACL,YAAY,CAAC;AAAA,IACb,GAAI,MAAM,iBAAiB,KAAK;AAAA,EAClC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { Queue, Task } from '../../../types/index.js';
2
+ /**
3
+ * Run the chained tasks and return the results
4
+ */
5
+ export declare function toJson<T extends Task[]>(queue: Queue<T>): Promise<string | undefined>;
6
+ //# sourceMappingURL=toJson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toJson.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toJson.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAIhD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAI3F"}
@@ -0,0 +1,11 @@
1
+ import { getEntrypoint } from "../../../utils/get-entrypoint.js";
2
+ import { toJson as toJsonUtility } from "../../../utils/to-json.js";
3
+ import { workThroughQueue } from "../utils/workThroughQueue.js";
4
+ async function toJson(queue) {
5
+ const { filesystem } = await workThroughQueue(queue);
6
+ return toJsonUtility(getEntrypoint(filesystem).specification);
7
+ }
8
+ export {
9
+ toJson
10
+ };
11
+ //# sourceMappingURL=toJson.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/actions/toJson.ts"],
4
+ "sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { toJson as toJsonUtility } from '@/utils/to-json'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function toJson<T extends Task[]>(queue: Queue<T>): Promise<string | undefined> {\n const { filesystem } = await workThroughQueue(queue)\n\n return toJsonUtility(getEntrypoint(filesystem).specification)\n}\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,UAAU,qBAAqB;AACxC,SAAS,wBAAwB;AAKjC,eAAsB,OAAyB,OAA8C;AAC3F,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,cAAc,cAAc,UAAU,EAAE,aAAa;AAC9D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { Queue, Task } from '../../../types/index.js';
2
+ /**
3
+ * Run the chained tasks and return the results
4
+ */
5
+ export declare function toYaml<T extends Task[]>(queue: Queue<T>): Promise<string>;
6
+ //# sourceMappingURL=toYaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toYaml.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/actions/toYaml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAIhD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/E"}
@@ -0,0 +1,11 @@
1
+ import { getEntrypoint } from "../../../utils/get-entrypoint.js";
2
+ import { toYaml as toYamlUtility } from "../../../utils/to-yaml.js";
3
+ import { workThroughQueue } from "../utils/workThroughQueue.js";
4
+ async function toYaml(queue) {
5
+ const { filesystem } = await workThroughQueue(queue);
6
+ return toYamlUtility(getEntrypoint(filesystem).specification);
7
+ }
8
+ export {
9
+ toYaml
10
+ };
11
+ //# sourceMappingURL=toYaml.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/actions/toYaml.ts"],
4
+ "sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { toYaml as toYamlUtility } from '@/utils/to-yaml'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function toYaml<T extends Task[]>(queue: Queue<T>): Promise<string> {\n const { filesystem } = await workThroughQueue(queue)\n\n return toYamlUtility(getEntrypoint(filesystem).specification)\n}\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,UAAU,qBAAqB;AACxC,SAAS,wBAAwB;AAKjC,eAAsB,OAAyB,OAAkC;AAC/E,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,cAAc,cAAc,UAAU,EAAE,aAAa;AAC9D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,27 @@
1
+ import type { DereferenceResult, Queue, Task } from '../../../types/index.js';
2
+ import type { DereferenceOptions } from '../../../utils/dereference.js';
3
+ declare global {
4
+ interface Commands {
5
+ dereference: {
6
+ task: {
7
+ name: 'dereference';
8
+ options?: DereferenceOptions;
9
+ };
10
+ result: DereferenceResult;
11
+ };
12
+ }
13
+ }
14
+ /**
15
+ * Dereference the given OpenAPI document
16
+ */
17
+ export declare function dereferenceCommand<T extends Task[]>(previousQueue: Queue<T>, options?: DereferenceOptions): {
18
+ details: () => Promise<import("../../../types/index.js").DetailsResult>;
19
+ files: () => Promise<import("../../../types/index.js").Filesystem>;
20
+ get: () => Promise<import("../../../types/index.js").CommandChain<[...T, {
21
+ name: "dereference";
22
+ options?: DereferenceOptions;
23
+ }]>>;
24
+ toJson: () => Promise<string>;
25
+ toYaml: () => Promise<string>;
26
+ };
27
+ //# sourceMappingURL=dereferenceCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dereferenceCommand.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/commands/dereferenceCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAQ7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,WAAW,EAAE;YACX,IAAI,EAAE;gBACJ,IAAI,EAAE,aAAa,CAAA;gBACnB,OAAO,CAAC,EAAE,kBAAkB,CAAA;aAC7B,CAAA;YACD,MAAM,EAAE,iBAAiB,CAAA;SAC1B,CAAA;KACF;CACF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB;;;;cAX5F,aAAa;kBACT,kBAAkB;;;;EA4BnC"}
@@ -0,0 +1,27 @@
1
+ import { details } from "../actions/details.js";
2
+ import { files } from "../actions/files.js";
3
+ import { get } from "../actions/get.js";
4
+ import { toJson } from "../actions/toJson.js";
5
+ import { toYaml } from "../actions/toYaml.js";
6
+ import { queueTask } from "../utils/queueTask.js";
7
+ function dereferenceCommand(previousQueue, options) {
8
+ const task = {
9
+ name: "dereference",
10
+ options: {
11
+ throwOnError: previousQueue.options?.throwOnError,
12
+ ...options ?? {}
13
+ }
14
+ };
15
+ const queue = queueTask(previousQueue, task);
16
+ return {
17
+ details: () => details(queue),
18
+ files: () => files(queue),
19
+ get: () => get(queue),
20
+ toJson: () => toJson(queue),
21
+ toYaml: () => toYaml(queue)
22
+ };
23
+ }
24
+ export {
25
+ dereferenceCommand
26
+ };
27
+ //# sourceMappingURL=dereferenceCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/commands/dereferenceCommand.ts"],
4
+ "sourcesContent": ["import type { DereferenceResult, Queue, Task } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\n\ndeclare global {\n interface Commands {\n dereference: {\n task: {\n name: 'dereference'\n options?: DereferenceOptions\n }\n result: DereferenceResult\n }\n }\n}\n\n/**\n * Dereference the given OpenAPI document\n */\nexport function dereferenceCommand<T extends Task[]>(previousQueue: Queue<T>, options?: DereferenceOptions) {\n const task: Task = {\n name: 'dereference',\n options: {\n throwOnError: previousQueue.options?.throwOnError,\n ...(options ?? {}),\n },\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n details: () => details(queue),\n files: () => files(queue),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAiBnB,SAAS,mBAAqC,eAAyB,SAA8B;AAC1G,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,IACN,SAAS;AAAA,MACP,cAAc,cAAc,SAAS;AAAA,MACrC,GAAI,WAAW,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,EAC5B;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,41 @@
1
+ import type { FilterResult, Queue, Task } from '../../../types/index.js';
2
+ import type { DereferenceOptions } from '../../../utils/dereference.js';
3
+ import type { FilterCallback } from '../../../utils/filter.js';
4
+ declare global {
5
+ interface Commands {
6
+ filter: {
7
+ task: {
8
+ name: 'filter';
9
+ options?: FilterCallback;
10
+ };
11
+ result: FilterResult;
12
+ };
13
+ }
14
+ }
15
+ /**
16
+ * Filter the given OpenAPI document
17
+ */
18
+ export declare function filterCommand<T extends Task[]>(previousQueue: Queue<T>, options?: FilterCallback): {
19
+ dereference: (dereferenceOptions?: DereferenceOptions) => {
20
+ details: () => Promise<import("../../../types/index.js").DetailsResult>;
21
+ files: () => Promise<import("../../../types/index.js").Filesystem>;
22
+ get: () => Promise<import("../../../types/index.js").CommandChain<[...T, {
23
+ name: "filter";
24
+ options?: FilterCallback;
25
+ }, {
26
+ name: "dereference";
27
+ options?: DereferenceOptions;
28
+ }]>>;
29
+ toJson: () => Promise<string>;
30
+ toYaml: () => Promise<string>;
31
+ };
32
+ details: () => Promise<import("../../../types/index.js").DetailsResult>;
33
+ files: () => Promise<import("../../../types/index.js").Filesystem>;
34
+ get: () => Promise<import("../../../types/index.js").CommandChain<[...T, {
35
+ name: "filter";
36
+ options?: FilterCallback;
37
+ }]>>;
38
+ toJson: () => Promise<string>;
39
+ toYaml: () => Promise<string>;
40
+ };
41
+ //# sourceMappingURL=filterCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterCommand.d.ts","sourceRoot":"","sources":["../../../../src/utils/openapi/commands/filterCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AASpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ,CAAA;gBACd,OAAO,CAAC,EAAE,cAAc,CAAA;aACzB,CAAA;YACD,MAAM,EAAE,YAAY,CAAA;SACrB,CAAA;KACF;CACF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;uCAS1D,kBAAkB;;;;kBApB3C,QAAQ;sBACJ,cAAc;;;;;;;;;;;cADlB,QAAQ;kBACJ,cAAc;;;;EA0B/B"}
@@ -0,0 +1,26 @@
1
+ import { details } from "../actions/details.js";
2
+ import { files } from "../actions/files.js";
3
+ import { get } from "../actions/get.js";
4
+ import { toJson } from "../actions/toJson.js";
5
+ import { toYaml } from "../actions/toYaml.js";
6
+ import { queueTask } from "../utils/queueTask.js";
7
+ import { dereferenceCommand } from "./dereferenceCommand.js";
8
+ function filterCommand(previousQueue, options) {
9
+ const task = {
10
+ name: "filter",
11
+ options
12
+ };
13
+ const queue = queueTask(previousQueue, task);
14
+ return {
15
+ dereference: (dereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),
16
+ details: () => details(queue),
17
+ files: () => files(queue),
18
+ get: () => get(queue),
19
+ toJson: () => toJson(queue),
20
+ toYaml: () => toYaml(queue)
21
+ };
22
+ }
23
+ export {
24
+ filterCommand
25
+ };
26
+ //# sourceMappingURL=filterCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/utils/openapi/commands/filterCommand.ts"],
4
+ "sourcesContent": ["import type { FilterResult, Queue, Task } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport type { FilterCallback } from '@/utils/filter'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\nimport { dereferenceCommand } from './dereferenceCommand'\n\ndeclare global {\n interface Commands {\n filter: {\n task: {\n name: 'filter'\n options?: FilterCallback\n }\n result: FilterResult\n }\n }\n}\n\n/**\n * Filter the given OpenAPI document\n */\nexport function filterCommand<T extends Task[]>(previousQueue: Queue<T>, options?: FilterCallback) {\n const task: Task = {\n name: 'filter',\n options,\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n dereference: (dereferenceOptions?: DereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),\n details: () => details(queue),\n files: () => files(queue),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n }\n}\n"],
5
+ "mappings": "AAGA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AAiB5B,SAAS,cAAgC,eAAyB,SAA0B;AACjG,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,IACN;AAAA,EACF;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,aAAa,CAAC,uBAA4C,mBAAmB,OAAO,kBAAkB;AAAA,IACtG,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,EAC5B;AACF;",
6
+ "names": []
7
+ }