@scalar/api-reference 1.34.1 → 1.34.4

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 (113) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/README.md +1 -1
  3. package/dist/browser/standalone.js +13121 -12730
  4. package/dist/browser/webpack-stats.json +1 -1
  5. package/dist/components/Badge/Badge.vue.d.ts +4 -1
  6. package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
  7. package/dist/components/Badge/Badge.vue.js +5 -11
  8. package/dist/components/Badge/Badge.vue2.js +22 -2
  9. package/dist/components/Badge/Badge.vue3.js +4 -0
  10. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts +1 -1
  11. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
  12. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +1 -1
  13. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Models/Models.vue.js +30 -31
  15. package/dist/components/Content/Models/ModernLayout.vue.d.ts +2 -0
  16. package/dist/components/Content/Models/ModernLayout.vue.d.ts.map +1 -1
  17. package/dist/components/Content/Models/ModernLayout.vue.js +2 -2
  18. package/dist/components/Content/Models/ModernLayout.vue2.js +39 -37
  19. package/dist/components/Content/Operations/TraversedEntry.vue.js +12 -12
  20. package/dist/components/Content/Tags/TagSection.vue.js +6 -6
  21. package/dist/components/GettingStarted.vue.js +3 -3
  22. package/dist/components/GettingStarted.vue2.js +21 -21
  23. package/dist/components/MobileHeader.vue.d.ts.map +1 -1
  24. package/dist/components/MobileHeader.vue.js +3 -3
  25. package/dist/components/Section/CompactSection.vue.d.ts +2 -0
  26. package/dist/components/Section/CompactSection.vue.d.ts.map +1 -1
  27. package/dist/components/Section/CompactSection.vue.js +1 -1
  28. package/dist/components/Section/CompactSection.vue2.js +30 -29
  29. package/dist/features/Operation/Operation.vue.d.ts +2 -1
  30. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  31. package/dist/features/Operation/Operation.vue.js +53 -52
  32. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +1 -2
  33. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  34. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  35. package/dist/features/Operation/components/callbacks/Callback.vue3.js +2 -2
  36. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  37. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +16 -16
  38. package/dist/features/Operation/helpers/combine-params.d.ts +5 -0
  39. package/dist/features/Operation/helpers/combine-params.d.ts.map +1 -0
  40. package/dist/features/Operation/helpers/combine-params.js +13 -0
  41. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -4
  42. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  43. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  44. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +59 -50
  45. package/dist/features/Operation/layouts/ClassicLayout.vue3.js +2 -2
  46. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -4
  47. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  48. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  49. package/dist/features/Operation/layouts/ModernLayout.vue2.js +94 -78
  50. package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
  51. package/dist/features/Search/helpers/create-fuse-instance.js +0 -3
  52. package/dist/features/api-client-modal/ApiClientModal.vue.d.ts.map +1 -1
  53. package/dist/features/api-client-modal/ApiClientModal.vue.js +51 -48
  54. package/dist/features/api-client-modal/useApiClient.d.ts +100 -100
  55. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  56. package/dist/features/document-source/hooks/useDocumentFetcher.d.ts.map +1 -1
  57. package/dist/features/document-source/hooks/useDocumentFetcher.js +16 -18
  58. package/dist/features/document-source/hooks/useDocumentSource.d.ts.map +1 -1
  59. package/dist/features/document-source/hooks/useDocumentSource.js +30 -33
  60. package/dist/features/example-responses/ExampleResponse.vue.d.ts +1 -1
  61. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  62. package/dist/features/example-responses/ExampleResponse.vue.js +2 -2
  63. package/dist/features/example-responses/ExampleResponse.vue2.js +15 -13
  64. package/dist/features/example-responses/ExampleResponses.vue.d.ts +2 -3
  65. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  66. package/dist/features/example-responses/ExampleResponses.vue.js +2 -2
  67. package/dist/features/example-responses/ExampleResponses.vue2.js +73 -69
  68. package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts +26 -0
  69. package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts.map +1 -0
  70. package/dist/features/example-responses/helpers/get-resolved-ref-deep.js +29 -0
  71. package/dist/features/sidebar/components/SidebarElement.vue.d.ts.map +1 -1
  72. package/dist/features/sidebar/components/SidebarElement.vue.js +1 -1
  73. package/dist/features/sidebar/components/SidebarElement.vue2.js +6 -6
  74. package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -1
  75. package/dist/features/sidebar/helpers/create-sidebar.js +13 -14
  76. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +1 -2
  77. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
  78. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
  79. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
  80. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
  81. package/dist/features/traverse-schema/types.d.ts +11 -12
  82. package/dist/features/traverse-schema/types.d.ts.map +1 -1
  83. package/dist/features/x-badges/XBadges.vue.d.ts +8 -0
  84. package/dist/features/x-badges/XBadges.vue.d.ts.map +1 -0
  85. package/dist/features/x-badges/XBadges.vue.js +26 -0
  86. package/dist/features/x-badges/XBadges.vue2.js +4 -0
  87. package/dist/features/x-badges/index.d.ts +2 -0
  88. package/dist/features/x-badges/index.d.ts.map +1 -0
  89. package/dist/helpers/test-utils.d.ts +1 -1
  90. package/dist/helpers/test-utils.d.ts.map +1 -1
  91. package/dist/hooks/useNavState.d.ts +1 -2
  92. package/dist/hooks/useNavState.d.ts.map +1 -1
  93. package/dist/index.js +1 -1
  94. package/dist/libs/openapi.d.ts +4 -14
  95. package/dist/libs/openapi.d.ts.map +1 -1
  96. package/dist/libs/openapi.js +55 -36
  97. package/dist/style.css +1 -1
  98. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  99. package/dist/v2/ApiReferenceWorkspace.vue.js +64 -64
  100. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts +1 -2
  101. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
  102. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +2 -2
  103. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +97 -100
  104. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts +1 -2
  105. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts.map +1 -1
  106. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +17 -20
  107. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.d.ts.map +1 -1
  108. package/dist/v2/helpers/map-configuration.d.ts +66 -0
  109. package/dist/v2/helpers/map-configuration.d.ts.map +1 -0
  110. package/dist/v2/helpers/map-configuration.js +53 -0
  111. package/dist/vitest.setup.d.ts +2 -0
  112. package/dist/vitest.setup.d.ts.map +1 -0
  113. package/package.json +24 -20
