@scalar/workspace-store 0.68.2 → 0.68.3

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 (149) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/channel-example/get-async-api-protocols.d.ts +3 -1
  3. package/dist/channel-example/get-async-api-protocols.d.ts.map +1 -1
  4. package/dist/channel-example/get-async-api-protocols.js +6 -2
  5. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +14 -2
  6. package/dist/channel-example/get-asyncapi-security-requirements.d.ts.map +1 -1
  7. package/dist/channel-example/get-asyncapi-security-requirements.js +89 -32
  8. package/dist/channel-example/get-channel-connection-context.d.ts.map +1 -1
  9. package/dist/channel-example/get-channel-connection-context.js +3 -4
  10. package/dist/channel-example/get-channel-connection-security.d.ts +3 -2
  11. package/dist/channel-example/get-channel-connection-security.d.ts.map +1 -1
  12. package/dist/channel-example/get-channel-connection-security.js +4 -6
  13. package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
  14. package/dist/channel-example/get-channel-operations.js +2 -1
  15. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
  16. package/dist/channel-example/get-channel-parameters.js +2 -1
  17. package/dist/channel-example/index.d.ts +2 -2
  18. package/dist/channel-example/index.d.ts.map +1 -1
  19. package/dist/channel-example/index.js +2 -2
  20. package/dist/channel-example/resolve-channel.d.ts.map +1 -1
  21. package/dist/channel-example/resolve-channel.js +2 -1
  22. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
  23. package/dist/channel-example/resolve-operation-channel.js +4 -2
  24. package/dist/channel-example/resolve-operation-with-traits.d.ts +1 -3
  25. package/dist/channel-example/resolve-operation-with-traits.d.ts.map +1 -1
  26. package/dist/channel-example/resolve-operation-with-traits.js +3 -41
  27. package/dist/channel-example/servers.d.ts.map +1 -1
  28. package/dist/channel-example/servers.js +2 -1
  29. package/dist/client.d.ts.map +1 -1
  30. package/dist/client.js +8 -4
  31. package/dist/entities/auth/schema.d.ts +5 -0
  32. package/dist/entities/auth/schema.d.ts.map +1 -1
  33. package/dist/events/definitions/operation.d.ts +7 -0
  34. package/dist/events/definitions/operation.d.ts.map +1 -1
  35. package/dist/helpers/asyncapi-chunk-groups.d.ts.map +1 -1
  36. package/dist/helpers/asyncapi-chunk-groups.js +8 -4
  37. package/dist/helpers/asyncapi-model-chunk-reference.d.ts.map +1 -1
  38. package/dist/helpers/asyncapi-model-chunk-reference.js +2 -1
  39. package/dist/helpers/auth-secret-fields.d.ts +11 -0
  40. package/dist/helpers/auth-secret-fields.d.ts.map +1 -1
  41. package/dist/helpers/auth-secret-fields.js +22 -0
  42. package/dist/helpers/encode-path-parameter.d.ts.map +1 -1
  43. package/dist/helpers/encode-path-parameter.js +11 -12
  44. package/dist/helpers/external-examples.d.ts.map +1 -1
  45. package/dist/helpers/external-examples.js +6 -3
  46. package/dist/helpers/get-boolean-schema.d.ts +7 -0
  47. package/dist/helpers/get-boolean-schema.d.ts.map +1 -0
  48. package/dist/helpers/get-boolean-schema.js +5 -0
  49. package/dist/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  50. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -1
  51. package/dist/helpers/normalize-boolean-schemas.js +6 -1
  52. package/dist/helpers/operation-examples.d.ts.map +1 -1
  53. package/dist/helpers/operation-examples.js +2 -1
  54. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  55. package/dist/helpers/querystring-parameter.js +6 -6
  56. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -1
  57. package/dist/helpers/resolve-security-requirements.js +38 -19
  58. package/dist/helpers/resolve-traits.d.ts +3 -0
  59. package/dist/helpers/resolve-traits.d.ts.map +1 -0
  60. package/dist/helpers/resolve-traits.js +68 -0
  61. package/dist/helpers/serialize-stream-example.js +1 -1
  62. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  63. package/dist/helpers/use-external-examples.js +10 -5
  64. package/dist/mutators/auth.d.ts.map +1 -1
  65. package/dist/mutators/auth.js +2 -1
  66. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  67. package/dist/mutators/operation/helpers/har-to-operation.js +4 -2
  68. package/dist/mutators/operation/operation.d.ts.map +1 -1
  69. package/dist/mutators/operation/operation.js +4 -2
  70. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  71. package/dist/mutators/operation/parameters.js +23 -1
  72. package/dist/mutators/tag.d.ts.map +1 -1
  73. package/dist/mutators/tag.js +4 -2
  74. package/dist/navigation/get-navigation-options.js +6 -5
  75. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  76. package/dist/navigation/helpers/traverse-asyncapi-document.js +27 -20
  77. package/dist/navigation/helpers/traverse-paths.js +1 -1
  78. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  79. package/dist/navigation/helpers/traverse-schemas.js +2 -1
  80. package/dist/plugins/bundler/index.d.ts.map +1 -1
  81. package/dist/plugins/bundler/index.js +2 -1
  82. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  83. package/dist/plugins/bundler/openapi-document.js +2 -1
  84. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -1
  85. package/dist/request-example/builder/body/build-multipart.js +18 -16
  86. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  87. package/dist/request-example/builder/body/encode-multipart-body.js +2 -1
  88. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  89. package/dist/request-example/builder/body/get-request-body-example.js +2 -1
  90. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  91. package/dist/request-example/builder/body/schema-value-coercion.js +4 -1
  92. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  93. package/dist/request-example/builder/header/build-request-parameters.js +12 -2
  94. package/dist/request-example/builder/header/filter-disabled-properties.d.ts +3 -0
  95. package/dist/request-example/builder/header/filter-disabled-properties.d.ts.map +1 -0
  96. package/dist/request-example/builder/header/filter-disabled-properties.js +18 -0
  97. package/dist/request-example/builder/header/filter-global-cookies.d.ts +1 -1
  98. package/dist/request-example/builder/header/filter-global-cookies.d.ts.map +1 -1
  99. package/dist/request-example/builder/header/filter-global-cookies.js +15 -3
  100. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  101. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  102. package/dist/request-example/builder/header/is-param-disabled.js +3 -2
  103. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  104. package/dist/request-example/builder/helpers/get-example-from-schema.js +20 -16
  105. package/dist/request-example/builder/helpers/get-example.d.ts +2 -0
  106. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  107. package/dist/request-example/builder/helpers/get-example.js +15 -5
  108. package/dist/request-example/builder/index.d.ts +1 -0
  109. package/dist/request-example/builder/index.d.ts.map +1 -1
  110. package/dist/request-example/builder/index.js +1 -0
  111. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  112. package/dist/request-example/builder/resolve-request-factory-url.js +9 -8
  113. package/dist/request-example/builder/security/secret-types.d.ts +13 -3
  114. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  115. package/dist/request-example/context/headers.js +1 -1
  116. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  117. package/dist/request-example/context/security/extract-security-scheme-secrets.js +63 -25
  118. package/dist/request-example/context/security/get-selected-security.js +1 -1
  119. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  120. package/dist/request-example/context/security/merge-security.js +2 -1
  121. package/dist/request-example/index.d.ts +1 -1
  122. package/dist/request-example/index.d.ts.map +1 -1
  123. package/dist/request-example/index.js +1 -1
  124. package/dist/request-example/xml/get-xml-example.js +2 -1
  125. package/dist/request-example/xml/write-xml.d.ts.map +1 -1
  126. package/dist/request-example/xml/write-xml.js +6 -5
  127. package/dist/resolve.d.ts +1 -1
  128. package/dist/resolve.d.ts.map +1 -1
  129. package/dist/resolve.js +16 -1
  130. package/dist/schemas/extensions/example/x-disabled.d.ts +4 -0
  131. package/dist/schemas/extensions/example/x-disabled.d.ts.map +1 -1
  132. package/dist/schemas/extensions/example/x-disabled.js +3 -1
  133. package/dist/schemas/navigation.d.ts +1 -1
  134. package/dist/schemas/navigation.d.ts.map +1 -1
  135. package/dist/schemas/reference-config/index.d.ts +1 -0
  136. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  137. package/dist/schemas/reference-config/settings.d.ts +1 -0
  138. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  139. package/dist/schemas/v3.1/strict/example.d.ts +3 -0
  140. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  141. package/dist/schemas/v3.1/strict/openapi-document.d.ts +36 -6
  142. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  143. package/dist/schemas/v3.2/strict/example.d.ts +3 -0
  144. package/dist/schemas/v3.2/strict/example.d.ts.map +1 -1
  145. package/dist/schemas/v3.2/strict/openapi-document.d.ts +36 -6
  146. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  147. package/dist/server.d.ts.map +1 -1
  148. package/dist/server.js +4 -2
  149. package/package.json +9 -9
