@vicinae/api 0.16.8 → 0.16.9

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/dist/api/alert.js CHANGED
@@ -40,7 +40,7 @@ const confirmAlert = async (options) => {
40
40
  style: styleMap[options.dismissAction?.style ?? Alert.ActionStyle.Cancel],
41
41
  },
42
42
  });
43
- bus_1.bus.turboRequest("ui.confirmAlert", req).then((res) => {
43
+ bus_1.bus.request("ui.confirmAlert", req).then((res) => {
44
44
  if (!res.ok)
45
45
  return false;
46
46
  if (res.value.confirmed) {
package/dist/api/bus.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { MessagePort } from "worker_threads";
1
+ import { type MessagePort } from "node:worker_threads";
2
2
  import * as ipc from "./proto/ipc";
3
3
  import * as extension from "./proto/extension";
4
- import { Result } from "./lib/result";
4
+ import { type Result } from "./lib/result";
5
5
  /**
6
6
  * @ignore
7
7
  */
@@ -93,7 +93,7 @@ declare class Bus {
93
93
  private requestMap;
94
94
  private safeRequestMap;
95
95
  private eventListeners;
96
- turboRequest<T extends RequestEndpoint>(endpoint: T, data: Map[T]["request"]): Promise<Result<Map[T]["response"], Error>>;
96
+ request<T extends RequestEndpoint>(endpoint: T, data: Map[T]["request"]): Promise<Result<Map[T]["response"], Error>>;
97
97
  private handleSafeMessage;
98
98
  emitCrash(errorText: string): void;
99
99
  constructor(port: MessagePort);
@@ -109,7 +109,7 @@ declare class Bus {
109
109
  };
110
110
  replaceEventHandler(id: string, handler: EventListenerInfo["callback"]): void;
111
111
  removeEventHandler(id: string): void;
112
- private request2;
112
+ private requestImpl;
113
113
  }
114
114
  /**
115
115
  * @ignore
package/dist/api/bus.js CHANGED
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.bus = void 0;
37
- const crypto_1 = require("crypto");
38
- const worker_threads_1 = require("worker_threads");
37
+ const node_crypto_1 = require("node:crypto");
38
+ const node_worker_threads_1 = require("node:worker_threads");
39
39
  const ipc = __importStar(require("./proto/ipc"));
40
40
  const extension = __importStar(require("./proto/extension"));
41
41
  const result_1 = require("./lib/result");
@@ -44,19 +44,19 @@ class Bus {
44
44
  requestMap = new Map();
45
45
  safeRequestMap = new Map();
46
46
  eventListeners = new Map();
47
- async turboRequest(endpoint, data) {
47
+ async request(endpoint, data) {
48
48
  const [category, requestId] = endpoint.split(".");
49
49
  const request = extension.RequestData.create({
50
50
  [category]: { [requestId]: data },
51
51
  });
52
- const res = await this.request2(request);
52
+ const res = await this.requestImpl(request);
53
53
  if (!res.ok) {
54
54
  return (0, result_1.Err)(res.error);
55
55
  }
56
56
  const resData = res.value[category]?.[requestId];
57
- if (!resData)
57
+ if (!resData) {
58
58
  return (0, result_1.Err)(Error(`Invalid response for request of type ${endpoint}: ${JSON.stringify(res, null, 2)}`));
59
- //console.error(`Got valid response for ${endpoint}`);
59
+ }
60
60
  return (0, result_1.Ok)(resData);
61
61
  }
62
62
  handleSafeMessage(message) {
@@ -86,7 +86,7 @@ class Bus {
86
86
  emitCrash(errorText) {
87
87
  this.sendMessage({
88
88
  event: {
89
- id: (0, crypto_1.randomUUID)(),
89
+ id: (0, node_crypto_1.randomUUID)(),
90
90
  crash: { text: errorText },
91
91
  },
92
92
  });
@@ -110,7 +110,7 @@ class Bus {
110
110
  }
111
111
  subscribe(type, cb) {
112
112
  const item = { callback: cb };
113
- let listeners = this.eventListeners.get(type);
113
+ const listeners = this.eventListeners.get(type);
114
114
  if (!listeners) {
115
115
  this.eventListeners.set(type, [item]);
116
116
  }
@@ -143,7 +143,7 @@ class Bus {
143
143
  this.port.postMessage(ipc.ExtensionMessage.encode(message).finish());
144
144
  }
145
145
  addEventHandler(cb) {
146
- const id = `handler-${(0, crypto_1.randomUUID)()}`;
146
+ const id = `handler-${(0, node_crypto_1.randomUUID)()}`;
147
147
  const { unsubscribe } = this.subscribe(id, cb);
148
148
  return { id, unsubscribe };
149
149
  }
@@ -155,8 +155,8 @@ class Bus {
155
155
  removeEventHandler(id) {
156
156
  this.eventListeners.delete(id);
157
157
  }
158
- request2(data, options = {}) {
159
- const req = extension.Request.create({ requestId: (0, crypto_1.randomUUID)(), data });
158
+ requestImpl(data, options = {}) {
159
+ const req = extension.Request.create({ requestId: (0, node_crypto_1.randomUUID)(), data });
160
160
  return new Promise((resolve, reject) => {
161
161
  let timeout;
162
162
  if (options.timeout) {
@@ -188,4 +188,4 @@ class Bus {
188
188
  * IPC bus to communicate with the extension manager.
189
189
  * If you are using this from inside your extension, you are WRONG and you should stop.
190
190
  */
191
- exports.bus = new Bus(worker_threads_1.parentPort);
191
+ exports.bus = new Bus(node_worker_threads_1.parentPort);
@@ -34,7 +34,7 @@ var Clipboard;
34
34
  * does not get indexed by the Vicinae clipboard manager.
35
35
  */
36
36
  async function copy(text, options = {}) {
37
- await bus_1.bus.turboRequest("clipboard.copy", {
37
+ await bus_1.bus.request("clipboard.copy", {
38
38
  content: mapContent(text),
39
39
  options: { concealed: options.concealed ?? false },
40
40
  });
@@ -47,7 +47,7 @@ var Clipboard;
47
47
  * clipboard copy.
48
48
  */
49
49
  async function paste(text) {
50
- await bus_1.bus.turboRequest("clipboard.paste", {
50
+ await bus_1.bus.request("clipboard.paste", {
51
51
  content: mapContent(text),
52
52
  });
53
53
  }
@@ -61,7 +61,7 @@ var Clipboard;
61
61
  * ```
62
62
  */
63
63
  async function read(options) {
64
- const res = await bus_1.bus.turboRequest("clipboard.readContent", {});
64
+ const res = await bus_1.bus.request("clipboard.readContent", {});
65
65
  return res.unwrap().content;
66
66
  }
67
67
  Clipboard.read = read;
@@ -84,7 +84,7 @@ var Clipboard;
84
84
  * Clear the current clipboard content.
85
85
  */
86
86
  async function clear() {
87
- await bus_1.bus.turboRequest("clipboard.clear", {});
87
+ await bus_1.bus.request("clipboard.clear", {});
88
88
  }
89
89
  Clipboard.clear = clear;
90
90
  })(Clipboard || (exports.Clipboard = Clipboard = {}));
@@ -13,5 +13,5 @@ async function updateCommandMetadata(metadata) {
13
13
  if (Object.prototype.hasOwnProperty.call(metadata, "subtitle")) {
14
14
  payload.subtitle = metadata.subtitle ?? undefined;
15
15
  }
16
- await bus_1.bus.turboRequest("command.updateCommandMetadata", payload);
16
+ await bus_1.bus.request("command.updateCommandMetadata", payload);
17
17
  }
@@ -1,6 +1,6 @@
1
- import type { ReactNode } from "react";
2
- import type { Keyboard } from "../keyboard";
1
+ import React, { type ReactNode } from "react";
3
2
  import { type Image } from "../image";
3
+ import type { Keyboard } from "../keyboard";
4
4
  /**
5
5
  * @category Actions
6
6
  */
@@ -21,7 +21,6 @@ export declare namespace ActionPanel {
21
21
  icon?: Image.ImageLike;
22
22
  shortcut?: Keyboard.Shortcut;
23
23
  onOpen?: () => void;
24
- onSearchTextChange?: (text: string) => void;
25
24
  children: ReactNode;
26
25
  };
27
26
  }
@@ -29,7 +28,7 @@ export declare namespace ActionPanel {
29
28
  /**
30
29
  * @category Actions
31
30
  */
32
- export declare const ActionPanel: import("react").FC<ActionPanel.Props> & {
33
- Section: import("react").FC<import("react").PropsWithChildren<ActionPanel.Section.Props>>;
34
- Submenu: import("react").FC<ActionPanel.Submenu.Props>;
31
+ export declare const ActionPanel: React.FC<ActionPanel.Props> & {
32
+ Section: React.FC<React.PropsWithChildren<ActionPanel.Section.Props>>;
33
+ Submenu: React.FC<ActionPanel.Submenu.Props>;
35
34
  };
@@ -2,9 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionPanel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const node_crypto_1 = require("node:crypto");
6
+ const react_1 = require("react");
5
7
  const image_1 = require("../image");
6
8
  const ActionPanelRoot = (props) => {
7
- const nativeProps = props;
9
+ const stableIdRef = (0, react_1.useRef)(undefined);
10
+ if (!stableIdRef.current) {
11
+ stableIdRef.current = (0, node_crypto_1.randomUUID)();
12
+ }
13
+ const nativeProps = {
14
+ ...props,
15
+ stableId: stableIdRef.current,
16
+ };
8
17
  return (0, jsx_runtime_1.jsx)("action-panel", { ...nativeProps });
9
18
  };
10
19
  const ActionPanelSection = (props) => {
@@ -14,8 +23,12 @@ const ActionPanelSection = (props) => {
14
23
  return ((0, jsx_runtime_1.jsx)("action-panel-section", { ...nativeProps, children: props.children }));
15
24
  };
16
25
  const ActionPannelSubmenu = ({ children, icon, ...props }) => {
26
+ const stableIdRef = (0, react_1.useRef)(undefined);
27
+ if (!stableIdRef.current) {
28
+ stableIdRef.current = (0, node_crypto_1.randomUUID)();
29
+ }
17
30
  const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
18
- return ((0, jsx_runtime_1.jsx)("action-panel-submenu", { ...props, icon: serializedIcon, children: children }));
31
+ return ((0, jsx_runtime_1.jsx)("action-panel-submenu", { ...props, icon: serializedIcon, stableId: stableIdRef.current, children: children }));
19
32
  };
20
33
  /**
21
34
  * @category Actions
@@ -1,9 +1,9 @@
1
- import React, { ReactNode } from "react";
1
+ import React, { type ReactNode } from "react";
2
2
  import type { PathLike } from "node:fs";
3
3
  import { Clipboard } from "../clipboard";
4
4
  import { type ImageLike } from "../image";
5
5
  import type { Keyboard } from "../keyboard";
6
- import { Application } from "../utils";
6
+ import { type Application } from "../utils";
7
7
  import type { Form } from "./form";
8
8
  import { Icon } from "../icon";
9
9
  type BaseActionProps = {
@@ -2,17 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Action = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const node_crypto_1 = require("node:crypto");
5
7
  const index_1 = require("../hooks/index");
6
8
  const clipboard_1 = require("../clipboard");
7
9
  const image_1 = require("../image");
8
10
  const utils_1 = require("../utils");
9
11
  const icon_1 = require("../icon");
10
12
  const controls_1 = require("../controls");
11
- const ActionRoot = (props) => {
12
- const serializedIcon = props.icon
13
- ? (0, image_1.serializeProtoImage)(props.icon)
14
- : props.icon;
15
- return (0, jsx_runtime_1.jsx)("action", { ...props, icon: serializedIcon });
13
+ const ActionRoot = ({ icon, ...props }) => {
14
+ const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
15
+ const stableIdRef = (0, react_1.useRef)(undefined);
16
+ if (!stableIdRef.current) {
17
+ stableIdRef.current = (0, node_crypto_1.randomUUID)();
18
+ }
19
+ return ((0, jsx_runtime_1.jsx)("action", { ...props, icon: serializedIcon, stableId: stableIdRef.current }));
16
20
  };
17
21
  const CopyToClipboard = ({ title = "Copy to clipboard", icon = icon_1.Icon.CopyClipboard, content, concealed = false, onCopy, ...props }) => {
18
22
  return ((0, jsx_runtime_1.jsx)(ActionRoot, { title: title, ...props, icon: icon_1.Icon.CopyClipboard, onAction: async () => {
@@ -33,8 +37,8 @@ const Open = ({ target, app, ...props }) => {
33
37
  (0, utils_1.open)(target, app);
34
38
  } }));
35
39
  };
36
- const OpenInBrowser = ({ url, ...props }) => {
37
- return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
40
+ const OpenInBrowser = ({ url, title = "Open in Browser", ...props }) => {
41
+ return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, title: title, onAction: () => {
38
42
  (0, utils_1.open)(url);
39
43
  } }));
40
44
  };
@@ -51,8 +55,13 @@ const Push = ({ target, ...props }) => {
51
55
  } }));
52
56
  };
53
57
  const SubmitForm = ({ title = "Submit", ...props }) => {
58
+ const stableIdRef = (0, react_1.useRef)(undefined);
59
+ if (!stableIdRef.current) {
60
+ stableIdRef.current = (0, node_crypto_1.randomUUID)();
61
+ }
54
62
  const nativeProps = {
55
63
  ...props,
64
+ stableId: stableIdRef.current,
56
65
  title,
57
66
  icon: props.icon ? (0, image_1.serializeProtoImage)(props.icon) : props.icon,
58
67
  onAction: () => { },
@@ -60,8 +69,13 @@ const SubmitForm = ({ title = "Submit", ...props }) => {
60
69
  return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
61
70
  };
62
71
  const CreateQuicklink = ({ title = "Create Quicklink", quicklink, ...props }) => {
72
+ const stableIdRef = (0, react_1.useRef)(undefined);
73
+ if (!stableIdRef.current) {
74
+ stableIdRef.current = (0, node_crypto_1.randomUUID)();
75
+ }
63
76
  const nativeProps = {
64
77
  ...props,
78
+ stableId: stableIdRef.current,
65
79
  title,
66
80
  type: "create-quicklink",
67
81
  quicklink: {
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  /**
3
3
  * @ignore
4
4
  */
@@ -16,22 +16,39 @@ const View = ({ children }) => {
16
16
  */
17
17
  const NavigationProvider = ({ root }) => {
18
18
  const [navStack, setNavStack] = (0, react_1.useState)([root]);
19
+ const pendingShutdown = (0, react_1.useRef)(false);
19
20
  const pop = () => {
21
+ if (pendingShutdown.current)
22
+ return;
20
23
  // we ask Vicinae to pop the current view, but we need to wait
21
24
  // for the pop-view event to be fired in order to dismount it from
22
25
  // our local view stack: otherwise Vicinae might miss a render.
23
- bus_1.bus.turboRequest("ui.popView", {});
26
+ bus_1.bus.request("ui.popView", {});
24
27
  };
25
28
  const push = (node) => {
26
- bus_1.bus.turboRequest("ui.pushView", {}).then(() => {
29
+ if (pendingShutdown.current)
30
+ return;
31
+ bus_1.bus.request("ui.pushView", {}).then(() => {
27
32
  setNavStack((cur) => [...cur, node]);
28
33
  });
29
34
  };
30
35
  (0, react_1.useEffect)(() => {
36
+ if (pendingShutdown.current && navStack.length === 0) {
37
+ process.exit(0);
38
+ }
39
+ }, [navStack]);
40
+ (0, react_1.useEffect)(() => {
41
+ const shutdown = bus_1.bus.subscribe("shutdown", () => {
42
+ pendingShutdown.current = true;
43
+ setNavStack([]);
44
+ });
31
45
  const listener = bus_1.bus.subscribe("pop-view", () => {
32
46
  setNavStack((cur) => cur.slice(0, -1));
33
47
  });
34
- return () => listener.unsubscribe();
48
+ return () => {
49
+ shutdown.unsubscribe();
50
+ listener.unsubscribe();
51
+ };
35
52
  }, []);
36
53
  return ((0, jsx_runtime_1.jsx)(navigation_context_1.default.Provider, { value: {
37
54
  push,
@@ -71,7 +71,7 @@ const popToRootProtoMap = {
71
71
  * @category Launcher Window
72
72
  */
73
73
  const showHUD = async (title, options) => {
74
- bus_1.bus.turboRequest("ui.showHud", {
74
+ bus_1.bus.request("ui.showHud", {
75
75
  text: title,
76
76
  clearRootSearch: options?.clearRootSearch ?? false,
77
77
  popToRoot: popToRootProtoMap[options?.popToRootType ?? PopToRootType.Default],
@@ -86,7 +86,7 @@ exports.showHUD = showHUD;
86
86
  */
87
87
  const closeMainWindow = async (options = {}) => {
88
88
  const { clearRootSearch = false, popToRootType = PopToRootType.Default } = options;
89
- await bus_1.bus.turboRequest("ui.closeMainWindow", {
89
+ await bus_1.bus.request("ui.closeMainWindow", {
90
90
  clearRootSearch,
91
91
  popToRoot: popToRootProtoMap[popToRootType],
92
92
  });
@@ -96,7 +96,7 @@ exports.closeMainWindow = closeMainWindow;
96
96
  * @category Launcher Window
97
97
  */
98
98
  const clearSearchBar = async () => {
99
- await bus_1.bus.turboRequest("ui.setSearchText", { text: "" });
99
+ await bus_1.bus.request("ui.setSearchText", { text: "" });
100
100
  };
101
101
  exports.clearSearchBar = clearSearchBar;
102
102
  /**
@@ -107,7 +107,7 @@ exports.clearSearchBar = clearSearchBar;
107
107
  * @category Launcher Window
108
108
  */
109
109
  const getSelectedText = async () => {
110
- const response = await bus_1.bus.turboRequest("ui.getSelectedText", {});
110
+ const response = await bus_1.bus.request("ui.getSelectedText", {});
111
111
  if (!response.ok) {
112
112
  throw new Error(`Failed to get selected text`);
113
113
  }
@@ -120,7 +120,7 @@ exports.getSelectedText = getSelectedText;
120
120
  * @category Launcher Window
121
121
  */
122
122
  const popToRoot = async (options) => {
123
- await bus_1.bus.turboRequest("ui.popToRoot", {
123
+ await bus_1.bus.request("ui.popToRoot", {
124
124
  clearSearchBar: options?.clearSearchBar ?? false,
125
125
  });
126
126
  };
@@ -42,7 +42,7 @@ var FileSearch;
42
42
  * ```
43
43
  */
44
44
  async function search(query, _ = {}) {
45
- const res = await bus_1.bus.turboRequest("fileSearch.search", { query });
45
+ const res = await bus_1.bus.request("fileSearch.search", { query });
46
46
  return res.unwrap().files;
47
47
  }
48
48
  FileSearch.search = search;
@@ -9,7 +9,7 @@ const bus_1 = require("./bus");
9
9
  var LocalStorage;
10
10
  (function (LocalStorage) {
11
11
  async function getItem(key) {
12
- const res = await bus_1.bus.turboRequest("storage.get", { key });
12
+ const res = await bus_1.bus.request("storage.get", { key });
13
13
  if (!res.ok || res.value.value === null) {
14
14
  return undefined;
15
15
  }
@@ -17,22 +17,22 @@ var LocalStorage;
17
17
  }
18
18
  LocalStorage.getItem = getItem;
19
19
  async function setItem(key, value) {
20
- await bus_1.bus.turboRequest("storage.set", { key, value });
20
+ await bus_1.bus.request("storage.set", { key, value });
21
21
  }
22
22
  LocalStorage.setItem = setItem;
23
23
  async function removeItem(key) {
24
- await bus_1.bus.turboRequest("storage.remove", { key });
24
+ await bus_1.bus.request("storage.remove", { key });
25
25
  }
26
26
  LocalStorage.removeItem = removeItem;
27
27
  async function allItems() {
28
- const res = await bus_1.bus.turboRequest("storage.list", {});
28
+ const res = await bus_1.bus.request("storage.list", {});
29
29
  if (!res.ok)
30
30
  return {};
31
31
  return res.value.values;
32
32
  }
33
33
  LocalStorage.allItems = allItems;
34
34
  async function clear() {
35
- await bus_1.bus.turboRequest("storage.clear", {});
35
+ await bus_1.bus.request("storage.clear", {});
36
36
  }
37
37
  LocalStorage.clear = clear;
38
38
  })(LocalStorage || (exports.LocalStorage = LocalStorage = {}));
package/dist/api/oauth.js CHANGED
@@ -110,7 +110,7 @@ class PKCEClient {
110
110
  const isAuthorizationOptions = (s) => {
111
111
  return typeof s.url === "string";
112
112
  };
113
- const res = await bus_1.bus.turboRequest("oauth.authorize", {
113
+ const res = await bus_1.bus.request("oauth.authorize", {
114
114
  client: {
115
115
  id: this.providerId,
116
116
  description: this.description ?? "Connect to your account",
@@ -142,7 +142,7 @@ class PKCEClient {
142
142
  return Object.hasOwn(options, "access_token");
143
143
  };
144
144
  if (isTokenResponse(options)) {
145
- await bus_1.bus.turboRequest("oauth.setTokens", {
145
+ await bus_1.bus.request("oauth.setTokens", {
146
146
  accessToken: options.access_token,
147
147
  refreshToken: options.refresh_token,
148
148
  idToken: options.id_token,
@@ -152,7 +152,7 @@ class PKCEClient {
152
152
  });
153
153
  }
154
154
  else {
155
- await bus_1.bus.turboRequest("oauth.setTokens", {
155
+ await bus_1.bus.request("oauth.setTokens", {
156
156
  ...options,
157
157
  providerId: this.providerId,
158
158
  });
@@ -166,7 +166,7 @@ class PKCEClient {
166
166
  * @returns A promise that resolves when the token set has been retrieved.
167
167
  */
168
168
  async getTokens() {
169
- const res = await bus_1.bus.turboRequest("oauth.getTokens", {
169
+ const res = await bus_1.bus.request("oauth.getTokens", {
170
170
  providerId: this.providerId,
171
171
  });
172
172
  const set = res.unwrap().tokenSet;
@@ -190,7 +190,7 @@ class PKCEClient {
190
190
  * Removes the stored {@link OAuth.TokenSet} for the client.
191
191
  */
192
192
  async removeTokens() {
193
- await bus_1.bus.turboRequest("oauth.removeTokens", {
193
+ await bus_1.bus.request("oauth.removeTokens", {
194
194
  providerId: this.providerId,
195
195
  });
196
196
  }
package/dist/api/toast.js CHANGED
@@ -137,7 +137,7 @@ class Toast {
137
137
  this.options.secondaryAction = action;
138
138
  }
139
139
  async update() {
140
- await bus_1.bus.turboRequest("ui.showToast", {
140
+ await bus_1.bus.request("ui.showToast", {
141
141
  id: this.id,
142
142
  title: this.title,
143
143
  style: this.styleMap[this.style],
@@ -170,7 +170,7 @@ class Toast {
170
170
  onAction: this.callbacks.secondary,
171
171
  };
172
172
  }
173
- await bus_1.bus.turboRequest("ui.showToast", {
173
+ await bus_1.bus.request("ui.showToast", {
174
174
  id: this.id,
175
175
  title: payload.title,
176
176
  style: this.styleMap[payload.style ?? Toast.Style.Success],
@@ -182,7 +182,7 @@ class Toast {
182
182
  * @returns A Promise that resolves when toast is hidden.
183
183
  */
184
184
  async hide() {
185
- await bus_1.bus.turboRequest("ui.hideToast", { id: this.id });
185
+ await bus_1.bus.request("ui.hideToast", { id: this.id });
186
186
  }
187
187
  }
188
188
  exports.Toast = Toast;
package/dist/api/utils.js CHANGED
@@ -30,7 +30,7 @@ exports.trash = trash;
30
30
  */
31
31
  const runInTerminal = async (args, options = {}) => {
32
32
  const { hold = false, appId, title } = options;
33
- await bus_1.bus.turboRequest("app.runInTerminal", {
33
+ await bus_1.bus.request("app.runInTerminal", {
34
34
  cmdline: args,
35
35
  hold,
36
36
  appId,
@@ -51,7 +51,7 @@ const open = async (target, app) => {
51
51
  appId = app.id;
52
52
  }
53
53
  }
54
- await bus_1.bus.turboRequest("app.open", {
54
+ await bus_1.bus.request("app.open", {
55
55
  target,
56
56
  appId,
57
57
  });
@@ -72,7 +72,7 @@ exports.getFrontmostApplication = getFrontmostApplication;
72
72
  * @category System
73
73
  */
74
74
  const getApplications = async (target) => {
75
- const res = await bus_1.bus.turboRequest("app.list", { target });
75
+ const res = await bus_1.bus.request("app.list", { target });
76
76
  return res.unwrap().apps;
77
77
  };
78
78
  exports.getApplications = getApplications;
@@ -80,7 +80,7 @@ exports.getApplications = getApplications;
80
80
  * @category System
81
81
  */
82
82
  const getDefaultApplication = async (path) => {
83
- const res = await bus_1.bus.turboRequest("app.getDefault", { target: path });
83
+ const res = await bus_1.bus.request("app.getDefault", { target: path });
84
84
  const app = res.unwrap().app;
85
85
  if (!app)
86
86
  throw new Error(`No default application for target ${path}`);
@@ -51,7 +51,7 @@ const transformWindow = (proto) => {
51
51
  var WindowManagement;
52
52
  (function (WindowManagement) {
53
53
  async function getWindows(options = {}) {
54
- const res = await bus_1.bus.turboRequest("wm.getWindows", options);
54
+ const res = await bus_1.bus.request("wm.getWindows", options);
55
55
  return res.unwrap().windows.map(transformWindow);
56
56
  }
57
57
  WindowManagement.getWindows = getWindows;
@@ -70,7 +70,7 @@ var WindowManagement;
70
70
  * @see {@link Window.focus}
71
71
  */
72
72
  async function focusWindow(window) {
73
- const res = await bus_1.bus.turboRequest("wm.focusWindow", {
73
+ const res = await bus_1.bus.request("wm.focusWindow", {
74
74
  id: window.id,
75
75
  });
76
76
  return res.unwrap().ok;
@@ -80,7 +80,7 @@ var WindowManagement;
80
80
  * Return the list of screens (physical and virtual) currently attached to the computer.
81
81
  */
82
82
  async function getScreens() {
83
- const res = await bus_1.bus.turboRequest("wm.getScreens", {});
83
+ const res = await bus_1.bus.request("wm.getScreens", {});
84
84
  return res.unwrap().screens.map((sc) => ({
85
85
  name: sc.name,
86
86
  make: sc.make,
@@ -94,12 +94,12 @@ var WindowManagement;
94
94
  }
95
95
  WindowManagement.getScreens = getScreens;
96
96
  async function getActiveWorkspace() {
97
- const res = await bus_1.bus.turboRequest("wm.getActiveWorkspace", {});
97
+ const res = await bus_1.bus.request("wm.getActiveWorkspace", {});
98
98
  return transformWorkspace(res.unwrap().workspace);
99
99
  }
100
100
  WindowManagement.getActiveWorkspace = getActiveWorkspace;
101
101
  async function getWorkspaces() {
102
- const res = await bus_1.bus.turboRequest("wm.getWorkspaces", {});
102
+ const res = await bus_1.bus.request("wm.getWorkspaces", {});
103
103
  return res.unwrap().workspaces.map(transformWorkspace);
104
104
  }
105
105
  WindowManagement.getWorkspaces = getWorkspaces;
@@ -109,11 +109,11 @@ var WindowManagement;
109
109
  }
110
110
  WindowManagement.getWindowsOnActiveWorkspace = getWindowsOnActiveWorkspace;
111
111
  async function setWindowBounds(payload) {
112
- await bus_1.bus.turboRequest("wm.setWindowBounds", payload);
112
+ await bus_1.bus.request("wm.setWindowBounds", payload);
113
113
  }
114
114
  WindowManagement.setWindowBounds = setWindowBounds;
115
115
  async function getActiveWindow() {
116
- const res = await bus_1.bus.turboRequest("wm.getActiveWindow", {});
116
+ const res = await bus_1.bus.request("wm.getActiveWindow", {});
117
117
  return transformWindow(res.unwrap().window);
118
118
  }
119
119
  WindowManagement.getActiveWindow = getActiveWindow;