@scalar/workspace-store 0.59.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +6 -0
  3. package/dist/channel-example/build-connection-url.d.ts.map +1 -1
  4. package/dist/channel-example/build-connection-url.js +3 -3
  5. package/dist/channel-example/dedupe-requirements.d.ts +1 -1
  6. package/dist/channel-example/get-async-api-protocols.js +2 -2
  7. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +1 -1
  8. package/dist/channel-example/get-channel-connection-security.d.ts +1 -1
  9. package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
  10. package/dist/channel-example/get-channel-operations.js +4 -1
  11. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
  12. package/dist/channel-example/get-channel-parameters.js +3 -1
  13. package/dist/channel-example/resolve-channel.d.ts.map +1 -1
  14. package/dist/channel-example/resolve-channel.js +2 -0
  15. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
  16. package/dist/channel-example/resolve-operation-channel.js +4 -0
  17. package/dist/channel-example/resolve-operation-with-traits.js +2 -2
  18. package/dist/channel-example/servers.d.ts.map +1 -1
  19. package/dist/channel-example/servers.js +3 -1
  20. package/dist/channel-example/types.d.ts +1 -1
  21. package/dist/client.d.ts +1 -1
  22. package/dist/client.js +3 -3
  23. package/dist/entities/auth/schema.d.ts +470 -20
  24. package/dist/entities/auth/schema.d.ts.map +1 -1
  25. package/dist/entities/auth/schema.js +2 -2
  26. package/dist/events/definitions/auth.d.ts +2 -2
  27. package/dist/events/definitions/document.d.ts +1 -1
  28. package/dist/events/definitions/operation.d.ts +3 -2
  29. package/dist/events/definitions/operation.d.ts.map +1 -1
  30. package/dist/events/definitions/server.d.ts +1 -1
  31. package/dist/events/old-definitions.d.ts +1 -1
  32. package/dist/helpers/create-chunk-writer.d.ts +6 -0
  33. package/dist/helpers/create-chunk-writer.d.ts.map +1 -0
  34. package/dist/helpers/create-chunk-writer.js +44 -0
  35. package/dist/helpers/dynamic-ref.d.ts +13 -2
  36. package/dist/helpers/dynamic-ref.d.ts.map +1 -1
  37. package/dist/helpers/dynamic-ref.js +20 -7
  38. package/dist/helpers/encode-chunk-name.d.ts +3 -0
  39. package/dist/helpers/encode-chunk-name.d.ts.map +1 -0
  40. package/dist/helpers/encode-chunk-name.js +9 -0
  41. package/dist/helpers/for-each-path-item-operation.d.ts +2 -2
  42. package/dist/helpers/get-first-server.d.ts +1 -1
  43. package/dist/helpers/get-resolved-ref.d.ts +6 -1
  44. package/dist/helpers/get-resolved-ref.d.ts.map +1 -1
  45. package/dist/helpers/get-resolved-ref.js +3 -10
  46. package/dist/helpers/is-non-optional-security-requirement.d.ts +1 -1
  47. package/dist/helpers/merge-object.d.ts +2 -2
  48. package/dist/helpers/merge-object.d.ts.map +1 -1
  49. package/dist/helpers/merge-object.js +2 -5
  50. package/dist/mutators/auth.d.ts +1 -1
  51. package/dist/mutators/auth.d.ts.map +1 -1
  52. package/dist/mutators/auth.js +15 -6
  53. package/dist/mutators/index.d.ts +10 -10
  54. package/dist/mutators/operation/body.js +2 -2
  55. package/dist/mutators/operation/helpers/fetch-request-to-har.d.ts.map +1 -1
  56. package/dist/mutators/operation/helpers/fetch-request-to-har.js +12 -2
  57. package/dist/mutators/operation/helpers/har-to-operation.d.ts +1 -1
  58. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  59. package/dist/mutators/operation/helpers/har-to-operation.js +9 -5
  60. package/dist/mutators/operation/helpers/sync-path-parameters.d.ts +2 -2
  61. package/dist/mutators/operation/history.js +2 -2
  62. package/dist/mutators/operation/operation.d.ts.map +1 -1
  63. package/dist/mutators/operation/operation.js +4 -0
  64. package/dist/mutators/operation/parameters.js +1 -1
  65. package/dist/mutators/server.d.ts +3 -3
  66. package/dist/mutators/server.js +1 -1
  67. package/dist/mutators/tag.d.ts.map +1 -1
  68. package/dist/mutators/tag.js +4 -0
  69. package/dist/navigation/helpers/get-openapi-object.d.ts +1 -1
  70. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  71. package/dist/navigation/helpers/traverse-asyncapi-document.js +2 -2
  72. package/dist/navigation/helpers/traverse-description.d.ts +1 -1
  73. package/dist/navigation/helpers/traverse-document.d.ts +1 -1
  74. package/dist/navigation/helpers/traverse-examples.d.ts +12 -1
  75. package/dist/navigation/helpers/traverse-examples.d.ts.map +1 -1
  76. package/dist/navigation/helpers/traverse-examples.js +22 -1
  77. package/dist/navigation/helpers/traverse-paths.d.ts +1 -1
  78. package/dist/navigation/helpers/traverse-schemas.d.ts +1 -1
  79. package/dist/navigation/helpers/traverse-tags.d.ts +1 -1
  80. package/dist/navigation/helpers/traverse-webhooks.d.ts +1 -1
  81. package/dist/navigation/helpers/update-order-ids.d.ts +2 -2
  82. package/dist/navigation/index.d.ts +1 -0
  83. package/dist/navigation/index.d.ts.map +1 -1
  84. package/dist/navigation/index.js +1 -0
  85. package/dist/navigation/types.d.ts +1 -1
  86. package/dist/persistence/index.d.ts.map +1 -1
  87. package/dist/persistence/index.js +10 -10
  88. package/dist/persistence/indexdb.d.ts.map +1 -1
  89. package/dist/persistence/indexdb.js +7 -5
  90. package/dist/persistence/migrations/v2-team-to-local.d.ts.map +1 -1
  91. package/dist/persistence/migrations/v2-team-to-local.js +3 -4
  92. package/dist/plugins/bundler/index.d.ts +5 -2
  93. package/dist/plugins/bundler/index.d.ts.map +1 -1
  94. package/dist/plugins/bundler/index.js +24 -26
  95. package/dist/request-example/builder/body/build-request-body.d.ts +2 -1
  96. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  97. package/dist/request-example/builder/body/build-request-body.js +65 -4
  98. package/dist/request-example/builder/body/encode-multipart-body.d.ts +9 -0
  99. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -0
  100. package/dist/request-example/builder/body/encode-multipart-body.js +29 -0
  101. package/dist/request-example/builder/body/get-request-body-example.d.ts +1 -1
  102. package/dist/request-example/builder/body/get-selected-body-content-type.d.ts +1 -1
  103. package/dist/request-example/builder/body/schema-value-coercion.d.ts +1 -1
  104. package/dist/request-example/builder/body/schema-value-coercion.js +1 -1
  105. package/dist/request-example/builder/body/serialize-form-property.d.ts +1 -1
  106. package/dist/request-example/builder/body/serialize-multipart-array.d.ts +16 -0
  107. package/dist/request-example/builder/body/serialize-multipart-array.d.ts.map +1 -0
  108. package/dist/request-example/builder/body/serialize-multipart-array.js +37 -0
  109. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  110. package/dist/request-example/builder/build-request.js +12 -7
  111. package/dist/request-example/builder/header/build-request-parameters.d.ts +1 -1
  112. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  113. package/dist/request-example/builder/header/build-request-parameters.js +7 -1
  114. package/dist/request-example/builder/header/de-serialize-parameter.d.ts +1 -1
  115. package/dist/request-example/builder/header/de-serialize-parameter.d.ts.map +1 -1
  116. package/dist/request-example/builder/header/de-serialize-parameter.js +17 -6
  117. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  118. package/dist/request-example/builder/header/serialize-parameter.d.ts.map +1 -1
  119. package/dist/request-example/builder/header/serialize-parameter.js +13 -14
  120. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts +9 -1
  121. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  122. package/dist/request-example/builder/helpers/get-example-from-schema.js +255 -20
  123. package/dist/request-example/builder/helpers/get-example.d.ts +1 -1
  124. package/dist/request-example/builder/helpers/get-example.js +2 -2
  125. package/dist/request-example/builder/helpers/get-resolved-url.d.ts +1 -1
  126. package/dist/request-example/builder/helpers/get-server-variables.d.ts +1 -1
  127. package/dist/request-example/builder/index.d.ts +1 -0
  128. package/dist/request-example/builder/index.d.ts.map +1 -1
  129. package/dist/request-example/builder/index.js +1 -0
  130. package/dist/request-example/builder/request-factory.d.ts +2 -2
  131. package/dist/request-example/builder/security/broker-scheme-types.d.ts.map +1 -1
  132. package/dist/request-example/builder/security/broker-scheme-types.js +2 -2
  133. package/dist/request-example/builder/security/build-request-security.d.ts.map +1 -1
  134. package/dist/request-example/builder/security/build-request-security.js +3 -4
  135. package/dist/request-example/builder/security/secret-types.d.ts +13 -4
  136. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  137. package/dist/request-example/context/get-request-example-context.d.ts +3 -3
  138. package/dist/request-example/context/get-request-example-context.js +1 -1
  139. package/dist/request-example/context/headers.d.ts +1 -1
  140. package/dist/request-example/context/headers.js +1 -1
  141. package/dist/request-example/context/helpers/combine-params.d.ts +1 -1
  142. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts +16 -3
  143. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  144. package/dist/request-example/context/security/extract-security-scheme-secrets.js +21 -19
  145. package/dist/request-example/context/security/get-security-requirements.d.ts +2 -2
  146. package/dist/request-example/context/security/get-security-schemes.d.ts +1 -1
  147. package/dist/request-example/context/security/get-selected-security.d.ts +1 -1
  148. package/dist/request-example/context/security/is-auth-optional.d.ts +1 -1
  149. package/dist/request-example/context/security/merge-security.d.ts +3 -3
  150. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  151. package/dist/request-example/context/security/merge-security.js +40 -11
  152. package/dist/request-example/context/servers.d.ts +2 -2
  153. package/dist/request-example/functions.d.ts.map +1 -1
  154. package/dist/request-example/index.d.ts +1 -1
  155. package/dist/request-example/index.d.ts.map +1 -1
  156. package/dist/request-example/index.js +1 -1
  157. package/dist/resolve.d.ts +1 -1
  158. package/dist/resolve.js +1 -1
  159. package/dist/schemas/extensions/document/x-scalar-default-request-body-view.d.ts +23 -0
  160. package/dist/schemas/extensions/document/x-scalar-default-request-body-view.d.ts.map +1 -0
  161. package/dist/schemas/extensions/document/x-scalar-default-request-body-view.js +23 -0
  162. package/dist/schemas/navigation.d.ts +4 -4
  163. package/dist/schemas/navigation.js +1 -1
  164. package/dist/schemas/reference-config/index.d.ts +94 -4
  165. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  166. package/dist/schemas/reference-config/settings.d.ts +95 -5
  167. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  168. package/dist/schemas/reference-config/settings.js +1 -1
  169. package/dist/schemas/type-guards.d.ts +1 -1
  170. package/dist/schemas/v3.1/openapi/index.d.ts +2 -0
  171. package/dist/schemas/v3.1/openapi/index.d.ts.map +1 -1
  172. package/dist/schemas/v3.1/openapi/index.js +13 -1
  173. package/dist/schemas/v3.1/strict/openapi-document.d.ts +284 -1
  174. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  175. package/dist/schemas/v3.1/strict/openapi-document.js +2 -1
  176. package/dist/schemas/v3.1/strict/security-scheme.d.ts +13 -1
  177. package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
  178. package/dist/schemas/v3.1/strict/security-scheme.js +11 -1
  179. package/dist/schemas/v3.2/openapi/index.d.ts +2 -0
  180. package/dist/schemas/v3.2/openapi/index.d.ts.map +1 -1
  181. package/dist/schemas/v3.2/openapi/index.js +13 -1
  182. package/dist/schemas/v3.2/strict/oauth-flow.d.ts +23 -1
  183. package/dist/schemas/v3.2/strict/oauth-flow.d.ts.map +1 -1
  184. package/dist/schemas/v3.2/strict/oauth-flow.js +6 -1
  185. package/dist/schemas/v3.2/strict/oauthflows.d.ts +20 -0
  186. package/dist/schemas/v3.2/strict/oauthflows.d.ts.map +1 -1
  187. package/dist/schemas/v3.2/strict/openapi-document.d.ts +1439 -141
  188. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  189. package/dist/schemas/v3.2/strict/openapi-document.js +2 -1
  190. package/dist/schemas/v3.2/strict/security-scheme.d.ts +29 -6
  191. package/dist/schemas/v3.2/strict/security-scheme.d.ts.map +1 -1
  192. package/dist/schemas/v3.2/strict/security-scheme.js +16 -3
  193. package/dist/schemas/workspace-specification/index.d.ts +1 -1
  194. package/dist/schemas/workspace.d.ts +1 -1
  195. package/dist/server.d.ts +1 -1
  196. package/dist/server.d.ts.map +1 -1
  197. package/dist/server.js +23 -20
  198. package/package.json +9 -9
