@scalar/api-reference 1.44.9 → 1.44.12

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 (65) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/browser/standalone.js +13583 -13314
  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/Models/components/ClassicLayout.vue.js +1 -1
  14. package/dist/components/Content/Models/components/ClassicLayout.vue2.js +2 -2
  15. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +3 -0
  16. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  17. package/dist/components/Content/Operations/TraversedEntry.vue.js +9 -4
  18. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +2 -3
  19. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  20. package/dist/components/Content/Schema/SchemaComposition.vue.js +3 -3
  21. package/dist/components/Content/Schema/SchemaEnumValues.vue.js +1 -1
  22. package/dist/components/Content/Schema/SchemaEnumValues.vue2.js +2 -2
  23. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
  24. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +4 -4
  25. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  26. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  27. package/dist/components/Content/Schema/SchemaProperty.vue2.js +3 -3
  28. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
  29. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +3 -3
  30. package/dist/components/Content/Schema/helpers/get-compositions-to-render.js +3 -3
  31. package/dist/components/Content/Schema/helpers/get-enum-values.js +2 -2
  32. package/dist/components/Content/Schema/helpers/get-schema-type.d.ts +1 -2
  33. package/dist/components/Content/Schema/helpers/get-schema-type.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/helpers/get-schema-type.js +3 -9
  35. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
  36. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +15 -14
  37. package/dist/components/Content/Schema/helpers/optimize-value-for-display.d.ts +1 -5
  38. package/dist/components/Content/Schema/helpers/optimize-value-for-display.d.ts.map +1 -1
  39. package/dist/components/Content/Schema/helpers/optimize-value-for-display.js +4 -6
  40. package/dist/components/Content/Schema/helpers/schema-name.d.ts +2 -2
  41. package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
  42. package/dist/components/Content/Schema/helpers/schema-name.js +4 -4
  43. package/dist/components/Content/Schema/helpers/sort-property-names.js +2 -2
  44. package/dist/features/Operation/Operation.vue.d.ts +6 -0
  45. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/features/Operation/Operation.vue.js +17 -2
  47. package/dist/features/Operation/helpers/filter-selected-security.d.ts +4 -3
  48. package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -1
  49. package/dist/features/Operation/helpers/filter-selected-security.js +2 -5
  50. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +4 -3
  51. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  52. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  53. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +4 -3
  54. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  55. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  56. package/dist/helpers/load-from-perssistance.d.ts +3 -23
  57. package/dist/helpers/load-from-perssistance.d.ts.map +1 -1
  58. package/dist/helpers/load-from-perssistance.js +5 -61
  59. package/dist/helpers/storage.d.ts +39 -278
  60. package/dist/helpers/storage.d.ts.map +1 -1
  61. package/dist/helpers/storage.js +9 -28
  62. package/dist/plugins/persistance-plugin.d.ts.map +1 -1
  63. package/dist/plugins/persistance-plugin.js +3 -19
  64. package/dist/style.css +157 -154
  65. package/package.json +15 -15
@@ -1,4 +1,4 @@
1
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
1
+ import { resolve } from "@scalar/workspace-store/resolve";
2
2
  import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
3
3
  import { getRefName } from "./get-ref-name.js";
