@scalar/api-reference 1.44.8 → 1.44.11

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 (37) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/browser/standalone.js +13543 -13289
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +1 -1
  6. package/dist/components/ApiReference.vue2.js +4 -3
  7. package/dist/components/Content/Auth/Auth.vue.d.ts +2 -0
  8. package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -1
  9. package/dist/components/Content/Auth/Auth.vue.js +11 -4
  10. package/dist/components/Content/Content.vue.d.ts +2 -0
  11. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  12. package/dist/components/Content/Content.vue.js +10 -5
  13. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +3 -0
  14. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Operations/TraversedEntry.vue.js +9 -4
  16. package/dist/features/Operation/Operation.vue.d.ts +6 -0
  17. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  18. package/dist/features/Operation/Operation.vue.js +17 -2
  19. package/dist/features/Operation/helpers/filter-selected-security.d.ts +4 -3
  20. package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -1
  21. package/dist/features/Operation/helpers/filter-selected-security.js +2 -5
  22. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +4 -3
  23. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  24. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  25. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +4 -3
  26. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  27. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  28. package/dist/helpers/load-from-perssistance.d.ts +3 -23
  29. package/dist/helpers/load-from-perssistance.d.ts.map +1 -1
  30. package/dist/helpers/load-from-perssistance.js +5 -61
  31. package/dist/helpers/storage.d.ts +39 -278
  32. package/dist/helpers/storage.d.ts.map +1 -1
  33. package/dist/helpers/storage.js +9 -28
  34. package/dist/plugins/persistance-plugin.d.ts.map +1 -1
  35. package/dist/plugins/persistance-plugin.js +3 -19
  36. package/dist/style.css +100 -97
  37. package/package.json +16 -16
@@ -1,5 +1,4 @@
1
- import type { XScalarSelectedSecurity } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-selected-security';
2
- import { type SecuritySchemes } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import { type Auth } from '@scalar/workspace-store/entities/auth';
3
2
  /**
4
3
  * Provides an interface to store and retrieve the selected client value
5
4
  * in local storage.
@@ -24,52 +23,47 @@ export declare const authStorage: () => {
24
23
  /**
25
24
  * Retrieves and coerces the authentication schemes stored in local storage.
26
25
  */
