@scalar/workspace-store 0.18.0 → 0.19.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 (109) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +1 -1
  4. package/dist/client.js.map +2 -2
  5. package/dist/events/bus.d.ts +14 -4
  6. package/dist/events/bus.d.ts.map +1 -1
  7. package/dist/events/bus.js +12 -10
  8. package/dist/events/bus.js.map +2 -2
  9. package/dist/events/definitions/analytics.d.ts +3 -3
  10. package/dist/events/definitions/analytics.d.ts.map +1 -1
  11. package/dist/events/definitions/auth.d.ts +59 -14
  12. package/dist/events/definitions/auth.d.ts.map +1 -1
  13. package/dist/events/definitions/common.d.ts +5 -0
  14. package/dist/events/definitions/common.d.ts.map +1 -0
  15. package/dist/events/definitions/common.js +1 -0
  16. package/dist/events/definitions/common.js.map +7 -0
  17. package/dist/events/definitions/document.d.ts +2 -2
  18. package/dist/events/definitions/environment.d.ts +37 -0
  19. package/dist/events/definitions/environment.d.ts.map +1 -0
  20. package/dist/events/definitions/environment.js +1 -0
  21. package/dist/events/definitions/environment.js.map +7 -0
  22. package/dist/events/definitions/index.d.ts +3 -1
  23. package/dist/events/definitions/index.d.ts.map +1 -1
  24. package/dist/events/definitions/meta.d.ts +9 -3
  25. package/dist/events/definitions/meta.d.ts.map +1 -1
  26. package/dist/events/definitions/operation.d.ts +200 -0
  27. package/dist/events/definitions/operation.d.ts.map +1 -1
  28. package/dist/events/definitions/ui.d.ts +5 -0
  29. package/dist/events/definitions/ui.d.ts.map +1 -1
  30. package/dist/events/index.d.ts +1 -0
  31. package/dist/events/index.d.ts.map +1 -1
  32. package/dist/events/index.js.map +2 -2
  33. package/dist/helpers/generate-unique-value.d.ts +40 -0
  34. package/dist/helpers/generate-unique-value.d.ts.map +1 -0
  35. package/dist/helpers/generate-unique-value.js +42 -0
  36. package/dist/helpers/generate-unique-value.js.map +7 -0
  37. package/dist/helpers/overrides-proxy.d.ts.map +1 -1
  38. package/dist/helpers/overrides-proxy.js +1 -1
  39. package/dist/helpers/overrides-proxy.js.map +2 -2
  40. package/dist/helpers/unpack-proxy.d.ts +1 -1
  41. package/dist/helpers/unpack-proxy.d.ts.map +1 -1
  42. package/dist/helpers/unpack-proxy.js.map +2 -2
  43. package/dist/mutators/auth.d.ts +210 -0
  44. package/dist/mutators/auth.d.ts.map +1 -0
  45. package/dist/mutators/auth.js +223 -0
  46. package/dist/mutators/auth.js.map +7 -0
  47. package/dist/mutators/environment.d.ts +21 -13
  48. package/dist/mutators/environment.d.ts.map +1 -1
  49. package/dist/mutators/environment.js +46 -25
  50. package/dist/mutators/environment.js.map +2 -2
  51. package/dist/mutators/index.d.ts +6 -12
  52. package/dist/mutators/index.d.ts.map +1 -1
  53. package/dist/mutators/index.js +45 -4
  54. package/dist/mutators/index.js.map +2 -2
  55. package/dist/mutators/operation.d.ts +313 -0
  56. package/dist/mutators/operation.d.ts.map +1 -0
  57. package/dist/mutators/operation.js +340 -0
  58. package/dist/mutators/operation.js.map +7 -0
  59. package/dist/schemas/extensions/document/x-scalar-environments.d.ts +52 -0
  60. package/dist/schemas/extensions/document/x-scalar-environments.d.ts.map +1 -0
  61. package/dist/schemas/extensions/document/x-scalar-environments.js +25 -0
  62. package/dist/schemas/extensions/document/x-scalar-environments.js.map +7 -0
  63. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts +13 -0
  64. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts.map +1 -0
  65. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js +9 -0
  66. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js.map +7 -0
  67. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts +21 -0
  68. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.d.ts.map +1 -0
  69. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +8 -0
  70. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +7 -0
  71. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts +17 -0
  72. package/dist/schemas/extensions/security/x-scalar-selected-security.d.ts.map +1 -0
  73. package/dist/schemas/extensions/security/x-scalar-selected-security.js +14 -0
  74. package/dist/schemas/extensions/security/x-scalar-selected-security.js.map +7 -0
  75. package/dist/schemas/extensions/workspace/x-scalar-active-environment.d.ts +8 -0
  76. package/dist/schemas/extensions/workspace/x-scalar-active-environment.d.ts.map +1 -0
  77. package/dist/schemas/extensions/workspace/x-scalar-active-environment.js +8 -0
  78. package/dist/schemas/extensions/workspace/x-scalar-active-environment.js.map +7 -0
  79. package/dist/schemas/inmemory-workspace.d.ts +56 -24
  80. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  81. package/dist/schemas/reference-config/index.d.ts +28 -12
  82. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  83. package/dist/schemas/reference-config/settings.d.ts +28 -12
  84. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  85. package/dist/schemas/v3.1/strict/openapi-document.d.ts +956 -413
  86. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  87. package/dist/schemas/v3.1/strict/openapi-document.js +9 -6
  88. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  89. package/dist/schemas/v3.1/strict/operation.d.ts +10 -6
  90. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  91. package/dist/schemas/v3.1/strict/operation.js +9 -7
  92. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  93. package/dist/schemas/v3.1/strict/request-body.d.ts +6 -3
  94. package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -1
  95. package/dist/schemas/v3.1/strict/request-body.js +15 -8
  96. package/dist/schemas/v3.1/strict/request-body.js.map +2 -2
  97. package/dist/schemas/workspace-specification/config.d.ts +28 -12
  98. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  99. package/dist/schemas/workspace-specification/index.d.ts +28 -12
  100. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  101. package/dist/schemas/workspace.d.ts +227 -103
  102. package/dist/schemas/workspace.d.ts.map +1 -1
  103. package/dist/schemas/workspace.js +16 -10
  104. package/dist/schemas/workspace.js.map +2 -2
  105. package/package.json +9 -4
  106. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +0 -33
  107. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +0 -1
  108. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +0 -23
  109. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +0 -7
