@speclynx/apidom-reference 3.2.1 → 4.0.1

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 (192) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/apidom-reference.browser.js +40 -36
  3. package/dist/apidom-reference.browser.min.js +1 -1
  4. package/package.json +25 -25
  5. package/types/dereference/strategies/apidom/visitor.d.ts +1 -1
  6. package/types/dereference/strategies/arazzo-1/visitor.d.ts +1 -1
  7. package/types/dereference/strategies/asyncapi-2/visitor.d.ts +1 -1
  8. package/types/dereference/strategies/openapi-2/visitor.d.ts +1 -1
  9. package/types/dereference/strategies/openapi-3-0/visitor.d.ts +1 -1
  10. package/types/dereference/strategies/openapi-3-1/visitor.d.ts +1 -1
  11. package/src/File.cjs +0 -50
  12. package/src/File.mjs +0 -44
  13. package/src/Reference.cjs +0 -31
  14. package/src/Reference.mjs +0 -27
  15. package/src/ReferenceSet.cjs +0 -60
  16. package/src/ReferenceSet.mjs +0 -57
  17. package/src/bundle/index.cjs +0 -61
  18. package/src/bundle/index.mjs +0 -55
  19. package/src/bundle/strategies/BundleStrategy.cjs +0 -20
  20. package/src/bundle/strategies/BundleStrategy.mjs +0 -16
  21. package/src/bundle/strategies/openapi-3-1/index.cjs +0 -35
  22. package/src/bundle/strategies/openapi-3-1/index.mjs +0 -29
  23. package/src/configuration/empty.cjs +0 -9
  24. package/src/configuration/empty.mjs +0 -1
  25. package/src/configuration/saturated.cjs +0 -88
  26. package/src/configuration/saturated.mjs +0 -80
  27. package/src/dereference/index.cjs +0 -90
  28. package/src/dereference/index.mjs +0 -83
  29. package/src/dereference/strategies/DereferenceStrategy.cjs +0 -20
  30. package/src/dereference/strategies/DereferenceStrategy.mjs +0 -16
  31. package/src/dereference/strategies/apidom/index.cjs +0 -89
  32. package/src/dereference/strategies/apidom/index.mjs +0 -83
  33. package/src/dereference/strategies/apidom/selectors/element-id.cjs +0 -47
  34. package/src/dereference/strategies/apidom/selectors/element-id.mjs +0 -41
  35. package/src/dereference/strategies/apidom/visitor.cjs +0 -266
  36. package/src/dereference/strategies/apidom/visitor.mjs +0 -259
  37. package/src/dereference/strategies/arazzo-1/index.cjs +0 -109
  38. package/src/dereference/strategies/arazzo-1/index.mjs +0 -100
  39. package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +0 -12
  40. package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +0 -1
  41. package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +0 -8
  42. package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +0 -1
  43. package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +0 -248
  44. package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +0 -243
  45. package/src/dereference/strategies/arazzo-1/util.cjs +0 -37
  46. package/src/dereference/strategies/arazzo-1/util.mjs +0 -29
  47. package/src/dereference/strategies/arazzo-1/visitor.cjs +0 -507
  48. package/src/dereference/strategies/arazzo-1/visitor.mjs +0 -500
  49. package/src/dereference/strategies/asyncapi-2/index.cjs +0 -94
  50. package/src/dereference/strategies/asyncapi-2/index.mjs +0 -88
  51. package/src/dereference/strategies/asyncapi-2/visitor.cjs +0 -501
  52. package/src/dereference/strategies/asyncapi-2/visitor.mjs +0 -494
  53. package/src/dereference/strategies/openapi-2/index.cjs +0 -96
  54. package/src/dereference/strategies/openapi-2/index.mjs +0 -90
  55. package/src/dereference/strategies/openapi-2/visitor.cjs +0 -629
  56. package/src/dereference/strategies/openapi-2/visitor.mjs +0 -622
  57. package/src/dereference/strategies/openapi-3-0/index.cjs +0 -96
  58. package/src/dereference/strategies/openapi-3-0/index.mjs +0 -90
  59. package/src/dereference/strategies/openapi-3-0/visitor.cjs +0 -621
  60. package/src/dereference/strategies/openapi-3-0/visitor.mjs +0 -614
  61. package/src/dereference/strategies/openapi-3-1/index.cjs +0 -99
  62. package/src/dereference/strategies/openapi-3-1/index.mjs +0 -90
  63. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +0 -67
  64. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +0 -56
  65. package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +0 -50
  66. package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +0 -42
  67. package/src/dereference/strategies/openapi-3-1/util.cjs +0 -68
  68. package/src/dereference/strategies/openapi-3-1/util.mjs +0 -59
  69. package/src/dereference/strategies/openapi-3-1/visitor.cjs +0 -873
  70. package/src/dereference/strategies/openapi-3-1/visitor.mjs +0 -866
  71. package/src/dereference/util.cjs +0 -31
  72. package/src/dereference/util.mjs +0 -27
  73. package/src/errors/BundleError.cjs +0 -10
  74. package/src/errors/BundleError.mjs +0 -7
  75. package/src/errors/DereferenceError.cjs +0 -10
  76. package/src/errors/DereferenceError.mjs +0 -7
  77. package/src/errors/EvaluationElementIdError.cjs +0 -10
  78. package/src/errors/EvaluationElementIdError.mjs +0 -7
  79. package/src/errors/EvaluationJsonSchema$anchorError.cjs +0 -11
  80. package/src/errors/EvaluationJsonSchema$anchorError.mjs +0 -6
  81. package/src/errors/EvaluationJsonSchemaUriError.cjs +0 -11
  82. package/src/errors/EvaluationJsonSchemaUriError.mjs +0 -6
  83. package/src/errors/InvalidJsonSchema$anchorError.cjs +0 -15
  84. package/src/errors/InvalidJsonSchema$anchorError.mjs +0 -10
  85. package/src/errors/JsonSchema$anchorError.cjs +0 -10
  86. package/src/errors/JsonSchema$anchorError.mjs +0 -7
  87. package/src/errors/JsonSchemaUriError.cjs +0 -10
  88. package/src/errors/JsonSchemaUriError.mjs +0 -7
  89. package/src/errors/MaximumBundleDepthError.cjs +0 -11
  90. package/src/errors/MaximumBundleDepthError.mjs +0 -6
  91. package/src/errors/MaximumDereferenceDepthError.cjs +0 -11
  92. package/src/errors/MaximumDereferenceDepthError.mjs +0 -6
  93. package/src/errors/MaximumResolveDepthError.cjs +0 -11
  94. package/src/errors/MaximumResolveDepthError.mjs +0 -6
  95. package/src/errors/ParseError.cjs +0 -10
  96. package/src/errors/ParseError.mjs +0 -7
  97. package/src/errors/ParserError.cjs +0 -11
  98. package/src/errors/ParserError.mjs +0 -6
  99. package/src/errors/PluginError.cjs +0 -18
  100. package/src/errors/PluginError.mjs +0 -15
  101. package/src/errors/ResolveError.cjs +0 -10
  102. package/src/errors/ResolveError.mjs +0 -7
  103. package/src/errors/ResolverError.cjs +0 -11
  104. package/src/errors/ResolverError.mjs +0 -6
  105. package/src/errors/UnmatchedBundleStrategyError.cjs +0 -11
  106. package/src/errors/UnmatchedBundleStrategyError.mjs +0 -6
  107. package/src/errors/UnmatchedDereferenceStrategyError.cjs +0 -11
  108. package/src/errors/UnmatchedDereferenceStrategyError.mjs +0 -6
  109. package/src/errors/UnmatchedParserError.cjs +0 -11
  110. package/src/errors/UnmatchedParserError.mjs +0 -6
  111. package/src/errors/UnmatchedResolveStrategyError.cjs +0 -11
  112. package/src/errors/UnmatchedResolveStrategyError.mjs +0 -6
  113. package/src/errors/UnmatchedResolverError.cjs +0 -11
  114. package/src/errors/UnmatchedResolverError.mjs +0 -6
  115. package/src/errors/UnresolvableReferenceError.cjs +0 -11
  116. package/src/errors/UnresolvableReferenceError.mjs +0 -6
  117. package/src/index.cjs +0 -146
  118. package/src/index.mjs +0 -103
  119. package/src/options/index.cjs +0 -194
  120. package/src/options/index.mjs +0 -191
  121. package/src/options/util.cjs +0 -24
  122. package/src/options/util.mjs +0 -19
  123. package/src/parse/index.cjs +0 -69
  124. package/src/parse/index.mjs +0 -63
  125. package/src/parse/parsers/Parser.cjs +0 -62
  126. package/src/parse/parsers/Parser.mjs +0 -58
  127. package/src/parse/parsers/apidom-json/index.cjs +0 -70
  128. package/src/parse/parsers/apidom-json/index.mjs +0 -64
  129. package/src/parse/parsers/arazzo-json-1/index.cjs +0 -62
  130. package/src/parse/parsers/arazzo-json-1/index.mjs +0 -56
  131. package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +0 -221
  132. package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +0 -214
  133. package/src/parse/parsers/arazzo-yaml-1/index.cjs +0 -62
  134. package/src/parse/parsers/arazzo-yaml-1/index.mjs +0 -56
  135. package/src/parse/parsers/arazzo-yaml-1/source-descriptions.cjs +0 -12
  136. package/src/parse/parsers/arazzo-yaml-1/source-descriptions.mjs +0 -7
  137. package/src/parse/parsers/asyncapi-json-2/index.cjs +0 -54
  138. package/src/parse/parsers/asyncapi-json-2/index.mjs +0 -48
  139. package/src/parse/parsers/asyncapi-yaml-2/index.cjs +0 -54
  140. package/src/parse/parsers/asyncapi-yaml-2/index.mjs +0 -48
  141. package/src/parse/parsers/binary/index-browser.cjs +0 -56
  142. package/src/parse/parsers/binary/index-browser.mjs +0 -50
  143. package/src/parse/parsers/binary/index-node.cjs +0 -51
  144. package/src/parse/parsers/binary/index-node.mjs +0 -45
  145. package/src/parse/parsers/json/index.cjs +0 -53
  146. package/src/parse/parsers/json/index.mjs +0 -47
  147. package/src/parse/parsers/openapi-json-2/index.cjs +0 -54
  148. package/src/parse/parsers/openapi-json-2/index.mjs +0 -48
  149. package/src/parse/parsers/openapi-json-3-0/index.cjs +0 -54
  150. package/src/parse/parsers/openapi-json-3-0/index.mjs +0 -48
  151. package/src/parse/parsers/openapi-json-3-1/index.cjs +0 -54
  152. package/src/parse/parsers/openapi-json-3-1/index.mjs +0 -48
  153. package/src/parse/parsers/openapi-yaml-2/index.cjs +0 -54
  154. package/src/parse/parsers/openapi-yaml-2/index.mjs +0 -48
  155. package/src/parse/parsers/openapi-yaml-3-0/index.cjs +0 -54
  156. package/src/parse/parsers/openapi-yaml-3-0/index.mjs +0 -48
  157. package/src/parse/parsers/openapi-yaml-3-1/index.cjs +0 -54
  158. package/src/parse/parsers/openapi-yaml-3-1/index.mjs +0 -48
  159. package/src/parse/parsers/yaml-1-2/index.cjs +0 -56
  160. package/src/parse/parsers/yaml-1-2/index.mjs +0 -50
  161. package/src/resolve/index.cjs +0 -67
  162. package/src/resolve/index.mjs +0 -60
  163. package/src/resolve/resolvers/HTTPResolver.cjs +0 -45
  164. package/src/resolve/resolvers/HTTPResolver.mjs +0 -37
  165. package/src/resolve/resolvers/Resolver.cjs +0 -20
  166. package/src/resolve/resolvers/Resolver.mjs +0 -16
  167. package/src/resolve/resolvers/file/index-browser.cjs +0 -24
  168. package/src/resolve/resolvers/file/index-browser.mjs +0 -19
  169. package/src/resolve/resolvers/file/index-node.cjs +0 -49
  170. package/src/resolve/resolvers/file/index-node.mjs +0 -42
  171. package/src/resolve/resolvers/http-axios/cache/MemoryCache.cjs +0 -41
  172. package/src/resolve/resolvers/http-axios/cache/MemoryCache.mjs +0 -37
  173. package/src/resolve/resolvers/http-axios/index.cjs +0 -113
  174. package/src/resolve/resolvers/http-axios/index.mjs +0 -105
  175. package/src/resolve/strategies/ResolveStrategy.cjs +0 -20
  176. package/src/resolve/strategies/ResolveStrategy.mjs +0 -16
  177. package/src/resolve/strategies/apidom/index.cjs +0 -49
  178. package/src/resolve/strategies/apidom/index.mjs +0 -43
  179. package/src/resolve/strategies/asyncapi-2/index.cjs +0 -49
  180. package/src/resolve/strategies/asyncapi-2/index.mjs +0 -43
  181. package/src/resolve/strategies/openapi-2/index.cjs +0 -49
  182. package/src/resolve/strategies/openapi-2/index.mjs +0 -43
  183. package/src/resolve/strategies/openapi-3-0/index.cjs +0 -49
  184. package/src/resolve/strategies/openapi-3-0/index.mjs +0 -43
  185. package/src/resolve/strategies/openapi-3-1/index.cjs +0 -49
  186. package/src/resolve/strategies/openapi-3-1/index.mjs +0 -43
  187. package/src/resolve/util.cjs +0 -37
  188. package/src/resolve/util.mjs +0 -30
  189. package/src/util/plugins.cjs +0 -39
  190. package/src/util/plugins.mjs +0 -34
  191. package/src/util/url.cjs +0 -288
  192. package/src/util/url.mjs +0 -274
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-reference",
3
- "version": "3.2.1",
3
+ "version": "4.0.1",
4
4
  "description": "Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -254,29 +254,29 @@
