@symbiosis-lab/moss-api 0.5.3 → 0.6.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.
- package/README.md +6 -6
- package/dist/index.d.mts +409 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +754 -1
- package/dist/index.mjs.map +1 -1
- package/dist/testing/index.d.mts +33 -0
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +72 -0
- package/dist/testing/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Symbiosis-Lab/moss-api/actions/workflows/ci.yml)
|
|
4
4
|
[](https://codecov.io/gh/Symbiosis-Lab/moss-api)
|
|
5
|
-
[](https://www.npmjs.com/package/@symbiosis-lab/moss-api)
|
|
6
6
|
|
|
7
7
|
Official API for building Moss plugins. Provides types and utilities for plugin development.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install moss-api
|
|
12
|
+
npm install @symbiosis-lab/moss-api
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -23,7 +23,7 @@ import type {
|
|
|
23
23
|
HookResult,
|
|
24
24
|
PluginManifest,
|
|
25
25
|
PluginCategory,
|
|
26
|
-
} from "moss-api";
|
|
26
|
+
} from "@symbiosis-lab/moss-api";
|
|
27
27
|
|
|
28
28
|
// Define your plugin manifest
|
|
29
29
|
const manifest: PluginManifest = {
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
log,
|
|
52
52
|
warn,
|
|
53
53
|
error,
|
|
54
|
-
} from "moss-api";
|
|
54
|
+
} from "@symbiosis-lab/moss-api";
|
|
55
55
|
|
|
56
56
|
// Set plugin context (call once at plugin initialization)
|
|
57
57
|
setMessageContext("my-plugin", "on_deploy");
|
|
@@ -74,7 +74,7 @@ await reportComplete({ url: "https://example.com" });
|
|
|
74
74
|
### Browser Utilities
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
|
-
import { openBrowser, closeBrowser } from "moss-api";
|
|
77
|
+
import { openBrowser, closeBrowser } from "@symbiosis-lab/moss-api";
|
|
78
78
|
|
|
79
79
|
// Open authentication page in plugin browser window
|
|
80
80
|
await openBrowser("https://example.com/auth");
|
|
@@ -86,7 +86,7 @@ await closeBrowser();
|
|
|
86
86
|
### Tauri Utilities
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
|
-
import { getTauriCore, isTauriAvailable } from "moss-api";
|
|
89
|
+
import { getTauriCore, isTauriAvailable } from "@symbiosis-lab/moss-api";
|
|
90
90
|
|
|
91
91
|
// Check if running in Tauri environment
|
|
92
92
|
if (isTauriAvailable()) {
|
package/dist/index.d.mts
CHANGED
|
@@ -86,7 +86,24 @@ interface DeploymentInfo {
|
|
|
86
86
|
url: string;
|
|
87
87
|
deployed_at: string;
|
|
88
88
|
metadata: Record<string, string>;
|
|
89
|
+
/** DNS target for custom domain configuration */
|
|
90
|
+
dns_target?: DnsTarget;
|
|
89
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* DNS target type for custom domain configuration
|
|
94
|
+
* Provided by deploy plugins to configure DNS records
|
|
95
|
+
*/
|
|
96
|
+
type DnsTarget = {
|
|
97
|
+
type: "cname";
|
|
98
|
+
hostname: string;
|
|
99
|
+
} | {
|
|
100
|
+
type: "a";
|
|
101
|
+
ips: string[];
|
|
102
|
+
} | {
|
|
103
|
+
type: "github-pages";
|
|
104
|
+
a_records: string[];
|
|
105
|
+
cname_target: string;
|
|
106
|
+
};
|
|
90
107
|
//#endregion
|
|
91
108
|
//#region src/types/hooks.d.ts
|
|
92
109
|
/**
|
|
@@ -556,6 +573,239 @@ interface ExecuteResult {
|
|
|
556
573
|
*/
|
|
557
574
|
declare function executeBinary(options: ExecuteOptions): Promise<ExecuteResult>;
|
|
558
575
|
//#endregion
|
|
576
|
+
//#region src/utils/platform.d.ts
|
|
577
|
+
/**
|
|
578
|
+
* Platform detection utilities for Moss plugins
|
|
579
|
+
*
|
|
580
|
+
* Detects the current operating system and architecture to enable
|
|
581
|
+
* platform-specific binary downloads and operations.
|
|
582
|
+
*/
|
|
583
|
+
/**
|
|
584
|
+
* Supported operating systems
|
|
585
|
+
*/
|
|
586
|
+
type OSType = "darwin" | "linux" | "windows";
|
|
587
|
+
/**
|
|
588
|
+
* Supported architectures
|
|
589
|
+
*/
|
|
590
|
+
type ArchType = "arm64" | "x64";
|
|
591
|
+
/**
|
|
592
|
+
* Platform key combining OS and architecture
|
|
593
|
+
*/
|
|
594
|
+
type PlatformKey = "darwin-arm64" | "darwin-x64" | "linux-x64" | "windows-x64";
|
|
595
|
+
/**
|
|
596
|
+
* Complete platform information
|
|
597
|
+
*/
|
|
598
|
+
interface PlatformInfo {
|
|
599
|
+
/** Operating system */
|
|
600
|
+
os: OSType;
|
|
601
|
+
/** CPU architecture */
|
|
602
|
+
arch: ArchType;
|
|
603
|
+
/** Combined platform key for binary selection */
|
|
604
|
+
platformKey: PlatformKey;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Detect the current platform (OS and architecture)
|
|
608
|
+
*
|
|
609
|
+
* Uses system commands to detect the platform:
|
|
610
|
+
* - On macOS/Linux: `uname -s` for OS, `uname -m` for architecture
|
|
611
|
+
* - On Windows: Falls back to environment variables and defaults
|
|
612
|
+
*
|
|
613
|
+
* Results are cached after the first call.
|
|
614
|
+
*
|
|
615
|
+
* @returns Platform information including OS, architecture, and combined key
|
|
616
|
+
* @throws Error if platform detection fails or platform is unsupported
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* const platform = await getPlatformInfo();
|
|
621
|
+
* console.log(platform.platformKey); // "darwin-arm64"
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
declare function getPlatformInfo(): Promise<PlatformInfo>;
|
|
625
|
+
/**
|
|
626
|
+
* Clear the cached platform info
|
|
627
|
+
*
|
|
628
|
+
* Useful for testing or when platform detection needs to be re-run.
|
|
629
|
+
*
|
|
630
|
+
* @internal
|
|
631
|
+
*/
|
|
632
|
+
declare function clearPlatformCache(): void;
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/utils/archive.d.ts
|
|
635
|
+
/**
|
|
636
|
+
* Archive extraction utilities for Moss plugins
|
|
637
|
+
*
|
|
638
|
+
* Provides functions to extract .tar.gz and .zip archives using
|
|
639
|
+
* system commands (tar, unzip, PowerShell).
|
|
640
|
+
*/
|
|
641
|
+
/**
|
|
642
|
+
* Supported archive formats
|
|
643
|
+
*/
|
|
644
|
+
type ArchiveFormat = "tar.gz" | "zip";
|
|
645
|
+
/**
|
|
646
|
+
* Options for archive extraction
|
|
647
|
+
*/
|
|
648
|
+
interface ExtractOptions {
|
|
649
|
+
/** Path to the archive file (absolute) */
|
|
650
|
+
archivePath: string;
|
|
651
|
+
/** Directory to extract to (absolute) */
|
|
652
|
+
destDir: string;
|
|
653
|
+
/** Archive format (auto-detected from extension if not provided) */
|
|
654
|
+
format?: ArchiveFormat;
|
|
655
|
+
/** Timeout in milliseconds (default: 60000) */
|
|
656
|
+
timeoutMs?: number;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Result of archive extraction
|
|
660
|
+
*/
|
|
661
|
+
interface ExtractResult {
|
|
662
|
+
/** Whether extraction succeeded */
|
|
663
|
+
success: boolean;
|
|
664
|
+
/** Error message if extraction failed */
|
|
665
|
+
error?: string;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Extract an archive to a destination directory
|
|
669
|
+
*
|
|
670
|
+
* Uses system commands for extraction:
|
|
671
|
+
* - .tar.gz: `tar -xzf` (macOS/Linux)
|
|
672
|
+
* - .zip: `unzip` (macOS/Linux) or PowerShell `Expand-Archive` (Windows)
|
|
673
|
+
*
|
|
674
|
+
* @param options - Extraction options
|
|
675
|
+
* @returns Extraction result
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```typescript
|
|
679
|
+
* const result = await extractArchive({
|
|
680
|
+
* archivePath: "/path/to/hugo.tar.gz",
|
|
681
|
+
* destDir: "/path/to/extract/",
|
|
682
|
+
* });
|
|
683
|
+
*
|
|
684
|
+
* if (!result.success) {
|
|
685
|
+
* console.error(`Extraction failed: ${result.error}`);
|
|
686
|
+
* }
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
declare function extractArchive(options: ExtractOptions): Promise<ExtractResult>;
|
|
690
|
+
/**
|
|
691
|
+
* Make a file executable (Unix only)
|
|
692
|
+
*
|
|
693
|
+
* Runs `chmod +x` on the specified file. No-op on Windows.
|
|
694
|
+
*
|
|
695
|
+
* @param filePath - Absolute path to the file
|
|
696
|
+
* @returns Whether the operation succeeded
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* await makeExecutable("/path/to/binary");
|
|
701
|
+
* ```
|
|
702
|
+
*/
|
|
703
|
+
declare function makeExecutable(filePath: string): Promise<boolean>;
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/utils/binary-resolver.d.ts
|
|
706
|
+
/**
|
|
707
|
+
* GitHub source configuration for binary downloads
|
|
708
|
+
*/
|
|
709
|
+
interface GitHubSource {
|
|
710
|
+
/** Repository owner (e.g., "gohugoio") */
|
|
711
|
+
owner: string;
|
|
712
|
+
/** Repository name (e.g., "hugo") */
|
|
713
|
+
repo: string;
|
|
714
|
+
/**
|
|
715
|
+
* Asset filename pattern with placeholders:
|
|
716
|
+
* - {version}: Version number (e.g., "0.139.0")
|
|
717
|
+
* - {os}: Operating system (darwin, linux, windows)
|
|
718
|
+
* - {arch}: Architecture (arm64, amd64, x64)
|
|
719
|
+
*
|
|
720
|
+
* Example: "hugo_extended_{version}_{os}-{arch}.tar.gz"
|
|
721
|
+
*/
|
|
722
|
+
assetPattern: string;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Binary source configuration per platform
|
|
726
|
+
*/
|
|
727
|
+
interface BinarySource {
|
|
728
|
+
/** GitHub release source */
|
|
729
|
+
github?: GitHubSource;
|
|
730
|
+
/** Direct download URL (with same placeholders as assetPattern) */
|
|
731
|
+
directUrl?: string;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Configuration for a binary to resolve
|
|
735
|
+
*/
|
|
736
|
+
interface BinaryConfig {
|
|
737
|
+
/** Binary name (e.g., "hugo") */
|
|
738
|
+
name: string;
|
|
739
|
+
/** Minimum version required (semver, optional) */
|
|
740
|
+
minVersion?: string;
|
|
741
|
+
/** Command to check version (default: "{name} version") */
|
|
742
|
+
versionCommand?: string;
|
|
743
|
+
/** Regex to extract version from command output */
|
|
744
|
+
versionPattern?: RegExp;
|
|
745
|
+
/** Download sources per platform */
|
|
746
|
+
sources: Partial<Record<PlatformKey, BinarySource>>;
|
|
747
|
+
/** Binary filename inside archive (default: same as name, or name.exe on Windows) */
|
|
748
|
+
binaryName?: string;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Result of binary resolution
|
|
752
|
+
*/
|
|
753
|
+
interface BinaryResolution {
|
|
754
|
+
/** Absolute path to the binary */
|
|
755
|
+
path: string;
|
|
756
|
+
/** Detected version (if available) */
|
|
757
|
+
version?: string;
|
|
758
|
+
/** How the binary was found */
|
|
759
|
+
source: "config" | "path" | "plugin-storage" | "downloaded";
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Options for binary resolution
|
|
763
|
+
*/
|
|
764
|
+
interface ResolveBinaryOptions {
|
|
765
|
+
/** Plugin's configured binary path (from context.config) */
|
|
766
|
+
configuredPath?: string;
|
|
767
|
+
/** Whether to auto-download if not found (default: true) */
|
|
768
|
+
autoDownload?: boolean;
|
|
769
|
+
/** Progress callback for UI feedback */
|
|
770
|
+
onProgress?: (phase: string, message: string) => void;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Error thrown during binary resolution
|
|
774
|
+
*/
|
|
775
|
+
declare class BinaryResolutionError extends Error {
|
|
776
|
+
readonly phase: "detection" | "download" | "extraction" | "validation";
|
|
777
|
+
readonly cause?: Error | undefined;
|
|
778
|
+
constructor(message: string, phase: "detection" | "download" | "extraction" | "validation", cause?: Error | undefined);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Resolve a binary, downloading if necessary
|
|
782
|
+
*
|
|
783
|
+
* Resolution order:
|
|
784
|
+
* 1. Configured path (from plugin config, e.g., hugo_path)
|
|
785
|
+
* 2. System PATH (just the binary name)
|
|
786
|
+
* 3. Plugin bin directory (.moss/plugins/{plugin}/bin/{name})
|
|
787
|
+
* 4. Download from GitHub releases (if autoDownload is true)
|
|
788
|
+
*
|
|
789
|
+
* @param config - Binary configuration
|
|
790
|
+
* @param options - Resolution options
|
|
791
|
+
* @returns Resolution result with path and source
|
|
792
|
+
* @throws BinaryResolutionError if binary cannot be resolved
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* const hugo = await resolveBinary(HUGO_CONFIG, {
|
|
797
|
+
* configuredPath: context.config.hugo_path,
|
|
798
|
+
* onProgress: (phase, msg) => reportProgress(phase, 0, 1, msg),
|
|
799
|
+
* });
|
|
800
|
+
*
|
|
801
|
+
* await executeBinary({
|
|
802
|
+
* binaryPath: hugo.path,
|
|
803
|
+
* args: ["--version"],
|
|
804
|
+
* });
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
declare function resolveBinary(config: BinaryConfig, options?: ResolveBinaryOptions): Promise<BinaryResolution>;
|
|
808
|
+
//#endregion
|
|
559
809
|
//#region src/utils/cookies.d.ts
|
|
560
810
|
/**
|
|
561
811
|
* Cookie management for Moss plugins
|
|
@@ -621,5 +871,163 @@ declare function getPluginCookie(): Promise<Cookie[]>;
|
|
|
621
871
|
*/
|
|
622
872
|
declare function setPluginCookie(cookies: Cookie[]): Promise<void>;
|
|
623
873
|
//#endregion
|
|
624
|
-
|
|
874
|
+
//#region src/utils/window.d.ts
|
|
875
|
+
/**
|
|
876
|
+
* Window utilities for plugins
|
|
877
|
+
* Enables plugins to show custom dialogs and UI elements
|
|
878
|
+
*/
|
|
879
|
+
/**
|
|
880
|
+
* Result from a dialog interaction
|
|
881
|
+
*/
|
|
882
|
+
interface DialogResult {
|
|
883
|
+
type: "submitted" | "cancelled";
|
|
884
|
+
value?: unknown;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Options for showing a plugin dialog
|
|
888
|
+
*/
|
|
889
|
+
interface ShowDialogOptions {
|
|
890
|
+
/** URL to load in the dialog (can be data: URL with embedded HTML) */
|
|
891
|
+
url: string;
|
|
892
|
+
/** Dialog window title */
|
|
893
|
+
title: string;
|
|
894
|
+
/** Dialog width in pixels */
|
|
895
|
+
width?: number;
|
|
896
|
+
/** Dialog height in pixels */
|
|
897
|
+
height?: number;
|
|
898
|
+
/** Maximum time to wait for user response in milliseconds */
|
|
899
|
+
timeoutMs?: number;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Show a plugin dialog and wait for user response
|
|
903
|
+
*
|
|
904
|
+
* The dialog can be an embedded HTML page (via data: URL) that communicates
|
|
905
|
+
* back to the plugin via the submitDialogResult function.
|
|
906
|
+
*
|
|
907
|
+
* @param options - Dialog configuration
|
|
908
|
+
* @returns Dialog result with submitted value or cancellation
|
|
909
|
+
*
|
|
910
|
+
* @example
|
|
911
|
+
* ```typescript
|
|
912
|
+
* const result = await showPluginDialog({
|
|
913
|
+
* url: createMyDialogUrl(),
|
|
914
|
+
* title: "Create Repository",
|
|
915
|
+
* width: 400,
|
|
916
|
+
* height: 300,
|
|
917
|
+
* });
|
|
918
|
+
*
|
|
919
|
+
* if (result.type === "submitted") {
|
|
920
|
+
* console.log("User submitted:", result.value);
|
|
921
|
+
* } else {
|
|
922
|
+
* console.log("User cancelled");
|
|
923
|
+
* }
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
declare function showPluginDialog(options: ShowDialogOptions): Promise<DialogResult>;
|
|
927
|
+
/**
|
|
928
|
+
* Submit a result from within a plugin dialog
|
|
929
|
+
*
|
|
930
|
+
* This is called from inside the dialog HTML to send data back to the plugin.
|
|
931
|
+
* The dialog will be closed automatically after submission.
|
|
932
|
+
*
|
|
933
|
+
* @param dialogId - The dialog ID (provided in the dialog's query string)
|
|
934
|
+
* @param value - The value to submit
|
|
935
|
+
* @returns Whether the submission was successful
|
|
936
|
+
*
|
|
937
|
+
* @example
|
|
938
|
+
* ```typescript
|
|
939
|
+
* // Inside dialog HTML:
|
|
940
|
+
* const dialogId = new URLSearchParams(location.search).get('dialogId');
|
|
941
|
+
* await submitDialogResult(dialogId, { repoName: 'my-repo' });
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
declare function submitDialogResult(dialogId: string, value: unknown): Promise<boolean>;
|
|
945
|
+
/**
|
|
946
|
+
* Cancel a plugin dialog
|
|
947
|
+
*
|
|
948
|
+
* This is called from inside the dialog HTML to cancel without submitting.
|
|
949
|
+
* The dialog will be closed automatically.
|
|
950
|
+
*
|
|
951
|
+
* @param dialogId - The dialog ID (provided in the dialog's query string)
|
|
952
|
+
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```typescript
|
|
955
|
+
* // Inside dialog HTML:
|
|
956
|
+
* const dialogId = new URLSearchParams(location.search).get('dialogId');
|
|
957
|
+
* await cancelDialog(dialogId);
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare function cancelDialog(dialogId: string): Promise<boolean>;
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region src/utils/events.d.ts
|
|
963
|
+
/**
|
|
964
|
+
* Event utilities for plugin communication
|
|
965
|
+
*
|
|
966
|
+
* Provides a way for plugins and dialog windows to communicate
|
|
967
|
+
* via Tauri's event system.
|
|
968
|
+
*/
|
|
969
|
+
/**
|
|
970
|
+
* Check if Tauri event API is available
|
|
971
|
+
*/
|
|
972
|
+
declare function isEventApiAvailable(): boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Emit an event to other parts of the application
|
|
975
|
+
*
|
|
976
|
+
* @param event - Event name (e.g., "repo-created", "dialog-result")
|
|
977
|
+
* @param payload - Data to send with the event
|
|
978
|
+
*
|
|
979
|
+
* @example
|
|
980
|
+
* ```typescript
|
|
981
|
+
* // From dialog:
|
|
982
|
+
* await emitEvent("repo-name-validated", { name: "my-repo", available: true });
|
|
983
|
+
*
|
|
984
|
+
* // From plugin:
|
|
985
|
+
* await emitEvent("deployment-started", { url: "https://github.com/..." });
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
988
|
+
declare function emitEvent(event: string, payload?: unknown): Promise<void>;
|
|
989
|
+
/**
|
|
990
|
+
* Listen for events from other parts of the application
|
|
991
|
+
*
|
|
992
|
+
* @param event - Event name to listen for
|
|
993
|
+
* @param handler - Function to call when event is received
|
|
994
|
+
* @returns Cleanup function to stop listening
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```typescript
|
|
998
|
+
* const unlisten = await onEvent<{ name: string; available: boolean }>(
|
|
999
|
+
* "repo-name-validated",
|
|
1000
|
+
* (data) => {
|
|
1001
|
+
* console.log(`Repo ${data.name} is ${data.available ? "available" : "taken"}`);
|
|
1002
|
+
* }
|
|
1003
|
+
* );
|
|
1004
|
+
*
|
|
1005
|
+
* // Later, to stop listening:
|
|
1006
|
+
* unlisten();
|
|
1007
|
+
* ```
|
|
1008
|
+
*/
|
|
1009
|
+
declare function onEvent<T>(event: string, handler: (payload: T) => void): Promise<() => void>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Wait for a single event occurrence
|
|
1012
|
+
*
|
|
1013
|
+
* @param event - Event name to wait for
|
|
1014
|
+
* @param timeoutMs - Maximum time to wait (default: 30000ms)
|
|
1015
|
+
* @returns Promise that resolves with the event payload
|
|
1016
|
+
* @throws Error if timeout is reached
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```typescript
|
|
1020
|
+
* try {
|
|
1021
|
+
* const result = await waitForEvent<{ confirmed: boolean }>("user-confirmed", 10000);
|
|
1022
|
+
* if (result.confirmed) {
|
|
1023
|
+
* // proceed
|
|
1024
|
+
* }
|
|
1025
|
+
* } catch (e) {
|
|
1026
|
+
* console.log("User did not respond in time");
|
|
1027
|
+
* }
|
|
1028
|
+
* ```
|
|
1029
|
+
*/
|
|
1030
|
+
declare function waitForEvent<T>(event: string, timeoutMs?: number): Promise<T>;
|
|
1031
|
+
//#endregion
|
|
1032
|
+
export { AfterDeployContext, ArchType, ArchiveFormat, ArticleInfo, BaseContext, BeforeBuildContext, BinaryConfig, BinaryResolution, BinaryResolutionError, BinarySource, CompleteMessage, Cookie, DeploymentInfo, DialogResult, DnsTarget, DownloadOptions, DownloadResult, ErrorMessage, ExecuteOptions, ExecuteResult, ExtractOptions, ExtractResult, FetchOptions, FetchResult, GitHubSource, HookResult, LogMessage, OSType, OnBuildContext, OnDeployContext, PlatformInfo, PlatformKey, PluginCategory, PluginManifest, PluginMessage, ProgressMessage, ProjectInfo, ResolveBinaryOptions, ShowDialogOptions, SourceFiles, TauriCore, cancelDialog, clearPlatformCache, closeBrowser, downloadAsset, emitEvent, error, executeBinary, extractArchive, fetchUrl, fileExists, getMessageContext, getPlatformInfo, getPluginCookie, getTauriCore, isEventApiAvailable, isTauriAvailable, listFiles, listPluginFiles, log, makeExecutable, onEvent, openBrowser, pluginFileExists, readFile, readPluginFile, reportComplete, reportError, reportProgress, resolveBinary, sendMessage, setMessageContext, setPluginCookie, showPluginDialog, submitDialogResult, waitForEvent, warn, writeFile, writePluginFile };
|
|
625
1033
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/context.ts","../src/types/hooks.ts","../src/types/messages.ts","../src/utils/tauri.ts","../src/utils/messaging.ts","../src/utils/logger.ts","../src/utils/browser.ts","../src/utils/filesystem.ts","../src/utils/plugin-storage.ts","../src/utils/http.ts","../src/utils/binary.ts","../src/utils/cookies.ts"],"sourcesContent":[],"mappings":";;AAIA;AAOA;AAWY,UAlBK,WAAA,CAkBS;;;;ECJT,aAAA,CAAW,EAAA,MAAA;AAQ5B;AAKiB,UDpBA,cAAA,CCoBe;EAOf,IAAA,EAAA,MAAA;EAOA,OAAA,EAAA,MAAA;EAEL,KAAA,EAAA,MAAA;EACG,QAAA,EDjCH,cCiCG;EAH6B,WAAA,CAAA,EAAA,MAAA;EAAW,IAAA,CAAA,EAAA,MAAA;EAStC,MAAA,CAAA,EAAA,MAAW;EAUX,MAAA,CAAA,ED7CN,MC6CiB,CAAA,MAAA,EAAA,OAIb,CAAA;AASf;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/context.ts","../src/types/hooks.ts","../src/types/messages.ts","../src/utils/tauri.ts","../src/utils/messaging.ts","../src/utils/logger.ts","../src/utils/browser.ts","../src/utils/filesystem.ts","../src/utils/plugin-storage.ts","../src/utils/http.ts","../src/utils/binary.ts","../src/utils/platform.ts","../src/utils/archive.ts","../src/utils/binary-resolver.ts","../src/utils/cookies.ts","../src/utils/window.ts","../src/utils/events.ts"],"sourcesContent":[],"mappings":";;AAIA;AAOA;AAWY,UAlBK,WAAA,CAkBS;;;;ECJT,aAAA,CAAW,EAAA,MAAA;AAQ5B;AAKiB,UDpBA,cAAA,CCoBe;EAOf,IAAA,EAAA,MAAA;EAOA,OAAA,EAAA,MAAA;EAEL,KAAA,EAAA,MAAA;EACG,QAAA,EDjCH,cCiCG;EAH6B,WAAA,CAAA,EAAA,MAAA;EAAW,IAAA,CAAA,EAAA,MAAA;EAStC,MAAA,CAAA,EAAA,MAAW;EAUX,MAAA,CAAA,ED7CN,MC6CiB,CAAA,MAAA,EAAA,OAIb,CAAA;AASf;AAaY,KDpEA,cAAA,GCoES,WAAA,GAAA,UAAA,GAAA,YAAA,GAAA,UA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