4
4
  const formatArrayType = (itemType) => {
@@ -12,7 +12,7 @@ const processArrayType = (value, isUnionType = false) => {
12
12
  if (!value.items) {
13
13
  return isUnionType ? "array" : value.title || value.xml?.name || "array";
14
14
  }
15
- const itemType = getSchemaType(value.items);
15
+ const itemType = getSchemaType(resolve.schema(value.items));
16
16
  const baseType = formatArrayType(itemType);
17
17
  if (isUnionType) {
18
18
  return baseType;
@@ -23,7 +23,7 @@ const getSchemaType = (valueOrRef) => {
23
23
  if (!valueOrRef) {
24
24
  return "";
25
25
  }
26
- const value = getResolvedRef(valueOrRef);
26
+ const value = resolve.schema(valueOrRef);
27
27
  if (value.const !== void 0) {
28
28
  return "const";
29
29
  }
@@ -47,12 +47,6 @@ const getSchemaType = (valueOrRef) => {
47
47
  if ("type" in value && value.type && value.contentEncoding) {
48
48
  return `${value.type} • ${value.contentEncoding}`;
49
49
  }
50
- if ("originalRef" in valueOrRef && valueOrRef.originalRef) {
51
- const refName = getRefName(valueOrRef.originalRef);
52
- if (refName) {
53
- return refName;
54
- }
55
- }
56
50
  if ("$ref" in valueOrRef) {
57
51
  const refName = getRefName(valueOrRef.$ref);
58
52
  if (refName) {
@@ -1 +1 @@
1
- {"version":3,"file":"merge-all-of-schemas.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/merge-all-of-schemas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAY,GAAG,SAAS,EAAE,aAAa,YAAY,KAAG,YA+ChG,CAAA"}
1
+ {"version":3,"file":"merge-all-of-schemas.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/merge-all-of-schemas.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAY,GAAG,SAAS,EAAE,aAAa,YAAY,KAAG,YA+ChG,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { objectKeys } from "@scalar/helpers/object/object-keys";
2
2
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { resolve } from "@scalar/workspace-store/resolve";
3
4
  import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
4
5
  const mergeAllOfSchemas = (schemas, rootSchema) => {
5
6
  if (!schemas?.allOf?.length || !Array.isArray(schemas.allOf)) {
@@ -11,7 +12,7 @@ const mergeAllOfSchemas = (schemas, rootSchema) => {
11
12
  if (!_schema || typeof _schema !== "object") {
12
13
  continue;
13
14
  }
14
- const schema = getResolvedRef(_schema);
15
+ const schema = resolve.schema(_schema);
15
16
  if (schema.allOf) {
16
17
  const nestedMerged = mergeAllOfSchemas(schema);
17
18
  mergeSchemaIntoResult(result, nestedMerged);
@@ -58,7 +59,7 @@ const mergeSchemaIntoResult = (result, schema, override = false) => {
58
59
  mergePropertiesIntoResult(result.properties, value);
59
60
  }
60
61
  } else if (key === "items") {
61
- const items = getResolvedRef(value);
62
+ const items = resolve.schema(value);
62
63
  if (items) {
63
64
  if (isArraySchema(schema)) {
64
65
  if (!result.items) {
@@ -92,8 +93,8 @@ const mergeSchemaIntoResult = (result, schema, override = false) => {
92
93
  result.properties = {};
93
94
  }
94
95
  for (const _option of value) {
95
- const option = getResolvedRef(_option);
96
- if (option.properties && "properties" in result) {
96
+ const option = resolve.schema(_option);
97
+ if (option && "properties" in option && "properties" in result) {
97
98
  mergePropertiesIntoResult(result.properties, option.properties);
98
99
  }
99
100
  }
@@ -113,7 +114,7 @@ const mergePropertiesIntoResult = (result, properties) => {
113
114
  return;
114
115
  }
115
116
  for (const key of propertyKeys) {
116
- const schema = getResolvedRef(properties[key]);
117
+ const schema = resolve.schema(properties[key]);
117
118
  if (!schema) {
118
119
  delete result[key];
119
120
  continue;
@@ -125,25 +126,25 @@ const mergePropertiesIntoResult = (result, properties) => {
125
126
  if (!result[key]) {
126
127
  if (schema.allOf) {
127
128
  result[key] = mergeAllOfSchemas(schema);
128
- } else if (isArraySchema(schema) && getResolvedRef(schema.items)?.allOf) {
129
+ } else if (isArraySchema(schema) && resolve.schema(schema.items)?.allOf) {
129
130
  result[key] = {
130
131
  ...schema,
131
- items: mergeAllOfSchemas(getResolvedRef(schema.items))
132
+ items: mergeAllOfSchemas(resolve.schema(schema.items))
132
133
  };
133
134
  } else if (properties[key]) {
134
135
  result[key] = properties[key];
135
136
  }
136
137
  continue;
137
138
  }
138
- const existing = getResolvedRef(result[key]);
139
+ const existing = resolve.schema(result[key]);
139
140
  if (schema.allOf) {
140
141
  result[key] = mergeAllOfSchemas({ allOf: [existing, ...schema.allOf] });
141
142
  } else if (isArraySchema(schema) && isArraySchema(existing) && schema.items) {
142
- const existingItems = getResolvedRef(existing.items);
143
+ const existingItems = resolve.schema(existing.items);
143
144
  result[key] = {
144
145
  ...existing,
145
146
  type: "array",
146
- items: existingItems ? mergeItems(existingItems, getResolvedRef(schema.items)) : getResolvedRef(schema.items)
147
+ items: existingItems ? mergeItems(existingItems, resolve.schema(schema.items)) : resolve.schema(schema.items)
147
148
  };
148
149
  } else {
149
150
  if ("properties" in existing && "properties" in schema) {
@@ -162,14 +163,14 @@ const mergeItemsIntoResult = (result, items) => {
162
163
  const allOfSchemas = [];
163
164
  if (result.allOf) {
164
165
  for (const schema of result.allOf) {
165
- allOfSchemas.push(getResolvedRef(schema));
166
+ allOfSchemas.push(resolve.schema(schema));
166
167
  }
167
168
  } else {
168
169
  allOfSchemas.push(result);
169
170
  }
170
171
  if (items.allOf) {
171
172
  for (const schema of items.allOf) {
172
- allOfSchemas.push(getResolvedRef(schema));
173
+ allOfSchemas.push(resolve.schema(schema));
173
174
  }
174
175
  } else {
175
176
  allOfSchemas.push(items);
@@ -188,14 +189,14 @@ const mergeItems = (existing, incoming) => {
188
189
  const allOfSchemas = [];
189
190
  if (existing.allOf) {
190
191
  for (const schema of existing.allOf) {
191
- allOfSchemas.push(getResolvedRef(schema));
192
+ allOfSchemas.push(resolve.schema(schema));
192
193
  }
193
194
  } else {
194
195
  allOfSchemas.push(existing);
195
196
  }
196
197
  if (incoming.allOf) {
197
198
  for (const schema of incoming.allOf) {
198
- allOfSchemas.push(getResolvedRef(schema));
199
+ allOfSchemas.push(resolve.schema(schema));
199
200
  }
200
201
  } else {
201
202
  allOfSchemas.push(incoming);
@@ -1,12 +1,8 @@
1
1
  import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** We need to keep the original ref after we resolve for display purposes */
3
- export type SchemaWithOriginalRef = SchemaObject & {
4
- originalRef?: string;
5
- };
6
2
  /**
7
3
  * Optimize the value by removing nulls from compositions and merging root properties.
8
4
  *
9
5
  * TODO: figure out what this does
10
6
  */
11
- export declare function optimizeValueForDisplay(value: SchemaObject | undefined): SchemaWithOriginalRef | undefined;
7
+ export declare function optimizeValueForDisplay(value: SchemaObject | undefined): SchemaObject | undefined;
12
8
  //# sourceMappingURL=optimize-value-for-display.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIhG,6EAA6E;AAC7E,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,qBAAqB,GAAG,SAAS,CA0F1G"}
1
+ {"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIhG;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAsFjG"}
@@ -1,4 +1,4 @@
1
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
1
+ import { resolve } from "@scalar/workspace-store/resolve";
2
2
  import { compositions } from "./schema-composition.js";
3
3
  function optimizeValueForDisplay(value) {
4
4
  if (!value || typeof value !== "object") {
@@ -16,11 +16,9 @@ function optimizeValueForDisplay(value) {
16
16
  const hasRootProperties = Object.keys(rootProperties).length > 0;
17
17
  const { filteredSchemas, hasNullSchema } = schemas.reduce(
18
18
  (acc, _schema) => {
19
- const schema = getResolvedRef(_schema);
19
+ const schema = resolve.schema(_schema);
20
20
  if ("type" in schema && schema.type === "null") {
21
21
  acc.hasNullSchema = true;
22
- } else if ("$ref" in _schema && _schema.$ref) {
23
- acc.filteredSchemas.push({ ...schema, originalRef: _schema.$ref });
24
22
  } else {
25
23
  acc.filteredSchemas.push(schema);
26
24
  }
@@ -39,10 +37,10 @@ function optimizeValueForDisplay(value) {
39
37
  const shouldMergeRootProperties = (composition === "oneOf" || composition === "anyOf") && (hasRootProperties || filteredSchemas.some((schema) => schema.allOf));
40
38
  if (shouldMergeRootProperties) {
41
39
  const mergedSchemas = filteredSchemas.map((_schema) => {
42
- const schema = getResolvedRef(_schema);
40
+ const schema = resolve.schema(_schema);
43
41
  if (schema.allOf?.length === 1) {
44
42
  const { allOf, ...otherProps } = schema;
45
- return { ...rootProperties, ...otherProps, ...getResolvedRef(allOf[0]) };
43
+ return { ...rootProperties, ...otherProps, ...resolve.schema(allOf[0]) };
46
44
  }
47
45
  return { ...rootProperties, ...schema };
48
46
  });
@@ -1,10 +1,10 @@
1
- import type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { SchemaObject, SchemaReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  /**
3
3
  * Extract schema name from various schema formats
4
4
  *
5
5
  * Handles $ref, title, name, type, and schema dictionary lookup
6
6
  */
7
- export declare const getModelNameFromSchema: (schemaOrRef: SchemaObject | ReferenceType<SchemaObject>) => string | null;
7
+ export declare const getModelNameFromSchema: (schemaOrRef: SchemaObject | SchemaReferenceType<SchemaObject>) => string | null;
8
8
  /**
9
9
  * Get the model name for a schema property
10
10
  * e.g. User | Admin | array of User | array of Admin
@@ -1 +1 @@
1
- {"version":3,"file":"schema-name.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/schema-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAK/G;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,KAAG,MAAM,GAAG,IAyBzG,CAAA;AAQD;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,EAAE,wBAAsB,KAAG,MAAM,GAAG,IA+CnF,CAAA"}
1
+ {"version":3,"file":"schema-name.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/schema-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AAKrH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,aAAa,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC,KAC5D,MAAM,GAAG,IAyBX,CAAA;AAQD;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,EAAE,wBAAsB,KAAG,MAAM,GAAG,IA+CnF,CAAA"}
@@ -1,4 +1,4 @@
1
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
1
+ import { resolve } from "@scalar/workspace-store/resolve";
2
2
  import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
3
3
  import { getRefName } from "./get-ref-name.js";
4
4
  const getModelNameFromSchema = (schemaOrRef) => {
@@ -11,7 +11,7 @@ const getModelNameFromSchema = (schemaOrRef) => {
11
11
  return refName;
12
12
  }
13
13
  }
14
- const schema = getResolvedRef(schemaOrRef);
14
+ const schema = resolve.schema(schemaOrRef);
15
15
  if (schema.title) {
16
16
  return schema.title;
17
17
  }
@@ -31,12 +31,12 @@ const getModelName = (value, hideModelNames = false) => {
31
31
  return valueType === "array" ? `array ${modelName}[]` : modelName;
32
32
  }
33
33
  if (isArraySchema(value) && value.items) {
34
- const items = getResolvedRef(value.items);
34
+ const items = resolve.schema(value.items);
35
35
  const itemName = items.title;
36
36
  if (itemName) {
37
37
  return formatTypeWithModel(valueType, itemName);
38
38
  }
39
- const itemModelName = getModelNameFromSchema(value.items);
39
+ const itemModelName = getModelNameFromSchema(items);
40
40
  if (itemModelName && "type" in items && itemModelName !== items.type) {
41
41
  return formatTypeWithModel(valueType, itemModelName);
42
42
  }
@@ -1,4 +1,4 @@
1
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
1
+ import { resolve } from "@scalar/workspace-store/resolve";
2
2
  import { isTypeObject } from "./is-type-object.js";
3
3
  const reduceNamesToObject = (names, properties) => names.reduce((acc, name) => {
4
4
  const prop = properties?.[name];
@@ -42,7 +42,7 @@ const sortPropertyNames = (schema, discriminator, {
42
42
  }
43
43
  return 0;
44
44
  }).filter((property) => {
45
- const resolved = schema.properties && getResolvedRef(schema.properties[property]);
45
+ const resolved = schema.properties && resolve.schema(schema.properties[property]);
46
46
  if (hideReadOnly && resolved?.readOnly === true) {
47
47
  return false;
48
48
  }
@@ -3,6 +3,7 @@ import type { MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-
3
3
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
4
4
  import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
5
5
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
6
+ import type { AuthStore } from '@scalar/workspace-store/entities/auth';
6
7
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
7
8
  import type { OpenApiDocument, PathItemObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
8
9
  /**
@@ -29,8 +30,13 @@ export type OperationProps = {
29
30
  clientOptions: ClientOptionGroup[];
30
31
  /** Whether the Classic layout operation is collapsed */
31
32
  isCollapsed: boolean;
33
+ /** Whether the operation is a webhook */
32
34
  isWebhook: boolean;
35
+ /** The currently selected client for the document */
33
36
  selectedClient: WorkspaceStore['workspace']['x-scalar-default-client'];
37
+ /** The event bus */
34
38
  eventBus: WorkspaceEventBus;
39
+ /** The auth store */
40
+ authStore: AuthStore;
35
41
  };
36
42
  //# sourceMappingURL=Operation.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAA;AAEpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,8DAA8D,CAAA;AAUrE;;GAEG;;AACH,wBA+JI;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,UAAU,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC1B,oBAAoB,GACpB,uBAAuB,GACvB,QAAQ,GACR,8BAA8B,GAC9B,yBAAyB,GACzB,iBAAiB,CACpB,CAAA;IACD,sBAAsB;IACtB,QAAQ,EAAE,eAAe,CAAA;IACzB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,SAAS,EAAE,cAAc,GAAG,SAAS,CAAA;IACrC,iDAAiD;IACjD,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,wFAAwF;IACxF,eAAe,EAAE,qBAAqB,CAAA;IACtC,+CAA+C;IAC/C,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACtE,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CACA"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAsKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAA;AAEpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,8DAA8D,CAAA;AAUrE;;GAEG;;AACH,wBA+KI;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,UAAU,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC1B,oBAAoB,GACpB,uBAAuB,GACvB,QAAQ,GACR,8BAA8B,GAC9B,yBAAyB,GACzB,iBAAiB,CACpB,CAAA;IACD,sBAAsB;IACtB,QAAQ,EAAE,eAAe,CAAA;IACzB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,SAAS,EAAE,cAAc,GAAG,SAAS,CAAA;IACrC,iDAAiD;IACjD,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,wFAAwF;IACxF,eAAe,EAAE,qBAAqB,CAAA;IACtC,+CAA+C;IAC/C,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAA;IACpB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACtE,oBAAoB;IACpB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,qBAAqB;IACrB,SAAS,EAAE,SAAS,CAAA;CACrB,CACA"}
@@ -22,7 +22,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
22
  isCollapsed: { type: Boolean },
23
23
  isWebhook: { type: Boolean },
24
24
  selectedClient: {},
25
- eventBus: {}
25
+ eventBus: {},
26
+ authStore: {}
26
27
  },
27
28
  setup(__props) {
28
29
  const operation = computed(() => {
@@ -44,7 +45,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
45
  )
45
46
  );
46
47
  const selectedSecuritySchemes = computed(
47
- () => filterSelectedSecurity(__props.document, operation.value, __props.securitySchemes)
48
+ () => filterSelectedSecurity(
49
+ __props.document,
50
+ operation.value,
51
+ __props.authStore.getAuthSelectedSchemas({
52
+ type: "document",
53
+ documentName: __props.document?.["x-scalar-navigation"]?.name ?? ""
54
+ }),
55
+ __props.authStore.getAuthSelectedSchemas({
56
+ type: "operation",
57
+ documentName: __props.document?.["x-scalar-navigation"]?.name ?? "",
58
+ path: __props.path,
59
+ method: __props.method
60
+ }),
61
+ __props.securitySchemes
62
+ )
48
63
  );
49
64
  return (_ctx, _cache) => {
50
65
  return operation.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
@@ -1,9 +1,10 @@
1
- import type { MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
2
- import type { OpenApiDocument, OperationObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { MergedSecuritySchemes, SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
2
+ import type { SelectedSecurity } from '@scalar/workspace-store/entities/auth';
3
+ import type { OpenApiDocument, OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
4
  /**
4
5
  * Find the intersection between which security is selected on the document and what this operation requires
5
6
  *
6
7
  * If there is no overlap, we return the first requirement
7
8
  */
8
- export declare const filterSelectedSecurity: (document: OpenApiDocument, operation: OperationObject | null, securitySchemes?: MergedSecuritySchemes) => SecuritySchemeObject[];
9
+ export declare const filterSelectedSecurity: (document: OpenApiDocument, operation: OperationObject | null, selectedSecurityDocument?: SelectedSecurity, selectedSecurityOperation?: SelectedSecurity, securitySchemes?: MergedSecuritySchemes) => SecuritySchemeObjectSecret[];
9
10
  //# sourceMappingURL=filter-selected-security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-selected-security.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/helpers/filter-selected-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAA;AAEpG,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEf,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAKrE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,eAAe,EACzB,WAAW,eAAe,GAAG,IAAI,EACjC,kBAAiB,qBAA0B,KAC1C,oBAAoB,EAkCtB,CAAA"}
1
+ {"version":3,"file":"filter-selected-security.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/helpers/filter-selected-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,yDAAyD,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAKrE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,eAAe,EACzB,WAAW,eAAe,GAAG,IAAI,EACjC,2BAA2B,gBAAgB,EAC3C,4BAA4B,gBAAgB,EAC5C,kBAAiB,qBAA0B,KAC1C,0BAA0B,EA+B5B,CAAA"}
@@ -1,12 +1,9 @@
1
1
  import { getSecuritySchemes } from "@scalar/api-client/v2/blocks/operation-block";
2
2
  import { getSelectedSecurity } from "@scalar/api-client/v2/features/operation";
3
3
  const getKey = (requirement) => Object.keys(requirement).sort().join(",");
4
- const filterSelectedSecurity = (document, operation, securitySchemes = {}) => {
4
+ const filterSelectedSecurity = (document, operation, selectedSecurityDocument, selectedSecurityOperation, securitySchemes = {}) => {
5
5
  const securityRequirements = operation?.security ?? document.security ?? [];
6
- const selectedSecurity = getSelectedSecurity(
7
- document?.["x-scalar-selected-security"],
8
- operation?.["x-scalar-selected-security"]
9
- );
6
+ const selectedSecurity = getSelectedSecurity(selectedSecurityDocument, selectedSecurityOperation);
10
7
  const requirementSet = new Set(securityRequirements.map((r) => getKey(r)));
11
8
  const selectedRequirement = selectedSecurity.selectedSchemes[selectedSecurity.selectedIndex];
12
9
  if (selectedRequirement && requirementSet.has(getKey(selectedRequirement))) {
@@ -1,12 +1,13 @@
1
- import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
2
+ import type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
3
  import type { OperationProps } from '../../../features/Operation/Operation.vue.js';
3
- type __VLS_Props = Omit<OperationProps, 'document' | 'pathValue' | 'server' | 'securitySchemes'> & {
4
+ type __VLS_Props = Omit<OperationProps, 'document' | 'pathValue' | 'server' | 'securitySchemes' | 'authStore'> & {
4
5
  /** Operation object with path params */
5
6
  operation: OperationObject;
6
7
  /** The selected server for the operation */
7
8
  selectedServer: ServerObject | null;
8
9
  /** The selected security schemes for the operation */
9
- selectedSecuritySchemes: SecuritySchemeObject[];
10
+ selectedSecuritySchemes: SecuritySchemeObjectSecret[];
10
11
  };
11
12
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
13
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ClassicLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ClassicLayout.vue"],"names":[],"mappings":"AA4fA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAcrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,KAAK,WAAW,GAAG,IAAI,CACnB,cAAc,EACd,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,iBAAiB,CACxD,GAAG;IACF,wCAAwC;IACxC,SAAS,EAAE,eAAe,CAAA;IAC1B,4CAA4C;IAC5C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,sDAAsD;IACtD,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,CAAC;;AAqkBJ,wBAMG"}
1
+ {"version":3,"file":"ClassicLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ClassicLayout.vue"],"names":[],"mappings":"AA2eA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAA;AAkBzG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAcrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,KAAK,WAAW,GAAG,IAAI,CACnB,cAAc,EACd,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,iBAAiB,GAAG,WAAW,CACtE,GAAG;IACF,wCAAwC;IACxC,SAAS,EAAE,eAAe,CAAA;IAC1B,4CAA4C;IAC5C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,sDAAsD;IACtD,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;CACtD,CAAC;;AAqkBJ,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./ClassicLayout.vue2.js";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const ClassicLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8a5966f4"]]);
4
+ const ClassicLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7a9e67c3"]]);
5
5
  export {
6
6
  ClassicLayout as default
7
7
  };
@@ -1,12 +1,13 @@
1
- import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
2
+ import type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
3
  import type { OperationProps } from '../../../features/Operation/Operation.vue.js';
3
- type __VLS_Props = Omit<OperationProps, 'document' | 'pathValue' | 'server' | 'isCollapsed' | 'securitySchemes'> & {
4
+ type __VLS_Props = Omit<OperationProps, 'document' | 'pathValue' | 'server' | 'isCollapsed' | 'securitySchemes' | 'authStore'> & {
4
5
  /** Operation object with path params */
5
6
  operation: OperationObject;
6
7
  /** The selected server for the operation */
7
8
  selectedServer: ServerObject | null;
8
9
  /** The selected security schemes for the operation */
9
- selectedSecuritySchemes: SecuritySchemeObject[];
10
+ selectedSecuritySchemes: SecuritySchemeObjectSecret[];
10
11
  };
11
12
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
13
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"names":[],"mappings":"AA2PA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAqBrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,KAAK,WAAW,GAAG,IAAI,CACnB,cAAc,EACd,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,iBAAiB,CACxE,GAAG;IACF,wCAAwC;IACxC,SAAS,EAAE,eAAe,CAAA;IAC1B,4CAA4C;IAC5C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,sDAAsD;IACtD,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,CAAC;;AA8fJ,wBAMG"}
1
+ {"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"names":[],"mappings":"AAwPA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAA;AASzG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAqBrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,KAAK,WAAW,GAAG,IAAI,CACnB,cAAc,EACZ,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,GACb,iBAAiB,GACjB,WAAW,CACd,GAAG;IACF,wCAAwC;IACxC,SAAS,EAAE,eAAe,CAAA;IAC1B,4CAA4C;IAC5C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,sDAAsD;IACtD,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;CACtD,CAAC;;AA8fJ,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./ModernLayout.vue2.js";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const ModernLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e67d0b83"]]);
4
+ const ModernLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1464254e"]]);
5
5
  export {
6
6
  ModernLayout as default
7
7
  };
@@ -5,28 +5,8 @@ import type { WorkspaceStore } from '@scalar/workspace-store/client';
5
5
  */
6
6
  export declare const loadClientFromStorage: (store: WorkspaceStore) => void;
7
7
  /**
8
- * Checks if a key is a Scalar secret key.
9
- * Secret keys start with 'x-scalar-secret-' prefix.
8
+ * Loads the authentication data from storage and applies it to the workspace.
9
+ * Only updates if no authentication data is already set.
10
10
  */
11
- export declare const isSecretKey: (key: string) => boolean;
12
- /**
13
- * Recursively merges secret values from stored data into the current schema.
14
- * Only merges secrets if the corresponding structure exists in the current schema.
15
- *
16
- * This function walks through both objects in parallel, copying any keys that
17
- * start with 'x-scalar-secret-' from the stored object to the current object,
18
- * but only if the path exists in the current schema.
19
- *
20
- * @param current - The current schema object (source of truth for structure)
21
- * @param stored - The stored object containing secret values to restore
22
- */
23
- export declare const mergeSecuritySchemas: (current: unknown, stored: unknown, level?: number) => void;
24
- /**
25
- * Loads authentication schemes and selected security settings from local storage.
26
- *
27
- * This function restores both the available security schemes and the user's
28
- * selected security configuration for the active document. It validates that
29
- * the stored schemes still exist in the current document before restoring them.
30
- */
31
- export declare const loadAuthSchemesFromStorage: (store: WorkspaceStore) => void;
11
+ export declare const loadAuthFromStorage: (store: WorkspaceStore, slug: string) => void;
32
12
  //# sourceMappingURL=load-from-perssistance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-from-perssistance.d.ts","sourceRoot":"","sources":["../../src/helpers/load-from-perssistance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAYpE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,cAAc,KAAG,IAM7D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,OAA4C,CAAA;AAEtF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,QAAQ,OAAO,EAAE,QAAO,MAAU,KAAG,IAyB3F,CAAA;AA4CD;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,cAAc,KAAG,IAiClE,CAAA"}
1
+ {"version":3,"file":"load-from-perssistance.d.ts","sourceRoot":"","sources":["../../src/helpers/load-from-perssistance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIpE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,cAAc,KAAG,IAM7D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,cAAc,EAAE,MAAM,MAAM,KAAG,IAIzE,CAAA"}
@@ -1,6 +1,4 @@
1
1
  import { isClient } from "@scalar/api-client/v2/blocks/operation-code-sample";
2
- import { isObject } from "@scalar/helpers/object/is-object";
3
- import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
2
  import { clientStorage, authStorage } from "./storage.js";
5
3
  const loadClientFromStorage = (store) => {
6
4
  const storedClient = clientStorage().get();
@@ -8,66 +6,12 @@ const loadClientFromStorage = (store) => {
8
6
  store.update("x-scalar-default-client", storedClient);
9
7
  }
10
8
  };
11
- const mergeSecuritySchemas = (current, stored, level = 0) => {
12
- if (!isObject(current) || !isObject(stored)) {
13
- return;
14
- }
15
- for (const [key, storedValue] of Object.entries(stored)) {
16
- if (level === 0 && key === "type") {
17
- continue;
18
- }
19
- if (typeof storedValue === "string" && storedValue !== "" || typeof storedValue === "number" || typeof storedValue === "boolean") {
20
- current[key] = storedValue;
21
- continue;
22
- }
23
- mergeSecuritySchemas(getResolvedRef(current[key]), storedValue, level + 1);
24
- }
25
- };
26
- const restoreAuthSecretsFromStorage = (store) => {
27
- const slug = store.workspace["x-scalar-active-document"];
28
- const activeDocument = store.workspace.activeDocument;
29
- if (!activeDocument || !slug) {
30
- console.warn("Active document not found in workspace, skipping auth secrets loading");
31
- return;
32
- }
33
- const securitySchemes = activeDocument.components?.securitySchemes ?? {};
34
- const storedAuthSchemes = authStorage().getSchemas(slug);
35
- for (const [key, storedScheme] of Object.entries(storedAuthSchemes)) {
36
- const currentScheme = getResolvedRef(securitySchemes[key]);
37
- if (isObject(currentScheme)) {
38
- mergeSecuritySchemas(currentScheme, storedScheme);
39
- }
40
- }
41
- };
42
- const isSchemeValid = (scheme, availableSchemes) => Object.keys(scheme).every((key) => availableSchemes.has(key));
43
- const clampSelectedIndex = (selectedIndex, schemesLength) => selectedIndex >= schemesLength ? schemesLength - 1 : selectedIndex;
44
- const loadAuthSchemesFromStorage = (store) => {
45
- const slug = store.workspace["x-scalar-active-document"];
46
- const activeDocument = store.workspace.activeDocument;
47
- if (!activeDocument || !slug) {
48
- console.warn("Active document not found in workspace, skipping auth schemes loading");
49
- return;
50
- }
9
+ const loadAuthFromStorage = (store, slug) => {
51
10
  const authPersistence = authStorage();
52
- const storedSelectedAuthSchemes = authPersistence.getSelectedSchemes(slug);
53
- restoreAuthSecretsFromStorage(store);
54
- if (activeDocument["x-scalar-selected-security"] !== void 0) {
55
- return;
56
- }
57
- const availableSchemes = new Set(Object.keys(activeDocument.components?.securitySchemes ?? {}));
58
- const selectedSchemes = storedSelectedAuthSchemes["x-scalar-selected-security"]?.selectedSchemes;
59
- const validSchemes = selectedSchemes?.filter((scheme) => isSchemeValid(scheme, availableSchemes));
60
- if (validSchemes && validSchemes.length > 0) {
61
- const selectedIndex = storedSelectedAuthSchemes["x-scalar-selected-security"]?.selectedIndex ?? 0;
62
- const clampedIndex = clampSelectedIndex(selectedIndex, validSchemes.length);
63
- activeDocument["x-scalar-selected-security"] = {
64
- selectedIndex: clampedIndex,
65
- selectedSchemes: validSchemes
66
- };
67
- }
11
+ const auth = authPersistence.getAuth(slug);
12
+ store.auth.load({ [slug]: auth });
68
13
  };
69
14
  export {
70
- loadAuthSchemesFromStorage,
71
- loadClientFromStorage,
72
- mergeSecuritySchemas
15
+ loadAuthFromStorage,
16
+ loadClientFromStorage
73
17
  };