@scalar/workspace-store 0.65.0 → 0.66.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 (84) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/client.js +1 -1
  3. package/dist/entities/auth/schema.d.ts +115 -20
  4. package/dist/entities/auth/schema.d.ts.map +1 -1
  5. package/dist/events/definitions/auth.d.ts +1 -2
  6. package/dist/events/definitions/auth.d.ts.map +1 -1
  7. package/dist/events/definitions/operation.d.ts +3 -4
  8. package/dist/events/definitions/operation.d.ts.map +1 -1
  9. package/dist/events/definitions/server.d.ts +1 -2
  10. package/dist/events/definitions/server.d.ts.map +1 -1
  11. package/dist/events/definitions/ui.d.ts +3 -4
  12. package/dist/events/definitions/ui.d.ts.map +1 -1
  13. package/dist/events/old-definitions.d.ts +1 -2
  14. package/dist/events/old-definitions.d.ts.map +1 -1
  15. package/dist/helpers/for-each-path-item-operation.d.ts +6 -5
  16. package/dist/helpers/for-each-path-item-operation.d.ts.map +1 -1
  17. package/dist/helpers/for-each-path-item-operation.js +36 -10
  18. package/dist/helpers/get-parameter-example.d.ts +14 -0
  19. package/dist/helpers/get-parameter-example.d.ts.map +1 -0
  20. package/dist/helpers/get-parameter-example.js +19 -0
  21. package/dist/helpers/querystring-parameter.d.ts +21 -0
  22. package/dist/helpers/querystring-parameter.d.ts.map +1 -0
  23. package/dist/helpers/querystring-parameter.js +108 -0
  24. package/dist/mutators/operation/operation.d.ts.map +1 -1
  25. package/dist/mutators/operation/operation.js +4 -7
  26. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  27. package/dist/mutators/operation/parameters.js +43 -3
  28. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  29. package/dist/navigation/get-navigation-options.js +19 -4
  30. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  31. package/dist/navigation/helpers/traverse-paths.js +2 -2
  32. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  33. package/dist/navigation/helpers/traverse-webhooks.js +2 -2
  34. package/dist/navigation/helpers/update-order-ids.d.ts +1 -2
  35. package/dist/navigation/helpers/update-order-ids.d.ts.map +1 -1
  36. package/dist/plugins/bundler/index.d.ts.map +1 -1
  37. package/dist/plugins/bundler/index.js +3 -2
  38. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  39. package/dist/request-example/builder/build-request.js +2 -1
  40. package/dist/request-example/builder/header/build-request-parameters.d.ts +2 -0
  41. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  42. package/dist/request-example/builder/header/build-request-parameters.js +49 -10
  43. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  44. package/dist/request-example/builder/header/is-param-disabled.js +3 -1
  45. package/dist/request-example/builder/request-factory.d.ts +7 -0
  46. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  47. package/dist/request-example/builder/request-factory.js +10 -1
  48. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  49. package/dist/request-example/builder/resolve-request-factory-url.js +18 -2
  50. package/dist/request-example/context/headers.d.ts +1 -2
  51. package/dist/request-example/context/headers.d.ts.map +1 -1
  52. package/dist/request-example/types.d.ts +1 -2
  53. package/dist/request-example/types.d.ts.map +1 -1
  54. package/dist/schemas/extensions/operation/x-code-samples.d.ts +22 -0
  55. package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
  56. package/dist/schemas/extensions/operation/x-code-samples.js +4 -0
  57. package/dist/schemas/navigation.d.ts +40 -34
  58. package/dist/schemas/navigation.d.ts.map +1 -1
  59. package/dist/schemas/navigation.js +2 -3
  60. package/dist/schemas/reference-config/index.d.ts +23 -4
  61. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  62. package/dist/schemas/reference-config/settings.d.ts +23 -4
  63. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  64. package/dist/schemas/v3.1/strict/openapi-document.d.ts +770 -140
  65. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  66. package/dist/schemas/v3.1/strict/operation.d.ts +8 -0
  67. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  68. package/dist/schemas/v3.1/strict/path-item.d.ts +19 -0
  69. package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
  70. package/dist/schemas/v3.1/strict/path-item.js +5 -0
  71. package/dist/schemas/v3.2/openapi/index.d.ts.map +1 -1
  72. package/dist/schemas/v3.2/openapi/index.js +2 -0
  73. package/dist/schemas/v3.2/openapi/reference.d.ts.map +1 -1
  74. package/dist/schemas/v3.2/openapi/reference.js +11 -3
  75. package/dist/schemas/v3.2/strict/openapi-document.d.ts +805 -140
  76. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  77. package/dist/schemas/v3.2/strict/operation.d.ts +8 -0
  78. package/dist/schemas/v3.2/strict/operation.d.ts.map +1 -1
  79. package/dist/schemas/v3.2/strict/parameter.d.ts +14 -0
  80. package/dist/schemas/v3.2/strict/parameter.d.ts.map +1 -1
  81. package/dist/schemas/v3.2/strict/parameter.js +2 -0
  82. package/dist/server.d.ts.map +1 -1
  83. package/dist/server.js +34 -13
  84. package/package.json +9 -9
