@scalar/workspace-store 0.52.0 → 0.54.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 (128) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/channel-example/build-connection-url.d.ts.map +1 -1
  3. package/dist/channel-example/build-connection-url.js +11 -8
  4. package/dist/channel-example/get-all-channel-messages.d.ts +10 -0
  5. package/dist/channel-example/get-all-channel-messages.d.ts.map +1 -0
  6. package/dist/channel-example/get-all-channel-messages.js +16 -0
  7. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +7 -0
  8. package/dist/channel-example/get-asyncapi-security-requirements.d.ts.map +1 -0
  9. package/dist/channel-example/get-asyncapi-security-requirements.js +76 -0
  10. package/dist/channel-example/get-channel-connection-context.d.ts +16 -0
  11. package/dist/channel-example/get-channel-connection-context.d.ts.map +1 -0
  12. package/dist/channel-example/get-channel-connection-context.js +120 -0
  13. package/dist/channel-example/get-channel-connection-security.d.ts +8 -0
  14. package/dist/channel-example/get-channel-connection-security.d.ts.map +1 -0
  15. package/dist/channel-example/get-channel-connection-security.js +20 -0
  16. package/dist/channel-example/get-channel-operations.d.ts +11 -0
  17. package/dist/channel-example/get-channel-operations.d.ts.map +1 -0
  18. package/dist/channel-example/get-channel-operations.js +20 -0
  19. package/dist/channel-example/get-channel-parameters.d.ts +14 -0
  20. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -0
  21. package/dist/channel-example/get-channel-parameters.js +59 -0
  22. package/dist/channel-example/index.d.ts +15 -0
  23. package/dist/channel-example/index.d.ts.map +1 -1
  24. package/dist/channel-example/index.js +9 -0
  25. package/dist/channel-example/resolve-channel.d.ts +11 -0
  26. package/dist/channel-example/resolve-channel.d.ts.map +1 -0
  27. package/dist/channel-example/resolve-channel.js +13 -0
  28. package/dist/channel-example/resolve-operation-channel.d.ts +11 -0
  29. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -0
  30. package/dist/channel-example/resolve-operation-channel.js +39 -0
  31. package/dist/channel-example/resolve-operation-with-traits.d.ts +6 -0
  32. package/dist/channel-example/resolve-operation-with-traits.d.ts.map +1 -0
  33. package/dist/channel-example/resolve-operation-with-traits.js +41 -0
  34. package/dist/channel-example/servers.d.ts.map +1 -1
  35. package/dist/channel-example/servers.js +23 -0
  36. package/dist/channel-example/types.d.ts +41 -0
  37. package/dist/channel-example/types.d.ts.map +1 -0
  38. package/dist/channel-example/types.js +1 -0
  39. package/dist/client.d.ts.map +1 -1
  40. package/dist/client.js +8 -8
  41. package/dist/entities/auth/schema.d.ts +1473 -88
  42. package/dist/entities/auth/schema.d.ts.map +1 -1
  43. package/dist/events/definitions/meta.d.ts +5 -3
  44. package/dist/events/definitions/meta.d.ts.map +1 -1
  45. package/dist/events/definitions/server.d.ts +21 -0
  46. package/dist/events/definitions/server.d.ts.map +1 -1
  47. package/dist/events/definitions/workspace.d.ts +7 -3
  48. package/dist/events/definitions/workspace.d.ts.map +1 -1
  49. package/dist/helpers/get-name-from-ref.d.ts +15 -0
  50. package/dist/helpers/get-name-from-ref.d.ts.map +1 -0
  51. package/dist/helpers/get-name-from-ref.js +37 -0
  52. package/dist/mutators/index.d.ts +4 -0
  53. package/dist/mutators/index.d.ts.map +1 -1
  54. package/dist/mutators/server.d.ts +26 -0
  55. package/dist/mutators/server.d.ts.map +1 -1
  56. package/dist/mutators/server.js +44 -1
  57. package/dist/navigation/get-navigation-options.d.ts +2 -2
  58. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  59. package/dist/navigation/get-navigation-options.js +26 -3
  60. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts +23 -0
  61. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -0
  62. package/dist/navigation/helpers/traverse-asyncapi-document.js +479 -0
  63. package/dist/navigation/helpers/traverse-description.d.ts +4 -3
  64. package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
  65. package/dist/navigation/helpers/traverse-description.js +2 -2
  66. package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
  67. package/dist/navigation/helpers/traverse-document.js +3 -3
  68. package/dist/navigation/index.d.ts +1 -0
  69. package/dist/navigation/index.d.ts.map +1 -1
  70. package/dist/navigation/index.js +1 -0
  71. package/dist/navigation/types.d.ts +3 -0
  72. package/dist/navigation/types.d.ts.map +1 -1
  73. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  74. package/dist/request-example/builder/body/build-request-body.js +32 -1
  75. package/dist/request-example/builder/body/serialize-form-property.d.ts +23 -0
  76. package/dist/request-example/builder/body/serialize-form-property.d.ts.map +1 -0
  77. package/dist/request-example/builder/body/serialize-form-property.js +101 -0
  78. package/dist/request-example/builder/header/de-serialize-parameter.d.ts +4 -1
  79. package/dist/request-example/builder/header/de-serialize-parameter.d.ts.map +1 -1
  80. package/dist/request-example/builder/header/de-serialize-parameter.js +19 -13
  81. package/dist/request-example/builder/index.d.ts +1 -0
  82. package/dist/request-example/builder/index.d.ts.map +1 -1
  83. package/dist/request-example/builder/index.js +1 -0
  84. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts +1 -1
  85. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  86. package/dist/request-example/context/security/extract-security-scheme-secrets.js +12 -8
  87. package/dist/request-example/context/security/merge-security.d.ts +1 -1
  88. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  89. package/dist/request-example/context/security/merge-security.js +2 -2
  90. package/dist/request-example/index.d.ts +1 -1
  91. package/dist/request-example/index.d.ts.map +1 -1
  92. package/dist/request-example/index.js +1 -1
  93. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts +1 -3
  94. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts.map +1 -1
  95. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +0 -2
  96. package/dist/schemas/extensions/operation/index.d.ts +1 -1
  97. package/dist/schemas/extensions/operation/index.d.ts.map +1 -1
  98. package/dist/schemas/extensions/operation/x-code-samples.d.ts +71 -0
  99. package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
  100. package/dist/schemas/extensions/operation/x-code-samples.js +50 -7
  101. package/dist/schemas/navigation.d.ts +113 -4
  102. package/dist/schemas/navigation.d.ts.map +1 -1
  103. package/dist/schemas/navigation.js +22 -0
  104. package/dist/schemas/reference-config/index.d.ts +286 -9
  105. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  106. package/dist/schemas/reference-config/settings.d.ts +286 -9
  107. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  108. package/dist/schemas/v3.1/openapi/index.d.ts +0 -1
  109. package/dist/schemas/v3.1/openapi/index.d.ts.map +1 -1
  110. package/dist/schemas/v3.1/openapi/index.js +59 -17
  111. package/dist/schemas/v3.1/strict/info.d.ts +0 -1
  112. package/dist/schemas/v3.1/strict/info.d.ts.map +1 -1
  113. package/dist/schemas/v3.1/strict/openapi-document.d.ts +11168 -1473
  114. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  115. package/dist/schemas/v3.1/strict/openapi-document.js +4 -1
  116. package/dist/schemas/v3.1/strict/operation.d.ts +25 -0
  117. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  118. package/dist/schemas/v3.1/strict/ref-definitions.d.ts +3 -0
  119. package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
  120. package/dist/schemas/v3.1/strict/ref-definitions.js +3 -0
  121. package/dist/schemas/v3.1/strict/schema.d.ts +387 -26
  122. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  123. package/dist/schemas/v3.1/strict/schema.js +53 -28
  124. package/dist/schemas/workspace-specification/index.d.ts +1 -1
  125. package/dist/schemas/workspace.d.ts +2 -3
  126. package/dist/schemas/workspace.d.ts.map +1 -1
  127. package/dist/schemas/workspace.js +5 -1
  128. package/package.json +7 -7
