@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 +1 @@
1
- {"version":3,"file":"ApiReference.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiReference.vue"],"names":[],"mappings":"AAqsCA,OAAO,EAEL,KAAK,4BAA4B,EAGlC,MAAM,6BAA6B,CAAA;AA4BpC,OAAO,8BAA8B,CAAA;AAiCrC,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,4BAA4B,CAAA;CAC7C,CAAC;AAGF,KAAK,WAAW,GAAG;IACjB,eAAe,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,aAAa,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,eAAe,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,aAAa,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,oBAAoB,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,MAAM,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC,CAAC;AA6vCF,QAAA,MAAM,eAAe;;;oPAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ApiReference.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiReference.vue"],"names":[],"mappings":"AAssCA,OAAO,EAEL,KAAK,4BAA4B,EAGlC,MAAM,6BAA6B,CAAA;AA4BpC,OAAO,8BAA8B,CAAA;AAiCrC,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,4BAA4B,CAAA;CAC7C,CAAC;AAGF,KAAK,WAAW,GAAG;IACjB,eAAe,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,aAAa,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,eAAe,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,aAAa,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,oBAAoB,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,MAAM,CAAC,IAAI;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC,CAAC;AA+vCF,QAAA,MAAM,eAAe;;;oPAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -4,7 +4,7 @@ import _sfc_main from "./ApiReference.vue2.js";
4
4
  /* empty css */
5
5
  /* empty css */
6
6
  import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
7
- const ApiReference = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-99c427c5"]]);
7
+ const ApiReference = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8a22e3d2"]]);
8
8
  export {
9
9
  ApiReference as default
10
10
  };
@@ -30,7 +30,7 @@ import { getSystemModePreference } from "../helpers/color-mode.js";
30
30
  import { downloadDocument } from "../helpers/download.js";
31
31
  import { getIdFromUrl, makeUrlFromId } from "../helpers/id-routing.js";
32
32
  import { intersectionEnabled, scrollToLazy, blockIntersection } from "../helpers/lazy-bus.js";
33
- import { loadClientFromStorage, loadAuthSchemesFromStorage } from "../helpers/load-from-perssistance.js";
33
+ import { loadClientFromStorage, loadAuthFromStorage } from "../helpers/load-from-perssistance.js";
34
34
  import { mapConfigPlugins } from "../helpers/map-config-plugins.js";
35
35
  import { mapConfigToWorkspaceStore } from "../helpers/map-config-to-workspace-store.js";
36
36
  import { normalizeConfigurations } from "../helpers/normalize-configurations.js";
@@ -301,7 +301,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
301
301
  }
302
302
  workspaceStore.update("x-scalar-active-document", slug);
303
303
  if (config.persistAuth) {
304
- loadAuthSchemesFromStorage(workspaceStore);
304
+ loadAuthFromStorage(workspaceStore, slug);
305
305
  }
306
306
  void (async () => {
307
307
  await onDocumentSelectPromise;
@@ -622,6 +622,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
622
622
  class: "references-rendered"
623
623
  }, [
624
624
  createVNode(_sfc_main$5, {
625
+ authStore: unref(workspaceStore).auth,
625
626
  document: unref(workspaceStore).workspace.activeDocument,
626
627
  environment: environment.value,
627
628
  eventBus: unref(eventBus),
@@ -689,7 +690,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
689
690
  ]),
690
691
  key: "0"
691
692
  } : void 0
692
- ]), 1032, ["document", "environment", "eventBus", "expandedItems", "headingSlugGenerator", "infoSectionId", "items", "options", "xScalarDefaultClient"])
693
+ ]), 1032, ["authStore", "document", "environment", "eventBus", "expandedItems", "headingSlugGenerator", "infoSectionId", "items", "options", "xScalarDefaultClient"])
693
694
  ], 8, _hoisted_3),