@@ -1,5 +1,16 @@
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
1
2
  import { slugify } from '@scalar/helpers/string/slugify';
2
3
  import { DEFAULT_MODELS_SECTION_LABEL } from '@scalar/types/api-reference';
4
+ /**
5
+ * Fixed fields retain their existing links; authored variants need a distinct namespace.
6
+ * Extension methods retain exact case because HTTP method tokens are case-sensitive.
7
+ * Normalizing COPY and copy would collapse distinct operations onto the same anchor.
8
+ */
9
+ const getMethodId = (method) => isHttpMethod(method)
10
+ ? method === method.toLowerCase()
11
+ ? method.toUpperCase()
12
+ : `additionalOperations/${method}`
13
+ : method;
3
14
  /**
4
15
  * Returns options for traversing an OpenAPI document, allowing customization of
5
16
  * how IDs and slugs are generated for tags, headings, models, operations, and webhooks.
@@ -65,11 +76,13 @@ export const getNavigationOptions = (documentName, options) => {
65
76
  return `${prefixTag}${options.generateOperationSlug({
66
77
  path: props.path,
67
78
  operationId: props.operation.operationId,
68
- method: props.method.toUpperCase(),
79
+ method: isHttpMethod(props.method) && props.method === props.method.toLowerCase()
80
+ ? props.method.toUpperCase()
81
+ : props.method,
69
82
  summary: props.operation.summary,
70
83
  })}`;
71
84
  }
72
- return `${prefixTag}${props.method.toUpperCase()}${props.path}`;
85
+ return `${prefixTag}${getMethodId(props.method)}${props.path}`;
73
86
  }
74
87
  // -------- Default webhook id generation logic --------
75
88
  if (props.type === 'webhook') {
@@ -83,13 +96,15 @@ export const getNavigationOptions = (documentName, options) => {
83
96
  if (options?.generateWebhookSlug) {
84
97
  return `${prefixTag}webhook/${options.generateWebhookSlug({
85
98
  name: props.name,
86
- method: props.method?.toUpperCase(),
99
+ method: isHttpMethod(props.method) && props.method === props.method.toLowerCase()
100
+ ? props.method.toUpperCase()
101
+ : props.method,
87
102
  })}`;
88
103
  }
89
104
  // Webhook events are commonly named with dots (e.g. "account_holder.created").
90
105
  // Keep the dot so the deep link stays close to the event name, instead of
91
106
  // dropping it and joining adjacent words ("account-holdercreated").
92
- return `${prefixTag}webhook/${props.method?.toUpperCase()}/${slugify(props.name, { allowedSpecialChars: '.' })}`;
107
+ return `${prefixTag}webhook/${getMethodId(props.method)}/${slugify(props.name, { allowedSpecialChars: '.' })}`;
93
108
  }
94
109
  // -------- Default model id generation logic --------
95
110
  if (props.type === 'model') {
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5F,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAI9F,eAAO,MAAM,qBAAqB,GAAI,WAAW,eAAe,YAE/D,CAAA;AAsED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,sEAM3B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CAC5C,KAAG;IAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;CA0D7C,CAAA"}
1
+ {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5F,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAI9F,eAAO,MAAM,qBAAqB,GAAI,WAAW,eAAe,YAE/D,CAAA;AAsED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,sEAM3B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CAC5C,KAAG;IAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;CA0D7C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { escapeJsonPointer } from '@scalar/json-magic/helpers/escape-json-pointer';
2
- import { forEachPathItemOperation } from '../../helpers/for-each-path-item-operation.js';
2
+ import { forEachPathItemOperation, getPathItemOperationKey } from '../../helpers/for-each-path-item-operation.js';
3
3
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
4
4
  import { isHidden } from '../../helpers/is-hidden.js';
5
5
  import { traverseOperationExamples } from '../../navigation/helpers/traverse-examples.js';
@@ -83,7 +83,7 @@ export const traversePaths = ({ document, tagsMap, generateId, documentId, opera
83
83
  if (isHidden(operation)) {
84
84
  return;
85
85
  }
86
- const ref = `#/paths/${escapeJsonPointer(path)}/${method}`;
86
+ const ref = `#/paths/${escapeJsonPointer(path)}/${getPathItemOperationKey(method)}`;
87
87
  // Traverse tags
88
88
  if (operation.tags?.length) {
89
89
  operation.tags.forEach((tagName) => {
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAA8B,MAAM,wCAAwC,CAAA;AA2DzG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,0EAM9B;IACD,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,wBAAwB,EAAE,MAAM,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,gBAAgB,EAuDnB,CAAA"}
1
+ {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAA8B,MAAM,wCAAwC,CAAA;AA2DzG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,0EAM9B;IACD,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,wBAAwB,EAAE,MAAM,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,gBAAgB,EAuDnB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { forEachPathItemOperation } from '../../helpers/for-each-path-item-operation.js';
1
+ import { forEachPathItemOperation, getPathItemOperationKey } from '../../helpers/for-each-path-item-operation.js';
2
2
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
3
3
  import { isHidden } from '../../helpers/is-hidden.js';
4
4
  import { isDeprecatedOperation } from '../../navigation/helpers/traverse-paths.js';
@@ -62,7 +62,7 @@ export const traverseWebhooks = ({ document, tagsMap, generateId, untaggedWebhoo
62
62
  if (isHidden(operation)) {
63
63
  return;
64
64
  }
65
- const ref = `#/webhooks/${name}/${method}`;
65
+ const ref = `#/webhooks/${name}/${getPathItemOperationKey(method)}`;
66
66
  if (operation.tags?.length) {
67
67
  operation.tags.forEach((tagName) => {
68
68
  const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
@@ -1,4 +1,3 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
1
  import type { WorkspaceStore } from '../../client.js';
3
2
  import type { IdGenerator, TraversedOperation, TraversedTag, TraversedWebhook, WithParent } from '../../schemas/navigation.js';
4
3
  import type { TagObject } from '../../schemas/v3.2/strict/openapi-document.js';
@@ -10,7 +9,7 @@ type UpdateOrderIdParams = {
10
9
  /** Operation or webhook entries to update the order ID for */
