@scalar/oas-utils 0.2.75 → 0.2.77

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 (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/entities/spec/collection.d.ts +292 -0
  3. package/dist/entities/spec/collection.d.ts.map +1 -1
  4. package/dist/entities/spec/collection.js +11 -1
  5. package/dist/entities/spec/index.js +2 -2
  6. package/dist/entities/spec/parameters.d.ts +2 -2
  7. package/dist/entities/spec/request-examples.d.ts +228 -70
  8. package/dist/entities/spec/request-examples.d.ts.map +1 -1
  9. package/dist/entities/spec/request-examples.js +156 -4
  10. package/dist/entities/spec/requests.d.ts +205 -11
  11. package/dist/entities/spec/requests.d.ts.map +1 -1
  12. package/dist/entities/spec/requests.js +16 -11
  13. package/dist/entities/spec/server.d.ts +2 -2
  14. package/dist/entities/spec/server.d.ts.map +1 -1
  15. package/dist/entities/spec/spec-objects.d.ts +20 -10
  16. package/dist/entities/spec/spec-objects.d.ts.map +1 -1
  17. package/dist/entities/spec/spec-objects.js +6 -1
  18. package/dist/entities/spec/x-scalar-environments.d.ts +74 -0
  19. package/dist/entities/spec/x-scalar-environments.d.ts.map +1 -0
  20. package/dist/entities/spec/x-scalar-environments.js +23 -0
  21. package/dist/entities/spec/x-scalar-secrets.d.ts +23 -0
  22. package/dist/entities/spec/x-scalar-secrets.d.ts.map +1 -0
  23. package/dist/entities/spec/x-scalar-secrets.js +9 -0
  24. package/dist/helpers/redirectToProxy.d.ts +1 -1
  25. package/dist/helpers/redirectToProxy.d.ts.map +1 -1
  26. package/dist/helpers/redirectToProxy.js +13 -2
  27. package/dist/helpers/regexHelpers.d.ts +1 -0
  28. package/dist/helpers/regexHelpers.d.ts.map +1 -1
  29. package/dist/helpers/regexHelpers.js +1 -0
  30. package/dist/migrations/v-2.1.0/migration.d.ts +1 -1
  31. package/dist/spec-getters/getExampleFromSchema.d.ts +1 -0
  32. package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
  33. package/dist/spec-getters/getRequestBodyFromOperation.d.ts +1 -1
  34. package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
  35. package/dist/spec-getters/getRequestBodyFromOperation.js +2 -5
  36. package/dist/spec-getters/getRequestFromOperation.d.ts +1 -1
  37. package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -1
  38. package/dist/spec-getters/getRequestFromOperation.js +2 -2
  39. package/dist/transforms/export-spec.d.ts +14 -71
  40. package/dist/transforms/export-spec.d.ts.map +1 -1
  41. package/dist/transforms/export-spec.js +73 -0
  42. package/dist/transforms/import-spec.js +1 -1
  43. package/dist/transforms/index.d.ts +1 -0
  44. package/dist/transforms/index.d.ts.map +1 -1
  45. package/dist/transforms/index.js +1 -0
  46. package/package.json +6 -6
@@ -2,14 +2,18 @@ import { z } from 'zod';
2
2
  import type { RequestParameter } from './parameters.js';
3
3
  import type { Request } from './requests.js';
4
4
  import type { Server } from './server.js';
5
+ /**
6
+ * TODO: Deprecate this.
7
+ *
8
+ * The request schema should be stored in the request and any
9
+ * parameters should be validated against that
10
+ */
5
11
  export declare const requestExampleParametersSchema: z.ZodObject<{
6
12
  key: z.ZodDefault<z.ZodString>;
7
13
  value: z.ZodDefault<z.ZodString>;
8
14
  enabled: z.ZodDefault<z.ZodBoolean>;
9
15
  file: z.ZodOptional<z.ZodAny>;
10
16
  description: z.ZodOptional<z.ZodString>;
11
- /** Params are linked to parents such as path params and global headers/cookies */
12
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
13
17
  required: z.ZodOptional<z.ZodBoolean>;
14
18
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
19
  type: z.ZodOptional<z.ZodString>;
@@ -31,7 +35,6 @@ export declare const requestExampleParametersSchema: z.ZodObject<{
31
35
  enum?: string[] | undefined;
32
36
  format?: string | undefined;
33
37
  file?: any;
34
- refUid?: string | undefined;
35
38
  nullable?: boolean | undefined;
36
39
  }, {
37
40
  minimum?: number | undefined;
@@ -46,11 +49,65 @@ export declare const requestExampleParametersSchema: z.ZodObject<{
46
49
  key?: string | undefined;
47
50
  enabled?: boolean | undefined;
48
51
  file?: any;
49
- refUid?: string | undefined;
50
52
  nullable?: boolean | undefined;
51
53
  }>;
52
54
  /** Request examples - formerly known as instances - are "children" of requests */
53
55
  export type RequestExampleParameter = z.infer<typeof requestExampleParametersSchema>;
56
+ export declare const xScalarFileValueSchema: z.ZodNullable<z.ZodObject<{
57
+ url: z.ZodString;
58
+ base64: z.ZodOptional<z.ZodString>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ url: string;
61
+ base64?: string | undefined;
62
+ }, {
63
+ url: string;
64
+ base64?: string | undefined;
65
+ }>>;
66
+ /**
67
+ * When files are required for an example we provide the options
68
+ * to provide a public URL or a base64 encoded string
69
+ */
70
+ export type XScalarFileValue = z.infer<typeof xScalarFileValueSchema>;
71
+ /**
72
+ * Schema for the OAS serialization of request example parameters
73
+ *
74
+ * File values can be optionally fetched on import OR inserted as a base64 encoded string
75
+ */
76
+ export declare const xScalarFormDataValue: z.ZodUnion<[z.ZodObject<{
77
+ type: z.ZodLiteral<"string">;
78
+ value: z.ZodString;
79
+ }, "strip", z.ZodTypeAny, {
80
+ type: "string";
81
+ value: string;
82
+ }, {
83
+ type: "string";
84
+ value: string;
85
+ }>, z.ZodObject<{
86
+ type: z.ZodLiteral<"file">;
87
+ file: z.ZodNullable<z.ZodObject<{
88
+ url: z.ZodString;
89
+ base64: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ url: string;
92
+ base64?: string | undefined;
93
+ }, {
94
+ url: string;
95
+ base64?: string | undefined;
96
+ }>>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ type: "file";
99
+ file: {
100
+ url: string;
101
+ base64?: string | undefined;
102
+ } | null;
103
+ }, {
104
+ type: "file";
105
+ file: {
106
+ url: string;
107
+ base64?: string | undefined;
108
+ } | null;
109
+ }>]>;
110
+ export type XScalarFormDataValue = z.infer<typeof xScalarFormDataValue>;
54
111
  /**
55
112
  * Possible encodings for example request bodies when using text formats
56
113
  *
@@ -58,6 +115,13 @@ export type RequestExampleParameter = z.infer<typeof requestExampleParametersSch
58
115
  */
59
116
  export declare const exampleRequestBodyEncoding: readonly ["json", "text", "html", "javascript", "xml", "yaml", "edn"];
60
117
  export type BodyEncoding = (typeof exampleRequestBodyEncoding)[number];
118
+ export declare const exampleBodyMime: readonly ["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"];
119
+ export type BodyMime = (typeof exampleBodyMime)[number];
120
+ /**
121
+ * TODO: Migrate away from this layout to the format used in the extension
122
+ *
123
+ * If a user changes the encoding of the body we expect the content to change as well
124
+ */
61
125
  export declare const exampleRequestBodySchema: z.ZodObject<{
62
126
  raw: z.ZodOptional<z.ZodObject<{
63
127
  encoding: z.ZodDefault<z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>>;
@@ -77,8 +141,6 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
77
141
  enabled: z.ZodDefault<z.ZodBoolean>;
78
142
  file: z.ZodOptional<z.ZodAny>;
79
143
  description: z.ZodOptional<z.ZodString>;
80
- /** Params are linked to parents such as path params and global headers/cookies */
81
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
82
144
  required: z.ZodOptional<z.ZodBoolean>;
83
145
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
84
146
  type: z.ZodOptional<z.ZodString>;
@@ -100,7 +162,6 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
100
162
  enum?: string[] | undefined;
101
163
  format?: string | undefined;
102
164
  file?: any;
103
- refUid?: string | undefined;
104
165
  nullable?: boolean | undefined;
105
166
  }, {
106
167
  minimum?: number | undefined;
@@ -115,7 +176,6 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
115
176
  key?: string | undefined;
116
177
  enabled?: boolean | undefined;
117
178
  file?: any;
118
- refUid?: string | undefined;
119
179
  nullable?: boolean | undefined;
120
180
  }>, "many">>;
121
181
  }, "strip", z.ZodTypeAny, {
@@ -132,7 +192,6 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
132
192
  enum?: string[] | undefined;
133
193
  format?: string | undefined;
134
194
  file?: any;
135
- refUid?: string | undefined;
136
195
  nullable?: boolean | undefined;
137
196
  }[];
138
197
  encoding: "form-data" | "urlencoded";
@@ -150,7 +209,6 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
150
209
  key?: string | undefined;
151
210
  enabled?: boolean | undefined;
152
211
  file?: any;
153
- refUid?: string | undefined;
154
212
  nullable?: boolean | undefined;
155
213
  }[] | undefined;
156
214
  encoding?: "form-data" | "urlencoded" | undefined;
@@ -158,7 +216,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
158
216
  binary: z.ZodOptional<z.ZodType<Blob, z.ZodTypeDef, Blob>>;
159
217
  activeBody: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"raw">, z.ZodLiteral<"formData">, z.ZodLiteral<"binary">]>>;
160
218
  }, "strip", z.ZodTypeAny, {
161
- activeBody: "formData" | "raw" | "binary";
219
+ activeBody: "formData" | "binary" | "raw";
162
220
  formData?: {
163
221
  value: {
164
222
  value: string;
@@ -173,16 +231,15 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
173
231
  enum?: string[] | undefined;
174
232
  format?: string | undefined;
175
233
  file?: any;
176
- refUid?: string | undefined;
177
234
  nullable?: boolean | undefined;
178
235
  }[];
179
236
  encoding: "form-data" | "urlencoded";
180
237
  } | undefined;
238
+ binary?: Blob | undefined;
181
239
  raw?: {
182
240
  value: string;
183
241
  encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
184
242
  } | undefined;
185
- binary?: Blob | undefined;
186
243
  }, {
187
244
  formData?: {
188
245
  value?: {
@@ -198,22 +255,57 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
198
255
  key?: string | undefined;
199
256
  enabled?: boolean | undefined;
200
257
  file?: any;
201
- refUid?: string | undefined;
202
258
  nullable?: boolean | undefined;
203
259
  }[] | undefined;
204
260
  encoding?: "form-data" | "urlencoded" | undefined;
205
261
  } | undefined;
262
+ binary?: Blob | undefined;
206
263
  raw?: {
207
264
  value?: string | undefined;
208
265
  encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
209
266
  } | undefined;
210
- binary?: Blob | undefined;
211
- activeBody?: "formData" | "raw" | "binary" | undefined;
267
+ activeBody?: "formData" | "binary" | "raw" | undefined;
212
268
  }>;