@@ -1,3 +1,4 @@
1
+ import { isObjectLike } from '@scalar/helpers/object/is-object';
1
2
  /**
2
3
  * Shared parameter serialization utilities for OpenAPI style values.
3
4
  * Used by both build-request-parameters and process-parameters.
@@ -19,7 +20,7 @@ export const serializeContentValue = (value, contentType) => {
19
20
  return value;
20
21
  }
21
22
  // Handle JSON content types
22
- if (contentType.includes('json') || (typeof value === 'object' && value !== null && !Array.isArray(value))) {
23
+ if (contentType.includes('json') || (isObjectLike(value) && !Array.isArray(value))) {
23
24
  return JSON.stringify(value);
24
25
  }
25
26
  // Default: convert to string
@@ -45,7 +46,7 @@ export const serializeSimpleStyle = (value, explode) => {
45
46
  return value.join(',');
46
47
  }
47
48
  // Handle objects
48
- if (typeof value === 'object' && value !== null) {
49
+ if (isObjectLike(value)) {
49
50
  const entries = Object.entries(value);
50
51
  if (explode) {
51
52
  // Simple explode object: R=100,G=200,B=150
@@ -81,14 +82,14 @@ export const serializeFormStyle = (value, explode) => {
81
82
  return value.join(',');
82
83
  }
83
84
  // Handle objects with explode
84
- if (typeof value === 'object' && value !== null && explode) {
85
+ if (isObjectLike(value) && explode) {
85
86
  return Object.entries(value).map(([k, v]) => ({
86
87
  key: k,
87
88
  value: v,
88
89
  }));
89
90
  }
90
91
  // Handle objects without explode
91
- if (typeof value === 'object' && value !== null) {
92
+ if (isObjectLike(value)) {
92
93
  return Object.entries(value)
93
94
  .map(([k, v]) => `${k},${v}`)
94
95
  .join(',');
@@ -121,19 +122,19 @@ export const serializeFormStyleForCookies = (value, explode) => {
121
122
  return value.map((v) => (v === null ? 'null' : String(v))).join(',');
122
123
  }
123
124
  // Handle objects with explode
124
- if (typeof value === 'object' && value !== null && explode) {
125
+ if (isObjectLike(value) && explode) {
125
126
  return Object.entries(value).map(([k, v]) => ({
126
127
  key: k,
127
128
  value: v,
128
129
  }));
129
130
  }
130
131
  // Handle objects without explode - recursively flatten nested objects
131
- if (typeof value === 'object' && value !== null) {
132
+ if (isObjectLike(value)) {
132
133
  const flattenObject = (obj) => {
133
134
  const result = [];
134
135
  for (const [key, val] of Object.entries(obj)) {
135
136
  // Recursively flatten nested objects
136
- if (typeof val === 'object' && val !== null && !Array.isArray(val)) {
137
+ if (isObjectLike(val) && !Array.isArray(val)) {
137
138
  result.push(key, ...flattenObject(val));
138
139
  }
139
140
  // Handle primitive values
@@ -161,7 +162,7 @@ export const serializeSpaceDelimitedStyle = (value) => {
161
162
  return value.join(' ');
162
163
  }
163
164
  // Handle objects
164
- if (typeof value === 'object' && value !== null) {
165
+ if (isObjectLike(value)) {
165
166
  return Object.entries(value)
166
167
  .map(([k, v]) => `${k} ${v}`)
167
168
  .join(' ');
@@ -182,10 +183,8 @@ export const serializePipeDelimitedStyle = (value) => {
182
183
  return value.join('|');
183
184
  }
184
185
  // Handle objects
185
- if (typeof value === 'object' && value !== null) {
186
- return Object.entries(value)
187
- .flat()
188
- .join('|');
186
+ if (isObjectLike(value)) {
187
+ return Object.entries(value).flat().join('|');
189
188
  }
190
189
  // Handle primitives (shouldn't happen for pipeDelimited)
191
190
  return String(value);
@@ -213,7 +212,7 @@ export const serializeDeepObjectStyle = (paramName, value) => {
213
212
  append(`${fullKey}[]`, item);
214
213
  }
215
214
  }
216
- else if (typeof val === 'object' && val !== null) {
215
+ else if (isObjectLike(val)) {
217
216
  flatten(val, fullKey);
218
217
  }
219
218
  else {
@@ -228,7 +227,7 @@ export const serializeDeepObjectStyle = (paramName, value) => {
228
227
  append(`${prefix}[${key}]`, val);
229
228
  }
230
229
  };
231
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
230
+ if (isObjectLike(value) && !Array.isArray(value)) {
232
231
  flatten(value, paramName);
233
232
  }
234
233
  return result;
@@ -1,5 +1,5 @@
1
1
  import { type DynamicScope } from '../../../helpers/dynamic-ref.js';
2
- import type { SchemaObject } from '../../../schemas/v3.1/strict/openapi-document.js';
2
+ import type { SchemaObject } from '../../../schemas/v3.2/strict/openapi-document.js';
3
3
  type GetExampleFromSchemaOptions = {
4
4
  /** Fallback string for empty string values. */
