@scalar/workspace-store 0.68.2 → 0.68.4

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 (177) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +20 -0
  3. package/dist/channel-example/build-connection-url.d.ts.map +1 -1
  4. package/dist/channel-example/build-connection-url.js +6 -5
  5. package/dist/channel-example/get-all-channel-messages.js +2 -2
  6. package/dist/channel-example/get-async-api-protocols.d.ts +3 -1
  7. package/dist/channel-example/get-async-api-protocols.d.ts.map +1 -1
  8. package/dist/channel-example/get-async-api-protocols.js +9 -5
  9. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +14 -2
  10. package/dist/channel-example/get-asyncapi-security-requirements.d.ts.map +1 -1
  11. package/dist/channel-example/get-asyncapi-security-requirements.js +93 -36
  12. package/dist/channel-example/get-channel-connection-context.d.ts.map +1 -1
  13. package/dist/channel-example/get-channel-connection-context.js +3 -4
  14. package/dist/channel-example/get-channel-connection-security.d.ts +3 -2
  15. package/dist/channel-example/get-channel-connection-security.d.ts.map +1 -1
  16. package/dist/channel-example/get-channel-connection-security.js +4 -6
  17. package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
  18. package/dist/channel-example/get-channel-operations.js +4 -3
  19. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
  20. package/dist/channel-example/get-channel-parameters.js +4 -3
  21. package/dist/channel-example/index.d.ts +2 -2
  22. package/dist/channel-example/index.d.ts.map +1 -1
  23. package/dist/channel-example/index.js +2 -2
  24. package/dist/channel-example/resolve-channel.d.ts.map +1 -1
  25. package/dist/channel-example/resolve-channel.js +4 -3
  26. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
  27. package/dist/channel-example/resolve-operation-channel.js +8 -6
  28. package/dist/channel-example/resolve-operation-with-traits.d.ts +1 -3
  29. package/dist/channel-example/resolve-operation-with-traits.d.ts.map +1 -1
  30. package/dist/channel-example/resolve-operation-with-traits.js +3 -41
  31. package/dist/channel-example/servers.d.ts.map +1 -1
  32. package/dist/channel-example/servers.js +4 -3
  33. package/dist/client.d.ts.map +1 -1
  34. package/dist/client.js +8 -4
  35. package/dist/entities/auth/schema.d.ts +25 -0
  36. package/dist/entities/auth/schema.d.ts.map +1 -1
  37. package/dist/entities/auth/schema.js +2 -0
  38. package/dist/events/definitions/operation.d.ts +7 -0
  39. package/dist/events/definitions/operation.d.ts.map +1 -1
  40. package/dist/helpers/asyncapi-chunk-groups.d.ts.map +1 -1
  41. package/dist/helpers/asyncapi-chunk-groups.js +8 -4
  42. package/dist/helpers/asyncapi-model-chunk-reference.d.ts.map +1 -1
  43. package/dist/helpers/asyncapi-model-chunk-reference.js +2 -1
  44. package/dist/helpers/auth-secret-fields.d.ts +11 -0
  45. package/dist/helpers/auth-secret-fields.d.ts.map +1 -1
  46. package/dist/helpers/auth-secret-fields.js +22 -0
  47. package/dist/helpers/encode-path-parameter.d.ts.map +1 -1
  48. package/dist/helpers/encode-path-parameter.js +11 -12
  49. package/dist/helpers/external-examples.d.ts.map +1 -1
  50. package/dist/helpers/external-examples.js +6 -3
  51. package/dist/helpers/get-async-api-schema-view.d.ts +8 -0
  52. package/dist/helpers/get-async-api-schema-view.d.ts.map +1 -0
  53. package/dist/helpers/get-async-api-schema-view.js +82 -0
  54. package/dist/helpers/get-boolean-schema.d.ts +7 -0
  55. package/dist/helpers/get-boolean-schema.d.ts.map +1 -0
  56. package/dist/helpers/get-boolean-schema.js +5 -0
  57. package/dist/helpers/get-resolved-async-api-ref.d.ts +10 -0
  58. package/dist/helpers/get-resolved-async-api-ref.d.ts.map +1 -0
  59. package/dist/helpers/get-resolved-async-api-ref.js +18 -0
  60. package/dist/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  61. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -1
  62. package/dist/helpers/normalize-boolean-schemas.js +6 -1
  63. package/dist/helpers/operation-examples.d.ts.map +1 -1
  64. package/dist/helpers/operation-examples.js +2 -1
  65. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  66. package/dist/helpers/querystring-parameter.js +6 -6
  67. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -1
  68. package/dist/helpers/resolve-security-requirements.js +38 -19
  69. package/dist/helpers/resolve-traits.d.ts +3 -0
  70. package/dist/helpers/resolve-traits.d.ts.map +1 -0
  71. package/dist/helpers/resolve-traits.js +76 -0
  72. package/dist/helpers/serialize-stream-example.js +1 -1
  73. package/dist/helpers/snapshot-schema.d.ts +9 -0
  74. package/dist/helpers/snapshot-schema.d.ts.map +1 -0
  75. package/dist/helpers/snapshot-schema.js +38 -0
  76. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  77. package/dist/helpers/use-external-examples.js +10 -5
  78. package/dist/mutators/auth.d.ts +2 -1
  79. package/dist/mutators/auth.d.ts.map +1 -1
  80. package/dist/mutators/auth.js +32 -2
  81. package/dist/mutators/index.d.ts +2 -2
  82. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  83. package/dist/mutators/operation/helpers/har-to-operation.js +4 -2
  84. package/dist/mutators/operation/operation.d.ts.map +1 -1
  85. package/dist/mutators/operation/operation.js +4 -2
  86. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  87. package/dist/mutators/operation/parameters.js +23 -1
  88. package/dist/mutators/tag.d.ts.map +1 -1
  89. package/dist/mutators/tag.js +4 -2
  90. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  91. package/dist/navigation/get-navigation-options.js +9 -5
  92. package/dist/navigation/helpers/get-tag-external-docs.d.ts +4 -0
  93. package/dist/navigation/helpers/get-tag-external-docs.d.ts.map +1 -0
  94. package/dist/navigation/helpers/get-tag-external-docs.js +6 -0
  95. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  96. package/dist/navigation/helpers/traverse-asyncapi-document.js +75 -36
  97. package/dist/navigation/helpers/traverse-paths.js +1 -1
  98. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  99. package/dist/navigation/helpers/traverse-schemas.js +2 -1
  100. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  101. package/dist/navigation/helpers/traverse-tags.js +3 -0
  102. package/dist/plugins/bundler/index.d.ts.map +1 -1
  103. package/dist/plugins/bundler/index.js +2 -1
  104. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  105. package/dist/plugins/bundler/openapi-document.js +2 -1
  106. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -1
  107. package/dist/request-example/builder/body/build-multipart.js +18 -16
  108. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  109. package/dist/request-example/builder/body/encode-multipart-body.js +2 -1
  110. package/dist/request-example/builder/body/get-request-body-example.d.ts +2 -2
  111. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  112. package/dist/request-example/builder/body/get-request-body-example.js +8 -7
  113. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  114. package/dist/request-example/builder/body/schema-value-coercion.js +4 -1
  115. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  116. package/dist/request-example/builder/header/build-request-parameters.js +12 -2
  117. package/dist/request-example/builder/header/filter-disabled-properties.d.ts +3 -0
  118. package/dist/request-example/builder/header/filter-disabled-properties.d.ts.map +1 -0
  119. package/dist/request-example/builder/header/filter-disabled-properties.js +18 -0
  120. package/dist/request-example/builder/header/filter-global-cookies.d.ts +1 -1
  121. package/dist/request-example/builder/header/filter-global-cookies.d.ts.map +1 -1
  122. package/dist/request-example/builder/header/filter-global-cookies.js +15 -3
  123. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  124. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  125. package/dist/request-example/builder/header/is-param-disabled.js +3 -2
  126. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  127. package/dist/request-example/builder/helpers/get-example-from-schema.js +27 -16
  128. package/dist/request-example/builder/helpers/get-example.d.ts +2 -0
  129. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  130. package/dist/request-example/builder/helpers/get-example.js +15 -5
  131. package/dist/request-example/builder/index.d.ts +1 -0
  132. package/dist/request-example/builder/index.d.ts.map +1 -1
  133. package/dist/request-example/builder/index.js +1 -0
  134. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  135. package/dist/request-example/builder/resolve-request-factory-url.js +9 -8
  136. package/dist/request-example/builder/security/secret-types.d.ts +13 -3
  137. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  138. package/dist/request-example/context/headers.js +1 -1
  139. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  140. package/dist/request-example/context/security/extract-security-scheme-secrets.js +65 -25
  141. package/dist/request-example/context/security/get-selected-security.js +1 -1
  142. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  143. package/dist/request-example/context/security/merge-security.js +12 -2
  144. package/dist/request-example/context/security/uses-api-key-name-override.d.ts +9 -0
  145. package/dist/request-example/context/security/uses-api-key-name-override.d.ts.map +1 -0
  146. package/dist/request-example/context/security/uses-api-key-name-override.js +9 -0
  147. package/dist/request-example/index.d.ts +1 -1
  148. package/dist/request-example/index.d.ts.map +1 -1
  149. package/dist/request-example/index.js +1 -1
  150. package/dist/request-example/xml/get-xml-example.js +2 -1
  151. package/dist/request-example/xml/write-xml.d.ts.map +1 -1
  152. package/dist/request-example/xml/write-xml.js +7 -5
  153. package/dist/resolve.d.ts +1 -1
  154. package/dist/resolve.d.ts.map +1 -1
  155. package/dist/resolve.js +16 -1
  156. package/dist/schemas/extensions/example/x-disabled.d.ts +4 -0
  157. package/dist/schemas/extensions/example/x-disabled.d.ts.map +1 -1
  158. package/dist/schemas/extensions/example/x-disabled.js +3 -1
  159. package/dist/schemas/navigation.d.ts +5 -1
  160. package/dist/schemas/navigation.d.ts.map +1 -1
  161. package/dist/schemas/navigation.js +2 -1
  162. package/dist/schemas/reference-config/index.d.ts +3 -0
  163. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  164. package/dist/schemas/reference-config/settings.d.ts +3 -0
  165. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  166. package/dist/schemas/v3.1/strict/example.d.ts +3 -0
  167. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  168. package/dist/schemas/v3.1/strict/openapi-document.d.ts +106 -6
  169. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  170. package/dist/schemas/v3.2/strict/example.d.ts +3 -0
  171. package/dist/schemas/v3.2/strict/example.d.ts.map +1 -1
  172. package/dist/schemas/v3.2/strict/openapi-document.d.ts +106 -6
  173. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  174. package/dist/server.d.ts +7 -0
  175. package/dist/server.d.ts.map +1 -1
  176. package/dist/server.js +16 -7
  177. package/package.json +9 -9
