@scalar/api-reference 1.37.0 → 1.38.0
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 +34 -0
- package/dist/browser/standalone.js +19983 -17826
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/GettingStarted.vue.d.ts.map +1 -1
- package/dist/components/GettingStarted.vue.js +2 -2
- package/dist/components/GettingStarted.vue2.js +22 -22
- package/dist/esm.d.ts +2 -2
- package/dist/esm.d.ts.map +1 -1
- package/dist/features/api-client-modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/features/api-client-modal/useApiClient.d.ts +32 -32
- package/dist/features/document-source/hooks/useDocumentFetcher.d.ts +2 -2
- package/dist/features/document-source/hooks/useDocumentFetcher.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentSource.d.ts +2 -2
- package/dist/features/document-source/hooks/useDocumentSource.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentSource.js +38 -34
- package/dist/features/multiple-documents/DocumentSelector.vue.d.ts +2 -2
- package/dist/features/multiple-documents/DocumentSelector.vue.d.ts.map +1 -1
- package/dist/features/multiple-documents/useMultipleDocuments.d.ts +4 -4
- package/dist/features/multiple-documents/useMultipleDocuments.d.ts.map +1 -1
- package/dist/features/multiple-documents/useMultipleDocuments.js +2 -2
- package/dist/index.js +1 -1
- package/dist/standalone/lib/html-api.d.ts +3 -3
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/standalone/lib/register-globals.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +18 -19
- package/dist/v2/helpers/map-configuration.d.ts +2 -2
- package/package.json +16 -16
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiReferenceConfigurationWithSource } from '@scalar/types/api-reference';
|
|
2
2
|
import { type MaybeRefOrGetter } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* Pass a configuration object containg content or an URL, and retrieve the OpenAPI document as a string.
|
|
5
5
|
*/
|
|
6
6
|
export declare function useDocumentFetcher({ configuration, }: {
|
|
7
|
-
configuration?: MaybeRefOrGetter<Pick<
|
|
7
|
+
configuration?: MaybeRefOrGetter<Pick<ApiReferenceConfigurationWithSource, 'url' | 'content' | 'proxyUrl' | 'fetch'>>;
|
|
8
8
|
}): {
|
|
9
9
|
originalDocument: import("vue").Ref<string, string>;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentFetcher.d.ts","sourceRoot":"","sources":["../../../../src/features/document-source/hooks/useDocumentFetcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useDocumentFetcher.d.ts","sourceRoot":"","sources":["../../../../src/features/document-source/hooks/useDocumentFetcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mCAAmC,EAAuB,MAAM,6BAA6B,CAAA;AAC3G,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,KAAK,CAAA;AAEhE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,aAAa,GACd,EAAE;IACD,aAAa,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC,CAAA;CACtH;;EAuBA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createActiveEntitiesStore, createWorkspaceStore } from '@scalar/api-client/store';
|
|
2
2
|
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ApiReferenceConfigurationWithSource } from '@scalar/types/api-reference';
|
|
4
4
|
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
5
5
|
/**
|
|
6
6
|
* Pass any data source, retrieve all the data stores and whatever we need to render the API reference.
|
|
@@ -8,7 +8,7 @@ import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
|
8
8
|
export declare function useDocumentSource({ originalDocument: providedOriginalDocument, dereferencedDocument: providedDereferencedDocument, configuration, }: {
|
|
9
9
|
originalDocument?: MaybeRefOrGetter<string>;
|
|
10
10
|
dereferencedDocument?: MaybeRefOrGetter<OpenAPIV3_1.Document>;
|
|
11
|
-
configuration?: MaybeRefOrGetter<Pick<
|
|
11
|
+
configuration?: MaybeRefOrGetter<Pick<ApiReferenceConfigurationWithSource, 'url' | 'content' | 'proxyUrl' | 'fetch' | 'proxyUrl' | 'showSidebar' | 'hideClientButton' | 'theme' | '_integration'>>;
|
|
12
12
|
}): {
|
|
13
13
|
originalDocument: Ref<string>;
|
|
14
14
|
originalOpenApiVersion: Ref<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentSource.d.ts","sourceRoot":"","sources":["../../../../src/features/document-source/hooks/useDocumentSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAG1F,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"useDocumentSource.d.ts","sourceRoot":"","sources":["../../../../src/features/document-source/hooks/useDocumentSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAG1F,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,KAAK,mCAAmC,EAAmC,MAAM,6BAA6B,CAAA;AACvH,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAiC,MAAM,KAAK,CAAA;AAIpF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,gBAAgB,EAAE,wBAAwB,EAC1C,oBAAoB,EAAE,4BAA4B,EAClD,aAAa,GACd,EAAE;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC3C,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7D,aAAa,CAAC,EAAE,gBAAgB,CAC9B,IAAI,CACF,mCAAmC,EACjC,KAAK,GACL,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,aAAa,GACb,kBAAkB,GAClB,OAAO,GACP,cAAc,CACjB,CACF,CAAA;CACF,GAAG;IACF,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnC,oBAAoB,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC/C,cAAc,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;IACvD,mBAAmB,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAA;CAClE,CAiHA"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createWorkspaceStore as
|
|
1
|
+
import { createWorkspaceStore as A, createActiveEntitiesStore as v } from "@scalar/api-client/store";
|
|
2
2
|
import { measureAsync as P } from "@scalar/helpers/testing/measure";
|
|
3
|
-
import { normalize as
|
|
3
|
+
import { normalize as b, dereference as O } from "@scalar/openapi-parser";
|
|
4
4
|
import { upgrade as V } from "@scalar/openapi-upgrader";
|
|
5
|
-
import { apiReferenceConfigurationSchema as
|
|
6
|
-
import { computed as f, toValue as
|
|
7
|
-
import { useDocumentFetcher as
|
|
8
|
-
function
|
|
5
|
+
import { apiReferenceConfigurationSchema as x } from "@scalar/types/api-reference";
|
|
6
|
+
import { computed as f, toValue as t, ref as d, watch as C } from "vue";
|
|
7
|
+
import { useDocumentFetcher as D } from "./useDocumentFetcher.js";
|
|
8
|
+
function j({
|
|
9
9
|
originalDocument: c,
|
|
10
|
-
dereferencedDocument:
|
|
11
|
-
configuration:
|
|
10
|
+
dereferencedDocument: o,
|
|
11
|
+
configuration: s
|
|
12
12
|
}) {
|
|
13
|
-
const { originalDocument:
|
|
14
|
-
configuration:
|
|
15
|
-
}),
|
|
13
|
+
const { originalDocument: h } = D({
|
|
14
|
+
configuration: s
|
|
15
|
+
}), u = f(() => c ? t(c) : t(h)), n = d(""), g = f(() => o ? t(o) : t(m)), m = d({
|
|
16
16
|
openapi: "3.1.0",
|
|
17
17
|
info: {
|
|
18
18
|
title: "",
|
|
@@ -20,50 +20,54 @@ function L({
|
|
|
20
20
|
},
|
|
21
21
|
paths: {}
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
() =>
|
|
25
|
-
async (
|
|
26
|
-
if (!
|
|
23
|
+
C(
|
|
24
|
+
() => t(u),
|
|
25
|
+
async (a) => {
|
|
26
|
+
if (!a)
|
|
27
27
|
return;
|
|
28
|
-
const e =
|
|
28
|
+
const e = b(a);
|
|
29
29
|
if (e === void 0) {
|
|
30
|
-
console.error("Failed to parse the OpenAPI document:",
|
|
30
|
+
console.error("Failed to parse the OpenAPI document:", a);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
33
|
+
if (n.value = typeof e == "object" && (e.openapi || e.swagger) || "", o)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
35
|
+
const y = !n.value.startsWith("3.1") ? (
|
|
36
36
|
// Upgrade needed
|
|
37
37
|
V(e, "3.1")
|
|
38
38
|
) : (
|
|
39
39
|
// Skip the upgrade
|
|
40
40
|
e
|
|
41
|
-
),
|
|
42
|
-
const { schema: p, errors:
|
|
43
|
-
return
|
|
41
|
+
), w = await P("dereference", async () => {
|
|
42
|
+
const { schema: p, errors: i } = await O(y);
|
|
43
|
+
return i?.length && console.warn(
|
|
44
44
|
`Please open an issue on https://github.com/scalar/scalar
|
|
45
45
|
`,
|
|
46
46
|
`Scalar OpenAPI Parser Warning:
|
|
47
47
|
`,
|
|
48
|
-
|
|
49
|
-
), p === void 0 && console.error("Failed to dereference the OpenAPI document",
|
|
48
|
+
i
|
|
49
|
+
), p === void 0 && console.error("Failed to dereference the OpenAPI document", i), p;
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
m.value = w;
|
|
52
52
|
},
|
|
53
53
|
{ immediate: !0 }
|
|
54
54
|
);
|
|
55
|
-
const
|
|
55
|
+
const r = t(s) ?? x.parse({}), l = A({
|
|
56
56
|
useLocalStorage: !1,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
proxyUrl: r.proxyUrl,
|
|
58
|
+
theme: r.theme,
|
|
59
|
+
showSidebar: r.showSidebar,
|
|
60
|
+
hideClientButton: r.hideClientButton,
|
|
61
|
+
_integration: r._integration
|
|
62
|
+
}), S = v(l);
|
|
59
63
|
return {
|
|
60
|
-
originalDocument:
|
|
61
|
-
originalOpenApiVersion:
|
|
62
|
-
dereferencedDocument:
|
|
63
|
-
workspaceStore:
|
|
64
|
-
activeEntitiesStore:
|
|
64
|
+
originalDocument: u,
|
|
65
|
+
originalOpenApiVersion: n,
|
|
66
|
+
dereferencedDocument: g,
|
|
67
|
+
workspaceStore: l,
|
|
68
|
+
activeEntitiesStore: S
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
71
|
export {
|
|
68
|
-
|
|
72
|
+
j as useDocumentSource
|
|
69
73
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SourceConfiguration } from '@scalar/types/api-reference';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
options?:
|
|
3
|
+
options?: SourceConfiguration[];
|
|
4
4
|
modelValue?: number;
|
|
5
5
|
};
|
|
6
6
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/features/multiple-documents/DocumentSelector.vue"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DocumentSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/features/multiple-documents/DocumentSelector.vue"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAC;;;;;;AAsHF,wBAOG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyApiReferenceConfiguration, type ApiReferenceConfiguration, type
|
|
1
|
+
import { type AnyApiReferenceConfiguration, type ApiReferenceConfiguration, type SourceConfiguration, apiReferenceConfigurationWithSourceSchema } from '@scalar/types/api-reference';
|
|
2
2
|
import { type ComputedRef, type Ref } from 'vue';
|
|
3
3
|
import type { z } from 'zod';
|
|
4
4
|
type UseMultipleDocumentsProps = {
|
|
@@ -18,15 +18,15 @@ type UseMultipleDocumentsProps = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Take any configuration and return a flat array of configurations.
|
|
20
20
|
*/
|
|
21
|
-
export declare const normalizeConfigurations: (configuration: AnyApiReferenceConfiguration | undefined) =>
|
|
21
|
+
export declare const normalizeConfigurations: (configuration: AnyApiReferenceConfiguration | undefined) => SourceConfiguration[];
|
|
22
22
|
/**
|
|
23
23
|
* DEPRECATED: This is a temporary state solution while we migrate to the new workspace store
|
|
24
24
|
*
|
|
25
25
|
* @deprecated
|
|
26
26
|
*/
|
|
27
27
|
export declare const useMultipleDocuments: ({ configuration, configurationOverrides, initialIndex, isIntersectionEnabled, hash, hashPrefix, }: UseMultipleDocumentsProps) => {
|
|
28
|
-
selectedConfiguration: ComputedRef<z.infer<typeof
|
|
29
|
-
availableDocuments: Ref<
|
|
28
|
+
selectedConfiguration: ComputedRef<z.infer<typeof apiReferenceConfigurationWithSourceSchema>>;
|
|
29
|
+
availableDocuments: Ref<SourceConfiguration[]>;
|
|
30
30
|
selectedDocumentIndex: Ref<number>;
|
|
31
31
|
isIntersectionEnabled: Ref<boolean>;
|
|
32
32
|
hash: Ref<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../../src/features/multiple-documents/useMultipleDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,
|
|
1
|
+
{"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../../src/features/multiple-documents/useMultipleDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,yCAAyC,EAE1C,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AACtE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAK5B,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAAA;IAC5D,+EAA+E;IAC/E,sBAAsB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,yBAAyB,CAAC,GAAG,SAAS,CAAC,CAAA;IAC5E,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,4BAA4B,GAAG,SAAS,KACtD,mBAAmB,EA6BrB,CAAA;AA0CD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,mGAOlC,yBAAyB,KAAG;IAC7B,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC,CAAA;IAC7F,kBAAkB,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAA;IAC9C,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAClC,qBAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAwIxB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDefined as y } from "@scalar/oas-utils/helpers";
|
|
2
|
-
import { isConfigurationWithSources as h,
|
|
2
|
+
import { isConfigurationWithSources as h, apiReferenceConfigurationWithSourceSchema as v } from "@scalar/types/api-reference";
|
|
3
3
|
import R from "github-slugger";
|
|
4
4
|
import { computed as m, ref as D, watch as b } from "vue";
|
|
5
5
|
const g = "api", w = new R(), A = (t) => t ? (Array.isArray(t) ? t : [t]).flatMap((u) => {
|
|
@@ -11,7 +11,7 @@ const g = "api", w = new R(), A = (t) => t ? (Array.isArray(t) ? t : [t]).flatMa
|
|
|
11
11
|
}).map((u, o) => u && C(u, o)).filter(y) : [], C = (t, i = 0) => {
|
|
12
12
|
const e = {
|
|
13
13
|
...t,
|
|
14
|
-
//
|
|
14
|
+
// this is before parsing so we transform the old style
|
|
15
15
|
...t.spec ?? {}
|
|
16
16
|
};
|
|
17
17
|
if (!(!e?.url && !e?.content))
|