5
5
  emptyString?: string;
@@ -11,6 +11,14 @@ type GetExampleFromSchemaOptions = {
11
11
  variables?: Record<string, unknown>;
12
12
  /** Whether to omit empty and optional properties. */
13
13
  omitEmptyAndOptionalProperties?: boolean;
14
+ /**
15
+ * Whether to keep schemas annotated `deprecated: true`.
16
+ *
17
+ * `deprecated` says a field is discouraged, not that it is absent from the wire, so a caller
18
+ * that must produce a value satisfying the schema — a mock server response, for instance —
19
+ * sets this. Defaults to omitting, which is what a request-body form-filler wants.
20
+ */
21
+ includeDeprecated?: boolean;
14
22
  /** Selected oneOf/anyOf variants keyed by schema path. */
15
23
  compositionSelection?: Record<string, number>;
16
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqD,MAAM,uBAAuB,CAAA;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAitB1E,KAAK,2BAA2B,GAAG;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,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,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9C,CAAA;AAeD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,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,OAwMF,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;AA+wB1E,KAAK,2BAA2B,GAAG;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,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;AA+ND;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,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,OAmNF,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { isDefined } from '@scalar/helpers/array/is-defined';
2
+ import { escapeJsonPointer } from '@scalar/helpers/json/escape-json-pointer';
2
3
  import { isDynamicRef, pushDynamicScope, resolveDynamicRef } from '../../../helpers/dynamic-ref.js';
3
4
  import { unpackProxyObject } from '../../../helpers/unpack-proxy.js';
4
5
  import { resolve } from '../../../resolve.js';
@@ -70,7 +71,10 @@ const guessFromFormat = (schema, makeUpRandomData = false, fallback = '') => {
70
71
  }
71
72
  // Return format-specific example if we have one and are making up data
72
73
  if (makeUpRandomData && 'format' in schema && schema.format) {
73
- return genericExampleValues[schema.format] ?? fallback;
74
+ // Some generators emit version-specific UUID formats (for example FastAPI/Pydantic
75
+ // uses uuid1, uuid3, uuid4 and uuid5). Treat them all like a regular uuid.
76
+ const format = /^uuid[1-8]$/.test(schema.format) ? 'uuid' : schema.format;
77
+ return genericExampleValues[format] ?? fallback;
74
78
  }
75
79
  return fallback;
76
80
  };