694
695
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_5, [
695
696
  renderSlot(_ctx.$slots, "footer", normalizeProps(guardReactiveProps(slotProps.value)), void 0, true)
@@ -1,11 +1,13 @@
1
1
  import { type MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
2
2
  import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
3
+ import type { AuthStore } from '@scalar/workspace-store/entities/auth';
3
4
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
5
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
5
6
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
6
7
  import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
7
8
  type __VLS_Props = {
8
9
  options: Pick<ApiReferenceConfigurationRaw, 'authentication' | 'persistAuth' | 'proxyUrl'>;
10
+ authStore: AuthStore;
9
11
  document: WorkspaceDocument | undefined;
10
12
  eventBus: WorkspaceEventBus;
11
13
  securitySchemes: MergedSecuritySchemes;
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Auth/Auth.vue"],"names":[],"mappings":"AAyFA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,yDAAyD,CAAA;AAKhE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAKlF,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC5B,gBAAgB,GAAG,aAAa,GAAG,UAAU,CAC9C,CAAA;IACD,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACvC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;AA6GJ,wBAMG"}
1
+ {"version":3,"file":"Auth.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Auth/Auth.vue"],"names":[],"mappings":"AAmGA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,yDAAyD,CAAA;AAKhE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAKlF,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC5B,gBAAgB,GAAG,aAAa,GAAG,UAAU,CAC9C,CAAA;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACvC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;AAqHJ,wBAMG"}
@@ -6,6 +6,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "Auth",
7
7
  props: {
8
8
  options: {},
9
+ authStore: {},
9
10
  document: {},
10
11
  eventBus: {},
11
12
  securitySchemes: {},
@@ -16,17 +17,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16
17
  const securityRequirements = computed(
17
18
  () => getSecurityRequirements(__props.document?.security)
18
19
  );
20
+ const documentSelectedSecurity = computed(
21
+ () => __props.authStore.getAuthSelectedSchemas({
22
+ type: "document",
23
+ documentName: __props.document?.["x-scalar-navigation"]?.name ?? ""
24
+ })
25
+ );
19
26
  const selectedSecurity = computed(
20
27
  () => getSelectedSecurity(
21
- __props.document?.["x-scalar-selected-security"],
28
+ documentSelectedSecurity.value,
22
29
  void 0,
23
30
  securityRequirements.value
24
31
  )
25
32
  );
26
33
  watch(
27
- () => __props.document?.["x-scalar-selected-security"],
28
- (documentSelectedSecurity) => {
29
- if (typeof documentSelectedSecurity !== "undefined") {
34
+ documentSelectedSecurity,
35
+ (newDocumentSelectedSecurity) => {
36
+ if (typeof newDocumentSelectedSecurity !== "undefined") {
30
37
  return;
31
38
  }
32
39
  const defaultSecurity = getDefaultSecurity(
@@ -1,5 +1,6 @@
1
1
  import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
2
2
  import type { Heading } from '@scalar/types/legacy';
3
+ import type { AuthStore } from '@scalar/workspace-store/entities/auth';
3
4
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
5
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
5
6
  import type { TraversedEntry as TraversedEntryType } from '@scalar/workspace-store/schemas/navigation';
@@ -9,6 +10,7 @@ type __VLS_Props = {
9
10
  /** The subset of the configuration object required for the content component */
10
11
  options: Pick<ApiReferenceConfigurationRaw, 'authentication' | 'baseServerURL' | 'documentDownloadType' | 'expandAllResponses' | 'hiddenClients' | 'hideTestRequestButton' | 'layout' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy' | 'persistAuth' | 'proxyUrl' | 'servers' | 'showOperationId'>;
11
12
  document: WorkspaceDocument | undefined;
13
+ authStore: AuthStore;
12
14
  xScalarDefaultClient: Workspace['x-scalar-default-client'];
13
15
  items: TraversedEntryType[];
14
16
  expandedItems: Record<string, boolean>;
@@ -1 +1 @@
1
- {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AS,GACT,iBAAiB,CACpB,CAAA;IACD,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACvC,SAAS,EAAE,SAAS,CAAA;IACpB,oBAAoB,EAAE,SAAS,CAAC,yBAAyB,CAAC,CAAA;IAC1D,KAAK,EAAE,kBAAkB,EAAE,CAAA;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,iDAAiD;IACjD,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;CACnD,CAAC;AAmSJ,QAAA,IAAI,OAAO,IAAU,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AAClE,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACnD;IAAE,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAmC5C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, Fragment, createVNode, createElementVNode, unref, renderSlot, createBlock, createCommentVNode, withCtx } from "vue";
2
2
  import { generateClientOptions } from "@scalar/api-client/v2/blocks/operation-code-sample";
3
- import { mergeAuthConfig } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
3
+ import { mergeSecurity } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
4
4
  import { mapHiddenClientsConfig } from "@scalar/api-client/v2/features/modal";
5
5
  import { getSelectedServer } from "@scalar/api-client/v2/features/operation";
6
6
  import { getServers } from "@scalar/api-client/v2/helpers";
@@ -27,6 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  infoSectionId: {},
28
28
  options: {},
29
29
  document: {},
30
+ authStore: {},
30
31
  xScalarDefaultClient: {},
31
32
  items: {},
32
33
  expandedItems: {},
@@ -50,9 +51,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
50
51
  () => getSelectedServer(__props.document ?? null, servers.value)
51
52
  );
52
53
  const securitySchemes = computed(
53
- () => mergeAuthConfig(
54
+ () => mergeSecurity(
54
55
  __props.document?.components?.securitySchemes,
55
- __props.options.authentication?.securitySchemes
56
+ __props.options.authentication?.securitySchemes,
57
+ __props.authStore,
58
+ __props.document?.["x-scalar-navigation"]?.name ?? ""
56
59
  )
57
60
  );
58
61
  return (_ctx, _cache) => {
@@ -104,13 +107,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
104
107
  }, {
105
108
  default: withCtx(() => [
106
109
  createVNode(unref(_sfc_main$4), {
110
+ authStore: __props.authStore,
107
111
  document: __props.document,
108
112
  environment: __props.environment,
109
113
  eventBus: __props.eventBus,
110
114
  options: __props.options,
111
115
  securitySchemes: securitySchemes.value,
112
116
  selectedServer: selectedServer.value
113
- }, null, 8, ["document", "environment", "eventBus", "options", "securitySchemes", "selectedServer"])
117
+ }, null, 8, ["authStore", "document", "environment", "eventBus", "options", "securitySchemes", "selectedServer"])
114
118
  ]),
115
119
  _: 1
116
120
  })) : createCommentVNode("", true)
@@ -145,6 +149,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
145
149
  }, 8, ["id"]),
146
150
  __props.items.length && __props.document ? (openBlock(), createBlock(_sfc_main$5, {
147
151
  key: 0,
152
+ authStore: __props.authStore,
148
153
  clientOptions: clientOptions.value,
149
154
  document: __props.document,
150
155
  entries: __props.items,
@@ -154,7 +159,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
154
159
  securitySchemes: securitySchemes.value,
155
160
  selectedClient: __props.xScalarDefaultClient,
156
161
  selectedServer: selectedServer.value
157
- }, null, 8, ["clientOptions", "document", "entries", "eventBus", "expandedItems", "options", "securitySchemes", "selectedClient", "selectedServer"])) : createCommentVNode("", true),
162
+ }, null, 8, ["authStore", "clientOptions", "document", "entries", "eventBus", "expandedItems", "options", "securitySchemes", "selectedClient", "selectedServer"])) : createCommentVNode("", true),
158
163
  createVNode(unref(_sfc_main$6), {
159
164
  options: __props.options,
160
165
  viewName: "content.end"
@@ -2,11 +2,14 @@ import type { ClientOptionGroup } from '@scalar/api-client/v2/blocks/operation-c
2
2
  import type { MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
3
3
  import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
4
4
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
5
+ import type { AuthStore } from '@scalar/workspace-store/entities/auth';
5
6
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
6
7
  import type { WorkspaceDocument } from '@scalar/workspace-store/schemas';
7
8
  import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
8
9
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
9
10
  type __VLS_Props = {
11
+ /** The auth store */
12
+ authStore: AuthStore;
10
13
  /** The level of depth */
11
14
  level?: number;
12
15
  /** Traversed entries to render */
@@ -1 +1 @@
1
- {"version":3,"file":"TraversedEntry.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Operations/TraversedEntry.vue"],"names":[],"mappings":"AAmMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAA;AACpG,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,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,4CAA4C,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAShG,KAAK,WAAW,GAAG;IACjB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,0BAA0B;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,+CAA+C;IAC/C,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,kFAAkF;IAClF,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC1B,oBAAoB,GACpB,uBAAuB,GACvB,QAAQ,GACR,8BAA8B,GAC9B,yBAAyB,GACzB,iBAAiB,CACpB,CAAA;IACD,iDAAiD;IACjD,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,wFAAwF;IACxF,eAAe,EAAE,qBAAqB,CAAA;IACtC,sDAAsD;IACtD,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACtE,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,iDAAiD;IACjD,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;;AA8RF,wBAMG"}
1
+ {"version":3,"file":"TraversedEntry.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Operations/TraversedEntry.vue"],"names":[],"mappings":"AA2MA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAC3F,OAAO,KAAK,EAAE,qBA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../Tags/Tag.vue.js";
9
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
10
  __name: "TraversedEntry",
11
11
  props: {
12
+ authStore: {},
12
13
  level: { default: 0 },
13
14
  entries: {},
14
15
  document: {},
@@ -45,6 +46,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
46
  default: withCtx(() => [
46
47
  createVNode(unref(_sfc_main$2), {
47
48
  id: entry.id,
49
+ authStore: __props.authStore,
48
50
  clientOptions: __props.clientOptions,
49
51
  document: __props.document,
50
52
  eventBus: __props.eventBus,
@@ -57,7 +59,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
59
  securitySchemes: __props.securitySchemes,
58
60
  selectedClient: __props.selectedClient,
59
61
  server: __props.selectedServer
60
- }, null, 8, ["id", "clientOptions", "document", "eventBus", "isCollapsed", "isWebhook", "method", "options", "path", "pathValue", "securitySchemes", "selectedClient", "server"])
62
+ }, null, 8, ["id", "authStore", "clientOptions", "document", "eventBus", "isCollapsed", "isWebhook", "method", "options", "path", "pathValue", "securitySchemes", "selectedClient", "server"])
61
63
  ]),
62
64
  _: 2
63
65
  }, 1032, ["omit"])) : isTag(entry) ? (openBlock(), createBlock(unref(_sfc_main$3), {
@@ -72,6 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
72
74
  default: withCtx(() => [
73
75
  "children" in entry && entry.children?.length ? (openBlock(), createBlock(_component_TraversedEntry, {
74
76
  key: 0,
77
+ authStore: __props.authStore,
75
78
  clientOptions: __props.clientOptions,
76
79
  document: __props.document,
77
80
  entries: entry.children,
@@ -82,11 +85,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
82
85
  securitySchemes: __props.securitySchemes,
83
86
  selectedClient: __props.selectedClient,
84
87
  selectedServer: __props.selectedServer
85
- }, null, 8, ["clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])) : createCommentVNode("", true)
88
+ }, null, 8, ["authStore", "clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])) : createCommentVNode("", true)
86
89
  ]),
87
90
  _: 2
88
91
  }, 1032, ["eventBus", "isCollapsed", "layout", "moreThanOneTag", "tag"])) : isTagGroup(entry) ? (openBlock(), createBlock(_component_TraversedEntry, {
89
92
  key: 2,
93
+ authStore: __props.authStore,
90
94
  clientOptions: __props.clientOptions,
91
95
  document: __props.document,
92
96
  entries: entry.children || [],
@@ -97,7 +101,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
97
101
  securitySchemes: __props.securitySchemes,
98
102
  selectedClient: __props.selectedClient,
99
103
  selectedServer: __props.selectedServer
100
- }, null, 8, ["clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])) : isModelsTag(entry) && __props.document.components?.schemas ? (openBlock(), createBlock(_sfc_main$4, {
104
+ }, null, 8, ["authStore", "clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])) : isModelsTag(entry) && __props.document.components?.schemas ? (openBlock(), createBlock(_sfc_main$4, {
101
105
  key: 3,
102
106
  id: entry.id,
103
107
  eventBus: __props.eventBus,
@@ -106,6 +110,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
106
110
  }, {
107
111
  default: withCtx(() => [
108
112
  createVNode(_component_TraversedEntry, {
113
+ authStore: __props.authStore,
109
114
  clientOptions: __props.clientOptions,
110
115
  document: __props.document,
111
116
  entries: entry.children || [],
@@ -116,7 +121,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
116
121
  securitySchemes: __props.securitySchemes,
117
122
  selectedClient: __props.selectedClient,
118
123
  selectedServer: __props.selectedServer
119
- }, null, 8, ["clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])
124
+ }, null, 8, ["authStore", "clientOptions", "document", "entries", "eventBus", "expandedItems", "level", "options", "securitySchemes", "selectedClient", "selectedServer"])
120
125
  ]),
121
126
  _: 2
122
127
  }, 1032, ["id", "eventBus", "isCollapsed", "layout"])) : isModel(entry) && __props.document.components?.schemas?.[entry.name] ? (openBlock(), createBlock(_sfc_main$5, {
@@ -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,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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
  };