@scalar/oas-utils 0.2.76 → 0.2.78

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/entities/spec/collection.d.ts +0 -278
  3. package/dist/entities/spec/collection.d.ts.map +1 -1
  4. package/dist/entities/spec/collection.js +1 -8
  5. package/dist/entities/spec/index.js +1 -1
  6. package/dist/entities/spec/requests.d.ts +2 -2
  7. package/dist/entities/spec/security.d.ts +1123 -783
  8. package/dist/entities/spec/security.d.ts.map +1 -1
  9. package/dist/entities/spec/security.js +73 -133
  10. package/dist/entities/workspace/workspace.d.ts +3 -7
  11. package/dist/entities/workspace/workspace.d.ts.map +1 -1
  12. package/dist/entities/workspace/workspace.js +0 -2
  13. package/dist/helpers/redirectToProxy.d.ts +1 -1
  14. package/dist/helpers/redirectToProxy.d.ts.map +1 -1
  15. package/dist/helpers/redirectToProxy.js +13 -2
  16. package/dist/helpers/regexHelpers.d.ts +1 -0
  17. package/dist/helpers/regexHelpers.d.ts.map +1 -1
  18. package/dist/helpers/regexHelpers.js +1 -0
  19. package/dist/migrations/data-version.d.ts +3 -2
  20. package/dist/migrations/data-version.d.ts.map +1 -1
  21. package/dist/migrations/data-version.js +3 -2
  22. package/dist/migrations/local-storage.d.ts.map +1 -1
  23. package/dist/migrations/local-storage.js +3 -5
  24. package/dist/migrations/migrator.d.ts +2 -2
  25. package/dist/migrations/migrator.d.ts.map +1 -1
  26. package/dist/migrations/migrator.js +16 -13
  27. package/dist/migrations/v-0.0.0/types.generated.d.ts +139 -90
  28. package/dist/migrations/v-0.0.0/types.generated.d.ts.map +1 -1
  29. package/dist/migrations/v-2.1.0/migration.d.ts +11 -340
  30. package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -1
  31. package/dist/migrations/v-2.1.0/migration.js +67 -46
  32. package/dist/migrations/v-2.1.0/types.generated.d.ts +353 -28
  33. package/dist/migrations/v-2.1.0/types.generated.d.ts.map +1 -1
  34. package/dist/migrations/v-2.2.0/index.d.ts +3 -0
  35. package/dist/migrations/v-2.2.0/index.d.ts.map +1 -0
  36. package/dist/migrations/v-2.2.0/index.js +1 -0
  37. package/dist/migrations/v-2.2.0/migration.d.ts +5 -0
  38. package/dist/migrations/v-2.2.0/migration.d.ts.map +1 -0
  39. package/dist/migrations/v-2.2.0/migration.js +110 -0
  40. package/dist/migrations/v-2.2.0/types.generated.d.ts +41 -0
  41. package/dist/migrations/v-2.2.0/types.generated.d.ts.map +1 -0
  42. package/dist/transforms/import-spec.d.ts +1 -3
  43. package/dist/transforms/import-spec.d.ts.map +1 -1
  44. package/dist/transforms/import-spec.js +54 -96
  45. package/dist/transforms/index.js +1 -1
  46. package/package.json +12 -7
@@ -1,344 +1,15 @@
1
1
  import type { v_0_0_0 } from '../../migrations/v-0.0.0/types.generated';
2
+ import type { v_2_1_0 } from './types.generated';
2
3
  /** V-0.0.0 to V-2.1.0 migration */