254
254
  "license": "Apache-2.0",
255
255
  "dependencies": {
256
256
  "@babel/runtime-corejs3": "^7.28.4",
257
- "@speclynx/apidom-core": "3.2.1",
258
- "@speclynx/apidom-datamodel": "3.2.1",
259
- "@speclynx/apidom-error": "3.2.1",
260
- "@speclynx/apidom-json-pointer": "3.2.1",
261
- "@speclynx/apidom-ns-arazzo-1": "3.2.1",
262
- "@speclynx/apidom-ns-asyncapi-2": "3.2.1",
263
- "@speclynx/apidom-ns-json-schema-2020-12": "3.2.1",
264
- "@speclynx/apidom-ns-openapi-2": "3.2.1",
265
- "@speclynx/apidom-ns-openapi-3-0": "3.2.1",
266
- "@speclynx/apidom-ns-openapi-3-1": "3.2.1",
267
- "@speclynx/apidom-parser-adapter-arazzo-json-1": "3.2.1",
268
- "@speclynx/apidom-parser-adapter-arazzo-yaml-1": "3.2.1",
269
- "@speclynx/apidom-parser-adapter-asyncapi-json-2": "3.2.1",
270
- "@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "3.2.1",
271
- "@speclynx/apidom-parser-adapter-json": "3.2.1",
272
- "@speclynx/apidom-parser-adapter-openapi-json-2": "3.2.1",
273
- "@speclynx/apidom-parser-adapter-openapi-json-3-0": "3.2.1",
274
- "@speclynx/apidom-parser-adapter-openapi-json-3-1": "3.2.1",
275
- "@speclynx/apidom-parser-adapter-openapi-yaml-2": "3.2.1",
276
- "@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "3.2.1",
277
- "@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "3.2.1",
278
- "@speclynx/apidom-parser-adapter-yaml-1-2": "3.2.1",
279
- "@speclynx/apidom-traverse": "3.2.1",
257
+ "@speclynx/apidom-core": "4.0.1",
258
+ "@speclynx/apidom-datamodel": "4.0.1",
259
+ "@speclynx/apidom-error": "4.0.1",
260
+ "@speclynx/apidom-json-pointer": "4.0.1",
261
+ "@speclynx/apidom-ns-arazzo-1": "4.0.1",
262
+ "@speclynx/apidom-ns-asyncapi-2": "4.0.1",
263
+ "@speclynx/apidom-ns-json-schema-2020-12": "4.0.1",
264
+ "@speclynx/apidom-ns-openapi-2": "4.0.1",
265
+ "@speclynx/apidom-ns-openapi-3-0": "4.0.1",
266
+ "@speclynx/apidom-ns-openapi-3-1": "4.0.1",
267
+ "@speclynx/apidom-parser-adapter-arazzo-json-1": "4.0.1",
268
+ "@speclynx/apidom-parser-adapter-arazzo-yaml-1": "4.0.1",
269
+ "@speclynx/apidom-parser-adapter-asyncapi-json-2": "4.0.1",
270
+ "@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "4.0.1",
271
+ "@speclynx/apidom-parser-adapter-json": "4.0.1",
272
+ "@speclynx/apidom-parser-adapter-openapi-json-2": "4.0.1",
273
+ "@speclynx/apidom-parser-adapter-openapi-json-3-0": "4.0.1",
274
+ "@speclynx/apidom-parser-adapter-openapi-json-3-1": "4.0.1",
275
+ "@speclynx/apidom-parser-adapter-openapi-yaml-2": "4.0.1",
276
+ "@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "4.0.1",
277
+ "@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "4.0.1",
278
+ "@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.1",
279
+ "@speclynx/apidom-traverse": "4.0.1",
280
280
  "@swaggerexpert/arazzo-runtime-expression": "^2.0.3",
281
281
  "axios": "^1.13.5",
282
282
  "picomatch": "^4.0.3",
@@ -298,5 +298,5 @@
298
298
  "README.md",
299
299
  "CHANGELOG.md"
300
300
  ],