@@ -1,24 +1,15 @@
1
1
  import type { OpenAPI, OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/parameter';
3
3
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/path-operations';
4
- import type { Dereference } from '@scalar/workspace-store/schemas/v3.1/type-guard';
5
- type PropertyObject = {
6
- required?: string[];
7
- properties: {
8
- [key: string]: {
9
- type: string;
10
- description?: string;
11
- };
12
- };
13
- };
4
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/schema';
14
5
  /**
15
6
  * Formats a property object into a string.
16
7
  */
17
- export declare function formatProperty(key: string, obj: PropertyObject): string;
8
+ export declare function formatProperty(key: string, obj: SchemaObject): string;
18
9
  /**
19
10
  * Extracts the request body from an operation.
20
11
  */
21
- export declare function extractRequestBody(operation: Dereference<OperationObject>): string[] | boolean;
12
+ export declare function extractRequestBody(operation: OperationObject): string[] | boolean;
22
13
  /**
23
14
  * Returns all models from the specification, no matter if it's OpenAPI 3.x.
24
15
  */
@@ -53,6 +44,5 @@ export type ParameterMap = {
53
44
  *
54
45
  * TODO: Isn't it easier to just stick to the OpenAPI structure, without transforming it?
55
46
  */
56
- export declare function createParameterMap(operation: Dereference<OperationObject>): ParameterMap;
57
- export {};
47
+ export declare function createParameterMap(operation: OperationObject): ParameterMap;
58
48
  //# sourceMappingURL=openapi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/libs/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAGlF,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,IAAI,EAAE,MAAM,CAAA;YACZ,WAAW,CAAC,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAA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@@
1
- import { isDereferenced as p } from "@scalar/openapi-types/helpers";
2
- function d(t, i) {
3
- var s;
4
- let o = t;
5
- const e = (s = i.required) == null ? void 0 : s.includes(t);
6
- return o += e ? " REQUIRED " : " optional ", i.properties[t] && (o += i.properties[t].type, i.properties[t].description && (o += " " + i.properties[t].description)), o;
1
+ import { isDereferenced as h } from "@scalar/openapi-types/helpers";
2
+ import { getResolvedRef as c } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ function d(i, s) {
4
+ var r, n;
5
+ let o = i;
6
+ const e = (r = s.required) == null ? void 0 : r.includes(i);
7
+ o += e ? " REQUIRED " : " optional ";
8
+ const t = c((n = s.properties) == null ? void 0 : n[i]);
9
+ return t && (o += t.type, t.description && (o += " " + t.description)), o;
7
10
  }
8
- function h(t) {
9
- var e;
10
- const i = ["Body"], o = (e = t == null ? void 0 : t.schema) == null ? void 0 : e.properties;
11
- return o && Object.keys(o).forEach((s) => {
12
- if (!t.schema)
11
+ function y(i) {
12
+ const s = ["Body"], o = c(i == null ? void 0 : i.schema), e = o == null ? void 0 : o.properties;
13
+ return e && Object.keys(e).forEach((t) => {
14
+ if (!i.schema)
13
15
  return;
14
- i.push(d(s, t.schema));
15
- const r = o[s];
16
- r.type === "object" && !!r.properties && r.properties && Object.keys(r.properties).forEach((n) => {
17
- var c, f;
18
- i.push(`${n} ${(f = (c = r.properties) == null ? void 0 : c[n]) == null ? void 0 : f.type}`);
16
+ s.push(d(t, o));
17
+ const r = c(e[t]);
18
+ r.type === "object" && !!r.properties && r.properties && Object.keys(r.properties).forEach((f) => {
19
+ var p, u;
20
+ s.push(`${f} ${(u = c((p = r.properties) == null ? void 0 : p[f])) == null ? void 0 : u.type}`);
19
21
  });
20
- }), i;
22
+ }), s;
21
23
  }
22
- function q(t) {
23
- var i, o;
24
+ function q(i) {
25
+ var s, o;
24
26
  try {
25
- const e = (o = (i = t == null ? void 0 : t.requestBody) == null ? void 0 : i.content) == null ? void 0 : o["application/json"];
27
+ const e = (o = (s = c(i == null ? void 0 : i.requestBody)) == null ? void 0 : s.content) == null ? void 0 : o["application/json"];
26
28
  if (!e)
27
29
  throw new Error("Body not found");
28
- return h(e);
30
+ return y(e);
29
31
  } catch {
30
32
  return !1;
31
33
  }
32
34
  }
33
- function u(t, i) {
34
- for (const [o, e] of Object.entries(t))
35
- e !== null && typeof e == "object" ? (i[o] ?? (i[o] = new e.__proto__.constructor()), u(e, i[o])) : typeof e < "u" && (i[o] = e);
36
- return i;
35
+ function a(i) {
36
+ var o, e;
37
+ if (!i)
38
+ return {};
39
+ const s = (
40
+ // OpenAPI 3.x
41
+ Object.keys(((o = i == null ? void 0 : i.components) == null ? void 0 : o.schemas) ?? {}).length ? (e = i == null ? void 0 : i.components) == null ? void 0 : e.schemas : (
42
+ // Fallback
43
+ {}
44
+ )
45
+ );
46
+ return Object.keys(s ?? {}).forEach((t) => {
47
+ var r, n;
48
+ (((r = s[t]) == null ? void 0 : r["x-internal"]) === !0 || ((n = s[t]) == null ? void 0 : n["x-scalar-ignore"]) === !0) && delete s[t];
49
+ }), s;
37
50
  }
38
- function E(t) {
39
- return u(t ?? {}, {
51
+ function l(i, s) {
52
+ for (const [o, e] of Object.entries(i))
53
+ e !== null && typeof e == "object" ? (s[o] ?? (s[o] = new e.__proto__.constructor()), l(e, s[o])) : typeof e < "u" && (s[o] = e);
54
+ return s;
55
+ }
56
+ function b(i) {
57
+ return l(i ?? {}, {
40
58
  info: {
41
59
  title: "",
42
60
  description: "",
@@ -54,23 +72,24 @@ function E(t) {
54
72
  tags: []
55
73
  });
56
74
  }
57
- function O(t) {
58
- const i = {
75
+ function v(i) {
76
+ const s = {
59
77
  path: [],
60
78
  query: [],
61
79
  header: [],
62
80
  cookie: [],
63
81
  body: [],
64
82
  formData: []
65
- }, o = t.parameters ?? [];
83
+ }, o = i.parameters ?? [];
66
84
  return o && o.forEach((e) => {
67
- p(e) && (typeof e == "object" && e !== null && "$ref" in e || (e.in === "path" ? i.path.push(e) : e.in === "query" ? i.query.push(e) : e.in === "header" ? i.header.push(e) : e.in === "cookie" ? i.cookie.push(e) : e.in === "body" ? i.body.push(e) : e.in === "formData" && i.formData.push(e)));
68
- }), i;
85
+ h(e) && (typeof e == "object" && e !== null && "$ref" in e || (e.in === "path" ? s.path.push(e) : e.in === "query" ? s.query.push(e) : e.in === "header" ? s.header.push(e) : e.in === "cookie" ? s.cookie.push(e) : e.in === "body" ? s.body.push(e) : e.in === "formData" && s.formData.push(e)));
86
+ }), s;
69
87
  }
70
88
  export {
71
- E as createEmptySpecification,
72
- O as createParameterMap,
73
- u as deepMerge,
89
+ b as createEmptySpecification,
90
+ v as createParameterMap,
91
+ l as deepMerge,
74
92
  q as extractRequestBody,
75
- d as formatProperty
93
+ d as formatProperty,
94
+ a as getModels
76
95
  };