@@ -1,3 +1,4 @@
1
+ import { isObject } from '@scalar/helpers/object/is-object';
1
2
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
2
3
  import { isHidden } from '../../helpers/is-hidden.js';
3
4
  import { getNavigationTagNames } from '../../navigation/helpers/get-navigation-tag-names.js';
@@ -15,7 +16,7 @@ const createSchemaEntry = ({ ref, name, generateId, parentTag, _schema, parentId
15
16
  const schema = getResolvedRef(_schema);
16
17
  // Use schema.title if available, otherwise fall back to name
17
18
  // @see https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.5
18
- const title = (schema && 'title' in schema && schema.title) || name;
19
+ const title = (isObject(schema) && 'title' in schema && schema.title) || name;
19
20
  const entry = {
20
21
  id,
21
22
  title,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAStF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAO,eAahC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,eA2CpE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,QAAO,eAwCjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,QAAO,eA6BtC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,QAAO,eAuBvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAO,eAyBhC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAO,eAmFrC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAaxC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAStF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAO,eAahC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,eA6CpE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,QAAO,eAwCjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,QAAO,eA6BtC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,QAAO,eAuBvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAO,eAyBhC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAO,eAmFrC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAaxC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -57,8 +57,9 @@ export const externalValueResolver = (options) => {
57
57
  const resolvedValue = resolveReferencePath(context.origin, externalValue);
58
58
  if (options?.lazy) {
59
59
  const path = context.path.at(-2) === 'examples' ? context.path : (context.referencedFromPath ?? context.path);
60
- if (path.at(-2) !== 'examples' || isSchemaPath(path))
60
+ if (path.at(-2) !== 'examples' || isSchemaPath(path)) {
61
61
  return;
62
+ }
62
63
  // Preserve the referenced document origin before bundling loses that context.
63
64
  node['externalValue'] = resolvedValue;
64
65
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"openapi-document.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/openapi-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAE7G,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,gBAcpC,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,eAAe,QAAO,eAsClC,CAAA"}
1
+ {"version":3,"file":"openapi-document.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/openapi-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAE7G,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,gBAcpC,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,eAAe,QAAO,eAwClC,CAAA"}
@@ -19,8 +19,9 @@ export const openApiDocument = () => {
19
19
  const authoredRefs = new WeakMap();
20
20
  const paths = new WeakMap();
21
21
  const indexPaths = (value, path) => {
22
- if (value === null || typeof value !== 'object' || paths.has(value))
22
+ if (value === null || typeof value !== 'object' || paths.has(value)) {
23
23
  return;
24
+ }
24
25
  paths.set(value, path);
25
26
  for (const [key, child] of Object.entries(value)) {
26
27
  indexPaths(child, [...path, key]);
@@ -1 +1 @@
1
- {"version":3,"file":"build-multipart.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-multipart.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAQrE,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,GAAG,CACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CACrE,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASnF,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASpF,CAAA;AA4CD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,YAAY,GAAG,SAAS,EAChC,OAAO,MAAM,EACb,aAAa,eAAe,CAAC,YAAY,CAAC,KACzC,YAAY,GAAG,SAMa,CAAA;AAc/B,6FAA6F;AAC7F,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,aAAa,MAAM,EACnB,WAAU,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,CAAM,EACnG,SAAS,YAAY,EACrB,gBAAW,KACV,aAAa,EAkIf,CAAA"}
1
+ {"version":3,"file":"build-multipart.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-multipart.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAQrE,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,GAAG,CACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CACrE,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASnF,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASpF,CAAA;AA4CD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,YAAY,GAAG,SAAS,EAChC,OAAO,MAAM,EACb,aAAa,eAAe,CAAC,YAAY,CAAC,KACzC,YAAY,GAAG,SAMa,CAAA;AAc/B,6FAA6F;AAC7F,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,aAAa,MAAM,EACnB,WAAU,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,CAAM,EACnG,SAAS,YAAY,EACrB,gBAAW,KACV,aAAa,EAmIf,CAAA"}
@@ -83,8 +83,9 @@ export const buildMultipart = (value, contentType, encoding = {}, schema, nestin
83
83
  }
84
84
  const named = parseMimeType(contentType).essence === 'multipart/form-data';
85
85
  const positional = Array.isArray(value);
86
- const entries = positional
87
- ? value.map((item, index) => {
86
+ let entries = [];
87
+ if (positional) {
88
+ entries = value.map((item, index) => {
88
89
  const itemEncoding = index < (encoding.prefixEncoding?.length ?? 0) ? encoding.prefixEncoding?.[index] : encoding.itemEncoding;
89
90
  const itemSchema = getMultipartItemSchema(schema, index, encoding.itemSchema);
90
91
  if (named && item !== null && typeof item === 'object' && !Array.isArray(item)) {
@@ -97,20 +98,21 @@ export const buildMultipart = (value, contentType, encoding = {}, schema, nestin
97
98
  return [entry[0], entry[1], itemEncoding, resolveLeafSchema(itemSchema, [entry[0]])];
98
99
  }
99
100
  return [undefined, item, itemEncoding, itemSchema];
100
- })
101
- : value !== null && typeof value === 'object'
102
- ? Object.entries(value).flatMap(([key, item]) => {
103
- const propertySchema = resolveLeafSchema(schema, [key]);
104
- return (Array.isArray(item) ? item : [item]).map((part) => [
105
- key,
106
- part,
107
- encoding.encoding?.[key],
108
- Array.isArray(item)
109
- ? getResolvedRef(propertySchema && isArraySchema(propertySchema) ? propertySchema.items : undefined, mergeSiblingReferences)
110
- : propertySchema,
111
- ]);
112
- })
113
- : [];
101
+ });
102
+ }
103
+ else if (value !== null && typeof value === 'object') {
104
+ entries = Object.entries(value).flatMap(([key, item]) => {
105
+ const propertySchema = resolveLeafSchema(schema, [key]);
106
+ return (Array.isArray(item) ? item : [item]).map((part) => [
107
+ key,
108
+ part,
109
+ encoding.encoding?.[key],
110
+ Array.isArray(item)
111
+ ? getResolvedRef(propertySchema && isArraySchema(propertySchema) ? propertySchema.items : undefined, mergeSiblingReferences)
112
+ : propertySchema,
113
+ ]);
114
+ });
115
+ }
114
116
  return entries.flatMap(([key, item, partEncoding, partSchema]) => {
115
117
  const style = named && hasEncodingStyle(partEncoding);
116
118
  const styleParts = style ? serializeFormPropertyWithEncoding(key ?? '', item, partEncoding) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"encode-multipart-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/encode-multipart-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AA0BtD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAS,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyB,EACrD,gBAAW,KACV;IAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CA6C3C,CAAA;AAED,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,GAC9B,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAClC,IAGF,CAAA"}
1
+ {"version":3,"file":"encode-multipart-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/encode-multipart-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AA0BtD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAS,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyB,EACrD,gBAAW,KACV;IAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CA8C3C,CAAA;AAED,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,GAC9B,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAClC,IAGF,CAAA"}
@@ -33,7 +33,8 @@ export const serializeMultipartBody = (parts, contentType = 'multipart/form-data
33
33
  const encoded = part.type === 'multipart'
34
34
  ? serializeMultipartBody(part.value, part.contentType, replace, nesting + 1)
35
35
  : { chunks: [part.type === 'text' ? replace(part.value) : part.value], contentType: part.contentType };
36
- const filename = part.type === 'file' ? part.value.name : part.type === 'blob' ? 'blob' : undefined;
36
+ const blobFilename = part.type === 'blob' ? 'blob' : undefined;
37
+ const filename = part.type === 'file' ? part.value.name : blobFilename;
37
38
  const partContentType = encoded.contentType ??
38
39
  (part.type === 'file' || part.type === 'blob' ? part.value.type || 'application/octet-stream' : undefined);
39
40
  if (partContentType && /[\r\n\0]/.test(partContentType)) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-request-body-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/get-request-body-example.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AASrE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACnC,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,OAgCF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,aAAa,GAAG,IA0ClB,CAAA"}
1
+ {"version":3,"file":"get-request-body-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/get-request-body-example.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AASrE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACnC,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,OAgCF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,aAAa,GAAG,IA4ClB,CAAA"}
@@ -58,8 +58,9 @@ export const getExampleFromBody = (requestBody, contentType, exampleName, reques
58
58
  compositionSelection: requestBodyCompositionSelection,
59
59
  schemaPath: ['requestBody'],
60
60
  });
61
- if (result.xml === undefined)
61
+ if (result.xml === undefined) {
62
62
  return null;
63
+ }
63
64
  // Consumers select dataValue before value, so retain the serialized result for editor and wire output.
64
65
  return example?.dataValue !== undefined
65
66
  ? { ...example, value: result.xml, serializedValue: result.xml }
@@ -1 +1 @@
1
- {"version":3,"file":"schema-value-coercion.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/schema-value-coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAShG;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,UAAU,MAAM,EAAE,KAAG,YAAY,GAAG,SASvG,CAAA;AA2BD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,EAAE,QAAQ,YAAY,GAAG,SAAS,KAAG,OAe9F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,OAUnD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,OAAO,aAG1C,MAAM,UAAU,OAAO,YAgBzC,CAAA"}
1
+ {"version":3,"file":"schema-value-coercion.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/schema-value-coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAYhG;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,UAAU,MAAM,EAAE,KAAG,YAAY,GAAG,SASvG,CAAA;AA2BD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,EAAE,QAAQ,YAAY,GAAG,SAAS,KAAG,OAe9F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,OAUnD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,OAAO,aAG1C,MAAM,UAAU,OAAO,YAgBzC,CAAA"}
@@ -3,7 +3,10 @@ import { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type
3
3
  /** Normalize a schema's `type` (string | string[] | absent) into a plain string array. */
4
4
  const normalizeSchemaTypes = (schema) => {
5
5
  const type = 'type' in schema ? schema.type : undefined;
6
- return Array.isArray(type) ? [...type] : type == null ? [] : [type];
6
+ if (Array.isArray(type)) {
7
+ return [...type];
8
+ }
9
+ return type == null ? [] : [type];
7
10
  };
8
11
  /**
9
12
  * Walk an object schema along a dotted-row path and return the resolved leaf schema,
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAElH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAoB5E;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB;AAC/B,6DAA6D;AAC7D,iBAAiB,MAAM,KACtB;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IAC9D,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CA+JvC,CAAA"}
1
+ {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAElH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAqB5E;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB;AAC/B,6DAA6D;AAC7D,iBAAiB,MAAM,KACtB;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IAC9D,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAyKvC,CAAA"}
@@ -6,6 +6,7 @@ import { xScalarCookieSchema, } from '@scalar/workspace-store/schemas/extensions
6
6
  import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
7
7
  import { getParameterExample } from '../../../helpers/get-parameter-example.js';
8
8
  import { deSerializeParameter } from '../../../request-example/builder/header/de-serialize-parameter.js';
9
+ import { filterDisabledProperties } from './filter-disabled-properties.js';
9
10
  import { isParamDisabled } from './is-param-disabled.js';
10
11
  import { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './serialize-parameter.js';
11
12
  /** Helper to get explode value with default */
@@ -47,7 +48,10 @@ openapiVersion) => {
47
48
  const selected = getParameterExample(param, exampleName);
48
49
  const { example, value } = selected;
49
50
  // Skip disabled examples
50
- if (!example || isParamDisabled(param, example)) {
51
+ const propertyStates = param.in === 'query' && !selected.serialized && !selected.mediaSerialized
52
+ ? example?.['x-scalar-disabled-properties']
53
+ : undefined;
54
+ if (!example || (!propertyStates && isParamDisabled(param, example))) {
51
55
  continue;
52
56
  }
53
57
  /** Parameter-level wire text already contains its name, delimiters, and encoding. */
@@ -94,7 +98,13 @@ openapiVersion) => {
94
98
  continue;
95
99
  }
96
100
  /** De-serialize the example value if it is a string and matches the schema type */
97
- const deSerializedValue = deSerializeParameter(value, param);
101
+ const fullValue = deSerializeParameter(value, param);
102
+ const deSerializedValue = propertyStates
103
+ ? filterDisabledProperties(fullValue, propertyStates, isParamDisabled(param, example))
104
+ : fullValue;
105
+ if (propertyStates && deSerializedValue === undefined) {
106
+ continue;
107
+ }
98
108
  const paramName = param.name;
99
109
  // Handle by parameter location
100
110
  switch (param.in) {
@@ -0,0 +1,3 @@
1
+ /** Build the enabled portion of a query object without discarding stored disabled values. */
2
+ export declare const filterDisabledProperties: (value: unknown, states: Record<string, boolean>, inheritedDisabled: boolean, path?: string[]) => unknown;
3
+ //# sourceMappingURL=filter-disabled-properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-disabled-properties.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-disabled-properties.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,eAAO,MAAM,wBAAwB,GACnC,OAAO,OAAO,EACd,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,mBAAmB,OAAO,EAC1B,OAAM,MAAM,EAAO,KAClB,OAgBF,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { isObject } from '@scalar/helpers/object/is-object';
2
+ /** Build the enabled portion of a query object without discarding stored disabled values. */
3
+ export const filterDisabledProperties = (value, states, inheritedDisabled, path = []) => {
4
+ const disabled = states[JSON.stringify(path)] ?? inheritedDisabled;
5
+ if (!isObject(value) || Array.isArray(value)) {
6
+ return disabled ? undefined : value;
7
+ }
8
+ const entries = Object.entries(value);
9
+ const enabled = entries.flatMap(([key, child]) => {
10
+ const filtered = filterDisabledProperties(child, states, disabled, [...path, key]);
11
+ return filtered === undefined ? [] : [[key, filtered]];
12
+ });
13
+ // Do not serialize parents whose children were all excluded.
14
+ if (enabled.length === 0 && (disabled || entries.length > 0)) {
15
+ return undefined;
16
+ }
17
+ return Object.fromEntries(enabled);
18
+ };
@@ -3,7 +3,7 @@ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/g
3
3
  * Filter a global cookie to determine if it should be included with a request to the given URL.
4
4
  * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
5
5
  * - Returns false if the domain does not match.
6
- * - Returns false if the path is specified and does not match the URL pathname.
6
+ * - Returns false if the path is specified and the request pathname does not path-match it.
7
7
  * - Returns true otherwise.
8
8
  */
9
9
  export declare const filterGlobalCookie: ({ cookie, url, disabledGlobalCookies, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAIxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAqBH,CAAA"}
1
+ {"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAiBxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAsBH,CAAA"}
@@ -1,9 +1,20 @@
1
1
  import { matchesDomain } from './matches-domain.js';
2
+ /**
3
+ * RFC 6265 path-match: cookie-path C matches request-path R when they are the same,
4
+ * or C is a prefix of R and the next character is a slash. A trailing slash on C
5
+ * already supplies that boundary, so `/api` matches `/api/users` but not `/apiv2`.
6
+ */
7
+ const pathMatches = (requestPath, cookiePath) => {
8
+ if (requestPath === cookiePath || cookiePath.endsWith('/')) {
9
+ return requestPath.startsWith(cookiePath);
10
+ }
11
+ return requestPath.startsWith(`${cookiePath}/`);
12
+ };
2
13
  /**
3
14
  * Filter a global cookie to determine if it should be included with a request to the given URL.
4
15
  * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
5
16
  * - Returns false if the domain does not match.
6
- * - Returns false if the path is specified and does not match the URL pathname.
17
+ * - Returns false if the path is specified and the request pathname does not path-match it.
7
18
  * - Returns true otherwise.
8
19
  */
9
20
  export const filterGlobalCookie = ({ cookie, url, disabledGlobalCookies, }) => {
@@ -17,8 +28,9 @@ export const filterGlobalCookie = ({ cookie, url, disabledGlobalCookies, }) => {
17
28
  if (cookie.domain && !matchesDomain(url, cookie.domain)) {
18
29
  return false;
19
30
  }
20
- // If a path restriction exists, ensure the cookie is only sent for URLs with a matching prefix.
21
- if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) {
31
+ // An empty path means no path restriction. Otherwise require an RFC 6265 path-match,
32
+ // so a cookie for `/api` is not sent to `/apiv2`.
33
+ if (cookie.path && !pathMatches(urlObject.pathname, cookie.path)) {
22
34
  return false;
23
35
  }
24
36
  // Cookie passed all checks; include it in the request.
@@ -3,7 +3,7 @@ import type { ExampleObject, ParameterObject } from '@scalar/workspace-store/sch
3
3
  * Determines if a parameter is disabled
4
4
  *
5
5
  * First we explicitly check if its been disabled via the `x-disabled` extension.
6
- * Populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
6
+ * Authored populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
7
  *
8
8
  * @param param - The parameter to check.
9
9
  * @param example - The example to check.
@@ -1 +1 @@
1
- {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAIlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAiBF,CAAA"}
1
+ {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAKlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAiBF,CAAA"}
@@ -1,9 +1,10 @@
1
1
  import { getExampleValue } from '../../../helpers/get-example-value.js';
2
+ import { isGeneratedExample } from '../../../request-example/builder/helpers/get-example.js';
2
3
  /**
3
4
  * Determines if a parameter is disabled
4
5
  *
5
6
  * First we explicitly check if its been disabled via the `x-disabled` extension.
6
- * Populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
+ * Authored populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
8
  *
8
9
  * @param param - The parameter to check.
9
10
  * @param example - The example to check.
@@ -18,7 +19,7 @@ export const isParamDisabled = (param, example, defaultDisabled = true) => {
18
19
  }
19
20
  // Keep the editor, generated snippets, and outgoing requests aligned for pre-populated values.
20
21
  const value = getExampleValue(example)?.value;
21
- const hasValue = value !== undefined && value !== '' && value !== null;
22
+ const hasValue = value !== undefined && value !== '' && value !== null && !isGeneratedExample(example);
22
23
  if (!defaultDisabled || hasValue) {
23
24
  return false;
24
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../src/request-example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;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qGAAqG;IACrG,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAM,KACN,OA8OF,CAAA;AAoBD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,UAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAM,KAC5D,OA2BF,CAAA"}
1
+ {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAqD,MAAM,uBAAuB,CAAA;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAA0B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAwZ9G,gGAAgG;AAChG,eAAO,MAAM,wBAAwB,GACnC,QAAQ,YAAY,EACpB,YAAY,MAAM,EAAE,EACpB,UAAU,2BAA2B,EACrC,mBAAiB,EACjB,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,YAAY,GAAG,SAoBjB,CAAA;AA0ZD,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG;IACxC,2EAA2E;IAC3E,CAAC,kBAAkB,CAAC,CAAC,EAAE,sBAAsB,CAAA;IAC7C,mFAAmF;IACnF,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,qDAAqD;IACrD,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9C,CAAA;AAyPD;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,yBAAyB,GAC7B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,iEAOG,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qGAAqG;IACrG,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAM,KACN,OAgPF,CAAA;AAoBD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,UAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAM,KAC5D,OA2BF,CAAA"}
@@ -324,7 +324,8 @@ const consumeCompositionSelection = (options, schemaPath, composition) => {
324
324
  };
325
325
  /** Select a composition branch once for both generated values and supplied example metadata. */
326
326
  export const selectExampleComposition = (schema, schemaPath, options, arrayItem = false, value) => {
327
- const keyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
327
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
328
+ const keyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
328
329
  const members = keyword ? schema[keyword] : undefined;
329
330
  if (!keyword || !members?.length) {
330
331
  return undefined;
@@ -472,16 +473,14 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
472
473
  // Use propertyNames enum values as example keys when no custom name is set
473
474
  const propertyNamesEnum = hasCustomName ? undefined : getPropertyNamesEnumValues(schema);
474
475
  const additionalName = hasCustomName ? customName.trim() : DEFAULT_ADDITIONAL_PROPERTIES_NAME;
475
- const additionalValue = isAnyType
476
- ? 'anything'
477
- : typeof additional === 'object'
478
- ? getExampleFromSchema(additional, options, {
479
- level: level + 1,
480
- schemaPath: [...schemaPath, additionalName],
481
- seen,
482
- dynamicScope: childScope,
483
- })
484
- : 'anything';
476
+ const additionalValue = !isAnyType && typeof additional === 'object'
477
+ ? getExampleFromSchema(additional, options, {
478
+ level: level + 1,
479
+ schemaPath: [...schemaPath, additionalName],
480
+ seen,
481
+ dynamicScope: childScope,
482
+ })
483
+ : 'anything';
485
484
  if (propertyNamesEnum && propertyNamesEnum.length > 0) {
486
485
  // Use the first enum value as a realistic example key
487
486
  response[String(propertyNamesEnum[0])] = additionalValue;
@@ -490,7 +489,8 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
490
489
  response[additionalName] = additionalValue;
491
490
  }
492
491
  }
493
- const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
492
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
493
+ const compositionKeyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
494
494
  const oneOfAnyOf = compositionKeyword ? schema[compositionKeyword] : undefined;
495
495
  if (compositionKeyword && oneOfAnyOf?.length) {
496
496
  const chosen = selectExampleComposition(schema, schemaPath, options, false, response);
@@ -593,7 +593,8 @@ const handleArraySchema = (schema, options, level, seen, cacheKey, schemaPath, d
593
593
  .filter(isDefined);
594
594
  return cache(schema, wrapItems ? examples.map((e) => ({ [itemsXmlTagName]: e })) : examples, cacheKey, skipCache);
595
595
  }
596
- const compositionKeyword = items.oneOf ? 'oneOf' : items.anyOf ? 'anyOf' : undefined;
596
+ const anyOfKeyword = items.anyOf ? 'anyOf' : undefined;
597
+ const compositionKeyword = items.oneOf ? 'oneOf' : anyOfKeyword;
597
598
  const union = compositionKeyword ? items[compositionKeyword] : undefined;
598
599
  if (compositionKeyword && union && union.length > 0) {
599
600
  const selectedIndex = getCompositionSelectionIndex(itemsSchemaPath, compositionKeyword, options, union.length) ??
@@ -730,7 +731,8 @@ const getEmptyContainer = (schema) => {
730
731
  };
731
732
  /** Pick the `oneOf`/`anyOf` variant the walk itself would have rendered, honoring an explicit selection. */
732
733
  const getSelectedVariant = (schema, options, schemaPath) => {
733
- const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
734
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
735
+ const compositionKeyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
734
736
  const variants = compositionKeyword ? schema[compositionKeyword] : undefined;
735
737
  if (!compositionKeyword || !Array.isArray(variants) || variants.length === 0) {
736
738
  return undefined;
@@ -990,7 +992,8 @@ const generateExampleFromSchema = (schema, options, { level = 0, parentSchema, n
990
992
  }
991
993
  // Resolve non-object unions before type dispatch so shared root keywords do not
992
994
  // hide the selected member. Use the same selection and discriminator rules as other unions.
993
- const selectedComposition = _schema.oneOf ? 'oneOf' : _schema.anyOf ? 'anyOf' : undefined;
995
+ const selectedAnyOf = _schema.anyOf ? 'anyOf' : undefined;
996
+ const selectedComposition = _schema.oneOf ? 'oneOf' : selectedAnyOf;
994
997
  const selectedVariant = getSelectedVariant(_schema, options, schemaPath);
995
998
  if (selectedComposition && selectedVariant) {
996
999
  const rootType = 'type' in _schema ? _schema.type : undefined;
@@ -1037,7 +1040,8 @@ const generateExampleFromSchema = (schema, options, { level = 0, parentSchema, n
1037
1040
  return cache(_schema, primitive, cacheKey, skipCache);
1038
1041
  }
1039
1042
  // Handle composition schemas (oneOf, anyOf)
1040
- const compositionKeyword = _schema.oneOf ? 'oneOf' : _schema.anyOf ? 'anyOf' : undefined;
1043
+ const anyOfKeyword = _schema.anyOf ? 'anyOf' : undefined;
1044
+ const compositionKeyword = _schema.oneOf ? 'oneOf' : anyOfKeyword;
1041
1045
  const discriminate = compositionKeyword ? _schema[compositionKeyword] : undefined;
1042
1046
  if (compositionKeyword && Array.isArray(discriminate) && discriminate.length > 0) {
1043
1047
  const candidate = selectExampleComposition(_schema, schemaPath, options);
@@ -1,4 +1,6 @@
1
1
  import type { ExampleObject, MediaTypeObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
2
+ /** Whether an example contains only enum suggestions rather than authored values. */
3
+ export declare const isGeneratedExample: (example: ExampleObject | undefined) => boolean;
2
4
  /**
3
5
  * Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
4
6
  * Or the [deprecated] `example` field.
@@ -1 +1 @@
1
- {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAGlB,MAAM,8DAA8D,CAAA;AAoHrE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAC5D,aAAa,MAAM,GAAG,SAAS,EAC/B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAyBlB,CAAA"}
1
+ {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAGlB,MAAM,8DAA8D,CAAA;AAQrE,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,GAAI,SAAS,aAAa,GAAG,SAAS,KAAG,OACf,CAAA;AAuHzD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAC5D,aAAa,MAAM,GAAG,SAAS,EAC/B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAyBlB,CAAA"}
@@ -1,5 +1,9 @@
1
1
  import { getResolvedRef } from '../../../helpers/get-resolved-ref.js';
2
2
  import { resolve } from '../../../resolve.js';
3
+ // Keep suggestion provenance out of API descriptions and persisted user examples.
4
+ const generatedExamples = new WeakSet();
5
+ /** Whether an example contains only enum suggestions rather than authored values. */
6
+ export const isGeneratedExample = (example) => example !== undefined && generatedExamples.has(example);
3
7
  /** Helper to get example from examples object with fallback to example field */
4
8
  const getExampleFromExamples = (examples, exampleField, exampleName) => {
5
9
  if (!examples && exampleField === undefined) {
@@ -34,15 +38,17 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
34
38
  if ('default' in schema && schema.default !== undefined) {
35
39
  return { value: schema.default };
36
40
  }
37
- if ('enum' in schema && schema.enum?.[0] !== undefined) {
38
- return { value: schema.enum[0] };
39
- }
40
41
  if ('examples' in schema && schema.examples?.[0] !== undefined) {
41
42
  return { value: schema.examples[0] };
42
43
  }
43
44
  if ('example' in schema && schema.example !== undefined) {
44
45
  return { value: schema.example };
45
46
  }
47
+ if ('enum' in schema && schema.enum?.[0] !== undefined) {
48
+ const example = { value: schema.enum[0] };
49
+ generatedExamples.add(example);
50
+ return example;
51
+ }
46
52
  // Reference siblings create a fresh merged object, so track the underlying schema for cycles.
47
53
  const target = getResolvedRef(input) ?? input;
48
54
  if (!('properties' in schema) || !schema.properties) {
@@ -62,7 +68,7 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
62
68
  walk.ancestors.add(target);
63
69
  const properties = Object.entries(schema.properties).flatMap(([name, property]) => {
64
70
  const example = getSchemaExample(property, walk);
65
- return example === undefined ? [] : [[name, example.value]];
71
+ return example === undefined ? [] : [{ name, example }];
66
72
  });
67
73
  walk.ancestors.delete(target);
68
74
  // Stops at schemas inside this walk have left the path, so the rest point above it.
@@ -70,7 +76,11 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
70
76
  walk.stops = outerStops;
71
77
  stops.forEach((stop) => outerStops.add(stop));
72
78
  if (properties.length > 0) {
73
- return { value: Object.fromEntries(properties) };
79
+ const example = { value: Object.fromEntries(properties.map(({ name, example }) => [name, example.value])) };
80
+ if (properties.every(({ example }) => isGeneratedExample(example))) {
81
+ generatedExamples.add(example);
82
+ }
83
+ return example;
74
84
  }
75
85
  walk.withoutValues.set(target, { properties: schema.properties, stops });
76
86
  return undefined;
@@ -5,6 +5,7 @@ export { type SerializedFormProperty, serializeFormPropertyWithEncoding } from '
5
5
  export { serializeMultipartArray } from './body/serialize-multipart-array.js';
6
6
  export { BUILD_REQUEST_FAILED, type BuildRequestData, type BuildRequestFailureCode, type BuildRequestResult, type RequestPayload, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
7
7
  export { deSerializeParameter, deSerializeSchemaValue } from './header/de-serialize-parameter.js';
8
+ export { filterDisabledProperties } from './header/filter-disabled-properties.js';
8
9
  export { filterGlobalCookie } from './header/filter-global-cookies.js';
9
10
  export { isParamDisabled } from './header/is-param-disabled.js';
10
11
  export { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './header/serialize-parameter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,KAAK,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAA;AAC/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAk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AAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,wBAAwB,GACzB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,EAClC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,yBAAyB,CAAA"}
@@ -5,6 +5,7 @@ export { serializeFormPropertyWithEncoding } from './body/serialize-form-propert
5
5
  export { serializeMultipartArray } from './body/serialize-multipart-array.js';
6
6
  export { BUILD_REQUEST_FAILED, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
7
7
  export { deSerializeParameter, deSerializeSchemaValue } from './header/de-serialize-parameter.js';
8
+ export { filterDisabledProperties } from './header/filter-disabled-properties.js';
8
9
  export { filterGlobalCookie } from './header/filter-global-cookies.js';
9
10
  export { isParamDisabled } from './header/is-param-disabled.js';
10
11
  export { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './header/serialize-parameter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAWnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF,MAAM,MAAM,6BAA6B,GAAG,OAAO,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAEnH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;AAK1F;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,8BAuFF,CAAA"}
1
+ {"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAWnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF,MAAM,MAAM,6BAA6B,GAAG,OAAO,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAEnH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;AAK1F;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,8BAwFF,CAAA"}
@@ -27,14 +27,15 @@ export const resolveRequestFactoryUrl = (request, options) => {
27
27
  const reserved = request.path.reservedParameters && Object.hasOwn(request.path.reservedParameters, key)
28
28
  ? request.path.reservedParameters[key]
29
29
  : undefined;
30
- const encoded = request.path.serializedParameters?.has(key)
31
- ? replace(value)
32
- : reserved
33
- ? serializeReservedPathParameter(key, {
34
- ...reserved,
35
- value: value === reserved.originalValue ? reserved.value : value,
36
- }, replace)
37
- : encodePathParameter(replace(value));
30
+ if (request.path.serializedParameters?.has(key)) {
31
+ return [key, replace(value)];
32
+ }
33
+ const encoded = reserved
34
+ ? serializeReservedPathParameter(key, {
35
+ ...reserved,
36
+ value: value === reserved.originalValue ? reserved.value : value,
37
+ }, replace)
38
+ : encodePathParameter(replace(value));
38
39
  return [key, encoded];
39
40
  })));
40
41
  if (!pathVariablesEncoded.ok) {
@@ -1,8 +1,18 @@
1
+ import type { AuthSecretField } from '../../../helpers/auth-secret-fields.js';
1
2
  import type { EncryptionSchemeType, SaslSchemeType } from '../../../request-example/builder/security/broker-scheme-types.js';
2
3
  import type { XScalarAuthUrl, XScalarCredentialsLocation, XScalarSecretClientCertificate, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretPrivateKey, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretServiceName, XScalarSecretToken, XScalarTokenUrl } from '../../../schemas/extensions/security/index.js';
3
4
  import type { OAuthFlowAuthorizationCode, OAuthFlowClientCredentials, OAuthFlowDeviceAuthorization, OAuthFlowImplicit, OAuthFlowPassword } from '../../../schemas/v3.2/strict/oauth-flow.js';
4
5
  import type { ApiKeyObject, HttpObject, MutualTlsObject, OAuth2Object, OpenIdConnectObject } from '../../../schemas/v3.2/strict/security-scheme.js';
5
- type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken & XScalarAuthUrl & XScalarTokenUrl & {
6
+ /**
7
+ * Derived while merging the auth store with the document and configuration: the value each field
8
+ * returns to when its stored override is reset. Fields without a non-empty default are left out.
9
+ * It is never persisted and never sent with a request; it only tells the auth UI whether Reset
10
+ * would restore anything.
11
+ */
12
+ export type XScalarSecretDefaults = {
13
+ 'x-scalar-secret-defaults'?: Partial<Record<AuthSecretField, string>>;
14
+ };
15
+ type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken & XScalarAuthUrl & XScalarTokenUrl & XScalarSecretDefaults & {
6
16
  /** Explicit clears are carried to the auth UI to prevent default prefill after remount. */
7
17
  'x-scalar-secret-cleared-fields'?: string[];
8
18
  };
@@ -26,8 +36,8 @@ export type BrokerApiKeyObject = {
26
36
  name?: string;
27
37
  description?: string;
28
38
  };
29
- export type ApiKeyObjectSecret = (ApiKeyObject | BrokerApiKeyObject) & XScalarSecretToken;
30
- export type HttpObjectSecret = HttpObject & XScalarSecretHTTP & XScalarSecretToken;
39
+ export type ApiKeyObjectSecret = (ApiKeyObject | BrokerApiKeyObject) & XScalarSecretToken & XScalarSecretDefaults;
40
+ export type HttpObjectSecret = HttpObject & XScalarSecretHTTP & XScalarSecretToken & XScalarSecretDefaults;
31
41
  /** Mutual TLS: the client certificate is presented at the TLS layer, so there is no secret to enter. */
32
42
  export type MutualTlsObjectSecret = MutualTlsObject;
33
43
  export type OAuth2ObjectSecret = Omit<OAuth2Object, 'flows'> & {
@@ -1 +1 @@
1
- {"version":3,"file":"secret-types.d.ts","sourceRoot":"","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,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAA;AAEpG,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAA;AAE1F,MAAM,MAAM,0BAA0B,GAClC,kBAAkB,GAClB,gBAAgB,GAChB,qBAAqB,GACrB,yBAAyB,GACzB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,sBAAsB,GACtB,kBAAkB,CAAA"}
1
+ {"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAA;AAClH,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EAChB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACpB,MAAM,uCAAuC,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,0BAA0B,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAA;CACtE,CAAA;AAED,KAAK,qBAAqB,GAAG,qBAAqB,GAChD,kBAAkB,GAClB,yBAAyB,GACzB,cAAc,GACd,eAAe,GACf,qBAAqB,GAAG;IACtB,2FA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