3
- export declare const migrate_v_2_1_0: (data: Omit<v_0_0_0.Data, "folders">) => {
4
- collections: {
5
- type: "collection";
6
- openapi: string;
7
- info: {
8
- title: string;
9
- summary?: string | undefined;
10
- description?: string | undefined;
11
- termsOfService?: string | undefined;
12
- contact?: {
13
- name?: string | undefined;
14
- url?: string | undefined;
15
- email?: string | undefined;
16
- } | undefined;
17
- license?: {
18
- name: string;
19
- identifier?: string | undefined;
20
- url?: string | undefined;
21
- } | undefined;
22
- version: string;
23
- };
24
- security: {
25
- [x: string]: string[];
26
- }[];
27
- externalDocs: {
28
- description: string;
29
- url: string;
30
- } | undefined;
31
- uid: string;
32
- securitySchemes: string[];
33
- selectedSecuritySchemeUids: never[];
34
- selectedServerUid: string;
35
- servers: string[];
36
- requests: string[];
37
- tags: string[];
38
- auth: Record<string, {
39
- type: "apiKey";
40
- value: string;
41
- name: string;
42
- } | {
43
- type: "http";
44
- username: string;
45
- password: string;
46
- token: string;
47
- } | {
48
- type: "oauth-implicit";
49
- token: string;
50
- } | {
51
- type: "oauth-password";
52
- username: string;
53
- password: string;
54
- token: string;
55
- clientSecret: string;
56
- } | {
57
- type: "oauth-clientCredentials";
58
- token: string;
59
- clientSecret: string;
60
- } | {
61
- type: "oauth-authorizationCode";
62
- token: string;
63
- clientSecret: string;
64
- }>;
65
- children: string[];
66
- 'x-scalar-icon': string;
67
- watchMode: false;
68
- watchModeStatus: "IDLE";
69
- }[];
70
- cookies: v_0_0_0.Cookie[];
71
- environments: {
72
- value: string;
73
- uid: string;
74
- name: string;
75
- color: string;
76
- raw?: string;
77
- parsed?: {
78
- key: string;
79
- value: string;
80
- }[];
81
- isDefault?: boolean | undefined;
82
- }[];
83
- requestExamples: {
84
- type: "requestExample";
85
- uid: string;
86
- url?: string;
87
- requestUid: string;
88
- name: string;
89
- body: {
90
- raw?: {
91
- encoding: "json" | "text" | "html" | "text" | "javascript" | "xml" | "yaml" | "edn";
92
- value: string;
93
- };
94
- formData?: {
95
- encoding: "form-data" | "urlencoded";
96
- value: {
97
- key: string;
98
- value: string;
99
- enabled: boolean;
100
- file?: {
101
- name: string;
102
- lastModified: number;
103
- webkitRelativePath: string;
104
- size: number;
105
- type: string;
106
- arrayBuffer: (...args_0: unknown[]) => Promise<any>;
107
- slice: (args_0: number | undefined, args_1: number | undefined, args_2: string | undefined, ...args_3: unknown[]) => any;
108
- stream: (...args_0: unknown[]) => any;
109
- text: (...args_0: unknown[]) => Promise<string>;
110
- } | undefined;
111
- description?: string | undefined;
112
- refUid?: string | undefined;
113
- required?: boolean | undefined;
114
- enum?: string[] | undefined;
115
- type?: string | undefined;
116
- format?: string | undefined;
117
- minimum?: number | undefined;
118
- maximum?: number | undefined;
119
- default?: any | undefined;
120
- nullable?: boolean | undefined;
121
- }[];
122
- };
123
- binary?: any | undefined;
124
- activeBody: "raw" | "formData" | "binary";
125
- };
126
- parameters: {
127
- path: {
128
- key: string;
129
- value: string;
130
- enabled: boolean;
131
- file?: any | undefined;
132
- description?: string | undefined;
133
- refUid?: string | undefined;
134
- required?: boolean | undefined;
135
- enum?: string[] | undefined;
136
- type?: string | undefined;
137
- format?: string | undefined;
138
- minimum?: number | undefined;
139
- maximum?: number | undefined;
140
- default?: any | undefined;
141
- nullable?: boolean | undefined;
142
- }[];
143
- query: {
144
- key: string;
145
- value: string;
146
- enabled: boolean;
147
- file?: any | undefined;
148
- description?: string | undefined;
149
- refUid?: string | undefined;
150
- required?: boolean | undefined;
151
- enum?: string[] | undefined;
152
- type?: string | undefined;
153
- format?: string | undefined;
154
- minimum?: number | undefined;
155
- maximum?: number | undefined;
156
- default?: any | undefined;
157
- nullable?: boolean | undefined;
158
- }[];
159
- headers: {
160
- key: string;
161
- value: string;
162
- enabled: boolean;
163
- file?: any | undefined;
164
- description?: string | undefined;
165
- refUid?: string | undefined;
166
- required?: boolean | undefined;
167
- enum?: string[] | undefined;
168
- type?: string | undefined;
169
- format?: string | undefined;
170
- minimum?: number | undefined;
171
- maximum?: number | undefined;
172
- default?: any | undefined;
173
- nullable?: boolean | undefined;
174
- }[];
175
- cookies: {
176
- key: string;
177
- value: string;
178
- enabled: boolean;
179
- file?: any | undefined;
180
- description?: string | undefined;
181
- refUid?: string | undefined;
182
- required?: boolean | undefined;
183
- enum?: string[] | undefined;
184
- type?: string | undefined;
185
- format?: string | undefined;
186
- minimum?: number | undefined;
187
- maximum?: number | undefined;
188
- default?: any | undefined;
189
- nullable?: boolean | undefined;
190
- }[];
191
- };
192
- auth?: {
193
- [x: string]: any;
194
- };
195
- }[];
196
- requests: {
197
- parameters: {
198
- required: boolean;
199
- name: string;
200
- in: "path" | "query" | "header" | "cookie";
201
- deprecated: boolean;
202
- description?: string | undefined;
203
- example?: unknown;
204
- schema?: unknown;
205
- content?: unknown;
206
- style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
207
- examples?: Record<string, {
208
- value?: unknown;
209
- summary?: string | undefined;
210
- }> | undefined;
211
- }[];
212
- type: "request";
213
- method: "options" | "delete" | "get" | "connect" | "head" | "patch" | "post" | "put" | "trace";
214
- examples: string[];
215
- selectedSecuritySchemeUids: string[];
216
- selectedServerUid: string;
217
- servers: never[];
218
- path: string;
219
- uid: string;
220
- ref?: {
221
- path: string;
222
- collectionRef?: string | undefined;
223
- isExternal: boolean;
224
- } | null;
225
- tags?: string[] | undefined;
226
- summary?: string | undefined;
227
- description?: string | undefined;
228
- operationId?: string | undefined;
229
- security?: {
230
- [x: string]: string[];
231
- }[] | undefined;
232
- securitySchemeUids?: string[];
233
- requestBody?: any | undefined;
234
- childUids?: string[];
235
- history?: any[];
236
- }[];
237
- securitySchemes: ({
238
- nameKey: string;
239
- 'x-scalar-client-id': string;
240
- flow: {
241
- type: "implicit";
242
- refreshUrl: string;
243
- scopes: Map<string, string | undefined> | Record<string, string | undefined> | {};
244
- selectedScopes: string[];
245
- authorizationUrl: string;
246
- 'x-scalar-redirect-uri': string;
247
- } | {
248
- type: "password";
249
- refreshUrl: string;
250
- scopes: Map<string, string | undefined> | Record<string, string | undefined> | {};
251
- selectedScopes: string[];
252
- tokenUrl: string;
253
- } | {
254
- type: "clientCredentials";
255
- refreshUrl: string;
256
- scopes: Map<string, string | undefined> | Record<string, string | undefined> | {};
257
- selectedScopes: string[];
258
- tokenUrl: string;
259
- } | {
260
- type: "authorizationCode";
261
- refreshUrl: string;
262
- scopes: Map<string, string | undefined> | Record<string, string | undefined> | {};
263
- selectedScopes: string[];
264
- authorizationUrl: string;
265
- 'x-scalar-redirect-uri': string;
266
- tokenUrl: string;
267
- 'x-usePkce': "SHA-256" | "plain" | "no";
268
- };
269
- uid: string;
270
- description?: string | undefined;
271
- type: "oauth2";
272
- clientId?: string;
273
- } | {
274
- nameKey: string;
275
- uid: string;
276
- description?: string | undefined;
277
- type: "apiKey";
278
- name: string;
279
- in: "query" | "header" | "cookie";
280
- value?: string;
281
- } | {
282
- nameKey: string;
283
- uid: string;
284
- description?: string | undefined;
285
- type: "http";
286
- scheme: "basic" | "bearer";
287
- bearerFormat: "JWT" | string;
288
- value?: string;
289
- secondValue?: string;
290
- } | {
291
- nameKey: string;
292
- uid: string;
293
- description?: string | undefined;
294
- type: "openIdConnect";
295
- openIdConnectUrl: string;
296
- })[];
297
- servers: {
298
- variables: {
299
- [x: string]: {
300
- uid?: string;
301
- enum?: [string, ...string[]] | undefined;
302
- default?: string;
303
- description?: string | undefined;
304
- value?: string | undefined;
305
- };
306
- };
307
- uid: string;
308
- url: string;
309
- description?: string | undefined;
310
- }[];
311
- tags: {
312
- type: "tag";
313
- uid: string;
314
- name: string;
315
- description: string | undefined;
316
- children: string[];
317
- 'x-scalar-children': never[];
318
- }[];
319
- workspaces: {
320
- description: string;
321
- cookies: string[];
322
- collections: string[];
323
- environments: string[];
324
- uid: string;
325
- name: string;
326
- isReadOnly: boolean;
327
- collectionUids?: string[];
328
- environmentUids?: string[];
329
- hotKeyConfig: {
330
- modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
331
- hotKeys?: {
332
- [x: string]: {
333
- modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
334
- event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
335
- };
336
- } | undefined;
337
- } | undefined;
338
- activeEnvironmentId: string;
339
- cookieUids?: string[];
340
- proxyUrl?: string | undefined;
341
- themeId: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none";
342
- }[];
4
+ export declare const migrate_v_2_1_0: (data: Omit<v_0_0_0.DataRecord, "folders">) => {
5
+ collections: Record<string, v_2_1_0.Collection>;
6
+ cookies: Record<string, v_0_0_0.Cookie>;
7
+ environments: Record<string, v_2_1_0.Environment>;
8
+ requestExamples: Record<string, v_2_1_0.RequestExample>;
9
+ requests: Record<string, v_2_1_0.Request>;
10
+ securitySchemes: Record<string, v_2_1_0.SecurityScheme>;
11
+ servers: Record<string, v_2_1_0.Server>;
12
+ tags: Record<string, v_2_1_0.Tag>;
13
+ workspaces: Record<string, v_2_1_0.Workspace>;
343
14
  };
344
15
  //# sourceMappingURL=migration.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAiDsD,CAAC;;;;oBASlD,CAAC;;;;;;wBAIF,CAAR;;;;;;sCAM2B,GAAG;oHAMoB,GAAsB;iCAGhE,GAAC;+BACS,GAAG;;+BAKb,CAAC;0BAED,CAAC;4BAIY,CAAA;wBAAoC,CAAC;wBAAqC,CAAC;0BACpF,CAAC;2BAAsC,CAAC;2BAGvC,CAAC;2BAAsC,CAAC;4BACxC,CAAC;;;kBACR,CAAD;;;;;;;;oBAQD,CAAC;2BAAqC,CAAC;sBAElB,CAAC;wBACA,CAAC;oBAAkC,CAAC;oBAG1D,CAAF;sBAAmC,CAAC;uBAE5B,CAAC;uBAAoC,CAAC;uBAChB,CAAC;wBACvB,CAAC;;;;;;oBAOS,CAAC;2BACP,CAAA;sBAAmC,CAAC;wBACtC,CAAC;oBACP,CAAA;oBAAmC,CAAC;sBAE7B,CAAC;uBACa,CAAC;uBACJ,CAAC;uBAAoC,CAAC;wBAC/C,CAAC;;;;;;oBAIS,CAAC;2BACA,CAAC;sBAChB,CAAC;wBACW,CAAC;oBACC,CAAC;oBAIlB,CAAA;sBACE,CAAC;uBACS,CAAC;uBAGb,CAAA;uBAAoC,CAAC;wBACpC,CAAC;;;;;;oBAQO,CAAC;2BAAqC,CAAC;sBACnC,CAAC;wBACW,CAAC;oBACtB,CAAC;oBAAmC,CAAC;sBACf,CAAC;uBACf,CAAC;uBACf,CAAD;uBAAoC,CAAC;wBAItC,CADJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAUS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA4I+b,CAAC;;6BAA4E,CAAC;;;;;;;;;;CADthB,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,CAAA;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,mCAAmC;AACnC,eAAO,MAAM,eAAe,SAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC;;;;;;;;;;CAuVxE,CAAA"}
@@ -85,7 +85,7 @@ const migrate_v_2_1_0 = (data) => {
85
85
  /** This is needed due to our previous data being poluted, we will only allow auth on a requst which is in the spec */
86
86
  const requestSecurityDict = {};
87
87
  // Collections
88
- const collections = Object.values(oldData.collections ?? {}).map((c) => {
88
+ const collections = Object.values(oldData.collections ?? {}).reduce((prev, c) => {
89
89
  const { requestUids, tagUids, authUids } = flattenChildren(c.childUids ?? []);
90
90
  // Ensure we got unique uids
91
91
  const securitySchemesSet = new Set([
@@ -96,13 +96,13 @@ const migrate_v_2_1_0 = (data) => {
96
96
  // Add this auth to each request
97
97
  requestUids.forEach((r) => (requestSecurityDict[r] = securitySchemes));
98
98
  // Migrate auth
99
- const auth = securitySchemes.reduce((prev, uid) => {
99
+ const auth = securitySchemes.reduce((_prev, uid) => {
100
100
  const scheme = oldData.securitySchemes[uid];
101
- if (scheme?.uid)
102
- prev[uid] = migrateAuth(scheme);
103
- return prev;
101
+ if (scheme?.uid && _prev)
102
+ _prev[uid] = migrateAuth(scheme);
103
+ return _prev;
104
104
  }, {});
105
- return {
105
+ prev[c.uid] = {
106
106
  'type': 'collection',
107
107
  'openapi': c.spec?.openapi || '3.1.0',
108
108
  'info': c.spec?.info || { title: 'OpenAPI Spec', version: '0.0.1' },
@@ -121,16 +121,20 @@ const migrate_v_2_1_0 = (data) => {
121
121
  'watchMode': false,
122
122
  'watchModeStatus': 'IDLE',
123
123
  };
124
- });
124
+ return prev;
125
+ }, {});
125
126
  // Cookies
126
- const cookies = Object.values(oldData.cookies ?? {});
127
+ const cookies = oldData.cookies ?? {};
127
128
  // Environments
128
- const environments = Object.values(oldData.environments ?? {}).map((e) => ({
129
- ...e,
130
- value: e.raw ?? '',
131
- }));
129
+ const environments = Object.values(oldData.environments ?? {}).reduce((prev, e) => {
130
+ prev[e.uid] = {
131
+ ...e,
132
+ value: e.raw ?? '',
133
+ };
134
+ return prev;
135
+ }, {});
132
136
  // Requests
133
- const requests = Object.values(oldData.requests ?? {}).map((r) => {
137
+ const requests = Object.values(oldData.requests ?? {}).reduce((prev, r) => {
134
138
  // Convert parameters
135
139
  const parameters = [
136
140
  ...Object.values(r.parameters?.path ?? {}),
@@ -140,7 +144,7 @@ const migrate_v_2_1_0 = (data) => {
140
144
  ].filter((p) => p);
141
145
  // Ensure this request can access these schemes
142
146
  const selectedSecuritySchemeUids = (r.selectedSecuritySchemeUids || []).filter((s) => requestSecurityDict[r.uid]?.includes(s));
143
- return {
147
+ prev[r.uid] = {
144
148
  ...r,
145
149
  parameters,
146
150
  type: 'request',
@@ -150,12 +154,16 @@ const migrate_v_2_1_0 = (data) => {
150
154
  selectedServerUid: '',
151
155
  servers: [],
152
156
  };
153
- });
157
+ return prev;
158
+ }, {});
154
159
  // Request Examples
155
- const requestExamples = Object.values(oldData.requestExamples ?? {}).map((e) => ({
156
- ...e,
157
- type: 'requestExample',
158
- }));
160
+ const requestExamples = Object.values(oldData.requestExamples ?? {}).reduce((prev, e) => {
161
+ prev[e.uid] = {
162
+ ...e,
163
+ type: 'requestExample',
164
+ };
165
+ return prev;
166
+ }, {});
159
167
  /** Specifically handle each oauth2 flow */
160
168
  const migrateFlow = (flow) => {
161
169
  const base = {
@@ -208,36 +216,49 @@ const migrate_v_2_1_0 = (data) => {
208
216
  }
209
217
  };
210
218
  // Security Schemes
211
- const securitySchemes = Object.values(oldData.securitySchemes ?? {}).map((s) => s.type === 'oauth2'
212
- ? {
213
- ...s,
214
- 'nameKey': getNameKey(s),
215
- 'x-scalar-client-id': s.clientId || '',
216
- 'flow': migrateFlow(s.flow),
217
- }
218
- : { ...s, nameKey: getNameKey(s) });
219
+ const securitySchemes = Object.values(oldData.securitySchemes ?? {}).reduce((prev, s) => {
220
+ prev[s.uid] =
221
+ s.type === 'oauth2'
222
+ ? {
223
+ ...s,
224
+ 'nameKey': getNameKey(s),
225
+ 'x-scalar-client-id': s.clientId || '',
226
+ 'flow': migrateFlow(s.flow),
227
+ }
228
+ : { ...s, nameKey: getNameKey(s) };
229
+ return prev;
230
+ }, {});
219
231
  // Servers
220
- const servers = Object.values(oldData.servers ?? {}).map((s) => ({
221
- ...s,
222
- variables: s.variables ?? {},
223
- }));
232
+ const servers = Object.values(oldData.servers ?? {}).reduce((prev, s) => {
233
+ prev[s.uid] = {
234
+ ...s,
235
+ variables: s.variables ?? {},
236
+ };
237
+ return prev;
238
+ }, {});
224
239
  // Tags
225
- const tags = Object.values(oldData.folders ?? {}).map((f) => ({
226
- 'type': 'tag',
227
- 'uid': f.uid,
228
- 'name': f.name || 'unknownTag',
229
- 'description': f.description,
230
- 'children': f.childUids || [],
231
- 'x-scalar-children': [],
232
- }));
240
+ const tags = Object.values(oldData.folders ?? {}).reduce((prev, f) => {
241
+ prev[f.uid] = {
242
+ 'type': 'tag',
243
+ 'uid': f.uid,
244
+ 'name': f.name || 'unknownTag',
245
+ 'description': f.description,
246
+ 'children': f.childUids || [],
247
+ 'x-scalar-children': [],
248
+ };
249
+ return prev;
250
+ }, {});
233
251
  // Workspaces
234
- const workspaces = Object.values(oldData.workspaces ?? {}).map((w) => ({
235
- ...w,
236
- description: w.description ?? 'Basic Scalar Workspace',
237
- cookies: w.cookieUids || [],
238
- collections: w.collectionUids || [],
239
- environments: w.environmentUids || [],
240
- }));
252
+ const workspaces = Object.values(oldData.workspaces ?? {}).reduce((prev, w) => {
253
+ prev[w.uid] = {
254
+ ...w,
255
+ description: w.description ?? 'Basic Scalar Workspace',
256
+ cookies: w.cookieUids || [],
257
+ collections: w.collectionUids || [],
258
+ environments: w.environmentUids || [],
259
+ };
260
+ return prev;
261
+ }, {});
241
262
  return {
242
263
  collections,
243
264
  cookies,