301
- "gitHead": "83a1e97089ef29134e41ff7cacd351973114ea5b"
301
+ "gitHead": "223132a9b00081ca04842efc2736a491f7876f44"
302
302
  }
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import Reference from '../../../Reference.ts';
4
4
  import type { ReferenceOptions } from '../../../options/index.ts';
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import Reference from '../../../Reference.ts';
4
4
  import { AncestorLineage } from '../../util.ts';
5
5
  import type { ReferenceOptions } from '../../../options/index.ts';
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import { AncestorLineage } from '../../util.ts';
4
4
  import Reference from '../../../Reference.ts';
5
5
  import type { ReferenceOptions } from '../../../options/index.ts';
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import { AncestorLineage } from '../../util.ts';
4
4
  import Reference from '../../../Reference.ts';
5
5
  import type { ReferenceOptions } from '../../../options/index.ts';
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import Reference from '../../../Reference.ts';
4
4
  import { AncestorLineage } from '../../util.ts';
5
5
  import type { ReferenceOptions } from '../../../options/index.ts';
@@ -1,5 +1,5 @@
1
1
  import { Element } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
2
+ import { type Path } from '@speclynx/apidom-traverse';
3
3
  import Reference from '../../../Reference.ts';
4
4
  import { AncestorLineage } from '../../util.ts';
