@scalar/api-client 2.29.4 → 2.31.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +9 -69
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +74 -76
  6. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +15 -8
  7. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  8. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  9. package/dist/v2/blocks/operation-block/components/Header.vue2.js +29 -28
  10. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +1 -1
  11. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  12. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +18 -21
  13. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  14. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +2 -2
  15. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +12 -0
  16. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  17. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -0
  18. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  19. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  20. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +13 -8
  21. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  23. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +97 -85
  24. package/dist/v2/components/server/ServerDropdown.vue.d.ts +16 -5
  25. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  26. package/dist/v2/components/server/ServerDropdown.vue.js +27 -24
  27. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  28. package/dist/v2/features/app/app-events.js +29 -14
  29. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  30. package/dist/v2/features/app/app-state.js +57 -57
  31. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  32. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  33. package/dist/v2/features/app/components/AppSidebar.vue2.js +171 -148
  34. package/dist/v2/features/app/helpers/routes.d.ts +42 -12
  35. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  36. package/dist/v2/features/app/helpers/routes.js +57 -26
  37. package/dist/v2/features/collection/OperationCollection.vue.d.ts +6 -0
  38. package/dist/v2/features/collection/OperationCollection.vue.d.ts.map +1 -0
  39. package/dist/v2/features/collection/OperationCollection.vue.js +83 -0
  40. package/dist/v2/features/collection/OperationCollection.vue2.js +4 -0
  41. package/dist/v2/features/collection/components/Authentication.vue.d.ts +2 -2
  42. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  43. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  44. package/dist/v2/features/collection/components/Authentication.vue2.js +99 -49
  45. package/dist/v2/features/collection/components/Cookies.vue.d.ts +9 -4
  46. package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
  47. package/dist/v2/features/collection/components/Cookies.vue.js +12 -10
  48. package/dist/v2/features/collection/components/Environment.vue.d.ts +9 -4
  49. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  50. package/dist/v2/features/collection/components/Environment.vue.js +18 -16
  51. package/dist/v2/features/collection/components/LabelInput.vue.d.ts +6 -2
  52. package/dist/v2/features/collection/components/LabelInput.vue.d.ts.map +1 -1
  53. package/dist/v2/features/collection/components/LabelInput.vue.js +2 -2
  54. package/dist/v2/features/collection/components/LabelInput.vue2.js +20 -18
  55. package/dist/v2/features/collection/components/Overview.vue.d.ts +2 -2
  56. package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
  57. package/dist/v2/features/collection/components/Overview.vue.js +1 -1
  58. package/dist/v2/features/collection/components/Overview.vue2.js +177 -75
  59. package/dist/v2/features/collection/components/Servers.vue.d.ts +2 -2
  60. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  61. package/dist/v2/features/collection/components/Servers.vue.js +154 -98
  62. package/dist/v2/features/collection/components/Settings.vue.d.ts +2 -2
  63. package/dist/v2/features/collection/components/Tabs.vue.d.ts +2 -1
  64. package/dist/v2/features/collection/components/Tabs.vue.d.ts.map +1 -1
  65. package/dist/v2/features/collection/components/Tabs.vue.js +25 -27
  66. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.d.ts +12 -0
  67. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.d.ts.map +1 -0
  68. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.js +13 -0
  69. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  70. package/dist/v2/features/operation/Operation.vue.js +61 -63
  71. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -3
  72. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  73. package/dist/v2/features/operation/helpers/get-selected-security.js +7 -8
  74. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +8 -6
  75. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -1
  76. package/dist/v2/features/operation/helpers/get-selected-server.js +2 -2
  77. package/dist/v2/workspace-events.d.ts.map +1 -1
  78. package/dist/v2/workspace-events.js +25 -15
  79. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  80. package/package.json +12 -12
@@ -1,12 +1,11 @@
1
1
  import { isAuthOptional as i } from "../../../blocks/scalar-auth-selector-block/helpers/is-auth-optional.js";