@@ -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,kCAAkC,CAAA;AAC1E,OAAO,EACL,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,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"}
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,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K,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":"","sources":["../../../../src/request-example/builder/security/secret-types.ts"],"names":[],"mappings":"AAAA,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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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,2FAA2F;IAC3F,gCAAgC,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5C,CAAA;AAEH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,wBAAwB,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GACrD,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,GACzB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,gCAAgC,GAAG,0BA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IAC5C,IAAI,EAAE,CAAC,CAAA;IACP,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,cAAc,CAAC,GAAG,iBAAiB,CAAA;AAEvF,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,MAAM,CAAC,GAAG,8BAA8B,GAAG,uBAAuB,CAAA;AAEtH,wFAAwF;AACxF,MAAM,MAAM,sBAAsB,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"}
@@ -28,7 +28,7 @@ const getEnabledOperationHeaderParameterNames = (operation, exampleName) => {
28
28
  const names = new Set();
29
29
  for (const ref of operation.parameters ?? []) {
30
30
  const param = getResolvedRef(ref);
31
- if (!param || param.in !== 'header') {
31
+ if (param?.in !== 'header') {
32
32
  continue;
33
33
  }
34
34
  const example = getExample(param, exampleName, undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAE/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAEV,kBAAkB,EAClB,sBAAsB,EAUtB,gBAAgB,EAChB,0BAA0B,EAE3B,MAAM,iDAAiD,CAAA;AAGxD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAEjF,KAAK,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAA;AACrG,KAAK,gBAAgB,GAAG;KACrB,CAAC,IAAI,gBAAgB,GAAG;QACvB,IAAI,EAAE,CAAC,CAAA;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf;CACF,CAAC,gBAAgB,CAAC,CAAA;AAyNnB,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,gBAAgB,GAAG,gBAAgB,GAAG,CAAC,kBAAkB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACvF,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,0BAqHF,CAAA"}
1
+ {"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAE/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAEV,kBAAkB,EAClB,sBAAsB,EAUtB,gBAAgB,EAChB,0BAA0B,EAG3B,MAAM,iDAAiD,CAAA;AAGxD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAEjF,KAAK,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAA;AACrG,KAAK,gBAAgB,GAAG;KACrB,CAAC,IAAI,gBAAgB,GAAG;QACvB,IAAI,EAAE,CAAC,CAAA;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf;CACF,CAAC,gBAAgB,CAAC,CAAA;AAuQnB,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,gBAAgB,GAAG,gBAAgB,GAAG,CAAC,kBAAkB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACvF,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,0BA6HF,CAAA"}
@@ -15,25 +15,55 @@ const SECRET_TO_INPUT_FIELD_MAP = {
15
15
  'x-scalar-secret-auth-url': 'authorizationUrl',
16
16
  'x-scalar-secret-token-url': 'tokenUrl',
17
17
  };
18
- const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}, oauth2RedirectUri) => {
18
+ /**
19
+ * Keep only the defaults that would restore something. An empty default means Reset could only
20
+ * clear the field, which the clear action already does, so the key is left off entirely.
21
+ */
22
+ const withSecretDefaults = (defaults) => {
23
+ const nonEmpty = Object.fromEntries(Object.entries(defaults).filter(([, value]) => typeof value === 'string' && value !== ''));
24
+ return Object.keys(nonEmpty).length ? { 'x-scalar-secret-defaults': nonEmpty } : {};
25
+ };
26
+ /** Only string values count; anything else falls through to the next source. */
27
+ const readString = (source, key) => {
28
+ const value = source[key];
29
+ return typeof value === 'string' ? value : undefined;
30
+ };
31
+ const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}, oauth2RedirectUri,
32
+ /**
33
+ * OpenID Connect passes the stored flow as both the config and the auth store, so its
34
+ * `x-scalar-secret-*` values are the user's own overrides and must not count as defaults.
35
+ */
36
+ includeConfigSecretValues = true) => {
19
37
  const clearedFields = properties.filter((property) => isSecretFieldCleared(authStoreSecrets, property));
38
+ const defaults = {};
20
39
  const values = Object.fromEntries(properties.map((property) => {
21
40
  // Preserve explicit clears, while legacy schema-filled empties still inherit defaults.
22
- const authStoreValue = typeof authStoreSecrets[property] === 'string' ? authStoreSecrets[property] : undefined;
23
- const configValue = typeof configSecrets[property] === 'string' ? configSecrets[property] : undefined;
24
- const configInputValue = typeof configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]] === 'string'
25
- ? configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]]
26
- : undefined;
41
+ const authStoreValue = readString(authStoreSecrets, property);
42
+ const configValue = includeConfigSecretValues ? readString(configSecrets, property) : undefined;
43
+ const configInputValue = readString(configSecrets, SECRET_TO_INPUT_FIELD_MAP[property]);
27
44
  // oauth2RedirectUri (top-level config option) is used as a global fallback for the redirect URI,
28
45
  // applied only when neither the auth store nor per-scheme config have a value. This ensures
29
46
  // the configured redirect URI persists when switching between documents with the same OAuth config,
30
47
  // because each document starts with no stored redirect URI (authStoreValue === undefined).
31
- const value = property === 'x-scalar-secret-redirect-uri' || isSecretFieldCleared(authStoreSecrets, property)
48
+ const isRedirect = property === 'x-scalar-secret-redirect-uri';
49
+ // The value and its reset target share one fallback, so Reset always restores exactly what the
50
+ // field shows once the stored override is released.
51
+ const fallback = isRedirect
52
+ ? (configValue ?? configInputValue ?? oauth2RedirectUri ?? '')
53
+ : configValue || configInputValue || '';
54
+ // The redirect URI and explicitly cleared fields keep an empty stored value instead of falling
55
+ // back. For the redirect URI this is the stored value ahead of the same fallback as above.
56
+ const value = isRedirect || isSecretFieldCleared(authStoreSecrets, property)
32
57
  ? (authStoreValue ?? configValue ?? configInputValue ?? oauth2RedirectUri ?? '')
33
- : authStoreValue || configValue || configInputValue || '';
58
+ : authStoreValue || fallback;
59
+ defaults[property] = fallback;
34
60
  return [property, value];
35
61
  }));
