@scalar/oas-utils 0.2.100 → 0.2.102
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 +23 -0
- package/dist/entities/shared/index.d.ts +1 -1
- package/dist/entities/shared/index.d.ts.map +1 -1
- package/dist/entities/shared/index.js +1 -1
- package/dist/entities/shared/utility.d.ts +3 -0
- package/dist/entities/shared/utility.d.ts.map +1 -1
- package/dist/entities/shared/utility.js +6 -1
- package/dist/entities/spec/collection.d.ts +6 -6
- package/dist/entities/spec/collection.d.ts.map +1 -1
- package/dist/entities/spec/collection.js +2 -2
- package/dist/entities/spec/request-examples.d.ts.map +1 -1
- package/dist/entities/spec/request-examples.js +5 -3
- package/dist/entities/spec/requests.d.ts +5 -3
- package/dist/entities/spec/requests.d.ts.map +1 -1
- package/dist/entities/spec/requests.js +2 -2
- package/dist/entities/spec/server.d.ts +29 -90
- package/dist/entities/spec/server.d.ts.map +1 -1
- package/dist/entities/spec/server.js +10 -5
- package/dist/migrations/data-version.d.ts +2 -1
- package/dist/migrations/data-version.d.ts.map +1 -1
- package/dist/migrations/data-version.js +2 -1
- package/dist/migrations/migrator.d.ts +2 -2
- package/dist/migrations/migrator.d.ts.map +1 -1
- package/dist/migrations/migrator.js +4 -0
- package/dist/migrations/v-2.4.0/types.generated.d.ts +363 -24
- package/dist/migrations/v-2.4.0/types.generated.d.ts.map +1 -1
- package/dist/migrations/v-2.5.0/index.d.ts +3 -0
- package/dist/migrations/v-2.5.0/index.d.ts.map +1 -0
- package/dist/migrations/v-2.5.0/index.js +1 -0
- package/dist/migrations/v-2.5.0/migration.d.ts +5 -0
- package/dist/migrations/v-2.5.0/migration.d.ts.map +1 -0
- package/dist/migrations/v-2.5.0/migration.js +46 -0
- package/dist/migrations/v-2.5.0/types.generated.d.ts +38 -0
- package/dist/migrations/v-2.5.0/types.generated.d.ts.map +1 -0
- package/dist/transforms/import-spec.d.ts +5 -0
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +31 -27
- package/dist/transforms/index.js +1 -1
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.102
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a34f834: feat: adds accept header by default
|
|
8
|
+
- ef98b9c: fix: setting initial security with no requirements
|
|
9
|
+
- a34f834: feat: adds v-2.5.0 accept header migration
|
|
10
|
+
- ebdf762: feat: add back complex security requirements
|
|
11
|
+
- Updated dependencies [f9bf5f1]
|
|
12
|
+
- @scalar/openapi-types@0.1.7
|
|
13
|
+
- @scalar/types@0.0.30
|
|
14
|
+
- @scalar/themes@0.9.64
|
|
15
|
+
|
|
16
|
+
## 0.2.101
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- be34e7d: feat: adds value to server variables schema
|
|
21
|
+
- Updated dependencies [be34e7d]
|
|
22
|
+
- Updated dependencies [51f3177]
|
|
23
|
+
- @scalar/types@0.0.29
|
|
24
|
+
- @scalar/themes@0.9.63
|
|
25
|
+
|
|
3
26
|
## 0.2.100
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type Nanoid, type SelectedSecuritySchemeUids, nanoidSchema, selectedSecuritySchemeUidSchema, } from './utility.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/shared/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,0BAA0B,EAC/B,YAAY,EACZ,+BAA+B,GAChC,MAAM,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { nanoidSchema } from './utility.js';
|
|
1
|
+
export { nanoidSchema, selectedSecuritySchemeUidSchema } from './utility.js';
|
|
@@ -3,4 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
export declare const nanoidSchema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
4
4
|
/** UID format for objects */
|
|
5
5
|
export type Nanoid = z.infer<typeof nanoidSchema>;
|
|
6
|
+
/** Schema for selectedSecuritySchemeUids */
|
|
7
|
+
export declare const selectedSecuritySchemeUidSchema: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">]>, "many">>;
|
|
8
|
+
export type SelectedSecuritySchemeUids = z.infer<typeof selectedSecuritySchemeUidSchema>;
|
|
6
9
|
//# sourceMappingURL=utility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../src/entities/shared/utility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gCAAgC;AAChC,eAAO,MAAM,YAAY,0CAIC,CAAA;AAE1B,6BAA6B;AAC7B,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../src/entities/shared/utility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gCAAgC;AAChC,eAAO,MAAM,YAAY,0CAIC,CAAA;AAE1B,6BAA6B;AAC7B,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAEjD,4CAA4C;AAC5C,eAAO,MAAM,+BAA+B,wJAG9B,CAAA;AAEd,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,+BAA+B,CACvC,CAAA"}
|
|
@@ -7,5 +7,10 @@ const nanoidSchema = z
|
|
|
7
7
|
.min(7)
|
|
8
8
|
.optional()
|
|
9
9
|
.default(() => nanoid());
|
|
10
|
+
/** Schema for selectedSecuritySchemeUids */
|
|
11
|
+
const selectedSecuritySchemeUidSchema = z
|
|
12
|
+
.union([nanoidSchema, nanoidSchema.array()])
|
|
13
|
+
.array()
|
|
14
|
+
.default([]);
|
|
10
15
|
|
|
11
|
-
export { nanoidSchema };
|
|
16
|
+
export { nanoidSchema, selectedSecuritySchemeUidSchema };
|
|
@@ -226,7 +226,7 @@ export declare const extendedCollectionSchema: z.ZodObject<{
|
|
|
226
226
|
/** A list of security schemes UIDs associated with the collection */
|
|
227
227
|
securitySchemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
228
228
|
/** List of currently selected security scheme UIDs, these can be overridden per request */
|
|
229
|
-
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
|
|
229
|
+
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">]>, "many">>;
|
|
230
230
|
/** The currently selected server */
|
|
231
231
|
selectedServerUid: z.ZodDefault<z.ZodString>;
|
|
232
232
|
/** UIDs which refer to servers on the workspace base */
|
|
@@ -262,7 +262,7 @@ export declare const extendedCollectionSchema: z.ZodObject<{
|
|
|
262
262
|
uid: string;
|
|
263
263
|
children: string[];
|
|
264
264
|
securitySchemes: string[];
|
|
265
|
-
selectedSecuritySchemeUids: string[];
|
|
265
|
+
selectedSecuritySchemeUids: (string | string[])[];
|
|
266
266
|
selectedServerUid: string;
|
|
267
267
|
servers: string[];
|
|
268
268
|
requests: string[];
|
|
@@ -275,7 +275,7 @@ export declare const extendedCollectionSchema: z.ZodObject<{
|
|
|
275
275
|
uid?: string | undefined;
|
|
276
276
|
children?: (string | undefined)[] | undefined;
|
|
277
277
|
securitySchemes?: string[] | undefined;
|
|
278
|
-
selectedSecuritySchemeUids?: (string | undefined)[] | undefined;
|
|
278
|
+
selectedSecuritySchemeUids?: (string | (string | undefined)[] | undefined)[] | undefined;
|
|
279
279
|
selectedServerUid?: string | undefined;
|
|
280
280
|
servers?: (string | undefined)[] | undefined;
|
|
281
281
|
requests?: (string | undefined)[] | undefined;
|
|
@@ -427,7 +427,7 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
427
427
|
/** A list of security schemes UIDs associated with the collection */
|
|
428
428
|
securitySchemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
429
429
|
/** List of currently selected security scheme UIDs, these can be overridden per request */
|
|
430
|
-
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
|
|
430
|
+
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">]>, "many">>;
|
|
431
431
|
/** The currently selected server */
|
|
432
432
|
selectedServerUid: z.ZodDefault<z.ZodString>;
|
|
433
433
|
/** UIDs which refer to servers on the workspace base */
|
|
@@ -467,7 +467,7 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
467
467
|
security: Record<string, string[]>[];
|
|
468
468
|
'x-scalar-icon': string;
|
|
469
469
|
securitySchemes: string[];
|
|
470
|
-
selectedSecuritySchemeUids: string[];
|
|
470
|
+
selectedSecuritySchemeUids: (string | string[])[];
|
|
471
471
|
selectedServerUid: string;
|
|
472
472
|
servers: string[];
|
|
473
473
|
requests: string[];
|
|
@@ -558,7 +558,7 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
558
558
|
example?: string | undefined;
|
|
559
559
|
}> | undefined;
|
|
560
560
|
securitySchemes?: string[] | undefined;
|
|
561
|
-
selectedSecuritySchemeUids?: (string | undefined)[] | undefined;
|
|
561
|
+
selectedSecuritySchemeUids?: (string | (string | undefined)[] | undefined)[] | undefined;
|
|
562
562
|
selectedServerUid?: string | undefined;
|
|
563
563
|
servers?: (string | undefined)[] | undefined;
|
|
564
564
|
requests?: (string | undefined)[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,mBAAmB;IAC9B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaH;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;IAEvB,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWhD,CAAA;AAEF,eAAO,MAAM,wBAAwB;;IAEnC,qEAAqE;;IAErE,2FAA2F;;IAE3F,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,kFAAkF;;IAElF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKH,CAAA;AAEF,eAAO,MAAM,gBAAgB;IArF3B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaH;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;IAEvB,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAehD,qEAAqE;;IAErE,2FAA2F;;IAE3F,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,kFAAkF;;IAElF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASJ,CAAA;AACD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { nanoidSchema, selectedSecuritySchemeUidSchema } from '../shared/utility.js';
|
|
1
2
|
import { xScalarEnvironmentsSchema } from './x-scalar-environments.js';
|
|
2
3
|
import { xScalarSecretsSchema } from './x-scalar-secrets.js';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { oasSecurityRequirementSchema } from './security.js';
|
|
5
6
|
import { oasInfoSchema, oasExternalDocumentationSchema } from './spec-objects.js';
|
|
6
|
-
import { nanoidSchema } from '../shared/utility.js';
|
|
7
7
|
|
|
8
8
|
const oasCollectionSchema = z.object({
|
|
9
9
|
/**
|
|
@@ -53,7 +53,7 @@ const extendedCollectionSchema = z.object({
|
|
|
53
53
|
/** A list of security schemes UIDs associated with the collection */
|
|
54
54
|
securitySchemes: z.string().array().default([]),
|
|
55
55
|
/** List of currently selected security scheme UIDs, these can be overridden per request */
|
|
56
|
-
selectedSecuritySchemeUids:
|
|
56
|
+
selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema,
|
|
57
57
|
/** The currently selected server */
|
|
58
58
|
selectedServerUid: z.string().default(''),
|
|
59
59
|
/** UIDs which refer to servers on the workspace base */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAKtC;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezC,CAAA;AAUF,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACtC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;GAKtB,CAAA;AAEb;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAS/B,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAKvE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,uEAQ7B,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtE,eAAO,MAAM,eAAe,gPAalB,CAAA;AA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C,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAOjE,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB;IAC/B,qCAAqC;;;;QA7CrC;;;;WAIG;;QAEH,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgD1E,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;EA8D9D;AAKD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;;;;;;;;;;;;;;;EAuD1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,cAAc,CAuGhB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { keysOf } from '@scalar/object-utils/arrays';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
3
4
|
import { schemaModel } from '../../helpers/schema-model.js';
|
|
4
5
|
import { getRequestBodyFromOperation } from '../../spec-getters/getRequestBodyFromOperation.js';
|
|
5
6
|
import { getServerVariableExamples } from '../../spec-getters/getServerVariableExamples.js';
|
|
6
|
-
import { nanoidSchema } from '../shared/utility.js';
|
|
7
7
|
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// Example Parameters
|
|
@@ -145,7 +145,9 @@ const requestExampleSchema = z.object({
|
|
|
145
145
|
.object({
|
|
146
146
|
path: requestExampleParametersSchema.array().default([]),
|
|
147
147
|
query: requestExampleParametersSchema.array().default([]),
|
|
148
|
-
headers: requestExampleParametersSchema
|
|
148
|
+
headers: requestExampleParametersSchema
|
|
149
|
+
.array()
|
|
150
|
+
.default([{ key: 'Accept', value: '*/*', enabled: true }]),
|
|
149
151
|
cookies: requestExampleParametersSchema.array().default([]),
|
|
150
152
|
})
|
|
151
153
|
.optional()
|
|
@@ -286,7 +288,7 @@ function createExampleFromRequest(request, name, server) {
|
|
|
286
288
|
cookie: [],
|
|
287
289
|
// deprecated TODO: add zod transform to remove
|
|
288
290
|
header: [],
|
|
289
|
-
headers: [],
|
|
291
|
+
headers: [{ key: 'Accept', value: '*/*', enabled: true }],
|
|
290
292
|
};
|
|
291
293
|
// Populated the separated params
|
|
292
294
|
request.parameters?.forEach((p) => parameters[p.in].push(createParamInstance(p)));
|
|
@@ -506,12 +506,12 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
506
506
|
/** List of example UIDs associated with the request */
|
|
507
507
|
examples: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
|
|
508
508
|
/** List of security scheme UIDs associated with the request */
|
|
509
|
-
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
|
|
509
|
+
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">]>, "many">>;
|
|
510
510
|
}>, "strip", z.ZodTypeAny, {
|
|
511
511
|
path: string;
|
|
512
512
|
type: "request";
|
|
513
513
|
uid: string;
|
|
514
|
-
selectedSecuritySchemeUids: string[];
|
|
514
|
+
selectedSecuritySchemeUids: (string | string[])[];
|
|
515
515
|
selectedServerUid: string;
|
|
516
516
|
servers: string[];
|
|
517
517
|
examples: string[];
|
|
@@ -558,7 +558,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
558
558
|
'x-internal'?: boolean | undefined;
|
|
559
559
|
'x-scalar-ignore'?: boolean | undefined;
|
|
560
560
|
security?: Record<string, string[] | undefined>[] | undefined;
|
|
561
|
-
selectedSecuritySchemeUids?: (string | undefined)[] | undefined;
|
|
561
|
+
selectedSecuritySchemeUids?: (string | (string | undefined)[] | undefined)[] | undefined;
|
|
562
562
|
selectedServerUid?: string | undefined;
|
|
563
563
|
servers?: (string | undefined)[] | undefined;
|
|
564
564
|
tags?: string[] | undefined;
|
|
@@ -586,4 +586,6 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
586
586
|
}>;
|
|
587
587
|
export type Request = z.infer<typeof requestSchema>;
|
|
588
588
|
export type RequestPayload = z.input<typeof requestSchema>;
|
|
589
|
+
export type Operation = Request;
|
|
590
|
+
export type OperationPayload = RequestPayload;
|
|
589
591
|
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/requests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/requests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,oBAAoB,CAAA;AAI9E,eAAO,MAAM,cAAc,2FAUjB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,IAAI,EAAE,MAAM,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;;;;;;;;;;;;;;;IAEvB,sBAAsB;;;;;;IAetB,eAAe;;IAEf,qBAAqB;;IAErB,kDAAkD;;IAElD,oCAAoC;;IAEpC,uDAAuD;;IAEvD,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOlC,CAAA;AAE/B,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAG1D,MAAM,MAAM,SAAS,GAAG,OAAO,CAAA;AAC/B,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { nanoidSchema, selectedSecuritySchemeUidSchema } from '../shared/utility.js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { oasParameterSchema } from './parameters.js';
|
|
3
4
|
import { xScalarExampleSchema } from './request-examples.js';
|
|
4
5
|
import { oasSecurityRequirementSchema } from './security.js';
|
|
5
6
|
import { oasExternalDocumentationSchema } from './spec-objects.js';
|
|
6
|
-
import { nanoidSchema } from '../shared/utility.js';
|
|
7
7
|
|
|
8
8
|
const requestMethods = [
|
|
9
9
|
'connect',
|
|
@@ -89,7 +89,7 @@ const extendedRequestSchema = z.object({
|
|
|
89
89
|
/** List of example UIDs associated with the request */
|
|
90
90
|
examples: nanoidSchema.array().default([]),
|
|
91
91
|
/** List of security scheme UIDs associated with the request */
|
|
92
|
-
selectedSecuritySchemeUids:
|
|
92
|
+
selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema,
|
|
93
93
|
});
|
|
94
94
|
/** Unified request schema for client usage */
|
|
95
95
|
const requestSchema = oasRequestSchema
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import { type ZodSchema, z } from 'zod';
|
|
2
3
|
/**
|
|
3
4
|
* Server Variable Object
|
|
4
5
|
*
|
|
@@ -6,15 +7,15 @@ import { z } from 'zod';
|
|
|
6
7
|
*
|
|
7
8
|
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-variable-object
|
|
8
9
|
*/
|
|
9
|
-
export declare const oasServerVariableSchema: z.
|
|
10
|
+
export declare const oasServerVariableSchema: z.ZodObject<{
|
|
10
11
|
/**
|
|
11
12
|
* An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
|
|
12
13
|
*/
|
|
13
14
|
enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
15
|
/**
|
|
15
16
|
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
16
|
-
* Note this behavior is different than the Schema Object
|
|
17
|
-
* parameter values are optional. If the enum is defined, the value MUST exist in the enum
|
|
17
|
+
* Note this behavior is different than the Schema Object's treatment of default values, because in those cases
|
|
18
|
+
* parameter values are optional. If the enum is defined, the value MUST exist in the enum's values.
|
|
18
19
|
*/
|
|
19
20
|
default: z.ZodOptional<z.ZodString>;
|
|
20
21
|
/**
|
|
@@ -29,14 +30,6 @@ export declare const oasServerVariableSchema: z.ZodEffects<z.ZodObject<{
|
|
|
29
30
|
default?: string | undefined;
|
|
30
31
|
description?: string | undefined;
|
|
31
32
|
enum?: string[] | undefined;
|
|
32
|
-
}>, {
|
|
33
|
-
default?: string | undefined;
|
|
34
|
-
description?: string | undefined;
|
|
35
|
-
enum?: string[] | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
default?: string | undefined;
|
|
38
|
-
description?: string | undefined;
|
|
39
|
-
enum?: string[] | undefined;
|
|
40
33
|
}>;
|
|
41
34
|
/**
|
|
42
35
|
* Server Object
|
|
@@ -58,53 +51,26 @@ export declare const oasServerSchema: z.ZodObject<{
|
|
|
58
51
|
*/
|
|
59
52
|
description: z.ZodOptional<z.ZodString>;
|
|
60
53
|
/** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
|
|
61
|
-
variables: z.ZodOptional<z.ZodRecord<z.ZodString,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
enum
|
|
66
|
-
|
|
67
|
-
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
68
|
-
* Note this behavior is different than the Schema Object’s treatment of default values, because in those cases
|
|
69
|
-
* parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values.
|
|
70
|
-
*/
|
|
71
|
-
default: z.ZodOptional<z.ZodString>;
|
|
72
|
-
/**
|
|
73
|
-
* An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
|
|
74
|
-
*/
|
|
75
|
-
description: z.ZodOptional<z.ZodString>;
|
|
76
|
-
}, "strip", z.ZodTypeAny, {
|
|
77
|
-
default?: string | undefined;
|
|
78
|
-
description?: string | undefined;
|
|
79
|
-
enum?: string[] | undefined;
|
|
80
|
-
}, {
|
|
81
|
-
default?: string | undefined;
|
|
82
|
-
description?: string | undefined;
|
|
83
|
-
enum?: string[] | undefined;
|
|
84
|
-
}>, {
|
|
85
|
-
default?: string | undefined;
|
|
86
|
-
description?: string | undefined;
|
|
87
|
-
enum?: string[] | undefined;
|
|
88
|
-
}, {
|
|
89
|
-
default?: string | undefined;
|
|
90
|
-
description?: string | undefined;
|
|
91
|
-
enum?: string[] | undefined;
|
|
54
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
55
|
+
enum?: [string, ...string[]];
|
|
56
|
+
value?: string;
|
|
57
|
+
}, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
58
|
+
enum?: [string, ...string[]];
|
|
59
|
+
value?: string;
|
|
92
60
|
}>>>;
|
|
93
61
|
}, "strip", z.ZodTypeAny, {
|
|
94
62
|
url: string;
|
|
95
63
|
description?: string | undefined;
|
|
96
|
-
variables?: Record<string, {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
enum?: string[] | undefined;
|
|
64
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
65
|
+
enum?: [string, ...string[]];
|
|
66
|
+
value?: string;
|
|
100
67
|
}> | undefined;
|
|
101
68
|
}, {
|
|
102
69
|
url: string;
|
|
103
70
|
description?: string | undefined;
|
|
104
|
-
variables?: Record<string, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
enum?: string[] | undefined;
|
|
71
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
72
|
+
enum?: [string, ...string[]];
|
|
73
|
+
value?: string;
|
|
108
74
|
}> | undefined;
|
|
109
75
|
}>;
|
|
110
76
|
export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
@@ -120,37 +86,12 @@ export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
120
86
|
*/
|
|
121
87
|
description: z.ZodOptional<z.ZodString>;
|
|
122
88
|
/** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
|
|
123
|
-
variables: z.ZodOptional<z.ZodRecord<z.ZodString,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
enum
|
|
128
|
-
|
|
129
|
-
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
130
|
-
* Note this behavior is different than the Schema Object’s treatment of default values, because in those cases
|
|
131
|
-
* parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values.
|
|
132
|
-
*/
|
|
133
|
-
default: z.ZodOptional<z.ZodString>;
|
|
134
|
-
/**
|
|
135
|
-
* An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
|
|
136
|
-
*/
|
|
137
|
-
description: z.ZodOptional<z.ZodString>;
|
|
138
|
-
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
default?: string | undefined;
|
|
140
|
-
description?: string | undefined;
|
|
141
|
-
enum?: string[] | undefined;
|
|
142
|
-
}, {
|
|
143
|
-
default?: string | undefined;
|
|
144
|
-
description?: string | undefined;
|
|
145
|
-
enum?: string[] | undefined;
|
|
146
|
-
}>, {
|
|
147
|
-
default?: string | undefined;
|
|
148
|
-
description?: string | undefined;
|
|
149
|
-
enum?: string[] | undefined;
|
|
150
|
-
}, {
|
|
151
|
-
default?: string | undefined;
|
|
152
|
-
description?: string | undefined;
|
|
153
|
-
enum?: string[] | undefined;
|
|
89
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
90
|
+
enum?: [string, ...string[]];
|
|
91
|
+
value?: string;
|
|
92
|
+
}, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
93
|
+
enum?: [string, ...string[]];
|
|
94
|
+
value?: string;
|
|
154
95
|
}>>>;
|
|
155
96
|
}, {
|
|
156
97
|
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -158,19 +99,17 @@ export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
158
99
|
uid: string;
|
|
159
100
|
url: string;
|
|
160
101
|
description?: string | undefined;
|
|
161
|
-
variables?: Record<string, {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
enum?: string[] | undefined;
|
|
102
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
103
|
+
enum?: [string, ...string[]];
|
|
104
|
+
value?: string;
|
|
165
105
|
}> | undefined;
|
|
166
106
|
}, {
|
|
167
107
|
url: string;
|
|
168
108
|
uid?: string | undefined;
|
|
169
109
|
description?: string | undefined;
|
|
170
|
-
variables?: Record<string, {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
enum?: string[] | undefined;
|
|
110
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
111
|
+
enum?: [string, ...string[]];
|
|
112
|
+
value?: string;
|
|
174
113
|
}> | undefined;
|
|
175
114
|
}>;
|
|
176
115
|
export type Server = z.infer<typeof serverSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;IAClC;;OAEG;;IAEH;;;;OAIG;;IAEH;;OAEG;;;;;;;;;;EAEH,CAAA;AA+BF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAxB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;;;;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;;;;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;EAyB8B,CAAA;AAEhD,eAAO,MAAM,YAAY;IAfvB;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAxB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;;;;;;;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;;;;;;eADP,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;EA6BhB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -8,22 +8,27 @@ import { nanoidSchema } from '../shared/utility.js';
|
|
|
8
8
|
*
|
|
9
9
|
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-variable-object
|
|
10
10
|
*/
|
|
11
|
-
const oasServerVariableSchema = z
|
|
12
|
-
.object({
|
|
11
|
+
const oasServerVariableSchema = z.object({
|
|
13
12
|
/**
|
|
14
13
|
* An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
|
|
15
14
|
*/
|
|
16
15
|
enum: z.array(z.string()).optional(),
|
|
17
16
|
/**
|
|
18
17
|
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
19
|
-
* Note this behavior is different than the Schema Object
|
|
20
|
-
* parameter values are optional. If the enum is defined, the value MUST exist in the enum
|
|
18
|
+
* Note this behavior is different than the Schema Object's treatment of default values, because in those cases
|
|
19
|
+
* parameter values are optional. If the enum is defined, the value MUST exist in the enum's values.
|
|
21
20
|
*/
|
|
22
21
|
default: z.string().optional(),
|
|
23
22
|
/**
|
|
24
23
|
* An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
|
|
25
24
|
*/
|
|
26
25
|
description: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
/** Extended schema for server variables */
|
|
28
|
+
const extendedServerVariableSchema = oasServerVariableSchema
|
|
29
|
+
.extend({
|
|
30
|
+
/** The value of the variable */
|
|
31
|
+
value: z.string().optional(),
|
|
27
32
|
})
|
|
28
33
|
.refine((data) => {
|
|
29
34
|
// Set default to the first enum value if invalid
|
|
@@ -58,7 +63,7 @@ const oasServerSchema = z.object({
|
|
|
58
63
|
*/
|
|
59
64
|
description: z.string().optional(),
|
|
60
65
|
/** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
|
|
61
|
-
variables: z.record(z.string(),
|
|
66
|
+
variables: z.record(z.string(), extendedServerVariableSchema).optional(),
|
|
62
67
|
});
|
|
63
68
|
const serverSchema = oasServerSchema.extend({
|
|
64
69
|
uid: nanoidSchema,
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* - 2.2.0 - auth compliancy
|
|
9
9
|
* - 2.3.0 - environments
|
|
10
10
|
* - 2.4.0 - draft collection servers
|
|
11
|
+
* - 2.5.0 - accept header
|
|
11
12
|
*/
|
|
12
|
-
export declare const DATA_VERSION = "2.
|
|
13
|
+
export declare const DATA_VERSION = "2.5.0";
|
|
13
14
|
/** The localStorage key under which the data version is stored */
|
|
14
15
|
export declare const DATA_VERSION_LS_LEY = "scalar_api_client_data_version";
|
|
15
16
|
//# sourceMappingURL=data-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-version.d.ts","sourceRoot":"","sources":["../../src/migrations/data-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"data-version.d.ts","sourceRoot":"","sources":["../../src/migrations/data-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,UAAU,CAAA;AAEnC,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,mCAAmC,CAAA"}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* - 2.2.0 - auth compliancy
|
|
9
9
|
* - 2.3.0 - environments
|
|
10
10
|
* - 2.4.0 - draft collection servers
|
|
11
|
+
* - 2.5.0 - accept header
|
|
11
12
|
*/
|
|
12
|
-
const DATA_VERSION = '2.
|
|
13
|
+
const DATA_VERSION = '2.5.0';
|
|
13
14
|
/** The localStorage key under which the data version is stored */
|
|
14
15
|
const DATA_VERSION_LS_LEY = 'scalar_api_client_data_version';
|
|
15
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type v_2_5_0 } from '../migrations/v-2.5.0/index.js';
|
|
2
2
|
/** Handles all data migrations per entity */
|
|
3
|
-
export declare const migrator: () =>
|
|
3
|
+
export declare const migrator: () => v_2_5_0.DataArray;
|
|
4
4
|
//# sourceMappingURL=migrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/migrations/migrator.ts"],"names":[],"mappings":"AASA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,QAAO,OAAO,CAAC,SA0CnC,CAAA"}
|
|
@@ -4,6 +4,7 @@ import { migrate_v_2_1_0 } from './v-2.1.0/migration.js';
|
|
|
4
4
|
import { migrate_v_2_2_0 } from './v-2.2.0/migration.js';
|
|
5
5
|
import { migrate_v_2_3_0 } from './v-2.3.0/migration.js';
|
|
6
6
|
import { migrate_v_2_4_0 } from './v-2.4.0/migration.js';
|
|
7
|
+
import { migrate_v_2_5_0 } from './v-2.5.0/migration.js';
|
|
7
8
|
|
|
8
9
|
/** Handles all data migrations per entity */
|
|
9
10
|
const migrator = () => {
|
|
@@ -33,6 +34,9 @@ const migrator = () => {
|
|
|
33
34
|
// 2.3.0 -> 2.4.0 migration
|
|
34
35
|
if (semverLessThan(dataVersion, '2.4.0'))
|
|
35
36
|
data = migrate_v_2_4_0(data);
|
|
37
|
+
// 2.4.0 -> 2.5.0 migration
|
|
38
|
+
if (semverLessThan(dataVersion, '2.5.0'))
|
|
39
|
+
data = migrate_v_2_5_0(data);
|
|
36
40
|
// Convert to data array
|
|
37
41
|
data = {
|
|
38
42
|
collections: Object.values(data.collections),
|