@scalar/api-client 2.0.12 → 2.0.14

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 (54) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/App.vue.js +51 -28
  4. package/dist/Modal/api-client-modal.d.ts +2 -1
  5. package/dist/Modal/api-client-modal.d.ts.map +1 -1
  6. package/dist/Modal/api-client-modal.js +49 -40
  7. package/dist/components/ActionModal/ActionModalFolder.vue.js +37 -35
  8. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  9. package/dist/components/AddressBar/AddressBar.vue.js +1 -1
  10. package/dist/components/AddressBar/AddressBar.vue2.js +44 -44
  11. package/dist/components/AddressBar/AddressBarServer.vue.d.ts +1 -14
  12. package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
  13. package/dist/components/AddressBar/AddressBarServer.vue.js +54 -59
  14. package/dist/components/CodeInput/CodeInput.vue.d.ts +2 -0
  15. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  16. package/dist/components/CodeInput/CodeInput.vue.js +1 -1
  17. package/dist/components/CodeInput/CodeInput.vue2.js +16 -14
  18. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  19. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +15 -17
  20. package/dist/components/Sidebar/Sidebar.vue.js +5 -5
  21. package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
  22. package/dist/components/Sidebar/SidebarListElementActions.vue.js +12 -12
  23. package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
  24. package/dist/components/TopNav/TopNavItem.vue.js +1 -1
  25. package/dist/components/TopNav/TopNavItem.vue2.js +10 -7
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +8 -9
  29. package/dist/libs/index.d.ts +1 -0
  30. package/dist/libs/index.d.ts.map +1 -1
  31. package/dist/libs/index.js +10 -8
  32. package/dist/libs/local-storage.d.ts +9 -0
  33. package/dist/libs/local-storage.d.ts.map +1 -0
  34. package/dist/libs/local-storage.js +36 -0
  35. package/dist/router.d.ts +2 -2
  36. package/dist/router.d.ts.map +1 -1
  37. package/dist/router.js +13 -13
  38. package/dist/store/workspace.d.ts +511 -269
  39. package/dist/store/workspace.d.ts.map +1 -1
  40. package/dist/store/workspace.js +213 -157
  41. package/dist/style.css +1 -1
  42. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  43. package/dist/views/Request/Request.vue.js +1 -1
  44. package/dist/views/Request/Request.vue2.js +105 -102
  45. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  46. package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -0
  47. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  48. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  49. package/dist/views/Request/RequestSidebarItem.vue2.js +25 -25
  50. package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts.map +1 -1
  51. package/dist/views/Request/ResponseSection/ResponseBody.vue.js +2 -2
  52. package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +56 -56
  53. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +11 -11
  54. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  import o from "./TopNavItem.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-095ab46d"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9a892de6"]]);