36
- return { ...values, ...(clearedFields.length ? { 'x-scalar-secret-cleared-fields': clearedFields } : {}) };
62
+ return {
63
+ ...values,
64
+ ...(clearedFields.length ? { 'x-scalar-secret-cleared-fields': clearedFields } : {}),
65
+ ...withSecretDefaults(defaults),
66
+ };
37
67
  };
38
68
  const storedSecret = (secrets, field) => {
39
69
  const value = secrets && Reflect.get(secrets, field);
@@ -60,7 +90,7 @@ const extractCredentialsLocation = (configSecrets, authStoreSecrets = {}) => {
60
90
  * Extract flow secrets and selected scopes for OAuth-like flows.
61
91
  * Reused by both oauth2 and openIdConnect security schemes.
62
92
  */
63
- const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
93
+ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri, includeConfigSecretValues = true) => {
64
94
  const selectedScopes = new Set();
65
95
  const extractedFlows = objectEntries(flows ?? {}).reduce((acc, [key, flow]) => {
66
96
  if (!isObject(flow)) {
@@ -80,7 +110,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
80
110
  'x-scalar-secret-redirect-uri',
81
111
  'x-scalar-secret-token',
82
112
  'x-scalar-secret-auth-url',
83
- ], flow, storeSecrets?.implicit, oauth2RedirectUri),
113
+ ], flow, storeSecrets?.implicit, oauth2RedirectUri, includeConfigSecretValues),
84
114
  ...extractRefreshTokenSecret(storeSecrets?.implicit),
85
115
  };
