@scalar/oas-utils 0.2.47 → 0.2.48
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 +10 -0
- package/dist/entities/spec/collection.d.ts +4 -0
- package/dist/entities/spec/collection.d.ts.map +1 -1
- package/dist/entities/spec/collection.js +10 -8
- package/dist/migrations/v-2.1.0/migration.d.ts +1 -0
- package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -1
- package/dist/migrations/v-2.1.0/migration.js +12 -11
- package/dist/transforms/export-spec.d.ts +1 -0
- package/dist/transforms/export-spec.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.48
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dc20180: feat(api-client): custom icons for collections
|
|
8
|
+
- Updated dependencies [f961940]
|
|
9
|
+
- Updated dependencies [f961940]
|
|
10
|
+
- @scalar/types@0.0.11
|
|
11
|
+
- @scalar/themes@0.9.32
|
|
12
|
+
|
|
3
13
|
## 0.2.47
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -260,6 +260,8 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
260
260
|
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
261
261
|
/** TODO: Type these */
|
|
262
262
|
webhooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
263
|
+
/** A custom icon representing the collection */
|
|
264
|
+
'x-scalar-icon': z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
263
265
|
}, {
|
|
264
266
|
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
265
267
|
/** A list of security schemes UIDs associated with the collection */
|
|
@@ -365,6 +367,7 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
365
367
|
children: string[];
|
|
366
368
|
openapi: string;
|
|
367
369
|
security: Record<string, string[]>[];
|
|
370
|
+
'x-scalar-icon': string;
|
|
368
371
|
securitySchemes: string[];
|
|
369
372
|
selectedServerUid: string;
|
|
370
373
|
servers: string[];
|
|
@@ -451,6 +454,7 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
451
454
|
security?: Record<string, string[] | undefined>[] | undefined;
|
|
452
455
|
components?: Record<string, unknown> | undefined;
|
|
453
456
|
webhooks?: Record<string, unknown> | undefined;
|
|
457
|
+
'x-scalar-icon'?: string | undefined;
|
|
454
458
|
securitySchemes?: string[] | undefined;
|
|
455
459
|
selectedServerUid?: string | undefined;
|
|
456
460
|
servers?: (string | undefined)[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAyCvB,eAAO,MAAM,wBAAwB;;IAEnC,qEAAqE;;IAErE,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA9C3B;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;IAEvB,gDAAgD;;;;IAYhD,qEAAqE;;IAErE,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMJ,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"}
|
|
@@ -4,8 +4,8 @@ import { oasInfoSchema, oasExternalDocumentationSchema } from './spec-objects.js
|
|
|
4
4
|
import { nanoidSchema } from '../shared/utility.js';
|
|
5
5
|
|
|
6
6
|
const oasCollectionSchema = z.object({
|
|
7
|
-
type: z.literal('collection').optional().default('collection'),
|
|
8
|
-
openapi: z
|
|
7
|
+
'type': z.literal('collection').optional().default('collection'),
|
|
8
|
+
'openapi': z
|
|
9
9
|
.union([
|
|
10
10
|
z.string(),
|
|
11
11
|
z.literal('3.0.0'),
|
|
@@ -14,8 +14,8 @@ const oasCollectionSchema = z.object({
|
|
|
14
14
|
])
|
|
15
15
|
.optional()
|
|
16
16
|
.default('3.1.0'),
|
|
17
|
-
jsonSchemaDialect: z.string().optional(),
|
|
18
|
-
info: oasInfoSchema.optional(),
|
|
17
|
+
'jsonSchemaDialect': z.string().optional(),
|
|
18
|
+
'info': oasInfoSchema.optional(),
|
|
19
19
|
/**
|
|
20
20
|
* A declaration of which security mechanisms can be used across the API. The list of
|
|
21
21
|
* values includes alternative security requirement objects that can be used. Only
|
|
@@ -23,12 +23,14 @@ const oasCollectionSchema = z.object({
|
|
|
23
23
|
* Individual operations can override this definition. To make security optional, an empty
|
|
24
24
|
* security requirement ({}) can be included in the array.
|
|
25
25
|
*/
|
|
26
|
-
security: z.array(oasSecurityRequirementSchema).optional().default([]),
|
|
27
|
-
externalDocs: oasExternalDocumentationSchema.optional(),
|
|
26
|
+
'security': z.array(oasSecurityRequirementSchema).optional().default([]),
|
|
27
|
+
'externalDocs': oasExternalDocumentationSchema.optional(),
|
|
28
28
|
/** TODO: Type these */
|
|
29
|
-
components: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
+
'components': z.record(z.string(), z.unknown()).optional(),
|
|
30
30
|
/** TODO: Type these */
|
|
31
|
-
webhooks: z.record(z.string(), z.unknown()).optional(),
|
|
31
|
+
'webhooks': z.record(z.string(), z.unknown()).optional(),
|
|
32
|
+
/** A custom icon representing the collection */
|
|
33
|
+
'x-scalar-icon': z.string().optional().default('interface-content-folder'),
|
|
32
34
|
// These properties will be stripped out and mapped back as id lists
|
|
33
35
|
// servers
|
|
34
36
|
// paths/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.1.0/migration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAInE,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;;;;;;;;;;oBAG/C,CAAC;mBAIjB,CADJ;qBAA4C,CAAC;;;;0BAKlC,CAAC;mBACR,CAAA
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/migrations/v-2.1.0/migration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAuI2jB,CAAC;;6BAA4E,CAAC;;;;;;;;;;CADrpB,CAAA"}
|
|
@@ -103,19 +103,20 @@ const migrate_v_2_1_0 = (data) => {
|
|
|
103
103
|
return prev;
|
|
104
104
|
}, {});
|
|
105
105
|
return {
|
|
106
|
-
type: 'collection',
|
|
107
|
-
openapi: c.spec?.openapi || '3.1.0',
|
|
108
|
-
info: c.spec?.info || { title: 'OpenAPI Spec', version: '0.0.1' },
|
|
109
|
-
security: c.spec?.security || [],
|
|
110
|
-
externalDocs: c.spec?.externalDocs,
|
|
111
|
-
uid: c.uid,
|
|
106
|
+
'type': 'collection',
|
|
107
|
+
'openapi': c.spec?.openapi || '3.1.0',
|
|
108
|
+
'info': c.spec?.info || { title: 'OpenAPI Spec', version: '0.0.1' },
|
|
109
|
+
'security': c.spec?.security || [],
|
|
110
|
+
'externalDocs': c.spec?.externalDocs,
|
|
111
|
+
'uid': c.uid,
|
|
112
112
|
securitySchemes,
|
|
113
|
-
selectedServerUid: c.selectedServerUid || c.spec?.serverUids?.[0] || '',
|
|
114
|
-
servers: c.spec?.serverUids || [],
|
|
115
|
-
requests: [...requestUids],
|
|
116
|
-
tags: [...tagUids],
|
|
113
|
+
'selectedServerUid': c.selectedServerUid || c.spec?.serverUids?.[0] || '',
|
|
114
|
+
'servers': c.spec?.serverUids || [],
|
|
115
|
+
'requests': [...requestUids],
|
|
116
|
+
'tags': [...tagUids],
|
|
117
117
|
auth,
|
|
118
|
-
children: c.childUids || [],
|
|
118
|
+
'children': c.childUids || [],
|
|
119
|
+
'x-scalar-icon': 'interface-content-folder',
|
|
119
120
|
};
|
|
120
121
|
});
|
|
121
122
|
// Cookies
|
|
@@ -8,6 +8,7 @@ export declare function exportSpecFromWorkspace({ collection, requests, }: {
|
|
|
8
8
|
children: string[];
|
|
9
9
|
openapi: string;
|
|
10
10
|
security: Record<string, string[]>[];
|
|
11
|
+
'x-scalar-icon': string;
|
|
11
12
|
securitySchemes: string[];
|
|
12
13
|
selectedServerUid: string;
|
|
13
14
|
servers: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/export-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,iBAAiB,CAAA;AAMxB,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC
|
|
1
|
+
{"version":3,"file":"export-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/export-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,iBAAiB,CAAA;AAMxB,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.48",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -93,9 +93,9 @@
|
|
|
93
93
|
"yaml": "^2.4.5",
|
|
94
94
|
"zod": "^3.23.8",
|
|
95
95
|
"@scalar/object-utils": "1.1.9",
|
|
96
|
-
"@scalar/themes": "0.9.31",
|
|
97
96
|
"@scalar/openapi-types": "0.1.1",
|
|
98
|
-
"@scalar/
|
|
97
|
+
"@scalar/themes": "0.9.32",
|
|
98
|
+
"@scalar/types": "0.0.11"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"rollup": "^4.16.4",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"vitest": "^1.6.0",
|
|
105
105
|
"zod-to-ts": "^1.2.0",
|
|
106
106
|
"@scalar/build-tooling": "0.1.10",
|
|
107
|
-
"@scalar/openapi-
|
|
108
|
-
"@scalar/openapi-
|
|
107
|
+
"@scalar/openapi-parser": "0.8.4",
|
|
108
|
+
"@scalar/openapi-types": "0.1.1"
|
|
109
109
|
},
|
|
110
110
|
"scripts": {
|
|
111
111
|
"build": "scalar-build-rollup",
|