@@ -6,6 +6,7 @@ import { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'
6
6
  import { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards';
7
7
  import { getExampleFromBody } from './get-request-body-example.js';
8
8
  import { getSelectedBodyContentType } from './get-selected-body-content-type.js';
9
+ import { serializeFormPropertyWithEncoding } from './serialize-form-property.js';
9
10
  const getMultipartEncodingContentType = (requestBody, bodyContentType, fieldName) => requestBody.content[bodyContentType]?.encoding?.[fieldName]?.contentType;
10
11
  /**
11
12
  * Build a predicate that recognizes multipart rows whose dotted name encodes a path
@@ -108,7 +109,18 @@ requestBodyCompositionSelection) => {
108
109
  if (!name) {
109
110
  return;
110
111
  }
111
- const partContentType = result.mode === 'formdata' ? getMultipartEncodingContentType(requestBody, bodyContentType, name) : undefined;
112
+ const partEncoding = requestBody.content[bodyContentType]?.encoding?.[name];
113
+ // When the encoding sets style/explode, serialize objects/arrays RFC6570-style
114
+ // (bracket or exploded notation) instead of JSON, so the wire request matches the
115
+ // generated code snippet.
116
+ const styleParts = serializeFormPropertyWithEncoding(name, value, partEncoding);
117
+ if (styleParts) {
118
+ for (const part of styleParts) {
119
+ result.value.push({ type: 'text', key: part.key, value: part.value });
120
+ }
121
+ return;
122
+ }
123
+ const partContentType = result.mode === 'formdata' ? partEncoding?.contentType : undefined;
112
124
  // Handle file uploads
113
125
  if (value instanceof File && result.mode === 'formdata') {
114
126
  /**
@@ -161,6 +173,15 @@ requestBodyCompositionSelection) => {
161
173
  // Convert object properties to form fields
162
174
  for (const [key, value] of Object.entries(example.value)) {
163
175
  if (key && value !== undefined && value !== null) {
176
+ const partEncoding = requestBody.content[bodyContentType]?.encoding?.[key];
177
+ // Encoding style/explode turns objects into bracket or exploded notation.
178
+ const styleParts = serializeFormPropertyWithEncoding(key, value, partEncoding);
179
+ if (styleParts) {
180
+ for (const part of styleParts) {
181
+ result.value.push({ key: part.key, value: part.value });
182
+ }
183
+ continue;
184
+ }
164
185
  const stringValue = typeof value === 'object' && value !== null ? JSON.stringify(unpackProxyObject(value)) : String(value);
165
186
  result.value.push({
166
187
  key,
@@ -180,6 +201,16 @@ requestBodyCompositionSelection) => {
180
201
  if (!key || value === undefined || value === null) {
181
202
  continue;
182
203
  }
204
+ const partEncoding = requestBody.content[bodyContentType]?.encoding?.[key];
205
+ // Encoding style/explode turns objects into bracket or exploded notation instead of
206
+ // the default single JSON part.
207
+ const styleParts = serializeFormPropertyWithEncoding(key, value, partEncoding);
208
+ if (styleParts) {
209
+ for (const part of styleParts) {
210
+ result.value.push({ type: 'text', key: part.key, value: part.value });
211
+ }
212
+ continue;
213
+ }
183
214
  const partContentType = getMultipartEncodingContentType(requestBody, bodyContentType, key);
184
215
  if (value instanceof File) {
185
216
  const unwrappedValue = unpackProxyObject(value);
@@ -0,0 +1,23 @@
1
+ import type { EncodingObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /** A single serialized form field, ready to become a multipart part or a urlencoded pair. */
3
+ export type SerializedFormProperty = {
4
+ key: string;
5
+ value: string;
6
+ };
7
+ /**
8
+ * Serialize a `multipart/form-data` or `application/x-www-form-urlencoded` property
9
+ * according to its OpenAPI Encoding Object when `style` / `explode` / `allowReserved`
10
+ * is set. The value is serialized RFC6570-style (like a query parameter) into one or
11
+ * more key/value parts — for example `style: deepObject` turns `{ address: { city } }`
12
+ * into `address[city]=...` bracket notation, and `style: form, explode: true` breaks an
13
+ * object into one part per property.
14
+ *
15
+ * Returns `null` when the encoding does not opt into style-based serialization, so callers
16
+ * keep their default handling (JSON for objects, `contentType` parts, file uploads). This
17
+ * is shared by the request builder (`build-request-body`) and the code-snippet generator
18
+ * (`process-body`) so the request sent over the wire matches the generated snippet.
19
+ *
20
+ * @see https://spec.openapis.org/oas/v3.1.1.html#encoding-object
21
+ */
22
+ export declare const serializeFormPropertyWithEncoding: (key: string, value: unknown, encoding: EncodingObject | undefined) => SerializedFormProperty[] | null;
23
+ //# sourceMappingURL=serialize-form-property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize-form-property.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/serialize-form-property.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAA;AASlG,6FAA6F;AAC7F,MAAM,MAAM,sBAAsB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAcnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iCAAiC,GAC5C,KAAK,MAAM,EACX,OAAO,OAAO,EACd,UAAU,cAAc,GAAG,SAAS,KACnC,sBAAsB,EAAE,GAAG,IA4E7B,CAAA"}
@@ -0,0 +1,101 @@
1
+ import { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy';
2
+ import { serializeDeepObjectStyle, serializeFormStyle, serializePipeDelimitedStyle, serializeSpaceDelimitedStyle, } from '../header/serialize-parameter.js';
3
+ /**
4
+ * Stringify a value emitted by `serializeFormStyle` into a form field value.
5
+ *
6
+ * Form-style serialization only addresses one level of nesting per RFC6570; deeper
7
+ * structures (an object or array still sitting in `entry.value`) are spec-undefined.
8
+ * JSON-stringify them so the output stays readable instead of `String(value)` returning
9
+ * `"[object Object]"`. Primitives pass through `String()` to preserve the existing wire
10
+ * shape (e.g. `true` -> `"true"`).
11
+ */
12
+ const stringifyEntryValue = (value) => value !== null && typeof value === 'object' ? JSON.stringify(value) : String(value);
13
+ /**
14
+ * Serialize a `multipart/form-data` or `application/x-www-form-urlencoded` property
15
+ * according to its OpenAPI Encoding Object when `style` / `explode` / `allowReserved`
16
+ * is set. The value is serialized RFC6570-style (like a query parameter) into one or
17
+ * more key/value parts — for example `style: deepObject` turns `{ address: { city } }`
18
+ * into `address[city]=...` bracket notation, and `style: form, explode: true` breaks an
19
+ * object into one part per property.
20
+ *
21
+ * Returns `null` when the encoding does not opt into style-based serialization, so callers
22
+ * keep their default handling (JSON for objects, `contentType` parts, file uploads). This
23
+ * is shared by the request builder (`build-request-body`) and the code-snippet generator
24
+ * (`process-body`) so the request sent over the wire matches the generated snippet.
25
+ *
26
+ * @see https://spec.openapis.org/oas/v3.1.1.html#encoding-object
27
+ */
28
+ export const serializeFormPropertyWithEncoding = (key, value, encoding) => {
29
+ /**
30
+ * Per OpenAPI 3.1.x: when style, explode, or allowReserved is explicitly set, the value
31
+ * is serialized as if it were a query-style parameter and contentType is ignored.
32
+ */
33
+ const hasFormStyle = !!encoding &&
34
+ (encoding.style !== undefined || encoding.explode !== undefined || encoding.allowReserved !== undefined);
35
+ if (!hasFormStyle) {
36
+ return null;
37
+ }
38
+ /**
39
+ * Style is a no-op for primitives, and RFC6570 expansion of binary data is undefined
40
+ * (spec §Appendix C). Files and arrays containing Files keep their dedicated handling in
41
+ * the caller, so we bail out and let the default path emit those parts.
42
+ */
43
+ if (typeof value !== 'object' ||
44
+ value === null ||
45
+ value instanceof File ||
46
+ (Array.isArray(value) && value.some((item) => item instanceof File))) {
47
+ return null;
48
+ }
49
+ const unpacked = unpackProxyObject(value);
50
+ /**
51
+ * OAS Encoding follows query-parameter defaults: when no `style` is set the default is
52
+ * "form"; when no `explode` is set the default is `true` for "form" and `false` otherwise.
53
+ */
54
+ const style = encoding?.style ?? 'form';
55
+ const explode = encoding?.explode ?? style === 'form';
56
+ const params = [];
57
+ if (style === 'deepObject') {
58
+ if (Array.isArray(unpacked)) {
59
+ /**
60
+ * deepObject-on-array is marked n/a by the spec; fall back to the form/explode:true
61
+ * shape so the array still reaches the wire instead of being silently dropped.
62
+ */
63
+ const serialized = serializeFormStyle(unpacked, true);
64
+ if (Array.isArray(serialized)) {
65
+ for (const entry of serialized) {
66
+ params.push({ key: entry.key || key, value: stringifyEntryValue(entry.value) });
67
+ }
68
+ }
69
+ else {
70
+ params.push({ key, value: String(serialized) });
71
+ }
72
+ }
73
+ else {
74
+ for (const entry of serializeDeepObjectStyle(key, unpacked)) {
75
+ params.push({ key: entry.key, value: String(entry.value) });
76
+ }
77
+ }
78
+ }
79
+ else if (style === 'spaceDelimited') {
80
+ params.push({ key, value: String(serializeSpaceDelimitedStyle(unpacked)) });
81
+ }
82
+ else if (style === 'pipeDelimited') {
83
+ params.push({ key, value: String(serializePipeDelimitedStyle(unpacked)) });
84
+ }
85
+ else {
86
+ const serialized = serializeFormStyle(unpacked, explode);
87
+ if (Array.isArray(serialized)) {
88
+ for (const entry of serialized) {
89
+ /**
90
+ * Arrays: `entry.key === ''` -> fall back to the outer name.
91
+ * Objects: `entry.key` is the inner property name (the spec strips the outer name).
92
+ */
93
+ params.push({ key: entry.key || key, value: stringifyEntryValue(entry.value) });
94
+ }
95
+ }
96
+ else {
97
+ params.push({ key, value: String(serialized) });
98
+ }
99
+ }
100
+ return params;
101
+ };
@@ -1,4 +1,7 @@
1
1
  import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** Helper that de-serializes the example value based on the parameter type */
2
+ /**
3
+ * Coerces a parameter example from the UI (always a string from CodeInput) into a value
4
+ * request building can serialize. Only structured types are parsed; primitives stay as strings.
5
+ */
3
6
  export declare const deSerializeParameter: (example: unknown, param: ParameterObject) => any;
4
7
  //# sourceMappingURL=de-serialize-parameter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"de-serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/de-serialize-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAErE,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,OAAO,eAAe,QAS5E,CAAA"}
1
+ {"version":3,"file":"de-serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/de-serialize-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAErE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,OAAO,eAAe,QAS5E,CAAA"}
@@ -1,5 +1,8 @@
1
1
  import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
2
- /** Helper that de-serializes the example value based on the parameter type */
2
+ /**
3
+ * Coerces a parameter example from the UI (always a string from CodeInput) into a value
4
+ * request building can serialize. Only structured types are parsed; primitives stay as strings.
5
+ */
3
6
  export const deSerializeParameter = (example, param) => {
4
7
  if ('content' in param) {
5
8
  return deSerializeContentExample(example, Object.keys(param.content ?? {})[0] ?? '');
@@ -9,39 +12,42 @@ export const deSerializeParameter = (example, param) => {
9
12
  }
10
13
  return example;
11
14
  };
12
- /** De-serialize the example value based on the content type */
15
+ /**
16
+ * Content-based parameters (e.g. `application/json`) may hold full JSON payloads;
17
+ * parse those so nested structure is available to serializers.
18
+ */
13
19
  const deSerializeContentExample = (example, contentType) => {
14
20
  if (typeof example === 'string' && contentType.includes('json')) {
15
21
  try {
16
22
  return JSON.parse(example);
17
23
  }
18
24
  catch {
19
- // Ignore the error and return the original example
25
+ return example;
20
26
  }
21
27
  }
22
28
  return example;
23
29
  };
24
- /** Create a set of all the types we wish to parse as JSON */
25
- const parseableTypesSet = new Set(['array', 'object', 'boolean', 'number', 'integer', 'null']);
26
- /** De-serialize the example value based on the schema type */
30
+ /** Schema types that must become arrays/objects serializers branch on `Array.isArray` / objects. */
31
+ const structuredSchemaTypes = new Set(['array', 'object']);
32
+ /**
33
+ * Schema-based parameters from the request editor.
34
+ *
35
+ * Primitives (`string`, `integer`, `number`, `boolean`, `null`) are left as the typed string
36
+ * Only `array` and `object` values are parsed so OpenAPI style serialization can expand them.
37
+ */
27
38
  const deSerializeSchemaExample = (example, schema) => {
28
39
  const resolvedSchema = getResolvedRef(schema);
29
40
  if (typeof example === 'string' && resolvedSchema && 'type' in resolvedSchema) {
30
41
  const type = Array.isArray(resolvedSchema.type) ? resolvedSchema.type[0] : resolvedSchema.type;
31
- if (type && parseableTypesSet.has(type)) {
42
+ if (type && structuredSchemaTypes.has(type)) {
32
43
  try {
33
44
  return JSON.parse(example);
34
45
  }
35
46
  catch {
36
- // For array types, fall back to splitting comma-separated values.
37
- // Users commonly enter array values as "foo,bar" or "foo, bar" in the UI
38
- // text field, which is not valid JSON. Per the OpenAPI spec, the default
39
- // serialization for query array parameters is style=form + explode=true,
40
- // meaning each value should be sent as a separate query parameter.
47
+ // Arrays: users often type `foo,bar` instead of JSON — split to match default form+explode query style.
41
48
  if (type === 'array') {
42
49
  return example.split(/,\s?/).filter((v) => v !== '');
43
50
  }
44
- // Ignore the error and return the original example for other types
45
51
  }
46
52
  }
47
53
  }
@@ -1,5 +1,6 @@
1
1
  export { getExampleFromBody } from './body/get-request-body-example.js';
2
2
  export { getSelectedBodyContentType } from './body/get-selected-body-content-type.js';
3
+ export { type SerializedFormProperty, serializeFormPropertyWithEncoding } from './body/serialize-form-property.js';
3
4
  export { BUILD_REQUEST_FAILED, type BuildRequestData, type BuildRequestFailureCode, type BuildRequestResult, type RequestPayload, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
4
5
  export { deSerializeParameter } from './header/de-serialize-parameter.js';
5
6
  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,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,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,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,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,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,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,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,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,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,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,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export { getExampleFromBody } from './body/get-request-body-example.js';
2
2
  export { getSelectedBodyContentType } from './body/get-selected-body-content-type.js';
3
+ export { serializeFormPropertyWithEncoding } from './body/serialize-form-property.js';
3
4
  export { BUILD_REQUEST_FAILED, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
4
5
  export { deSerializeParameter } from './header/de-serialize-parameter.js';
5
6
  export { filterGlobalCookie } from './header/filter-global-cookies.js';
@@ -6,5 +6,5 @@ import type { SecuritySchemeObjectSecret } from '../../../request-example/builde
6
6
  /** A combined scheme that includes both the auth store secrets and a deep partial of the config auth */
7
7
  export type ConfigAuthScheme = SecuritySchemeObject & DeepPartial<SecurityScheme>;
8
8
  /** Extract the secrets from the config and the auth store */
9
- export declare const extractSecuritySchemeSecrets: (scheme: SecuritySchemeObject & DeepPartial<SecurityScheme>, authStore: AuthStore, name: string, documentSlug: string) => SecuritySchemeObjectSecret;
9
+ export declare const extractSecuritySchemeSecrets: (scheme: SecuritySchemeObject & DeepPartial<SecurityScheme>, authStore: AuthStore, name: string, documentSlug: string, oauth2RedirectUri?: string) => SecuritySchemeObjectSecret;
10
10
  //# sourceMappingURL=extract-security-scheme-secrets.d.ts.map
@@ -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;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAiLjF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,EAC1D,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,KACnB,0BA2DF,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;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAyLjF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,EAC1D,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,0BA4DF,CAAA"}
@@ -14,7 +14,7 @@ const SECRET_TO_INPUT_FIELD_MAP = {
14
14
  'x-scalar-secret-auth-url': 'authorizationUrl',
15
15
  'x-scalar-secret-token-url': 'tokenUrl',
16
16
  };
17
- const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}) => Object.fromEntries(properties.map((property) => {
17
+ const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}, oauth2RedirectUri) => Object.fromEntries(properties.map((property) => {
18
18
  // Redirect URI is the only OAuth secret where an explicit empty value from
19
19
  // store must be preserved. Other secrets use falsy fallback behavior for backwards-compatibility
20
20
  // with config defaults when the casted auth store value is an empty string.
@@ -23,8 +23,12 @@ const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}) => O
23
23
  const configInputValue = typeof configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]] === 'string'
24
24
  ? configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]]
25
25
  : undefined;
26
+ // oauth2RedirectUri (top-level config option) is used as a global fallback for the redirect URI,
27
+ // applied only when neither the auth store nor per-scheme config have a value. This ensures
28
+ // the configured redirect URI persists when switching between documents with the same OAuth config,
29
+ // because each document starts with no stored redirect URI (authStoreValue === undefined).
26
30
  const value = property === 'x-scalar-secret-redirect-uri'
27
- ? (authStoreValue ?? configValue ?? configInputValue ?? '')
31
+ ? (authStoreValue ?? configValue ?? configInputValue ?? oauth2RedirectUri ?? '')
28
32
  : authStoreValue || configValue || configInputValue || '';
29
33
  return [property, value];
30
34
  }));
@@ -44,7 +48,7 @@ const extractCredentialsLocation = (configSecrets, authStoreSecrets = {}) => {
44
48
  * Extract flow secrets and selected scopes for OAuth-like flows.
45
49
  * Reused by both oauth2 and openIdConnect security schemes.
46
50
  */
47
- const extractOAuthFlowSecrets = (flows, storeSecrets) => {
51
+ const extractOAuthFlowSecrets = (flows, storeSecrets, oauth2RedirectUri) => {
48
52
  const selectedScopes = new Set();
49
53
  const extractedFlows = objectEntries(flows ?? {}).reduce((acc, [key, flow]) => {
50
54
  if (!isObject(flow)) {
@@ -64,7 +68,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets) => {
64
68
  'x-scalar-secret-redirect-uri',
65
69
  'x-scalar-secret-token',
66
70
  'x-scalar-secret-auth-url',
67
- ], flow, storeSecrets?.implicit),
71
+ ], flow, storeSecrets?.implicit, oauth2RedirectUri),
68
72
  ...extractRefreshTokenSecret(storeSecrets?.implicit),
69
73
  };
70
74
  }
@@ -109,7 +113,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets) => {
109
113
  'x-scalar-secret-token',
110
114
  'x-scalar-secret-auth-url',
111
115
  'x-scalar-secret-token-url',
112
- ], flow, storeSecrets?.authorizationCode),
116
+ ], flow, storeSecrets?.authorizationCode, oauth2RedirectUri),
113
117
  ...extractCredentialsLocation(flow, storeSecrets?.authorizationCode),