86
116
  }
@@ -95,7 +125,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
95
125
  'x-scalar-secret-password',
96
126
  'x-scalar-secret-token',
97
127
  'x-scalar-secret-token-url',
98
- ], flow, storeSecrets?.password),
128
+ ], flow, storeSecrets?.password, undefined, includeConfigSecretValues),
99
129
  ...extractCredentialsLocation(flow, storeSecrets?.password),
100
130
  ...extractRefreshTokenSecret(storeSecrets?.password),
101
131
  };
@@ -109,7 +139,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
109
139
  'x-scalar-secret-client-secret',
110
140
  'x-scalar-secret-token',
111
141
  'x-scalar-secret-token-url',
112
- ], flow, storeSecrets?.clientCredentials),
142
+ ], flow, storeSecrets?.clientCredentials, undefined, includeConfigSecretValues),
113
143
  ...extractCredentialsLocation(flow, storeSecrets?.clientCredentials),
114
144
  ...extractRefreshTokenSecret(storeSecrets?.clientCredentials),
115
145
  };
@@ -123,7 +153,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
123
153
  'x-scalar-secret-client-secret',
124
154
  'x-scalar-secret-token',
125
155
  'x-scalar-secret-token-url',
126
- ], flow, storeSecrets?.deviceAuthorization),
156
+ ], flow, storeSecrets?.deviceAuthorization, undefined, includeConfigSecretValues),
127
157
  ...extractCredentialsLocation(flow, storeSecrets?.deviceAuthorization),
128
158
  ...extractRefreshTokenSecret(storeSecrets?.deviceAuthorization),
129
159
  };
@@ -139,7 +169,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
139
169
  'x-scalar-secret-token',
140
170
  'x-scalar-secret-auth-url',
141
171
  'x-scalar-secret-token-url',
142
- ], flow, storeSecrets?.authorizationCode, oauth2RedirectUri),
172
+ ], flow, storeSecrets?.authorizationCode, oauth2RedirectUri, includeConfigSecretValues),
143
173
  ...extractCredentialsLocation(flow, storeSecrets?.authorizationCode),
144
174
  ...extractRefreshTokenSecret(storeSecrets?.authorizationCode),