27
- getSchemas: (slug: string) => {
28
- [x: string]: ({
29
- description?: string | undefined;
30
- } & {
31
- 'x-scalar-secret-token': string;
32
- } & {
33
- type: "apiKey";
34
- in: "header" | "query" | "cookie";
35
- name: string;
36
- }) | ({
37
- description?: string | undefined;
38
- } & {
39
- 'x-scalar-secret-token': string;
40
- } & {
41
- 'x-scalar-secret-username': string;
42
- 'x-scalar-secret-password': string;
43
- } & {
44
- bearerFormat?: string | undefined;
45
- type: "http";
46
- scheme: "basic" | "bearer";
47
- }) | ({
48
- description?: string | undefined;
49
- } & {
50
- type: "oauth2";
51
- flows: {
52
- password?: ({
53
- refreshUrl: string;
54
- scopes: {
55
- [x: string]: string;
26
+ getAuth: (slug: string) => {
27
+ selected: {
28
+ path?: {
29
+ [x: string]: {
30
+ [x: string]: {
31
+ selectedIndex: number;
32
+ selectedSchemes: {}[];
56
33
  };
57
- } & {
34
+ };
35
+ } | undefined;
36
+ document?: {
37
+ selectedIndex: number;
38
+ selectedSchemes: {}[];
39
+ } | undefined;
40
+ };
41
+ secrets: {
42
+ [x: string]: ({
43
+ type: "apiKey";
44
+ } & {
45
+ 'x-scalar-secret-token': string;
46
+ }) | ({
47
+ type: "http";
48
+ } & {
49
+ 'x-scalar-secret-token': string;
50
+ } & {
51
+ 'x-scalar-secret-username': string;
52
+ 'x-scalar-secret-password': string;
53
+ }) | ({
54
+ type: "oauth2";
55
+ } & {
56
+ implicit?: ({
58
57
  'x-scalar-secret-client-id': string;
59
58
  } & {
60
59
  'x-scalar-secret-token': string;
61
60
  } & {
62
- 'x-scalar-security-query'?: {
63
- [x: string]: string;
64
- } | undefined;
65
- } & {
66
- 'x-scalar-security-body'?: {
67
- [x: string]: string;
68
- } | undefined;
69
- } & {
70
- 'x-tokenName'?: string | undefined;
61
+ 'x-scalar-secret-redirect-uri': string;
62
+ }) | undefined;
63
+ password?: ({
64
+ 'x-scalar-secret-client-id': string;
71
65
  } & {
72
- tokenUrl: string;
66
+ 'x-scalar-secret-token': string;
73
67
  } & {
74
68
  'x-scalar-secret-username': string;
75
69
  'x-scalar-secret-password': string;
@@ -78,266 +72,33 @@ export declare const authStorage: () => {
78
72
  } & {
79
73
  'x-scalar-credentials-location'?: "body" | "header" | undefined;
80
74
  }) | undefined;
81
- implicit?: ({
82
- refreshUrl: string;
83
- scopes: {
84
- [x: string]: string;
85
- };
86
- } & {
87
- 'x-scalar-secret-client-id': string;
88
- } & {
89
- 'x-scalar-secret-token': string;
90
- } & {
91
- 'x-scalar-security-query'?: {
92
- [x: string]: string;
93
- } | undefined;
94
- } & {
95
- 'x-scalar-security-body'?: {
96
- [x: string]: string;
97
- } | undefined;
98
- } & {
99
- 'x-tokenName'?: string | undefined;
100
- } & {
101
- authorizationUrl: string;
102
- } & {
103
- 'x-scalar-secret-redirect-uri': string;
104
- }) | undefined;
105
75
  clientCredentials?: ({
106
- refreshUrl: string;
107
- scopes: {
108
- [x: string]: string;
109
- };
110
- } & {
111
76
  'x-scalar-secret-client-id': string;
112
77
  } & {
113
78
  'x-scalar-secret-token': string;
114
- } & {
115
- 'x-scalar-security-query'?: {
116
- [x: string]: string;
117
- } | undefined;
118
- } & {
119
- 'x-scalar-security-body'?: {
120
- [x: string]: string;
121
- } | undefined;
122
- } & {
123
- 'x-tokenName'?: string | undefined;
124
- } & {
125
- tokenUrl: string;
126
79
  } & {
127
80
  'x-scalar-secret-client-secret': string;
128
81
  } & {
129
82
  'x-scalar-credentials-location'?: "body" | "header" | undefined;
130
83
  }) | undefined;
131
84
  authorizationCode?: ({
132
- refreshUrl: string;
133
- scopes: {
134
- [x: string]: string;
135
- };
136
- } & {
137
85
  'x-scalar-secret-client-id': string;
138
86
  } & {
139
87
  'x-scalar-secret-token': string;
140
- } & {
141
- 'x-scalar-security-query'?: {
142
- [x: string]: string;
143
- } | undefined;
144
- } & {
145
- 'x-scalar-security-body'?: {
146
- [x: string]: string;
147
- } | undefined;
148
- } & {
149
- 'x-tokenName'?: string | undefined;
150
- } & {
151
- authorizationUrl: string;
152
- tokenUrl: string;
153
88
  } & {
154
89
  'x-scalar-secret-client-secret': string;
155
90
  } & {
156
91
  'x-scalar-secret-redirect-uri': string;
157
- } & {
158
- 'x-usePkce': "SHA-256" | "plain" | "no";
159
92
  } & {
160
93
  'x-scalar-credentials-location'?: "body" | "header" | undefined;
161
94
  }) | undefined;
162
- };
163
- } & {
164
- 'x-default-scopes'?: string[] | undefined;
165
- }) | ({
166
- description?: string | undefined;
167
- } & {
168
- type: "openIdConnect";
169
- openIdConnectUrl: string;
170
- }) | ({
171
- summary?: string | undefined;
172
- description?: string | undefined;
173
- $ref: string;
174
- } & {
175
- $status?: "loading" | "error" | undefined;
176
- $global?: boolean | undefined;
177
- } & {
178
- '$ref-value': ({
179
- description?: string | undefined;
180
- } & {
181
- 'x-scalar-secret-token': string;
182
- } & {
183
- type: "apiKey";
184
- in: "header" | "query" | "cookie";
185
- name: string;
186
- }) | ({
187
- description?: string | undefined;
188
- } & {
189
- 'x-scalar-secret-token': string;
190
- } & {
191
- 'x-scalar-secret-username': string;
192
- 'x-scalar-secret-password': string;
193
- } & {
194
- bearerFormat?: string | undefined;
195
- type: "http";
196
- scheme: "basic" | "bearer";
197
- }) | ({
198
- description?: string | undefined;
199
- } & {
200
- type: "oauth2";
201
- flows: {
202
- password?: ({
203
- refreshUrl: string;
204
- scopes: {
205
- [x: string]: string;
206
- };
207
- } & {
208
- 'x-scalar-secret-client-id': string;
209
- } & {
210
- 'x-scalar-secret-token': string;
211
- } & {
212
- 'x-scalar-security-query'?: {
213
- [x: string]: string;
214
- } | undefined;
215
- } & {
216
- 'x-scalar-security-body'?: {
217
- [x: string]: string;
218
- } | undefined;
219
- } & {
220
- 'x-tokenName'?: string | undefined;
221
- } & {
222
- tokenUrl: string;
223
- } & {
224
- 'x-scalar-secret-username': string;
225
- 'x-scalar-secret-password': string;
226
- } & {
227
- 'x-scalar-secret-client-secret': string;
228
- } & {
229
- 'x-scalar-credentials-location'?: "body" | "header" | undefined;
230
- }) | undefined;
231
- implicit?: ({
232
- refreshUrl: string;
233
- scopes: {
234
- [x: string]: string;
235
- };
236
- } & {
237
- 'x-scalar-secret-client-id': string;
238
- } & {
239
- 'x-scalar-secret-token': string;
240
- } & {
241
- 'x-scalar-security-query'?: {
242
- [x: string]: string;
243
- } | undefined;
244
- } & {
245
- 'x-scalar-security-body'?: {
246
- [x: string]: string;
247
- } | undefined;
248
- } & {
249
- 'x-tokenName'?: string | undefined;
250
- } & {
251
- authorizationUrl: string;
252
- } & {
253
- 'x-scalar-secret-redirect-uri': string;
254
- }) | undefined;
255
- clientCredentials?: ({
256
- refreshUrl: string;
257
- scopes: {
258
- [x: string]: string;
259
- };
260
- } & {
261
- 'x-scalar-secret-client-id': string;
262
- } & {
263
- 'x-scalar-secret-token': string;
264
- } & {
265
- 'x-scalar-security-query'?: {
266
- [x: string]: string;
267
- } | undefined;
268
- } & {
269
- 'x-scalar-security-body'?: {
270
- [x: string]: string;
271
- } | undefined;
272
- } & {
273
- 'x-tokenName'?: string | undefined;
274
- } & {
275
- tokenUrl: string;
276
- } & {
277
- 'x-scalar-secret-client-secret': string;
278
- } & {
279
- 'x-scalar-credentials-location'?: "body" | "header" | undefined;
280
- }) | undefined;
281
- authorizationCode?: ({
282
- refreshUrl: string;
283
- scopes: {
284
- [x: string]: string;
285
- };
286
- } & {
287
- 'x-scalar-secret-client-id': string;
288
- } & {
289
- 'x-scalar-secret-token': string;
290
- } & {
291
- 'x-scalar-security-query'?: {
292
- [x: string]: string;
293
- } | undefined;
294
- } & {
295
- 'x-scalar-security-body'?: {
296
- [x: string]: string;
297
- } | undefined;
298
- } & {
299
- 'x-tokenName'?: string | undefined;
300
- } & {
301
- authorizationUrl: string;
302
- tokenUrl: string;
303
- } & {
304
- 'x-scalar-secret-client-secret': string;
305
- } & {
306
- 'x-scalar-secret-redirect-uri': string;
307
- } & {
308
- 'x-usePkce': "SHA-256" | "plain" | "no";
309
- } & {
310
- 'x-scalar-credentials-location'?: "body" | "header" | undefined;
311
- }) | undefined;
312
- };
313
- } & {
314
- 'x-default-scopes'?: string[] | undefined;
315
- }) | ({
316
- description?: string | undefined;
317
- } & {
318
- type: "openIdConnect";
319
- openIdConnectUrl: string;
320
95
  });
321
- });
96
+ };
322
97
  };
323
98
  /**
324
99
  * Stores the authentication schemes in local storage.
325
- * @param value The SecuritySchemes object to stringify and store.
326
- */
327
- setSchemas: (slug: string, value: SecuritySchemes) => void;
328
- /**
329
- * Retrieves and coerces the selected authentication schemes stored in local storage.
330
- */
331
- getSelectedSchemes: (slug: string) => {
332
- 'x-scalar-selected-security'?: {
333
- selectedIndex: number;
334
- selectedSchemes: {}[];
335
- } | undefined;
336
- };
337
- /**
338
- * Stores the user's selected authentication schemes in local storage.
339
- * @param value The XScalarSelectedSecurity object to stringify and store.
100
+ * @param value The Auth object to stringify and store.
340
101
  */
341
- setSelectedSchemes: (slug: string, value: XScalarSelectedSecurity) => void;
102
+ setAuth: (slug: string, value: Auth) => void;
342
103
  };
343
104
  //# sourceMappingURL=storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gFAAgF,CAAA;AAE7H,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,8DAA8D,CAAA;AAKrE;;;GAGG;AACH,eAAO,MAAM,aAAa;IAGtB;;OAEG;;IAIH;;;OAGG;iBACU,MAAM;CAItB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAYpB;;OAEG;uBACgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIzB;;;OAGG;uBACgB,MAAM,SAAS,eAAe;IAGjD;;OAEG;+BACwB,MAAM;;;;;;IAIjC;;;OAGG;+BACwB,MAAM,SAAS,uBAAuB;CAIpE,CAAA"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,uCAAuC,CAAA;AAM7E;;;GAGG;AACH,eAAO,MAAM,aAAa;IAGtB;;OAEG;;IAIH;;;OAGG;iBACU,MAAM;CAItB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAMpB;;OAEG;oBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB;;;OAGG;oBACa,MAAM,SAAS,IAAI;CAItC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { REFERENCE_LS_KEYS, safeLocalStorage } from "@scalar/helpers/object/local-storage";
2
+ import { AuthSchema } from "@scalar/workspace-store/entities/auth";
2
3
  import { coerceValue } from "@scalar/workspace-store/schemas/typebox-coerce";
3
- import { XScalarSelectedSecuritySchema, SecuritySchemesSchema } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
4
4
  const storage = safeLocalStorage();
5
5
  const clientStorage = () => {
6
6
  const key = REFERENCE_LS_KEYS.SELECTED_CLIENT;
@@ -21,42 +21,23 @@ const clientStorage = () => {
21
21
  };
22
22
  };
23
23
  const authStorage = () => {
24
- const schemasKey = REFERENCE_LS_KEYS.AUTH_SCHEMES;
25
- const selectedSchemesKey = REFERENCE_LS_KEYS.SELECTED_AUTH_SCHEMES;
26
- const getAuthId = (type, prefix) => {
27
- const getKey = (type2) => {
28
- return type2 === "schemas" ? schemasKey : selectedSchemesKey;
29
- };
30
- return `${prefix}-${getKey(type)}`;
24
+ const getKey = (slug) => {
25
+ return `${REFERENCE_LS_KEYS.AUTH}-${slug}`;
31
26
  };
32
27
  return {
33
28
  /**
34
29
  * Retrieves and coerces the authentication schemes stored in local storage.
35
30
  */
36
- getSchemas: (slug) => {
37
- const parsed = JSON.parse(storage.getItem(getAuthId("schemas", slug)) ?? "{}");
38
- return coerceValue(SecuritySchemesSchema, parsed);
31
+ getAuth: (slug) => {
32
+ const parsed = JSON.parse(storage.getItem(getKey(slug)) ?? "{}");
33
+ return coerceValue(AuthSchema, parsed);
39
34
  },
40
35
  /**
41
36
  * Stores the authentication schemes in local storage.
42
- * @param value The SecuritySchemes object to stringify and store.
37
+ * @param value The Auth object to stringify and store.
43
38
  */
44
- setSchemas: (slug, value) => {
45
- storage.setItem(getAuthId("schemas", slug), JSON.stringify(value));
46
- },
47
- /**
48
- * Retrieves and coerces the selected authentication schemes stored in local storage.
49
- */
50
- getSelectedSchemes: (slug) => {
51
- const parsed = JSON.parse(storage.getItem(getAuthId("selectedSchemes", slug)) ?? "{}");
52
- return coerceValue(XScalarSelectedSecuritySchema, parsed);
53
- },
54
- /**
55
- * Stores the user's selected authentication schemes in local storage.
56
- * @param value The XScalarSelectedSecurity object to stringify and store.
57
- */
58
- setSelectedSchemes: (slug, value) => {
59
- storage.setItem(getAuthId("selectedSchemes", slug), JSON.stringify(value));
39
+ setAuth: (slug, value) => {
40
+ storage.setItem(getKey(slug), JSON.stringify(value));
60
41
  }
61
42
  };
62
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"persistance-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/persistance-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAI/E;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,kDAK/B;IACD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAA;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;CACxC,KAAG,eA2EH,CAAA"}
1
+ {"version":3,"file":"persistance-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/persistance-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAI/E;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,kDAK/B;IACD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAA;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;CACxC,KAAG,eAsDH,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { debounce } from "@scalar/helpers/general/debounce";
2
- import { authStorage, clientStorage } from "../helpers/storage.js";
2
+ import { clientStorage, authStorage } from "../helpers/storage.js";
3
3
  const persistencePlugin = ({
4
4
  debounceDelay = 500,
5
5
  maxWait = 1e4,
@@ -35,24 +35,8 @@ const persistencePlugin = ({
35
35
  }
36
36
  return;
37
37
  }
38
- if (event.type === "documents") {
39
- if (!getPersistAuth()) {
40
- return;
41
- }
42
- const { path, value: document } = event;
43
- const { securitySchemes = {} } = document.components ?? {};
44
- if (path[0] === "components" && path[1] === "securitySchemes") {
45
- execute("x-scalar-security-schemes", () => authPersistence.setSchemas(getPrefix(), securitySchemes));
46
- }
47
- const selectedSecurity = document["x-scalar-selected-security"];
48
- if (path[0] === "x-scalar-selected-security" && selectedSecurity) {
49
- execute(
50
- "x-scalar-selected-security-schemes",
51
- () => authPersistence.setSelectedSchemes(getPrefix(), {
52
- "x-scalar-selected-security": selectedSecurity
53
- })
54
- );
55
- }
38
+ if (getPersistAuth() && event.type === "auth") {
39
+ execute("auth", () => authPersistence.setAuth(getPrefix(), event.value));
56
40
  }
57
41
  return;
58
42
  }