213
269
  export type ExampleRequestBody = z.infer<typeof exampleRequestBodySchema>;
270
+ /** Schema for the OAS serialization of request example bodies */
271
+ export declare const xScalarExampleBodySchema: z.ZodObject<{
272
+ encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
273
+ /**
274
+ * Body content as an object with a separately specified encoding or a simple pre-encoded string value
275
+ *
276
+ * Ideally we would convert any objects into the proper encoding on import
277
+ */
278
+ content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
279
+ /** When the encoding is `binary` this will be used to link to the file */
280
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
281
+ url: z.ZodString;
282
+ base64: z.ZodOptional<z.ZodString>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ url: string;
285
+ base64?: string | undefined;
286
+ }, {
287
+ url: string;
288
+ base64?: string | undefined;
289
+ }>>>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ content: string | Record<string, any>;
292
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
293
+ file?: {
294
+ url: string;
295
+ base64?: string | undefined;
296
+ } | null | undefined;
297
+ }, {
298
+ content: string | Record<string, any>;
299
+ file?: {
300
+ url: string;
301
+ base64?: string | undefined;
302
+ } | null | undefined;
303
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
304
+ }>;
305
+ export type XScalarExampleBody = z.infer<typeof xScalarExampleBodySchema>;
214
306
  export declare const requestExampleSchema: z.ZodObject<{
215
- type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"requestExample">>>;
216
307
  uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
308
+ type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"requestExample">>>;
217
309
  requestUid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
218
310
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
219
311
  body: z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -235,8 +327,6 @@ export declare const requestExampleSchema: z.ZodObject<{
235
327
  enabled: z.ZodDefault<z.ZodBoolean>;
236
328
  file: z.ZodOptional<z.ZodAny>;
237
329
  description: z.ZodOptional<z.ZodString>;
238
- /** Params are linked to parents such as path params and global headers/cookies */
239
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
240
330
  required: z.ZodOptional<z.ZodBoolean>;
241
331
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
242
332
  type: z.ZodOptional<z.ZodString>;
@@ -258,7 +348,6 @@ export declare const requestExampleSchema: z.ZodObject<{
258
348
  enum?: string[] | undefined;
259
349
  format?: string | undefined;
260
350
  file?: any;
261
- refUid?: string | undefined;
262
351
  nullable?: boolean | undefined;
263
352
  }, {
264
353
  minimum?: number | undefined;
@@ -273,7 +362,6 @@ export declare const requestExampleSchema: z.ZodObject<{
273
362
  key?: string | undefined;
274
363
  enabled?: boolean | undefined;
275
364
  file?: any;
276
- refUid?: string | undefined;
277
365
  nullable?: boolean | undefined;
278
366
  }>, "many">>;
279
367
  }, "strip", z.ZodTypeAny, {
@@ -290,7 +378,6 @@ export declare const requestExampleSchema: z.ZodObject<{
290
378
  enum?: string[] | undefined;
291
379
  format?: string | undefined;
292
380
  file?: any;
293
- refUid?: string | undefined;
294
381
  nullable?: boolean | undefined;
295
382
  }[];
296
383
  encoding: "form-data" | "urlencoded";
@@ -308,7 +395,6 @@ export declare const requestExampleSchema: z.ZodObject<{
308
395
  key?: string | undefined;
309
396
  enabled?: boolean | undefined;
310
397
  file?: any;
311
- refUid?: string | undefined;
312
398
  nullable?: boolean | undefined;
313
399
  }[] | undefined;
314
400
  encoding?: "form-data" | "urlencoded" | undefined;
@@ -316,7 +402,7 @@ export declare const requestExampleSchema: z.ZodObject<{
316
402
  binary: z.ZodOptional<z.ZodType<Blob, z.ZodTypeDef, Blob>>;
317
403
  activeBody: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"raw">, z.ZodLiteral<"formData">, z.ZodLiteral<"binary">]>>;
318
404
  }, "strip", z.ZodTypeAny, {
319
- activeBody: "formData" | "raw" | "binary";
405
+ activeBody: "formData" | "binary" | "raw";
320
406
  formData?: {
321
407
  value: {
322
408
  value: string;
@@ -331,16 +417,15 @@ export declare const requestExampleSchema: z.ZodObject<{
331
417
  enum?: string[] | undefined;
332
418
  format?: string | undefined;
333
419
  file?: any;
334
- refUid?: string | undefined;
335
420
  nullable?: boolean | undefined;
336
421
  }[];
337
422
  encoding: "form-data" | "urlencoded";
338
423
  } | undefined;
424
+ binary?: Blob | undefined;
339
425
  raw?: {
340
426
  value: string;
341
427
  encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
342
428
  } | undefined;
343
- binary?: Blob | undefined;
344
429
  }, {
345
430
  formData?: {
346
431
  value?: {
@@ -356,17 +441,16 @@ export declare const requestExampleSchema: z.ZodObject<{
356
441
  key?: string | undefined;
357
442
  enabled?: boolean | undefined;
358
443
  file?: any;
359
- refUid?: string | undefined;
360
444
  nullable?: boolean | undefined;
361
445
  }[] | undefined;
362
446
  encoding?: "form-data" | "urlencoded" | undefined;
363
447
  } | undefined;
448
+ binary?: Blob | undefined;
364
449
  raw?: {
365
450
  value?: string | undefined;
366
451
  encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
367
452
  } | undefined;
368
- binary?: Blob | undefined;
369
- activeBody?: "formData" | "raw" | "binary" | undefined;
453
+ activeBody?: "formData" | "binary" | "raw" | undefined;
370
454
  }>>>;
371
455
  parameters: z.ZodDefault<z.ZodOptional<z.ZodObject<{
372
456
  path: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -375,8 +459,6 @@ export declare const requestExampleSchema: z.ZodObject<{
375
459
  enabled: z.ZodDefault<z.ZodBoolean>;
376
460
  file: z.ZodOptional<z.ZodAny>;
377
461
  description: z.ZodOptional<z.ZodString>;
378
- /** Params are linked to parents such as path params and global headers/cookies */
379
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
380
462
  required: z.ZodOptional<z.ZodBoolean>;
381
463
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
382
464
  type: z.ZodOptional<z.ZodString>;
@@ -398,7 +480,6 @@ export declare const requestExampleSchema: z.ZodObject<{
398
480
  enum?: string[] | undefined;
399
481
  format?: string | undefined;
400
482
  file?: any;
401
- refUid?: string | undefined;
402
483
  nullable?: boolean | undefined;
403
484
  }, {
404
485
  minimum?: number | undefined;
@@ -413,7 +494,6 @@ export declare const requestExampleSchema: z.ZodObject<{
413
494
  key?: string | undefined;
414
495
  enabled?: boolean | undefined;
415
496
  file?: any;
416
- refUid?: string | undefined;
417
497
  nullable?: boolean | undefined;
418
498
  }>, "many">>;
419
499
  query: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -422,8 +502,6 @@ export declare const requestExampleSchema: z.ZodObject<{
422
502
  enabled: z.ZodDefault<z.ZodBoolean>;
423
503
  file: z.ZodOptional<z.ZodAny>;
424
504
  description: z.ZodOptional<z.ZodString>;
425
- /** Params are linked to parents such as path params and global headers/cookies */
426
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
427
505
  required: z.ZodOptional<z.ZodBoolean>;
428
506
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
429
507
  type: z.ZodOptional<z.ZodString>;
@@ -445,7 +523,6 @@ export declare const requestExampleSchema: z.ZodObject<{
445
523
  enum?: string[] | undefined;
446
524
  format?: string | undefined;
447
525
  file?: any;
448
- refUid?: string | undefined;
449
526
  nullable?: boolean | undefined;
450
527
  }, {
451
528
  minimum?: number | undefined;
@@ -460,7 +537,6 @@ export declare const requestExampleSchema: z.ZodObject<{
460
537
  key?: string | undefined;
461
538
  enabled?: boolean | undefined;
462
539
  file?: any;
463
- refUid?: string | undefined;
464
540
  nullable?: boolean | undefined;
465
541
  }>, "many">>;
466
542
  headers: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -469,8 +545,6 @@ export declare const requestExampleSchema: z.ZodObject<{
469
545
  enabled: z.ZodDefault<z.ZodBoolean>;
470
546
  file: z.ZodOptional<z.ZodAny>;
471
547
  description: z.ZodOptional<z.ZodString>;
472
- /** Params are linked to parents such as path params and global headers/cookies */
473
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
474
548
  required: z.ZodOptional<z.ZodBoolean>;
475
549
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
476
550
  type: z.ZodOptional<z.ZodString>;
@@ -492,7 +566,6 @@ export declare const requestExampleSchema: z.ZodObject<{
492
566
  enum?: string[] | undefined;
493
567
  format?: string | undefined;
494
568
  file?: any;
495
- refUid?: string | undefined;
496
569
  nullable?: boolean | undefined;
497
570
  }, {
498
571
  minimum?: number | undefined;
@@ -507,7 +580,6 @@ export declare const requestExampleSchema: z.ZodObject<{
507
580
  key?: string | undefined;
508
581
  enabled?: boolean | undefined;
509
582
  file?: any;
510
- refUid?: string | undefined;
511
583
  nullable?: boolean | undefined;
512
584
  }>, "many">>;
513
585
  cookies: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -516,8 +588,6 @@ export declare const requestExampleSchema: z.ZodObject<{
516
588
  enabled: z.ZodDefault<z.ZodBoolean>;
517
589
  file: z.ZodOptional<z.ZodAny>;
518
590
  description: z.ZodOptional<z.ZodString>;
519
- /** Params are linked to parents such as path params and global headers/cookies */
520
- refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
521
591
  required: z.ZodOptional<z.ZodBoolean>;
522
592
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
523
593
  type: z.ZodOptional<z.ZodString>;
@@ -539,7 +609,6 @@ export declare const requestExampleSchema: z.ZodObject<{
539
609
  enum?: string[] | undefined;
540
610
  format?: string | undefined;
541
611
  file?: any;
542
- refUid?: string | undefined;
543
612
  nullable?: boolean | undefined;
544
613
  }, {
545
614
  minimum?: number | undefined;
@@ -554,7 +623,6 @@ export declare const requestExampleSchema: z.ZodObject<{
554
623
  key?: string | undefined;
555
624
  enabled?: boolean | undefined;
556
625
  file?: any;
557
- refUid?: string | undefined;
558
626
  nullable?: boolean | undefined;
559
627
  }>, "many">>;
560
628
  }, "strip", z.ZodTypeAny, {
@@ -571,7 +639,6 @@ export declare const requestExampleSchema: z.ZodObject<{
571
639
  enum?: string[] | undefined;
572
640
  format?: string | undefined;
573
641
  file?: any;
574
- refUid?: string | undefined;
575
642
  nullable?: boolean | undefined;
576
643
  }[];
577
644
  cookies: {
@@ -587,7 +654,6 @@ export declare const requestExampleSchema: z.ZodObject<{
587
654
  enum?: string[] | undefined;
588
655
  format?: string | undefined;
589
656
  file?: any;
590
- refUid?: string | undefined;
591
657
  nullable?: boolean | undefined;
592
658
  }[];
593
659
  query: {
@@ -603,7 +669,6 @@ export declare const requestExampleSchema: z.ZodObject<{
603
669
  enum?: string[] | undefined;
604
670
  format?: string | undefined;
605
671
  file?: any;
606
- refUid?: string | undefined;
607
672
  nullable?: boolean | undefined;
608
673
  }[];
609
674
  headers: {
@@ -619,7 +684,6 @@ export declare const requestExampleSchema: z.ZodObject<{
619
684
  enum?: string[] | undefined;
620
685
  format?: string | undefined;
621
686
  file?: any;
622
- refUid?: string | undefined;
623
687
  nullable?: boolean | undefined;
624
688
  }[];
625
689
  }, {
@@ -636,7 +700,6 @@ export declare const requestExampleSchema: z.ZodObject<{
636
700
  key?: string | undefined;
637
701
  enabled?: boolean | undefined;
638
702
  file?: any;
639
- refUid?: string | undefined;
640
703
  nullable?: boolean | undefined;
641
704
  }[] | undefined;
642
705
  cookies?: {
@@ -652,7 +715,6 @@ export declare const requestExampleSchema: z.ZodObject<{
652
715
  key?: string | undefined;
653
716
  enabled?: boolean | undefined;
654
717
  file?: any;
655
- refUid?: string | undefined;
656
718
  nullable?: boolean | undefined;
657
719
  }[] | undefined;
658
720
  query?: {
@@ -668,7 +730,6 @@ export declare const requestExampleSchema: z.ZodObject<{
668
730
  key?: string | undefined;
669
731
  enabled?: boolean | undefined;
670
732
  file?: any;
671
- refUid?: string | undefined;
672
733
  nullable?: boolean | undefined;
673
734
  }[] | undefined;
674
735
  headers?: {
@@ -684,17 +745,17 @@ export declare const requestExampleSchema: z.ZodObject<{
684
745
  key?: string | undefined;
685
746
  enabled?: boolean | undefined;
686
747
  file?: any;
687
- refUid?: string | undefined;
688
748
  nullable?: boolean | undefined;
689
749
  }[] | undefined;
690
750
  }>>>;
751
+ /** TODO: Should this be deprecated? */
691
752
  serverVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
692
753
  }, "strip", z.ZodTypeAny, {
693
754
  type: "requestExample";
694
755
  uid: string;
695
756
  name: string;
696
757
  body: {
697
- activeBody: "formData" | "raw" | "binary";
758
+ activeBody: "formData" | "binary" | "raw";
698
759
  formData?: {
699
760
  value: {
700
761
  value: string;
@@ -709,16 +770,15 @@ export declare const requestExampleSchema: z.ZodObject<{
709
770
  enum?: string[] | undefined;
710
771
  format?: string | undefined;
711
772
  file?: any;
712
- refUid?: string | undefined;
713
773
  nullable?: boolean | undefined;
714
774
  }[];
715
775
  encoding: "form-data" | "urlencoded";
716
776
  } | undefined;
777
+ binary?: Blob | undefined;
717
778
  raw?: {
718
779
  value: string;
719
780
  encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
720
781
  } | undefined;
721
- binary?: Blob | undefined;
722
782
  };
723
783
  requestUid: string;
724
784
  parameters: {
@@ -735,7 +795,6 @@ export declare const requestExampleSchema: z.ZodObject<{
735
795
  enum?: string[] | undefined;
736
796
  format?: string | undefined;
737
797
  file?: any;
738
- refUid?: string | undefined;
739
798
  nullable?: boolean | undefined;
740
799
  }[];
741
800
  cookies: {
@@ -751,7 +810,6 @@ export declare const requestExampleSchema: z.ZodObject<{
751
810
  enum?: string[] | undefined;
752
811
  format?: string | undefined;
753
812
  file?: any;
754
- refUid?: string | undefined;
755
813
  nullable?: boolean | undefined;
756
814
  }[];
757
815
  query: {
@@ -767,7 +825,6 @@ export declare const requestExampleSchema: z.ZodObject<{
767
825
  enum?: string[] | undefined;
768
826
  format?: string | undefined;
769
827
  file?: any;
770
- refUid?: string | undefined;
771
828
  nullable?: boolean | undefined;
772
829
  }[];
773
830
  headers: {
@@ -783,7 +840,6 @@ export declare const requestExampleSchema: z.ZodObject<{
783
840
  enum?: string[] | undefined;
784
841
  format?: string | undefined;
785
842
  file?: any;
786
- refUid?: string | undefined;
787
843
  nullable?: boolean | undefined;
788
844
  }[];
789
845
  };
@@ -807,17 +863,16 @@ export declare const requestExampleSchema: z.ZodObject<{
807
863
  key?: string | undefined;
808
864
  enabled?: boolean | undefined;
809
865
  file?: any;
810
- refUid?: string | undefined;
811
866
  nullable?: boolean | undefined;
812
867
  }[] | undefined;
813
868
  encoding?: "form-data" | "urlencoded" | undefined;
814
869
  } | undefined;
870
+ binary?: Blob | undefined;
815
871
  raw?: {
816
872
  value?: string | undefined;
817
873
  encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
818
874
  } | undefined;
819
- binary?: Blob | undefined;
820
- activeBody?: "formData" | "raw" | "binary" | undefined;
875
+ activeBody?: "formData" | "binary" | "raw" | undefined;
821
876
  } | undefined;
822
877
  requestUid?: string | undefined;
823
878
  parameters?: {
@@ -834,7 +889,6 @@ export declare const requestExampleSchema: z.ZodObject<{
834
889
  key?: string | undefined;
835
890
  enabled?: boolean | undefined;
836
891
  file?: any;
837
- refUid?: string | undefined;
838
892
  nullable?: boolean | undefined;
839
893
  }[] | undefined;
840
894
  cookies?: {
@@ -850,7 +904,6 @@ export declare const requestExampleSchema: z.ZodObject<{
850
904
  key?: string | undefined;
851
905
  enabled?: boolean | undefined;
852
906
  file?: any;
853
- refUid?: string | undefined;
854
907
  nullable?: boolean | undefined;
855
908
  }[] | undefined;
856
909
  query?: {
@@ -866,7 +919,6 @@ export declare const requestExampleSchema: z.ZodObject<{
866
919
  key?: string | undefined;
867
920
  enabled?: boolean | undefined;
868
921
  file?: any;
869
- refUid?: string | undefined;
870
922
  nullable?: boolean | undefined;
871
923
  }[] | undefined;
872
924
  headers?: {
@@ -882,15 +934,122 @@ export declare const requestExampleSchema: z.ZodObject<{
882
934
  key?: string | undefined;
883
935
  enabled?: boolean | undefined;
884
936
  file?: any;
885
- refUid?: string | undefined;
886
937
  nullable?: boolean | undefined;
887
938
  }[] | undefined;
888
939
  } | undefined;
889
940
  serverVariables?: Record<string, string[]> | undefined;
890
941
  }>;
891
- /** A single set 23of params for a request example */
892
942
  export type RequestExample = z.infer<typeof requestExampleSchema>;
893
- export type RequestExamplePayload = z.input<typeof requestExampleSchema>;
943
+ /** Schema for the OAS serialization of request examples */
944
+ export declare const xScalarExampleSchema: z.ZodObject<{
945
+ /** TODO: Should this be required? */
946
+ name: z.ZodOptional<z.ZodString>;
947
+ body: z.ZodOptional<z.ZodObject<{
948
+ encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
949
+ /**
950
+ * Body content as an object with a separately specified encoding or a simple pre-encoded string value
951
+ *
952
+ * Ideally we would convert any objects into the proper encoding on import
953
+ */
954
+ content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
955
+ /** When the encoding is `binary` this will be used to link to the file */
956
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
957
+ url: z.ZodString;
958
+ base64: z.ZodOptional<z.ZodString>;
959
+ }, "strip", z.ZodTypeAny, {
960
+ url: string;
961
+ base64?: string | undefined;
962
+ }, {
963
+ url: string;
964
+ base64?: string | undefined;
965
+ }>>>;
966
+ }, "strip", z.ZodTypeAny, {
967
+ content: string | Record<string, any>;
968
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
969
+ file?: {
970
+ url: string;
971
+ base64?: string | undefined;
972
+ } | null | undefined;
973
+ }, {
974
+ content: string | Record<string, any>;
975
+ file?: {
976
+ url: string;
977
+ base64?: string | undefined;
978
+ } | null | undefined;
979
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
980
+ }>>;
981
+ parameters: z.ZodObject<{
982
+ path: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
983
+ query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
984
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
985
+ cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
986
+ }, "strip", z.ZodTypeAny, {
987
+ path?: Record<string, string> | undefined;
988
+ cookies?: Record<string, string> | undefined;
989
+ query?: Record<string, string> | undefined;
990
+ headers?: Record<string, string> | undefined;
991
+ }, {
992
+ path?: Record<string, string> | undefined;
993
+ cookies?: Record<string, string> | undefined;
994
+ query?: Record<string, string> | undefined;
995
+ headers?: Record<string, string> | undefined;
996
+ }>;
997
+ }, "strip", z.ZodTypeAny, {
998
+ parameters: {
999
+ path?: Record<string, string> | undefined;
1000
+ cookies?: Record<string, string> | undefined;
1001
+ query?: Record<string, string> | undefined;
1002
+ headers?: Record<string, string> | undefined;
1003
+ };
1004
+ name?: string | undefined;
1005
+ body?: {
1006
+ content: string | Record<string, any>;
1007
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
1008
+ file?: {
1009
+ url: string;
1010
+ base64?: string | undefined;
1011
+ } | null | undefined;
1012
+ } | undefined;
1013
+ }, {
1014
+ parameters: {
1015
+ path?: Record<string, string> | undefined;
1016
+ cookies?: Record<string, string> | undefined;
1017
+ query?: Record<string, string> | undefined;
1018
+ headers?: Record<string, string> | undefined;
1019
+ };
1020
+ name?: string | undefined;
1021
+ body?: {
1022
+ content: string | Record<string, any>;
1023
+ file?: {
1024
+ url: string;
1025
+ base64?: string | undefined;
1026
+ } | null | undefined;
1027
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
1028
+ } | undefined;
1029
+ }>;
1030
+ export type XScalarExample = z.infer<typeof xScalarExampleSchema>;
1031
+ /**
1032
+ * Convert a request example to the xScalar serialized format
1033
+ *
1034
+ * TODO: The base format should be migrated to align MUCH closer to the serialized format
1035
+ */
1036
+ export declare function convertExampleToXScalar(example: RequestExample): {
1037
+ parameters: {
1038
+ path?: Record<string, string> | undefined;
1039
+ cookies?: Record<string, string> | undefined;
1040
+ query?: Record<string, string> | undefined;
1041
+ headers?: Record<string, string> | undefined;
1042
+ };
1043
+ name?: string | undefined;
1044
+ body?: {
1045
+ content: string | Record<string, any>;
1046
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
1047
+ file?: {
1048
+ url: string;
1049
+ base64?: string | undefined;
1050
+ } | null | undefined;
1051
+ } | undefined;
1052
+ };
894
1053
  /** Create new instance parameter from a request parameter */
895
1054
  export declare function createParamInstance(param: RequestParameter): {
896
1055
  value: string;
@@ -905,7 +1064,6 @@ export declare function createParamInstance(param: RequestParameter): {
905
1064
  enum?: string[] | undefined;
906
1065
  format?: string | undefined;
907
1066
  file?: any;
908
- refUid?: string | undefined;
909
1067
  nullable?: boolean | undefined;
910
1068
  };
911
1069
  /**