5
5
  import type { ReferenceOptions } from '../../../options/index.ts';
package/src/File.cjs DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
4
- exports.__esModule = true;
5
- exports.default = void 0;
6
- var _ramda = require("ramda");
7
- var _ramdaAdjunct = require("ramda-adjunct");
8
- var url = _interopRequireWildcard(require("./util/url.cjs"));
9
- /**
10
- * This class represents a File object with url and data.
11
- * @public
12
- */
13
-
14
- /**
15
- * @public
16
- */
17
- class File {
18
- uri;
19
- mediaType;
20
- data;
21
- parseResult;
22
- constructor({
23
- uri,
24
- mediaType = 'text/plain',
25
- data,
26
- parseResult
27
- }) {
28
- this.uri = uri;
29
- this.mediaType = mediaType;
30
- this.data = data;
31
- this.parseResult = parseResult;
32
- }
33
- get extension() {
34
- if ((0, _ramdaAdjunct.isString)(this.uri)) {
35
- return url.getExtension(this.uri);
36
- }
37
- return '';
38
- }
39
- toString() {
40
- if (typeof this.data === 'string') {
41
- return this.data;
42
- }
43
- if (this.data instanceof ArrayBuffer || ['ArrayBuffer'].includes((0, _ramda.type)(this.data)) || ArrayBuffer.isView(this.data)) {
44
- const textDecoder = new TextDecoder('utf-8');
45
- return textDecoder.decode(this.data);
46
- }
47
- return String(this.data);
48
- }
49
- }
50
- var _default = exports.default = File;
package/src/File.mjs DELETED
@@ -1,44 +0,0 @@
1
- import { type } from 'ramda';
2
- import { isString } from 'ramda-adjunct';
3
- import * as url from "./util/url.mjs";
4
- /**
5
- * This class represents a File object with url and data.
6
- * @public
7
- */
8
- /**
9
- * @public
10
- */
11
- class File {
12
- uri;
13
- mediaType;
14
- data;
15
- parseResult;
16
- constructor({
17
- uri,
18
- mediaType = 'text/plain',
19
- data,
20
- parseResult
21
- }) {
22
- this.uri = uri;
23
- this.mediaType = mediaType;
24
- this.data = data;
25
- this.parseResult = parseResult;
26
- }
27
- get extension() {
28
- if (isString(this.uri)) {
29
- return url.getExtension(this.uri);
30
- }
31
- return '';
32
- }
33
- toString() {
34
- if (typeof this.data === 'string') {
35
- return this.data;
36
- }
37
- if (this.data instanceof ArrayBuffer || ['ArrayBuffer'].includes(type(this.data)) || ArrayBuffer.isView(this.data)) {
38
- const textDecoder = new TextDecoder('utf-8');
39
- return textDecoder.decode(this.data);
40
- }
41
- return String(this.data);
42
- }
43
- }
44
- export default File;
package/src/Reference.cjs DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- /**
6
- * @public
7
- */
8
-
9
- /**
10
- * @public
11
- */
12
- class Reference {
13
- uri;
14
- depth;
15
- value;
16
- refSet;
17
- errors;
18
- constructor({
19
- uri,
20
- depth = 0,
21
- refSet,
22
- value
23
- }) {
24
- this.uri = uri;
25
- this.value = value;
26
- this.depth = depth;
27
- this.refSet = refSet;
28
- this.errors = [];
29
- }
30
- }
31
- var _default = exports.default = Reference;
package/src/Reference.mjs DELETED
@@ -1,27 +0,0 @@
1
- /**
2
- * @public
3
- */
4
-
5
- /**
6
- * @public
7
- */
8
- class Reference {
9
- uri;
10
- depth;
11
- value;
12
- refSet;
13
- errors;
14
- constructor({
15
- uri,
16
- depth = 0,
17
- refSet,
18
- value
19
- }) {
20
- this.uri = uri;
21
- this.value = value;
22
- this.depth = depth;
23
- this.refSet = refSet;
24
- this.errors = [];
25
- }
26
- }
27
- export default Reference;
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _ramdaAdjunct = require("ramda-adjunct");
6
- /**
7
- * @public
8
- */
9
-
10
- /**
11
- * @public
12
- */
13
- class ReferenceSet {
14
- rootRef;
15
- refs;
16
- circular;
17
- constructor({
18
- refs = [],
19
- circular = false
20
- } = {}) {
21
- this.refs = [];
22
- this.circular = circular;
23
- refs.forEach(this.add.bind(this));
24
- }
25
- get size() {
26
- return this.refs.length;
27
- }
28
- add(reference) {
29
- if (!this.has(reference)) {
30
- this.refs.push(reference);
31
- this.rootRef = this.rootRef === undefined ? reference : this.rootRef;
32
- reference.refSet = this;
33
- }
34
- return this;
35
- }
36
- merge(anotherRefSet) {
37
- for (const reference of anotherRefSet.values()) {
38
- this.add(reference);
39
- }
40
- return this;
41
- }
42
- has(thing) {
43
- const uri = (0, _ramdaAdjunct.isString)(thing) ? thing : thing.uri;
44
- return (0, _ramdaAdjunct.isNotUndefined)(this.find(ref => ref.uri === uri));
45
- }
46
- find(predicate) {
47
- return this.refs.find(predicate);
48
- }
49
- *values() {
50
- yield* this.refs;
51
- }
52
- clean() {
53
- this.refs.forEach(ref => {
54
- ref.refSet = undefined;
55
- });
56
- this.rootRef = undefined;
57
- this.refs.length = 0;
58
- }
59
- }
60
- var _default = exports.default = ReferenceSet;
@@ -1,57 +0,0 @@
1
- import { isNotUndefined, isString } from 'ramda-adjunct';
2
-
3
- /**
4
- * @public
5
- */
6
-
7
- /**
8
- * @public
9
- */
10
- class ReferenceSet {
11
- rootRef;
12
- refs;
13
- circular;
14
- constructor({
15
- refs = [],
16
- circular = false
17
- } = {}) {
18
- this.refs = [];
19
- this.circular = circular;
20
- refs.forEach(this.add.bind(this));
21
- }
22
- get size() {
23
- return this.refs.length;
24
- }
25
- add(reference) {
26
- if (!this.has(reference)) {
27
- this.refs.push(reference);
28
- this.rootRef = this.rootRef === undefined ? reference : this.rootRef;
29
- reference.refSet = this;
30
- }
31
- return this;
32
- }
33
- merge(anotherRefSet) {
34
- for (const reference of anotherRefSet.values()) {
35
- this.add(reference);
36
- }
37
- return this;
38
- }
39
- has(thing) {
40
- const uri = isString(thing) ? thing : thing.uri;
41
- return isNotUndefined(this.find(ref => ref.uri === uri));
42
- }
43
- find(predicate) {
44
- return this.refs.find(predicate);
45
- }
46
- *values() {
47
- yield* this.refs;
48
- }
49
- clean() {
50
- this.refs.forEach(ref => {
51
- ref.refSet = undefined;
52
- });
53
- this.rootRef = undefined;
54
- this.refs.length = 0;
55
- }
56
- }
57
- export default ReferenceSet;
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
5
- exports.__esModule = true;
6
- exports.default = void 0;
7
- var _ramda = require("ramda");
8
- var _File = _interopRequireDefault(require("../File.cjs"));
9
- var plugins = _interopRequireWildcard(require("../util/plugins.cjs"));
10
- var _UnmatchedBundleStrategyError = _interopRequireDefault(require("../errors/UnmatchedBundleStrategyError.cjs"));
11
- var _BundleError = _interopRequireDefault(require("../errors/BundleError.cjs"));
12
- var _index = _interopRequireDefault(require("../parse/index.cjs"));
13
- var _util = require("../options/util.cjs");
14
- var url = _interopRequireWildcard(require("../util/url.cjs"));
15
- /**
16
- * Bundle a file with all its external references to a compound document.
17
- */
18
- const bundle = async (uri, options) => {
19
- const {
20
- refSet
21
- } = options.bundle;
22
- const sanitizedURI = url.sanitize(uri);
23
- const mergedOptions = (0, _util.merge)(options, {
24
- resolve: {
25
- baseURI: sanitizedURI
26
- }
27
- });
28
- let parseResult;
29
-
30
- // if refSet was provided, use it to avoid unnecessary parsing
31
- if (refSet !== null && refSet.has(sanitizedURI)) {
32
- // @ts-ignore
33
- ({
34
- value: parseResult
35
- } = refSet.find((0, _ramda.propEq)(sanitizedURI, 'uri')));
36
- } else {
37
- parseResult = await (0, _index.default)(uri, mergedOptions);
38
- }
39
- const file = new _File.default({
40
- uri: mergedOptions.resolve.baseURI,
41
- parseResult,
42
- mediaType: mergedOptions.parse.mediaType
43
- });
44
- const bundleStrategies = await plugins.filter('canBundle', [file, mergedOptions], mergedOptions.bundle.strategies);
45
-
46
- // we couldn't find any bundle strategy for this File
47
- if ((0, _ramda.isEmpty)(bundleStrategies)) {
48
- throw new _UnmatchedBundleStrategyError.default(`Could not find a bundle strategy that can bundle the file "${file.uri}"`);
49
- }
50
- try {
51
- const {
52
- result
53
- } = await plugins.run('bundle', [file, mergedOptions], bundleStrategies);
54
- return result;
55
- } catch (error) {
56
- throw new _BundleError.default(`Error while bundling file "${file.uri}"`, {
57
- cause: error
58
- });
59
- }
60
- };
61
- var _default = exports.default = bundle;
@@ -1,55 +0,0 @@
1
- import { isEmpty, propEq } from 'ramda';
2
- import File from "../File.mjs";
3
- import * as plugins from "../util/plugins.mjs";
4
- import UnmatchedBundleStrategyError from "../errors/UnmatchedBundleStrategyError.mjs";
5
- import BundleError from "../errors/BundleError.mjs";
6
- import parse from "../parse/index.mjs";
7
- import { merge as mergeOptions } from "../options/util.mjs";
8
- import * as url from "../util/url.mjs";
9
- /**
10
- * Bundle a file with all its external references to a compound document.
11
- */
12
- const bundle = async (uri, options) => {
13
- const {
14
- refSet
15
- } = options.bundle;
16
- const sanitizedURI = url.sanitize(uri);
17
- const mergedOptions = mergeOptions(options, {
18
- resolve: {
19
- baseURI: sanitizedURI
20
- }
21
- });
22
- let parseResult;
23
-
24
- // if refSet was provided, use it to avoid unnecessary parsing
25
- if (refSet !== null && refSet.has(sanitizedURI)) {
26
- // @ts-ignore
27
- ({
28
- value: parseResult
29
- } = refSet.find(propEq(sanitizedURI, 'uri')));
30
- } else {
31
- parseResult = await parse(uri, mergedOptions);
32
- }
33
- const file = new File({
34
- uri: mergedOptions.resolve.baseURI,
35
- parseResult,
36
- mediaType: mergedOptions.parse.mediaType
37
- });
38
- const bundleStrategies = await plugins.filter('canBundle', [file, mergedOptions], mergedOptions.bundle.strategies);
39
-
40
- // we couldn't find any bundle strategy for this File
41
- if (isEmpty(bundleStrategies)) {
42
- throw new UnmatchedBundleStrategyError(`Could not find a bundle strategy that can bundle the file "${file.uri}"`);
43
- }
44
- try {
45
- const {
46
- result
47
- } = await plugins.run('bundle', [file, mergedOptions], bundleStrategies);
48
- return result;
49
- } catch (error) {
50
- throw new BundleError(`Error while bundling file "${file.uri}"`, {
51
- cause: error
52
- });
53
- }
54
- };
55
- export default bundle;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- /**
6
- * @public
7
- */
8
-
9
- /**
10
- * @public
11
- */
12
- class BundleStrategy {
13
- name;
14
- constructor({
15
- name
16
- }) {
17
- this.name = name;
18
- }
19
- }
20
- var _default = exports.default = BundleStrategy;
@@ -1,16 +0,0 @@
1
- /**
2
- * @public
3
- */
4
-
5
- /**
6
- * @public
7
- */
8
- class BundleStrategy {
9
- name;
10
- constructor({
11
- name
12
- }) {
13
- this.name = name;
14
- }
15
- }
16
- export default BundleStrategy;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
- exports.__esModule = true;
5
- exports.default = void 0;
6
- var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-3-1");
7
- var _BundleStrategy = _interopRequireDefault(require("../BundleStrategy.cjs"));
8
- /**
9
- * @public
10
- */
11
-
12
- /**
13
- * @public
14
- */
15
- class OpenAPI3_1BundleStrategy extends _BundleStrategy.default {
16
- constructor(options) {
17
- super({
18
- ...(options ?? {}),
19
- name: 'openapi-3-1'
20
- });
21
- }
22
- canBundle(file) {
23
- // assert by media type
24
- if (file.mediaType !== 'text/plain') {
25
- return _apidomNsOpenapi.mediaTypes.includes(file.mediaType);
26
- }
27
-
28
- // assert by inspecting ApiDOM
29
- return (0, _apidomNsOpenapi.isOpenApi3_1Element)(file.parseResult?.result);
30
- }
31
- async bundle(file) {
32
- return file.parseResult;
33
- }
34
- }
35
- var _default = exports.default = OpenAPI3_1BundleStrategy;
@@ -1,29 +0,0 @@
1
- import { mediaTypes, isOpenApi3_1Element } from '@speclynx/apidom-ns-openapi-3-1';
2
- import BundleStrategy from "../BundleStrategy.mjs";
3
- /**
4
- * @public
5
- */
6
- /**
7
- * @public
8
- */
9
- class OpenAPI3_1BundleStrategy extends BundleStrategy {
10
- constructor(options) {
11
- super({
12
- ...(options ?? {}),
13
- name: 'openapi-3-1'
14
- });
15
- }
16
- canBundle(file) {
17
- // assert by media type
18
- if (file.mediaType !== 'text/plain') {
19
- return mediaTypes.includes(file.mediaType);
20
- }
21
-
22
- // assert by inspecting ApiDOM
23
- return isOpenApi3_1Element(file.parseResult?.result);
24
- }
25
- async bundle(file) {
26
- return file.parseResult;
27
- }
28
- }
29
- export default OpenAPI3_1BundleStrategy;
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- var _index = require("../index.cjs");
5
- Object.keys(_index).forEach(function (key) {
6
- if (key === "default" || key === "__esModule") return;
7
- if (key in exports && exports[key] === _index[key]) return;
8
- exports[key] = _index[key];
9
- });
@@ -1 +0,0 @@
1
- export * from "../index.mjs";