145
175
  };
@@ -156,29 +186,37 @@ scheme, authStore, name, documentSlug, oauth2RedirectUri) => {
156
186
  // Handle API Key security schemes
157
187
  if (scheme.type === 'apiKey') {
158
188
  const storeSecrets = secrets?.type === 'apiKey' ? secrets : undefined;
189
+ const defaults = {
190
+ 'x-scalar-secret-token': documentSecret(scheme, 'x-scalar-secret-token') || scheme.value || '',
191
+ };
159
192
  return {
160
193
  ...scheme,
161
- 'x-scalar-secret-token': storedSecret(storeSecrets, 'x-scalar-secret-token') ??
162
- (documentSecret(scheme, 'x-scalar-secret-token') || scheme.value || ''),
194
+ // User edits take precedence over document and configuration defaults, even when cleared.
195
+ ...(storeSecrets?.name === undefined ? {} : { name: storeSecrets.name }),
196
+ 'x-scalar-secret-token': storedSecret(storeSecrets, 'x-scalar-secret-token') ?? defaults['x-scalar-secret-token'],
197
+ ...withSecretDefaults(defaults),
163
198
  };
164
199
  }
165
200
  // Handle HTTP Auth security schemes (e.g., Basic, Bearer)
166
201
  if (scheme.type === 'http') {
167
202
  const storeSecrets = secrets?.type === 'http' ? secrets : undefined;
203
+ const defaults = {
204
+ 'x-scalar-secret-token': documentSecret(scheme, 'x-scalar-secret-token') || scheme.token || '',
205
+ 'x-scalar-secret-username': documentSecret(scheme, 'x-scalar-secret-username') || scheme.username || '',
206
+ 'x-scalar-secret-password': documentSecret(scheme, 'x-scalar-secret-password') || scheme.password || '',
207
+ };
168
208
  return {
169
209
  ...scheme,
170
- 'x-scalar-secret-token': storedSecret(storeSecrets, 'x-scalar-secret-token') ??
171
- (documentSecret(scheme, 'x-scalar-secret-token') || scheme.token || ''),
172
- 'x-scalar-secret-username': storedSecret(storeSecrets, 'x-scalar-secret-username') ??
173
- (documentSecret(scheme, 'x-scalar-secret-username') || scheme.username || ''),
174
- 'x-scalar-secret-password': storedSecret(storeSecrets, 'x-scalar-secret-password') ??
175
- (documentSecret(scheme, 'x-scalar-secret-password') || scheme.password || ''),
210
+ 'x-scalar-secret-token': storedSecret(storeSecrets, 'x-scalar-secret-token') ?? defaults['x-scalar-secret-token'],
211
+ 'x-scalar-secret-username': storedSecret(storeSecrets, 'x-scalar-secret-username') ?? defaults['x-scalar-secret-username'],
212
+ 'x-scalar-secret-password': storedSecret(storeSecrets, 'x-scalar-secret-password') ?? defaults['x-scalar-secret-password'],
213
+ ...withSecretDefaults(defaults),
176
214
  };
177
215
  }
178
216
  // Handle OAuth2 security schemes and all supported flows
179
217
  if (scheme.type === 'oauth2') {
180
218
  const storeSecrets = secrets?.type === 'oauth2' ? secrets : undefined;
181
- const extracted = extractOAuthFlowSecrets(scheme.flows, storeSecrets, oauth2RedirectUri);
219
+ const extracted = extractOAuthFlowSecrets(scheme.flows, storeSecrets, oauth2RedirectUri, true);
182
220
  const configuredDefaultScopes = Array.isArray(scheme['x-default-scopes'])
183
221
  ? scheme['x-default-scopes'].filter((scope) => typeof scope === 'string')
184
222
  : [];
@@ -198,7 +236,9 @@ scheme, authStore, name, documentSlug, oauth2RedirectUri) => {
198
236
  clientCredentials: storeSecrets?.clientCredentials,
199
237
  authorizationCode: storeSecrets?.authorizationCode,
200
238
  deviceAuthorization: storeSecrets?.deviceAuthorization,
201
- }, storeSecrets, oauth2RedirectUri);
239
+ }, storeSecrets, oauth2RedirectUri,
240
+ // The flows above are the stored flows themselves, so only discovered or input keys are defaults
241
+ false);
202
242
  return {
203
243
  ...scheme,
204
244
  ...(objectEntries(extracted.flows).length ? { flows: extracted.flows } : {}),
@@ -2,7 +2,7 @@ import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref
2
2
  import { isAuthOptional } from './is-auth-optional.js';
3
3
  /** Extracts the default scopes for a security scheme (only OAuth2 schemes support this) */
4
4
  const getDefaultScopes = (scheme) => {
5
- if (!scheme || scheme.type !== 'oauth2') {
5
+ if (scheme?.type !== 'oauth2') {
6
6
  return [];
7
7
  }
8
8
  return scheme['x-default-scopes'] ?? [];
@@ -1 +1 @@
1
- {"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAgC,MAAM,4BAA4B,CAAA;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AA0E9E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,yBACI,gBAAgB,CAAC,iBAAiB,CAAC,GACnC,WAAW,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,qBA4DF,CAAA"}
1
+ {"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAgC,MAAM,4BAA4B,CAAA;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAKjG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AA4E9E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,yBACI,gBAAgB,CAAC,iBAAiB,CAAC,GACnC,WAAW,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,qBAoEF,CAAA"}
@@ -8,6 +8,7 @@ import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
8
8
  import { SecuritySchemeObjectSchema, } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
9
9
  import { isEncryptionSchemeType, isSaslSchemeType } from '../../../request-example/builder/security/broker-scheme-types.js';
10
10
  import { extractSecuritySchemeSecrets } from './extract-security-scheme-secrets.js';
11
+ import { usesApiKeyNameOverride } from './uses-api-key-name-override.js';
11
12
  const hasAvailableScopes = (flow) => {
12
13
  const resolved = getResolvedRef(flow);
13
14
  return resolved !== null && typeof resolved === 'object' && 'availableScopes' in resolved;
@@ -35,8 +36,9 @@ const normalizeAsyncApiOAuthFlows = (flows) => {
35
36
  }
36
37
  // Prefer an OpenAPI-native `scopes` map if one is somehow already present, so we never drop it.
37
38
  const resolved = getResolvedRef(flowValue);
38
- if (!isObjectLike(resolved))
39
+ if (!isObjectLike(resolved)) {
39
40
  return [flowKey, flowValue];
41
+ }
40
42
  const { availableScopes, scopes: existingScopes, ...rest } = resolved;
41
43
  return [flowKey, { ...rest, scopes: existingScopes ?? availableScopes ?? {} }];
42
44
  }));
@@ -118,7 +120,15 @@ export const mergeSecurity = (documentSecuritySchemes = {}, configSecurityScheme
118
120
  // We coerce in case the scheme is missing any key fields like type.
119
121
  const coerced = coerceValue(SecuritySchemeObjectSchema, scheme);
120
122
  const merged = { ...(isObjectLike(scheme) ? scheme : {}), ...coerced };
121
- acc[name] = extractSecuritySchemeSecrets(merged, authStore, name, documentName, oauth2RedirectUri);
123
+ const extracted = extractSecuritySchemeSecrets(merged, authStore, name, documentName, oauth2RedirectUri);
124
+ const configured = Object.hasOwn(configSecuritySchemes, name) ? configSecuritySchemes[name] : undefined;
125
+ // A name override left behind after the configuration changed must not hide the document name.
126
+ acc[name] =
127
+ extracted.type === 'apiKey' &&
128
+ merged.type === 'apiKey' &&
129
+ !usesApiKeyNameOverride(configured, resolvedDocumentSecuritySchemes[name])
130
+ ? { ...extracted, name: merged.name }
131
+ : extracted;
122
132
  return acc;
123
133
  }, {});
