@scalar/oas-utils 0.4.1 → 0.4.3
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 +21 -0
- package/dist/entities/spec/request-examples.d.ts +27 -27
- package/dist/entities/spec/request-examples.d.ts.map +1 -1
- package/dist/entities/spec/request-examples.js +4 -4
- package/dist/entities/spec/request-examples.js.map +2 -2
- package/dist/entities/spec/spec-objects.d.ts.map +1 -1
- package/dist/entities/spec/spec-objects.js +1 -1
- package/dist/entities/spec/spec-objects.js.map +1 -1
- package/dist/helpers/index.d.ts +77 -18
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +69 -21
- package/dist/helpers/index.js.map +2 -2
- package/dist/helpers/redirect-to-proxy.d.ts +0 -4
- package/dist/helpers/redirect-to-proxy.d.ts.map +1 -1
- package/dist/helpers/redirect-to-proxy.js +2 -13
- package/dist/helpers/redirect-to-proxy.js.map +2 -2
- package/dist/helpers/security/get-schemes.d.ts.map +1 -1
- package/dist/helpers/security/get-schemes.js +1 -1
- package/dist/helpers/security/get-schemes.js.map +2 -2
- package/dist/migrations/local-storage.d.ts +1 -1
- package/dist/migrations/local-storage.d.ts.map +1 -1
- package/dist/migrations/local-storage.js +1 -1
- package/dist/migrations/local-storage.js.map +2 -2
- package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.1.0/migration.js +2 -1
- package/dist/migrations/v-2.1.0/migration.js.map +2 -2
- package/dist/spec-getters/get-request-body-from-operation.d.ts.map +1 -1
- 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/dist/transforms/import-spec.d.ts +1 -1
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +9 -6
- package/dist/transforms/import-spec.js.map +2 -2
- package/package.json +8 -7
- package/dist/helpers/create-hash.d.ts +0 -7
- package/dist/helpers/create-hash.d.ts.map +0 -1
- package/dist/helpers/create-hash.js +0 -18
- package/dist/helpers/create-hash.js.map +0 -7
- package/dist/helpers/ensure-protocol.d.ts +0 -3
- package/dist/helpers/ensure-protocol.d.ts.map +0 -1
- package/dist/helpers/ensure-protocol.js +0 -11
- package/dist/helpers/ensure-protocol.js.map +0 -7
- package/dist/helpers/find-variables.d.ts +0 -5
- package/dist/helpers/find-variables.d.ts.map +0 -1
- package/dist/helpers/find-variables.js +0 -8
- package/dist/helpers/find-variables.js.map +0 -7
- package/dist/helpers/http-methods.d.ts +0 -29
- package/dist/helpers/http-methods.d.ts.map +0 -1
- package/dist/helpers/http-methods.js +0 -66
- package/dist/helpers/http-methods.js.map +0 -7
- package/dist/helpers/http-status-codes.d.ts +0 -8
- package/dist/helpers/http-status-codes.d.ts.map +0 -1
- package/dist/helpers/http-status-codes.js +0 -321
- package/dist/helpers/http-status-codes.js.map +0 -7
- package/dist/helpers/is-defined.d.ts +0 -13
- package/dist/helpers/is-defined.d.ts.map +0 -1
- package/dist/helpers/is-defined.js +0 -5
- package/dist/helpers/is-defined.js.map +0 -7
- package/dist/helpers/is-local-url.d.ts +0 -5
- package/dist/helpers/is-local-url.d.ts.map +0 -1
- package/dist/helpers/is-local-url.js +0 -13
- package/dist/helpers/is-local-url.js.map +0 -7
- package/dist/helpers/is-valid-url.d.ts +0 -12
- package/dist/helpers/is-valid-url.d.ts.map +0 -1
- package/dist/helpers/is-valid-url.js +0 -11
- package/dist/helpers/is-valid-url.js.map +0 -7
- package/dist/helpers/iterate-title.d.ts +0 -5
- package/dist/helpers/iterate-title.d.ts.map +0 -1
- package/dist/helpers/iterate-title.js +0 -12
- package/dist/helpers/iterate-title.js.map +0 -7
- package/dist/helpers/json2xml.d.ts +0 -5
- package/dist/helpers/json2xml.d.ts.map +0 -1
- package/dist/helpers/json2xml.js +0 -45
- package/dist/helpers/json2xml.js.map +0 -7
- package/dist/helpers/local-storage.d.ts +0 -16
- package/dist/helpers/local-storage.d.ts.map +0 -1
- package/dist/helpers/local-storage.js +0 -15
- package/dist/helpers/local-storage.js.map +0 -7
- package/dist/helpers/make-url-absolute.d.ts +0 -5
- package/dist/helpers/make-url-absolute.d.ts.map +0 -1
- package/dist/helpers/make-url-absolute.js +0 -13
- package/dist/helpers/make-url-absolute.js.map +0 -7
- package/dist/helpers/merge-urls.d.ts +0 -15
- package/dist/helpers/merge-urls.d.ts.map +0 -1
- package/dist/helpers/merge-urls.js +0 -56
- package/dist/helpers/merge-urls.js.map +0 -7
- package/dist/helpers/object.d.ts +0 -10
- package/dist/helpers/object.d.ts.map +0 -1
- package/dist/helpers/object.js +0 -15
- package/dist/helpers/object.js.map +0 -7
- package/dist/helpers/omit-undefined-values.d.ts +0 -7
- package/dist/helpers/omit-undefined-values.d.ts.map +0 -1
- package/dist/helpers/omit-undefined-values.js +0 -19
- package/dist/helpers/omit-undefined-values.js.map +0 -7
- package/dist/helpers/regex-helpers.d.ts +0 -10
- package/dist/helpers/regex-helpers.d.ts.map +0 -1
- package/dist/helpers/regex-helpers.js +0 -13
- package/dist/helpers/regex-helpers.js.map +0 -7
- package/dist/helpers/replace-variables.d.ts +0 -5
- package/dist/helpers/replace-variables.d.ts.map +0 -1
- package/dist/helpers/replace-variables.js +0 -15
- package/dist/helpers/replace-variables.js.map +0 -7
- package/dist/helpers/string.d.ts +0 -15
- package/dist/helpers/string.d.ts.map +0 -1
- package/dist/helpers/string.js +0 -7
- package/dist/helpers/string.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8165b3b: feat(helpers): added new helpers package
|
|
8
|
+
- Updated dependencies [ba84a3c]
|
|
9
|
+
- Updated dependencies [8165b3b]
|
|
10
|
+
- Updated dependencies [358eb63]
|
|
11
|
+
- Updated dependencies [05c22c7]
|
|
12
|
+
- @scalar/themes@0.13.2
|
|
13
|
+
- @scalar/helpers@0.0.2
|
|
14
|
+
- @scalar/openapi-types@0.3.2
|
|
15
|
+
- @scalar/object-utils@1.2.1
|
|
16
|
+
- @scalar/types@0.2.2
|
|
17
|
+
|
|
18
|
+
## 0.4.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 7ca47ab: fix: add ssr safe alias for local storage
|
|
23
|
+
|
|
3
24
|
## 0.4.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -46,8 +46,8 @@ export declare const requestExampleParametersSchema: z.ZodEffects<z.ZodObject<{
|
|
|
46
46
|
description?: string | undefined;
|
|
47
47
|
default?: any;
|
|
48
48
|
required?: boolean | undefined;
|
|
49
|
-
key?: string | undefined;
|
|
50
49
|
enum?: string[] | undefined;
|
|
50
|
+
key?: string | undefined;
|
|
51
51
|
format?: string | undefined;
|
|
52
52
|
examples?: any[] | undefined;
|
|
53
53
|
enabled?: boolean | undefined;
|
|
@@ -76,8 +76,8 @@ export declare const requestExampleParametersSchema: z.ZodEffects<z.ZodObject<{
|
|
|
76
76
|
description?: string | undefined;
|
|
77
77
|
default?: any;
|
|
78
78
|
required?: boolean | undefined;
|
|
79
|
-
key?: string | undefined;
|
|
80
79
|
enum?: string[] | undefined;
|
|
80
|
+
key?: string | undefined;
|
|
81
81
|
format?: string | undefined;
|
|
82
82
|
examples?: any[] | undefined;
|
|
83
83
|
enabled?: boolean | undefined;
|
|
@@ -211,8 +211,8 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
211
211
|
description?: string | undefined;
|
|
212
212
|
default?: any;
|
|
213
213
|
required?: boolean | undefined;
|
|
214
|
-
key?: string | undefined;
|
|
215
214
|
enum?: string[] | undefined;
|
|
215
|
+
key?: string | undefined;
|
|
216
216
|
format?: string | undefined;
|
|
217
217
|
examples?: any[] | undefined;
|
|
218
218
|
enabled?: boolean | undefined;
|
|
@@ -241,8 +241,8 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
241
241
|
description?: string | undefined;
|
|
242
242
|
default?: any;
|
|
243
243
|
required?: boolean | undefined;
|
|
244
|
-
key?: string | undefined;
|
|
245
244
|
enum?: string[] | undefined;
|
|
245
|
+
key?: string | undefined;
|
|
246
246
|
format?: string | undefined;
|
|
247
247
|
examples?: any[] | undefined;
|
|
248
248
|
enabled?: boolean | undefined;
|
|
@@ -276,8 +276,8 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
276
276
|
description?: string | undefined;
|
|
277
277
|
default?: any;
|
|
278
278
|
required?: boolean | undefined;
|
|
279
|
-
key?: string | undefined;
|
|
280
279
|
enum?: string[] | undefined;
|
|
280
|
+
key?: string | undefined;
|
|
281
281
|
format?: string | undefined;
|
|
282
282
|
examples?: any[] | undefined;
|
|
283
283
|
enabled?: boolean | undefined;
|
|
@@ -326,8 +326,8 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
326
326
|
description?: string | undefined;
|
|
327
327
|
default?: any;
|
|
328
328
|
required?: boolean | undefined;
|
|
329
|
-
key?: string | undefined;
|
|
330
329
|
enum?: string[] | undefined;
|
|
330
|
+
key?: string | undefined;
|
|
331
331
|
format?: string | undefined;
|
|
332
332
|
examples?: any[] | undefined;
|
|
333
333
|
enabled?: boolean | undefined;
|
|
@@ -439,8 +439,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
439
439
|
description?: string | undefined;
|
|
440
440
|
default?: any;
|
|
441
441
|
required?: boolean | undefined;
|
|
442
|
-
key?: string | undefined;
|
|
443
442
|
enum?: string[] | undefined;
|
|
443
|
+
key?: string | undefined;
|
|
444
444
|
format?: string | undefined;
|
|
445
445
|
examples?: any[] | undefined;
|
|
446
446
|
enabled?: boolean | undefined;
|
|
@@ -469,8 +469,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
469
469
|
description?: string | undefined;
|
|
470
470
|
default?: any;
|
|
471
471
|
required?: boolean | undefined;
|
|
472
|
-
key?: string | undefined;
|
|
473
472
|
enum?: string[] | undefined;
|
|
473
|
+
key?: string | undefined;
|
|
474
474
|
format?: string | undefined;
|
|
475
475
|
examples?: any[] | undefined;
|
|
476
476
|
enabled?: boolean | undefined;
|
|
@@ -504,8 +504,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
504
504
|
description?: string | undefined;
|
|
505
505
|
default?: any;
|
|
506
506
|
required?: boolean | undefined;
|
|
507
|
-
key?: string | undefined;
|
|
508
507
|
enum?: string[] | undefined;
|
|
508
|
+
key?: string | undefined;
|
|
509
509
|
format?: string | undefined;
|
|
510
510
|
examples?: any[] | undefined;
|
|
511
511
|
enabled?: boolean | undefined;
|
|
@@ -554,8 +554,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
554
554
|
description?: string | undefined;
|
|
555
555
|
default?: any;
|
|
556
556
|
required?: boolean | undefined;
|
|
557
|
-
key?: string | undefined;
|
|
558
557
|
enum?: string[] | undefined;
|
|
558
|
+
key?: string | undefined;
|
|
559
559
|
format?: string | undefined;
|
|
560
560
|
examples?: any[] | undefined;
|
|
561
561
|
enabled?: boolean | undefined;
|
|
@@ -610,8 +610,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
610
610
|
description?: string | undefined;
|
|
611
611
|
default?: any;
|
|
612
612
|
required?: boolean | undefined;
|
|
613
|
-
key?: string | undefined;
|
|
614
613
|
enum?: string[] | undefined;
|
|
614
|
+
key?: string | undefined;
|
|
615
615
|
format?: string | undefined;
|
|
616
616
|
examples?: any[] | undefined;
|
|
617
617
|
enabled?: boolean | undefined;
|
|
@@ -640,8 +640,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
640
640
|
description?: string | undefined;
|
|
641
641
|
default?: any;
|
|
642
642
|
required?: boolean | undefined;
|
|
643
|
-
key?: string | undefined;
|
|
644
643
|
enum?: string[] | undefined;
|
|
644
|
+
key?: string | undefined;
|
|
645
645
|
format?: string | undefined;
|
|
646
646
|
examples?: any[] | undefined;
|
|
647
647
|
enabled?: boolean | undefined;
|
|
@@ -686,8 +686,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
686
686
|
description?: string | undefined;
|
|
687
687
|
default?: any;
|
|
688
688
|
required?: boolean | undefined;
|
|
689
|
-
key?: string | undefined;
|
|
690
689
|
enum?: string[] | undefined;
|
|
690
|
+
key?: string | undefined;
|
|
691
691
|
format?: string | undefined;
|
|
692
692
|
examples?: any[] | undefined;
|
|
693
693
|
enabled?: boolean | undefined;
|
|
@@ -716,8 +716,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
716
716
|
description?: string | undefined;
|
|
717
717
|
default?: any;
|
|
718
718
|
required?: boolean | undefined;
|
|
719
|
-
key?: string | undefined;
|
|
720
719
|
enum?: string[] | undefined;
|
|
720
|
+
key?: string | undefined;
|
|
721
721
|
format?: string | undefined;
|
|
722
722
|
examples?: any[] | undefined;
|
|
723
723
|
enabled?: boolean | undefined;
|
|
@@ -762,8 +762,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
762
762
|
description?: string | undefined;
|
|
763
763
|
default?: any;
|
|
764
764
|
required?: boolean | undefined;
|
|
765
|
-
key?: string | undefined;
|
|
766
765
|
enum?: string[] | undefined;
|
|
766
|
+
key?: string | undefined;
|
|
767
767
|
format?: string | undefined;
|
|
768
768
|
examples?: any[] | undefined;
|
|
769
769
|
enabled?: boolean | undefined;
|
|
@@ -792,8 +792,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
792
792
|
description?: string | undefined;
|
|
793
793
|
default?: any;
|
|
794
794
|
required?: boolean | undefined;
|
|
795
|
-
key?: string | undefined;
|
|
796
795
|
enum?: string[] | undefined;
|
|
796
|
+
key?: string | undefined;
|
|
797
797
|
format?: string | undefined;
|
|
798
798
|
examples?: any[] | undefined;
|
|
799
799
|
enabled?: boolean | undefined;
|
|
@@ -838,8 +838,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
838
838
|
description?: string | undefined;
|
|
839
839
|
default?: any;
|
|
840
840
|
required?: boolean | undefined;
|
|
841
|
-
key?: string | undefined;
|
|
842
841
|
enum?: string[] | undefined;
|
|
842
|
+
key?: string | undefined;
|
|
843
843
|
format?: string | undefined;
|
|
844
844
|
examples?: any[] | undefined;
|
|
845
845
|
enabled?: boolean | undefined;
|
|
@@ -868,8 +868,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
868
868
|
description?: string | undefined;
|
|
869
869
|
default?: any;
|
|
870
870
|
required?: boolean | undefined;
|
|
871
|
-
key?: string | undefined;
|
|
872
871
|
enum?: string[] | undefined;
|
|
872
|
+
key?: string | undefined;
|
|
873
873
|
format?: string | undefined;
|
|
874
874
|
examples?: any[] | undefined;
|
|
875
875
|
enabled?: boolean | undefined;
|
|
@@ -950,8 +950,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
950
950
|
description?: string | undefined;
|
|
951
951
|
default?: any;
|
|
952
952
|
required?: boolean | undefined;
|
|
953
|
-
key?: string | undefined;
|
|
954
953
|
enum?: string[] | undefined;
|
|
954
|
+
key?: string | undefined;
|
|
955
955
|
format?: string | undefined;
|
|
956
956
|
examples?: any[] | undefined;
|
|
957
957
|
enabled?: boolean | undefined;
|
|
@@ -966,8 +966,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
966
966
|
description?: string | undefined;
|
|
967
967
|
default?: any;
|
|
968
968
|
required?: boolean | undefined;
|
|
969
|
-
key?: string | undefined;
|
|
970
969
|
enum?: string[] | undefined;
|
|
970
|
+
key?: string | undefined;
|
|
971
971
|
format?: string | undefined;
|
|
972
972
|
examples?: any[] | undefined;
|
|
973
973
|
enabled?: boolean | undefined;
|
|
@@ -982,8 +982,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
982
982
|
description?: string | undefined;
|
|
983
983
|
default?: any;
|
|
984
984
|
required?: boolean | undefined;
|
|
985
|
-
key?: string | undefined;
|
|
986
985
|
enum?: string[] | undefined;
|
|
986
|
+
key?: string | undefined;
|
|
987
987
|
format?: string | undefined;
|
|
988
988
|
examples?: any[] | undefined;
|
|
989
989
|
enabled?: boolean | undefined;
|
|
@@ -998,8 +998,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
998
998
|
description?: string | undefined;
|
|
999
999
|
default?: any;
|
|
1000
1000
|
required?: boolean | undefined;
|
|
1001
|
-
key?: string | undefined;
|
|
1002
1001
|
enum?: string[] | undefined;
|
|
1002
|
+
key?: string | undefined;
|
|
1003
1003
|
format?: string | undefined;
|
|
1004
1004
|
examples?: any[] | undefined;
|
|
1005
1005
|
enabled?: boolean | undefined;
|
|
@@ -1124,8 +1124,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1124
1124
|
description?: string | undefined;
|
|
1125
1125
|
default?: any;
|
|
1126
1126
|
required?: boolean | undefined;
|
|
1127
|
-
key?: string | undefined;
|
|
1128
1127
|
enum?: string[] | undefined;
|
|
1128
|
+
key?: string | undefined;
|
|
1129
1129
|
format?: string | undefined;
|
|
1130
1130
|
examples?: any[] | undefined;
|
|
1131
1131
|
enabled?: boolean | undefined;
|
|
@@ -1151,8 +1151,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1151
1151
|
description?: string | undefined;
|
|
1152
1152
|
default?: any;
|
|
1153
1153
|
required?: boolean | undefined;
|
|
1154
|
-
key?: string | undefined;
|
|
1155
1154
|
enum?: string[] | undefined;
|
|
1155
|
+
key?: string | undefined;
|
|
1156
1156
|
format?: string | undefined;
|
|
1157
1157
|
examples?: any[] | undefined;
|
|
1158
1158
|
enabled?: boolean | undefined;
|
|
@@ -1167,8 +1167,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1167
1167
|
description?: string | undefined;
|
|
1168
1168
|
default?: any;
|
|
1169
1169
|
required?: boolean | undefined;
|
|
1170
|
-
key?: string | undefined;
|
|
1171
1170
|
enum?: string[] | undefined;
|
|
1171
|
+
key?: string | undefined;
|
|
1172
1172
|
format?: string | undefined;
|
|
1173
1173
|
examples?: any[] | undefined;
|
|
1174
1174
|
enabled?: boolean | undefined;
|
|
@@ -1183,8 +1183,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1183
1183
|
description?: string | undefined;
|
|
1184
1184
|
default?: any;
|
|
1185
1185
|
required?: boolean | undefined;
|
|
1186
|
-
key?: string | undefined;
|
|
1187
1186
|
enum?: string[] | undefined;
|
|
1187
|
+
key?: string | undefined;
|
|
1188
1188
|
format?: string | undefined;
|
|
1189
1189
|
examples?: any[] | undefined;
|
|
1190
1190
|
enabled?: boolean | undefined;
|
|
@@ -1199,8 +1199,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1199
1199
|
description?: string | undefined;
|
|
1200
1200
|
default?: any;
|
|
1201
1201
|
required?: boolean | undefined;
|
|
1202
|
-
key?: string | undefined;
|
|
1203
1202
|
enum?: string[] | undefined;
|
|
1203
|
+
key?: string | undefined;
|
|
1204
1204
|
format?: string | undefined;
|
|
1205
1205
|
examples?: any[] | undefined;
|
|
1206
1206
|
enabled?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAOtC;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAKjE,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB;IAC/B,qCAAqC;;;;QAzCrC;;;;WAIG;;QAEH,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4C1E,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;EAqD9D;AAKD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;;;;;;;;;;;;;;;EAsH1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAwHxG"}
|
|
@@ -3,9 +3,9 @@ import { getServerVariableExamples } from "../../spec-getters/get-server-variabl
|
|
|
3
3
|
import { keysOf } from "@scalar/object-utils/arrays";
|
|
4
4
|
import { nanoidSchema } from "@scalar/types/utils";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { isDefined } from "../../helpers/is-defined.js";
|
|
7
|
-
import { getObjectKeys } from "../../helpers/object.js";
|
|
8
6
|
import { getRequestBodyFromOperation } from "../../spec-getters/get-request-body-from-operation.js";
|
|
7
|
+
import { isDefined } from "@scalar/helpers/array/is-defined";
|
|
8
|
+
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
9
9
|
const requestExampleParametersSchema = z.object({
|
|
10
10
|
key: z.string().default(""),
|
|
11
11
|
value: z.coerce.string().default(""),
|
|
@@ -172,7 +172,7 @@ function convertExampleToXScalar(example) {
|
|
|
172
172
|
function createParamInstance(param) {
|
|
173
173
|
const schema = param.schema;
|
|
174
174
|
const firstExample = (() => {
|
|
175
|
-
if (param.examples && !Array.isArray(param.examples) &&
|
|
175
|
+
if (param.examples && !Array.isArray(param.examples) && objectKeys(param.examples).length > 0) {
|
|
176
176
|
const exampleValues = Object.entries(param.examples).map(([_, example2]) => {
|
|
177
177
|
if (example2.externalValue) {
|
|
178
178
|
return example2.externalValue;
|
|
@@ -197,7 +197,7 @@ function createParamInstance(param) {
|
|
|
197
197
|
return { value: schema.examples[0] };
|
|
198
198
|
}
|
|
199
199
|
if (param.content) {
|
|
200
|
-
const firstContentType =
|
|
200
|
+
const firstContentType = objectKeys(param.content)[0];
|
|
201
201
|
if (firstContentType) {
|
|
202
202
|
const content = param.content[firstContentType];
|
|
203
203
|
if (content?.examples) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/request-examples.ts"],
|
|
4
|
-
"sourcesContent": ["import { schemaModel } from '@/helpers/schema-model'\nimport { getServerVariableExamples } from '@/spec-getters/get-server-variable-examples'\nimport { keysOf } from '@scalar/object-utils/arrays'\nimport { type ENTITY_BRANDS, nanoidSchema } from '@scalar/types/utils'\nimport { z } from 'zod'\n\nimport { isDefined } from '@/helpers/is-defined'\nimport { getObjectKeys } from '@/helpers/object'\n\nimport { getRequestBodyFromOperation } from '@/spec-getters/get-request-body-from-operation'\nimport type { RequestParameter, ParameterContent } from './parameters'\nimport type { Request } from './requests'\nimport type { Server } from './server'\n\n// ---------------------------------------------------------------------------\n// Example Parameters\n\n/**\n * TODO: Deprecate this.\n *\n * The request schema should be stored in the request and any\n * parameters should be validated against that\n */\nexport const requestExampleParametersSchema = z\n .object({\n key: z.string().default(''),\n value: z.coerce.string().default(''),\n enabled: z.boolean().default(true),\n file: z.any().optional(),\n description: z.string().optional(),\n required: z.boolean().optional(),\n enum: z.array(z.string()).optional(),\n examples: z.array(z.any()).optional(),\n type: z\n .union([\n // 'string'\n z.string(),\n // ['string', 'null']\n z.array(z.string()),\n ])\n .optional(),\n format: z.string().optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional(),\n default: z.any().optional(),\n nullable: z.boolean().optional(),\n })\n // set nullable: to true if type is ['string', 'null']\n .transform((_data) => {\n const data = { ..._data }\n\n // type: ['string', 'null'] -> nullable: true\n if (Array.isArray(data.type) && data.type.includes('null')) {\n data.nullable = true\n }\n\n // Hey, if it's just one value and 'null', we can make it a string and ditch the 'null'.\n if (Array.isArray(data.type) && data.type.length === 2 && data.type.includes('null')) {\n data.type = data.type.find((item) => item !== 'null')\n }\n\n return data\n })\n\n/** Convert the array of parameters to an object keyed by the parameter name */\nexport const parameterArrayToObject = (params: RequestExampleParameter[]) =>\n params.reduce<Record<string, string>>((map, param) => {\n map[param.key] = param.value\n return map\n }, {})\n\n/** Request examples - formerly known as instances - are \"children\" of requests */\nexport type RequestExampleParameter = z.infer<typeof requestExampleParametersSchema>\n\nexport const xScalarFileValueSchema = z\n .object({\n url: z.string(),\n base64: z.string().optional(),\n })\n .nullable()\n\n/**\n * When files are required for an example we provide the options\n * to provide a public URL or a base64 encoded string\n */\nexport type XScalarFileValue = z.infer<typeof xScalarFileValueSchema>\n\n/**\n * Schema for the OAS serialization of request example parameters\n *\n * File values can be optionally fetched on import OR inserted as a base64 encoded string\n */\nexport const xScalarFormDataValue = z.union([\n z.object({\n type: z.literal('string'),\n value: z.string(),\n }),\n z.object({\n type: z.literal('file'),\n file: xScalarFileValueSchema,\n }),\n])\n\nexport type XScalarFormDataValue = z.infer<typeof xScalarFormDataValue>\n\n// ---------------------------------------------------------------------------\n// Example Body\n\n/**\n * Possible encodings for example request bodies when using text formats\n *\n * TODO: This list may not be comprehensive enough\n */\nexport const exampleRequestBodyEncoding = ['json', 'text', 'html', 'javascript', 'xml', 'yaml', 'edn'] as const\n\nexport type BodyEncoding = (typeof exampleRequestBodyEncoding)[number]\n\nexport const exampleBodyMime = [\n 'application/json',\n 'text/plain',\n 'text/html',\n 'application/javascript',\n 'application/xml',\n 'application/yaml',\n 'application/edn',\n 'application/octet-stream',\n 'application/x-www-form-urlencoded',\n 'multipart/form-data',\n /** Used for direct files */\n 'binary',\n] as const\n\nexport type BodyMime = (typeof exampleBodyMime)[number]\n\nconst contentMapping: Record<BodyEncoding, BodyMime> = {\n json: 'application/json',\n text: 'text/plain',\n html: 'text/html',\n javascript: 'application/javascript',\n xml: 'application/xml',\n yaml: 'application/yaml',\n edn: 'application/edn',\n} as const\n\n/**\n * TODO: Migrate away from this layout to the format used in the extension\n *\n * If a user changes the encoding of the body we expect the content to change as well\n */\nexport const exampleRequestBodySchema = z.object({\n raw: z\n .object({\n encoding: z.enum(exampleRequestBodyEncoding),\n value: z.string().default(''),\n mimeType: z.string().optional(),\n })\n .optional(),\n formData: z\n .object({\n encoding: z.union([z.literal('form-data'), z.literal('urlencoded')]).default('form-data'),\n value: requestExampleParametersSchema.array().default([]),\n })\n .optional(),\n binary: z.instanceof(Blob).optional(),\n activeBody: z.union([z.literal('raw'), z.literal('formData'), z.literal('binary')]).default('raw'),\n})\n\nexport type ExampleRequestBody = z.infer<typeof exampleRequestBodySchema>\n\n/** Schema for the OAS serialization of request example bodies */\nexport const xScalarExampleBodySchema = z.object({\n encoding: z.enum(exampleBodyMime),\n /**\n * Body content as an object with a separately specified encoding or a simple pre-encoded string value\n *\n * Ideally we would convert any objects into the proper encoding on import\n */\n content: z.union([z.record(z.string(), z.any()), z.string()]),\n /** When the encoding is `binary` this will be used to link to the file */\n file: xScalarFileValueSchema.optional(),\n})\n\nexport type XScalarExampleBody = z.infer<typeof xScalarExampleBodySchema>\n\n// ---------------------------------------------------------------------------\n// Example Schema\n\nexport const requestExampleSchema = z.object({\n uid: nanoidSchema.brand<ENTITY_BRANDS['EXAMPLE']>(),\n type: z.literal('requestExample').optional().default('requestExample'),\n requestUid: z.string().brand<ENTITY_BRANDS['OPERATION']>().optional(),\n name: z.string().optional().default('Name'),\n body: exampleRequestBodySchema.optional().default({}),\n parameters: z\n .object({\n path: requestExampleParametersSchema.array().default([]),\n query: requestExampleParametersSchema.array().default([]),\n headers: requestExampleParametersSchema.array().default([{ key: 'Accept', value: '*/*', enabled: true }]),\n cookies: requestExampleParametersSchema.array().default([]),\n })\n .optional()\n .default({}),\n /** TODO: Should this be deprecated? */\n serverVariables: z.record(z.string(), z.array(z.string())).optional(),\n})\n\nexport type RequestExample = z.infer<typeof requestExampleSchema>\n\n/** For OAS serialization we just store the simple key/value pairs */\nconst xScalarExampleParameterSchema = z.record(z.string(), z.string()).optional()\n\n/** Schema for the OAS serialization of request examples */\nexport const xScalarExampleSchema = z.object({\n /** TODO: Should this be required? */\n name: z.string().optional(),\n body: xScalarExampleBodySchema.optional(),\n parameters: z.object({\n path: xScalarExampleParameterSchema,\n query: xScalarExampleParameterSchema,\n headers: xScalarExampleParameterSchema,\n cookies: xScalarExampleParameterSchema,\n }),\n})\n\nexport type XScalarExample = z.infer<typeof xScalarExampleSchema>\n\n/**\n * Convert a request example to the xScalar serialized format\n *\n * TODO: The base format should be migrated to align MUCH closer to the serialized format\n */\nexport function convertExampleToXScalar(example: RequestExample) {\n const active = example.body?.activeBody\n\n const xScalarBody: XScalarExampleBody = {\n encoding: 'text/plain',\n content: '',\n }\n\n if (example.body?.activeBody === 'binary') {\n xScalarBody.encoding = 'binary'\n // TODO: Need to allow users to set these properties\n xScalarBody.file = null\n }\n\n if (active === 'formData' && example.body?.[active]) {\n const body = example.body[active]\n xScalarBody.encoding = body.encoding === 'form-data' ? 'multipart/form-data' : 'application/x-www-form-urlencoded'\n\n // TODO: Need to allow users to set these properties\n xScalarBody.content = body.value.reduce<Record<string, XScalarFormDataValue>>((map, param) => {\n /** TODO: We need to ensure only file or value is set */\n map[param.key] = param.file\n ? {\n type: 'file',\n file: null,\n }\n : {\n type: 'string',\n value: param.value,\n }\n return map\n }, {})\n }\n\n if (example.body?.activeBody === 'raw') {\n xScalarBody.encoding = contentMapping[example.body.raw?.encoding ?? 'text'] ?? 'text/plain'\n\n xScalarBody.content = example.body.raw?.value ?? ''\n }\n\n const parameters: XScalarExample['parameters'] = {}\n\n keysOf(example.parameters ?? {}).forEach((key) => {\n if (example.parameters?.[key].length) {\n parameters[key] = parameterArrayToObject(example.parameters[key])\n }\n })\n\n return xScalarExampleSchema.parse({\n /** Only add the body if we have content or the body should be a file */\n body: xScalarBody.content || xScalarBody.encoding === 'binary' ? xScalarBody : undefined,\n parameters,\n })\n}\n\n// ---------------------------------------------------------------------------\n// Example Helpers\n\n/** Create new instance parameter from a request parameter */\nexport function createParamInstance(param: RequestParameter) {\n const schema = param.schema as any\n\n const firstExample = (() => {\n if (param.examples && !Array.isArray(param.examples) && getObjectKeys(param.examples).length > 0) {\n const exampleValues = Object.entries(param.examples).map(([_, example]) => {\n // returns the external value if it exists\n if (example.externalValue) {\n return example.externalValue\n }\n\n // returns the value if it exists and is defined\n // e.g. { examples: { foo: { value: 'bar' } } } would return ['bar']\n return example.value\n })\n\n // returns the first example as selected value along other examples\n return { value: exampleValues[0], examples: exampleValues }\n }\n\n // param example e.g. { example: 'foo' }\n if (isDefined(param.example)) {\n return { value: param.example }\n }\n\n // param examples e.g. { examples: ['foo', 'bar'] }\n if (Array.isArray(param.examples) && param.examples.length > 0) {\n return { value: param.examples[0] }\n }\n\n // schema example e.g. { example: 'foo' } while being discouraged\n // see https://spec.openapis.org/oas/v3.1.1.html#fixed-fields-20\n if (isDefined(schema?.example)) {\n return { value: schema.example }\n }\n\n // schema examples e.g. { examples: ['foo', 'bar'] }\n if (Array.isArray(schema?.examples) && schema.examples.length > 0) {\n // For boolean type, default to false when using schema examples\n if (schema?.type === 'boolean') {\n return { value: schema.default ?? false }\n }\n return { value: schema.examples[0] }\n }\n\n // content examples e.g. { content: { 'application/json': { examples: { foo: { value: 'bar' } } } } }\n if (param.content) {\n const firstContentType = getObjectKeys(param.content)[0]\n if (firstContentType) {\n const content = (param.content as ParameterContent)[firstContentType]\n if (content?.examples) {\n const firstExampleKey = Object.keys(content.examples)[0]\n if (firstExampleKey) {\n const example = content.examples[firstExampleKey]\n if (isDefined(example?.value)) {\n return { value: example.value }\n }\n }\n }\n // content example e.g. { example: 'foo' }\n if (isDefined(content?.example)) {\n return { value: content.example }\n }\n }\n }\n\n return null\n })() as null | { value: any; examples?: string[] }\n\n /**\n * TODO:\n * - Need better value defaulting here\n * - Need to handle non-string parameters much better\n * - Need to handle unions/array values for schema\n */\n const value = String(firstExample?.value ?? schema?.default ?? '')\n\n // Handle non-string enums and enums within items for array types\n const parseEnum = (() => {\n if (schema?.enum && schema?.type !== 'string') {\n return schema.enum?.map(String)\n }\n\n if (schema?.items?.enum && schema?.type === 'array') {\n return schema.items.enum.map(String)\n }\n\n return schema?.enum\n })()\n\n // Handle parameter examples\n const examples =\n firstExample?.examples ||\n (schema?.examples && schema?.type !== 'string' ? schema.examples?.map(String) : schema?.examples)\n\n // safe parse the example\n const example = schemaModel(\n {\n ...schema,\n key: param.name,\n value,\n description: param.description,\n required: param.required,\n /** Initialized all required properties to enabled */\n enabled: !!param.required,\n enum: parseEnum,\n examples,\n },\n requestExampleParametersSchema,\n false,\n )\n\n if (!example) {\n console.warn(`Example at ${param.name} is invalid.`)\n return requestExampleParametersSchema.parse({})\n }\n\n return example\n}\n\n/**\n * Create new request example from a request\n * Iterates the name of the example if provided\n */\nexport function createExampleFromRequest(request: Request, name: string, server?: Server): RequestExample {\n // ---------------------------------------------------------------------------\n // Populate all parameters with an example value\n const parameters: Record<'path' | 'cookie' | 'header' | 'query' | 'headers', RequestExampleParameter[]> = {\n path: [],\n query: [],\n cookie: [],\n // deprecated TODO: add zod transform to remove\n header: [],\n headers: [{ key: 'Accept', value: '*/*', enabled: true }],\n }\n\n // Populated the separated params\n request.parameters?.forEach((p) => parameters[p.in].push(createParamInstance(p)))\n\n // TODO: add zod transform to remove header and only support headers\n if (parameters.header.length > 0) {\n parameters.headers = parameters.header\n parameters.header = []\n }\n\n // Get content type header\n const contentTypeHeader = parameters.headers.find((h) => h.key.toLowerCase() === 'content-type')\n\n // ---------------------------------------------------------------------------\n // Handle request body defaulting for various content type encodings\n const body: ExampleRequestBody = {\n activeBody: 'raw',\n }\n\n // If we have a request body or a content type header\n if (request.requestBody || contentTypeHeader?.value) {\n const requestBody = getRequestBodyFromOperation({\n path: request.path,\n information: {\n requestBody: request.requestBody,\n },\n })\n\n const contentType = request.requestBody ? requestBody?.mimeType : contentTypeHeader?.value\n\n // Handle JSON and JSON-like mimetypes\n if (contentType?.includes('/json') || contentType?.endsWith('+json')) {\n body.activeBody = 'raw'\n body.raw = {\n encoding: 'json',\n mimeType: contentType,\n value: requestBody?.text ?? JSON.stringify({}),\n }\n }\n\n if (contentType === 'application/xml') {\n body.activeBody = 'raw'\n body.raw = {\n encoding: 'xml',\n value: requestBody?.text ?? '',\n }\n }\n\n /**\n * TODO: Are we loading example files from somewhere based on the spec?\n * How are we handling the body values\n */\n if (contentType === 'application/octet-stream') {\n body.activeBody = 'binary'\n body.binary = undefined\n }\n\n if (contentType === 'application/x-www-form-urlencoded' || contentType === 'multipart/form-data') {\n body.activeBody = 'formData'\n body.formData = {\n encoding: contentType === 'application/x-www-form-urlencoded' ? 'urlencoded' : 'form-data',\n value: (requestBody?.params || []).map((param) => {\n if (param.value instanceof File) {\n return {\n key: param.name,\n value: 'BINARY',\n file: param.value,\n enabled: true,\n }\n }\n return {\n key: param.name,\n value: param.value || '',\n enabled: true,\n }\n }),\n }\n }\n\n // Add the content-type header if it doesn't exist and if it's not multipart request\n if (requestBody?.mimeType && !contentTypeHeader && !requestBody.mimeType.startsWith('multipart/')) {\n parameters.headers.push({\n key: 'Content-Type',\n value: requestBody.mimeType,\n enabled: true,\n })\n }\n }\n\n const serverVariables = server ? getServerVariableExamples(server) : {}\n\n // safe parse the example\n const example = schemaModel(\n {\n requestUid: request.uid,\n parameters,\n name,\n body,\n serverVariables,\n },\n requestExampleSchema,\n false,\n )\n\n if (!example) {\n console.warn(`Example at ${request.uid} is invalid.`)\n return requestExampleSchema.parse({})\n }\n return example\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,iCAAiC;AAC1C,SAAS,cAAc;AACvB,SAA6B,oBAAoB;AACjD,SAAS,SAAS;AAElB,SAAS,
|
|
4
|
+
"sourcesContent": ["import { schemaModel } from '@/helpers/schema-model'\nimport { getServerVariableExamples } from '@/spec-getters/get-server-variable-examples'\nimport { keysOf } from '@scalar/object-utils/arrays'\nimport { type ENTITY_BRANDS, nanoidSchema } from '@scalar/types/utils'\nimport { z } from 'zod'\n\nimport { getRequestBodyFromOperation } from '@/spec-getters/get-request-body-from-operation'\nimport type { RequestParameter, ParameterContent } from './parameters'\nimport type { Request } from './requests'\nimport type { Server } from './server'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { objectKeys } from '@scalar/helpers/object/object-keys'\n\n// ---------------------------------------------------------------------------\n// Example Parameters\n\n/**\n * TODO: Deprecate this.\n *\n * The request schema should be stored in the request and any\n * parameters should be validated against that\n */\nexport const requestExampleParametersSchema = z\n .object({\n key: z.string().default(''),\n value: z.coerce.string().default(''),\n enabled: z.boolean().default(true),\n file: z.any().optional(),\n description: z.string().optional(),\n required: z.boolean().optional(),\n enum: z.array(z.string()).optional(),\n examples: z.array(z.any()).optional(),\n type: z\n .union([\n // 'string'\n z.string(),\n // ['string', 'null']\n z.array(z.string()),\n ])\n .optional(),\n format: z.string().optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional(),\n default: z.any().optional(),\n nullable: z.boolean().optional(),\n })\n // set nullable: to true if type is ['string', 'null']\n .transform((_data) => {\n const data = { ..._data }\n\n // type: ['string', 'null'] -> nullable: true\n if (Array.isArray(data.type) && data.type.includes('null')) {\n data.nullable = true\n }\n\n // Hey, if it's just one value and 'null', we can make it a string and ditch the 'null'.\n if (Array.isArray(data.type) && data.type.length === 2 && data.type.includes('null')) {\n data.type = data.type.find((item) => item !== 'null')\n }\n\n return data\n })\n\n/** Convert the array of parameters to an object keyed by the parameter name */\nexport const parameterArrayToObject = (params: RequestExampleParameter[]) =>\n params.reduce<Record<string, string>>((map, param) => {\n map[param.key] = param.value\n return map\n }, {})\n\n/** Request examples - formerly known as instances - are \"children\" of requests */\nexport type RequestExampleParameter = z.infer<typeof requestExampleParametersSchema>\n\nexport const xScalarFileValueSchema = z\n .object({\n url: z.string(),\n base64: z.string().optional(),\n })\n .nullable()\n\n/**\n * When files are required for an example we provide the options\n * to provide a public URL or a base64 encoded string\n */\nexport type XScalarFileValue = z.infer<typeof xScalarFileValueSchema>\n\n/**\n * Schema for the OAS serialization of request example parameters\n *\n * File values can be optionally fetched on import OR inserted as a base64 encoded string\n */\nexport const xScalarFormDataValue = z.union([\n z.object({\n type: z.literal('string'),\n value: z.string(),\n }),\n z.object({\n type: z.literal('file'),\n file: xScalarFileValueSchema,\n }),\n])\n\nexport type XScalarFormDataValue = z.infer<typeof xScalarFormDataValue>\n\n// ---------------------------------------------------------------------------\n// Example Body\n\n/**\n * Possible encodings for example request bodies when using text formats\n *\n * TODO: This list may not be comprehensive enough\n */\nexport const exampleRequestBodyEncoding = ['json', 'text', 'html', 'javascript', 'xml', 'yaml', 'edn'] as const\n\nexport type BodyEncoding = (typeof exampleRequestBodyEncoding)[number]\n\nexport const exampleBodyMime = [\n 'application/json',\n 'text/plain',\n 'text/html',\n 'application/javascript',\n 'application/xml',\n 'application/yaml',\n 'application/edn',\n 'application/octet-stream',\n 'application/x-www-form-urlencoded',\n 'multipart/form-data',\n /** Used for direct files */\n 'binary',\n] as const\n\nexport type BodyMime = (typeof exampleBodyMime)[number]\n\nconst contentMapping: Record<BodyEncoding, BodyMime> = {\n json: 'application/json',\n text: 'text/plain',\n html: 'text/html',\n javascript: 'application/javascript',\n xml: 'application/xml',\n yaml: 'application/yaml',\n edn: 'application/edn',\n} as const\n\n/**\n * TODO: Migrate away from this layout to the format used in the extension\n *\n * If a user changes the encoding of the body we expect the content to change as well\n */\nexport const exampleRequestBodySchema = z.object({\n raw: z\n .object({\n encoding: z.enum(exampleRequestBodyEncoding),\n value: z.string().default(''),\n mimeType: z.string().optional(),\n })\n .optional(),\n formData: z\n .object({\n encoding: z.union([z.literal('form-data'), z.literal('urlencoded')]).default('form-data'),\n value: requestExampleParametersSchema.array().default([]),\n })\n .optional(),\n binary: z.instanceof(Blob).optional(),\n activeBody: z.union([z.literal('raw'), z.literal('formData'), z.literal('binary')]).default('raw'),\n})\n\nexport type ExampleRequestBody = z.infer<typeof exampleRequestBodySchema>\n\n/** Schema for the OAS serialization of request example bodies */\nexport const xScalarExampleBodySchema = z.object({\n encoding: z.enum(exampleBodyMime),\n /**\n * Body content as an object with a separately specified encoding or a simple pre-encoded string value\n *\n * Ideally we would convert any objects into the proper encoding on import\n */\n content: z.union([z.record(z.string(), z.any()), z.string()]),\n /** When the encoding is `binary` this will be used to link to the file */\n file: xScalarFileValueSchema.optional(),\n})\n\nexport type XScalarExampleBody = z.infer<typeof xScalarExampleBodySchema>\n\n// ---------------------------------------------------------------------------\n// Example Schema\n\nexport const requestExampleSchema = z.object({\n uid: nanoidSchema.brand<ENTITY_BRANDS['EXAMPLE']>(),\n type: z.literal('requestExample').optional().default('requestExample'),\n requestUid: z.string().brand<ENTITY_BRANDS['OPERATION']>().optional(),\n name: z.string().optional().default('Name'),\n body: exampleRequestBodySchema.optional().default({}),\n parameters: z\n .object({\n path: requestExampleParametersSchema.array().default([]),\n query: requestExampleParametersSchema.array().default([]),\n headers: requestExampleParametersSchema.array().default([{ key: 'Accept', value: '*/*', enabled: true }]),\n cookies: requestExampleParametersSchema.array().default([]),\n })\n .optional()\n .default({}),\n /** TODO: Should this be deprecated? */\n serverVariables: z.record(z.string(), z.array(z.string())).optional(),\n})\n\nexport type RequestExample = z.infer<typeof requestExampleSchema>\n\n/** For OAS serialization we just store the simple key/value pairs */\nconst xScalarExampleParameterSchema = z.record(z.string(), z.string()).optional()\n\n/** Schema for the OAS serialization of request examples */\nexport const xScalarExampleSchema = z.object({\n /** TODO: Should this be required? */\n name: z.string().optional(),\n body: xScalarExampleBodySchema.optional(),\n parameters: z.object({\n path: xScalarExampleParameterSchema,\n query: xScalarExampleParameterSchema,\n headers: xScalarExampleParameterSchema,\n cookies: xScalarExampleParameterSchema,\n }),\n})\n\nexport type XScalarExample = z.infer<typeof xScalarExampleSchema>\n\n/**\n * Convert a request example to the xScalar serialized format\n *\n * TODO: The base format should be migrated to align MUCH closer to the serialized format\n */\nexport function convertExampleToXScalar(example: RequestExample) {\n const active = example.body?.activeBody\n\n const xScalarBody: XScalarExampleBody = {\n encoding: 'text/plain',\n content: '',\n }\n\n if (example.body?.activeBody === 'binary') {\n xScalarBody.encoding = 'binary'\n // TODO: Need to allow users to set these properties\n xScalarBody.file = null\n }\n\n if (active === 'formData' && example.body?.[active]) {\n const body = example.body[active]\n xScalarBody.encoding = body.encoding === 'form-data' ? 'multipart/form-data' : 'application/x-www-form-urlencoded'\n\n // TODO: Need to allow users to set these properties\n xScalarBody.content = body.value.reduce<Record<string, XScalarFormDataValue>>((map, param) => {\n /** TODO: We need to ensure only file or value is set */\n map[param.key] = param.file\n ? {\n type: 'file',\n file: null,\n }\n : {\n type: 'string',\n value: param.value,\n }\n return map\n }, {})\n }\n\n if (example.body?.activeBody === 'raw') {\n xScalarBody.encoding = contentMapping[example.body.raw?.encoding ?? 'text'] ?? 'text/plain'\n\n xScalarBody.content = example.body.raw?.value ?? ''\n }\n\n const parameters: XScalarExample['parameters'] = {}\n\n keysOf(example.parameters ?? {}).forEach((key) => {\n if (example.parameters?.[key].length) {\n parameters[key] = parameterArrayToObject(example.parameters[key])\n }\n })\n\n return xScalarExampleSchema.parse({\n /** Only add the body if we have content or the body should be a file */\n body: xScalarBody.content || xScalarBody.encoding === 'binary' ? xScalarBody : undefined,\n parameters,\n })\n}\n\n// ---------------------------------------------------------------------------\n// Example Helpers\n\n/** Create new instance parameter from a request parameter */\nexport function createParamInstance(param: RequestParameter) {\n const schema = param.schema as any\n\n const firstExample = (() => {\n if (param.examples && !Array.isArray(param.examples) && objectKeys(param.examples).length > 0) {\n const exampleValues = Object.entries(param.examples).map(([_, example]) => {\n // returns the external value if it exists\n if (example.externalValue) {\n return example.externalValue\n }\n\n // returns the value if it exists and is defined\n // e.g. { examples: { foo: { value: 'bar' } } } would return ['bar']\n return example.value\n })\n\n // returns the first example as selected value along other examples\n return { value: exampleValues[0], examples: exampleValues }\n }\n\n // param example e.g. { example: 'foo' }\n if (isDefined(param.example)) {\n return { value: param.example }\n }\n\n // param examples e.g. { examples: ['foo', 'bar'] }\n if (Array.isArray(param.examples) && param.examples.length > 0) {\n return { value: param.examples[0] }\n }\n\n // schema example e.g. { example: 'foo' } while being discouraged\n // see https://spec.openapis.org/oas/v3.1.1.html#fixed-fields-20\n if (isDefined(schema?.example)) {\n return { value: schema.example }\n }\n\n // schema examples e.g. { examples: ['foo', 'bar'] }\n if (Array.isArray(schema?.examples) && schema.examples.length > 0) {\n // For boolean type, default to false when using schema examples\n if (schema?.type === 'boolean') {\n return { value: schema.default ?? false }\n }\n return { value: schema.examples[0] }\n }\n\n // content examples e.g. { content: { 'application/json': { examples: { foo: { value: 'bar' } } } } }\n if (param.content) {\n const firstContentType = objectKeys(param.content)[0]\n if (firstContentType) {\n const content = (param.content as ParameterContent)[firstContentType]\n if (content?.examples) {\n const firstExampleKey = Object.keys(content.examples)[0]\n if (firstExampleKey) {\n const example = content.examples[firstExampleKey]\n if (isDefined(example?.value)) {\n return { value: example.value }\n }\n }\n }\n // content example e.g. { example: 'foo' }\n if (isDefined(content?.example)) {\n return { value: content.example }\n }\n }\n }\n\n return null\n })() as null | { value: any; examples?: string[] }\n\n /**\n * TODO:\n * - Need better value defaulting here\n * - Need to handle non-string parameters much better\n * - Need to handle unions/array values for schema\n */\n const value = String(firstExample?.value ?? schema?.default ?? '')\n\n // Handle non-string enums and enums within items for array types\n const parseEnum = (() => {\n if (schema?.enum && schema?.type !== 'string') {\n return schema.enum?.map(String)\n }\n\n if (schema?.items?.enum && schema?.type === 'array') {\n return schema.items.enum.map(String)\n }\n\n return schema?.enum\n })()\n\n // Handle parameter examples\n const examples =\n firstExample?.examples ||\n (schema?.examples && schema?.type !== 'string' ? schema.examples?.map(String) : schema?.examples)\n\n // safe parse the example\n const example = schemaModel(\n {\n ...schema,\n key: param.name,\n value,\n description: param.description,\n required: param.required,\n /** Initialized all required properties to enabled */\n enabled: !!param.required,\n enum: parseEnum,\n examples,\n },\n requestExampleParametersSchema,\n false,\n )\n\n if (!example) {\n console.warn(`Example at ${param.name} is invalid.`)\n return requestExampleParametersSchema.parse({})\n }\n\n return example\n}\n\n/**\n * Create new request example from a request\n * Iterates the name of the example if provided\n */\nexport function createExampleFromRequest(request: Request, name: string, server?: Server): RequestExample {\n // ---------------------------------------------------------------------------\n // Populate all parameters with an example value\n const parameters: Record<'path' | 'cookie' | 'header' | 'query' | 'headers', RequestExampleParameter[]> = {\n path: [],\n query: [],\n cookie: [],\n // deprecated TODO: add zod transform to remove\n header: [],\n headers: [{ key: 'Accept', value: '*/*', enabled: true }],\n }\n\n // Populated the separated params\n request.parameters?.forEach((p) => parameters[p.in].push(createParamInstance(p)))\n\n // TODO: add zod transform to remove header and only support headers\n if (parameters.header.length > 0) {\n parameters.headers = parameters.header\n parameters.header = []\n }\n\n // Get content type header\n const contentTypeHeader = parameters.headers.find((h) => h.key.toLowerCase() === 'content-type')\n\n // ---------------------------------------------------------------------------\n // Handle request body defaulting for various content type encodings\n const body: ExampleRequestBody = {\n activeBody: 'raw',\n }\n\n // If we have a request body or a content type header\n if (request.requestBody || contentTypeHeader?.value) {\n const requestBody = getRequestBodyFromOperation({\n path: request.path,\n information: {\n requestBody: request.requestBody,\n },\n })\n\n const contentType = request.requestBody ? requestBody?.mimeType : contentTypeHeader?.value\n\n // Handle JSON and JSON-like mimetypes\n if (contentType?.includes('/json') || contentType?.endsWith('+json')) {\n body.activeBody = 'raw'\n body.raw = {\n encoding: 'json',\n mimeType: contentType,\n value: requestBody?.text ?? JSON.stringify({}),\n }\n }\n\n if (contentType === 'application/xml') {\n body.activeBody = 'raw'\n body.raw = {\n encoding: 'xml',\n value: requestBody?.text ?? '',\n }\n }\n\n /**\n * TODO: Are we loading example files from somewhere based on the spec?\n * How are we handling the body values\n */\n if (contentType === 'application/octet-stream') {\n body.activeBody = 'binary'\n body.binary = undefined\n }\n\n if (contentType === 'application/x-www-form-urlencoded' || contentType === 'multipart/form-data') {\n body.activeBody = 'formData'\n body.formData = {\n encoding: contentType === 'application/x-www-form-urlencoded' ? 'urlencoded' : 'form-data',\n value: (requestBody?.params || []).map((param) => {\n if (param.value instanceof File) {\n return {\n key: param.name,\n value: 'BINARY',\n file: param.value,\n enabled: true,\n }\n }\n return {\n key: param.name,\n value: param.value || '',\n enabled: true,\n }\n }),\n }\n }\n\n // Add the content-type header if it doesn't exist and if it's not multipart request\n if (requestBody?.mimeType && !contentTypeHeader && !requestBody.mimeType.startsWith('multipart/')) {\n parameters.headers.push({\n key: 'Content-Type',\n value: requestBody.mimeType,\n enabled: true,\n })\n }\n }\n\n const serverVariables = server ? getServerVariableExamples(server) : {}\n\n // safe parse the example\n const example = schemaModel(\n {\n requestUid: request.uid,\n parameters,\n name,\n body,\n serverVariables,\n },\n requestExampleSchema,\n false,\n )\n\n if (!example) {\n console.warn(`Example at ${request.uid} is invalid.`)\n return requestExampleSchema.parse({})\n }\n return example\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,iCAAiC;AAC1C,SAAS,cAAc;AACvB,SAA6B,oBAAoB;AACjD,SAAS,SAAS;AAElB,SAAS,mCAAmC;AAI5C,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAWpB,MAAM,iCAAiC,EAC3C,OAAO;AAAA,EACN,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA,EAC1B,OAAO,EAAE,OAAO,OAAO,EAAE,QAAQ,EAAE;AAAA,EACnC,SAAS,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,EACjC,MAAM,EAAE,IAAI,EAAE,SAAS;AAAA,EACvB,aAAa,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AM,iBAAiB,MAAM;AAC/B,mBAAO;AAAA,cACL,KAAK,MAAM;AAAA,cACX,OAAO;AAAA,cACP,MAAM,MAAM;AAAA,cACZ,SAAS;AAAA,YACX;AAAA,UACF;AACA,iBAAO;AAAA,YACL,KAAK,MAAM;AAAA,YACX,OAAO,MAAM,SAAS;AAAA,YACtB,SAAS;AAAA,UACX;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAGA,QAAI,aAAa,YAAY,CAAC,qBAAqB,CAAC,YAAY,SAAS,WAAW,YAAY,GAAG;AACjG,iBAAW,QAAQ,KAAK;AAAA,QACtB,KAAK;AAAA,QACL,OAAO,YAAY;AAAA,QACnB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,kBAAkB,SAAS,0BAA0B,MAAM,IAAI,CAAC;AAGtE,QAAM,UAAU;AAAA,IACd;AAAA,MACE,YAAY,QAAQ;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,MAAI,CAAC,SAAS;AACZ,YAAQ,KAAK,cAAc,QAAQ,GAAG,cAAc;AACpD,WAAO,qBAAqB,MAAM,CAAC,CAAC;AAAA,EACtC;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["example"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-objects.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/spec-objects.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAEzB,mDAAmD;;IAEnD,2GAA2G;;IAE3G;;OAEG;;;;;;;;;;;;;;;;;;EAG0B,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAEzB,+DAA+D;;IAE/D,sFAAsF;;IAEtF,0GAA0G;;;;;;;;;;;;;;;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gBAAmB,EACvC,UACK;;mBAA6C,CAAC;cAAoC,CAAC;;;mBAI1E,CAAC;cAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DT,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;IAEvC,6GAA6G;;IAE7G,yFAAyF;;;;;;;;;;;;;;EAG5D,CAAA;AAEjC,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAElF,eAAO,MAAM,mBAAmB;;;;;;WAItB,CAAA;AAEV;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;IAEvB;;OAEG;;IAEH,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QAjCpD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;IAkC3F,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAA;AAEF,eAAO,MAAM,SAAS;IAhBpB;;OAEG;;IAEH,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QAjCpD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;IAkC3F,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWvB,CAAA;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { omitUndefinedValues } from "
|
|
1
|
+
import { omitUndefinedValues } from "@scalar/helpers/object/omit-undefined-values";
|
|
2
2
|
import { XScalarSdkInstallationSchema } from "@scalar/openapi-types/schemas/extensions";
|
|
3
3
|
import { nanoidSchema } from "@scalar/types/utils";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/spec-objects.ts"],
|
|
4
|
-
"sourcesContent": ["import { omitUndefinedValues } from '
|
|
4
|
+
"sourcesContent": ["import { omitUndefinedValues } from '@scalar/helpers/object/omit-undefined-values'\nimport { XScalarSdkInstallationSchema } from '@scalar/openapi-types/schemas/extensions'\nimport { type ENTITY_BRANDS, nanoidSchema } from '@scalar/types/utils'\nimport { z } from 'zod'\n\n/**\n * License Object\n *\n * License information for the exposed API.\n *\n * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#license-object\n */\nexport const oasLicenseSchema = z\n .object({\n /** REQUIRED. The license name used for the API. */\n name: z.string().optional().nullable().catch(null),\n /** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */\n identifier: z.string().optional().catch(undefined),\n /**\n * A URI for the license used for the API. This MUST be in the form of a URI. The url field is mutually exclusive of the identifier field.\n */\n url: z.string().url().optional().catch(undefined),\n })\n .transform(omitUndefinedValues)\n\n/**\n * Contact Object\n *\n * Contact information for the exposed API.\n *\n * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#contact-object\n */\nexport const oasContactSchema = z\n .object({\n /** The identifying name of the contact person/organization. */\n name: z.string().optional(),\n /** The URL pointing to the contact information. This MUST be in the form of a URL. */\n url: z.string().url().optional().catch(undefined),\n /** The email address of the contact person/organization. This MUST be in the form of an email address. */\n email: z.string().optional().catch(undefined),\n })\n .transform(omitUndefinedValues)\n\n/**\n * Info Object\n *\n * The object provides metadata about the API. The metadata MAY be used by the clients if needed,\n * and MAY be presented in editing or documentation generation tools for convenience.\n *\n * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#info-object\n */\nexport const oasInfoSchema = z\n .object({\n /** REQUIRED. The title of the API. */\n title: z.string().catch('API'),\n /** A short summary of the API. */\n summary: z.string().optional().catch(undefined),\n /** A description of the API. CommonMark syntax MAY be used for rich text representation. */\n description: z.string().optional().catch(undefined),\n /** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */\n termsOfService: z.string().url().optional().catch(undefined),\n /** The contact information for the exposed API. */\n contact: oasContactSchema.optional().catch(undefined),\n /** The license information for the exposed API. */\n license: oasLicenseSchema.optional().catch(undefined),\n /**\n * REQUIRED. The version of the OpenAPI Document (which is distinct from the OpenAPI Specification version or the\n * version of the API being described or the version of the OpenAPI Description).\n */\n version: z.string().catch('1.0'),\n })\n .merge(XScalarSdkInstallationSchema)\n .transform(omitUndefinedValues)\n\n/**\n * External Documentation Object\n *\n * Allows referencing an external resource for extended documentation.\n *\n * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#external-documentation-object\n */\nexport const oasExternalDocumentationSchema = z\n .object({\n /** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */\n description: z.string().optional().catch(undefined),\n /** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */\n url: z.string(),\n })\n .transform(omitUndefinedValues)\n\nexport type ExternalDocumentation = z.infer<typeof oasExternalDocumentationSchema>\n\nexport const xScalarNestedSchema = z\n .object({\n tagName: z.string(),\n })\n .array()\n\n/**\n * Tag Object\n *\n * Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag\n * defined in the Operation Object instances.\n *\n * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#tag-object\n */\nexport const oasTagSchema = z.object({\n // TODO: Remove\n /**\n * @deprecated Needs to be remove as it is not a spec property\n */\n 'type': z.literal('tag').optional().default('tag'),\n /** REQUIRED. The name of the tag. */\n 'name': z.string(),\n /** A description for the tag. CommonMark syntax MAY be used for rich text representation. */\n 'description': z.string().optional().catch(undefined),\n /** Additional external documentation for this tag. */\n 'externalDocs': oasExternalDocumentationSchema.optional(),\n 'x-scalar-children': xScalarNestedSchema.default([]).optional(),\n /** Hide collections */\n 'x-internal': z.boolean().optional(),\n 'x-scalar-ignore': z.boolean().optional(),\n})\n\nexport const tagSchema = oasTagSchema.extend({\n uid: nanoidSchema.brand<ENTITY_BRANDS['TAG']>(),\n children: z\n .union([z.string().brand<ENTITY_BRANDS['OPERATION']>(), z.string().brand<ENTITY_BRANDS['TAG']>()])\n .array()\n .default([]),\n})\n\nexport type Tag = z.infer<typeof tagSchema>\nexport type TagPayload = z.input<typeof tagSchema>\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,2BAA2B;AACpC,SAAS,oCAAoC;AAC7C,SAA6B,oBAAoB;AACjD,SAAS,SAAS;AASX,MAAM,mBAAmB,EAC7B,OAAO;AAAA;AAAA,EAEN,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI;AAAA;AAAA,EAEjD,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAS;AAAA;AAAA;AAAA;AAAA,EAIjD,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAS;AAClD,CAAC,EACA,UAAU,mBAAmB;AASzB,MAAM,mBAAmB,EAC7B,OAAO;AAAA;AAAA,EAEN,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE1B,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAS;AAAA;AAAA,EAEhD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAS;AAC9C,CAAC,EACA,UAAU,mBAAmB;AAUzB,MAAM,gBAAgB,EAC1B,OAAO;AAAA;AAAA,EAEN,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK;AAAA;AAAA,EAE7B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAS;AAAA;AAAA,EAE9C,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAS;AAAA;AAAA,EAElD,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAS;AAAA;A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
|
1
|
-
export { createHash } from './create-hash.js';
|
|
2
|
-
export { ensureProtocol } from './ensure-protocol.js';
|
|
3
1
|
export { fetchDocument } from './fetch-document.js';
|
|
4
2
|
export { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback.js';
|
|
5
|
-
export { findVariables } from './find-variables.js';
|
|
6
|
-
export { canMethodHaveBody, getHttpMethodInfo, isHttpMethod, REQUEST_METHODS } from './http-methods.js';
|
|
7
|
-
export { type HttpStatusCode, type HttpStatusCodes, httpStatusCodes } from './http-status-codes.js';
|
|
8
|
-
export { isDefined } from './is-defined.js';
|
|
9
|
-
export { isLocalUrl } from './is-local-url.js';
|
|
10
|
-
export { isValidUrl } from './is-valid-url.js';
|
|
11
|
-
export { iterateTitle } from './iterate-title.js';
|
|
12
|
-
export { json2xml } from './json2xml.js';
|
|
13
|
-
export { LS_KEYS } from './local-storage.js';
|
|
14
|
-
export { makeUrlAbsolute } from './make-url-absolute.js';
|
|
15
|
-
export { combineUrlAndPath, mergeSearchParams, mergeUrls } from './merge-urls.js';
|
|
16
3
|
export { normalizeMimeType } from './normalize-mime-type.js';
|
|
17
4
|
export { normalizeMimeTypeObject } from './normalize-mime-type-object.js';
|
|
18
|
-
export { objectMerge, getObjectKeys } from './object.js';
|
|
19
5
|
export { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse.js';
|
|
20
6
|
export { prettyPrintJson, replaceCircularDependencies } from './pretty-print-json.js';
|
|
21
|
-
export {
|
|
22
|
-
export { REGEX } from './regex-helpers.js';
|
|
23
|
-
export { replaceVariables } from './replace-variables.js';
|
|
7
|
+
export { shouldUseProxy, redirectToProxy } from './redirect-to-proxy.js';
|
|
24
8
|
export { schemaModel } from './schema-model.js';
|
|
25
9
|
export { shouldIgnoreEntity } from './should-ignore-entity.js';
|
|
26
10
|
export { defaultStateFactory, ssrState } from './ssr-state.js';
|
|
27
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated These helpers are being phased out. Please import directly from @scalar/helpers instead.
|
|
13
|
+
* For example: import { createHash } from '/@scalar/helpers/string/create-hash'
|
|
14
|
+
*/
|
|
15
|
+
export {
|
|
16
|
+
/** @deprecated Please use createHash from \@scalar/helpers/string/create-hash instead */
|
|
17
|
+
createHash, } from '@scalar/helpers/string/create-hash';
|
|
18
|
+
export {
|
|
19
|
+
/** @deprecated Please use isDefined from \@scalar/helpers/array/is-defined instead */
|
|
20
|
+
isDefined, } from '@scalar/helpers/array/is-defined';
|
|
21
|
+
export {
|
|
22
|
+
/** @deprecated Please use isHttpMethod from \@scalar/helpers/http/is-http-method instead */
|
|
23
|
+
isHttpMethod, } from '@scalar/helpers/http/is-http-method';
|
|
24
|
+
export {
|
|
25
|
+
/** @deprecated Please use combineUrlAndPath from \@scalar/helpers/url/merge-urls instead */
|
|
26
|
+
combineUrlAndPath, } from '@scalar/helpers/url/merge-urls';
|
|
27
|
+
export {
|
|
28
|
+
/** @deprecated Please use json2xml from \@scalar/helpers/file/json2xml instead */
|
|
29
|
+
json2xml, } from '@scalar/helpers/file/json2xml';
|
|
30
|
+
export {
|
|
31
|
+
/** @deprecated Please use capitalize from \@scalar/helpers/string/capitalize instead */
|
|
32
|
+
capitalize, } from '@scalar/helpers/string/capitalize';
|
|
33
|
+
export {
|
|
34
|
+
/** @deprecated Please use camelToTitleWords from \@scalar/helpers/string/camel-to-title instead */
|
|
35
|
+
camelToTitleWords, } from '@scalar/helpers/string/camel-to-title';
|
|
36
|
+
export {
|
|
37
|
+
/** @deprecated Please use REGEX from \@scalar/helpers/regex/regex-helpers instead */
|
|
38
|
+
REGEX, } from '@scalar/helpers/regex/regex-helpers';
|
|
39
|
+
export {
|
|
40
|
+
/** @deprecated Please use isLocalUrl from \@scalar/helpers/url/is-local-url instead */
|
|
41
|
+
isLocalUrl, } from '@scalar/helpers/url/is-local-url';
|
|
42
|
+
export {
|
|
43
|
+
/** @deprecated Please use isRelativePath from \@scalar/helpers/url/is-relative-path instead */
|
|
44
|
+
isRelativePath, } from '@scalar/helpers/url/is-relative-path';
|
|
45
|
+
export {
|
|
46
|
+
/** @deprecated Please use ensureProtocol from \@scalar/helpers/url/ensure-protocol instead */
|
|
47
|
+
ensureProtocol, } from '@scalar/helpers/url/ensure-protocol';
|
|
48
|
+
export {
|
|
49
|
+
/** @deprecated Please use findVariables from \@scalar/helpers/regex/find-variables instead */
|
|
50
|
+
findVariables, } from '@scalar/helpers/regex/find-variables';
|
|
51
|
+
export {
|
|
52
|
+
/** @deprecated Please use canMethodHaveBody from \@scalar/helpers/http/can-method-have-body instead */
|
|
53
|
+
canMethodHaveBody, } from '@scalar/helpers/http/can-method-have-body';
|
|
54
|
+
export {
|
|
55
|
+
/** @deprecated Please use getHttpMethodInfo from \@scalar/helpers/http/http-info instead */
|
|
56
|
+
getHttpMethodInfo, } from '@scalar/helpers/http/http-info';
|
|
57
|
+
export {
|
|
58
|
+
/** @deprecated Please use REQUEST_METHODS from \@scalar/helpers/http/http-methods instead */
|
|
59
|
+
REQUEST_METHODS, } from '@scalar/helpers/http/http-info';
|
|
60
|
+
export {
|
|
61
|
+
/** @deprecated Please use HttpStatusCode from \@scalar/helpers/http/http-status-codes instead */
|
|
62
|
+
type HttpStatusCode,
|
|
63
|
+
/** @deprecated Please use HttpStatusCodes from \@scalar/helpers/http/http-status-codes instead */
|
|
64
|
+
type HttpStatusCodes,
|
|
65
|
+
/** @deprecated Please use httpStatusCodes from \@scalar/helpers/http/http-status-codes instead */
|
|
66
|
+
httpStatusCodes, } from '@scalar/helpers/http/http-status-codes';
|
|
67
|
+
export {
|
|
68
|
+
/** @deprecated Please use isValidUrl from \@scalar/helpers/url/is-valid-url instead */
|
|
69
|
+
isValidUrl, } from '@scalar/helpers/url/is-valid-url';
|
|
70
|
+
export {
|
|
71
|
+
/** @deprecated Please use iterateTitle from \@scalar/helpers/string/iterate-title instead */
|
|
72
|
+
iterateTitle, } from '@scalar/helpers/string/iterate-title';
|
|
73
|
+
export {
|
|
74
|
+
/** @deprecated Please use makeUrlAbsolute from \@scalar/helpers/url/make-url-absolute instead */
|
|
75
|
+
makeUrlAbsolute, } from '@scalar/helpers/url/make-url-absolute';
|
|
76
|
+
export {
|
|
77
|
+
/** @deprecated Please use mergeSearchParams from \@scalar/helpers/url/merge-urls instead */
|
|
78
|
+
mergeSearchParams,
|
|
79
|
+
/** @deprecated Please use mergeUrls from \@scalar/helpers/url/merge-urls instead */
|
|
80
|
+
mergeUrls, } from '@scalar/helpers/url/merge-urls';
|
|
81
|
+
export {
|
|
82
|
+
/** @deprecated Please use objectKeys from \@scalar/helpers/object/object-keys instead */
|
|
83
|
+
objectKeys as getObjectKeys, } from '@scalar/helpers/object/object-keys';
|
|
84
|
+
export {
|
|
85
|
+
/** @deprecated Please use replaceVariables from \@scalar/helpers/regex/replace-variables instead */
|
|
86
|
+
replaceVariables, } from '@scalar/helpers/regex/replace-variables';
|
|
28
87
|
//# sourceMappingURL=index.d.ts.map
|