2
- const c = (e, t, s = [], r = !1) => {
3
- if (r) {
4
- if (t)
5
- return t;
6
- } else if (e)
2
+ const f = (e, t, s = []) => {
3
+ if (t)
4
+ return t;
5
+ if (e)
7
6
  return e;
8
- const f = i(s), n = s[0];
9
- return f || !n ? {
7
+ const r = i(s), n = s[0];
8
+ return r || !n ? {
10
9
  selectedIndex: -1,
11
10
  selectedSchemes: []
12
11
  } : {
@@ -15,5 +14,5 @@ const c = (e, t, s = [], r = !1) => {
15
14
  };
16
15
  };
17
16
  export {
18
- c as getSelectedSecurity
17
+ f as getSelectedSecurity
19
18
  };
@@ -1,11 +1,13 @@
1
1
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
3
2
  /**
4
- * Get the selected server for a document,
5
- * we can later expand this to support operation/path servers as well
3
+ * Get the selected server from a list of servers and an optional selected-server URL.
4
+ * Works for both document-level and operation-level servers: the caller passes the
5
+ * appropriate selected URL (from document or operation).
6
6
  *
7
- * If x-scalar-selected-server is undefined we select the first server (this means the user has not selected a server yet)
8
- * If the user has un-selected a server it would be an empty string
7
+ * - If selectedServerUrl is undefined and servers has items, returns the first server
8
+ * (user has not selected yet).
9
+ * - If selectedServerUrl is '' (user un-selected), returns null.
10
+ * - Otherwise returns the server whose url matches selectedServerUrl, or null.
9
11
  */
10
- export declare const getSelectedServer: (document: WorkspaceDocument | null, servers: ServerObject[] | null) => ServerObject | null;
12
+ export declare const getSelectedServer: (servers: ServerObject[] | null, selectedServerUrl: string | undefined) => ServerObject | null;
11
13
  //# sourceMappingURL=get-selected-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-selected-server.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAElF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,iBAAiB,GAAG,IAAI,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI,wBAQnG,CAAA"}
1
+ {"version":3,"file":"get-selected-server.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,YAAY,EAAE,GAAG,IAAI,EAC9B,mBAAmB,MAAM,GAAG,SAAS,KACpC,YAAY,GAAG,IAcjB,CAAA"}
@@ -1,4 +1,4 @@
1
- const l = (r, e) => typeof r?.["x-scalar-selected-server"] > "u" && e?.length ? e[0] : e?.find(({ url: t }) => t === r?.["x-scalar-selected-server"]) ?? null;
1
+ const i = (n, t) => n?.length ? t === void 0 ? n[0] : t === "" ? null : n.find(({ url: u }) => u === t) ?? null : null;
2
2
  export {
3
- l as getSelectedServer
3
+ i as getSelectedServer
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-events.d.ts","sourceRoot":"","sources":["../../src/v2/workspace-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAkB,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAE3G,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,KAAK,CAAA;AAExC,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,OAAO,CAAC;IACtD,eAAe,EAAE,CACf,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAC3B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IAClF,cAAc,EAAE,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;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACjC,KAAK,EAAE,KAAK,CAAA;CACb,QAqSA"}
@@ -1,15 +1,15 @@
1
- import { generateClientMutators as i } from "@scalar/workspace-store/mutators";
1
+ import { generateClientMutators as n } from "@scalar/workspace-store/mutators";
2
2
  import { computed as p } from "vue";
3
3
  const r = (a, c, t) => async (o) => {
4
- const n = await t[a]?.onBeforeExecute?.(o) ?? o;
5
- return await c(n), await t[a]?.onAfterExecute?.(n), n;
4
+ const i = await t[a]?.onBeforeExecute?.(o) ?? o;
5
+ return await c(i), await t[a]?.onAfterExecute?.(i), i;
6
6
  };
7
7
  function l({
8
8
  eventBus: a,
9
9
  store: c,
10
10
  hooks: t
11
11
  }) {
12
- const o = p(() => i(c.value)), n = ({ collectionType: e }) => e === "document" ? o.value.active() : o.value.workspace();
12
+ const o = p(() => n(c.value)), i = ({ collectionType: e }) => e === "document" ? o.value.active() : o.value.workspace();
13
13
  a.on(
14
14
  "workspace:update:active-proxy",
15
15
  (e) => r("workspace:update:active-proxy", o.value.workspace().workspace.updateActiveProxy, t)(e)
@@ -39,9 +39,6 @@ function l({
39
39
  ), a.on(
40
40
  "document:update:info",
41
41
  (e) => r("document:update:info", o.value.active().document.updateDocumentInfo, t)(e)
42
- ), a.on(
43
- "document:toggle:security",
44
- (e) => r("document:toggle:security", o.value.active().document.toggleSecurity, t)(e)
45
42
  ), a.on(
46
43
  "document:update:watch-mode",
47
44
  (e) => r("document:update:watch-mode", o.value.active().document.updateWatchMode, t)(e)
@@ -53,28 +50,28 @@ function l({
53
50
  (e) => r("document:delete:document", o.value.active().document.deleteDocument, t)(e)
54
51
  ), a.on(
55
52
  "environment:upsert:environment",
56
- (e) => r("environment:upsert:environment", n(e).environment.upsertEnvironment, t)(e)
53
+ (e) => r("environment:upsert:environment", i(e).environment.upsertEnvironment, t)(e)
57
54
  ), a.on(
58
55
  "environment:delete:environment",
59
- (e) => r("environment:delete:environment", n(e).environment.deleteEnvironment, t)(e)
56
+ (e) => r("environment:delete:environment", i(e).environment.deleteEnvironment, t)(e)
60
57
  ), a.on(
61
58
  "environment:upsert:environment-variable",
62
59
  (e) => r(
63
60
  "environment:upsert:environment-variable",
64
- n(e).environment.upsertEnvironmentVariable,
61
+ i(e).environment.upsertEnvironmentVariable,
65
62
  t
66
63
  )(e)
67
64
  ), a.on(
68
65
  "environment:delete:environment-variable",
69
66
  (e) => r(
70
67
  "environment:delete:environment-variable",
71
- n(e).environment.deleteEnvironmentVariable,
68
+ i(e).environment.deleteEnvironmentVariable,
72
69
  t
73
70
  )(e)
74
71
  ), a.on("cookie:upsert:cookie", async (e) => {
75
- await r("cookie:upsert:cookie", n(e).cookie.upsertCookie, t)(e);
72
+ await r("cookie:upsert:cookie", i(e).cookie.upsertCookie, t)(e);
76
73
  }), a.on("cookie:delete:cookie", async (e) => {
77
- await r("cookie:delete:cookie", n(e).cookie.deleteCookie, t)(e);
74
+ await r("cookie:delete:cookie", i(e).cookie.deleteCookie, t)(e);
78
75
  }), a.on(
79
76
  "auth:delete:security-scheme",
80
77
  (e) => r("auth:delete:security-scheme", o.value.active().auth.deleteSecurityScheme, t)(e)
@@ -94,6 +91,13 @@ function l({
94
91
  o.value.active().auth.updateSelectedSecuritySchemes,
95
92
  t
96
93
  )(e)
94
+ ), a.on(
95
+ "auth:clear:selected-security-schemes",
96
+ (e) => r(
97
+ "auth:clear:selected-security-schemes",
98
+ o.value.active().auth.clearSelectedSecuritySchemes,
99
+ t
100
+ )(e)
97
101
  ), a.on(
98
102
  "auth:update:security-scheme-secrets",
99
103
  (e) => r(
@@ -108,6 +112,9 @@ function l({
108
112
  o.value.active().auth.clearSecuritySchemeSecrets,
109
113
  t
110
114
  )(e)
115
+ ), a.on(
116
+ "server:initialize:servers",
117
+ (e) => r("server:initialize:servers", o.value.active().server.initializeServers, t)(e)
111
118
  ), a.on(
112
119
  "server:add:server",
113
120
  (e) => r("server:add:server", o.value.active().server.addServer, t)(e)
@@ -117,6 +124,9 @@ function l({
117
124
  ), a.on(
118
125
  "server:delete:server",
119
126
  (e) => r("server:delete:server", o.value.active().server.deleteServer, t)(e)
127
+ ), a.on(
128
+ "server:clear:servers",
129
+ (e) => r("server:clear:servers", o.value.active().server.clearServers, t)(e)
120
130
  ), a.on(
121
131
  "server:update:variables",
122
132
  (e) => r("server:update:variables", o.value.active().server.updateServerVariables, t)(e)
@@ -134,8 +144,8 @@ function l({
134
144
  t
135
145
  )(e)
136
146
  ), a.on(
137
- "operation:update:summary",
138
- (e) => r("operation:update:summary", o.value.active().operation.updateOperationSummary, t)(e)
147
+ "operation:update:meta",
148
+ (e) => r("operation:update:meta", o.value.active().operation.updateOperationMeta, t)(e)
139
149
  ), a.on(
140
150
  "operation:delete:operation",
141
151
  (e) => r("operation:delete:operation", o.value.active().operation.deleteOperation, t)(e)
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
33
33
  }));
34
34
  }, f = (u) => {
35
35
  u?.createNew && g.name === "request" && p();
36
- }, v = "2.29.4";
36
+ }, v = "2.31.0";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.29.4",
21
+ "version": "2.31.0",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -327,26 +327,26 @@
327
327
  "whatwg-mimetype": "4.0.0",
328
328
  "yaml": "^2.8.0",
329
329
  "zod": "^4.3.5",
330
- "@scalar/components": "0.19.10",
331
330
  "@scalar/analytics-client": "1.0.1",
331
+ "@scalar/components": "0.19.12",
332
332
  "@scalar/draggable": "0.3.0",
333
+ "@scalar/helpers": "0.2.16",
333
334
  "@scalar/icons": "0.5.3",
334
335
  "@scalar/import": "0.4.53",
335
- "@scalar/helpers": "0.2.16",
336
336
  "@scalar/json-magic": "0.11.5",
337
- "@scalar/oas-utils": "0.6.48",
338
- "@scalar/openapi-parser": "0.24.15",
337
+ "@scalar/oas-utils": "0.8.0",
339
338
  "@scalar/object-utils": "1.2.30",
339
+ "@scalar/openapi-parser": "0.24.15",
340
340
  "@scalar/openapi-types": "0.5.3",
341
341
  "@scalar/postman-to-openapi": "0.4.8",
342
- "@scalar/sidebar": "0.7.41",
343
342
  "@scalar/snippetz": "0.6.17",
344
- "@scalar/themes": "0.14.0",
345
- "@scalar/use-codemirror": "0.13.45",
343
+ "@scalar/sidebar": "0.7.43",
344
+ "@scalar/themes": "0.14.2",
346
345
  "@scalar/types": "0.6.8",
347
346
  "@scalar/use-hooks": "0.3.7",
348
- "@scalar/workspace-store": "0.34.4",
349
- "@scalar/use-toasts": "0.9.1"
347
+ "@scalar/use-codemirror": "0.13.47",
348
+ "@scalar/use-toasts": "0.9.1",
349
+ "@scalar/workspace-store": "0.35.1"
350
350
  },
351
351
  "devDependencies": {
352
352
  "@tailwindcss/vite": "^4.1.18",
@@ -362,8 +362,8 @@
362
362
  "vite-svg-loader": "5.1.0",
363
363
  "vitest": "4.0.16",
364
364
  "@scalar/build-tooling": "0.4.1",
365
- "@scalar/galaxy": "0.5.16",
366
- "@scalar/pre-post-request-scripts": "0.2.4"
365
+ "@scalar/pre-post-request-scripts": "0.2.6",
366
+ "@scalar/galaxy": "0.5.16"
367
367
  },
368
368
  "scripts": {
369
369
  "build": "scalar-build-vite",