124
134
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether API key name edits for a scheme live in the auth store instead of the document.
3
+ *
4
+ * The document owns the name unless the configuration supplies one, or the scheme only exists in the
5
+ * configuration. The mutator and the merge share this rule, so an override left behind after the
6
+ * configuration changes cannot hide the document name.
7
+ */
8
+ export declare const usesApiKeyNameOverride: (configuredScheme: unknown, documentScheme: unknown) => boolean;
9
+ //# sourceMappingURL=uses-api-key-name-override.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uses-api-key-name-override.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/uses-api-key-name-override.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,OAAO,EAAE,gBAAgB,OAAO,KAAG,OACc,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { isObjectLike } from '@scalar/helpers/object/is-object';
2
+ /**
3
+ * Whether API key name edits for a scheme live in the auth store instead of the document.
4
+ *
5
+ * The document owns the name unless the configuration supplies one, or the scheme only exists in the
6
+ * configuration. The mutator and the merge share this rule, so an override left behind after the
7
+ * configuration changes cannot hide the document name.
8
+ */
9
+ export const usesApiKeyNameOverride = (configuredScheme, documentScheme) => isObjectLike(configuredScheme) && (configuredScheme.name !== undefined || !isObjectLike(documentScheme));
@@ -1,5 +1,5 @@
1
1
  export type { ApiKeyObjectSecret, BuildRequestData, BuildRequestFailureCode, BuildRequestResult, EncryptionObjectSecret, GssapiObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowDeviceAuthorizationSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, ResolveRequestFactoryUrlError, ResolveRequestFactoryUrlResult, SaslObjectSecret, SecuritySchemeObjectSecret, X509ObjectSecret, } from './builder/index.js';
2
- export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, type SerializedFormProperty, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, type SerializedFormProperty, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterDisabledProperties, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
3
3
  export { needsMultipartEncoding } from './builder/body/build-multipart.js';
4
4
  export { buildRequestBody } from './builder/body/build-request-body.js';
5
5
  export { serializeMultipartBody } from './builder/body/encode-multipart-body.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,EAClC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,iCAAiC,EACjC,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,KAAK,0BAA0B,EAC/B,aAAa,EACb,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,EAClC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,O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E,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,4 +1,4 @@
1
- export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
1
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterDisabledProperties, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
2
  export { needsMultipartEncoding } from './builder/body/build-multipart.js';
3
3
  export { buildRequestBody } from './builder/body/build-request-body.js';
4
4
  export { serializeMultipartBody } from './builder/body/encode-multipart-body.js';