@@ -0,0 +1,340 @@
1
+ import { getResolvedRef } from "../helpers/get-resolved-ref.js";
2
+ const updateOperationSummary = ({
3
+ document,
4
+ meta,
5
+ payload: { summary }
6
+ }) => {
7
+ if (!document) {
8
+ return;
9
+ }
10
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
11
+ if (!operation) {
12
+ return;
13
+ }
14
+ operation.summary = summary;
15
+ };
16
+ const updateOperationMethodDraft = ({
17
+ document,
18
+ meta,
19
+ payload: { method }
20
+ }) => {
21
+ if (!document) {
22
+ return;
23
+ }
24
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
25
+ if (!operation) {
26
+ return;
27
+ }
28
+ operation["x-scalar-method"] = method;
29
+ };
30
+ const updateOperationPathDraft = ({
31
+ document,
32
+ meta,
33
+ payload: { path }
34
+ }) => {
35
+ if (!document) {
36
+ return;
37
+ }
38
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
39
+ if (!operation) {
40
+ return;
41
+ }
42
+ operation["x-scalar-path"] = path;
43
+ const pathVariables = Array.from(path.matchAll(/{([^\/}]+)}/g), (m) => m[1]);
44
+ const pathVariablesWithoutPathParameters = operation.parameters?.filter((it) => getResolvedRef(it).in !== "path");
45
+ operation.parameters = [
46
+ ...pathVariablesWithoutPathParameters ?? [],
47
+ ...pathVariables.map((it) => ({
48
+ name: it ?? "",
49
+ in: "path",
50
+ required: true
51
+ }))
52
+ ];
53
+ };
54
+ const addOperationParameter = ({
55
+ document,
56
+ meta,
57
+ payload,
58
+ type
59
+ }) => {
60
+ if (!document) {
61
+ return;
62
+ }
63
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
64
+ if (!operation) {
65
+ return;
66
+ }
67
+ if (!operation.parameters) {
68
+ operation.parameters = [];
69
+ }
70
+ operation.parameters.push({
71
+ name: payload.key,
72
+ in: type,
73
+ required: type === "path" ? true : false,
74
+ examples: {
75
+ [meta.exampleKey]: {
76
+ value: payload.value,
77
+ "x-disabled": !payload.isEnabled
78
+ }
79
+ }
80
+ });
81
+ };
82
+ const updateOperationParameter = ({
83
+ document,
84
+ meta,
85
+ type,
86
+ payload,
87
+ index
88
+ }) => {
89
+ if (!document) {
90
+ return;
91
+ }
92
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
93
+ if (!operation) {
94
+ return;
95
+ }
96
+ const resolvedParameters = operation.parameters?.map((it) => getResolvedRef(it)).filter((it) => it.in === type) ?? [];
97
+ const parameter = resolvedParameters[index];
98
+ if (!parameter) {
99
+ return;
100
+ }
101
+ parameter.name = payload.key ?? parameter.name ?? "";
102
+ if ("examples" in parameter) {
103
+ if (!parameter.examples) {
104
+ parameter.examples = {};
105
+ }
106
+ const example = getResolvedRef(parameter.examples[meta.exampleKey]);
107
+ if (!example) {
108
+ return;
109
+ }
110
+ example.value = payload.value ?? example?.value ?? "";
111
+ example["x-disabled"] = payload.isEnabled === void 0 ? example["x-disabled"] : !payload.isEnabled;
112
+ }
113
+ };
114
+ const deleteOperationParameter = ({
115
+ document,
116
+ meta,
117
+ index,
118
+ type
119
+ }) => {
120
+ if (!document) {
121
+ return;
122
+ }
123
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
124
+ if (!operation) {
125
+ return;
126
+ }
127
+ const resolvedParameters = operation.parameters?.map((it) => getResolvedRef(it)).filter((it) => it.in === type) ?? [];
128
+ const parameter = resolvedParameters[index];
129
+ if (!parameter) {
130
+ return;
131
+ }
132
+ const actualIndex = operation.parameters?.findIndex((it) => getResolvedRef(it) === parameter);
133
+ operation.parameters?.splice(actualIndex, 1);
134
+ };
135
+ const deleteAllOperationParameters = ({
136
+ document,
137
+ meta,
138
+ type
139
+ }) => {
140
+ if (!document) {
141
+ return;
142
+ }
143
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
144
+ if (!operation) {
145
+ return;
146
+ }
147
+ operation.parameters = operation.parameters?.filter((it) => getResolvedRef(it).in !== type) ?? [];
148
+ };
149
+ const updateOperationRequestBodyContentType = ({
150
+ document,
151
+ meta,
152
+ payload
153
+ }) => {
154
+ if (!document) {
155
+ return;
156
+ }
157
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
158
+ if (!operation) {
159
+ return;
160
+ }
161
+ let requestBody = getResolvedRef(operation.requestBody);
162
+ if (!requestBody) {
163
+ operation.requestBody = {
164
+ content: {}
165
+ };
166
+ requestBody = getResolvedRef(operation.requestBody);
167
+ }
168
+ if (!requestBody["x-scalar-selected-content-type"]) {
169
+ requestBody["x-scalar-selected-content-type"] = {};
170
+ }
171
+ requestBody["x-scalar-selected-content-type"][meta.exampleKey] = payload.contentType;
172
+ };
173
+ const updateOperationRequestBodyExample = ({
174
+ document,
175
+ meta,
176
+ payload,
177
+ contentType
178
+ }) => {
179
+ if (!document) {
180
+ return;
181
+ }
182
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
183
+ if (!operation) {
184
+ return;
185
+ }
186
+ let requestBody = getResolvedRef(operation.requestBody);
187
+ if (!requestBody) {
188
+ operation.requestBody = {
189
+ content: {}
190
+ };
191
+ requestBody = getResolvedRef(operation.requestBody);
192
+ }
193
+ if (!requestBody.content[contentType]) {
194
+ requestBody.content[contentType] = {
195
+ examples: {}
196
+ };
197
+ }
198
+ const mediaType = requestBody.content[contentType];
199
+ mediaType.examples ??= {};
200
+ const examples = getResolvedRef(mediaType.examples);
201
+ const example = getResolvedRef(examples[meta.exampleKey]);
202
+ if (!example) {
203
+ examples[meta.exampleKey] = {
204
+ value: payload.value
205
+ };
206
+ return;
207
+ }
208
+ example.value = payload.value;
209
+ };
210
+ const addOperationRequestBodyFormRow = ({
211
+ document,
212
+ meta,
213
+ payload,
214
+ contentType
215
+ }) => {
216
+ if (!document) {
217
+ return;
218
+ }
219
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
220
+ if (!operation) {
221
+ return;
222
+ }
223
+ let requestBody = getResolvedRef(operation.requestBody);
224
+ if (!requestBody) {
225
+ operation.requestBody = {
226
+ content: {}
227
+ };
228
+ requestBody = getResolvedRef(operation.requestBody);
229
+ }
230
+ if (!requestBody.content[contentType]) {
231
+ requestBody.content[contentType] = {
232
+ examples: {}
233
+ };
234
+ }
235
+ if (!requestBody.content[contentType].examples) {
236
+ requestBody.content[contentType].examples = {};
237
+ }
238
+ const examples = getResolvedRef(requestBody.content[contentType].examples);
239
+ const example = getResolvedRef(examples[meta.exampleKey]);
240
+ if (!example || !Array.isArray(example.value)) {
241
+ examples[meta.exampleKey] = {
242
+ value: [
243
+ {
244
+ name: payload.key,
245
+ value: payload.value
246
+ }
247
+ ]
248
+ };
249
+ return;
250
+ }
251
+ example.value.push({
252
+ name: payload.key ?? "",
253
+ value: payload.value ?? ""
254
+ });
255
+ };
256
+ const updateOperationRequestBodyFormRow = ({
257
+ document,
258
+ meta,
259
+ index,
260
+ payload,
261
+ contentType
262
+ }) => {
263
+ if (!document) {
264
+ return;
265
+ }
266
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
267
+ if (!operation) {
268
+ return;
269
+ }
270
+ let requestBody = getResolvedRef(operation.requestBody);
271
+ if (!requestBody) {
272
+ operation.requestBody = {
273
+ content: {}
274
+ };
275
+ requestBody = getResolvedRef(operation.requestBody);
276
+ }
277
+ if (!requestBody.content[contentType]) {
278
+ return;
279
+ }
280
+ const examples = getResolvedRef(requestBody.content[contentType].examples);
281
+ if (!examples) {
282
+ return;
283
+ }
284
+ const example = getResolvedRef(examples[meta.exampleKey]);
285
+ if (!example || !Array.isArray(example.value)) {
286
+ return;
287
+ }
288
+ example.value[index] = {
289
+ name: payload.key ?? example.value[index]?.name ?? "",
290
+ value: payload.value === null ? void 0 : payload.value ?? example.value[index]?.value ?? ""
291
+ };
292
+ };
293
+ const deleteOperationRequestBodyFormRow = ({
294
+ document,
295
+ meta,
296
+ index,
297
+ contentType
298
+ }) => {
299
+ if (!document) {
300
+ return;
301
+ }
302
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
303
+ if (!operation) {
304
+ return;
305
+ }
306
+ const requestBody = getResolvedRef(operation.requestBody);
307
+ if (!requestBody) {
308
+ return;
309
+ }
310
+ if (!requestBody.content[contentType]) {
311
+ return;
312
+ }
313
+ const examples = getResolvedRef(requestBody.content[contentType].examples);
314
+ if (!examples) {
315
+ return;
316
+ }
317
+ const example = getResolvedRef(examples[meta.exampleKey]);
318
+ if (!example || !Array.isArray(example.value)) {
319
+ return;
320
+ }
321
+ example.value.splice(index, 1);
322
+ if (example.value.length === 0) {
323
+ delete requestBody.content[contentType].examples[meta.exampleKey];
324
+ }
325
+ };
326
+ export {
327
+ addOperationParameter,
328
+ addOperationRequestBodyFormRow,
329
+ deleteAllOperationParameters,
330
+ deleteOperationParameter,
331
+ deleteOperationRequestBodyFormRow,
332
+ updateOperationMethodDraft,
333
+ updateOperationParameter,
334
+ updateOperationPathDraft,
335
+ updateOperationRequestBodyContentType,
336
+ updateOperationRequestBodyExample,
337
+ updateOperationRequestBodyFormRow,
338
+ updateOperationSummary
339
+ };
340
+ //# sourceMappingURL=operation.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/mutators/operation.ts"],
4
+ "sourcesContent": ["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\n\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { WorkspaceDocument } from '@/schemas'\n\n/**\n * Describes the minimal identity for an operation in the workspace document.\n * It is used by mutators to find the target operation under `paths`.\n *\n * Example:\n * ```ts\n * const meta: OperationMeta = { method: 'get', path: '/users/{id}' }\n * ```\n */\nexport type OperationMeta = {\n method: HttpMethod\n path: string\n}\n\n/**\n * Extends {@link OperationMeta} with an `exampleKey` to address a specific\n * example variant (e.g. per environment or scenario) for request/parameters.\n *\n * Example:\n * ```ts\n * const meta: OperationExampleMeta = {\n * method: 'post',\n * path: '/upload',\n * exampleKey: 'default',\n * }\n * ```\n */\nexport type OperationExampleMeta = OperationMeta & {\n exampleKey: string\n}\n\n/** ------------------------------------------------------------------------------------------------\n * Operation Draft Mutators\n * ------------------------------------------------------------------------------------------------ */\n\n/**\n * Updates the `summary` of an operation.\n * Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * updateOperationSummary({\n * document,\n * meta: { method: 'get', path: '/users/{id}' },\n * payload: { summary: 'Get a single user' },\n * })\n * ```\n */\nexport const updateOperationSummary = ({\n document,\n meta,\n payload: { summary },\n}: {\n document: WorkspaceDocument | null\n payload: { summary: string }\n meta: OperationMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method as HttpMethod])\n\n if (!operation) {\n return\n }\n\n operation.summary = summary\n}\n\n/**\n * Stores the chosen HTTP method under `x-scalar-method` on the operation.\n * This does not move the operation to a different method slot under `paths`;\n * it records the desired method as an extension for downstream consumers.\n * Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * updateOperationMethodDraft({\n * document,\n * meta: { method: 'get', path: '/users' },\n * payload: { method: 'post' },\n * })\n * ```\n */\nexport const updateOperationMethodDraft = ({\n document,\n meta,\n payload: { method },\n}: {\n document: WorkspaceDocument | null\n payload: { method: HttpMethod }\n meta: OperationMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n if (!operation) {\n return\n }\n\n operation['x-scalar-method'] = method\n}\n\n/**\n * Records a normalized path for the operation under `x-scalar-path`, and\n * synchronizes path parameters in `operation.parameters` with the placeholders\n * present in the provided `path` (e.g. `/users/{id}`). Existing non-path\n * parameters are preserved.\n * Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * updateOperationPathDraft({\n * document,\n * meta: { method: 'get', path: '/users/{id}' },\n * payload: { path: '/users/{id}' },\n * })\n * ```\n */\nexport const updateOperationPathDraft = ({\n document,\n meta,\n payload: { path },\n}: {\n document: WorkspaceDocument | null\n payload: { path: string }\n meta: OperationMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n if (!operation) {\n return\n }\n\n operation['x-scalar-path'] = path\n\n // Extract the path variables from the path\n const pathVariables = Array.from(path.matchAll(/{([^\\/}]+)}/g), (m) => m[1])\n\n // now we need to update the operation path variables\n const pathVariablesWithoutPathParameters = operation.parameters?.filter((it) => getResolvedRef(it).in !== 'path')\n\n operation.parameters = [\n ...(pathVariablesWithoutPathParameters ?? []),\n ...pathVariables.map((it) => ({\n name: it ?? '',\n in: 'path' as const,\n required: true,\n })),\n ]\n}\n\n/** ------------------------------------------------------------------------------------------------\n * Operation Parameters Mutators\n * ------------------------------------------------------------------------------------------------ */\n\n/**\n * Adds a parameter to the operation with an example value tracked by `exampleKey`.\n * For `path` parameters `required` is set to true automatically.\n * Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * addOperationParameter({\n * document,\n * type: 'query',\n * meta: { method: 'get', path: '/search', exampleKey: 'default' },\n * payload: { key: 'q', value: 'john', isEnabled: true },\n * })\n * ```\n */\nexport const addOperationParameter = ({\n document,\n meta,\n payload,\n type,\n}: {\n document: WorkspaceDocument | null\n type: 'header' | 'path' | 'query' | 'cookie'\n payload: {\n key: string\n value: string\n isEnabled: boolean\n }\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n // Initialize parameters array if it doesn't exist\n if (!operation.parameters) {\n operation.parameters = []\n }\n\n // Add the new parameter\n operation.parameters.push({\n name: payload.key,\n in: type,\n required: type === 'path' ? true : false,\n examples: {\n [meta.exampleKey]: {\n value: payload.value,\n 'x-disabled': !payload.isEnabled,\n },\n },\n })\n}\n\n/**\n * Updates an existing parameter of a given `type` by its index within that\n * type subset (e.g. the N-th query parameter). Supports updating name, value,\n * and enabled state for the targeted example.\n * Safely no-ops if the document, operation, or parameter does not exist.\n *\n * Example:\n * ```ts\n * updateOperationParameter({\n * document,\n * type: 'query',\n * index: 0,\n * meta: { method: 'get', path: '/search', exampleKey: 'default' },\n * payload: { value: 'alice', isEnabled: true },\n * })\n * ```\n */\nexport const updateOperationParameter = ({\n document,\n meta,\n type,\n payload,\n index,\n}: {\n document: WorkspaceDocument | null\n type: 'header' | 'path' | 'query' | 'cookie'\n index: number\n payload: Partial<{\n key: string\n value: string\n isEnabled: boolean\n }>\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n // Get all resolved parameters of the specified type\n // The passed index corresponds to this filtered list\n const resolvedParameters = operation.parameters?.map((it) => getResolvedRef(it)).filter((it) => it.in === type) ?? []\n const parameter = resolvedParameters[index]\n\n // Don't proceed if parameter doesn't exist\n if (!parameter) {\n return\n }\n\n parameter.name = payload.key ?? parameter.name ?? ''\n\n // TODO: handle content-type parameters\n if ('examples' in parameter) {\n if (!parameter.examples) {\n parameter.examples = {}\n }\n\n const example = getResolvedRef(parameter.examples[meta.exampleKey])\n\n if (!example) {\n return\n }\n\n example.value = payload.value ?? example?.value ?? ''\n example['x-disabled'] = payload.isEnabled === undefined ? example['x-disabled'] : !payload.isEnabled\n }\n}\n\n/**\n * Removes a parameter from the operation by resolving its position within\n * the filtered list of parameters of the specified `type`.\n * Safely no-ops if the document, operation, or parameter does not exist.\n *\n * Example:\n * ```ts\n * deleteOperationParameter({\n * document,\n * type: 'header',\n * index: 1,\n * meta: { method: 'get', path: '/users', exampleKey: 'default' },\n * })\n * ```\n */\nexport const deleteOperationParameter = ({\n document,\n meta,\n index,\n type,\n}: {\n document: WorkspaceDocument | null\n type: 'header' | 'path' | 'query' | 'cookie'\n index: number\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n // Translate the index from the filtered list to the actual parameters array\n const resolvedParameters = operation.parameters?.map((it) => getResolvedRef(it)).filter((it) => it.in === type) ?? []\n const parameter = resolvedParameters[index]\n\n // Don't proceed if parameter doesn't exist\n if (!parameter) {\n return\n }\n\n const actualIndex = operation.parameters?.findIndex((it) => getResolvedRef(it) === parameter) as number\n\n // Remove the parameter from the operation\n operation.parameters?.splice(actualIndex, 1)\n}\n\n/**\n * Deletes all parameters of a given `type` from the operation.\n * Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * deleteAllOperationParameters({\n * document,\n * type: 'cookie',\n * meta: { method: 'get', path: '/users' },\n * })\n * ```\n */\nexport const deleteAllOperationParameters = ({\n document,\n meta,\n type,\n}: {\n document: WorkspaceDocument | null\n type: 'header' | 'path' | 'query' | 'cookie'\n meta: OperationMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n // Filter out parameters of the specified type\n operation.parameters = operation.parameters?.filter((it) => getResolvedRef(it).in !== type) ?? []\n}\n\n/** ------------------------------------------------------------------------------------------------\n * Operation Request Body Mutators\n * ------------------------------------------------------------------------------------------------ */\n\n/**\n * Sets the selected request-body content type for the current `exampleKey`.\n * This stores the selection under `x-scalar-selected-content-type` on the\n * resolved requestBody. Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * updateOperationRequestBodyContentType({\n * document,\n * meta: { method: 'post', path: '/upload', exampleKey: 'default' },\n * payload: { contentType: 'multipart/form-data' },\n * })\n * ```\n */\nexport const updateOperationRequestBodyContentType = ({\n document,\n meta,\n payload,\n}: {\n document: WorkspaceDocument | null\n payload: {\n contentType: string\n }\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n let requestBody = getResolvedRef(operation.requestBody)\n\n if (!requestBody) {\n operation.requestBody = {\n content: {},\n }\n requestBody = getResolvedRef(operation.requestBody)\n }\n\n if (!requestBody!['x-scalar-selected-content-type']) {\n requestBody!['x-scalar-selected-content-type'] = {}\n }\n\n requestBody!['x-scalar-selected-content-type'][meta.exampleKey] = payload.contentType\n}\n\n/**\n * Creates or updates a concrete example value for a specific request-body\n * `contentType` and `exampleKey`. Safely no-ops if the document or operation\n * does not exist.\n *\n * Example:\n * ```ts\n * updateOperationRequestBodyExample({\n * document,\n * contentType: 'application/json',\n * meta: { method: 'post', path: '/users', exampleKey: 'default' },\n * payload: { value: JSON.stringify({ name: 'Ada' }) },\n * })\n * ```\n */\nexport const updateOperationRequestBodyExample = ({\n document,\n meta,\n payload,\n contentType,\n}: {\n document: WorkspaceDocument | null\n contentType: string\n payload: {\n value: string | File | undefined\n }\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n let requestBody = getResolvedRef(operation.requestBody)\n\n if (!requestBody) {\n operation.requestBody = {\n content: {},\n }\n requestBody = getResolvedRef(operation.requestBody)\n }\n\n if (!requestBody!.content[contentType]) {\n requestBody!.content[contentType] = {\n examples: {},\n }\n }\n\n // Ensure examples object exists and get a resolved reference\n const mediaType = requestBody!.content[contentType]!\n mediaType.examples ??= {}\n const examples = getResolvedRef(mediaType.examples)!\n\n const example = getResolvedRef(examples[meta.exampleKey])\n\n if (!example) {\n examples[meta.exampleKey] = {\n value: payload.value,\n }\n return\n }\n\n example.value = payload.value\n}\n\n/**\n * Appends a form-data row to the request-body example identified by\n * `contentType` and `exampleKey`. Initializes the example as an array when\n * needed. Safely no-ops if the document or operation does not exist.\n *\n * Example:\n * ```ts\n * addOperationRequestBodyFormRow({\n * document,\n * contentType: 'multipart/form-data',\n * meta: { method: 'post', path: '/upload', exampleKey: 'default' },\n * payload: { key: 'file', value: new File(['x'], 'a.txt') },\n * })\n * ```\n */\nexport const addOperationRequestBodyFormRow = ({\n document,\n meta,\n payload,\n contentType,\n}: {\n document: WorkspaceDocument | null\n payload: Partial<{ key: string; value?: string | File }>\n contentType: string\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n let requestBody = getResolvedRef(operation.requestBody)\n\n if (!requestBody) {\n operation.requestBody = {\n content: {},\n }\n requestBody = getResolvedRef(operation.requestBody)\n }\n\n if (!requestBody!.content[contentType]) {\n requestBody!.content[contentType] = {\n examples: {},\n }\n }\n\n if (!requestBody!.content[contentType]!.examples) {\n requestBody!.content[contentType]!.examples = {}\n }\n\n const examples = getResolvedRef(requestBody!.content[contentType]!.examples)\n\n const example = getResolvedRef(examples[meta.exampleKey])\n\n if (!example || !Array.isArray(example.value)) {\n examples[meta.exampleKey] = {\n value: [\n {\n name: payload.key,\n value: payload.value,\n },\n ],\n }\n return\n }\n\n // Add the new row to the example\n example.value.push({\n name: payload.key ?? '',\n value: payload.value ?? '',\n })\n}\n\n/**\n * Updates a form-data row at a given `index` for the specified example and\n * `contentType`. Setting `payload.value` to `null` clears the value (sets to\n * `undefined`). Safely no-ops if the document, operation, or example does not exist.\n *\n * Example:\n * ```ts\n * updateOperationRequestBodyFormRow({\n * document,\n * index: 0,\n * contentType: 'multipart/form-data',\n * meta: { method: 'post', path: '/upload', exampleKey: 'default' },\n * payload: { key: 'description', value: 'Profile picture' },\n * })\n * ```\n */\nexport const updateOperationRequestBodyFormRow = ({\n document,\n meta,\n index,\n payload,\n contentType,\n}: {\n document: WorkspaceDocument | null\n index: number\n payload: Partial<{ key: string; value: string | File | null }>\n contentType: string\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n let requestBody = getResolvedRef(operation.requestBody)\n\n if (!requestBody) {\n operation.requestBody = {\n content: {},\n }\n requestBody = getResolvedRef(operation.requestBody)\n }\n\n if (!requestBody!.content[contentType]) {\n return\n }\n\n const examples = getResolvedRef(requestBody!.content[contentType]!.examples)\n\n if (!examples) {\n return\n }\n\n const example = getResolvedRef(examples[meta.exampleKey])\n\n if (!example || !Array.isArray(example.value)) {\n return\n }\n\n example.value[index] = {\n name: payload.key ?? example.value[index]?.name ?? '',\n value: payload.value === null ? undefined : (payload.value ?? example.value[index]?.value ?? ''),\n }\n}\n\n/**\n * Deletes a form-data row at a given `index` from the example for the given\n * `contentType`. If the example becomes empty, the example entry is removed.\n * Safely no-ops if the document, operation, example, or row does not exist.\n *\n * Example:\n * ```ts\n * deleteOperationRequestBodyFormRow({\n * document,\n * index: 0,\n * contentType: 'multipart/form-data',\n * meta: { method: 'post', path: '/upload', exampleKey: 'default' },\n * })\n * ```\n */\nexport const deleteOperationRequestBodyFormRow = ({\n document,\n meta,\n index,\n contentType,\n}: {\n document: WorkspaceDocument | null\n index: number\n contentType: string\n meta: OperationExampleMeta\n}) => {\n if (!document) {\n return\n }\n\n const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n\n // Don't proceed if operation doesn't exist\n if (!operation) {\n return\n }\n\n const requestBody = getResolvedRef(operation.requestBody)\n\n if (!requestBody) {\n return\n }\n\n if (!requestBody.content[contentType]) {\n return\n }\n\n const examples = getResolvedRef(requestBody.content[contentType]!.examples)\n\n if (!examples) {\n return\n }\n\n const example = getResolvedRef(examples[meta.exampleKey])\n\n if (!example || !Array.isArray(example.value)) {\n return\n }\n\n example.value.splice(index, 1)\n\n if (example.value.length === 0) {\n delete requestBody.content[contentType]!.examples![meta.exampleKey]\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,sBAAsB;AAmDxB,MAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA,SAAS,EAAE,QAAQ;AACrB,MAIM;AACJ,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,YAAY,eAAe,SAAS,QAAQ,KAAK,IAAI,IAAI,KAAK,MAAoB,CAAC;AAEzF,MAAI,CAAC,WAAW;AACd;AAAA,EACF;AAEA,YAAU,UAAU;AACtB;AAiBO,MAAM,6BAA6B,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA,SAAS,EAAE,OAAO;AACpB,MAIM;AACJ,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,YAAY,eAAe,SAAS,QAAQ,KAAK,IAAI,IAAI,KAAK,MAAM,CAAC;AAE3E,MAAI,CAAC,WAAW;AACd;AAAA,EACF;AAEA,YAAU,iBAAiB,IAAI;AACjC;AAkBO,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA,SAAS,EAAE,KAAK;AAClB,MAIM;AACJ,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,YAAY,eAAe,SAAS,QAAQ,KAAK,IAAI,IAAI,KAAK,MAAM,CAAC;AAE3E,MAAI,CAAC,WAAW;AACd;AAAA,EACF;AAEA,YAAU,eAAe,IAAI;AAG7B,QAAM,gBAAgB,MAAM,KAAK,KAAK,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B;AAAA,EACF;AAEA,MAAI,CAAC,YAAY,QAAQ,WAAW,GAAG;AACrC;AAAA,EACF;AAEA,QAAM,WAAW,eAAe,YAAY,QAAQ,WAAW,EAAG,QAAQ;AAE1E,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,UAAU,eAAe,SAAS,KAAK,UAAU,CAAC;AAExD,MAAI,CAAC,WAAW,CAAC,MAAM,QAAQ,QAAQ,KAAK,GAAG;AAC7C;AAAA,EACF;AAEA,UAAQ,MAAM,OAAO,OAAO,CAAC;AAE7B,MAAI,QAAQ,MAAM,WAAW,GAAG;AAC9B,WAAO,YAAY,QAAQ,WAAW,EAAG,SAAU,KAAK,UAAU;AAAA,EACpE;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,52 @@
1
+ export declare const xScalarEnvVarSchema: import("@scalar/typebox").TObject<{
2
+ name: import("@scalar/typebox").TString;
3
+ value: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TObject<{
4
+ description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
5
+ default: import("@scalar/typebox").TString;
6
+ }>, import("@scalar/typebox").TString]>;
7
+ }>;
8
+ /** A scalar environment variable */
9
+ export type XScalarEnvVar = {
10
+ name: string;
11
+ value: {
12
+ description?: string;
13
+ default: string;
14
+ } | string;
15
+ };
16
+ export declare const xScalarEnvironmentSchema: import("@scalar/typebox").TObject<{
17
+ description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
18
+ color: import("@scalar/typebox").TString;
19
+ variables: import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
20
+ name: import("@scalar/typebox").TString;
21
+ value: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TObject<{
22
+ description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
23
+ default: import("@scalar/typebox").TString;
24
+ }>, import("@scalar/typebox").TString]>;
25
+ }>>;
26
+ }>;
27
+ export type XScalarEnvironment = {
28
+ /** Optional description for the environment */
29
+ description?: string;
30
+ /** Color for the environment */
31
+ color: string;
32
+ /** An array of variables */
33
+ variables: XScalarEnvVar[];
34
+ };
35
+ export declare const xScalarEnvironmentsSchema: import("@scalar/typebox").TObject<{
36
+ 'x-scalar-environments': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TObject<{
37
+ description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
38
+ color: import("@scalar/typebox").TString;
39
+ variables: import("@scalar/typebox").TArray<import("@scalar/typebox").TObject<{
40
+ name: import("@scalar/typebox").TString;
41
+ value: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TObject<{
42
+ description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
43
+ default: import("@scalar/typebox").TString;
44
+ }>, import("@scalar/typebox").TString]>;
45
+ }>>;
46
+ }>>>;
47
+ }>;
48
+ export type XScalarEnvironments = {
49
+ /** A record of environments by name */
50
+ 'x-scalar-environments'?: Record<string, XScalarEnvironment>;
51
+ };
52
+ //# sourceMappingURL=x-scalar-environments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-environments.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/document/x-scalar-environments.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;EAS9B,CAAA;AAEF,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EACD;QACE,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;KAChB,GACD,MAAM,CAAA;CACX,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;EAInC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,SAAS,EAAE,aAAa,EAAE,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAEpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,uCAAuC;IACvC,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CAC7D,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { Type } from "@scalar/typebox";
2
+ const xScalarEnvVarSchema = Type.Object({
3
+ name: Type.String(),
4
+ value: Type.Union([
5
+ Type.Object({
6
+ description: Type.Optional(Type.String()),
7
+ default: Type.String({ default: "" })
8
+ }),
9
+ Type.String()
10
+ ])
11
+ });
12
+ const xScalarEnvironmentSchema = Type.Object({
13
+ description: Type.Optional(Type.String()),
14
+ color: Type.String({ default: "#FFFFFF" }),
15
+ variables: Type.Array(xScalarEnvVarSchema)
16
+ });
17
+ const xScalarEnvironmentsSchema = Type.Object({
18
+ "x-scalar-environments": Type.Optional(Type.Record(Type.String(), xScalarEnvironmentSchema))
19
+ });
20
+ export {
21
+ xScalarEnvVarSchema,
22
+ xScalarEnvironmentSchema,
23
+ xScalarEnvironmentsSchema
24
+ };
25
+ //# sourceMappingURL=x-scalar-environments.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/schemas/extensions/document/x-scalar-environments.ts"],
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const xScalarEnvVarSchema = Type.Object({\n name: Type.String(),\n value: Type.Union([\n Type.Object({\n description: Type.Optional(Type.String()),\n default: Type.String({ default: '' }),\n }),\n Type.String(),\n ]),\n})\n\n/** A scalar environment variable */\nexport type XScalarEnvVar = {\n name: string\n value:\n | {\n description?: string\n default: string\n }\n | string\n}\n\nexport const xScalarEnvironmentSchema = Type.Object({\n description: Type.Optional(Type.String()),\n color: Type.String({ default: '#FFFFFF' }),\n variables: Type.Array(xScalarEnvVarSchema),\n})\n\nexport type XScalarEnvironment = {\n /** Optional description for the environment */\n description?: string\n /** Color for the environment */\n color: string\n /** An array of variables */\n variables: XScalarEnvVar[]\n}\n\nexport const xScalarEnvironmentsSchema = Type.Object({\n 'x-scalar-environments': Type.Optional(Type.Record(Type.String(), xScalarEnvironmentSchema)),\n})\n\nexport type XScalarEnvironments = {\n /** A record of environments by name */\n 'x-scalar-environments'?: Record<string, XScalarEnvironment>\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM,KAAK,OAAO;AAAA,EAClB,OAAO,KAAK,MAAM;AAAA,IAChB,KAAK,OAAO;AAAA,MACV,aAAa,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,MACxC,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,CAAC;AAAA,IACtC,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,EACd,CAAC;AACH,CAAC;AAaM,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,aAAa,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACxC,OAAO,KAAK,OAAO,EAAE,SAAS,UAAU,CAAC;AAAA,EACzC,WAAW,KAAK,MAAM,mBAAmB;AAC3C,CAAC;AAWM,MAAM,4BAA4B,KAAK,OAAO;AAAA,EACnD,yBAAyB,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,wBAAwB,CAAC;AAC7F,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ import { type Static } from '@scalar/typebox';
2
+ /**
3
+ * path and method identifiers for Scalar operations
4
+ *
5
+ * Used internally by Scalar to keep track of operations
6
+ * as a draft state when you edit the path/method before saving the new operation
7
+ */
8
+ export declare const XScalarOperationIdentifiersSchema: import("@scalar/typebox").TObject<{
9
+ 'x-scalar-path': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
10
+ 'x-scalar-method': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
11
+ }>;
12
+ export type XScalarOperationIdentifiers = Static<typeof XScalarOperationIdentifiersSchema>;
13
+ //# sourceMappingURL=x-scalar-operation-identifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-operation-identifiers.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-scalar-operation-identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC;;;EAG5C,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,OAAO,iCAAiC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { Type } from "@scalar/typebox";
2
+ const XScalarOperationIdentifiersSchema = Type.Object({
3
+ "x-scalar-path": Type.Optional(Type.String()),
4
+ "x-scalar-method": Type.Optional(Type.String())
5
+ });
6
+ export {
7
+ XScalarOperationIdentifiersSchema
8
+ };
9
+ //# sourceMappingURL=x-scalar-operation-identifiers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/schemas/extensions/operation/x-scalar-operation-identifiers.ts"],
4
+ "sourcesContent": ["import { type Static, Type } from '@scalar/typebox'\n\n/**\n * path and method identifiers for Scalar operations\n *\n * Used internally by Scalar to keep track of operations\n * as a draft state when you edit the path/method before saving the new operation\n */\nexport const XScalarOperationIdentifiersSchema = Type.Object({\n 'x-scalar-path': Type.Optional(Type.String()),\n 'x-scalar-method': Type.Optional(Type.String()),\n})\n\nexport type XScalarOperationIdentifiers = Static<typeof XScalarOperationIdentifiersSchema>\n"],
5
+ "mappings": "AAAA,SAAsB,YAAY;AAQ3B,MAAM,oCAAoC,KAAK,OAAO;AAAA,EAC3D,iBAAiB,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EAC5C,mBAAmB,KAAK,SAAS,KAAK,OAAO,CAAC;AAChD,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Schema for the x-scalar-selected-content-type extension on an OpenAPI operation.
3
+ *
4
+ * The key represents the example name, and the value is the selected content type string.
5
+ * Used by Scalar to track which content type is selected for each example in request or response bodies.
6
+ */
7
+ export declare const XScalarSelectedContentTypeSchema: import("@scalar/typebox").TObject<{
8
+ 'x-scalar-selected-content-type': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TString>>;
9
+ }>;
10
+ /**
11
+ * Type definition for the x-scalar-selected-content-type extension on an OpenAPI operation.
12
+ *
13
+ * The key represents the example name, and the value is the selected content type string.
14
+ * Used by Scalar to track which content type is selected for each example in request or response bodies.
15
+ */
16
+ export type XScalarSelectedContentType = {
17
+ 'x-scalar-selected-content-type'?: {
18
+ [key: string]: string;
19
+ };
20
+ };
21
+ //# sourceMappingURL=x-scalar-selected-content-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-selected-content-type.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-scalar-selected-content-type.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC;;EAE3C,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,gCAAgC,CAAC,EAAE;QACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;CACF,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Type } from "@scalar/typebox";
2
+ const XScalarSelectedContentTypeSchema = Type.Object({
3
+ "x-scalar-selected-content-type": Type.Optional(Type.Record(Type.String(), Type.String()))
4
+ });
5
+ export {
6
+ XScalarSelectedContentTypeSchema
7
+ };
8
+ //# sourceMappingURL=x-scalar-selected-content-type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/schemas/extensions/operation/x-scalar-selected-content-type.ts"],
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Schema for the x-scalar-selected-content-type extension on an OpenAPI operation.\n *\n * The key represents the example name, and the value is the selected content type string.\n * Used by Scalar to track which content type is selected for each example in request or response bodies.\n */\nexport const XScalarSelectedContentTypeSchema = Type.Object({\n 'x-scalar-selected-content-type': Type.Optional(Type.Record(Type.String(), Type.String())),\n})\n\n/**\n * Type definition for the x-scalar-selected-content-type extension on an OpenAPI operation.\n *\n * The key represents the example name, and the value is the selected content type string.\n * Used by Scalar to track which content type is selected for each example in request or response bodies.\n */\nexport type XScalarSelectedContentType = {\n 'x-scalar-selected-content-type'?: {\n [key: string]: string\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAQd,MAAM,mCAAmC,KAAK,OAAO;AAAA,EAC1D,kCAAkC,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC;AAC3F,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,17 @@
1
+ import type { SecurityRequirementObject } from '../../../schemas/v3.1/strict/security-requirement.js';
2
+ /**
3
+ * Selected security schemes and the currently selected tab
4
+ */
5
+ export declare const XScalarSelectedSecuritySchema: import("@scalar/typebox").TObject<{
6
+ 'x-scalar-selected-security': import("@scalar/typebox").TOptional<import("@scalar/typebox").TObject<{
7
+ 'x-selected-index': import("@scalar/typebox").TInteger;
8
+ 'x-schemes': import("@scalar/typebox").TArray<import("@scalar/typebox").TRef<"SecurityRequirementObject">>;
9
+ }>>;
10
+ }>;
11
+ export type XScalarSelectedSecurity = {
12
+ 'x-scalar-selected-security'?: {
13
+ 'x-selected-index': number;
14
+ 'x-schemes': SecurityRequirementObject[];
15
+ };
16
+ };
17
+ //# sourceMappingURL=x-scalar-selected-security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-selected-security.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-scalar-selected-security.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAE3F;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;EAOxC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,4BAA4B,CAAC,EAAE;QAC7B,kBAAkB,EAAE,MAAM,CAAA;QAC1B,WAAW,EAAE,yBAAyB,EAAE,CAAA;KACzC,CAAA;CACF,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { Type } from "@scalar/typebox";
2
+ import { SecurityRequirementObjectRef } from "../../../schemas/v3.1/strict/ref-definitions.js";
3
+ const XScalarSelectedSecuritySchema = Type.Object({
4
+ "x-scalar-selected-security": Type.Optional(
5
+ Type.Object({
6
+ "x-selected-index": Type.Integer(),
7
+ "x-schemes": Type.Array(SecurityRequirementObjectRef)
8
+ })
9
+ )
10
+ });
11
+ export {
12
+ XScalarSelectedSecuritySchema
13
+ };
14
+ //# sourceMappingURL=x-scalar-selected-security.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/schemas/extensions/security/x-scalar-selected-security.ts"],
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nimport { SecurityRequirementObjectRef } from '@/schemas/v3.1/strict/ref-definitions'\nimport type { SecurityRequirementObject } from '@/schemas/v3.1/strict/security-requirement'\n\n/**\n * Selected security schemes and the currently selected tab\n */\nexport const XScalarSelectedSecuritySchema = Type.Object({\n 'x-scalar-selected-security': Type.Optional(\n Type.Object({\n 'x-selected-index': Type.Integer(),\n 'x-schemes': Type.Array(SecurityRequirementObjectRef),\n }),\n ),\n})\n\nexport type XScalarSelectedSecurity = {\n 'x-scalar-selected-security'?: {\n 'x-selected-index': number\n 'x-schemes': SecurityRequirementObject[]\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAErB,SAAS,oCAAoC;AAMtC,MAAM,gCAAgC,KAAK,OAAO;AAAA,EACvD,8BAA8B,KAAK;AAAA,IACjC,KAAK,OAAO;AAAA,MACV,oBAAoB,KAAK,QAAQ;AAAA,MACjC,aAAa,KAAK,MAAM,4BAA4B;AAAA,IACtD,CAAC;AAAA,EACH;AACF,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ export declare const XScalarActiveEnvironmentSchema: import("@scalar/typebox").TObject<{
2
+ 'x-scalar-active-environment': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
3
+ }>;
4
+ export type XScalarActiveEnvironment = {
5
+ /** The currently selected environment */
6
+ 'x-scalar-active-environment'?: string;
7
+ };
8
+ //# sourceMappingURL=x-scalar-active-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-active-environment.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/workspace/x-scalar-active-environment.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B;;EAEzC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,yCAAyC;IACzC,6BAA6B,CAAC,EAAE,MAAM,CAAA;CACvC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Type } from "@scalar/typebox";
2
+ const XScalarActiveEnvironmentSchema = Type.Object({
3
+ "x-scalar-active-environment": Type.Optional(Type.String())
4
+ });
5
+ export {
6
+ XScalarActiveEnvironmentSchema
7
+ };
8
+ //# sourceMappingURL=x-scalar-active-environment.js.map