@scalar/api-client 2.1.25 → 2.1.27
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 +26 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +150 -90
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +42 -42
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
- package/dist/layouts/App/create-api-client-app.d.ts +77 -20
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +14 -12
- package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.js +23 -26
- package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.js +12 -10
- package/dist/libs/create-client.d.ts +77 -20
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +60 -58
- package/dist/store/collections.d.ts +34 -4
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/import-spec.d.ts +43 -4
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/import-spec.js +60 -36
- package/dist/store/requests.d.ts +4 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +76 -76
- package/dist/store/security-schemes.d.ts +2 -2
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +35 -37
- package/dist/store/servers.d.ts +10 -10
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +154 -40
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +74 -72
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +23 -18
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +39 -38
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +4 -4
- package/dist/views/Request/RequestSidebar.vue2.js +107 -102
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
- package/dist/views/Request/libs/live-sync.d.ts +59 -0
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
- package/dist/views/Request/libs/live-sync.js +289 -0
- package/dist/views/Request/types/sidebar-item.d.ts +2 -0
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue2.js +15 -45
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.js +135 -102
- package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneralMode.vue.js +76 -68
- package/package.json +8 -6
|
@@ -5,26 +5,26 @@ import { DATA_VERSION_LS_LEY as q, DATA_VERSION as K } from "@scalar/oas-utils/m
|
|
|
5
5
|
import { createApp as L, watch as R } from "vue";
|
|
6
6
|
import { createWorkspaceStore as T } from "../store/store.js";
|
|
7
7
|
const D = ({
|
|
8
|
-
el:
|
|
8
|
+
el: A,
|
|
9
9
|
appComponent: b,
|
|
10
10
|
configuration: t = {},
|
|
11
|
-
isReadOnly:
|
|
12
|
-
persistData:
|
|
13
|
-
mountOnInitialize:
|
|
14
|
-
router:
|
|
11
|
+
isReadOnly: u = !1,
|
|
12
|
+
persistData: y = !0,
|
|
13
|
+
mountOnInitialize: I = !0,
|
|
14
|
+
router: o
|
|
15
15
|
}) => {
|
|
16
|
-
const s = T(
|
|
17
|
-
if (localStorage.getItem(M.WORKSPACE) && !
|
|
16
|
+
const s = T(o, y);
|
|
17
|
+
if (localStorage.getItem(M.WORKSPACE) && !u) {
|
|
18
18
|
const e = {};
|
|
19
|
-
let
|
|
19
|
+
let l = 0, r = 0, a = "";
|
|
20
20
|
for (a in localStorage)
|
|
21
|
-
Object.prototype.hasOwnProperty.call(localStorage, a) && (
|
|
22
|
-
e.Total = (
|
|
23
|
-
} else if (!
|
|
21
|
+
Object.prototype.hasOwnProperty.call(localStorage, a) && (r = (localStorage[a].length + a.length) * 2, l += r, e[a] = (r / 1024).toFixed(2) + " KB");
|
|
22
|
+
e.Total = (l / 1024).toFixed(2) + " KB", console.table(e), j(s);
|
|
23
|
+
} else if (!u || !t.spec)
|
|
24
24
|
s.workspaceMutators.add({
|
|
25
25
|
uid: "default",
|
|
26
26
|
name: "Workspace",
|
|
27
|
-
isReadOnly:
|
|
27
|
+
isReadOnly: u,
|
|
28
28
|
proxyUrl: t.proxyUrl
|
|
29
29
|
}), localStorage.setItem(q, K);
|
|
30
30
|
else {
|
|
@@ -36,20 +36,20 @@ const D = ({
|
|
|
36
36
|
});
|
|
37
37
|
s.workspaceMutators.rawAdd(e);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const c = L(b);
|
|
40
|
+
c.use(o), c.provide("workspace", s);
|
|
41
41
|
const {
|
|
42
|
-
activeCollection:
|
|
43
|
-
activeWorkspace:
|
|
44
|
-
collectionMutators:
|
|
45
|
-
importSpecFile:
|
|
46
|
-
importSpecFromUrl:
|
|
47
|
-
modalState:
|
|
48
|
-
requests:
|
|
49
|
-
securitySchemes:
|
|
50
|
-
servers:
|
|
42
|
+
activeCollection: d,
|
|
43
|
+
activeWorkspace: p,
|
|
44
|
+
collectionMutators: m,
|
|
45
|
+
importSpecFile: v,
|
|
46
|
+
importSpecFromUrl: O,
|
|
47
|
+
modalState: h,
|
|
48
|
+
requests: i,
|
|
49
|
+
securitySchemes: w,
|
|
50
|
+
servers: S,
|
|
51
51
|
workspaceMutators: U
|
|
52
|
-
} = s, k = (e =
|
|
52
|
+
} = s, k = (e = A) => {
|
|
53
53
|
if (!e) {
|
|
54
54
|
console.error(
|
|
55
55
|
"[@scalar/api-client-modal] Could not create the API client.",
|
|
@@ -58,43 +58,43 @@ const D = ({
|
|
|
58
58
|
);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
c.mount(e);
|
|
62
62
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
63
|
+
return p.value && (I && k(), t != null && t.proxyUrl && U.edit(
|
|
64
|
+
p.value.uid,
|
|
65
65
|
"proxyUrl",
|
|
66
66
|
t == null ? void 0 : t.proxyUrl
|
|
67
67
|
), t != null && t.themeId && U.edit(
|
|
68
|
-
|
|
68
|
+
p.value.uid,
|
|
69
69
|
"themeId",
|
|
70
70
|
t == null ? void 0 : t.themeId
|
|
71
71
|
)), {
|
|
72
72
|
/** The vue app instance for the modal, be careful with this */
|
|
73
|
-
app:
|
|
73
|
+
app: c,
|
|
74
74
|
/** Update the API client config */
|
|
75
|
-
updateConfig(e,
|
|
76
|
-
|
|
75
|
+
updateConfig(e, l = !0) {
|
|
76
|
+
l ? Object.assign(t ?? {}, e) : P(t ?? {}, e), e.spec && v(e.spec, p.value.uid);
|
|
77
77
|
},
|
|
78
78
|
/** Update the currently selected server via URL */
|
|
79
79
|
updateServer: (e) => {
|
|
80
|
-
var
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
(
|
|
80
|
+
var r;
|
|
81
|
+
const l = Object.values(S).find((a) => a.url === e);
|
|
82
|
+
l && d.value && m.edit(
|
|
83
|
+
(r = d.value) == null ? void 0 : r.uid,
|
|
84
84
|
"selectedServerUid",
|
|
85
|
-
|
|
85
|
+
l.uid
|
|
86
86
|
);
|
|
87
87
|
},
|
|
88
88
|
/** Update the currently selected server via URL */
|
|
89
89
|
onUpdateServer: (e) => {
|
|
90
90
|
R(
|
|
91
91
|
() => {
|
|
92
|
-
var
|
|
93
|
-
return (
|
|
92
|
+
var l;
|
|
93
|
+
return (l = d.value) == null ? void 0 : l.selectedServerUid;
|
|
94
94
|
},
|
|
95
|
-
(
|
|
96
|
-
const
|
|
97
|
-
|
|
95
|
+
(l) => {
|
|
96
|
+
const r = Object.values(S).find((a) => a.uid === l);
|
|
97
|
+
r != null && r.url && e(r.url);
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
},
|
|
@@ -103,20 +103,22 @@ const D = ({
|
|
|
103
103
|
*/
|
|
104
104
|
updateAuth: ({
|
|
105
105
|
nameKey: e,
|
|
106
|
-
propertyKey:
|
|
107
|
-
value:
|
|
106
|
+
propertyKey: l,
|
|
107
|
+
value: r
|
|
108
108
|
}) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
`auth.${
|
|
109
|
+
const x = Object.values(w).find((_) => _.nameKey === e);
|
|
110
|
+
x && d.value && m.edit(
|
|
111
|
+
d.value.uid,
|
|
112
|
+
`auth.${x.uid}.${l}`,
|
|
113
113
|
// @ts-expect-error why typescript why
|
|
114
|
-
|
|
114
|
+
r
|
|
115
115
|
);
|
|
116
116
|
},
|
|
117
117
|
/** Update the spec file, this will re-parse it and clear your store */
|
|
118
118
|
updateSpec: async (e) => {
|
|
119
|
-
e != null && e.url ? await
|
|
119
|
+
e != null && e.url ? await O(e.url, p.value.uid, {
|
|
120
|
+
proxy: t == null ? void 0 : t.proxyUrl
|
|
121
|
+
}) : e != null && e.content ? await v(e == null ? void 0 : e.content, p.value.uid) : console.error(
|
|
120
122
|
"[@scalar/api-client-modal] Could not create the API client.",
|
|
121
123
|
"Please provide an OpenAPI document: { spec: { url: '…' } }",
|
|
122
124
|
"Read more: https://github.com/scalar/scalar/tree/main/packages/api-client"
|
|
@@ -124,31 +126,31 @@ const D = ({
|
|
|
124
126
|
},
|
|
125
127
|
/** Route to a method + path */
|
|
126
128
|
route: (e) => {
|
|
127
|
-
const
|
|
128
|
-
({ path:
|
|
129
|
+
const l = Object.values(i).find(
|
|
130
|
+
({ path: r, method: a }) => r === e.path && a.toUpperCase() === e.method.toUpperCase()
|
|
129
131
|
);
|
|
130
|
-
|
|
132
|
+
l && o.push(`/workspace/default/request/${l.uid}`);
|
|
131
133
|
},
|
|
132
134
|
/** Open the API client modal and optionally route to a request */
|
|
133
135
|
open: (e) => {
|
|
134
136
|
if (e) {
|
|
135
|
-
const
|
|
136
|
-
({ path:
|
|
137
|
+
const l = Object.values(i).find(
|
|
138
|
+
({ path: r, method: a }) => e ? (
|
|
137
139
|
// The given operation
|
|
138
|
-
|
|
140
|
+
r === e.path && a.toUpperCase() === e.method.toUpperCase()
|
|
139
141
|
) : (
|
|
140
142
|
// Or the first request
|
|
141
143
|
!0
|
|
142
144
|
)
|
|
143
145
|
);
|
|
144
|
-
|
|
146
|
+
l && o.push(`/workspace/default/request/${l.uid}`);
|
|
145
147
|
}
|
|
146
|
-
|
|
148
|
+
h.open = !0;
|
|
147
149
|
},
|
|
148
150
|
/** Mount the references to a given element */
|
|
149
151
|
mount: k,
|
|
150
152
|
/** State for controlling the modal */
|
|
151
|
-
modalState:
|
|
153
|
+
modalState: h,
|
|
152
154
|
/* The workspace store */
|
|
153
155
|
store: s
|
|
154
156
|
};
|
|
@@ -42,6 +42,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
42
42
|
token: string;
|
|
43
43
|
clientSecret: string;
|
|
44
44
|
}>;
|
|
45
|
+
watchForChanges: boolean;
|
|
46
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
45
47
|
externalDocs?: {
|
|
46
48
|
url: string;
|
|
47
49
|
description?: string | undefined;
|
|
@@ -66,6 +68,7 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
66
68
|
} | undefined;
|
|
67
69
|
components?: Record<string, unknown> | undefined;
|
|
68
70
|
webhooks?: Record<string, unknown> | undefined;
|
|
71
|
+
documentUrl?: string | undefined;
|
|
69
72
|
}>;
|
|
70
73
|
collectionMutators: {
|
|
71
74
|
add: (item: {
|
|
@@ -107,6 +110,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
107
110
|
token: string;
|
|
108
111
|
clientSecret: string;
|
|
109
112
|
}>;
|
|
113
|
+
watchForChanges: boolean;
|
|
114
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
110
115
|
externalDocs?: {
|
|
111
116
|
url: string;
|
|
112
117
|
description?: string | undefined;
|
|
@@ -131,6 +136,7 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
131
136
|
} | undefined;
|
|
132
137
|
components?: Record<string, unknown> | undefined;
|
|
133
138
|
webhooks?: Record<string, unknown> | undefined;
|
|
139
|
+
documentUrl?: string | undefined;
|
|
134
140
|
}) => void;
|
|
135
141
|
delete: (uid: string) => void;
|
|
136
142
|
set: (item: {
|
|
@@ -172,6 +178,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
172
178
|
token: string;
|
|
173
179
|
clientSecret: string;
|
|
174
180
|
}>;
|
|
181
|
+
watchForChanges: boolean;
|
|
182
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
175
183
|
externalDocs?: {
|
|
176
184
|
url: string;
|
|
177
185
|
description?: string | undefined;
|
|
@@ -196,8 +204,9 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
196
204
|
} | undefined;
|
|
197
205
|
components?: Record<string, unknown> | undefined;
|
|
198
206
|
webhooks?: Record<string, unknown> | undefined;
|
|
207
|
+
documentUrl?: string | undefined;
|
|
199
208
|
}) => void;
|
|
200
|
-
edit: <P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "selectedServerUid" | `servers.${number}` | `tags.${number}` | `security.${number}` | `security.${number}.${string}` | "externalDocs.url" | "externalDocs.description" | "x-scalar-icon" | `children.${number}` | "info.summary" | "info.title" | "info.description" | "info.termsOfService" | "info.contact" | "info.license" | "info.version" | "info.contact.url" | "info.contact.name" | "info.contact.email" | "info.license.url" | "info.license.name" | "info.license.identifier" | `auth.${string}` | `securitySchemes.${number}` | `requests.${number}` | `components.${string}` | `webhooks.${string}`>(uid: string, path: P, value: P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "selectedServerUid" | "x-scalar-icon" ? {
|
|
209
|
+
edit: <P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | `servers.${number}` | `tags.${number}` | `security.${number}` | `security.${number}.${string}` | "externalDocs.url" | "externalDocs.description" | "x-scalar-icon" | "watchForChangesStatus" | `children.${number}` | "info.summary" | "info.title" | "info.description" | "info.termsOfService" | "info.contact" | "info.license" | "info.version" | "info.contact.url" | "info.contact.name" | "info.contact.email" | "info.license.url" | "info.license.name" | "info.license.identifier" | `auth.${string}` | `securitySchemes.${number}` | `requests.${number}` | `components.${string}` | `webhooks.${string}`>(uid: string, path: P, value: P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | "x-scalar-icon" | "watchForChangesStatus" ? {
|
|
201
210
|
type: "collection";
|
|
202
211
|
uid: string;
|
|
203
212
|
children: string[];
|
|
@@ -236,6 +245,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
236
245
|
token: string;
|
|
237
246
|
clientSecret: string;
|
|
238
247
|
}>;
|
|
248
|
+
watchForChanges: boolean;
|
|
249
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
239
250
|
externalDocs?: {
|
|
240
251
|
url: string;
|
|
241
252
|
description?: string | undefined;
|
|
@@ -260,7 +271,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
260
271
|
} | undefined;
|
|
261
272
|
components?: Record<string, unknown> | undefined;
|
|
262
273
|
webhooks?: Record<string, unknown> | undefined;
|
|
263
|
-
|
|
274
|
+
documentUrl?: string | undefined;
|
|
275
|
+
}[P] : P extends `${infer K}.${infer R}` ? K extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | "x-scalar-icon" | "watchForChangesStatus" ? R extends import("@scalar/object-utils/nested").Path<{
|
|
264
276
|
type: "collection";
|
|
265
277
|
uid: string;
|
|
266
278
|
children: string[];
|
|
@@ -299,6 +311,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
299
311
|
token: string;
|
|
300
312
|
clientSecret: string;
|
|
301
313
|
}>;
|
|
314
|
+
watchForChanges: boolean;
|
|
315
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
302
316
|
externalDocs?: {
|
|
303
317
|
url: string;
|
|
304
318
|
description?: string | undefined;
|
|
@@ -323,6 +337,7 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
323
337
|
} | undefined;
|
|
324
338
|
components?: Record<string, unknown> | undefined;
|
|
325
339
|
webhooks?: Record<string, unknown> | undefined;
|
|
340
|
+
documentUrl?: string | undefined;
|
|
326
341
|
}[K]> ? import("@scalar/object-utils/nested").PathValue<{
|
|
327
342
|
type: "collection";
|
|
328
343
|
uid: string;
|
|
@@ -362,6 +377,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
362
377
|
token: string;
|
|
363
378
|
clientSecret: string;
|
|
364
379
|
}>;
|
|
380
|
+
watchForChanges: boolean;
|
|
381
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
365
382
|
externalDocs?: {
|
|
366
383
|
url: string;
|
|
367
384
|
description?: string | undefined;
|
|
@@ -386,8 +403,9 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
386
403
|
} | undefined;
|
|
387
404
|
components?: Record<string, unknown> | undefined;
|
|
388
405
|
webhooks?: Record<string, unknown> | undefined;
|
|
406
|
+
documentUrl?: string | undefined;
|
|
389
407
|
}[K], R> : never : K extends `${number}` ? never : never : P extends `${number}` ? never : never) => void;
|
|
390
|
-
untrackedEdit: <P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "selectedServerUid" | `servers.${number}` | `tags.${number}` | `security.${number}` | `security.${number}.${string}` | "externalDocs.url" | "externalDocs.description" | "x-scalar-icon" | `children.${number}` | "info.summary" | "info.title" | "info.description" | "info.termsOfService" | "info.contact" | "info.license" | "info.version" | "info.contact.url" | "info.contact.name" | "info.contact.email" | "info.license.url" | "info.license.name" | "info.license.identifier" | `auth.${string}` | `securitySchemes.${number}` | `requests.${number}` | `components.${string}` | `webhooks.${string}`>(uid: string, path: P, value: P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "selectedServerUid" | "x-scalar-icon" ? {
|
|
408
|
+
untrackedEdit: <P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | `servers.${number}` | `tags.${number}` | `security.${number}` | `security.${number}.${string}` | "externalDocs.url" | "externalDocs.description" | "x-scalar-icon" | "watchForChangesStatus" | `children.${number}` | "info.summary" | "info.title" | "info.description" | "info.termsOfService" | "info.contact" | "info.license" | "info.version" | "info.contact.url" | "info.contact.name" | "info.contact.email" | "info.license.url" | "info.license.name" | "info.license.identifier" | `auth.${string}` | `securitySchemes.${number}` | `requests.${number}` | `components.${string}` | `webhooks.${string}`>(uid: string, path: P, value: P extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | "x-scalar-icon" | "watchForChangesStatus" ? {
|
|
391
409
|
type: "collection";
|
|
392
410
|
uid: string;
|
|
393
411
|
children: string[];
|
|
@@ -426,6 +444,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
426
444
|
token: string;
|
|
427
445
|
clientSecret: string;
|
|
428
446
|
}>;
|
|
447
|
+
watchForChanges: boolean;
|
|
448
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
429
449
|
externalDocs?: {
|
|
430
450
|
url: string;
|
|
431
451
|
description?: string | undefined;
|
|
@@ -450,7 +470,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
450
470
|
} | undefined;
|
|
451
471
|
components?: Record<string, unknown> | undefined;
|
|
452
472
|
webhooks?: Record<string, unknown> | undefined;
|
|
453
|
-
|
|
473
|
+
documentUrl?: string | undefined;
|
|
474
|
+
}[P] : P extends `${infer K}.${infer R}` ? K extends "type" | "children" | "info" | "servers" | "uid" | "auth" | "securitySchemes" | "tags" | "requests" | "components" | "openapi" | "security" | "externalDocs" | "webhooks" | "jsonSchemaDialect" | "documentUrl" | "watchForChanges" | "selectedServerUid" | "x-scalar-icon" | "watchForChangesStatus" ? R extends import("@scalar/object-utils/nested").Path<{
|
|
454
475
|
type: "collection";
|
|
455
476
|
uid: string;
|
|
456
477
|
children: string[];
|
|
@@ -489,6 +510,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
489
510
|
token: string;
|
|
490
511
|
clientSecret: string;
|
|
491
512
|
}>;
|
|
513
|
+
watchForChanges: boolean;
|
|
514
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
492
515
|
externalDocs?: {
|
|
493
516
|
url: string;
|
|
494
517
|
description?: string | undefined;
|
|
@@ -513,6 +536,7 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
513
536
|
} | undefined;
|
|
514
537
|
components?: Record<string, unknown> | undefined;
|
|
515
538
|
webhooks?: Record<string, unknown> | undefined;
|
|
539
|
+
documentUrl?: string | undefined;
|
|
516
540
|
}[K]> ? import("@scalar/object-utils/nested").PathValue<{
|
|
517
541
|
type: "collection";
|
|
518
542
|
uid: string;
|
|
@@ -552,6 +576,8 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
552
576
|
token: string;
|
|
553
577
|
clientSecret: string;
|
|
554
578
|
}>;
|
|
579
|
+
watchForChanges: boolean;
|
|
580
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
555
581
|
externalDocs?: {
|
|
556
582
|
url: string;
|
|
557
583
|
description?: string | undefined;
|
|
@@ -576,6 +602,7 @@ export declare function createStoreCollections(useLocalStorage: boolean): {
|
|
|
576
602
|
} | undefined;
|
|
577
603
|
components?: Record<string, unknown> | undefined;
|
|
578
604
|
webhooks?: Record<string, unknown> | undefined;
|
|
605
|
+
documentUrl?: string | undefined;
|
|
579
606
|
}[K], R> : never : K extends `${number}` ? never : never : P extends `${number}` ? never : never) => void;
|
|
580
607
|
undo: (uid: string) => void;
|
|
581
608
|
redo: (uid: string) => void;
|
|
@@ -622,6 +649,8 @@ export declare function extendedCollectionDataFactory({ requests, requestMutator
|
|
|
622
649
|
token: string;
|
|
623
650
|
clientSecret: string;
|
|
624
651
|
}>;
|
|
652
|
+
watchForChanges: boolean;
|
|
653
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
625
654
|
externalDocs?: {
|
|
626
655
|
url: string;
|
|
627
656
|
description?: string | undefined;
|
|
@@ -646,6 +675,7 @@ export declare function extendedCollectionDataFactory({ requests, requestMutator
|
|
|
646
675
|
} | undefined;
|
|
647
676
|
components?: Record<string, unknown> | undefined;
|
|
648
677
|
webhooks?: Record<string, unknown> | undefined;
|
|
678
|
+
documentUrl?: string | undefined;
|
|
649
679
|
};
|
|
650
680
|
deleteCollection: (collection: Collection, workspace: Workspace) => void;
|
|
651
681
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/store/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAKrE,yCAAyC;AACzC,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,OAAO
|
|
1
|
+
{"version":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ACtB,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,WAAW,GACZ,EAAE,YAAY;6BACmB,iBAAiB,gBAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAwD28a,CAAC;;;;;;uBAAqK,CAAC;mBAAqC,CAAC;0BAA4C,CAAC;mBAAqC,CAAC;oBAAoB,CAAC;mBAAqC,CAAC;qBAAuC,CAAC;;mBAA4D,CAAC;;0BAAoD,CAAC;mBAAqC,CAAC;;;;;;;mCA7Cvgc,UAAU,aAAa,SAAS;EA4CvE"}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ClientConfiguration, type ErrorResponse } from '../libs/index.js';
|
|
2
2
|
import type { StoreContext } from '../store/store-context';
|
|
3
|
+
import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
3
4
|
import type { Spec } from '@scalar/types/legacy';
|
|
5
|
+
/** Maps the specs by URL */
|
|
6
|
+
export declare const specDictionary: Record<string, {
|
|
7
|
+
hash: number;
|
|
8
|
+
schema: OpenAPIV3.Document | OpenAPIV3_1.Document;
|
|
9
|
+
}>;
|
|
4
10
|
/** Generate the import functions from a store context */
|
|
5
11
|
export declare function importSpecFileFactory({ requestMutators, collectionMutators, serverMutators, tagMutators, securitySchemeMutators, requestExampleMutators, workspaceMutators, workspaces, }: StoreContext): {
|
|
6
|
-
importSpecFile: (_spec: string | Record<string, any>, workspaceUid
|
|
12
|
+
importSpecFile: (_spec: string | Record<string, any>, workspaceUid: string, { documentUrl, watchForChanges, overloadServers, preferredSecurityScheme, }?: {
|
|
13
|
+
/** To store the documentUrl, used for watchForChanges */
|
|
14
|
+
documentUrl?: string;
|
|
15
|
+
watchForChanges?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: What do these look like?
|
|
18
|
+
* Ideally we reference some existing UIDs in the store and
|
|
19
|
+
* attach those as needed to entities below
|
|
20
|
+
*/
|
|
21
|
+
overloadServers?: Spec["servers"];
|
|
22
|
+
preferredSecurityScheme?: ClientConfiguration["preferredSecurityScheme"];
|
|
23
|
+
}) => Promise<{
|
|
7
24
|
type: "collection";
|
|
8
25
|
uid: string;
|
|
9
26
|
children: string[];
|
|
@@ -42,6 +59,8 @@ export declare function importSpecFileFactory({ requestMutators, collectionMutat
|
|
|
42
59
|
token: string;
|
|
43
60
|
clientSecret: string;
|
|
44
61
|
}>;
|
|
62
|
+
watchForChanges: boolean;
|
|
63
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
45
64
|
externalDocs?: {
|
|
46
65
|
url: string;
|
|
47
66
|
description?: string | undefined;
|
|
@@ -66,8 +85,25 @@ export declare function importSpecFileFactory({ requestMutators, collectionMutat
|
|
|
66
85
|
} | undefined;
|
|
67
86
|
components?: Record<string, unknown> | undefined;
|
|
68
87
|
webhooks?: Record<string, unknown> | undefined;
|
|
88
|
+
documentUrl?: string | undefined;
|
|
69
89
|
} | undefined>;
|
|
70
|
-
importSpecFromUrl: (url: string,
|
|
90
|
+
importSpecFromUrl: (url: string, workspaceUid: string, { proxy, overloadServers, watchForChanges, preferredSecurityScheme, }?: {
|
|
91
|
+
watchForChanges?: boolean;
|
|
92
|
+
overloadServers?: Spec["servers"];
|
|
93
|
+
preferredSecurityScheme?: ClientConfiguration["preferredSecurityScheme"];
|
|
94
|
+
proxy?: string;
|
|
95
|
+
}) => Promise<ErrorResponse<Awaited<ReturnType<(_spec: string | Record<string, any>, workspaceUid: string, { documentUrl, watchForChanges, overloadServers, preferredSecurityScheme, }?: {
|
|
96
|
+
/** To store the documentUrl, used for watchForChanges */
|
|
97
|
+
documentUrl?: string;
|
|
98
|
+
watchForChanges?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* TODO: What do these look like?
|
|
101
|
+
* Ideally we reference some existing UIDs in the store and
|
|
102
|
+
* attach those as needed to entities below
|
|
103
|
+
*/
|
|
104
|
+
overloadServers?: Spec["servers"];
|
|
105
|
+
preferredSecurityScheme?: ClientConfiguration["preferredSecurityScheme"];
|
|
106
|
+
}) => Promise<{
|
|
71
107
|
type: "collection";
|
|
72
108
|
uid: string;
|
|
73
109
|
children: string[];
|
|
@@ -106,6 +142,8 @@ export declare function importSpecFileFactory({ requestMutators, collectionMutat
|
|
|
106
142
|
token: string;
|
|
107
143
|
clientSecret: string;
|
|
108
144
|
}>;
|
|
145
|
+
watchForChanges: boolean;
|
|
146
|
+
watchForChangesStatus: "IDLE" | "WATCHING" | "ERROR";
|
|
109
147
|
externalDocs?: {
|
|
110
148
|
url: string;
|
|
111
149
|
description?: string | undefined;
|
|
@@ -130,6 +168,7 @@ export declare function importSpecFileFactory({ requestMutators, collectionMutat
|
|
|
130
168
|
} | undefined;
|
|
131
169
|
components?: Record<string, unknown> | undefined;
|
|
132
170
|
webhooks?: Record<string, unknown> | undefined;
|
|
133
|
-
|
|
171
|
+
documentUrl?: string | undefined;
|
|
172
|
+
} | undefined>>>>>;
|
|
134
173
|
};
|
|
135
174
|
//# sourceMappingURL=import-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/store/import-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/store/import-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAEnB,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAGhD,4BAA4B;AAC5B,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,MAAM,EACN;IAAE,IAAI,EAAE,MAAM,CAAC;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QACH,eAAe,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACjC,uBAAuB,CAAC,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,CAAA;KACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6FgiY,CAAC;;;;;;uBAAqK,CAAC;mBAAqC,CAAC;0BAA4C,CAAC;mBAAqC,CAAC;oBAAoB,CAAC;mBAAqC,CAAC;qBAAuC,CAAC;;mBAA4D,CAAC;;0BAAoD,CAAC;mBAAqC,CAAC;;;;;;mBAxB5/Y,CAAC,CAAC,CAAC;EAuBtE"}
|
|
@@ -1,49 +1,73 @@
|
|
|
1
|
-
import { fetchSpecFromUrl as w } from "@scalar/oas-utils/helpers";
|
|
2
|
-
import { importSpecToWorkspace as
|
|
3
|
-
import { toRaw as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createHash as R, fetchSpecFromUrl as w } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { importSpecToWorkspace as x } from "@scalar/oas-utils/transforms";
|
|
3
|
+
import { toRaw as O } from "vue";
|
|
4
|
+
import { normalizeError as S } from "../libs/errors.js";
|
|
5
|
+
const T = {};
|
|
6
|
+
function q({
|
|
7
|
+
requestMutators: l,
|
|
8
|
+
collectionMutators: m,
|
|
9
|
+
serverMutators: h,
|
|
10
|
+
tagMutators: u,
|
|
11
|
+
securitySchemeMutators: d,
|
|
12
|
+
requestExampleMutators: E,
|
|
13
|
+
workspaceMutators: y,
|
|
14
|
+
workspaces: g
|
|
13
15
|
}) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
16
|
+
const p = async (i, n, {
|
|
17
|
+
documentUrl: e,
|
|
18
|
+
watchForChanges: a = !1,
|
|
19
|
+
overloadServers: r,
|
|
20
|
+
preferredSecurityScheme: s
|
|
21
|
+
} = {}) => {
|
|
22
|
+
var f;
|
|
23
|
+
const t = O(i);
|
|
24
|
+
r != null && r.length && typeof t == "object" && (t.servers = r);
|
|
25
|
+
const o = await x(t, {
|
|
26
|
+
documentUrl: e,
|
|
27
|
+
preferredSecurityScheme: s,
|
|
28
|
+
watchForChanges: a
|
|
29
|
+
});
|
|
22
30
|
if (o.error) {
|
|
23
|
-
console.group("IMPORT ERRORS"), o.importWarnings.forEach((
|
|
31
|
+
console.group("IMPORT ERRORS"), o.importWarnings.forEach((c) => console.warn(c)), console.groupEnd();
|
|
24
32
|
return;
|
|
25
33
|
}
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
return e && typeof t == "string" && (T[e] = {
|
|
35
|
+
hash: R(t),
|
|
36
|
+
schema: o.schema
|
|
37
|
+
}), o.examples.forEach((c) => E.add(c)), o.requests.forEach((c) => l.add(c)), o.tags.forEach((c) => u.add(c)), o.servers.forEach((c) => h.add(c)), o.securitySchemes.forEach(
|
|
38
|
+
(c) => d.add(c)
|
|
39
|
+
), m.add(o.collection), y.edit(n, "collections", [
|
|
40
|
+
...((f = g[n]) == null ? void 0 : f.collections) ?? [],
|
|
30
41
|
o.collection.uid
|
|
31
42
|
]), o.collection;
|
|
32
43
|
};
|
|
33
|
-
async function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
async function F(i, n, {
|
|
45
|
+
proxy: e,
|
|
46
|
+
overloadServers: a,
|
|
47
|
+
watchForChanges: r = !1,
|
|
48
|
+
preferredSecurityScheme: s
|
|
49
|
+
} = {}) {
|
|
50
|
+
try {
|
|
51
|
+
const t = await w(i, e);
|
|
52
|
+
return [
|
|
53
|
+
null,
|
|
54
|
+
await p(t, n, {
|
|
55
|
+
documentUrl: i,
|
|
56
|
+
overloadServers: a,
|
|
57
|
+
watchForChanges: r,
|
|
58
|
+
preferredSecurityScheme: s
|
|
59
|
+
})
|
|
60
|
+
];
|
|
61
|
+
} catch (t) {
|
|
62
|
+
return console.error("Failed to fetch spec from URL:", t), [S(t), null];
|
|
63
|
+
}
|
|
41
64
|
}
|
|
42
65
|
return {
|
|
43
|
-
importSpecFile:
|
|
44
|
-
importSpecFromUrl:
|
|
66
|
+
importSpecFile: p,
|
|
67
|
+
importSpecFromUrl: F
|
|
45
68
|
};
|
|
46
69
|
}
|
|
47
70
|
export {
|
|
48
|
-
|
|
71
|
+
q as importSpecFileFactory,
|
|
72
|
+
T as specDictionary
|
|
49
73
|
};
|
package/dist/store/requests.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { extendedTagDataFactory } from '../store/tags.js';
|
|
1
2
|
import { type Collection, type Request, type RequestPayload, type Tag } from '@scalar/oas-utils/entities/spec';
|
|
2
3
|
import type { StoreContext } from './store-context';
|
|
3
4
|
/** Create top level request handlers for a workspace */
|
|
@@ -292,10 +293,11 @@ export declare function createStoreRequests(useLocalStorage: boolean): {
|
|
|
292
293
|
redo: (uid: string) => void;
|
|
293
294
|
};
|
|
294
295
|
};
|
|
296
|
+
type AddTag = ReturnType<typeof extendedTagDataFactory>['addTag'];
|
|
295
297
|
/**
|
|
296
298
|
* Create the extended mutators for request where access to the workspace is required
|
|
297
299
|
*/
|
|
298
|
-
export declare function extendedRequestDataFactory({ requestExamples, requestExampleMutators, requestMutators, collectionMutators, collections, tags, tagMutators, }: StoreContext): {
|
|
300
|
+
export declare function extendedRequestDataFactory({ requestExamples, requestExampleMutators, requestMutators, collectionMutators, collections, tags, tagMutators, }: StoreContext, addTag: AddTag): {
|
|
299
301
|
addRequest: (payload: RequestPayload, collectionUid: string) => void | {
|
|
300
302
|
path: string;
|
|
301
303
|
type: "request";
|
|
@@ -336,4 +338,5 @@ export declare function findRequestParentsFactory({ collections, tags, }: {
|
|
|
336
338
|
collections: Record<string, Collection>;
|
|
337
339
|
tags: Record<string, Tag>;
|
|
338
340
|
}): (r: Request) => string[];
|
|
341
|
+
export {};
|
|
339
342
|
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/store/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,GAAG,EAGT,MAAM,iCAAiC,CAAA;AAKxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,OAAO;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/store/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,GAAG,EAGT,MAAM,iCAAiC,CAAA;AAKxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,OAAO;;;;;;;;;;;;;;uBA8Ko0M,CAAC;;;;;;;;;;;uBAAqX,CAAC;kBAAoC,CAAC;mBAA0B,CAAC;iBAAwB,CAAC;;;;;;;;;;;;;;;;;;;2BAAhd,CAAC;;;;;;;;;;;2BAAqX,CAAC;sBAAoC,CAAC;uBAA0B,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;;2BAAhd,CAAC;;;;;;;;;;;2BAAqX,CAAC;sBAAoC,CAAC;uBAA0B,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;2BAAhd,CAAC;;;;;;;;;;;2BAAqX,CAAC;sBAAoC,CAAC;uBAA0B,CA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