@@ -213,7 +213,8 @@ const buildXmlExample = (value, input, options, evaluation) => {
213
213
  }
214
214
  const xml = schema.xml ?? {};
215
215
  validateXmlMetadata(xml, context.path);
216
- const kind = xml.nodeType ?? (xml.attribute ? 'attribute' : Array.isArray(data) && !xml.wrapped ? 'none' : 'element');
216
+ const elementKind = Array.isArray(data) && !xml.wrapped ? 'none' : 'element';
217
+ const kind = xml.nodeType ?? (xml.attribute ? 'attribute' : elementKind);
217
218
  const selectedComponentName = context.depth === 0 && '$ref' in schema && typeof schema.$ref === 'string'
218
219
  ? componentNameFromRef(schema.$ref, context.path)
219
220
  : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"write-xml.d.ts","sourceRoot":"","sources":["../../../src/request-example/xml/write-xml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAW,OAAO,EAAE,MAAM,YAAY,CAAA;AAUnF,4FAA4F;AAC5F,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5E,uFAAuF;AACvF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,EAAE,EAAE,UAAS,eAAoB,KAAG,gBA4H1E,CAAA"}
1
+ {"version":3,"file":"write-xml.d.ts","sourceRoot":"","sources":["../../../src/request-example/xml/write-xml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,gBAAgB,EAAW,OAAO,EAAE,MAAM,YAAY,CAAA;AAWnF,4FAA4F;AAC5F,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5E,uFAAuF;AACvF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,EAAE,EAAE,UAAS,eAAoB,KAAG,gBA6H1E,CAAA"}
@@ -3,6 +3,7 @@ const XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';
3
3
  // XML 1.0 (fifth edition) NCName: a QName's prefix and local part cannot contain colons.
4
4
  const NAME_START = 'A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}';
5
5
  const namePattern = new RegExp(`^[${NAME_START}][${NAME_START}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`, 'u');
6
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: Control characters are intentionally matched to validate or sanitize input.
6
7
  const invalidCharacter = /[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/u;
7
8
  /** Serialize an XML document, validating names, characters, and namespace bindings. */
8
9
  export const writeXml = (nodes, options = {}) => {
@@ -10,7 +11,7 @@ export const writeXml = (nodes, options = {}) => {
10
11
  const fail = (code, message, path) => {
11
12
  diagnostics.push({ severity: 'error', code, message, path });
12
13
  };
13
- const escape = (value, attribute, path) => {
14
+ const escapeXml = (value, attribute, path) => {
14
15
  if (invalidCharacter.test(value)) {
15
16
  fail('invalid-character', 'The value contains a character XML 1.0 cannot represent.', path);
16
17
  }
@@ -27,7 +28,7 @@ export const writeXml = (nodes, options = {}) => {
27
28
  }
28
29
  if (node.type !== 'element') {
29
30
  if (node.type === 'text') {
30
- return escape(node.value, false, path);
31
+ return escapeXml(node.value, false, path);
31
32
  }
32
33
  if (invalidCharacter.test(node.value)) {
33
34
  fail('invalid-character', 'The CDATA contains a character XML 1.0 cannot represent.', path);
@@ -44,7 +45,8 @@ export const writeXml = (nodes, options = {}) => {
44
45
  fail('invalid-name', `Invalid XML name: ${input.prefix ? `${input.prefix}:` : ''}${input.name}`, path);
45
46
  }
46
47
  let prefix = input.prefix ?? '';
47
- const namespace = input.namespace ?? (prefix ? bindings.get(prefix) : attribute ? '' : bindings.get('')) ?? '';
48
+ const defaultNamespace = attribute ? '' : bindings.get('');
49
+ const namespace = input.namespace ?? (prefix ? bindings.get(prefix) : defaultNamespace) ?? '';
48
50
  if (prefix === 'xmlns' || namespace === XMLNS_NAMESPACE || (attribute && !prefix && input.name === 'xmlns')) {
49
51
  fail('reserved-namespace', 'Namespace declarations must be expressed through XML namespace metadata.', path);
50
52
  }
@@ -87,11 +89,11 @@ export const writeXml = (nodes, options = {}) => {
87
89
  fail('duplicate-attribute', `Duplicate XML attribute: ${qualified.name}`, path);
88
90
  }
89
91
  attributeNames.add(key);
90
- return ` ${qualified.name}="${escape(attribute.value, true, path)}"`;
92
+ return ` ${qualified.name}="${escapeXml(attribute.value, true, path)}"`;
91
93
  })
92
94
  .join('');
93
95
  const namespaces = [...declarations]
94
- .map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ''}="${escape(uri, true, path)}"`)
96
+ .map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ''}="${escapeXml(uri, true, path)}"`)
95
97
  .join('');
96
98
  const opening = `<${element.name}${namespaces}${attributes}`;
97
99
  if (node.children.length === 0) {
package/dist/resolve.d.ts CHANGED
@@ -11,7 +11,7 @@ type ResolvedSchema<T> = T extends undefined ? undefined : Readonly<SchemaObject
11
11
  $ref?: string;
12
12
  }>;
13
13
  export declare const resolve: {
14
- schema: <T extends MaybeRefSchemaObject | undefined>(schema: T) => ResolvedSchema<T>;
14
+ schema: <T extends MaybeRefSchemaObject | boolean | undefined>(schema: T) => ResolvedSchema<T>;
15
15
  };
16
16
  export {};
17
17
  //# sourceMappingURL=resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEtF;;;;;;;GAOG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,YAAY,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAWrG,eAAO,MAAM,OAAO;aACT,CAAC,SAAS,oBAAoB,GAAG,SAAS,UAAU,CAAC,KAAG,cAAc,CAAC,CAAC,CAAC;CAQnF,CAAA"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEtF;;;;;;;GAOG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,YAAY,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAoBrG,eAAO,MAAM,OAAO;aACT,CAAC,SAAS,oBAAoB,GAAG,OAAO,GAAG,SAAS,UAAU,CAAC,KAAG,cAAc,CAAC,CAAC,CAAC;CAc7F,CAAA"}
package/dist/resolve.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Type } from '@scalar/typebox';
2
+ import { getBooleanSchema } from './helpers/get-boolean-schema.js';
2
3
  import { getResolvedRef, mergeSiblingReferences } from './helpers/get-resolved-ref.js';
3
4
  import { compose } from './schemas/compose.js';
4
5
  import { coerceValue } from './schemas/typebox-coerce.js';
@@ -10,12 +11,26 @@ import { SchemaObjectSchema } from './schemas/v3.2/strict/openapi-document.js';
10
11
  * scope. `resolve.schema` runs once per property of every schema a render walks, and rebuilding the
11
12
  * composite per call dominated that walk.
12
13
  */
13
- const resolvedSchemaSchema = compose(SchemaObjectSchema, Type.Object({ $ref: Type.Optional(Type.String()) }));
14
+ // Rendering also consumes AsyncAPI schemas. Keep boolean children intact until their own rows
15
+ // resolve them, without widening the object-based OpenAPI document validation types.
16
+ const displaySchemaObject = {
17
+ ...SchemaObjectSchema,
18
+ $defs: {
19
+ ...SchemaObjectSchema.$defs,
20
+ SchemaObject: Type.Union([SchemaObjectSchema.$defs.SchemaObject, Type.Boolean()]),
21
+ },
22
+ };
23
+ const resolvedSchemaSchema = compose(displaySchemaObject, Type.Object({ $ref: Type.Optional(Type.String()) }));
14
24
  export const resolve = {
15
25
  schema: (schema) => {
16
26
  if (schema === undefined) {
17
27
  return undefined;
18
28
  }
29
+ // Resolve boolean targets before merging siblings, which assumes an object target.
30
+ const target = getResolvedRef(schema);
31
+ if (typeof target === 'boolean') {
32
+ return getBooleanSchema(target);
33
+ }
19
34
  const resoled = getResolvedRef(schema, mergeSiblingReferences);
20
35
  return coerceValue(resolvedSchemaSchema, resoled);
21
36
  },
@@ -14,11 +14,15 @@
14
14
  */
15
15
  export declare const XDisabledSchema: import("@scalar/typebox").TObject<{
16
16
  'x-disabled': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
17
+ 'x-scalar-disabled-properties': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TBoolean>>;
17
18
  }>;
18
19
  export type XDisabled = {
19
20
  'x-disabled'?: boolean;
21
+ /** Per-property overrides keyed by JSON-encoded paths. The empty path stores the inherited default. */
22
+ 'x-scalar-disabled-properties'?: Record<string, boolean>;
20
23
  };
21
24
  export declare const XDisabled: import("@scalar/validation").ObjectSchema<{
22
25
  'x-disabled': import("@scalar/validation").OptionalSchema<import("@scalar/validation").BooleanSchema>;
26
+ 'x-scalar-disabled-properties': import("@scalar/validation").OptionalSchema<import("@scalar/validation").RecordSchema<import("@scalar/validation").StringSchema, import("@scalar/validation").BooleanSchema>>;
23
27
  }>;
24
28
  //# sourceMappingURL=x-disabled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-disabled.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/example/x-disabled.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe;;EAE1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,SAAS;;EAQrB,CAAA"}
1
+ {"version":3,"file":"x-disabled.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/example/x-disabled.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,uGAAuG;IACvG,8BAA8B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACzD,CAAA;AAED,eAAO,MAAM,SAAS;;;EASrB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Type } from '@scalar/typebox';
2
- import { boolean, object, optional } from '@scalar/validation';
2
+ import { boolean, object, optional, record, string } from '@scalar/validation';
3
3
  /**
4
4
  * OpenAPI extension to control whether a parameter example is enabled (checkbox on) or disabled (checkbox off).
5
5
  *
@@ -16,9 +16,11 @@ import { boolean, object, optional } from '@scalar/validation';
16
16
  */
17
17
  export const XDisabledSchema = Type.Object({
18
18
  'x-disabled': Type.Optional(Type.Boolean()),
19
+ 'x-scalar-disabled-properties': Type.Optional(Type.Record(Type.String(), Type.Boolean())),
19
20
  });
20
21
  export const XDisabled = object({
21
22
  'x-disabled': optional(boolean()),
23
+ 'x-scalar-disabled-properties': optional(record(string(), boolean())),
22
24
  }, {
23
25
  typeName: 'XDisabled',
24
26
  typeComment: 'Whether a parameter example is disabled in the API client',