@scalar/workspace-store 0.73.0 → 0.74.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 (81) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +10 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +23 -6
  5. package/dist/entities/auth/schema.d.ts +195 -40
  6. package/dist/entities/auth/schema.d.ts.map +1 -1
  7. package/dist/helpers/async-api-schema-resources/load-inline.d.ts +5 -0
  8. package/dist/helpers/async-api-schema-resources/load-inline.d.ts.map +1 -0
  9. package/dist/helpers/async-api-schema-resources/load-inline.js +71 -0
  10. package/dist/helpers/async-api-schema-resources/protobuf-imports.d.ts +8 -0
  11. package/dist/helpers/async-api-schema-resources/protobuf-imports.d.ts.map +1 -0
  12. package/dist/helpers/async-api-schema-resources/protobuf-imports.js +25 -0
  13. package/dist/helpers/async-api-schema-resources/raml-source.d.ts +12 -0
  14. package/dist/helpers/async-api-schema-resources/raml-source.d.ts.map +1 -0
  15. package/dist/helpers/async-api-schema-resources/raml-source.js +32 -0
  16. package/dist/helpers/async-api-schema-resources/resources.d.ts +10 -0
  17. package/dist/helpers/async-api-schema-resources/resources.d.ts.map +1 -0
  18. package/dist/helpers/async-api-schema-resources/resources.js +124 -0
  19. package/dist/helpers/async-api-schema-resources/schema-resource-path.d.ts +3 -0
  20. package/dist/helpers/async-api-schema-resources/schema-resource-path.d.ts.map +1 -0
  21. package/dist/helpers/async-api-schema-resources/schema-resource-path.js +9 -0
  22. package/dist/helpers/compact-upgrade-metadata.d.ts +3 -0
  23. package/dist/helpers/compact-upgrade-metadata.d.ts.map +1 -0
  24. package/dist/helpers/compact-upgrade-metadata.js +71 -0
  25. package/dist/helpers/is-file-schema.js +1 -1
  26. package/dist/helpers/querystring-parameter.d.ts +3 -1
  27. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  28. package/dist/helpers/querystring-parameter.js +2 -2
  29. package/dist/helpers/resolve-async-api-schema.d.ts +2 -0
  30. package/dist/helpers/resolve-async-api-schema.d.ts.map +1 -1
  31. package/dist/helpers/resolve-async-api-schema.js +23 -1
  32. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  33. package/dist/mutators/operation/parameters.js +9 -1
  34. package/dist/mutators/operation/reset-request-body.d.ts.map +1 -1
  35. package/dist/mutators/operation/reset-request-body.js +3 -1
  36. package/dist/plugins/bundler/async-api-schema-resources.d.ts +4 -0
  37. package/dist/plugins/bundler/async-api-schema-resources.d.ts.map +1 -0
  38. package/dist/plugins/bundler/async-api-schema-resources.js +20 -0
  39. package/dist/plugins/bundler/index.d.ts +1 -1
  40. package/dist/plugins/bundler/index.d.ts.map +1 -1
  41. package/dist/plugins/bundler/index.js +7 -4
  42. package/dist/plugins/bundler/openapi-document.d.ts +5 -1
  43. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  44. package/dist/plugins/bundler/openapi-document.js +7 -3
  45. package/dist/plugins/bundler/upgrade-documents.d.ts +4 -0
  46. package/dist/plugins/bundler/upgrade-documents.d.ts.map +1 -0
  47. package/dist/plugins/bundler/upgrade-documents.js +357 -0
  48. package/dist/request-example/builder/body/build-request-body.d.ts +1 -1
  49. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  50. package/dist/request-example/builder/body/build-request-body.js +2 -2
  51. package/dist/request-example/builder/body/get-request-body-example.d.ts +2 -2
  52. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  53. package/dist/request-example/builder/body/get-request-body-example.js +7 -3
  54. package/dist/request-example/builder/helpers/array-contains.d.ts +15 -0
  55. package/dist/request-example/builder/helpers/array-contains.d.ts.map +1 -0
  56. package/dist/request-example/builder/helpers/array-contains.js +199 -0
  57. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts +6 -0
  58. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  59. package/dist/request-example/builder/helpers/get-example-from-schema.js +30 -2
  60. package/dist/request-example/builder/request-factory.d.ts +3 -1
  61. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  62. package/dist/request-example/builder/request-factory.js +5 -3
  63. package/dist/schemas/reference-config/index.d.ts +39 -8
  64. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  65. package/dist/schemas/reference-config/settings.d.ts +39 -8
  66. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  67. package/dist/schemas/v3.1/strict/openapi-document.d.ts +1365 -280
  68. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  69. package/dist/schemas/v3.1/strict/schema.d.ts +62 -10
  70. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  71. package/dist/schemas/v3.1/strict/schema.js +10 -2
  72. package/dist/schemas/v3.2/openapi/index.d.ts.map +1 -1
  73. package/dist/schemas/v3.2/openapi/index.js +5 -2
  74. package/dist/schemas/v3.2/strict/openapi-document.d.ts +1365 -280
  75. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  76. package/dist/schemas/v3.2/strict/schema.d.ts +62 -10
  77. package/dist/schemas/v3.2/strict/schema.d.ts.map +1 -1
  78. package/dist/schemas/v3.2/strict/schema.js +10 -2
  79. package/dist/server.d.ts.map +1 -1
  80. package/dist/server.js +33 -3
  81. package/package.json +12 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @scalar/workspace-store