11
10
  entries: (WithParent<TraversedOperation> | WithParent<TraversedWebhook>)[];
12
11
  operation: OperationObject;
13
- method: HttpMethod;
12
+ method: string;
14
13
  path: string;
15
14
  } | {
16
15
  /** Tag entries to update the order ID for */
@@ -1 +1 @@
1
- {"version":3,"file":"update-order-ids.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/update-order-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEvH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEtE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,cAAc,CAAA;IACrB,UAAU,EAAE,WAAW,CAAA;CACxB,GAAG,CACA;IACE,8DAA8D;IAC9D,OAAO,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAA;IAC1E,SAAS,EAAE,eAAe,CAAA;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,6CAA6C;IAC7C,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,CAAA;IACnC,GAAG,EAAE,SAAS,CAAA;CACf,CACJ,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,gCAAgC,mBAAmB,SAiEjF,CAAA"}
1
+ {"version":3,"file":"update-order-ids.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/update-order-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AAA"}
@@ -273,8 +273,9 @@ export const syncPathParameters = () => {
273
273
  }
274
274
  const pathString = path[1];
275
275
  // Sync parameters for each operation method
276
- for (const method of HTTP_METHODS) {
277
- const operation = getResolvedRef(node[method], context);
276
+ const additionalOperations = isObject(node.additionalOperations) ? Object.values(node.additionalOperations) : [];
277
+ for (const operationNode of [...HTTP_METHODS.map((method) => node[method]), ...additionalOperations]) {
278
+ const operation = getResolvedRef(operationNode, context);
278
279
  if (!isObject(operation)) {
279
280
  continue;
280
281
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAQnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uDAAuD,CAAA;AAK9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAwClD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,cAAc,EACvB,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB;IAAE,6BAA6B,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3D,MAyBF,CAAA;AAED;;;;;KAKK;AACL,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kGAAkG;IAClG,cAAc,EAAE,cAAc,CAAA;IAC9B,2BAA2B;IAC3B,UAAU,EAAE,eAAe,CAAA;IAC3B,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAA;AAEnE,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,OAAO,oBAAoB,CAAA;AAEjG,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;AAElF,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,kBAMF,CAAA"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAQnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uDAAuD,CAAA;AAK9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAwClD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,cAAc,EACvB,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB;IAAE,6BAA6B,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3D,MAyBF,CAAA;AAED;;;;;KAKK;AACL,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kGAAkG;IAClG,cAAc,EAAE,cAAc,CAAA;IAC9B,2BAA2B;IAC3B,UAAU,EAAE,eAAe,CAAA;IAC3B,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAA;AAEnE,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,OAAO,oBAAoB,CAAA;AAEjG,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;AAElF,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,kBAMF,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
1
2
  import { X_SCALAR_DATE, X_SCALAR_DNT, X_SCALAR_REFERER, X_SCALAR_USER_AGENT } from '@scalar/helpers/http/scalar-headers';
2
3
  import { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables';
3
4
  import { err, ok } from '@scalar/helpers/types/result';
@@ -206,7 +207,7 @@ const buildRequestInner = (request, options) => {
206
207
  *
207
208
  * @see https://github.com/whatwg/fetch/issues/50
208
209
  */
209
- method: request.method.toUpperCase(),
210
+ method: isHttpMethod(request.method) ? request.method.toUpperCase() : request.method,
210
211
  headers,
211
212
  body,
212
213
  cache: request.cache,
@@ -20,5 +20,7 @@ exampleName?: string) => {
20
20
  pathVariables: Record<string, string>;
21
21
  allowReservedQueryParameters: Set<string>;
22
22
  urlParams: URLSearchParams;
23
+ serializedQuery?: string[];
24
+ serializedPathParameters?: Set<string>;
23
25
  };
24
26
  //# sourceMappingURL=build-request-parameters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAqBlH;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB,KAC9B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;CAqG3B,CAAA"}
1
+ {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAqBlH;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB,KAC9B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CA8IvC,CAAA"}
@@ -3,8 +3,8 @@ import { isObject } from '@scalar/helpers/object/is-object';
3
3
  import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
4
4
  import { xScalarCookieSchema, } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
5
5
  import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
6
+ import { getParameterExample } from '../../../helpers/get-parameter-example.js';
6
7
  import { deSerializeParameter } from '../../../request-example/builder/header/de-serialize-parameter.js';
7
- import { getExample } from '../helpers/get-example.js';
8
8
  import { isParamDisabled } from './is-param-disabled.js';
9
9
  import { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './serialize-parameter.js';
10
10
  /** Helper to get explode value with default */
@@ -38,15 +38,58 @@ exampleName = 'default') => {
38
38
  // Second pass: process all parameters
39
39
  for (const referencedParam of parameters) {
40
40
  const param = getResolvedRef(referencedParam);
41
- if (!param)
41
+ if (!param) {
42
42
  continue;
43
- const example = getExample(param, exampleName, undefined);
43
+ }
44
+ const selected = getParameterExample(param, exampleName);
45
+ const { example, value } = selected;
44
46
  // Skip disabled examples
45
47
  if (!example || isParamDisabled(param, example)) {
46
48
  continue;
47
49
  }
48
- /** Replace environment variables in the key and value */
49
- const value = example.value;
50
+ /** Parameter-level wire text already contains its name, delimiters, and encoding. */
51
+ if (selected.serialized) {
52
+ const wireValue = String(value);
53
+ switch (param.in) {
54
+ case 'query':
55
+ ;
56
+ (result.serializedQuery ??= []).push(wireValue);
57
+ break;
58
+ case 'path':
59
+ result.pathVariables[param.name] = wireValue;
60
+ (result.serializedPathParameters ??= new Set()).add(param.name);
61
+ break;
62
+ case 'header':
63
+ result.headers[param.name] = wireValue;
64
+ break;
65
+ case 'cookie':
66
+ result.headers.Cookie = [result.headers.Cookie, wireValue].filter(Boolean).join('; ');
67
+ break;
68
+ }
69
+ continue;
70
+ }
71
+ if (selected.mediaSerialized) {
72
+ const text = String(value);
73
+ switch (param.in) {
74
+ case 'query':
75
+ result.urlParams.set(param.name, text);
76
+ break;
77
+ case 'header':
78
+ result.headers[param.name] = text;
79
+ break;
80
+ case 'path':
81
+ result.pathVariables[param.name] = text;
82
+ break;
83
+ case 'cookie':
84
+ result.cookies.push(coerceValue(xScalarCookieSchema, {
85
+ name: encodeURIComponent(param.name),
86
+ value: encodeURIComponent(text),
87
+ path: '/',
88
+ }));
89
+ break;
90
+ }
91
+ continue;
92
+ }
50
93
  /** De-serialize the example value if it is a string and matches the schema type */
51
94
  const deSerializedValue = deSerializeParameter(value, param);
52
95
  const paramName = param.name;
@@ -82,11 +125,7 @@ exampleName = 'default') => {
82
125
  result.pathVariables[paramName] = String(serialized);
83
126
  break;
84
127
  }
85
- // The 3.2 `querystring` location represents the whole query string. Handle it like a
86
- // regular query parameter so schema-based values still expand into the query string
87
- // instead of being silently dropped.
88
- case 'query':
89
- case 'querystring': {
128
+ case 'query': {
90
129
  processQueryParameter(param, paramName, deSerializedValue, result.urlParams, result.allowReservedQueryParameters);
91
130
  break;
92
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAElH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAgBF,CAAA"}
1
+ {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAIlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAiBF,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { getExampleValue } from '../../../helpers/get-example-value.js';
1
2
  /**
2
3
  * Determines if a parameter is disabled
3
4
  *
@@ -16,7 +17,8 @@ export const isParamDisabled = (param, example, defaultDisabled = true) => {
16
17
  return xDisabled;
17
18
  }
18
19
  // Keep the editor, generated snippets, and outgoing requests aligned for pre-populated values.
19
- const hasValue = example?.value !== undefined && example.value !== '' && example.value !== null;
20
+ const value = getExampleValue(example)?.value;
21
+ const hasValue = value !== undefined && value !== '' && value !== null;
20
22
  if (!defaultDisabled || hasValue) {
21
23
  return false;
22
24
  }
@@ -2,6 +2,7 @@ import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensi
2
2
  import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
3
3
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
4
4
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/operation';
5
+ import { type QuerystringParameter } from '../../helpers/querystring-parameter.js';
5
6
  import { type BuildRequestSecurityResult } from '../../request-example/builder/security/build-request-security.js';
6
7
  import type { SecuritySchemeObjectSecret } from '../../request-example/builder/security/secret-types.js';
7
8
  import type { RequestExampleMeta } from '../../request-example/types.js';
@@ -91,6 +92,8 @@ export type RequestFactory = {
91
92
  * @example { "userId": "{env.USER_ID}" }
92
93
  */
93
94
  variables: Record<string, string>;
95
+ /** Names whose example is already URI-encoded. */
96
+ serializedParameters?: Set<string>;
94
97
  /**
95
98
  * The raw request path string, as entered by the user or read from the OpenAPI schema.
96
99
  * Placeholders are not yet substituted.
@@ -119,6 +122,10 @@ export type RequestFactory = {
119
122
  * The actual query string is assembled later, after variable and environment expansion.
120
123
  */
121
124
  query: URLSearchParams;
125
+ /** URI-ready named-parameter examples, appended without re-encoding. */
126
+ serializedQuery?: string[];
127
+ /** OpenAPI 3.2 whole-query parameter, serialized after environment substitution. */
128
+ querystring?: QuerystringParameter;
122
129
  /**
123
130
  * Headers to be sent with this request, combining spec-provided defaults, user overrides,
124
131
  * and (potentially) security-related fields. All header values are unsubstituted at this stage.
@@ -1 +1 @@
1
- {"version":3,"file":"request-factory.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/request-factory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CA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AAA;QACnB;;;WAGG;QACH,eAAe,EAAE,OAAO,CAAA;KACzB,CAAC,CAAA;CACH,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,kKAY5B,kBAAkB,GAAG;IACtB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAA;IACnB,8DAA8D;IAC9D,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;IACrD,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,KAAG;IACF,OAAO,EAAE,cAAc,CAAA;CAqExB,CAAA"}
1
+ {"version":3,"file":"request-factory.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/request-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAE5F,OAAO,EAAE,KAAK,oBAAoB,EAA2B,MAAM,iCAAiC,CAAA;AAEpG,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,2DAA2D,CAAA;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AACjG,OAAO,KAAK,EAAE,kBAAkB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AGG;AACH,eAAO,MAAM,cAAc,GAAI,kKAY5B,kBAAkB,GAAG;IACtB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAA;IACnB,8DAA8D;IAC9D,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;IACrD,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,KAAG;IACF,OAAO,EAAE,cAAc,CAAA;CA4ExB,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body';
2
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
3
  import { replacePathVariables } from '@scalar/helpers/regex/replace-variables';
3
4
  import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
5
+ import { getQuerystringParameter } from '../../helpers/querystring-parameter.js';
4
6
  import { getServerVariables } from '../../request-example/builder/helpers/get-server-variables.js';
5
7
  import { buildRequestSecurity, } from '../../request-example/builder/security/build-request-security.js';
6
8
  import { filterDisabledDefaultHeaders } from '../context/headers.js';
@@ -14,6 +16,10 @@ export const requestFactory = ({ exampleName, globalCookies, method, operation,
14
16
  const requestBody = getResolvedRef(operation.requestBody);
15
17
  /** Build out the request parameters */
16
18
  const params = buildRequestParameters(operation.parameters ?? [], exampleName);
19
+ const querystringParameter = operation.parameters
20
+ ?.map((parameter) => getResolvedRef(parameter))
21
+ .find((parameter) => parameter?.in === 'querystring');
22
+ const querystring = querystringParameter ? getQuerystringParameter(querystringParameter, exampleName) : undefined;
17
23
  const security = buildRequestSecurity(selectedSecuritySchemes);
18
24
  const headers = new Headers({
19
25
  ...filterDisabledDefaultHeaders(operation, exampleName, defaultHeaders),
@@ -50,10 +56,13 @@ export const requestFactory = ({ exampleName, globalCookies, method, operation,
50
56
  proxyUrl,
51
57
  path: {
52
58
  variables: params.pathVariables,
59
+ ...(params.serializedPathParameters ? { serializedParameters: params.serializedPathParameters } : {}),
53
60
  raw: path,
54
61
  },
55
62
  query: params.urlParams,
56
- method: method.toUpperCase(),
63
+ ...(params.serializedQuery ? { serializedQuery: params.serializedQuery } : {}),
64
+ ...(querystring ? { querystring } : {}),
65
+ method: isHttpMethod(method) && method === method.toLowerCase() ? method.toUpperCase() : method,
57
66
  headers,
58
67
  body,
59
68
  cookies: cookiesList,
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF,MAAM,MAAM,6BAA6B,GAAG,OAAO,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAEnH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;AAK1F;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,8BAqDF,CAAA"}
1
+ {"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAMnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAA;AAEjF,MAAM,MAAM,6BAA6B,GAAG,OAAO,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAEnH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;AAK1F;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,8BAoEF,CAAA"}
@@ -3,6 +3,7 @@ import { err, ok } from '@scalar/helpers/types/result';
3
3
  import { safeRun } from '@scalar/helpers/types/safe-run';
4
4
  import { isRelativePath } from '@scalar/helpers/url/is-relative-path';
5
5
  import { mergeSearchParams, mergeUrls } from '@scalar/helpers/url/merge-urls';
6
+ import { serializeQuerystringParameter } from '../../helpers/querystring-parameter.js';
6
7
  /**
7
8
  * Discriminated error code when the merged request URL is not a complete absolute target
8
9
  * (for example no OpenAPI server, or unresolved `{{environment}}` segments left in the merged URL).
@@ -22,7 +23,9 @@ export const resolveRequestFactoryUrl = (request, options) => {
22
23
  const variables = options.envVariables;
23
24
  const pathVariablesEncoded = safeRun(() => Object.fromEntries(Object.entries(request.path.variables).map(([key, value]) => [
24
25
  key,
25
- encodeURIComponent(replaceEnvVariables(value, variables)),
26
+ request.path.serializedParameters?.has(key)
27
+ ? replaceEnvVariables(value, variables)
28
+ : encodeURIComponent(replaceEnvVariables(value, variables)),
26
29
  ])));
27
30
  if (!pathVariablesEncoded.ok) {
28
31
  return err(INVALID_REQUEST_FACTORY_URL, 'The request URL contains invalid characters in path parameters.');
@@ -54,6 +57,19 @@ export const resolveRequestFactoryUrl = (request, options) => {
54
57
  for (const [key, value] of options.securityQueryParams.entries()) {
55
58
  securityQueryParams.append(key, value);
56
59
  }
57
- url.search = mergeSearchParams(url.searchParams, operationQueryParams, securityQueryParams).toString();
60
+ if (request.querystring) {
61
+ // A whole-query value replaces the server/path query and must never pass through
62
+ // URLSearchParams, which would add '=' and change existing percent encodings.
63
+ const query = serializeQuerystringParameter(request.querystring, variables);
64
+ const extra = mergeSearchParams(operationQueryParams, securityQueryParams).toString();
65
+ url.search = [query, extra].filter(Boolean).join('&');
66
+ }
67
+ else {
68
+ url.search = mergeSearchParams(url.searchParams, operationQueryParams, securityQueryParams).toString();
69
+ }
70
+ if (request.serializedQuery?.length) {
71
+ const query = request.serializedQuery.map((value) => replaceEnvVariables(value, variables)).join('&');
72
+ url.search = [url.search.slice(1), query].filter(Boolean).join('&');
73
+ }
58
74
  return ok(url.toString());
59
75
  };
@@ -1,4 +1,3 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
1
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
3
2
  /**
4
3
  * Restores conventional casing for well-known default headers.
@@ -35,7 +34,7 @@ export declare const filterDisabledDefaultHeaders: (operation: OperationObject,
35
34
  * operation parameter with `in: header` (disabled optional header parameters do not shadow defaults).
36
35
  */
37
36
  export declare const getDefaultHeaders: ({ method, operation, exampleName, hideDisabledHeaders, hideOverriddenHeaders, options, }: {
38
- method: HttpMethod;
37
+ method: string;
39
38
  operation: OperationObject;
40
39
  exampleName: string;
41
40
  hideDisabledHeaders?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/headers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAcnG;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,YAAY,MAAM,KAAG,MACQ,CAAA;AAE3E;;GAEG;AACH,eAAO,MAAM,qCAAqC,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CACK,CAAA;AAgDlH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACvC,WAAW,eAAe,EAC1B,aAAa,MAAM,EACnB,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,CAIpB,CAAA;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,0FAU/B;IACD,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE;QACR,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,OAAO,CAAA;KACpB,CAAA;CACF,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAuCxB,CAAA"}
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/headers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAcnG;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,YAAY,MAAM,KAAG,MACQ,CAAA;AAE3E;;GAEG;AACH,eAAO,MAAM,qCAAqC,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CACK,CAAA;AAgDlH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACvC,WAAW,eAAe,EAC1B,aAAa,MAAM,EACnB,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,CAIpB,CAAA;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,0FAU/B;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE;QACR,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,OAAO,CAAA;KACpB,CAAA;CACF,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAuCxB,CAAA"}
@@ -1,4 +1,3 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
1
  /**
3
2
  * Re-exported from `@scalar/helpers/types/result` so the rest of the
4
3
  * workspace-store codebase keeps importing `Result` from a colocated
@@ -8,7 +7,7 @@ export type { Result } from '@scalar/helpers/types/result';
8
7
  export type RequestExampleMeta = {
9
8
  /** API path, or webhook name when `isWebhook` is true. */
10
9
  path: string;
11
- method: HttpMethod;
10
+ method: string;
12
11
  exampleName: string;
13
12
  /** Resolve the operation from `document.webhooks` instead of `document.paths`. */
14
13
  isWebhook?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request-example/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE;;;;GAIG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/request-example/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA"}
@@ -3,16 +3,22 @@ export declare const XCodeSamplesSchema: import("@scalar/typebox").TObject<{
3
3
  lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
4
4
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
5
5
  source: import("@scalar/typebox").TString;
6
+ example: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
7
+ contentType: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
6
8
  }>>>;
7
9
  'x-code-samples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
8
10
  lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
9
11
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
10
12
  source: import("@scalar/typebox").TString;
13
+ example: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
14
+ contentType: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
11
15
  }>>>;
12
16
  'x-custom-examples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
13
17
  lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
14
18
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
15
19
  source: import("@scalar/typebox").TString;
20
+ example: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
21
+ contentType: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
16
22
  }>>>;
17
23
  'x-readme': import("@scalar/typebox").TOptional<import("@scalar/typebox").TObject<{
18
24
  'code-samples': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
@@ -38,12 +44,18 @@ export declare const XCodeSamplesSchema: import("@scalar/typebox").TObject<{
38
44
  lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
39
45
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
40
46
  source: import("@scalar/typebox").TString;
47
+ example: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
48
+ contentType: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
41
49
  }>>>;
42
50
  }>;
43
51
  export type XCodeSample = {
44
52
  lang?: string;
45
53
  label?: string;
46
54
  source: string;
55
+ /** Request body example key used by this sample. */
56
+ example?: string;
57
+ /** Request body media type used by this sample. */
58
+ contentType?: string;
47
59
  };
48
60
  /** A single ReadMe custom code sample. */
49
61
  export type XReadmeCodeSample = {
@@ -63,6 +75,8 @@ export declare const XCodeSample: import("@scalar/validation").ObjectSchema<{
63
75
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
64
76
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
65
77
  source: import("@scalar/validation").StringSchema;
78
+ example: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
79
+ contentType: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
66
80
  }>;
67
81
  export type XCodeSamples = {
68
82
  'x-codeSamples'?: XCodeSample[];
@@ -81,16 +95,22 @@ export declare const XCodeSamples: import("@scalar/validation").ObjectSchema<{
81
95
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
82
96
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
83
97
  source: import("@scalar/validation").StringSchema;
98
+ example: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
99
+ contentType: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
84
100
  }>>>;
85
101
  'x-code-samples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
86
102
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
87
103
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
88
104
  source: import("@scalar/validation").StringSchema;
105
+ example: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
106
+ contentType: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
89
107
  }>>>;
90
108
  'x-custom-examples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
91
109
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
92
110
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
93
111
  source: import("@scalar/validation").StringSchema;
112
+ example: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
113
+ contentType: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
94
114
  }>>>;
95
115
  'x-readme': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
96
116
  'code-samples': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
@@ -116,6 +136,8 @@ export declare const XCodeSamples: import("@scalar/validation").ObjectSchema<{
116
136
  lang: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
117
137
  label: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
118
138
  source: import("@scalar/validation").StringSchema;
139
+ example: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
140
+ contentType: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
119
141
  }>>>;
120
142
  }>;
121
143
  //# sourceMappingURL=x-code-samples.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-code-samples.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-code-samples.ts"],"names":[],"mappings":"AAqCA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW;;;;EAItB,CAAA;AAuBF,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,CAAC,EAAE,WAAW,EAAE,CAAA;IAC/B,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAA;IAChC,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAA;IACnC,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAA;QACpC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;KAC/B,CAAA;IACD,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,sBAAsB,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAA;IAC9D,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQvB,CAAA"}
1
+ {"version":3,"file":"x-code-samples.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-code-samples.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAA;AAuBF,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,CAAC,EAAE,WAAW,EAAE,CAAA;IAC/B,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAA;IAChC,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAA;IACnC,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAA;QACpC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;KAC/B,CAAA;IACD,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,sBAAsB,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAA;IAC9D,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQvB,CAAA"}
@@ -4,6 +4,8 @@ const XCodeSampleSchema = Type.Object({
4
4
  lang: Type.Optional(Type.String()),
5
5
  label: Type.Optional(Type.String()),
6
6
  source: Type.String(),
7
+ example: Type.Optional(Type.String()),
8
+ contentType: Type.Optional(Type.String()),
7
9
  });
8
10
  /** A single ReadMe custom code sample (`x-readme.code-samples`). */
9
11
  const XReadmeCodeSampleSchema = Type.Object({
@@ -42,6 +44,8 @@ export const XCodeSample = object({
42
44
  lang: optional(string()),
43
45
  label: optional(string()),
44
46
  source: string(),
47
+ example: optional(string()),
48
+ contentType: optional(string()),
45
49
  });
46
50
  const XReadmeCodeSample = object({
47
51
  language: optional(string()),