@scalar/oas-utils 0.4.15 → 0.4.17
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.
- package/CHANGELOG.md +35 -0
- package/dist/entities/spec/operation.d.ts +15 -15
- package/dist/entities/spec/parameters.d.ts +5 -5
- package/dist/entities/spec/request-examples.d.ts +68 -68
- package/dist/entities/spec/requests.d.ts +31 -31
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +0 -3
- package/dist/helpers/index.js.map +2 -2
- package/dist/helpers/normalize-mime-type-object.d.ts +2 -13
- package/dist/helpers/normalize-mime-type-object.d.ts.map +1 -1
- package/dist/helpers/normalize-mime-type-object.js +4 -8
- package/dist/helpers/normalize-mime-type-object.js.map +2 -2
- package/dist/helpers/normalize-mime-type.d.ts +3 -1
- package/dist/helpers/normalize-mime-type.d.ts.map +1 -1
- package/dist/helpers/normalize-mime-type.js.map +2 -2
- package/dist/helpers/operation-to-har/process-body.d.ts +1 -1
- package/dist/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/helpers/operation-to-har/process-body.js +3 -30
- package/dist/helpers/operation-to-har/process-body.js.map +2 -2
- package/dist/helpers/security/get-schemes.d.ts +3 -0
- package/dist/helpers/security/get-schemes.d.ts.map +1 -1
- package/dist/spec-getters/get-example-from-schema.d.ts.map +1 -1
- package/dist/spec-getters/get-example-from-schema.js +5 -2
- package/dist/spec-getters/get-example-from-schema.js.map +2 -2
- package/dist/spec-getters/get-request-body-from-operation.js +1 -1
- package/dist/spec-getters/get-request-body-from-operation.js.map +2 -2
- package/package.json +11 -11
- package/dist/helpers/ssr-state.d.ts +0 -12
- package/dist/helpers/ssr-state.d.ts.map +0 -1
- package/dist/helpers/ssr-state.js +0 -7
- package/dist/helpers/ssr-state.js.map +0 -7
|
@@ -103,13 +103,13 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
103
103
|
in: "cookie" | "path" | "query" | "header";
|
|
104
104
|
description?: string | undefined;
|
|
105
105
|
example?: unknown;
|
|
106
|
+
content?: unknown;
|
|
107
|
+
schema?: unknown;
|
|
106
108
|
examples?: unknown[] | Record<string, {
|
|
107
109
|
value?: unknown;
|
|
108
110
|
summary?: string | undefined;
|
|
109
111
|
externalValue?: string | undefined;
|
|
110
112
|
}> | undefined;
|
|
111
|
-
schema?: unknown;
|
|
112
|
-
content?: unknown;
|
|
113
113
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
114
114
|
explode?: boolean | undefined;
|
|
115
115
|
}, {
|
|
@@ -118,14 +118,14 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
118
118
|
description?: string | undefined;
|
|
119
119
|
required?: boolean | undefined;
|
|
120
120
|
example?: unknown;
|
|
121
|
-
|
|
121
|
+
content?: unknown;
|
|
122
|
+
schema?: unknown;
|
|
122
123
|
examples?: unknown[] | Record<string, {
|
|
123
124
|
value?: unknown;
|
|
124
125
|
summary?: string | undefined;
|
|
125
126
|
externalValue?: string | undefined;
|
|
126
127
|
}> | undefined;
|
|
127
|
-
|
|
128
|
-
content?: unknown;
|
|
128
|
+
deprecated?: boolean | undefined;
|
|
129
129
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
130
130
|
explode?: boolean | undefined;
|
|
131
131
|
}>, "many">>;
|
|
@@ -191,20 +191,20 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
191
191
|
cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
192
192
|
}, "strip", z.ZodTypeAny, {
|
|
193
193
|
path?: Record<string, string> | undefined;
|
|
194
|
-
query?: Record<string, string> | undefined;
|
|
195
194
|
headers?: Record<string, string> | undefined;
|
|
195
|
+
query?: Record<string, string> | undefined;
|
|
196
196
|
cookies?: Record<string, string> | undefined;
|
|
197
197
|
}, {
|
|
198
198
|
path?: Record<string, string> | undefined;
|
|
199
|
-
query?: Record<string, string> | undefined;
|
|
200
199
|
headers?: Record<string, string> | undefined;
|
|
200
|
+
query?: Record<string, string> | undefined;
|
|
201
201
|
cookies?: Record<string, string> | undefined;
|
|
202
202
|
}>;
|
|
203
203
|
}, "strip", z.ZodTypeAny, {
|
|
204
204
|
parameters: {
|
|
205
205
|
path?: Record<string, string> | undefined;
|
|
206
|
-
query?: Record<string, string> | undefined;
|
|
207
206
|
headers?: Record<string, string> | undefined;
|
|
207
|
+
query?: Record<string, string> | undefined;
|
|
208
208
|
cookies?: Record<string, string> | undefined;
|
|
209
209
|
};
|
|
210
210
|
name?: string | undefined;
|
|
@@ -219,8 +219,8 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
219
219
|
}, {
|
|
220
220
|
parameters: {
|
|
221
221
|
path?: Record<string, string> | undefined;
|
|
222
|
-
query?: Record<string, string> | undefined;
|
|
223
222
|
headers?: Record<string, string> | undefined;
|
|
223
|
+
query?: Record<string, string> | undefined;
|
|
224
224
|
cookies?: Record<string, string> | undefined;
|
|
225
225
|
};
|
|
226
226
|
name?: string | undefined;
|
|
@@ -258,13 +258,13 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
258
258
|
in: "cookie" | "path" | "query" | "header";
|
|
259
259
|
description?: string | undefined;
|
|
260
260
|
example?: unknown;
|
|
261
|
+
content?: unknown;
|
|
262
|
+
schema?: unknown;
|
|
261
263
|
examples?: unknown[] | Record<string, {
|
|
262
264
|
value?: unknown;
|
|
263
265
|
summary?: string | undefined;
|
|
264
266
|
externalValue?: string | undefined;
|
|
265
267
|
}> | undefined;
|
|
266
|
-
schema?: unknown;
|
|
267
|
-
content?: unknown;
|
|
268
268
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
269
269
|
explode?: boolean | undefined;
|
|
270
270
|
}[] | undefined;
|
|
@@ -273,8 +273,8 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
273
273
|
'x-scalar-examples'?: Record<string, {
|
|
274
274
|
parameters: {
|
|
275
275
|
path?: Record<string, string> | undefined;
|
|
276
|
-
query?: Record<string, string> | undefined;
|
|
277
276
|
headers?: Record<string, string> | undefined;
|
|
277
|
+
query?: Record<string, string> | undefined;
|
|
278
278
|
cookies?: Record<string, string> | undefined;
|
|
279
279
|
};
|
|
280
280
|
name?: string | undefined;
|
|
@@ -307,14 +307,14 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
307
307
|
description?: string | undefined;
|
|
308
308
|
required?: boolean | undefined;
|
|
309
309
|
example?: unknown;
|
|
310
|
-
|
|
310
|
+
content?: unknown;
|
|
311
|
+
schema?: unknown;
|
|
311
312
|
examples?: unknown[] | Record<string, {
|
|
312
313
|
value?: unknown;
|
|
313
314
|
summary?: string | undefined;
|
|
314
315
|
externalValue?: string | undefined;
|
|
315
316
|
}> | undefined;
|
|
316
|
-
|
|
317
|
-
content?: unknown;
|
|
317
|
+
deprecated?: boolean | undefined;
|
|
318
318
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
319
319
|
explode?: boolean | undefined;
|
|
320
320
|
}[] | undefined;
|
|
@@ -323,8 +323,8 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
323
323
|
'x-scalar-examples'?: Record<string, {
|
|
324
324
|
parameters: {
|
|
325
325
|
path?: Record<string, string> | undefined;
|
|
326
|
-
query?: Record<string, string> | undefined;
|
|
327
326
|
headers?: Record<string, string> | undefined;
|
|
327
|
+
query?: Record<string, string> | undefined;
|
|
328
328
|
cookies?: Record<string, string> | undefined;
|
|
329
329
|
};
|
|
330
330
|
name?: string | undefined;
|
|
@@ -408,13 +408,13 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
408
408
|
in: "cookie" | "path" | "query" | "header";
|
|
409
409
|
description?: string | undefined;
|
|
410
410
|
example?: unknown;
|
|
411
|
+
content?: unknown;
|
|
412
|
+
schema?: unknown;
|
|
411
413
|
examples?: unknown[] | Record<string, {
|
|
412
414
|
value?: unknown;
|
|
413
415
|
summary?: string | undefined;
|
|
414
416
|
externalValue?: string | undefined;
|
|
415
417
|
}> | undefined;
|
|
416
|
-
schema?: unknown;
|
|
417
|
-
content?: unknown;
|
|
418
418
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
419
419
|
explode?: boolean | undefined;
|
|
420
420
|
}, {
|
|
@@ -423,14 +423,14 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
423
423
|
description?: string | undefined;
|
|
424
424
|
required?: boolean | undefined;
|
|
425
425
|
example?: unknown;
|
|
426
|
-
|
|
426
|
+
content?: unknown;
|
|
427
|
+
schema?: unknown;
|
|
427
428
|
examples?: unknown[] | Record<string, {
|
|
428
429
|
value?: unknown;
|
|
429
430
|
summary?: string | undefined;
|
|
430
431
|
externalValue?: string | undefined;
|
|
431
432
|
}> | undefined;
|
|
432
|
-
|
|
433
|
-
content?: unknown;
|
|
433
|
+
deprecated?: boolean | undefined;
|
|
434
434
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
435
435
|
explode?: boolean | undefined;
|
|
436
436
|
}>, "many">>;
|
|
@@ -496,20 +496,20 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
496
496
|
cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
497
497
|
}, "strip", z.ZodTypeAny, {
|
|
498
498
|
path?: Record<string, string> | undefined;
|
|
499
|
-
query?: Record<string, string> | undefined;
|
|
500
499
|
headers?: Record<string, string> | undefined;
|
|
500
|
+
query?: Record<string, string> | undefined;
|
|
501
501
|
cookies?: Record<string, string> | undefined;
|
|
502
502
|
}, {
|
|
503
503
|
path?: Record<string, string> | undefined;
|
|
504
|
-
query?: Record<string, string> | undefined;
|
|
505
504
|
headers?: Record<string, string> | undefined;
|
|
505
|
+
query?: Record<string, string> | undefined;
|
|
506
506
|
cookies?: Record<string, string> | undefined;
|
|
507
507
|
}>;
|
|
508
508
|
}, "strip", z.ZodTypeAny, {
|
|
509
509
|
parameters: {
|
|
510
510
|
path?: Record<string, string> | undefined;
|
|
511
|
-
query?: Record<string, string> | undefined;
|
|
512
511
|
headers?: Record<string, string> | undefined;
|
|
512
|
+
query?: Record<string, string> | undefined;
|
|
513
513
|
cookies?: Record<string, string> | undefined;
|
|
514
514
|
};
|
|
515
515
|
name?: string | undefined;
|
|
@@ -524,8 +524,8 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
524
524
|
}, {
|
|
525
525
|
parameters: {
|
|
526
526
|
path?: Record<string, string> | undefined;
|
|
527
|
-
query?: Record<string, string> | undefined;
|
|
528
527
|
headers?: Record<string, string> | undefined;
|
|
528
|
+
query?: Record<string, string> | undefined;
|
|
529
529
|
cookies?: Record<string, string> | undefined;
|
|
530
530
|
};
|
|
531
531
|
name?: string | undefined;
|
|
@@ -630,13 +630,13 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
630
630
|
in: "cookie" | "path" | "query" | "header";
|
|
631
631
|
description?: string | undefined;
|
|
632
632
|
example?: unknown;
|
|
633
|
+
content?: unknown;
|
|
634
|
+
schema?: unknown;
|
|
633
635
|
examples?: unknown[] | Record<string, {
|
|
634
636
|
value?: unknown;
|
|
635
637
|
summary?: string | undefined;
|
|
636
638
|
externalValue?: string | undefined;
|
|
637
639
|
}> | undefined;
|
|
638
|
-
schema?: unknown;
|
|
639
|
-
content?: unknown;
|
|
640
640
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
641
641
|
explode?: boolean | undefined;
|
|
642
642
|
}[] | undefined;
|
|
@@ -676,8 +676,8 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
676
676
|
selectedServerUid?: string | null | undefined;
|
|
677
677
|
servers?: string[] | undefined;
|
|
678
678
|
tags?: string[] | undefined;
|
|
679
|
-
deprecated?: boolean | undefined;
|
|
680
679
|
examples?: string[] | undefined;
|
|
680
|
+
deprecated?: boolean | undefined;
|
|
681
681
|
operationId?: string | undefined;
|
|
682
682
|
requestBody?: any;
|
|
683
683
|
parameters?: {
|
|
@@ -686,14 +686,14 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
686
686
|
description?: string | undefined;
|
|
687
687
|
required?: boolean | undefined;
|
|
688
688
|
example?: unknown;
|
|
689
|
-
|
|
689
|
+
content?: unknown;
|
|
690
|
+
schema?: unknown;
|
|
690
691
|
examples?: unknown[] | Record<string, {
|
|
691
692
|
value?: unknown;
|
|
692
693
|
summary?: string | undefined;
|
|
693
694
|
externalValue?: string | undefined;
|
|
694
695
|
}> | undefined;
|
|
695
|
-
|
|
696
|
-
content?: unknown;
|
|
696
|
+
deprecated?: boolean | undefined;
|
|
697
697
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
698
698
|
explode?: boolean | undefined;
|
|
699
699
|
}[] | undefined;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { prettyPrintJson, replaceCircularDependencies } from './pretty-print-jso
|
|
|
7
7
|
export { shouldUseProxy, redirectToProxy } from './redirect-to-proxy.js';
|
|
8
8
|
export { schemaModel } from './schema-model.js';
|
|
9
9
|
export { shouldIgnoreEntity } from './should-ignore-entity.js';
|
|
10
|
-
export { defaultStateFactory, ssrState } from './ssr-state.js';
|
|
11
10
|
export { isOperationDeprecated, getOperationStability, getOperationStabilityColor } from './operation-stability.js';
|
|
12
11
|
/**
|
|
13
12
|
* @deprecated These helpers are being phased out. Please import directly from @scalar/helpers instead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,KAAK,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC5G,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,KAAK,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC5G,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAEhH;;;GAGG;AACH,OAAO;AACL,yFAAyF;AACzF,UAAU,GACX,MAAM,oCAAoC,CAAA;AAC3C,OAAO;AACL,sFAAsF;AACtF,SAAS,GACV,MAAM,kCAAkC,CAAA;AACzC,OAAO;AACL,4FAA4F;AAC5F,YAAY,GACb,MAAM,qCAAqC,CAAA;AAC5C,OAAO;AACL,4FAA4F;AAC5F,iBAAiB,GAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO;AACL,kFAAkF;AAClF,QAAQ,GACT,MAAM,+BAA+B,CAAA;AACtC,OAAO;AACL,wFAAwF;AACxF,UAAU,GACX,MAAM,mCAAmC,CAAA;AAC1C,OAAO;AACL,mGAAmG;AACnG,iBAAiB,GAClB,MAAM,uCAAuC,CAAA;AAC9C,OAAO;AACL,qFAAqF;AACrF,KAAK,GACN,MAAM,qCAAqC,CAAA;AAC5C,OAAO;AACL,uFAAuF;AACvF,UAAU,GACX,MAAM,kCAAkC,CAAA;AACzC,OAAO;AACL,+FAA+F;AAC/F,cAAc,GACf,MAAM,sCAAsC,CAAA;AAC7C,OAAO;AACL,8FAA8F;AAC9F,cAAc,GACf,MAAM,qCAAqC,CAAA;AAC5C,OAAO;AACL,8FAA8F;AAC9F,aAAa,GACd,MAAM,sCAAsC,CAAA;AAC7C,OAAO;AACL,uGAAuG;AACvG,iBAAiB,GAClB,MAAM,2CAA2C,CAAA;AAClD,OAAO;AACL,4FAA4F;AAC5F,iBAAiB,GAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO;AACL,6FAA6F;AAC7F,eAAe,GAChB,MAAM,gCAAgC,CAAA;AACvC,OAAO;AACL,iGAAiG;AACjG,KAAK,cAAc;AACnB,kGAAkG;AAClG,KAAK,eAAe;AACpB,kGAAkG;AAClG,eAAe,GAChB,MAAM,wCAAwC,CAAA;AAC/C,OAAO;AACL,uFAAuF;AACvF,UAAU,GACX,MAAM,kCAAkC,CAAA;AACzC,OAAO;AACL,6FAA6F;AAC7F,YAAY,GACb,MAAM,sCAAsC,CAAA;AAC7C,OAAO;AACL,iGAAiG;AACjG,eAAe,GAChB,MAAM,uCAAuC,CAAA;AAC9C,OAAO;AACL,4FAA4F;AAC5F,iBAAiB;AACjB,oFAAoF;AACpF,SAAS,GACV,MAAM,gCAAgC,CAAA;AACvC,OAAO;AACL,yFAAyF;AACzF,UAAU,IAAI,aAAa,GAC5B,MAAM,oCAAoC,CAAA;AAC3C,OAAO;AACL,oGAAoG;AACpG,gBAAgB,GACjB,MAAM,yCAAyC,CAAA"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import { prettyPrintJson, replaceCircularDependencies } from "./pretty-print-jso
|
|
|
7
7
|
import { shouldUseProxy, redirectToProxy } from "./redirect-to-proxy.js";
|
|
8
8
|
import { schemaModel } from "./schema-model.js";
|
|
9
9
|
import { shouldIgnoreEntity } from "./should-ignore-entity.js";
|
|
10
|
-
import { defaultStateFactory, ssrState } from "./ssr-state.js";
|
|
11
10
|
import { isOperationDeprecated, getOperationStability, getOperationStabilityColor } from "./operation-stability.js";
|
|
12
11
|
import {
|
|
13
12
|
createHash
|
|
@@ -84,7 +83,6 @@ export {
|
|
|
84
83
|
capitalize,
|
|
85
84
|
combineUrlAndPath,
|
|
86
85
|
createHash,
|
|
87
|
-
defaultStateFactory,
|
|
88
86
|
ensureProtocol,
|
|
89
87
|
fetchDocument,
|
|
90
88
|
fetchWithProxyFallback,
|
|
@@ -118,7 +116,6 @@ export {
|
|
|
118
116
|
schemaModel,
|
|
119
117
|
shouldIgnoreEntity,
|
|
120
118
|
shouldUseProxy,
|
|
121
|
-
ssrState,
|
|
122
119
|
transformToJson,
|
|
123
120
|
yaml
|
|
124
121
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { fetchDocument } from './fetch-document'\nexport { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback'\nexport { normalizeMimeType } from './normalize-mime-type'\nexport { normalizeMimeTypeObject } from './normalize-mime-type-object'\nexport { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse'\nexport { prettyPrintJson, replaceCircularDependencies } from './pretty-print-json'\nexport { shouldUseProxy, redirectToProxy } from './redirect-to-proxy'\nexport { schemaModel } from './schema-model'\nexport { shouldIgnoreEntity } from './should-ignore-entity'\nexport {
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAA6C,8BAA8B;AAC3E,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AACxC,SAAS,wBAAwB,cAAc,MAAM,iBAAiB,iBAAiB,YAAY;AACnG,SAAS,iBAAiB,mCAAmC;AAC7D,SAAS,gBAAgB,uBAAuB;AAChD,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,
|
|
4
|
+
"sourcesContent": ["export { fetchDocument } from './fetch-document'\nexport { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback'\nexport { normalizeMimeType } from './normalize-mime-type'\nexport { normalizeMimeTypeObject } from './normalize-mime-type-object'\nexport { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse'\nexport { prettyPrintJson, replaceCircularDependencies } from './pretty-print-json'\nexport { shouldUseProxy, redirectToProxy } from './redirect-to-proxy'\nexport { schemaModel } from './schema-model'\nexport { shouldIgnoreEntity } from './should-ignore-entity'\nexport { isOperationDeprecated, getOperationStability, getOperationStabilityColor } from './operation-stability'\n\n/**\n * @deprecated These helpers are being phased out. Please import directly from @scalar/helpers instead.\n * For example: import { createHash } from '\\@scalar/helpers/string/create-hash'\n */\nexport {\n /** @deprecated Please use createHash from \\@scalar/helpers/string/create-hash instead */\n createHash,\n} from '@scalar/helpers/string/create-hash'\nexport {\n /** @deprecated Please use isDefined from \\@scalar/helpers/array/is-defined instead */\n isDefined,\n} from '@scalar/helpers/array/is-defined'\nexport {\n /** @deprecated Please use isHttpMethod from \\@scalar/helpers/http/is-http-method instead */\n isHttpMethod,\n} from '@scalar/helpers/http/is-http-method'\nexport {\n /** @deprecated Please use combineUrlAndPath from \\@scalar/helpers/url/merge-urls instead */\n combineUrlAndPath,\n} from '@scalar/helpers/url/merge-urls'\nexport {\n /** @deprecated Please use json2xml from \\@scalar/helpers/file/json2xml instead */\n json2xml,\n} from '@scalar/helpers/file/json2xml'\nexport {\n /** @deprecated Please use capitalize from \\@scalar/helpers/string/capitalize instead */\n capitalize,\n} from '@scalar/helpers/string/capitalize'\nexport {\n /** @deprecated Please use camelToTitleWords from \\@scalar/helpers/string/camel-to-title instead */\n camelToTitleWords,\n} from '@scalar/helpers/string/camel-to-title'\nexport {\n /** @deprecated Please use REGEX from \\@scalar/helpers/regex/regex-helpers instead */\n REGEX,\n} from '@scalar/helpers/regex/regex-helpers'\nexport {\n /** @deprecated Please use isLocalUrl from \\@scalar/helpers/url/is-local-url instead */\n isLocalUrl,\n} from '@scalar/helpers/url/is-local-url'\nexport {\n /** @deprecated Please use isRelativePath from \\@scalar/helpers/url/is-relative-path instead */\n isRelativePath,\n} from '@scalar/helpers/url/is-relative-path'\nexport {\n /** @deprecated Please use ensureProtocol from \\@scalar/helpers/url/ensure-protocol instead */\n ensureProtocol,\n} from '@scalar/helpers/url/ensure-protocol'\nexport {\n /** @deprecated Please use findVariables from \\@scalar/helpers/regex/find-variables instead */\n findVariables,\n} from '@scalar/helpers/regex/find-variables'\nexport {\n /** @deprecated Please use canMethodHaveBody from \\@scalar/helpers/http/can-method-have-body instead */\n canMethodHaveBody,\n} from '@scalar/helpers/http/can-method-have-body'\nexport {\n /** @deprecated Please use getHttpMethodInfo from \\@scalar/helpers/http/http-info instead */\n getHttpMethodInfo,\n} from '@scalar/helpers/http/http-info'\nexport {\n /** @deprecated Please use REQUEST_METHODS from \\@scalar/helpers/http/http-methods instead */\n REQUEST_METHODS,\n} from '@scalar/helpers/http/http-info'\nexport {\n /** @deprecated Please use HttpStatusCode from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCode,\n /** @deprecated Please use HttpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCodes,\n /** @deprecated Please use httpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n httpStatusCodes,\n} from '@scalar/helpers/http/http-status-codes'\nexport {\n /** @deprecated Please use isValidUrl from \\@scalar/helpers/url/is-valid-url instead */\n isValidUrl,\n} from '@scalar/helpers/url/is-valid-url'\nexport {\n /** @deprecated Please use iterateTitle from \\@scalar/helpers/string/iterate-title instead */\n iterateTitle,\n} from '@scalar/helpers/string/iterate-title'\nexport {\n /** @deprecated Please use makeUrlAbsolute from \\@scalar/helpers/url/make-url-absolute instead */\n makeUrlAbsolute,\n} from '@scalar/helpers/url/make-url-absolute'\nexport {\n /** @deprecated Please use mergeSearchParams from \\@scalar/helpers/url/merge-urls instead */\n mergeSearchParams,\n /** @deprecated Please use mergeUrls from \\@scalar/helpers/url/merge-urls instead */\n mergeUrls,\n} from '@scalar/helpers/url/merge-urls'\nexport {\n /** @deprecated Please use objectKeys from \\@scalar/helpers/object/object-keys instead */\n objectKeys as getObjectKeys,\n} from '@scalar/helpers/object/object-keys'\nexport {\n /** @deprecated Please use replaceVariables from \\@scalar/helpers/regex/replace-variables instead */\n replaceVariables,\n} from '@scalar/helpers/regex/replace-variables'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAA6C,8BAA8B;AAC3E,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AACxC,SAAS,wBAAwB,cAAc,MAAM,iBAAiB,iBAAiB,YAAY;AACnG,SAAS,iBAAiB,mCAAmC;AAC7D,SAAS,gBAAgB,uBAAuB;AAChD,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,uBAAuB,uBAAuB,kCAAkC;AAMzF;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAME;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAEgB;AAAA,OACT;AACP;AAAA,EAEE;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResponseObject } from '@scalar/workspace-store/schemas/v3.1/strict/response';
|
|
2
2
|
/**
|
|
3
3
|
* Remove charset from content types
|
|
4
4
|
*
|
|
5
5
|
* Example: `application/json; charset=utf-8` -> `application/json`
|
|
6
6
|
*/
|
|
7
|
-
export declare function normalizeMimeTypeObject(content?:
|
|
8
|
-
[x: `application/json${string}`]: any;
|
|
9
|
-
[x: `application/xml${string}`]: any;
|
|
10
|
-
[x: `text/plain${string}`]: any;
|
|
11
|
-
[x: `text/html${string}`]: any;
|
|
12
|
-
[x: `application/octet-stream${string}`]: any;
|
|
13
|
-
[x: `application/x-www-form-urlencoded${string}`]: any;
|
|
14
|
-
[x: `multipart/form-data${string}`]: any;
|
|
15
|
-
[x: `*/*${string}`]: any;
|
|
16
|
-
[x: `application/vnd.${string}+jsonnull`]: any;
|
|
17
|
-
[x: `application/vnd.${string}+json${string}`]: any;
|
|
18
|
-
} | undefined;
|
|
7
|
+
export declare function normalizeMimeTypeObject(content?: ResponseObject['content']): ResponseObject['content'];
|
|
19
8
|
//# sourceMappingURL=normalize-mime-type-object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-mime-type-object.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-mime-type-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"normalize-mime-type-object.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-mime-type-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAG1F;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAiBtG"}
|
|
@@ -6,14 +6,10 @@ function normalizeMimeTypeObject(content) {
|
|
|
6
6
|
const newContent = {
|
|
7
7
|
...content
|
|
8
8
|
};
|
|
9
|
-
Object.
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
newContent[newKey] = newContent[key];
|
|
15
|
-
if (key !== newKey) {
|
|
16
|
-
delete newContent[key];
|
|
9
|
+
Object.entries(newContent).forEach(([key, value]) => {
|
|
10
|
+
const normalizedKey = normalizeMimeType(key);
|
|
11
|
+
if (normalizedKey) {
|
|
12
|
+
newContent[normalizedKey] = value;
|
|
17
13
|
}
|
|
18
14
|
});
|
|
19
15
|
return newContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/normalize-mime-type-object.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { ResponseObject } from '@scalar/workspace-store/schemas/v3.1/strict/response'\nimport { normalizeMimeType } from './normalize-mime-type'\n\n/**\n * Remove charset from content types\n *\n * Example: `application/json; charset=utf-8` -> `application/json`\n */\nexport function normalizeMimeTypeObject(content?: ResponseObject['content']): ResponseObject['content'] {\n if (!content) {\n return content\n }\n\n const newContent: ResponseObject['content'] = {\n ...content,\n }\n\n Object.entries(newContent).forEach(([key, value]) => {\n const normalizedKey = normalizeMimeType(key)\n if (normalizedKey) {\n newContent[normalizedKey] = value\n }\n })\n\n return newContent\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,yBAAyB;AAO3B,SAAS,wBAAwB,SAAgE;AACtG,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,aAAwC;AAAA,IAC5C,GAAG;AAAA,EACL;AAEA,SAAO,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnD,UAAM,gBAAgB,kBAAkB,GAAG;AAC3C,QAAI,eAAe;AACjB,iBAAW,aAAa,IAAI;AAAA,IAC9B;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { ContentType } from '@scalar/types/legacy';
|
|
1
2
|
/**
|
|
2
3
|
* Normalizes a MIME type to a standard format.
|
|
3
4
|
*
|
|
4
5
|
* Input: application/problem+json; charset=utf-8
|
|
5
6
|
* Output: application/json
|
|
6
7
|
*/
|
|
7
|
-
export declare function normalizeMimeType(contentType
|
|
8
|
+
export declare function normalizeMimeType(contentType: undefined): undefined;
|
|
9
|
+
export declare function normalizeMimeType(contentType: string): ContentType;
|
|
8
10
|
//# sourceMappingURL=normalize-mime-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-mime-type.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-mime-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-mime-type.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-mime-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,SAAS,GAAG,SAAS,CAAA;AACpE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/normalize-mime-type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ContentType } from '@scalar/types/legacy'\n\n/**\n * Normalizes a MIME type to a standard format.\n *\n * Input: application/problem+json; charset=utf-8\n * Output: application/json\n */\nexport function normalizeMimeType(contentType
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { ContentType } from '@scalar/types/legacy'\n\n/**\n * Normalizes a MIME type to a standard format.\n *\n * Input: application/problem+json; charset=utf-8\n * Output: application/json\n */\nexport function normalizeMimeType(contentType: undefined): undefined\nexport function normalizeMimeType(contentType: string): ContentType\nexport function normalizeMimeType(contentType: string | undefined): ContentType | undefined {\n if (typeof contentType !== 'string') {\n return undefined\n }\n\n return (\n contentType\n // Remove '; charset=utf-8'\n .replace(/;.*$/, '')\n // Remove 'problem+' but keep vendor-specific vnd and fhir mime types\n .replace(/\\/(?!.*vnd\\.|fhir\\+).*\\+/, '/')\n // Remove whitespace\n .trim() as ContentType\n )\n}\n"],
|
|
5
|
+
"mappings": "AAUO,SAAS,kBAAkB,aAA0D;AAC1F,MAAI,OAAO,gBAAgB,UAAU;AACnC,WAAO;AAAA,EACT;AAEA,SACE,YAEG,QAAQ,QAAQ,EAAE,EAElB,QAAQ,4BAA4B,GAAG,EAEvC,KAAK;AAEZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OperationToHarProps } from '
|
|
1
|
+
import type { OperationToHarProps } from './operation-to-har.js';
|
|
2
2
|
import type { PostData } from 'har-format';
|
|
3
3
|
type ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'operation' | 'example'>;
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../src/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../src/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEjD,KAAK,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CAAA;AAoC1F;;GAEG;AACH,eAAO,MAAM,WAAW,wCAAyC,gBAAgB,KAAG,QA6CnF,CAAA"}
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
+
import { getExampleFromSchema } from "../../spec-getters/get-example-from-schema.js";
|
|
1
2
|
import { isReference } from "@scalar/workspace-store/schemas/v3.1/type-guard";
|
|
2
|
-
const extractExamplesFromSchema = (schema, depth = 0) => {
|
|
3
|
-
if (!schema || depth > 10) {
|
|
4
|
-
return void 0;
|
|
5
|
-
}
|
|
6
|
-
if (schema.examples?.[0] !== void 0) {
|
|
7
|
-
return schema.examples[0];
|
|
8
|
-
}
|
|
9
|
-
if (schema.example !== void 0) {
|
|
10
|
-
return schema.example;
|
|
11
|
-
}
|
|
12
|
-
if (schema.type === "object" && schema.properties) {
|
|
13
|
-
const result = {};
|
|
14
|
-
let hasExamples = false;
|
|
15
|
-
for (const [key, propSchema] of Object.entries(schema.properties)) {
|
|
16
|
-
const example = extractExamplesFromSchema(propSchema, depth + 1);
|
|
17
|
-
if (example !== void 0) {
|
|
18
|
-
result[key] = example;
|
|
19
|
-
hasExamples = true;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return hasExamples ? result : void 0;
|
|
23
|
-
}
|
|
24
|
-
if (schema.type === "array" && schema.items) {
|
|
25
|
-
const itemExample = extractExamplesFromSchema(schema.items, depth + 1);
|
|
26
|
-
return itemExample !== void 0 ? [itemExample] : void 0;
|
|
27
|
-
}
|
|
28
|
-
return void 0;
|
|
29
|
-
};
|
|
30
3
|
const objectToFormParams = (obj) => {
|
|
31
4
|
const params = [];
|
|
32
5
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -50,7 +23,7 @@ const objectToFormParams = (obj) => {
|
|
|
50
23
|
};
|
|
51
24
|
const processBody = ({ operation, contentType, example }) => {
|
|
52
25
|
const content = !operation.requestBody || isReference(operation.requestBody) ? {} : operation.requestBody.content;
|
|
53
|
-
const _contentType = contentType || Object.keys(content)[0];
|
|
26
|
+
const _contentType = (contentType || Object.keys(content)[0]) ?? "";
|
|
54
27
|
const isFormData = _contentType === "multipart/form-data" || _contentType === "application/x-www-form-urlencoded";
|
|
55
28
|
if (example) {
|
|
56
29
|
if (isFormData && typeof example === "object" && example !== null) {
|
|
@@ -66,7 +39,7 @@ const processBody = ({ operation, contentType, example }) => {
|
|
|
66
39
|
}
|
|
67
40
|
const contentSchema = content[_contentType]?.schema;
|
|
68
41
|
if (contentSchema) {
|
|
69
|
-
const extractedExample =
|
|
42
|
+
const extractedExample = getExampleFromSchema(contentSchema);
|
|
70
43
|
if (extractedExample !== void 0) {
|
|
71
44
|
if (isFormData && typeof extractedExample === "object" && extractedExample !== null) {
|
|
72
45
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/operation-to-har/process-body.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OperationToHarProps } from '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { OperationToHarProps } from './operation-to-har'\nimport { getExampleFromSchema } from '@/spec-getters/get-example-from-schema'\nimport { isReference } from '@scalar/workspace-store/schemas/v3.1/type-guard'\nimport type { Param, PostData } from 'har-format'\n\ntype ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'operation' | 'example'>\n\n/**\n * Converts an object to an array of form parameters\n * @param obj - The object to convert\n * @returns Array of form parameters with name and value properties\n */\nconst objectToFormParams = (obj: Record<string, unknown>): Param[] => {\n const params: Param[] = []\n\n for (const [key, value] of Object.entries(obj)) {\n if (value === undefined || value === null) {\n continue\n }\n\n // Handle arrays by adding each item with the same key\n if (Array.isArray(value)) {\n for (const item of value) {\n params.push({ name: key, value: String(item) })\n }\n }\n // Handle nested objects by flattening them\n else if (typeof value === 'object') {\n const nestedParams = objectToFormParams(value as Record<string, unknown>)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({ name: key, value: String(value) })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n */\nexport const processBody = ({ operation, contentType, example }: ProcessBodyProps): PostData => {\n const content = !operation.requestBody || isReference(operation.requestBody) ? {} : operation.requestBody.content\n\n const _contentType = (contentType || Object.keys(content)[0]) ?? ''\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Return the provided top level example\n if (example) {\n if (isFormData && typeof example === 'object' && example !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(example as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(example),\n }\n }\n\n // Try to extract examples from the schema\n const contentSchema = content[_contentType]?.schema\n if (contentSchema) {\n const extractedExample = getExampleFromSchema(contentSchema)\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(extractedExample as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(extractedExample),\n }\n }\n }\n\n return {\n mimeType: _contentType,\n text: 'null',\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAU5B,MAAM,qBAAqB,CAAC,QAA0C;AACpE,QAAM,SAAkB,CAAC;AAEzB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,UAAU,UAAa,UAAU,MAAM;AACzC;AAAA,IACF;AAGA,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,iBAAW,QAAQ,OAAO;AACxB,eAAO,KAAK,EAAE,MAAM,KAAK,OAAO,OAAO,IAAI,EAAE,CAAC;AAAA,MAChD;AAAA,IACF,WAES,OAAO,UAAU,UAAU;AAClC,YAAM,eAAe,mBAAmB,KAAgC;AAExE,iBAAW,SAAS,cAAc;AAChC,eAAO,KAAK,EAAE,MAAM,GAAG,GAAG,IAAI,MAAM,IAAI,IAAI,OAAO,MAAM,MAAM,CAAC;AAAA,MAClE;AAAA,IACF,OAAO;AACL,aAAO,KAAK,EAAE,MAAM,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC;AAAA,IACjD;AAAA,EACF;AAEA,SAAO;AACT;AAKO,MAAM,cAAc,CAAC,EAAE,WAAW,aAAa,QAAQ,MAAkC;AAC9F,QAAM,UAAU,CAAC,UAAU,eAAe,YAAY,UAAU,WAAW,IAAI,CAAC,IAAI,UAAU,YAAY;AAE1G,QAAM,gBAAgB,eAAe,OAAO,KAAK,OAAO,EAAE,CAAC,MAAM;AAGjE,QAAM,aAAa,iBAAiB,yBAAyB,iBAAiB;AAG9E,MAAI,SAAS;AACX,QAAI,cAAc,OAAO,YAAY,YAAY,YAAY,MAAM;AACjE,aAAO;AAAA,QACL,UAAU;AAAA,QACV,QAAQ,mBAAmB,OAAkC;AAAA,MAC/D;AAAA,IACF;AACA,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,UAAU,OAAO;AAAA,IAC9B;AAAA,EACF;AAGA,QAAM,gBAAgB,QAAQ,YAAY,GAAG;AAC7C,MAAI,eAAe;AACjB,UAAM,mBAAmB,qBAAqB,aAAa;AAE3D,QAAI,qBAAqB,QAAW;AAClC,UAAI,cAAc,OAAO,qBAAqB,YAAY,qBAAqB,MAAM;AACnF,eAAO;AAAA,UACL,UAAU;AAAA,UACV,QAAQ,mBAAmB,gBAA2C;AAAA,QACxE;AAAA,MACF;AACA,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,KAAK,UAAU,gBAAgB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,6 +44,7 @@ export declare const getSchemes: (selectedSecuritySchemes: Operation["selectedSe
|
|
|
44
44
|
"x-scalar-security-query"?: Record<string, string> | undefined;
|
|
45
45
|
"x-scalar-security-body"?: Record<string, string> | undefined;
|
|
46
46
|
"x-tokenName"?: string | undefined;
|
|
47
|
+
"x-scalar-credentials-location"?: "header" | "body" | undefined;
|
|
47
48
|
} | undefined;
|
|
48
49
|
implicit?: {
|
|
49
50
|
type: "implicit";
|
|
@@ -70,6 +71,7 @@ export declare const getSchemes: (selectedSecuritySchemes: Operation["selectedSe
|
|
|
70
71
|
"x-scalar-security-query"?: Record<string, string> | undefined;
|
|
71
72
|
"x-scalar-security-body"?: Record<string, string> | undefined;
|
|
72
73
|
"x-tokenName"?: string | undefined;
|
|
74
|
+
"x-scalar-credentials-location"?: "header" | "body" | undefined;
|
|
73
75
|
} | undefined;
|
|
74
76
|
authorizationCode?: {
|
|
75
77
|
type: "authorizationCode";
|
|
@@ -86,6 +88,7 @@ export declare const getSchemes: (selectedSecuritySchemes: Operation["selectedSe
|
|
|
86
88
|
"x-scalar-security-query"?: Record<string, string> | undefined;
|
|
87
89
|
"x-scalar-security-body"?: Record<string, string> | undefined;
|
|
88
90
|
"x-tokenName"?: string | undefined;
|
|
91
|
+
"x-scalar-credentials-location"?: "header" | "body" | undefined;
|
|
89
92
|
} | undefined;
|
|
90
93
|
};
|
|
91
94
|
description?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-schemes.d.ts","sourceRoot":"","sources":["../../../src/helpers/security/get-schemes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,2IAA2I;AAC3I,eAAO,MAAM,UAAU,4BACI,SAAS,CAAC,4BAA4B,CAAC,mBAC/C,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"get-schemes.d.ts","sourceRoot":"","sources":["../../../src/helpers/security/get-schemes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,2IAA2I;AAC3I,eAAO,MAAM,UAAU,4BACI,SAAS,CAAC,4BAA4B,CAAC,mBAC/C,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAO43qF,CAAC;;;;;;;;;;;qCAA0X,CAAC;oCAA0E,CAAC;yBAA+D,CAAC;2CAAiE,CAAC;;gBAAwE,CAAC;;;;;;;;;qCAAiV,CAAC;oCAA0E,CAAC;yBAA+D,CAAC;;yBAAsE,CAAC;;;;;;;;;qCAAuU,CAAC;oCAA0E,CAAC;yBAA+D,CAAC;2CAAiE,CAAC;;yBAAiF,CAAC;;;;;;;;;;;;qCAA+c,CAAC;oCAA0E,CAAC;yBAA+D,CAAC;2CAAiE,CAAC;;;;;IADr3vF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AAgEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YACjB;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,
|
|
1
|
+
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AAgEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YACjB;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,GAwSF,CAAA"}
|
|
@@ -196,8 +196,11 @@ const getExampleFromSchema = (schema, options, level = 0, parentSchema, name) =>
|
|
|
196
196
|
}
|
|
197
197
|
const discriminateSchema = schema.oneOf || schema.anyOf;
|
|
198
198
|
if (Array.isArray(discriminateSchema) && discriminateSchema.length > 0) {
|
|
199
|
-
const
|
|
200
|
-
|
|
199
|
+
const firstNonNullItem = discriminateSchema.find((item) => item.type !== "null");
|
|
200
|
+
if (firstNonNullItem) {
|
|
201
|
+
return getExampleFromSchema(firstNonNullItem, options, level + 1);
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
201
204
|
}
|
|
202
205
|
if (Array.isArray(schema.allOf)) {
|
|
203
206
|
let example = null;
|