2
2
 
3
+ ## 0.74.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#11089](https://github.com/scalar/scalar/pull/11089): Resolve external RAML and Protobuf dependencies for structured AsyncAPI schema documentation, preserving source fallback when dependencies cannot be fully resolved.
8
+
9
+ Show RAML named types in schema headings instead of adding a "RAML type:" line to the description.
10
+
11
+ Show inline object item titles in array type signatures across all `@scalar/blocks` consumers, including OpenAPI documentation: an array with `items: { type: 'object', title: 'Pet' }` now displays `array of Pet` instead of `array of object`.
12
+
13
+ ### Patch Changes
14
+
15
+ - [#11029](https://github.com/scalar/scalar/pull/11029): fix: respect contains match counts in simple array examples
16
+
17
+ Generate matching and nonmatching primitive items for direct contains constraints, counting tuple prefixes and respecting item schemas, length bounds, uniqueness, and the declared dialect. Authored examples remain authoritative. Candidate generation is bounded and may return a partial example for contradictory constraints.
18
+
19
+ Complex references and compositions, nested object or array candidate synthesis, and XML branch reconstruction retain existing best-effort behavior and are deferred to a follow-up.
20
+ - [#11099](https://github.com/scalar/scalar/pull/11099): Update compatible runtime and styling dependencies, align editor dependency versions, and preserve document-change comparisons with updated microdiff semantics.
21
+ - [#11102](https://github.com/scalar/scalar/pull/11102): Update @scalar/typebox to 0.1.4.
22
+ - [#11029](https://github.com/scalar/scalar/pull/11029): Preserve authored array item examples when contains constraints cannot be satisfied, and pass only dialect context to streaming example generation.
23
+ - [#10997](https://github.com/scalar/scalar/pull/10997): Upgrade referenced OpenAPI 2.0 and 3.0 resources before bundling, including bare fragments interpreted in their owning API description's dialect and media types. Preserve authored reference targets when schemas and parameters move, and retain their context through lazy loading, serialization, and export.
24
+
25
+ Add JSON Magic resource and target lifecycle hooks and the typed `upgradeFragment` API. Headerless external resources are traversed through referenced subtrees, including when reached from OpenAPI 3.1/3.2 descriptions. Exports retain compact `x-scalar-upgrade` bookkeeping only when lazy external references still need the original dialect, relocation mappings, or media types.
26
+
27
+ Resources already stored in an input bundle's `x-ext` keep their existing layout so saved references remain valid. Legacy keywords in those stored resources, including OpenAPI 2.0 schema `x-nullable` and `type: file`, deliberately remain unconverted; newly loaded legacy resources are upgraded.
28
+
3
29
  ## 0.73.0
4
30
 
5
31
  ### Minor Changes
package/README.md CHANGED
@@ -605,6 +605,16 @@ await result.applyChanges({ resolvedDocument: newDocument })
605
605
 
606
606
  After `applyChanges` returns, the merged document becomes both the new active document and the new saved baseline, so a subsequent `revertDocumentChanges` rolls back to the post-rebase state rather than the pre-rebase original.
607
607
 
608
+ ## Referenced OpenAPI upgrades
609
+
610
+ The workspace store uses JSON Magic's resource and target lifecycle hooks to
611
+ upgrade newly loaded referenced OpenAPI 2.0 and 3.0 resources. It retains compact
612
+ `x-scalar-upgrade` bookkeeping when lazy external references still need the
613
+ original dialect, relocation mappings, or media types. Editable exports keep
614
+ that bookkeeping only while those external references remain. Resources already
615
+ stored in an input bundle's `x-ext` retain their existing layout and legacy
616
+ keywords, including `x-nullable` and `type: file`, so saved pointers remain valid.
617
+
608
618
  ## OpenAPI document identity
609
619
 
610
620
  The store honors `$self` when resolving relative references in an OpenAPI 3.2 description. Relative identities resolve against the document source URL. External documents keep their own identities, including across partial bundles.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,2BAA2B,CAAA;AAErE,OAAO,EAAE,KAAK,UAAU,EAAe,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAQ7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAI5C,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAMnE,OAAO,EAAE,KAAK,uBAAuB,EAAiC,MAAM,6BAA6B,CAAA;AAWzG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAe5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAErE,OAAO,EACL,KAAK,sBAAsB,EAI5B,MAAM,2BAA2B,CAAA;AAIlC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,qBAAqB,CAAA;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A;IAC5D;;;;;;;;;OASG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C;;;;;;;;;;OAUG;IACH,eAAe,IAAI,iBAAiB,CAAA;IACpC;;;;;;;OAOG;IACH,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC7C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gCAAgC,CAAC,aAAa,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3F;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CACtD;QACE,EAAE,EAAE,KAAK,CAAA;QACT,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,qBAAqB,CAAA;QAChE,OAAO,EAAE,MAAM,CAAA;KAChB,GACD;QACE,EAAE,EAAE,IAAI,CAAA;QACR,OAAO,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;QAC1C,SAAS,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,CAAA;QAChD,YAAY,EAAE,CACZ,iBAAiB,EACb;YACE,iBAAiB,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAA;SACzC,GACD;YACE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAC1C,KACF,OAAO,CAAC,IAAI,CAAC,CAAA;KACnB,CACJ,CAAA;CACF,CAAA;AA2DD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,oBAAqB,cAAc,KAAG,cA+3CtE,CAAA;AAGD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA"}
package/dist/client.js CHANGED
@@ -9,7 +9,6 @@ import { bundle } from '@scalar/json-magic/bundle';
9
9
  import { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser';
10
10
  import { apply, diff, merge } from '@scalar/json-magic/diff';
11
11
  import { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy';
12
- import { upgrade } from '@scalar/openapi-upgrader';
13
12
  import { asyncApiObjectSchema } from '@scalar/schemas/asyncapi/3.1';
14
13
  import { Value } from '@scalar/typebox/value';
15
14
  import { coerce } from '@scalar/validation';
@@ -17,8 +16,10 @@ import { reactive } from 'vue';
17
16
  import YAML from 'yaml';
18
17
  import { createAuthStore } from './entities/auth/index.js';
19
18
  import { createHistoryStore } from './entities/history/index.js';
19
+ import { loadInlineAsyncApiSchemaResources } from './helpers/async-api-schema-resources/load-inline.js';
20
20
  import { asyncApiModelChunkReference } from './helpers/asyncapi-model-chunk-reference.js';
21
21
  import { chunkReference, expandChunkIndex } from './helpers/chunk-index.js';
22
+ import { compactUpgradeMetadata } from './helpers/compact-upgrade-metadata.js';
22
23
  import { deepClone } from './helpers/deep-clone.js';
23
24
  import { createDetectChangesProxy } from './helpers/detect-changes-proxy.js';
24
25
  import { bumpDocumentRevision } from './helpers/document-revision.js';
@@ -34,6 +35,7 @@ import { snapshotRequestBodies } from './helpers/snapshot-request-bodies.js';
34
35
  import { unpackProxyObject } from './helpers/unpack-proxy.js';
35
36
  import { createNavigation, traverseAsyncApiDocument, traversePluginDocument } from './navigation/index.js';
36
37
  import { externalValueResolver, loadingStatus, normalizeAuthSchemes, normalizeRefs, openApiDocument, refsEverywhere, removeExtraScalarKeys, resolveOpenApiDocument, restoreOriginalRefs, syncPathParameters, } from './plugins/bundler/index.js';
38
+ import { asyncApiSchemaResources } from './plugins/bundler/async-api-schema-resources.js';
37
39
  import { codeSampleSources } from './plugins/bundler/code-sample-sources.js';
38
40
  import { extensions } from './schemas/extensions.js';
39
41
  import { PLUGIN_DOCUMENT_TYPE_KEY, findDocumentType, } from './schemas/plugin-document.js';
@@ -41,6 +43,7 @@ import { isAsyncApiDocument, isOpenApiDocument } from './schemas/type-guards.js'
41
43
  import { generateSchema } from './schemas/v3.2/openapi/index.js';
42
44
  import { recursiveRef } from './schemas/v3.2/openapi/reference.js';
43
45
  import { OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict, } from './schemas/v3.2/strict/openapi-document.js';
46
+ import { upgradeDocuments } from './plugins/bundler/upgrade-documents.js';
44
47
  /**
45
48
  * Maximum number of external references and example `externalValue`s fetched at once while bundling
46
49
  * a document. Keeps large documents (which can reference thousands of external examples) from opening
@@ -143,6 +146,7 @@ const METADATA_ONLY_DOCUMENT_KEYS = new Set([
143
146
  */
144
147
  const purgeInternalDocumentKeys = (input) => {
145
148
  const result = deepClone(input);
149
+ compactUpgradeMetadata(result);
146
150
  // Top level keys that need to be excluded from the original document
147
151
  // Nested keys are removed during the previous step of the bundler process
148
152
  const EXCLUDE_KEYS = [
@@ -593,6 +597,10 @@ export const createWorkspaceStore = (workspaceProps) => {
593
597
  if (isAsyncApiDocument(clonedRawInputDocument)) {
594
598
  // Capture the original version before the upgrader bumps `asyncapi` to the latest.
595
599
  const originalAasVersion = clonedRawInputDocument.asyncapi;
600
+ if (originalAasVersion.startsWith('2.')) {
601
+ // Preserve the 2.x message-level schema format before upgrading its channel structure.
602
+ await loadInlineAsyncApiSchemaResources(createMagicProxy(clonedRawInputDocument), input.documentSource ?? '/', loaders);
603
+ }
596
604
  // The upgrader is typed against the loose `UnknownObject` shape; the result is a valid
597
605
  // 3.x AsyncAPI document, so cast it back so the spread below still satisfies `AsyncApiDocument`.
598
606
  const upgradedAsyncApiDocument = withMeasurementSync('upgrade', () => upgradeAsyncApi(deepClone(clonedRawInputDocument)));
@@ -607,7 +615,7 @@ export const createWorkspaceStore = (workspaceProps) => {
607
615
  await withMeasurementAsync('bundle', async () => await bundle(getRaw(asyncApiDocument), {
608
616
  traversal: 'document',
609
617
  treeShake: false,
610
- plugins: loaders,
618
+ plugins: [asyncApiSchemaResources(), ...loaders],
611
619
  urlMap: true,
612
620
  origin: input.documentSource,
613
621
  }));
@@ -624,13 +632,15 @@ export const createWorkspaceStore = (workspaceProps) => {
624
632
  : asyncApiDocument;
625
633
  return true;
626
634
  }
627
- const inputDocument = withMeasurementSync('upgrade', () => upgrade(deepClone(clonedRawInputDocument), '3.1'));
635
+ const inputDocument = deepClone(clonedRawInputDocument);
628
636
  const strictDocument = createMagicProxy({
629
637
  ...inputDocument,
630
638
  // Partial API descriptions still need document traversal rather than standalone schema traversal.
631
639
  openapi: inputDocument.openapi ?? '',
632
640
  ...meta,
633
- 'x-original-oas-version': clonedRawInputDocument.openapi ?? clonedRawInputDocument.swagger,
641
+ 'x-original-oas-version': clonedRawInputDocument['x-original-oas-version'] ??
642
+ clonedRawInputDocument.openapi ??
643
+ clonedRawInputDocument.swagger,
634
644
  'x-scalar-original-document-hash': input.documentHash,
635
645
  'x-scalar-original-source-url': input.documentSource,
636
646
  }, { showInternal: true, documentUri: resolveOpenApiDocument(inputDocument, input.documentSource ?? '/')?.baseUri });
@@ -645,6 +655,7 @@ export const createWorkspaceStore = (workspaceProps) => {
645
655
  plugins: [
646
656
  ...loaders,
647
657
  codeSampleSources(),
658
+ upgradeDocuments(clonedRawInputDocument.openapi ?? clonedRawInputDocument.swagger),
648
659
  openApiDocument(),
649
660
  normalizeRefs(),
650
661
  externalValueResolver({ lazy: true }),
@@ -774,6 +785,7 @@ export const createWorkspaceStore = (workspaceProps) => {
774
785
  const authoredDocument = deepClone(rawDocument);
775
786
  restoreSecurityRequirements(authoredDocument);
776
787
  const original = (await bundle(authoredDocument, {
788
+ traversal: isAsyncApiDocument(authoredDocument) ? 'document' : undefined,
777
789
  plugins: [openApiDocument(), restoreOriginalRefs(), removeExtraScalarKeys()],
778
790
  treeShake: false,
779
791
  urlMap: true,
@@ -1031,12 +1043,17 @@ export const createWorkspaceStore = (workspaceProps) => {
1031
1043
  visitedNodesCaches.set(activeDocument, visitedNodes);
1032
1044
  }
1033
1045
  return bundle(target, {
1034
- root: activeDocument,
1046
+ inputPath: path,
1035
1047
  traversal: 'document',
1048
+ root: activeDocument,
1036
1049
  origin: activeDocument?.['x-scalar-original-source-url'],
1037
1050
  treeShake: false,
1038
1051
  plugins: [
1039
- codeSampleSources(path),
1052
+ ...(activeDocument && isOpenApiDocument(activeDocument)
1053
+ ? [upgradeDocuments(activeDocument['x-original-oas-version'])]
1054
+ : []),
1055
+ codeSampleSources(),
1056
+ asyncApiSchemaResources(),
1040
1057
  openApiDocument(),
1041
1058
  fetchUrls({
1042
1059
  fetch: extraDocumentConfigurations[getActiveDocumentName()]?.fetch ?? workspaceProps?.fetch,