5
5
  export {
6
6
  r as default
7
7
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as m, openBlock as i, createBlock as s, unref as n, withCtx as l, createElementVNode as o, normalizeClass as p, createVNode as a, toDisplayString as f, createCommentVNode as v } from "vue";
2
- import y from "../ScalarHotkey.vue.js";
3
- import { ScalarTooltip as k, ScalarIcon as c } from "@scalar/components";
1
+ import { defineComponent as m, openBlock as s, createBlock as i, unref as n, withCtx as l, createElementVNode as o, normalizeClass as p, createVNode as a, toDisplayString as f, createCommentVNode as k } from "vue";
2
+ import v from "../ScalarHotkey.vue.js";
3
+ import { ScalarTooltip as y, ScalarIcon as c } from "@scalar/components";
4
4
  const d = { class: "nav-item-icon-copy flex flex-1 items-center justify-center gap-1.5" }, u = { class: "nav-item-copy text-xs" }, b = /* @__PURE__ */ m({
5
5
  __name: "TopNavItem",
6
6
  props: {
@@ -11,7 +11,7 @@ const d = { class: "nav-item-icon-copy flex flex-1 items-center justify-center g
11
11
  },
12
12
  emits: ["click", "close"],
13
13
  setup(C) {
14
- return (e, t) => (i(), s(n(k), {
14
+ return (e, t) => (s(), i(n(y), {
15
15
  class: "scalar-client",
16
16
  delay: 500,
17
17
  resize: "",
@@ -35,15 +35,18 @@ const d = { class: "nav-item-icon-copy flex flex-1 items-center justify-center g
35
35
  type: "button",
36
36
  onClick: t[0] || (t[0] = (r) => e.$emit("close"))
37
37
  }, [
38
- a(n(c), { icon: "Close" })
38
+ a(n(c), {
39
+ class: "stroke-[1.75]",
40
+ icon: "Close"
41
+ })
39
42
  ])
40
43
  ], 2)
41
44
  ]),
42
45
  content: l(() => [
43
- e.hotkey ? (i(), s(y, {
46
+ e.hotkey ? (s(), i(v, {
44
47
  key: 0,
45
48
  hotkey: e.hotkey
46
- }, null, 8, ["hotkey"])) : v("", !0)
49
+ }, null, 8, ["hotkey"])) : k("", !0)
47
50
  ]),
48
51
  _: 1
49
52
  }));
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { default as ScalarClient } from './App.vue.js';
2
2
  export * from './Modal/index.js';
3
3
  export { useWorkspace } from './store/workspace.js';
4
- export { clientRoutes, clientRouter } from './router.js';
4
+ export { modalRouter } from './router.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
- import { default as o } from "./App.vue.js";
1
+ import { default as t } from "./App.vue.js";
2
2
  /* empty css */
3
3
  import { useWorkspace as l } from "./store/workspace.js";
4
- import { clientRouter as i, clientRoutes as f } from "./router.js";
5
- import { default as m } from "./Modal/ApiClientModal.vue.js";
6
- import { createScalarApiClient as s } from "./Modal/api-client-modal.js";
4
+ import { modalRouter as f } from "./router.js";
5
+ import { default as i } from "./Modal/ApiClientModal.vue.js";
6
+ import { createScalarApiClient as c } from "./Modal/api-client-modal.js";
7
7
  export {
8
- m as ApiClientModal,
9
- o as ScalarClient,
10
- i as clientRouter,
11
- f as clientRoutes,
12
- s as createScalarApiClient,
8
+ i as ApiClientModal,
9
+ t as ScalarClient,
10
+ c as createScalarApiClient,
11
+ f as modalRouter,
13
12
  l as useWorkspace
14
13
  };
@@ -1,5 +1,6 @@
1
1
  export * from './formatters.js';
2
2
  export * from './eventBusses/index.js';
3
+ export * from './local-storage.js';
3
4
  export * from './pathParams.js';
4
5
  export { sendRequest } from './sendRequest.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1,11 +1,13 @@
1
- import { formatBytes as o, formatMs as t } from "./formatters.js";
2
- import { syncPathParamsFromURL as s } from "./pathParams.js";
3
- import { sendRequest as a } from "./sendRequest.js";
4
- import { executeRequestBus as p } from "./eventBusses/executeRequestBus.js";
1
+ import { formatBytes as r, formatMs as t } from "./formatters.js";
2
+ import { loadAllResources as m } from "./local-storage.js";
3
+ import { syncPathParamsFromURL as a } from "./pathParams.js";
4
+ import { sendRequest as p } from "./sendRequest.js";
5
+ import { executeRequestBus as R } from "./eventBusses/executeRequestBus.js";
5
6
  export {
6
- p as executeRequestBus,
7
- o as formatBytes,
7
+ R as executeRequestBus,
8
+ r as formatBytes,
8
9
  t as formatMs,
9
- a as sendRequest,
10
- s as syncPathParamsFromURL
10
+ m as loadAllResources,
11
+ p as sendRequest,
12
+ a as syncPathParamsFromURL
11
13
  };
@@ -0,0 +1,9 @@
1
+ import type { useWorkspace } from '../store/workspace.js';
2
+ /**
3
+ * Loads all resources from localStorage into mutators on app start
4
+ * We use the raw mutator.add here instead of the custom ones because we do NOT want any side effects
5
+ *
6
+ * Currently not working for workspace
7
+ */
8
+ export declare const loadAllResources: (mutators: ReturnType<typeof useWorkspace>, workspaceUid?: string) => void;
9
+ //# sourceMappingURL=local-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../src/libs/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAcrD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aACjB,UAAU,CAAC,OAAO,YAAY,CAAC,gCAoE1C,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { LS_KEYS as e } from "@scalar/object-utils/mutator-record";
2
+ const h = (t, o = "default") => {
3
+ const {
4
+ collectionMutators: s,
5
+ cookieMutators: a,
6
+ environmentMutators: r,
7
+ folderMutators: c,
8
+ requestExampleMutators: l,
9
+ requestMutators: E,
10
+ serverMutators: u,
11
+ securitySchemeMutators: S,
12
+ workspaceMutators: O
13
+ } = t;
14
+ Object.values(
15
+ JSON.parse(localStorage.getItem(e.COLLECTION) || "{}")
16
+ ).forEach(s.rawAdd), Object.values(
17
+ JSON.parse(localStorage.getItem(e.COOKIE) || "{}")
18
+ ).forEach(a.add), Object.values(
19
+ JSON.parse(localStorage.getItem(e.ENVIRONMENT) || "{}")
20
+ ).forEach(r.add), Object.values(
21
+ JSON.parse(localStorage.getItem(e.FOLDER) || "{}")
22
+ ).forEach(c.rawAdd), Object.values(
23
+ JSON.parse(localStorage.getItem(e.REQUEST_EXAMPLE) || "{}")
24
+ ).forEach(l.rawAdd), Object.values(
25
+ JSON.parse(localStorage.getItem(e.REQUEST) || "{}")
26
+ ).forEach(E.rawAdd), Object.values(
27
+ JSON.parse(localStorage.getItem(e.SERVER) || "{}")
28
+ ).forEach(u.rawAdd), Object.values(
29
+ JSON.parse(localStorage.getItem(e.SECURITY_SCHEME) || "{}")
30
+ ).forEach(S.add), Object.values(
31
+ JSON.parse(localStorage.getItem(e.WORKSPACE + o) || "{}")
32
+ ).forEach(O.add);
33
+ };
34
+ export {
35
+ h as loadAllResources
36
+ };
package/dist/router.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare enum PathId {
8
8
  Server = "server"
9
9
  }
10
10
  /** Routes required by the client modal */
11
- export declare const clientRoutes: ({
11
+ export declare const modalRoutes: ({
12
12
  path: string;
13
13
  redirect: string;
14
14
  component?: undefined;
@@ -19,7 +19,7 @@ export declare const clientRoutes: ({
19
19
  })[];
20
20
  export declare const router: import("vue-router").Router;
21
21
  /** Creates the in memory client router */
22
- export declare const clientRouter: import("vue-router").Router;
22
+ export declare const modalRouter: import("vue-router").Router;
23
23
  export declare const activeRouterParams: import("vue").ComputedRef<{
24
24
  collection: string;
25
25
  environment: string;
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAGA,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED,0CAA0C;AAC1C,eAAO,MAAM,YAAY;;;;;;;;IAcxB,CAAA;AAyDD,eAAO,MAAM,MAAM,6BAGjB,CAAA;AAEF,0CAA0C;AAC1C,eAAO,MAAM,YAAY,6BAGvB,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;EAyB7B,CAAA;AAEF,gGAAgG;AAChG,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,QAmBtC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAGA,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED,0CAA0C;AAC1C,eAAO,MAAM,WAAW;;;;;;;;IAcvB,CAAA;AAyDD,eAAO,MAAM,MAAM,6BAGjB,CAAA;AAEF,0CAA0C;AAC1C,eAAO,MAAM,WAAW,6BAGtB,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;EAyB7B,CAAA;AAEF,gGAAgG;AAChG,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,QAmBtC"}
package/dist/router.js CHANGED
@@ -1,5 +1,5 @@
1
- import { computed as i } from "vue";
2
- import { createRouter as c, createWebHistory as l, createMemoryHistory as m } from "vue-router";
1
+ import { computed as m } from "vue";
2
+ import { createRouter as c, createWebHistory as l, createMemoryHistory as i } from "vue-router";
3
3
  var u = /* @__PURE__ */ ((e) => (e.Request = "request", e.Example = "example", e.Cookies = "cookies", e.Collection = "collection", e.Schema = "schema", e.Environment = "environment", e.Server = "server", e))(u || {});
4
4
  const s = [
5
5
  { path: "/", redirect: "/request/default" },
@@ -71,10 +71,10 @@ const s = [
71
71
  ], t = c({
72
72
  history: l(),
73
73
  routes: p
74
- }), a = c({
75
- history: m(),
74
+ }), n = c({
75
+ history: i(),
76
76
  routes: s
77
- }), f = i(() => {
77
+ }), d = m(() => {
78
78
  const e = {
79
79
  collection: "default",
80
80
  environment: "default",
@@ -83,15 +83,15 @@ const s = [
83
83
  schema: "default",
84
84
  cookies: "default",
85
85
  server: "default"
86
- }, o = a.currentRoute.value.matched.length ? a.currentRoute.value : t.currentRoute.value;
86
+ }, o = n.currentRoute.value.matched.length ? n.currentRoute.value : t.currentRoute.value;
87
87
  return o && Object.values(u).forEach((r) => {
88
88
  o.params[r] && (e[r] = o.params[r]);
89
89
  }), e;
90
90
  });
91
- function d(e, o) {
92
- var r, n;
91
+ function f(e, o) {
92
+ var r, a;
93
93
  t.currentRoute.value && // If the item is missing then we know the UID is no longer in use and redirect to the default
94
- !o && ((r = t.currentRoute.value) != null && r.params[e]) && ((n = t.currentRoute.value) == null ? void 0 : n.params[e]) !== "default" && // We only redirect if the key is missing for the matching route
94
+ !o && ((r = t.currentRoute.value) != null && r.params[e]) && ((a = t.currentRoute.value) == null ? void 0 : a.params[e]) !== "default" && // We only redirect if the key is missing for the matching route
95
95
  t.currentRoute.value.path.includes(e) && t.push({
96
96
  params: {
97
97
  ...t.currentRoute.value.params,
@@ -101,9 +101,9 @@ function d(e, o) {
101
101
  }
102
102
  export {
103
103
  u as PathId,
104
- f as activeRouterParams,
105
- a as clientRouter,
106
- s as clientRoutes,
107
- d as fallbackMissingParams,
104
+ d as activeRouterParams,
105
+ f as fallbackMissingParams,
106
+ n as modalRouter,
107
+ s as modalRoutes,
108
108
  t as router
109
109
  };