@speclynx/apidom-reference 2.13.0 → 3.0.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 (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +5 -5
  3. package/dist/apidom-reference.browser.js +577 -337
  4. package/dist/apidom-reference.browser.min.js +1 -1
  5. package/package.json +25 -25
  6. package/src/dereference/strategies/apidom/selectors/element-id.cjs +11 -2
  7. package/src/dereference/strategies/apidom/selectors/element-id.mjs +12 -3
  8. package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +2 -2
  9. package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +3 -3
  10. package/src/dereference/strategies/arazzo-1/visitor.cjs +2 -2
  11. package/src/dereference/strategies/arazzo-1/visitor.mjs +2 -2
  12. package/src/dereference/strategies/asyncapi-2/visitor.cjs +6 -6
  13. package/src/dereference/strategies/asyncapi-2/visitor.mjs +6 -6
  14. package/src/dereference/strategies/openapi-2/visitor.cjs +8 -8
  15. package/src/dereference/strategies/openapi-2/visitor.mjs +8 -8
  16. package/src/dereference/strategies/openapi-3-0/visitor.cjs +6 -6
  17. package/src/dereference/strategies/openapi-3-0/visitor.mjs +6 -6
  18. package/src/dereference/strategies/openapi-3-1/util.cjs +2 -2
  19. package/src/dereference/strategies/openapi-3-1/util.mjs +2 -2
  20. package/src/dereference/strategies/openapi-3-1/visitor.cjs +8 -8
  21. package/src/dereference/strategies/openapi-3-1/visitor.mjs +8 -8
  22. package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +2 -2
  23. package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +3 -3
  24. package/src/resolve/resolvers/http-axios/cache/MemoryCache.cjs +0 -3
  25. package/src/resolve/resolvers/http-axios/cache/MemoryCache.mjs +0 -3
  26. package/types/apidom-reference.d.ts +1 -1
  27. package/types/index.d.ts +1 -1
  28. package/types/resolve/resolvers/http-axios/cache/MemoryCache.d.ts +0 -3
@@ -138,8 +138,8 @@ class OpenAPI3_1DereferenceVisitor {
138
138
 
139
139
  // applying semantics to a fragment
140
140
  if (isPrimitiveElement(referencedElement)) {
141
- const referencedElementType = toValue(referencingElement.meta.get('referenced-element'));
142
- const cacheKey = `${referencedElementType}-${toValue(identityManager.identify(referencedElement))}`;
141
+ const referencedElementType = referencingElement.meta.get('referenced-element');
142
+ const cacheKey = `${referencedElementType}-${identityManager.identify(referencedElement)}`;
143
143
  if (this.refractCache.has(cacheKey)) {
144
144
  referencedElement = this.refractCache.get(cacheKey);
145
145
  } else if (isReferenceLikeElement(referencedElement)) {
@@ -233,7 +233,7 @@ class OpenAPI3_1DereferenceVisitor {
233
233
  // annotate fragment with info about origin
234
234
  mergedElement.meta.set('ref-origin', reference.uri);
235
235
  // annotate fragment with info about referencing element
236
- mergedElement.meta.set('ref-referencing-element-id', cloneDeep(identityManager.identify(referencingElement)));
236
+ mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
237
237
 
238
238
  // override description and summary (outer has higher priority then inner)
239
239
  if (isObjectElement(referencedElement) && isObjectElement(mergedElement)) {
@@ -296,7 +296,7 @@ class OpenAPI3_1DereferenceVisitor {
296
296
  * Applying semantics to a referenced element if semantics are missing.
297
297
  */
298
298
  if (isPrimitiveElement(referencedElement)) {
299
- const cacheKey = `path-item-${toValue(identityManager.identify(referencedElement))}`;
299
+ const cacheKey = `path-item-${identityManager.identify(referencedElement)}`;
300
300
  if (this.refractCache.has(cacheKey)) {
301
301
  referencedElement = this.refractCache.get(cacheKey);
302
302
  } else {
@@ -386,7 +386,7 @@ class OpenAPI3_1DereferenceVisitor {
386
386
  // annotate referenced element with info about origin
387
387
  mergedElement.meta.set('ref-origin', reference.uri);
388
388
  // annotate fragment with info about referencing element
389
- mergedElement.meta.set('ref-referencing-element-id', cloneDeep(identityManager.identify(referencingElement)));
389
+ mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
390
390
  referencedElement = mergedElement;
391
391
  }
392
392
 
@@ -429,7 +429,7 @@ class OpenAPI3_1DereferenceVisitor {
429
429
  operationElement = jsonPointerEvaluate(reference.value.result, jsonPointer);
430
430
  // applying semantics to a referenced element
431
431
  if (isPrimitiveElement(operationElement)) {
432
- const cacheKey = `operation-${toValue(identityManager.identify(operationElement))}`;
432
+ const cacheKey = `operation-${identityManager.identify(operationElement)}`;
433
433
  if (this.refractCache.has(cacheKey)) {
434
434
  operationElement = this.refractCache.get(cacheKey);
435
435
  } else {
@@ -710,7 +710,7 @@ class OpenAPI3_1DereferenceVisitor {
710
710
  // annotate referenced element with info about origin
711
711
  booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
712
712
  // annotate fragment with info about referencing element
713
- booleanJsonSchemaElement.meta.set('ref-referencing-element-id', cloneDeep(identityManager.identify(referencingElement)));
713
+ booleanJsonSchemaElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
714
714
  path.replaceWith(booleanJsonSchemaElement);
715
715
  return;
716
716
  }
@@ -735,7 +735,7 @@ class OpenAPI3_1DereferenceVisitor {
735
735
  // annotate fragment with info about origin
736
736
  mergedElement.meta.set('ref-origin', reference.uri);
737
737
  // annotate fragment with info about referencing element
738
- mergedElement.meta.set('ref-referencing-element-id', cloneDeep(identityManager.identify(referencingElement)));
738
+ mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
739
739
  referencedElement = mergedElement;
740
740
  }
741
741
  /**
@@ -31,8 +31,8 @@ async function parseSourceDescription(sourceDescription, ctx) {
31
31
 
32
32
  // set class and metadata from source description element
33
33
  parseResult.classes.push('source-description');
34
- if ((0, _apidomDatamodel.isStringElement)(sourceDescription.name)) parseResult.setMetaProperty('name', (0, _apidomDatamodel.cloneDeep)(sourceDescription.name));
35
- if ((0, _apidomDatamodel.isStringElement)(sourceDescription.type)) parseResult.setMetaProperty('type', (0, _apidomDatamodel.cloneDeep)(sourceDescription.type));
34
+ if ((0, _apidomDatamodel.isStringElement)(sourceDescription.name)) parseResult.setMetaProperty('name', (0, _apidomCore.toValue)(sourceDescription.name));
35
+ if ((0, _apidomDatamodel.isStringElement)(sourceDescription.type)) parseResult.setMetaProperty('type', (0, _apidomCore.toValue)(sourceDescription.type));
36
36
  const sourceDescriptionURI = (0, _apidomCore.toValue)(sourceDescription.url);
37
37
  if (typeof sourceDescriptionURI !== 'string') {
38
38
  const annotation = new _apidomDatamodel.AnnotationElement('Source description URL is missing or not a string. Skipping');
@@ -1,4 +1,4 @@
1
- import { ParseResultElement, AnnotationElement, isArrayElement, isStringElement, cloneDeep } from '@speclynx/apidom-datamodel';
1
+ import { ParseResultElement, AnnotationElement, isArrayElement, isStringElement } from '@speclynx/apidom-datamodel';
2
2
  import { isArazzoSpecification1Element, isSourceDescriptionElement } from '@speclynx/apidom-ns-arazzo-1';
3
3
  import { isSwaggerElement } from '@speclynx/apidom-ns-openapi-2';
4
4
  import { isOpenApi3_0Element } from '@speclynx/apidom-ns-openapi-3-0';
@@ -24,8 +24,8 @@ async function parseSourceDescription(sourceDescription, ctx) {
24
24
 
25
25
  // set class and metadata from source description element
26
26
  parseResult.classes.push('source-description');
27
- if (isStringElement(sourceDescription.name)) parseResult.setMetaProperty('name', cloneDeep(sourceDescription.name));
28
- if (isStringElement(sourceDescription.type)) parseResult.setMetaProperty('type', cloneDeep(sourceDescription.type));
27
+ if (isStringElement(sourceDescription.name)) parseResult.setMetaProperty('name', toValue(sourceDescription.name));
28
+ if (isStringElement(sourceDescription.type)) parseResult.setMetaProperty('type', toValue(sourceDescription.type));
29
29
  const sourceDescriptionURI = toValue(sourceDescription.url);
30
30
  if (typeof sourceDescriptionURI !== 'string') {
31
31
  const annotation = new AnnotationElement('Source description URL is missing or not a string. Skipping');
@@ -2,9 +2,6 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
- /**
6
- * @public
7
- */
8
5
  class MemoryCache {
9
6
  maxEntries;
10
7
  maxStaleAge;
@@ -1,6 +1,3 @@
1
- /**
2
- * @public
3
- */
4
1
  class MemoryCache {
5
2
  maxEntries;
6
3
  maxStaleAge;
@@ -89,7 +89,7 @@ export declare interface BundleStrategyOptions {
89
89
  /**
90
90
  * @public
91
91
  */
92
- declare interface CacheOptions {
92
+ export declare interface CacheOptions {
93
93
  readonly maxEntries?: number | false;
94
94
  readonly maxStaleAge?: number | false;
95
95
  }
package/types/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { default as Parser } from './parse/parsers/Parser.ts';
7
7
  export type { ParserOptions } from './parse/parsers/Parser.ts';
8
8
  export { default as Resolver } from './resolve/resolvers/Resolver.ts';
9
9
  export { default as HTTPResolver } from './resolve/resolvers/HTTPResolver.ts';
10
- export type { HTTPResolverOptions } from './resolve/resolvers/HTTPResolver.ts';
10
+ export type { HTTPResolverOptions, CacheOptions } from './resolve/resolvers/HTTPResolver.ts';
11
11
  export { default as ResolveStrategy } from './resolve/strategies/ResolveStrategy.ts';
12
12
  export type { ResolverOptions } from './resolve/resolvers/Resolver.ts';
13
13
  export type { ResolveStrategyOptions } from './resolve/strategies/ResolveStrategy.ts';
@@ -3,9 +3,6 @@ interface CacheEntry<T> {
3
3
  value: T;
4
4
  createdAt: number;
5
5
  }
6
- /**
7
- * @public
8
- */
9
6
  declare class MemoryCache<T> {
10
7
  protected maxEntries: number | false;
11
8
  protected maxStaleAge: number | false;