@scalar/api-client 2.24.0 → 2.25.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 (28) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  4. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -2
  5. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  6. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -2
  7. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  8. package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
  9. package/dist/v2/features/app/App.vue.d.ts +4 -1
  10. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  11. package/dist/v2/features/app/App.vue.js +60 -54
  12. package/dist/v2/features/app/app-state.d.ts +41 -9
  13. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  14. package/dist/v2/features/app/app-state.js +200 -192
  15. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +2 -2
  16. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  17. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  18. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +3 -3
  19. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  20. package/dist/v2/features/app/helpers/filter-workspaces.d.ts +49 -0
  21. package/dist/v2/features/app/helpers/filter-workspaces.d.ts.map +1 -0
  22. package/dist/v2/features/app/helpers/filter-workspaces.js +5 -0
  23. package/dist/v2/features/app/helpers/group-workspaces.d.ts +24 -0
  24. package/dist/v2/features/app/helpers/group-workspaces.d.ts.map +1 -0
  25. package/dist/v2/features/app/helpers/group-workspaces.js +23 -0
  26. package/dist/v2/features/operation/Operation.vue.js +1 -1
  27. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  28. package/package.json +11 -11
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Filters workspaces to show only those accessible to the current team.
3
+ *
4
+ * A workspace is accessible if:
5
+ * - Its teamUid matches the current team, OR
6
+ * - Its teamUid is 'local' (local workspaces are always accessible)
7
+ *
8
+ * @param workspaces - Array of workspaces to filter
9
+ * @param currentTeamUid - The currently active team identifier
10
+ * @returns Filtered array of workspaces accessible to the current team
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const workspaces = [
15
+ * { id: '1', teamUid: 'local', name: 'Local' },
16
+ * { id: '2', teamUid: 'team-a', name: 'Team A' },
17
+ * { id: '3', teamUid: 'team-b', name: 'Team B' },
18
+ * ]
19
+ *
20
+ * filterWorkspacesByTeam(workspaces, 'team-a')
21
+ * // => [{ id: '1', teamUid: 'local' }, { id: '2', teamUid: 'team-a' }]
22
+ * ```
23
+ */
24
+ export declare const filterWorkspacesByTeam: <T extends {
25
+ teamUid: string;
26
+ }>(workspaces: T[], currentTeamUid: string) => T[];
27
+ /**
28
+ * Checks if a workspace can be loaded by the current team.
29
+ *
30
+ * A workspace can be loaded if:
31
+ * - Its teamUid matches the current team, OR
32
+ * - Its teamUid is 'local' (local workspaces are always accessible)
33
+ *
34
+ * This is used during route changes to prevent users from accessing
35
+ * workspaces that do not belong to their active team.
36
+ *
37
+ * @param workspaceTeamUid - The team identifier of the workspace to check
38
+ * @param currentTeamUid - The currently active team identifier
39
+ * @returns true if the workspace can be loaded, false otherwise
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * canLoadWorkspace('team-a', 'team-a') // => true
44
+ * canLoadWorkspace('local', 'team-a') // => true
45
+ * canLoadWorkspace('team-b', 'team-a') // => false
46
+ * ```
47
+ */
48
+ export declare const canLoadWorkspace: (workspaceTeamUid: string, currentTeamUid: string) => boolean;
49
+ //# sourceMappingURL=filter-workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/filter-workspaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,YAAY,CAAC,EAAE,EAAE,gBAAgB,MAAM,KAAG,CAAC,EAEhH,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,MAAM,EAAE,gBAAgB,MAAM,KAAG,OAEnF,CAAA"}
@@ -0,0 +1,5 @@
1
+ const a = (r, t) => r.filter((e) => o(e.teamUid, t)), o = (r, t) => r === t || r === "local";
2
+ export {
3
+ o as canLoadWorkspace,
4
+ a as filterWorkspacesByTeam
5
+ };
@@ -0,0 +1,24 @@
1
+ import type { WorkspaceGroup } from '@scalar/components';
2
+ /**
3
+ * Represents a workspace with team information.
4
+ * Used to group workspaces by team or local status.
5
+ */
6
+ export type WorkspaceItem = {
7
+ /** Unique identifier for the workspace. */
8
+ id: string;
9
+ /** Display name of the workspace. */
10
+ label: string;
11
+ /** Team identifier. Use 'local' for local workspaces. */
12
+ teamUid: string;
13
+ };
14
+ /**
15
+ * Groups workspaces into team and local categories.
16
+ * Team workspaces are listed first (if not viewing local workspaces),
17
+ * followed by local workspaces.
18
+ *
19
+ * @param workspaces - Array of workspaces to group
20
+ * @param currentTeamUid - Current team identifier ('local' for local team)
21
+ * @returns Array of workspace groups with labels and options
22
+ */
23
+ export declare function groupWorkspacesByTeam(workspaces: WorkspaceItem[], currentTeamUid: string): WorkspaceGroup[];
24
+ //# sourceMappingURL=group-workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-workspaces.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/group-workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE7E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,cAAc,EAAE,CAsC3G"}
@@ -0,0 +1,23 @@
1
+ function p(n, t) {
2
+ const a = n.reduce((e, o) => {
3
+ const l = o.teamUid;
4
+ return e[l] || (e[l] = []), e[l].push({
5
+ id: o.id,
6
+ label: o.label
7
+ }), e;
8
+ }, {}), s = [];
9
+ if (t !== "local") {
10
+ const e = a[t] ?? [];
11
+ e.length > 0 && s.push({
12
+ label: "Team Workspaces",
13
+ options: e
14
+ });
15
+ }
16
+ return s.push({
17
+ label: "Local Workspaces",
18
+ options: a.local ?? []
19
+ }), s;
20
+ }
21
+ export {
22
+ p as groupWorkspacesByTeam
23
+ };
@@ -76,7 +76,7 @@ const E = {
76
76
  )
