@domicile-desktop/sdk 0.0.0-alpha-02742dc00a6c → 0.0.0-alpha-251128fa4649

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.
@@ -87,9 +87,9 @@ const absentHost = () => ({
87
87
  pointerButton: () => undefined,
88
88
  pointerLeave: () => undefined,
89
89
  pointerMotion: () => undefined,
90
- previewFile: () => undefined,
91
- searchApps: () => undefined,
92
- searchFiles: () => undefined,
90
+ previewFile: () => new Promise(() => undefined),
91
+ searchApps: () => new Promise(() => undefined),
92
+ searchFiles: () => new Promise(() => undefined),
93
93
  setAudioMuted: () => undefined,
94
94
  setAudioPort: () => undefined,
95
95
  setAudioProfile: () => undefined,
@@ -397,7 +397,8 @@ export class DomicileClient {
397
397
  searchFiles(query) {
398
398
  return new Promise((settle) => {
399
399
  this.#searches.set(query, [...(this.#searches.get(query) ?? []), settle]);
400
- this.#host.searchFiles(query);
400
+ // Settled by the event; a superseded ask's rejection is not news.
401
+ this.#host.searchFiles(query).catch(() => undefined);
401
402
  });
402
403
  }
403
404
  /**
@@ -409,7 +410,8 @@ export class DomicileClient {
409
410
  previewFile(path) {
410
411
  return new Promise((settle) => {
411
412
  this.#previews.set(path, [...(this.#previews.get(path) ?? []), settle]);
412
- this.#host.previewFile(path);
413
+ // Settled by the event; a superseded ask's rejection is not news.
414
+ this.#host.previewFile(path).catch(() => undefined);
413
415
  });
414
416
  }
415
417
  /**
@@ -422,7 +424,8 @@ export class DomicileClient {
422
424
  ...(this.#appSearches.get(query) ?? []),
423
425
  settle,
424
426
  ]);
425
- this.#host.searchApps(query);
427
+ // Settled by the event; a superseded ask's rejection is not news.
428
+ this.#host.searchApps(query).catch(() => undefined);
426
429
  });
427
430
  }
428
431
  /**
@@ -222,6 +222,12 @@ export type DomicileAppsEvent = Event & {
222
222
  /** See {@link DomicileModifiersEvent.arrival}. */
223
223
  readonly arrival: DOMHighResTimeStamp;
224
224
  };
225
+ /** What {@link DomicileHost.searchFiles} resolves with; see {@link DomicileFilesEvent}. */
226
+ export type DomicileFileSearch = Pick<DomicileFilesEvent, "files" | "matched" | "indexing">;
227
+ /** What {@link DomicileHost.previewFile} resolves with; see {@link DomicileFilePreviewEvent}. */
228
+ export type DomicileFilePreview = Pick<DomicileFilePreviewEvent, "kind" | "text" | "entries" | "title" | "artist" | "album" | "duration" | "cover">;
229
+ /** What {@link DomicileHost.searchApps} resolves with; see {@link DomicileAppsEvent}. */
230
+ export type DomicileAppSearch = Pick<DomicileAppsEvent, "apps" | "bookmarks">;
225
231
  /**
226
232
  * The answer to {@link DomicileHost.searchFiles}.
227
233
  *
@@ -667,25 +673,30 @@ export type DomicileHost = {
667
673
  */
668
674
  spawn(command: readonly string[]): void;
669
675
  /**
670
- * Search the home directory for `query`. Answered with a `files` event.
676
+ * Search the home directory for `query`. Resolves with the result, which
677
+ * also arrives as a `files` event. A newer call rejects this one with an
678
+ * `AbortError`.
671
679
  *
672
680
  * It takes no path on purpose, so pages cannot browse the filesystem. The
673
681
  * compositor matches against its index and sends only the matches. See
674
682
  * `domicile_host::file_search`.
675
683
  */
676
- searchFiles(query: string): void;
684
+ searchFiles(query: string): Promise<DomicileFileSearch>;
677
685
  /**
678
- * Preview `path`. Answered with a `filepreview` event.
686
+ * Preview `path`. Resolves with the result, which also arrives as a
687
+ * `filepreview` event. A newer call rejects this one, as with
688
+ * {@link searchFiles}.
679
689
  *
680
690
  * Paths outside the compositor's home index are `unreadable`, so a page can
681
691
  * only read what a search could return. See `domicile_host::file_preview`.
682
692
  */
683
- previewFile(path: string): void;
693
+ previewFile(path: string): Promise<DomicileFilePreview>;
684
694
  /**
685
- * Search installed applications and bookmarks for `query`. Answered with an
686
- * `apps` event. See `domicile_host::desktop_entries`.
695
+ * Search installed applications and bookmarks for `query`. Resolves with
696
+ * the result, which also arrives as an `apps` event. A newer call rejects
697
+ * this one, as with {@link searchFiles}. See `domicile_host::desktop_entries`.
687
698
  */
688
- searchApps(query: string): void;
699
+ searchApps(query: string): Promise<DomicileAppSearch>;
689
700
  /**
690
701
  * Put a clipboard history entry back on the clipboard.
691
702
  *
package/package.json CHANGED
@@ -150,7 +150,7 @@
150
150
  "test:unit": "bun test"
151
151
  },
152
152
  "type": "module",
153
- "version": "0.0.0-alpha-02742dc00a6c",
153
+ "version": "0.0.0-alpha-251128fa4649",
154
154
  "repository": {
155
155
  "type": "git",
156
156
  "url": "git+https://github.com/cprussin/domicile.git",