114
118
  ...extractRefreshTokenSecret(storeSecrets?.authorizationCode),
115
119
  };
@@ -121,7 +125,7 @@ const extractOAuthFlowSecrets = (flows, storeSecrets) => {
121
125
  /** Extract the secrets from the config and the auth store */
122
126
  export const extractSecuritySchemeSecrets = (
123
127
  // Include the config fields
124
- scheme, authStore, name, documentSlug) => {
128
+ scheme, authStore, name, documentSlug, oauth2RedirectUri) => {
125
129
  const secrets = authStore.getAuthSecrets(documentSlug, name);
126
130
  // Handle API Key security schemes
127
131
  if (scheme.type === 'apiKey') {
@@ -144,7 +148,7 @@ scheme, authStore, name, documentSlug) => {
144
148
  // Handle OAuth2 security schemes and all supported flows
145
149
  if (scheme.type === 'oauth2') {
146
150
  const storeSecrets = secrets?.type === 'oauth2' ? secrets : undefined;
147
- const extracted = extractOAuthFlowSecrets(scheme.flows, storeSecrets);
151
+ const extracted = extractOAuthFlowSecrets(scheme.flows, storeSecrets, oauth2RedirectUri);
148
152
  const configuredDefaultScopes = Array.isArray(scheme['x-default-scopes'])
149
153
  ? scheme['x-default-scopes'].filter((scope) => typeof scope === 'string')
150
154
  : [];
@@ -163,7 +167,7 @@ scheme, authStore, name, documentSlug) => {
163
167
  password: storeSecrets?.password,
164
168
  clientCredentials: storeSecrets?.clientCredentials,
165
169
  authorizationCode: storeSecrets?.authorizationCode,
166
- }, storeSecrets);
170
+ }, storeSecrets, oauth2RedirectUri);
167
171
  return {
168
172
  ...scheme,
169
173
  ...(objectEntries(extracted.flows).length ? { flows: extracted.flows } : {}),
@@ -5,5 +5,5 @@ import type { SecuritySchemeObjectSecret } from '../../../request-example/builde
5
5
  /** Document security merged with the config security schemes */
6
6
  export type MergedSecuritySchemes = Record<string, SecuritySchemeObjectSecret>;
7
7
  /** Merge the authentication config with the document security schemes + the auth store secrets */
8
- export declare const mergeSecurity: (documentSecuritySchemes: ComponentsObject["securitySchemes"], configSecuritySchemes: AuthenticationConfiguration["securitySchemes"], authStore: AuthStore, documentName: string) => MergedSecuritySchemes;
8
+ export declare const mergeSecurity: (documentSecuritySchemes: ComponentsObject["securitySchemes"], configSecuritySchemes: AuthenticationConfiguration["securitySchemes"], authStore: AuthStore, documentName: string, oauth2RedirectUri?: string) => MergedSecuritySchemes;
9
9
  //# sourceMappingURL=merge-security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AAE9E,kGAAkG;AAClG,eAAO,MAAM,aAAa,GACxB,yBAAyB,gBAAgB,CAAC,iBAAiB,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,KACnB,qBA2BF,CAAA"}
1
+ {"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AAE9E,kGAAkG;AAClG,eAAO,MAAM,aAAa,GACxB,yBAAyB,gBAAgB,CAAC,iBAAiB,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,qBA2BF,CAAA"}
@@ -6,7 +6,7 @@ import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
6
6
  import { SecuritySchemeObjectSchema, } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
7
7
  import { extractSecuritySchemeSecrets } from './extract-security-scheme-secrets.js';
8
8
  /** Merge the authentication config with the document security schemes + the auth store secrets */
9
- export const mergeSecurity = (documentSecuritySchemes = {}, configSecuritySchemes = {}, authStore, documentName) => {
9
+ export const mergeSecurity = (documentSecuritySchemes = {}, configSecuritySchemes = {}, authStore, documentName, oauth2RedirectUri) => {
10
10
  /** Resolve any refs in the document security schemes */
11
11
  const resolvedDocumentSecuritySchemes = objectEntries(documentSecuritySchemes).reduce((acc, [key, value]) => {
12
12
  const resolved = deepClone(getResolvedRef(value));
@@ -23,7 +23,7 @@ export const mergeSecurity = (documentSecuritySchemes = {}, configSecurityScheme
23
23
  const coerced = coerceValue(SecuritySchemeObjectSchema, value);
24
24
  // We then overwrite it back with the original value to keep any other fields like description, etc.
25
25
  const merged = { ...coerced, ...value };
26
- acc[name] = extractSecuritySchemeSecrets(merged, authStore, name, documentName);
26
+ acc[name] = extractSecuritySchemeSecrets(merged, authStore, name, documentName, oauth2RedirectUri);
27
27
  return acc;
28
28
  }, {});
29
29
  };
@@ -1,5 +1,5 @@
1
1
  export type { ApiKeyObjectSecret, BuildRequestData, BuildRequestFailureCode, BuildRequestResult, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, ResolveRequestFactoryUrlError, ResolveRequestFactoryUrlResult, SecuritySchemeObjectSecret, } from './builder/index.js';
2
- export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, type SerializedFormProperty, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
3
3
  export type { MergedSecuritySchemes } from './context/index.js';
4
4
  export { type BuildRequestExampleContext, combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
5
5
  export { CONTEXT_FUNCTION_NAMES, type ContextFunctionEntry, type ContextFunctionName, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.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,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,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"}
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,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,iCAAiC,EACjC,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,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"}
@@ -1,4 +1,4 @@
1
- export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
1
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
2
  export { combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
3
3
  export { CONTEXT_FUNCTION_NAMES, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
4
4
  export { createVariablesStoreForRequest } from './variable-store/index.js';
@@ -1,7 +1,6 @@
1
1
  export declare const XScalarSdkInstallationSchema: import("@scalar/typebox").TObject<{
2
2
  'x-scalar-sdk-installation': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
3
3
  lang: import("@scalar/typebox").TString;
4
- source: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
5
4
  description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
6
5
  }>>>;
7
6
  }>;
@@ -9,14 +8,13 @@ export type XScalarSdkInstallation = {
9
8
  /** Scalar SDK installation information. */
10
9
  'x-scalar-sdk-installation'?: {
11
10
  lang: string;
12
- source?: string;
11
+ /** Installation instructions in Markdown (supports fenced code blocks). */
13
12
  description?: string;
14
13
  }[];
15
14
  };
16
15
  export declare const XScalarSdkInstallation: import("@scalar/validation").ObjectSchema<{
17
16
  'x-scalar-sdk-installation': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
18
17
  lang: import("@scalar/validation").StringSchema;
19
- source: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
20
18
  description: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
21
19
  }>>>;
22
20
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"x-scalar-sdk-installation.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/document/x-scalar-sdk-installation.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAA;AAcF,MAAM,MAAM,sBAAsB,GAAG;IACnC,2CAA2C;IAC3C,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EAAE,CAAA;CACJ,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;EAYlC,CAAA"}
1
+ {"version":3,"file":"x-scalar-sdk-installation.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/document/x-scalar-sdk-installation.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,4BAA4B;;;;;EAEvC,CAAA;AAaF,MAAM,MAAM,sBAAsB,GAAG;IACnC,2CAA2C;IAC3C,2BAA2B,CAAC,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAA;QACZ,2EAA2E;QAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,EAAE,CAAA;CACJ,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;EAYlC,CAAA"}
@@ -2,7 +2,6 @@ import { Type } from '@scalar/typebox';
2
2
  import { array, object, optional, string } from '@scalar/validation';
3
3
  const XScalarSdkInstallationItemSchema = Type.Object({
4
4
  lang: Type.String(),
5
- source: Type.Optional(Type.String()),
6
5
  description: Type.Optional(Type.String()),
7
6
  });
8
7
  export const XScalarSdkInstallationSchema = Type.Object({
@@ -10,7 +9,6 @@ export const XScalarSdkInstallationSchema = Type.Object({
10
9
  });
11
10
  const XScalarSdkInstallationItem = object({
12
11
  lang: string(),
13
- source: optional(string()),
14
12
  description: optional(string()),
15
13
  }, {
16
14
  typeName: 'XScalarSdkInstallationItem',
@@ -1,5 +1,5 @@
1
1
  export { type XBadge, XBadgeSchema, type XBadges, XBadgesSchema, } from './x-badge.js';
2
- export { type XCodeSample, type XCodeSamples, XCodeSamplesSchema, } from './x-code-samples.js';
2
+ export { type XCodeSample, type XCodeSamples, XCodeSamplesSchema, type XLanguageExample, type XReadmeCodeSample, } from './x-code-samples.js';
3
3
  export { type XScalarSelectedContentType, XScalarSelectedContentTypeSchema, } from './x-scalar-selected-content-type.js';
4
4
  export { XScalarStabilitySchema, XScalarStabilityValues, } from './x-scalar-stability.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,OAAO,EACZ,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,OAAO,EACZ,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA"}
@@ -14,12 +14,51 @@ export declare const XCodeSamplesSchema: import("@scalar/typebox").TObject<{
14
14
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
15
15
  source: import("@scalar/typebox").TString;
16
16
  }>>>;
17
+ 'x-readme': import("@scalar/typebox").TOptional<import("@scalar/typebox").TObject<{
18
+ 'code-samples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
19
+ language: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
20
+ code: import("@scalar/typebox").TString;
21
+ name: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
22
+ install: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
23
+ correspondingExample: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
24
+ }>>>;
25
+ 'samples-languages': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
26
+ }>>;
27
+ 'x-stainless-snippets': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TString>>;
28
+ 'x-stainless-examples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TObject<{
29
+ title: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
30
+ request: import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TString>>;
31
+ response: import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnknown>;
32
+ }>, import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
33
+ title: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
34
+ request: import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TString>>;
35
+ response: import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnknown>;
36
+ }>>]>>;
37
+ 'x-scalar-examples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
38
+ lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
39
+ label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
40
+ source: import("@scalar/typebox").TString;
41
+ }>>>;
17
42
  }>;
18
43
  export type XCodeSample = {
19
44
  lang?: string;
20
45
  label?: string;
21
46
  source: string;
22
47
  };
48
+ /** A single ReadMe custom code sample. */
49
+ export type XReadmeCodeSample = {
50
+ language?: string;
51
+ code: string;
52
+ name?: string;
53
+ install?: string;
54
+ correspondingExample?: string;
55
+ };
56
+ /** Per-language request snippets with an optional title and response. */
57
+ export type XLanguageExample = {
58
+ title?: string;
59
+ request?: Record<string, string>;
60
+ response?: unknown;
61
+ };
23
62
  export declare const XCodeSample: import("@scalar/validation").ObjectSchema<{
24
63
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
25
64
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
@@ -29,6 +68,13 @@ export type XCodeSamples = {
29
68
  'x-codeSamples'?: XCodeSample[];
30
69
  'x-code-samples'?: XCodeSample[];
31
70
  'x-custom-examples'?: XCodeSample[];
71
+ 'x-readme'?: {
72
+ 'code-samples'?: XReadmeCodeSample[];
73
+ 'samples-languages'?: string[];
74
+ };
75
+ 'x-stainless-snippets'?: Record<string, string>;
76
+ 'x-stainless-examples'?: XLanguageExample | XLanguageExample[];
77
+ 'x-scalar-examples'?: XCodeSample[];
32
78
  };
33
79
  export declare const XCodeSamples: import("@scalar/validation").ObjectSchema<{
34
80
  'x-codeSamples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
@@ -46,5 +92,30 @@ export declare const XCodeSamples: import("@scalar/validation").ObjectSchema<{
46
92
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
47
93
  source: import("@scalar/validation").StringSchema;
48
94
  }>>>;
95
+ 'x-readme': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
96
+ 'code-samples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
97
+ language: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
98
+ code: import("@scalar/validation").StringSchema;
99
+ name: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
100
+ install: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
101
+ correspondingExample: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
102
+ }>>>;
103
+ 'samples-languages': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").StringSchema>>;
104
+ }>>;
105
+ 'x-stainless-snippets': import("@scalar/validation").OptionalSchema<import("@scalar/validation").RecordSchema<import("@scalar/validation").StringSchema, import("@scalar/validation").StringSchema>>;
106
+ 'x-stainless-examples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").ObjectSchema<{
107
+ title: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
108
+ request: import("@scalar/validation").OptionalSchema<import("@scalar/validation").RecordSchema<import("@scalar/validation").StringSchema, import("@scalar/validation").StringSchema>>;
109
+ response: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnknownSchema>;
110
+ }>, import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
111
+ title: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
112
+ request: import("@scalar/validation").OptionalSchema<import("@scalar/validation").RecordSchema<import("@scalar/validation").StringSchema, import("@scalar/validation").StringSchema>>;
113
+ response: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnknownSchema>;
114
+ }>>]>>;
115
+ 'x-scalar-examples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
116
+ lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
117
+ label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
118
+ source: import("@scalar/validation").StringSchema;
119
+ }>>>;
49
120
  }>;
50
121
  //# sourceMappingURL=x-code-samples.d.ts.map