@scalar/api-reference 1.43.8 → 1.43.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.md +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts.map +1 -1
- package/dist/browser/standalone.js +14630 -14139
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue2.js +8 -3
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts +2 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-name.d.ts +0 -6
- package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-name.js +0 -1
- package/dist/components/Content/index.d.ts +0 -1
- package/dist/components/Content/index.d.ts.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.js +1 -1
- package/dist/features/toolbar/ApiReferenceToolbarSdks.vue.js +1 -1
- package/dist/features/toolbar/ApiReferenceToolbarShareRegister.vue.js +1 -1
- package/dist/helpers/lazy-bus.d.ts +0 -1
- package/dist/helpers/lazy-bus.d.ts.map +1 -1
- package/dist/helpers/lazy-bus.js +0 -1
- package/dist/helpers/load-from-perssistance.d.ts +1 -1
- package/dist/helpers/load-from-perssistance.d.ts.map +1 -1
- package/dist/helpers/load-from-perssistance.js +12 -13
- package/dist/helpers/markdown.d.ts +0 -7
- package/dist/helpers/markdown.d.ts.map +1 -1
- package/dist/helpers/normalize-configurations.d.ts +1 -14
- package/dist/helpers/normalize-configurations.d.ts.map +1 -1
- package/dist/helpers/normalize-configurations.js +0 -1
- package/dist/helpers/openapi.d.ts +1 -5
- package/dist/helpers/openapi.d.ts.map +1 -1
- package/dist/helpers/openapi.js +1 -2
- package/dist/plugins/persistance-plugin.d.ts +7 -1
- package/dist/plugins/persistance-plugin.d.ts.map +1 -1
- package/dist/plugins/persistance-plugin.js +11 -1
- package/dist/style.css +179 -176
- package/package.json +11 -20
- package/dist/features/Operation/types/schemas.d.ts +0 -3
- package/dist/features/Operation/types/schemas.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReference.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiReference.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiReference.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiReference.vue"],"names":[],"mappings":"AAopCA,OAAO,EAEL,KAAK,4BAA4B,EAGlC,MAAM,6BAA6B,CAAA;AAyDpC,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;AA6sCF,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-
|
|
7
|
+
const ApiReference = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4acc19c4"]]);
|
|
8
8
|
export {
|
|
9
9
|
ApiReference as default
|
|
10
10
|
};
|
|
@@ -157,7 +157,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
157
157
|
activeSlug.value = slug;
|
|
158
158
|
}
|
|
159
159
|
const workspaceStore = createWorkspaceStore({
|
|
160
|
-
plugins: [
|
|
160
|
+
plugins: [
|
|
161
|
+
persistencePlugin({
|
|
162
|
+
prefix: () => activeSlug.value,
|
|
163
|
+
persistAuth: () => mergedConfig.value.persistAuth ?? false
|
|
164
|
+
})
|
|
165
|
+
]
|
|
161
166
|
});
|
|
162
167
|
const { toggleColorMode, isDarkMode } = useColorMode({
|
|
163
168
|
initialColorMode: {
|
|
@@ -634,11 +639,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
634
639
|
!mergedConfig.value.hideSearch ? (openBlock(), createBlock(_sfc_main$3, {
|
|
635
640
|
key: 0,
|
|
636
641
|
class: "t-doc__sidebar max-w-64",
|
|
642
|
+
document: unref(workspaceStore).workspace.activeDocument,
|
|
637
643
|
eventBus: unref(eventBus),
|
|
638
644
|
hideModels: mergedConfig.value.hideModels,
|
|
639
|
-
items: sidebarItems.value,
|
|
640
645
|
searchHotKey: mergedConfig.value.searchHotKey
|
|
641
|
-
}, null, 8, ["
|
|
646
|
+
}, null, 8, ["document", "eventBus", "hideModels", "searchHotKey"])) : createCommentVNode("", true)
|
|
642
647
|
]),
|
|
643
648
|
_: 1
|
|
644
649
|
})) : createCommentVNode("", true),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./SchemaProperty.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const SchemaProperty = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const SchemaProperty = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7ddcdaa6"]]);
|
|
5
5
|
export {
|
|
6
6
|
SchemaProperty as default
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
2
|
import { type CompositionKeyword } from './schema-composition.js';
|
|
3
|
-
|
|
3
|
+
type CompositionToRender = {
|
|
4
4
|
composition: CompositionKeyword;
|
|
5
5
|
value: SchemaObject;
|
|
6
6
|
};
|
|
@@ -11,4 +11,5 @@ export type CompositionToRender = {
|
|
|
11
11
|
* @returns Array of compositions to render with their values
|
|
12
12
|
*/
|
|
13
13
|
export declare const getCompositionsToRender: (value: SchemaObject | undefined) => CompositionToRender[];
|
|
14
|
+
export {};
|
|
14
15
|
//# sourceMappingURL=get-compositions-to-render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAG5E,
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAG5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,YAAY,GAAG,SAAS,KAAG,mBAAmB,EAgC5F,CAAA"}
|
|
@@ -5,12 +5,6 @@ import type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schema
|
|
|
5
5
|
* Handles $ref, title, name, type, and schema dictionary lookup
|
|
6
6
|
*/
|
|
7
7
|
export declare const getModelNameFromSchema: (schemaOrRef: SchemaObject | ReferenceType<SchemaObject>) => string | null;
|
|
8
|
-
/**
|
|
9
|
-
* Format the type and model name for display
|
|
10
|
-
*/
|
|
11
|
-
export declare const formatTypeWithModel: (type: Extract<SchemaObject, {
|
|
12
|
-
type: any;
|
|
13
|
-
}>["type"], modelName: string) => string;
|
|
14
8
|
/**
|
|
15
9
|
* Get the model name for a schema property
|
|
16
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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9F,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionAccordion.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Section/SectionAccordion.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SectionAccordion.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Section/SectionAccordion.vue"],"names":[],"mappings":"AAoIA,KAAK,WAAW,GAAG;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;AA0IF,QAAA,IAAyB,QAAQ,IAAW,EAAE,QAAQ;;CAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AAC9G,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC7C;IAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACjD;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AA4BhD,QAAA,MAAM,eAAe;;;;kFAOnB,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,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./SectionAccordion.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const SectionAccordion = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const SectionAccordion = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ff689b94"]]);
|
|
5
5
|
export {
|
|
6
6
|
SectionAccordion as default
|
|
7
7
|
};
|
|
@@ -68,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
68
68
|
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
69
69
|
createTextVNode(" Generating SDKs is a paid feature starting at $100/mo, learn more in our ", -1),
|
|
70
70
|
createElementVNode("a", {
|
|
71
|
-
href: "https://
|
|
71
|
+
href: "https://scalar.com/products/sdks/getting-started",
|
|
72
72
|
target: "_blank"
|
|
73
73
|
}, " guides", -1),
|
|
74
74
|
createTextVNode(". ", -1)
|
|
@@ -43,7 +43,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
44
44
|
createTextVNode(" Uploading documents to the Scalar Registry is a Premium feature. See what else is included in our ", -1),
|
|
45
45
|
createElementVNode("a", {
|
|
46
|
-
href: "https://
|
|
46
|
+
href: "https://scalar.com/",
|
|
47
47
|
target: "_blank"
|
|
48
48
|
}, " guides", -1),
|
|
49
49
|
createTextVNode(". ", -1)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-bus.d.ts","sourceRoot":"","sources":["../../src/helpers/lazy-bus.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qCAAa,CAAA;AAc/C,KAAK,SAAS,GAAG,MAAM,IAAI,CAAA;AAE3B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,oCAAkD,CAAA;AA6FlF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM;;EAUpC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,EACjD,cAAc,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GAAG,SAAS,SA2D/G,CAAA
|
|
1
|
+
{"version":3,"file":"lazy-bus.d.ts","sourceRoot":"","sources":["../../src/helpers/lazy-bus.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qCAAa,CAAA;AAc/C,KAAK,SAAS,GAAG,MAAM,IAAI,CAAA;AAE3B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,oCAAkD,CAAA;AA6FlF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM;;EAUpC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,EACjD,cAAc,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GAAG,SAAS,SA2D/G,CAAA"}
|
package/dist/helpers/lazy-bus.js
CHANGED
|
@@ -20,7 +20,7 @@ export declare const isSecretKey: (key: string) => boolean;
|
|
|
20
20
|
* @param current - The current schema object (source of truth for structure)
|
|
21
21
|
* @param stored - The stored object containing secret values to restore
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const mergeSecuritySchemas: (current: unknown, stored: unknown, level?: number) => void;
|
|
24
24
|
/**
|
|
25
25
|
* Loads authentication schemes and selected security settings from local storage.
|
|
26
26
|
*
|
|
@@ -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,
|
|
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"}
|
|
@@ -2,24 +2,25 @@ import { isClient } from "@scalar/api-client/v2/blocks/operation-code-sample";
|
|
|
2
2
|
import { isObject } from "@scalar/helpers/object/is-object";
|
|
3
3
|
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
4
|
import { clientStorage, authStorage } from "./storage.js";
|
|
5
|
-
const SECRET_KEY_PREFIX = "x-scalar-secret-";
|
|
6
5
|
const loadClientFromStorage = (store) => {
|
|
7
6
|
const storedClient = clientStorage().get();
|
|
8
7
|
if (isClient(storedClient) && !store.workspace["x-scalar-default-client"]) {
|
|
9
8
|
store.update("x-scalar-default-client", storedClient);
|
|
10
9
|
}
|
|
11
10
|
};
|
|
12
|
-
const
|
|
13
|
-
const mergeSecrets = (current, stored) => {
|
|
11
|
+
const mergeSecuritySchemas = (current, stored, level = 0) => {
|
|
14
12
|
if (!isObject(current) || !isObject(stored)) {
|
|
15
13
|
return;
|
|
16
14
|
}
|
|
17
15
|
for (const [key, storedValue] of Object.entries(stored)) {
|
|
18
|
-
if (
|
|
16
|
+
if (level === 0 && key === "type") {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (typeof storedValue === "string" && storedValue !== "" || typeof storedValue === "number" || typeof storedValue === "boolean") {
|
|
19
20
|
current[key] = storedValue;
|
|
20
21
|
continue;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
mergeSecuritySchemas(getResolvedRef(current[key]), storedValue, level + 1);
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
const restoreAuthSecretsFromStorage = (store) => {
|
|
@@ -34,7 +35,7 @@ const restoreAuthSecretsFromStorage = (store) => {
|
|
|
34
35
|
for (const [key, storedScheme] of Object.entries(storedAuthSchemes)) {
|
|
35
36
|
const currentScheme = getResolvedRef(securitySchemes[key]);
|
|
36
37
|
if (isObject(currentScheme)) {
|
|
37
|
-
|
|
38
|
+
mergeSecuritySchemas(currentScheme, storedScheme);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
};
|
|
@@ -47,12 +48,12 @@ const loadAuthSchemesFromStorage = (store) => {
|
|
|
47
48
|
console.warn("Active document not found in workspace, skipping auth schemes loading");
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
if (activeDocument["x-scalar-selected-security"]) {
|
|
51
|
-
restoreAuthSecretsFromStorage(store);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
51
|
const authPersistence = authStorage();
|
|
55
52
|
const storedSelectedAuthSchemes = authPersistence.getSelectedSchemes(slug);
|
|
53
|
+
restoreAuthSecretsFromStorage(store);
|
|
54
|
+
if (activeDocument["x-scalar-selected-security"] !== void 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
56
57
|
const availableSchemes = new Set(Object.keys(activeDocument.components?.securitySchemes ?? {}));
|
|
57
58
|
const selectedSchemes = storedSelectedAuthSchemes["x-scalar-selected-security"]?.selectedSchemes;
|
|
58
59
|
const validSchemes = selectedSchemes?.filter((scheme) => isSchemeValid(scheme, availableSchemes));
|
|
@@ -64,11 +65,9 @@ const loadAuthSchemesFromStorage = (store) => {
|
|
|
64
65
|
selectedSchemes: validSchemes
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
restoreAuthSecretsFromStorage(store);
|
|
68
68
|
};
|
|
69
69
|
export {
|
|
70
|
-
isSecretKey,
|
|
71
70
|
loadAuthSchemesFromStorage,
|
|
72
71
|
loadClientFromStorage,
|
|
73
|
-
|
|
72
|
+
mergeSecuritySchemas
|
|
74
73
|
};
|
|
@@ -3,11 +3,4 @@ import type { Heading } from '@scalar/types/legacy';
|
|
|
3
3
|
* Extracts all headings from a Markdown string.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getHeadingsFromMarkdown(input: string): Heading[];
|
|
6
|
-
export type HeadingLevels = 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the lowest heading level from a list of headings.
|
|
9
|
-
*
|
|
10
|
-
* If there are h1, h2, h3 … h1 is the lowest heading level.
|
|
11
|
-
*/
|
|
12
|
-
export declare const getLowestHeadingLevel: (headings: Heading[]) => HeadingLevels;
|
|
13
6
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/helpers/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAWnD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAMhE
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/helpers/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAWnD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAMhE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type AnyApiReferenceConfiguration, type ApiReferenceConfigurationRaw
|
|
2
|
-
import GithubSlugger from 'github-slugger';
|
|
1
|
+
import { type AnyApiReferenceConfiguration, type ApiReferenceConfigurationRaw } from '@scalar/types/api-reference';
|
|
3
2
|
/** Processed API Reference Configuration
|
|
4
3
|
*
|
|
5
4
|
* Creates the required title and slug for the API Reference.
|
|
@@ -20,23 +19,11 @@ export type NormalizedConfiguration = {
|
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
type NormalizedConfigurations = Record<string, NormalizedConfiguration>;
|
|
23
|
-
type ConfigWithRequiredSource = Omit<ApiReferenceConfigurationWithSource, 'url' | 'content'> & ({
|
|
24
|
-
url: string;
|
|
25
|
-
content?: never;
|
|
26
|
-
} | {
|
|
27
|
-
content: Record<string, unknown>;
|
|
28
|
-
url?: never;
|
|
29
|
-
});
|
|
30
22
|
/**
|
|
31
23
|
* Take any configuration and return a flat array of configurations.
|
|
32
24
|
*/
|
|
33
25
|
export declare const normalizeConfigurations: (configuration: AnyApiReferenceConfiguration | undefined) => NormalizedConfigurations;
|
|
34
26
|
/** Normalize content into a JS object or return null if it is falsey */
|
|
35
27
|
export declare const normalizeContent: (content: string | Record<string, unknown> | (() => string | Record<string, unknown>)) => Record<string, unknown> | null;
|
|
36
|
-
/** Process a single spec configuration so that it has a title and a slug */
|
|
37
|
-
export declare const addSlugAndTitle: (source: ConfigWithRequiredSource, index: number | undefined, slugger: GithubSlugger) => ConfigWithRequiredSource & {
|
|
38
|
-
slug: string;
|
|
39
|
-
title: string;
|
|
40
|
-
};
|
|
41
28
|
export {};
|
|
42
29
|
//# sourceMappingURL=normalize-configurations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-configurations.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-configurations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,
|
|
1
|
+
{"version":3,"file":"normalize-configurations.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-configurations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EAIlC,MAAM,6BAA6B,CAAA;AAGpC;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,4BAA4B,CAAA;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,GAAG,CAAC,EAAE,KAAK,CAAA;KAAE,CAAA;CAC7F,CAAA;AAED,KAAK,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;AAKvE;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,4BAA4B,GAAG,SAAS,KACtD,wBAmDF,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KACnF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAc5B,CAAA"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { OpenAPI
|
|
1
|
+
import type { OpenAPI } from '@scalar/openapi-types';
|
|
2
2
|
import type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
-
/**
|
|
4
|
-
* Formats a property object into a string.
|
|
5
|
-
*/
|
|
6
|
-
export declare function formatProperty(key: string, obj: OpenAPIV3_1.SchemaObject): string;
|
|
7
3
|
/**
|
|
8
4
|
* Extracts the request body from an operation.
|
|
9
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/helpers/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/helpers/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,uBAAuB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAmDpH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,OAAO,CAYjF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,oBAW3E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAiBjF,OAAO,CAAC,QAAQ,CACvB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,gBA2D5D"}
|
package/dist/helpers/openapi.js
CHANGED
|
@@ -2,7 +2,7 @@ import type { WorkspacePlugin } from '@scalar/workspace-store/workspace-plugin';
|
|
|
2
2
|
/**
|
|
3
3
|
* Plugin to persist workspace state changes with debounced writes.
|
|
4
4
|
*/
|
|
5
|
-
export declare const persistencePlugin: ({ debounceDelay, maxWait, prefix, }: {
|
|
5
|
+
export declare const persistencePlugin: ({ debounceDelay, maxWait, prefix, persistAuth, }: {
|
|
6
6
|
debounceDelay?: number;
|
|
7
7
|
/** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */
|
|
8
8
|
maxWait?: number;
|
|
@@ -12,5 +12,11 @@ export declare const persistencePlugin: ({ debounceDelay, maxWait, prefix, }: {
|
|
|
12
12
|
* For example, to persist data per document, use the document name as the prefix.
|
|
13
13
|
*/
|
|
14
14
|
prefix?: string | (() => string);
|
|
15
|
+
/**
|
|
16
|
+
* Determines whether authentication details should be persisted.
|
|
17
|
+
* Accepts a boolean or a function that returns a boolean.
|
|
18
|
+
* Allows for conditional persistence logic, e.g., based on environment or user settings.
|
|
19
|
+
*/
|
|
20
|
+
persistAuth?: boolean | (() => boolean);
|
|
15
21
|
}) => WorkspacePlugin;
|
|
16
22
|
//# sourceMappingURL=persistance-plugin.d.ts.map
|
|
@@ -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,
|
|
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"}
|
|
@@ -3,7 +3,8 @@ import { authStorage, clientStorage } from "../helpers/storage.js";
|
|
|
3
3
|
const persistencePlugin = ({
|
|
4
4
|
debounceDelay = 500,
|
|
5
5
|
maxWait = 1e4,
|
|
6
|
-
prefix = ""
|
|
6
|
+
prefix = "",
|
|
7
|
+
persistAuth = false
|
|
7
8
|
}) => {
|
|
8
9
|
const { execute } = debounce({ delay: debounceDelay, maxWait });
|
|
9
10
|
const authPersistence = authStorage();
|
|
@@ -14,6 +15,12 @@ const persistencePlugin = ({
|
|
|
14
15
|
}
|
|
15
16
|
return prefix();
|
|
16
17
|
};
|
|
18
|
+
const getPersistAuth = () => {
|
|
19
|
+
if (typeof persistAuth === "function") {
|
|
20
|
+
return persistAuth();
|
|
21
|
+
}
|
|
22
|
+
return persistAuth;
|
|
23
|
+
};
|
|
17
24
|
return {
|
|
18
25
|
hooks: {
|
|
19
26
|
/**
|
|
@@ -29,6 +36,9 @@ const persistencePlugin = ({
|
|
|
29
36
|
return;
|
|
30
37
|
}
|
|
31
38
|
if (event.type === "documents") {
|
|
39
|
+
if (!getPersistAuth()) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
32
42
|
const { path, value: document } = event;
|
|
33
43
|
const { securitySchemes = {} } = document.components ?? {};
|
|
34
44
|
if (path[0] === "components" && path[1] === "securitySchemes") {
|