@@ -79,6 +83,18 @@ const guessFromFormat = (schema, makeUpRandomData = false, fallback = '') => {
79
83
  * Uses the resolved schema object as the key for efficient lookups.
80
84
  */
81
85
  const resultCache = new WeakMap();
86
+ /**
87
+ * Set once the depth cap has truncated something in the current top-level call.
88
+ *
89
+ * A truncated value only holds at the level it was produced at, but `resultCache` keys carry no level,
90
+ * so a value assembled around one must not be stored. Composition reaches that case: an `allOf` member
91
+ * climbs a level without growing `schemaPath`, so a schema rendered just above the cap in one chain
92
+ * shares its key with the same schema used at the top of a document, and the shallow use is served the
93
+ * truncated result. Widening the key would cost the cache its hits everywhere, so storing simply stops
94
+ * for the rest of the call instead. The walk is synchronous, so resetting at level 0 scopes this to one
95
+ * top-level call.
96
+ */
97
+ let truncated = false;
82
98
  /** Cache required property names per parent schema for O(1) membership checks */
83
99
  const requiredNamesCache = new WeakMap();
84
100
  /** Normalize schema identity for cache and cycle tracking */
@@ -115,7 +131,7 @@ const getRequiredNames = (parentSchema) => {
115
131
  * identity would leak one scope's result into another.
116
132
  */
117
133
  const cache = (schema, result, cacheKey, skip = false) => {
118
- if (skip || typeof result !== 'object' || result === null) {
134
+ if (skip || truncated || typeof result !== 'object' || result === null) {
119
135
  return result;
120
136
  }
121
137
  const rawSchema = getSchemaCacheTarget(schema);
@@ -136,8 +152,8 @@ const isComposed = (schema) => !!(schema.allOf || schema.oneOf || schema.anyOf);
136
152
  * Properties are omitted if they are not required and the option is enabled.
137
153
  */
138
154
  const shouldOmitProperty = (schema, parentSchema, propertyName, options) => {
139
- // Early exits for schemas that should not be included (deprecated, readOnly, writeOnly)
140
- if (schema.deprecated ||
155
+ // Early exits for schemas that should not be included (deprecated unless opted in, readOnly, writeOnly)
156
+ if ((schema.deprecated && options?.includeDeprecated !== true) ||
141
157
  (options?.mode === 'write' && schema.readOnly) ||
142
158
  (options?.mode === 'read' && schema.writeOnly)) {
143
159
  return true;
@@ -292,6 +308,44 @@ const getCompositionSelectionIndex = (schemaPath, composition, options, length)
292
308
  }
293
309
  return Math.max(0, Math.min(rawIndex, length - 1));
294
310
  };
311
+ /**
312
+ * Use the discriminator as a generation hint. Only referenced variants have
313
+ * implicit names; inline titles are display labels, not discriminator mappings.
314
+ */
315
+ const getDiscriminatorSelectionIndex = (schema, variants, options, value) => {
316
+ const discriminator = schema.discriminator;
317
+ if (discriminator?.defaultMapping === undefined) {
318
+ return undefined;
319
+ }
320
+ const property = 'properties' in schema ? schema.properties?.[discriminator.propertyName] : undefined;
321
+ const resolvedProperty = property ? resolve.schema(property) : undefined;
322
+ const propertyName = options?.xml && resolvedProperty && 'xml' in resolvedProperty
323
+ ? (resolvedProperty.xml?.name ?? discriminator.propertyName)
324
+ : discriminator.propertyName;
325
+ const variableValue = resolvedProperty?.['x-variable']
326
+ ? options?.variables?.[resolvedProperty['x-variable']]
327
+ : undefined;
328
+ const declaredValue = resolvedProperty ? getDeclaredValue(resolvedProperty) : undefined;
329
+ const schemaValue = variableValue !== undefined ? variableValue : declaredValue;
330
+ const tag = value ? value[propertyName] : schemaValue;
331
+ const findReference = (reference) => variants.findIndex((variant) => '$ref' in variant && variant.$ref === reference);
332
+ const findComponent = (name) => findReference(`#/components/schemas/${escapeJsonPointer(name)}`);
333
+ const findTarget = (target) => {
334
+ // Prefer a component name when the same string could also be a relative URI.
335
+ const componentIndex = findComponent(target);
336
+ return componentIndex >= 0 ? componentIndex : findReference(target);
337
+ };
338
+ if (typeof tag === 'string') {
339
+ const explicit = discriminator.mapping && Object.hasOwn(discriminator.mapping, tag) ? discriminator.mapping[tag] : undefined;
340
+ const mappedIndex = explicit === undefined ? findComponent(tag) : findTarget(explicit);
341
+ // A broken explicit mapping must not silently select the fallback.
342
+ if (explicit !== undefined || mappedIndex >= 0) {
343
+ return mappedIndex >= 0 ? mappedIndex : undefined;
344
+ }
345
+ }
346
+ const fallbackIndex = findTarget(discriminator.defaultMapping);
347
+ return fallbackIndex >= 0 ? fallbackIndex : undefined;
348
+ };
295
349
  /**
296
350
  * Read the numeric `x-order` extension value from a raw property entry, if present.
297
351
  * The entry may be a schema or a `$ref` object, so we check membership before reading.
@@ -378,15 +432,13 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
378
432
  const isAnyType = schema.additionalProperties === true ||
379
433
  (typeof schema.additionalProperties === 'object' && Object.keys(schema.additionalProperties).length === 0);
380
434
  // Check for explicit x-additionalPropertiesName first
381
- const hasCustomName = typeof additional === 'object' &&
382
- 'x-additionalPropertiesName' in additional &&
383
- typeof additional['x-additionalPropertiesName'] === 'string' &&
384
- additional['x-additionalPropertiesName'].trim().length > 0;
435
+ const customName = typeof additional === 'object' && 'x-additionalPropertiesName' in additional
436
+ ? additional['x-additionalPropertiesName']
437
+ : undefined;
438
+ const hasCustomName = typeof customName === 'string' && customName.trim().length > 0;
385
439
  // Use propertyNames enum values as example keys when no custom name is set
386
440
  const propertyNamesEnum = hasCustomName ? undefined : getPropertyNamesEnumValues(schema);
387
- const additionalName = hasCustomName
388
- ? additional['x-additionalPropertiesName'].trim()
389
- : DEFAULT_ADDITIONAL_PROPERTIES_NAME;
441
+ const additionalName = hasCustomName ? customName.trim() : DEFAULT_ADDITIONAL_PROPERTIES_NAME;
390
442
  const additionalValue = isAnyType
391
443
  ? 'anything'
392
444
  : typeof additional === 'object'
@@ -408,7 +460,9 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
408
460
  const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
409
461
  const oneOfAnyOf = compositionKeyword ? schema[compositionKeyword] : undefined;
410
462
  if (compositionKeyword && oneOfAnyOf?.length) {
411
- const index = getCompositionSelectionIndex(schemaPath, compositionKeyword, options, oneOfAnyOf.length) ?? 0;
463
+ const index = getCompositionSelectionIndex(schemaPath, compositionKeyword, options, oneOfAnyOf.length) ??
464
+ getDiscriminatorSelectionIndex(schema, oneOfAnyOf, options, response) ??
465
+ 0;
412
466
  const chosen = resolve.schema(oneOfAnyOf[index]);
413
467
  if (chosen) {
414
468
  Object.assign(response, getExampleFromSchema(chosen, options, {
@@ -503,7 +557,9 @@ const handleArraySchema = (schema, options, level, seen, cacheKey, schemaPath, d
503
557
  const compositionKeyword = items.oneOf ? 'oneOf' : items.anyOf ? 'anyOf' : undefined;
504
558
  const union = compositionKeyword ? items[compositionKeyword] : undefined;
505
559
  if (compositionKeyword && union && union.length > 0) {
506
- const selectedIndex = getCompositionSelectionIndex(itemsSchemaPath, compositionKeyword, options, union.length) ?? 0;
560
+ const selectedIndex = getCompositionSelectionIndex(itemsSchemaPath, compositionKeyword, options, union.length) ??
561
+ getDiscriminatorSelectionIndex(items, union, options) ??
562
+ 0;
507
563
  const selected = union[selectedIndex];
508
564
  const ex = getExampleFromSchema(resolve.schema(selected), options, {
509
565
  level: level + 1,
@@ -581,10 +637,181 @@ const createOptionsCacheKey = (options) => JSON.stringify({
581
637
  mode: options?.mode,
582
638
  variables: options?.variables,
583
639
  omitEmptyAndOptionalProperties: options?.omitEmptyAndOptionalProperties,
640
+ // Load-bearing: `resultCache` is a module global keyed by schema identity plus this string, and
641
+ // the lookup happens before `shouldOmitProperty` runs. Without this entry an include-caller's
642
+ // populated object could be handed back to a default caller, and vice versa. `JSON.stringify`
643
+ // drops `undefined`, so existing callers' keys stay byte-identical.
644
+ includeDeprecated: options?.includeDeprecated,
584
645
  compositionSelection: options?.compositionSelection
585
646
  ? Object.entries(options.compositionSelection).sort(([a], [b]) => a.localeCompare(b))
586
647
  : undefined,
587
648
  });
649
+ /** Stand-in for a truncated schema whose shape cannot be read off the document. */
650
+ const MAX_DEPTH_EXCEEDED = '[Max Depth Exceeded]';
651
+ /** How long a chain of composition wrappers may be unwrapped before the stack becomes the concern. */
652
+ const MAX_COMPOSITION_DEPTH = MAX_LEVELS_DEEP * 5;
653
+ /** Read a schema's declared types as a list, so `type: 'object'` and `type: ['object']` behave alike. */
654
+ const getDeclaredTypes = (schema) => {
655
+ if (!('type' in schema) || !schema.type) {
656
+ return [];
657
+ }
658
+ return Array.isArray(schema.type) ? schema.type : [schema.type];
659
+ };
660
+ /** Return the empty container a schema declares, or `undefined` when it declares neither. */
661
+ const getEmptyContainer = (schema) => {
662
+ const types = getDeclaredTypes(schema);
663
+ if ('properties' in schema || types.includes('object')) {
664
+ return {};
665
+ }
666
+ if ('items' in schema || types.includes('array')) {
667
+ return [];
668
+ }
669
+ return undefined;
670
+ };
671
+ /** Pick the `oneOf`/`anyOf` variant the walk itself would have rendered, honoring an explicit selection. */
672
+ const getSelectedVariant = (schema, options, schemaPath) => {
673
+ const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
674
+ const variants = compositionKeyword ? schema[compositionKeyword] : undefined;
675
+ if (!compositionKeyword || !Array.isArray(variants) || variants.length === 0) {
676
+ return undefined;
677
+ }
678
+ const index = getCompositionSelectionIndex(schemaPath, compositionKeyword, options, variants.length) ??
679
+ getDiscriminatorSelectionIndex(schema, variants, options);
680
+ const candidate = index !== undefined
681
+ ? variants[index]
682
+ : variants.find((variant) => {
683
+ const resolved = resolve.schema(variant);
684
+ return resolved && (!('type' in resolved) || resolved.type !== 'null');
685
+ });
686
+ return candidate ? resolve.schema(candidate) : undefined;
687
+ };
688
+ /**
689
+ * Return the value a schema states outright, in the order the walk prefers them.
690
+ *
691
+ * The walk applies this before the cap, so a truncated schema has already had its turn — but a
692
+ * composition member reached from below the cap has not, and answering an `allOf`-wrapped enum with an
693
+ * empty string hands back a value that very schema forbids.
694
+ */
695
+ const getDeclaredValue = (schema) => {
696
+ if (Array.isArray(schema.examples) && schema.examples.length > 0) {
697
+ return schema.examples[0];
698
+ }
699
+ if (schema.example !== undefined) {
700
+ return schema.example;
701
+ }
702
+ if (schema.default !== undefined) {
703
+ const normalizedDefault = normalizeSchemaDefault(schema);
704
+ if (normalizedDefault !== INVALID_DEFAULT) {
705
+ return normalizedDefault;
706
+ }
707
+ }
708
+ if (schema.const !== undefined) {
709
+ return schema.const;
710
+ }
711
+ if (Array.isArray(schema.enum) && schema.enum.length > 0) {
712
+ return schema.enum[0];
713
+ }
714
+ return undefined;
715
+ };
716
+ /**
717
+ * Describe a composed schema by the member the walk itself would have rendered.
718
+ * Returns `undefined` when no member describes a shape.
719
+ */
720
+ const describeComposition = (schema, options, schemaPath, seen) => {
721
+ const variant = getSelectedVariant(schema, options, schemaPath);
722
+ if (variant) {
723
+ return getMaxDepthValue(variant, options, schemaPath, seen);
724
+ }
725
+ if (!Array.isArray(schema.allOf) || schema.allOf.length === 0) {
726
+ return undefined;
727
+ }
728
+ // `allOf` merges every member, so merge their truncated values the same way. Members that describe
729
+ // nothing contribute nothing rather than clobbering the ones that do.
730
+ let merged = undefined;
731
+ let choiceIndex = 0;
732
+ for (const member of schema.allOf) {
733
+ const resolved = resolve.schema(member);
734
+ // Each direct choice member gets its own ordinal in the path, the same way the walk keys them, so
735
+ // an explicit selection on an `allOf`-wrapped `oneOf` still resolves here.
736
+ const isChoiceMember = !!resolved && (Array.isArray(resolved.oneOf) || Array.isArray(resolved.anyOf));
737
+ const memberSchemaPath = isChoiceMember ? [...schemaPath, String(choiceIndex++)] : schemaPath;
738
+ const value = resolved ? getMaxDepthValue(resolved, options, memberSchemaPath, seen) : undefined;
739
+ if (value !== undefined && value !== MAX_DEPTH_EXCEEDED) {
740
+ merged = mergeExamples(merged, value);
741
+ }
742
+ }
743
+ return merged;
744
+ };
745
+ /**
746
+ * Build the value that stands in for a schema the recursion depth cap cut off.
747
+ *
748
+ * The stand-in is still read as an example of the schema it replaced, so a plain string makes the
749
+ * example contradict its own type: a mock server answering a `type: object` field with
750
+ * `[Max Depth Exceeded]` hands a strict SDK decoder a body it cannot parse. Describe the declared
751
+ * type instead, dispatching in the order the walk does, so a truncated value differs from a full render
752
+ * in having no children. A schema that describes no shape at all keeps the sentinel, which is then the
753
+ * only signal that truncation happened.
754
+ *
755
+ * Two deliberate departures from the walk, both answering with the declared container where the walk
756
+ * answers `null`: a container spelled as a list (`type: ['object']`, or `['object', 'null']`) is read
757
+ * here as the container it names, where the walk's strict comparison misses it.
758
+ *
759
+ * The value is empty rather than complete: satisfying `required` or `minItems` means descending
760
+ * again, which is exactly what the cap exists to prevent.
761
+ */
762
+ const getMaxDepthValue = (schema, options, schemaPath, seen = new Set()) => {
763
+ // A stated value beats any stand-in, and matches what a full render would have produced.
764
+ const declared = getDeclaredValue(schema);
765
+ if (declared !== undefined) {
766
+ return declared;
767
+ }
768
+ const container = getEmptyContainer(schema);
769
+ if (container !== undefined) {
770
+ // Children were dropped here, so anything assembled around this value is level-bound too.
771
+ truncated = true;
772
+ return container;
773
+ }
774
+ // A schema with no children renders the same at every level, so nothing is lost and the cache stays
775
+ // usable for the rest of the call.
776
+ const makeUpRandomData = !!options?.emptyString;
777
+ const primitive = getPrimitiveValue(schema, makeUpRandomData, options?.emptyString);
778
+ if (primitive !== undefined) {
779
+ return primitive;
780
+ }
781
+ // A wrapper such as `allOf: [$ref]` declares no type of its own, so describe its members instead.
782
+ // Unwrapping runs outside the walk's own cycle guard, so it carries one: refusing to re-enter a
783
+ // wrapper already on the path terminates a self-reference without capping how long a legitimate
784
+ // inheritance chain may be. `seen` holds exactly the path, so its size bounds the stack against a
785
+ // pathological chain, the way `schemaAllowsValue` bounds its own recursion.
786
+ const target = getSchemaCacheTarget(schema);
787
+ if (!seen.has(target) && seen.size < MAX_COMPOSITION_DEPTH) {
788
+ seen.add(target);
789
+ const composed = describeComposition(schema, options, schemaPath, seen);
790
+ seen.delete(target);
791
+ if (composed !== undefined) {
792
+ return composed;
793
+ }
794
+ }
795
+ else {
796
+ // A description declined is never the value a full render would have produced.
797
+ truncated = true;
798
+ }
799
+ const unionPrimitive = getUnionPrimitiveValue(schema, makeUpRandomData, options?.emptyString);
800
+ if (unionPrimitive !== undefined) {
801
+ return unionPrimitive;
802
+ }
803
+ // A schema that declares `null` has exactly one valid value, which is what the walk falls back to.
804
+ if (getDeclaredTypes(schema).includes('null')) {
805
+ return null;
806
+ }
807
+ // A composition or a negative constraint none of the above could describe still says something about
808
+ // the value, and the walk answers both with `null` rather than a value of no particular type.
809
+ if (isComposed(schema) || 'not' in schema) {
810
+ return null;
811
+ }
812
+ truncated = true;
813
+ return MAX_DEPTH_EXCEEDED;
814
+ };
588
815
  /**
589
816
  * Generate an example value from a given OpenAPI SchemaObject.
590
817
  *
@@ -601,6 +828,10 @@ const createOptionsCacheKey = (options) => JSON.stringify({
601
828
  * @returns An example value for the given schema.
602
829
  */
603
830
  export const getExampleFromSchema = (schema, options, { level = 0, parentSchema, name, seen = new WeakSet(), schemaPath = [], dynamicScope = [], } = {}) => {
831
+ // A truncation only taints the call it happened in, so every top-level call starts clean.
832
+ if (level === 0) {
833
+ truncated = false;
834
+ }
604
835
  // Resolve any $ref references to get the actual schema
605
836
  const _schema = resolve.schema(schema);
606
837
  if (!isDefined(_schema)) {
@@ -645,14 +876,9 @@ export const getExampleFromSchema = (schema, options, { level = 0, parentSchema,
645
876
  return cached;
646
877
  }
647
878
  }
648
- // Prevent infinite recursion in circular references
649
- if (level > MAX_LEVELS_DEEP) {
650
- seen.delete(targetValue);
651
- return '[Max Depth Exceeded]';
652
- }
653
879
  // Determine if we should generate realistic example data
654
880
  const makeUpRandomData = !!options?.emptyString;
655
- // Early exits for schemas that should not be included (deprecated, readOnly, writeOnly, omitEmptyAndOptionalProperties)
881
+ // Early exits for schemas that should not be included (deprecated unless opted in, readOnly, writeOnly, omitEmptyAndOptionalProperties)
656
882
  if (shouldOmitProperty(_schema, parentSchema, name, options)) {
657
883
  seen.delete(targetValue);
658
884
  return undefined;
@@ -694,6 +920,14 @@ export const getExampleFromSchema = (schema, options, { level = 0, parentSchema,
694
920
  seen.delete(targetValue);
695
921
  return cache(_schema, _schema.enum[0], cacheKey, skipCache);
696
922
  }
923
+ // Stop descending once the walk is too deep to keep going, which also breaks circular references.
924
+ // Everything above still applied, so an explicit example, `const` or `enum` wins here as it would at
925
+ // any other level; only the children are given up on.
926
+ if (level > MAX_LEVELS_DEEP) {
927
+ seen.delete(targetValue);
928
+ // Deliberately not cached: the value holds only at this level, and the cache key carries none.
929
+ return getMaxDepthValue(_schema, options, schemaPath);
930
+ }
697
931
  // Handle object types - check for properties to identify objects
698
932
  if ('properties' in _schema || ('type' in _schema && _schema.type === 'object')) {
699
933
  const result = handleObjectSchema(_schema, options, level, seen, cacheKey, schemaPath, dynamicScope);
@@ -716,7 +950,8 @@ export const getExampleFromSchema = (schema, options, { level = 0, parentSchema,
716
950
  const compositionKeyword = _schema.oneOf ? 'oneOf' : _schema.anyOf ? 'anyOf' : undefined;
717
951
  const discriminate = compositionKeyword ? _schema[compositionKeyword] : undefined;
718
952
  if (compositionKeyword && Array.isArray(discriminate) && discriminate.length > 0) {
719
- const index = getCompositionSelectionIndex(schemaPath, compositionKeyword, options, discriminate.length);
953
+ const index = getCompositionSelectionIndex(schemaPath, compositionKeyword, options, discriminate.length) ??
954
+ getDiscriminatorSelectionIndex(_schema, discriminate, options);
720
955
  const candidate = index !== undefined
721
956
  ? discriminate[index]
722
957
  : discriminate.find((item) => {
@@ -1,4 +1,4 @@
1
- import type { ExampleObject, MediaTypeObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { ExampleObject, MediaTypeObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
2
2
  /**
3
3
  * Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
4
4
  * Or the [deprecated] `example` field.
@@ -1,7 +1,7 @@
1
1
  import { getResolvedRef } from '../../../helpers/get-resolved-ref.js';
2
2
  /** Helper to get example from examples object with fallback to example field */
3
3
  const getExampleFromExamples = (examples, exampleField, exampleName) => {
4
- if (!examples && !exampleField) {
4
+ if (!examples && exampleField === undefined) {
5
5
  return undefined;
6
6
  }
7
7
  const hasExamples = !!examples && Object.keys(examples).length > 0;
@@ -43,7 +43,7 @@ export const getExample = (param, exampleName, contentType) => {
43
43
  }
44
44
  // Derive value from the schema
45
45
  const resolvedParam = getResolvedRef(param);
46
- if ('schema' in resolvedParam && resolvedParam.schema) {
46
+ if (resolvedParam && 'schema' in resolvedParam && resolvedParam.schema) {
47
47
  const schema = resolvedParam.schema;
48
48
  // Default value
49
49
  if ('default' in schema && schema.default !== undefined) {
@@ -1,4 +1,4 @@
1
- import type { ServerObject } from '../../../schemas/v3.1/strict/server.js';
1
+ import type { ServerObject } from '../../../schemas/v3.2/strict/server.js';
2
2
  /**
3
3
  * Resolves the full request URL by:
4
4
  * 1. Applying OpenAPI server variables to the server URL template.
@@ -1,4 +1,4 @@
1
- import type { ServerObject } from '../../../schemas/v3.1/strict/server.js';
1
+ import type { ServerObject } from '../../../schemas/v3.2/strict/server.js';
2
2
  /**
3
3
  * Extracts the default values of variables defined in a ServerObject into a simple key-value map.
4
4
  * Ignores variables with no default value.
@@ -2,6 +2,7 @@ export { getExampleFromBody, getSchemaExampleFromBody } from './body/get-request
2
2
  export { getSelectedBodyContentType } from './body/get-selected-body-content-type.js';
3
3
  export { buildDottedNestedRowPredicate, coerceLeafValueToSchemaType, coerceUntypedValue, resolveLeafSchema, } from './body/schema-value-coercion.js';
4
4
  export { type SerializedFormProperty, serializeFormPropertyWithEncoding } from './body/serialize-form-property.js';
5
+ export { serializeMultipartArray } from './body/serialize-multipart-array.js';
5
6
  export { BUILD_REQUEST_FAILED, type BuildRequestData, type BuildRequestFailureCode, type BuildRequestResult, type RequestPayload, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
6
7
  export { deSerializeParameter, deSerializeSchemaValue } from './header/de-serialize-parameter.js';
7
8
  export { filterGlobalCookie } from './header/filter-global-cookies.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,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,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,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,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,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,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,yBAAyB,CAAA"}
@@ -2,6 +2,7 @@ export { getExampleFromBody, getSchemaExampleFromBody } from './body/get-request
2
2
  export { getSelectedBodyContentType } from './body/get-selected-body-content-type.js';
3
3
  export { buildDottedNestedRowPredicate, coerceLeafValueToSchemaType, coerceUntypedValue, resolveLeafSchema, } from './body/schema-value-coercion.js';
4
4
  export { serializeFormPropertyWithEncoding } from './body/serialize-form-property.js';
5
+ export { serializeMultipartArray } from './body/serialize-multipart-array.js';
5
6
  export { BUILD_REQUEST_FAILED, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
6
7
  export { deSerializeParameter, deSerializeSchemaValue } from './header/de-serialize-parameter.js';
7
8
  export { filterGlobalCookie } from './header/filter-global-cookies.js';
@@ -1,7 +1,7 @@
1
1
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
2
2
  import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
3
- import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
- import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
3
+ import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
4
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/operation';
5
5
  import { type BuildRequestSecurityResult } from '../../request-example/builder/security/build-request-security.js';
6
6
  import type { SecuritySchemeObjectSecret } from '../../request-example/builder/security/secret-types.js';
7
7
  import type { RequestExampleMeta } from '../../request-example/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"broker-scheme-types.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/broker-scheme-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2FAA2F;AAC3F,QAAA,MAAM,iBAAiB,kEAAmE,CAAA;AAE1F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,IAAI,IAAI,cACO,CAAA;AAE3E,qDAAqD;AACrD,QAAA,MAAM,uBAAuB,0DAA2D,CAAA;AAExF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,IAAI,IAAI,oBACO,CAAA"}
1
+ {"version":3,"file":"broker-scheme-types.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/broker-scheme-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2FAA2F;AAC3F,QAAA,MAAM,iBAAiB,kEAAmE,CAAA;AAE1F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,IAAI,IAAI,cACP,CAAA;AAE7D,qDAAqD;AACrD,QAAA,MAAM,uBAAuB,0DAA2D,CAAA;AAExF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,IAAI,IAAI,oBACP,CAAA"}
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /** SASL-style broker schemes: all of them authenticate with a username + password pair. */
8
8
  const SASL_SCHEME_TYPES = ['userPassword', 'plain', 'scramSha256', 'scramSha512'];
9
- export const isSaslSchemeType = (type) => Boolean(type) && SASL_SCHEME_TYPES.includes(type);
9
+ export const isSaslSchemeType = (type) => SASL_SCHEME_TYPES.some((schemeType) => schemeType === type);
10
10
  /** Encryption broker schemes: a single key value. */
11
11
  const ENCRYPTION_SCHEME_TYPES = ['symmetricEncryption', 'asymmetricEncryption'];
12
- export const isEncryptionSchemeType = (type) => Boolean(type) && ENCRYPTION_SCHEME_TYPES.includes(type);
12
+ export const isEncryptionSchemeType = (type) => ENCRYPTION_SCHEME_TYPES.some((schemeType) => schemeType === type);
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/build-request-security.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,8DAA8D;IAC9D,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACjC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD,qEAAqE;AACrE,8BAA0B,KACzB,0BAA0B,EA6F5B,CAAA"}
1
+ {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/build-request-security.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,8DAA8D;IAC9D,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACjC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD,qEAAqE;AACrE,8BAA0B,KACzB,0BAA0B,EA4F5B,CAAA"}
@@ -12,26 +12,25 @@ emptyTokenPlaceholder = '') => {
12
12
  selectedSecuritySchemes.forEach((scheme) => {
13
13
  // Api key
14
14
  if (scheme.type === 'apiKey') {
15
- const name = scheme.name;
16
15
  const value = scheme['x-scalar-secret-token'] || emptyTokenPlaceholder;
17
16
  if (scheme.in === 'header') {
18
17
  return result.push({
19
18
  in: scheme.in,
20
- name,
19
+ name: scheme.name,
21
20
  value,
22
21
  });
23
22
  }
24
23
  if (scheme.in === 'query') {
25
24
  return result.push({
26
25
  in: 'query',
27
- name,
26
+ name: scheme.name,
28
27
  value,
29
28
  });
30
29
  }
31
30
  if (scheme.in === 'cookie') {
32
31
  return result.push({
33
32
  in: 'cookie',
34
- name,
33
+ name: scheme.name,
35
34
  value,
36
35
  });
37
36
  }