@scalar/oas-utils 0.2.6 → 0.2.7
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 +6 -0
- package/dist/entities/workspace/spec/request-examples.d.ts +46 -0
- package/dist/entities/workspace/spec/request-examples.d.ts.map +1 -1
- package/dist/entities/workspace/spec/request-examples.js +1 -0
- package/dist/entities/workspace/workspace.d.ts +5 -0
- package/dist/entities/workspace/workspace.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.js +2 -0
- package/dist/helpers/fetchSpecFromUrl.d.ts.map +1 -1
- package/dist/helpers/fetchSpecFromUrl.js +1 -4
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/redirectToProxy.d.ts +7 -0
- package/dist/helpers/redirectToProxy.d.ts.map +1 -0
- package/dist/helpers/redirectToProxy.js +37 -0
- package/dist/transforms/import-spec.d.ts +1 -0
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +7 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,17 +7,20 @@ declare const requestExampleParametersSchema: z.ZodObject<{
|
|
|
7
7
|
description: z.ZodOptional<z.ZodString>;
|
|
8
8
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
9
9
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
10
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
value: string;
|
|
12
13
|
key: string;
|
|
13
14
|
enabled: boolean;
|
|
14
15
|
description?: string | undefined;
|
|
16
|
+
required?: boolean | undefined;
|
|
15
17
|
file?: File | undefined;
|
|
16
18
|
refUid?: string | undefined;
|
|
17
19
|
}, {
|
|
18
20
|
value?: string | number | undefined;
|
|
19
21
|
description?: string | undefined;
|
|
20
22
|
key?: string | undefined;
|
|
23
|
+
required?: boolean | undefined;
|
|
21
24
|
enabled?: boolean | undefined;
|
|
22
25
|
file?: File | undefined;
|
|
23
26
|
refUid?: string | undefined;
|
|
@@ -31,6 +34,7 @@ export declare const createRequestExampleParameter: (payload: RequestExamplePara
|
|
|
31
34
|
key: string;
|
|
32
35
|
enabled: boolean;
|
|
33
36
|
description?: string | undefined;
|
|
37
|
+
required?: boolean | undefined;
|
|
34
38
|
file?: File | undefined;
|
|
35
39
|
refUid?: string | undefined;
|
|
36
40
|
};
|
|
@@ -59,17 +63,20 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
59
63
|
description: z.ZodOptional<z.ZodString>;
|
|
60
64
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
61
65
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
66
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
62
67
|
}, "strip", z.ZodTypeAny, {
|
|
63
68
|
value: string;
|
|
64
69
|
key: string;
|
|
65
70
|
enabled: boolean;
|
|
66
71
|
description?: string | undefined;
|
|
72
|
+
required?: boolean | undefined;
|
|
67
73
|
file?: File | undefined;
|
|
68
74
|
refUid?: string | undefined;
|
|
69
75
|
}, {
|
|
70
76
|
value?: string | number | undefined;
|
|
71
77
|
description?: string | undefined;
|
|
72
78
|
key?: string | undefined;
|
|
79
|
+
required?: boolean | undefined;
|
|
73
80
|
enabled?: boolean | undefined;
|
|
74
81
|
file?: File | undefined;
|
|
75
82
|
refUid?: string | undefined;
|
|
@@ -80,6 +87,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
80
87
|
key: string;
|
|
81
88
|
enabled: boolean;
|
|
82
89
|
description?: string | undefined;
|
|
90
|
+
required?: boolean | undefined;
|
|
83
91
|
file?: File | undefined;
|
|
84
92
|
refUid?: string | undefined;
|
|
85
93
|
}[];
|
|
@@ -89,6 +97,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
89
97
|
value?: string | number | undefined;
|
|
90
98
|
description?: string | undefined;
|
|
91
99
|
key?: string | undefined;
|
|
100
|
+
required?: boolean | undefined;
|
|
92
101
|
enabled?: boolean | undefined;
|
|
93
102
|
file?: File | undefined;
|
|
94
103
|
refUid?: string | undefined;
|
|
@@ -108,6 +117,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
108
117
|
key: string;
|
|
109
118
|
enabled: boolean;
|
|
110
119
|
description?: string | undefined;
|
|
120
|
+
required?: boolean | undefined;
|
|
111
121
|
file?: File | undefined;
|
|
112
122
|
refUid?: string | undefined;
|
|
113
123
|
}[];
|
|
@@ -125,6 +135,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
125
135
|
value?: string | number | undefined;
|
|
126
136
|
description?: string | undefined;
|
|
127
137
|
key?: string | undefined;
|
|
138
|
+
required?: boolean | undefined;
|
|
128
139
|
enabled?: boolean | undefined;
|
|
129
140
|
file?: File | undefined;
|
|
130
141
|
refUid?: string | undefined;
|
|
@@ -143,17 +154,20 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
143
154
|
description: z.ZodOptional<z.ZodString>;
|
|
144
155
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
145
156
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
157
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
146
158
|
}, "strip", z.ZodTypeAny, {
|
|
147
159
|
value: string;
|
|
148
160
|
key: string;
|
|
149
161
|
enabled: boolean;
|
|
150
162
|
description?: string | undefined;
|
|
163
|
+
required?: boolean | undefined;
|
|
151
164
|
file?: File | undefined;
|
|
152
165
|
refUid?: string | undefined;
|
|
153
166
|
}, {
|
|
154
167
|
value?: string | number | undefined;
|
|
155
168
|
description?: string | undefined;
|
|
156
169
|
key?: string | undefined;
|
|
170
|
+
required?: boolean | undefined;
|
|
157
171
|
enabled?: boolean | undefined;
|
|
158
172
|
file?: File | undefined;
|
|
159
173
|
refUid?: string | undefined;
|
|
@@ -166,17 +180,20 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
166
180
|
description: z.ZodOptional<z.ZodString>;
|
|
167
181
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
168
182
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
183
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
169
184
|
}, "strip", z.ZodTypeAny, {
|
|
170
185
|
value: string;
|
|
171
186
|
key: string;
|
|
172
187
|
enabled: boolean;
|
|
173
188
|
description?: string | undefined;
|
|
189
|
+
required?: boolean | undefined;
|
|
174
190
|
file?: File | undefined;
|
|
175
191
|
refUid?: string | undefined;
|
|
176
192
|
}, {
|
|
177
193
|
value?: string | number | undefined;
|
|
178
194
|
description?: string | undefined;
|
|
179
195
|
key?: string | undefined;
|
|
196
|
+
required?: boolean | undefined;
|
|
180
197
|
enabled?: boolean | undefined;
|
|
181
198
|
file?: File | undefined;
|
|
182
199
|
refUid?: string | undefined;
|
|
@@ -189,17 +206,20 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
189
206
|
description: z.ZodOptional<z.ZodString>;
|
|
190
207
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
191
208
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
209
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
192
210
|
}, "strip", z.ZodTypeAny, {
|
|
193
211
|
value: string;
|
|
194
212
|
key: string;
|
|
195
213
|
enabled: boolean;
|
|
196
214
|
description?: string | undefined;
|
|
215
|
+
required?: boolean | undefined;
|
|
197
216
|
file?: File | undefined;
|
|
198
217
|
refUid?: string | undefined;
|
|
199
218
|
}, {
|
|
200
219
|
value?: string | number | undefined;
|
|
201
220
|
description?: string | undefined;
|
|
202
221
|
key?: string | undefined;
|
|
222
|
+
required?: boolean | undefined;
|
|
203
223
|
enabled?: boolean | undefined;
|
|
204
224
|
file?: File | undefined;
|
|
205
225
|
refUid?: string | undefined;
|
|
@@ -212,17 +232,20 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
212
232
|
description: z.ZodOptional<z.ZodString>;
|
|
213
233
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
214
234
|
refUid: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
|
|
235
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
215
236
|
}, "strip", z.ZodTypeAny, {
|
|
216
237
|
value: string;
|
|
217
238
|
key: string;
|
|
218
239
|
enabled: boolean;
|
|
219
240
|
description?: string | undefined;
|
|
241
|
+
required?: boolean | undefined;
|
|
220
242
|
file?: File | undefined;
|
|
221
243
|
refUid?: string | undefined;
|
|
222
244
|
}, {
|
|
223
245
|
value?: string | number | undefined;
|
|
224
246
|
description?: string | undefined;
|
|
225
247
|
key?: string | undefined;
|
|
248
|
+
required?: boolean | undefined;
|
|
226
249
|
enabled?: boolean | undefined;
|
|
227
250
|
file?: File | undefined;
|
|
228
251
|
refUid?: string | undefined;
|
|
@@ -233,6 +256,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
233
256
|
key: string;
|
|
234
257
|
enabled: boolean;
|
|
235
258
|
description?: string | undefined;
|
|
259
|
+
required?: boolean | undefined;
|
|
236
260
|
file?: File | undefined;
|
|
237
261
|
refUid?: string | undefined;
|
|
238
262
|
}[];
|
|
@@ -241,6 +265,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
241
265
|
key: string;
|
|
242
266
|
enabled: boolean;
|
|
243
267
|
description?: string | undefined;
|
|
268
|
+
required?: boolean | undefined;
|
|
244
269
|
file?: File | undefined;
|
|
245
270
|
refUid?: string | undefined;
|
|
246
271
|
}[];
|
|
@@ -249,6 +274,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
249
274
|
key: string;
|
|
250
275
|
enabled: boolean;
|
|
251
276
|
description?: string | undefined;
|
|
277
|
+
required?: boolean | undefined;
|
|
252
278
|
file?: File | undefined;
|
|
253
279
|
refUid?: string | undefined;
|
|
254
280
|
}[];
|
|
@@ -257,6 +283,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
257
283
|
key: string;
|
|
258
284
|
enabled: boolean;
|
|
259
285
|
description?: string | undefined;
|
|
286
|
+
required?: boolean | undefined;
|
|
260
287
|
file?: File | undefined;
|
|
261
288
|
refUid?: string | undefined;
|
|
262
289
|
}[];
|
|
@@ -265,6 +292,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
265
292
|
value?: string | number | undefined;
|
|
266
293
|
description?: string | undefined;
|
|
267
294
|
key?: string | undefined;
|
|
295
|
+
required?: boolean | undefined;
|
|
268
296
|
enabled?: boolean | undefined;
|
|
269
297
|
file?: File | undefined;
|
|
270
298
|
refUid?: string | undefined;
|
|
@@ -273,6 +301,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
273
301
|
value?: string | number | undefined;
|
|
274
302
|
description?: string | undefined;
|
|
275
303
|
key?: string | undefined;
|
|
304
|
+
required?: boolean | undefined;
|
|
276
305
|
enabled?: boolean | undefined;
|
|
277
306
|
file?: File | undefined;
|
|
278
307
|
refUid?: string | undefined;
|
|
@@ -281,6 +310,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
281
310
|
value?: string | number | undefined;
|
|
282
311
|
description?: string | undefined;
|
|
283
312
|
key?: string | undefined;
|
|
313
|
+
required?: boolean | undefined;
|
|
284
314
|
enabled?: boolean | undefined;
|
|
285
315
|
file?: File | undefined;
|
|
286
316
|
refUid?: string | undefined;
|
|
@@ -289,6 +319,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
289
319
|
value?: string | number | undefined;
|
|
290
320
|
description?: string | undefined;
|
|
291
321
|
key?: string | undefined;
|
|
322
|
+
required?: boolean | undefined;
|
|
292
323
|
enabled?: boolean | undefined;
|
|
293
324
|
file?: File | undefined;
|
|
294
325
|
refUid?: string | undefined;
|
|
@@ -304,6 +335,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
304
335
|
key: string;
|
|
305
336
|
enabled: boolean;
|
|
306
337
|
description?: string | undefined;
|
|
338
|
+
required?: boolean | undefined;
|
|
307
339
|
file?: File | undefined;
|
|
308
340
|
refUid?: string | undefined;
|
|
309
341
|
}[];
|
|
@@ -312,6 +344,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
312
344
|
key: string;
|
|
313
345
|
enabled: boolean;
|
|
314
346
|
description?: string | undefined;
|
|
347
|
+
required?: boolean | undefined;
|
|
315
348
|
file?: File | undefined;
|
|
316
349
|
refUid?: string | undefined;
|
|
317
350
|
}[];
|
|
@@ -320,6 +353,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
320
353
|
key: string;
|
|
321
354
|
enabled: boolean;
|
|
322
355
|
description?: string | undefined;
|
|
356
|
+
required?: boolean | undefined;
|
|
323
357
|
file?: File | undefined;
|
|
324
358
|
refUid?: string | undefined;
|
|
325
359
|
}[];
|
|
@@ -328,6 +362,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
328
362
|
key: string;
|
|
329
363
|
enabled: boolean;
|
|
330
364
|
description?: string | undefined;
|
|
365
|
+
required?: boolean | undefined;
|
|
331
366
|
file?: File | undefined;
|
|
332
367
|
refUid?: string | undefined;
|
|
333
368
|
}[];
|
|
@@ -344,6 +379,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
344
379
|
key: string;
|
|
345
380
|
enabled: boolean;
|
|
346
381
|
description?: string | undefined;
|
|
382
|
+
required?: boolean | undefined;
|
|
347
383
|
file?: File | undefined;
|
|
348
384
|
refUid?: string | undefined;
|
|
349
385
|
}[];
|
|
@@ -362,6 +398,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
362
398
|
value?: string | number | undefined;
|
|
363
399
|
description?: string | undefined;
|
|
364
400
|
key?: string | undefined;
|
|
401
|
+
required?: boolean | undefined;
|
|
365
402
|
enabled?: boolean | undefined;
|
|
366
403
|
file?: File | undefined;
|
|
367
404
|
refUid?: string | undefined;
|
|
@@ -370,6 +407,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
370
407
|
value?: string | number | undefined;
|
|
371
408
|
description?: string | undefined;
|
|
372
409
|
key?: string | undefined;
|
|
410
|
+
required?: boolean | undefined;
|
|
373
411
|
enabled?: boolean | undefined;
|
|
374
412
|
file?: File | undefined;
|
|
375
413
|
refUid?: string | undefined;
|
|
@@ -378,6 +416,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
378
416
|
value?: string | number | undefined;
|
|
379
417
|
description?: string | undefined;
|
|
380
418
|
key?: string | undefined;
|
|
419
|
+
required?: boolean | undefined;
|
|
381
420
|
enabled?: boolean | undefined;
|
|
382
421
|
file?: File | undefined;
|
|
383
422
|
refUid?: string | undefined;
|
|
@@ -386,6 +425,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
386
425
|
value?: string | number | undefined;
|
|
387
426
|
description?: string | undefined;
|
|
388
427
|
key?: string | undefined;
|
|
428
|
+
required?: boolean | undefined;
|
|
389
429
|
enabled?: boolean | undefined;
|
|
390
430
|
file?: File | undefined;
|
|
391
431
|
refUid?: string | undefined;
|
|
@@ -401,6 +441,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
401
441
|
value?: string | number | undefined;
|
|
402
442
|
description?: string | undefined;
|
|
403
443
|
key?: string | undefined;
|
|
444
|
+
required?: boolean | undefined;
|
|
404
445
|
enabled?: boolean | undefined;
|
|
405
446
|
file?: File | undefined;
|
|
406
447
|
refUid?: string | undefined;
|
|
@@ -425,6 +466,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
425
466
|
key: string;
|
|
426
467
|
enabled: boolean;
|
|
427
468
|
description?: string | undefined;
|
|
469
|
+
required?: boolean | undefined;
|
|
428
470
|
file?: File | undefined;
|
|
429
471
|
refUid?: string | undefined;
|
|
430
472
|
}[];
|
|
@@ -433,6 +475,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
433
475
|
key: string;
|
|
434
476
|
enabled: boolean;
|
|
435
477
|
description?: string | undefined;
|
|
478
|
+
required?: boolean | undefined;
|
|
436
479
|
file?: File | undefined;
|
|
437
480
|
refUid?: string | undefined;
|
|
438
481
|
}[];
|
|
@@ -441,6 +484,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
441
484
|
key: string;
|
|
442
485
|
enabled: boolean;
|
|
443
486
|
description?: string | undefined;
|
|
487
|
+
required?: boolean | undefined;
|
|
444
488
|
file?: File | undefined;
|
|
445
489
|
refUid?: string | undefined;
|
|
446
490
|
}[];
|
|
@@ -449,6 +493,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
449
493
|
key: string;
|
|
450
494
|
enabled: boolean;
|
|
451
495
|
description?: string | undefined;
|
|
496
|
+
required?: boolean | undefined;
|
|
452
497
|
file?: File | undefined;
|
|
453
498
|
refUid?: string | undefined;
|
|
454
499
|
}[];
|
|
@@ -465,6 +510,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
465
510
|
key: string;
|
|
466
511
|
enabled: boolean;
|
|
467
512
|
description?: string | undefined;
|
|
513
|
+
required?: boolean | undefined;
|
|
468
514
|
file?: File | undefined;
|
|
469
515
|
refUid?: string | undefined;
|
|
470
516
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/request-examples.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,8BAA8B;;;;;;IAMlC,kFAAkF
|
|
1
|
+
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/request-examples.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,8BAA8B;;;;;;IAMlC,kFAAkF;;;;;;;;;;;;;;;;;;;EAGlF,CAAA;AAEF,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACtC,CAAA;AACD,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAA;AAED,8CAA8C;AAC9C,eAAO,MAAM,6BAA6B,YAC/B,8BAA8B;;;;;;;;CACwB,CAAA;AAEjE,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;gBAlBxB,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAAlF,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;YAAlF,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;YAAlF,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;YAAlF,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkElF,CAAA;AAEF,mDAAmD;AACnD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAExE,oCAAoC;AACpC,eAAO,MAAM,oBAAoB,YAAa,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhE,CAAA"}
|
|
@@ -10,6 +10,7 @@ const requestExampleParametersSchema = z.object({
|
|
|
10
10
|
description: z.string().optional(),
|
|
11
11
|
/** Params are linked to parents such as path params and global headers/cookies */
|
|
12
12
|
refUid: nanoidSchema.optional(),
|
|
13
|
+
required: z.boolean().optional(),
|
|
13
14
|
});
|
|
14
15
|
/** Create request example parameter helper */
|
|
15
16
|
const createRequestExampleParameter = (payload) => deepMerge(requestExampleParametersSchema.parse({}), payload);
|
|
@@ -14,6 +14,8 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
14
14
|
cookieUids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
15
15
|
/** Workspace level proxy for all requests to be sent through */
|
|
16
16
|
proxyUrl: z.ZodOptional<z.ZodString>;
|
|
17
|
+
/** Workspace level theme, we might move this to user level later */
|
|
18
|
+
themeId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
17
19
|
}, "strip", z.ZodTypeAny, {
|
|
18
20
|
uid: string;
|
|
19
21
|
description: string;
|
|
@@ -22,6 +24,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
22
24
|
collectionUids: string[];
|
|
23
25
|
environmentUids: string[];
|
|
24
26
|
cookieUids: string[];
|
|
27
|
+
themeId: string;
|
|
25
28
|
proxyUrl?: string | undefined;
|
|
26
29
|
}, {
|
|
27
30
|
uid?: string | undefined;
|
|
@@ -32,6 +35,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
32
35
|
environmentUids?: string[] | undefined;
|
|
33
36
|
cookieUids?: string[] | undefined;
|
|
34
37
|
proxyUrl?: string | undefined;
|
|
38
|
+
themeId?: string | undefined;
|
|
35
39
|
}>;
|
|
36
40
|
/** The base scalar workspace */
|
|
37
41
|
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
@@ -44,6 +48,7 @@ export declare const createWorkspace: (payload: WorkspacePayload) => {
|
|
|
44
48
|
collectionUids: string[];
|
|
45
49
|
environmentUids: string[];
|
|
46
50
|
cookieUids: string[];
|
|
51
|
+
themeId: string;
|
|
47
52
|
proxyUrl?: string | undefined;
|
|
48
53
|
};
|
|
49
54
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,QAAA,MAAM,eAAe;;;IAGnB,4BAA4B;;IAE5B,6EAA6E;;IAE7E,uDAAuD;;IAEvD,wDAAwD;;IAExD,mDAAmD;;IAEnD,gEAAgE
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,QAAA,MAAM,eAAe;;;IAGnB,4BAA4B;;IAE5B,6EAA6E;;IAE7E,uDAAuD;;IAEvD,wDAAwD;;IAExD,mDAAmD;;IAEnD,gEAAgE;;IAEhE,oEAAoE;;;;;;;;;;;;;;;;;;;;;;EAEpE,CAAA;AAEF,gCAAgC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE9D,eAAO,MAAM,eAAe,YAAa,gBAAgB;;;;;;;;;;CACzB,CAAA"}
|
|
@@ -16,6 +16,8 @@ const workspaceSchema = z.object({
|
|
|
16
16
|
cookieUids: z.array(z.string()).default([]),
|
|
17
17
|
/** Workspace level proxy for all requests to be sent through */
|
|
18
18
|
proxyUrl: z.string().optional(),
|
|
19
|
+
/** Workspace level theme, we might move this to user level later */
|
|
20
|
+
themeId: z.string().optional().default('default'),
|
|
19
21
|
});
|
|
20
22
|
const createWorkspace = (payload) => workspaceSchema.parse(payload);
|
|
21
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchSpecFromUrl.d.ts","sourceRoot":"","sources":["../../src/helpers/fetchSpecFromUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchSpecFromUrl.d.ts","sourceRoot":"","sources":["../../src/helpers/fetchSpecFromUrl.ts"],"names":[],"mappings":"AASA,iEAAiE;AACjE,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { redirectToProxy } from './redirectToProxy.js';
|
|
1
2
|
import { formatJsonOrYamlString } from './parse.js';
|
|
2
3
|
|
|
3
4
|
// Doesn’t work
|
|
4
5
|
const OLD_PROXY_URL = 'https://api.scalar.com/request-proxy';
|
|
5
6
|
// Does work
|
|
6
7
|
const NEW_PROXY_URL = 'https://proxy.scalar.com';
|
|
7
|
-
/** Redirects the request to a proxy server with a given URL. */
|
|
8
|
-
function redirectToProxy(proxy, url) {
|
|
9
|
-
return `${proxy}?scalar_url=${encodeURIComponent(url)}`;
|
|
10
|
-
}
|
|
11
8
|
/** Fetches an OpenAPI/Swagger specification from a given URL. */
|
|
12
9
|
async function fetchSpecFromUrl(url, proxy) {
|
|
13
10
|
// This replaces the OLD_PROXY_URL with the NEW_PROXY_URL on the fly.
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './normalizeMimeTypeObject.js';
|
|
|
11
11
|
export * from './object.js';
|
|
12
12
|
export * from './parse.js';
|
|
13
13
|
export * from './prettyPrintJson.js';
|
|
14
|
+
export * from './redirectToProxy.js';
|
|
14
15
|
export * from './replaceVariables.js';
|
|
15
16
|
export * from './schema-model.js';
|
|
16
17
|
export * from './ssrState.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { normalizeMimeTypeObject } from './normalizeMimeTypeObject.js';
|
|
|
11
11
|
export { getObjectKeys, objectMerge } from './object.js';
|
|
12
12
|
export { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse.js';
|
|
13
13
|
export { prettyPrintJson, replaceCircularDependencies } from './prettyPrintJson.js';
|
|
14
|
+
export { isRequestToLocalhost, redirectToProxy, shouldUseProxy } from './redirectToProxy.js';
|
|
14
15
|
export { replaceVariables } from './replaceVariables.js';
|
|
15
16
|
export { schemaModel } from './schema-model.js';
|
|
16
17
|
export { defaultStateFactory, ssrState } from './ssrState.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Redirects the request to a proxy server with a given URL. */
|
|
2
|
+
export declare function redirectToProxy(proxy?: string, url?: string): string;
|
|
3
|
+
/** Returns false for requests to localhost, relative URLs, if no proxy is defined … */
|
|
4
|
+
export declare function shouldUseProxy(proxy?: string, url?: string): boolean;
|
|
5
|
+
/** Detect requests to localhost */
|
|
6
|
+
export declare function isRequestToLocalhost(url: string): boolean;
|
|
7
|
+
//# sourceMappingURL=redirectToProxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirectToProxy.d.ts","sourceRoot":"","sources":["../../src/helpers/redirectToProxy.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAepE;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAiBpE;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,WAI/C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Redirects the request to a proxy server with a given URL. */
|
|
2
|
+
function redirectToProxy(proxy, url) {
|
|
3
|
+
if (!shouldUseProxy(proxy, url)) {
|
|
4
|
+
return url ?? '';
|
|
5
|
+
}
|
|
6
|
+
// Create new URL object from url
|
|
7
|
+
const newUrl = new URL(url);
|
|
8
|
+
// Rewrite the URL with the proxy
|
|
9
|
+
newUrl.href = proxy;
|
|
10
|
+
// Add the original URL as a query parameter
|
|
11
|
+
newUrl.searchParams.append('scalar_url', url);
|
|
12
|
+
return newUrl.toString();
|
|
13
|
+
}
|
|
14
|
+
/** Returns false for requests to localhost, relative URLs, if no proxy is defined … */
|
|
15
|
+
function shouldUseProxy(proxy, url) {
|
|
16
|
+
// No proxy or url
|
|
17
|
+
if (!proxy || !url) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// Relative URLs
|
|
21
|
+
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
// Requests to localhost
|
|
25
|
+
if (isRequestToLocalhost(url)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/** Detect requests to localhost */
|
|
31
|
+
function isRequestToLocalhost(url) {
|
|
32
|
+
const { hostname } = new URL(url);
|
|
33
|
+
const listOfLocalUrls = ['localhost', '127.0.0.1', '[::1]'];
|
|
34
|
+
return listOfLocalUrls.includes(hostname);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { isRequestToLocalhost, redirectToProxy, shouldUseProxy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,2BAA2B,CAAA;AAKvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAWxC,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,SAAgB,MAAM,GAAG,SAAS
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,2BAA2B,CAAA;AAKvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAWxC,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,SAAgB,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiLnE,CAAA"}
|
|
@@ -115,8 +115,9 @@ const importSpecToWorkspace = async (spec) => {
|
|
|
115
115
|
];
|
|
116
116
|
const servers = unparsedServers.map((server) => createServer(server));
|
|
117
117
|
// Select initial security
|
|
118
|
-
const firstSecurityKey = Object.keys(
|
|
119
|
-
const firstScheme =
|
|
118
|
+
const firstSecurityKey = Object.keys((schema?.components?.securitySchemes || schema?.securityDefinitions) ?? {})?.[0];
|
|
119
|
+
const firstScheme = (schema?.components?.securitySchemes ||
|
|
120
|
+
schema?.securityDefinitions)?.[firstSecurityKey ?? ''];
|
|
120
121
|
// In the case of oauth2 we need to select the flow as well
|
|
121
122
|
const flowKey = firstScheme?.type === 'oauth2'
|
|
122
123
|
? Object.keys(firstScheme.flows ?? {})[0]
|
|
@@ -126,9 +127,9 @@ const importSpecToWorkspace = async (spec) => {
|
|
|
126
127
|
: [];
|
|
127
128
|
const collection = createCollection({
|
|
128
129
|
spec: {
|
|
129
|
-
openapi:
|
|
130
|
+
openapi: schema?.openapi,
|
|
130
131
|
info: schema?.info,
|
|
131
|
-
security:
|
|
132
|
+
security: schema?.security || schema?.securityDefinitions,
|
|
132
133
|
externalDocs: schema?.externalDocs,
|
|
133
134
|
serverUids: servers.map(({ uid }) => uid),
|
|
134
135
|
tags,
|
|
@@ -139,6 +140,7 @@ const importSpecToWorkspace = async (spec) => {
|
|
|
139
140
|
childUids: folders.map(({ uid }) => uid),
|
|
140
141
|
});
|
|
141
142
|
const components = schema?.components;
|
|
143
|
+
const securityDefinitions = schema?.securityDefinitions;
|
|
142
144
|
return {
|
|
143
145
|
tags,
|
|
144
146
|
folders,
|
|
@@ -146,6 +148,7 @@ const importSpecToWorkspace = async (spec) => {
|
|
|
146
148
|
requests,
|
|
147
149
|
collection,
|
|
148
150
|
components,
|
|
151
|
+
securityDefinitions,
|
|
149
152
|
};
|
|
150
153
|
};
|
|
151
154
|
|