77
77
  )), S = n(
78
78
  () => C(r(e.options)?.hiddenClients)
79
- ), y = "2.24.0";
79
+ ), y = "2.25.0";
80
80
  return (t, a) => e.path && e.method && e.exampleName && u.value ? (l(), x(i(N), {
81
81
  key: 0,
82
82
  activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
@@ -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.24.0";
36
+ }, v = "2.25.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.24.0",
21
+ "version": "2.25.0",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -327,25 +327,25 @@
327
327
  "yaml": "^2.8.0",
328
328
  "zod": "^4.3.5",
329
329
  "@scalar/analytics-client": "1.0.1",
330
- "@scalar/components": "0.17.6",
331
330
  "@scalar/draggable": "0.3.0",
332
- "@scalar/json-magic": "0.10.0",
331
+ "@scalar/components": "0.18.0",
333
332
  "@scalar/helpers": "0.2.11",
334
- "@scalar/import": "0.4.48",
335
333
  "@scalar/icons": "0.5.2",
334
+ "@scalar/json-magic": "0.10.0",
335
+ "@scalar/import": "0.4.48",
336
+ "@scalar/oas-utils": "0.6.37",
336
337
  "@scalar/object-utils": "1.2.25",
337
- "@scalar/openapi-parser": "0.24.8",
338
- "@scalar/oas-utils": "0.6.36",
339
338
  "@scalar/openapi-types": "0.5.3",
340
- "@scalar/postman-to-openapi": "0.4.3",
341
- "@scalar/sidebar": "0.7.29",
339
+ "@scalar/openapi-parser": "0.24.8",
340
+ "@scalar/sidebar": "0.7.30",
342
341
  "@scalar/snippetz": "0.6.11",
342
+ "@scalar/postman-to-openapi": "0.4.3",
343
343
  "@scalar/themes": "0.14.0",
344
344
  "@scalar/types": "0.6.2",
345
- "@scalar/use-codemirror": "0.13.33",
345
+ "@scalar/use-codemirror": "0.13.34",
346
+ "@scalar/use-hooks": "0.3.7",
346
347
  "@scalar/use-toasts": "0.9.1",
347
- "@scalar/workspace-store": "0.29.0",
348
- "@scalar/use-hooks": "0.3.7"
348
+ "@scalar/workspace-store": "0.30.0"
349
349
  },
350
350
  "devDependencies": {
351
351
  "@tailwindcss/vite": "^4.1.18",