@voltius/plugin-types 0.20.0 → 0.21.1
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/index.d.ts +123 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -165,6 +165,52 @@ export interface PluginIdentity {
|
|
|
165
165
|
tags: string[];
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/** A vault the user organizes objects into. Unrelated to `api.vault`, which is plugin storage. */
|
|
169
|
+
export interface PluginVault {
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
/** Backed by a team; every write verb refuses it. */
|
|
173
|
+
team: boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** The four folder trees the app has. One `keychain` tree holds keys AND identities. */
|
|
177
|
+
export type PluginFolderKind = "connection" | "keychain" | "port_forwarding" | "snippet";
|
|
178
|
+
|
|
179
|
+
export interface PluginFolder {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
kind: PluginFolderKind;
|
|
183
|
+
vaultId: string;
|
|
184
|
+
parentFolderId: string | null;
|
|
185
|
+
team: boolean;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* One relocation of vault objects: the same operation a cut/copy + paste is on
|
|
190
|
+
* the page, so the ids must all belong to one tab (hosts, keychain, port
|
|
191
|
+
* forwarding or snippets). Folder ids may travel with them, contents included.
|
|
192
|
+
*/
|
|
193
|
+
export interface PluginObjectMoveInput {
|
|
194
|
+
ids: string[];
|
|
195
|
+
/** Destination folder, or null for the destination vault's root. */
|
|
196
|
+
folderId: string | null;
|
|
197
|
+
/** Destination vault. null keeps every object in the vault it has. */
|
|
198
|
+
vaultId: string | null;
|
|
199
|
+
/**
|
|
200
|
+
* Authorizes a destination vault other than the objects' own. Without it a
|
|
201
|
+
* crossing is refused before anything is written, and the refusal carries the
|
|
202
|
+
* plan — how many objects, which vault, and what would travel with them.
|
|
203
|
+
*/
|
|
204
|
+
allowCrossVault?: boolean;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface PluginObjectMoveOutcome {
|
|
208
|
+
moved: number;
|
|
209
|
+
created: number;
|
|
210
|
+
/** Ids that no longer exist, or objects already where the call would put them. */
|
|
211
|
+
skipped: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
168
214
|
export interface OmniCommand {
|
|
169
215
|
id: string;
|
|
170
216
|
label: string;
|
|
@@ -544,6 +590,35 @@ export interface DockerAPI {
|
|
|
544
590
|
};
|
|
545
591
|
}
|
|
546
592
|
|
|
593
|
+
export interface ReachPortRequest {
|
|
594
|
+
sessionId: string;
|
|
595
|
+
isRemote: boolean;
|
|
596
|
+
/** Published host port on the Docker host. */
|
|
597
|
+
hostPort: number;
|
|
598
|
+
/** The publish's bind address; wildcard binds collapse to loopback. */
|
|
599
|
+
hostIp?: string | null;
|
|
600
|
+
scheme?: "http" | "https";
|
|
601
|
+
action: "browser" | "copy";
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export interface ReachPortResponse {
|
|
605
|
+
/** Full URL for "browser", bare host:port for "copy". */
|
|
606
|
+
address: string;
|
|
607
|
+
localPort: number;
|
|
608
|
+
/** True when this call opened a new tunnel (as opposed to reusing or not needing one). */
|
|
609
|
+
tunneled: boolean;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* GATED (ports:forward). One verb: make a published port reachable from this
|
|
614
|
+
* machine and act on it. Deliberately host-executed — a plugin never receives a
|
|
615
|
+
* raw URL-opener or raw tunnel control, both of which are larger grants than
|
|
616
|
+
* this needs.
|
|
617
|
+
*/
|
|
618
|
+
export interface PortsAPI {
|
|
619
|
+
reach(req: ReachPortRequest): Promise<ReachPortResponse>;
|
|
620
|
+
}
|
|
621
|
+
|
|
547
622
|
/** A local audit row, projected. Drops the internal id, actor id, team/vault
|
|
548
623
|
* ids and IP — none of which a plugin or an external client has any use for. */
|
|
549
624
|
export interface PluginAuditRow {
|
|
@@ -602,6 +677,9 @@ export interface PluginAPI {
|
|
|
602
677
|
/** Creates a key entry and stores private/public content in the vault. */
|
|
603
678
|
create(data: { name?: string; key_type?: string; tags?: string[] }, privateKey: string, publicKey?: string): Promise<PluginKey>;
|
|
604
679
|
delete(id: string): Promise<void>;
|
|
680
|
+
/** Appends the key's public half to a connection's authorized_keys over SSH.
|
|
681
|
+
* Requires keys:read and connections:read. Never accepts a script. */
|
|
682
|
+
addToHost(input: { keyId: string; connectionId: string; location?: string; filename?: string }): Promise<void>;
|
|
605
683
|
};
|
|
606
684
|
|
|
607
685
|
// Identities (requires identities:*)
|
|
@@ -629,6 +707,48 @@ export interface PluginAPI {
|
|
|
629
707
|
subscribe(cb: (connections: PluginConnection[]) => void): () => void;
|
|
630
708
|
};
|
|
631
709
|
|
|
710
|
+
// The user's vaults (requires the gated vaults:*). Note the plural: `vault`
|
|
711
|
+
// below is this plugin's own secret storage and is a different thing.
|
|
712
|
+
vaults: {
|
|
713
|
+
list(): PluginVault[];
|
|
714
|
+
create(name: string): PluginVault;
|
|
715
|
+
/** Rejects a team vault. */
|
|
716
|
+
rename(id: string, name: string): void;
|
|
717
|
+
/**
|
|
718
|
+
* Rejects the personal vault, a team vault, and a vault that still holds
|
|
719
|
+
* objects unless `cascade` is passed — in which case its contents are
|
|
720
|
+
* deleted with it.
|
|
721
|
+
*/
|
|
722
|
+
delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// Folders across all four trees (requires the gated folders:*)
|
|
726
|
+
folders: {
|
|
727
|
+
list(kind?: PluginFolderKind): PluginFolder[];
|
|
728
|
+
create(input: {
|
|
729
|
+
kind: PluginFolderKind;
|
|
730
|
+
name: string;
|
|
731
|
+
/** Defaults to the personal vault. */
|
|
732
|
+
vaultId?: string;
|
|
733
|
+
parentFolderId?: string;
|
|
734
|
+
}): Promise<PluginFolder>;
|
|
735
|
+
/** Name only — kind, vault and parent are preserved. Rejects a team vault. */
|
|
736
|
+
rename(id: string, name: string): Promise<void>;
|
|
737
|
+
/** Cascades by default. Rejects a team vault. */
|
|
738
|
+
delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Move and copy vault objects between folders and vaults, through the same
|
|
743
|
+
* paste path the pages use. Each method requires the write permission of every
|
|
744
|
+
* kind it names, and folders:write when a folder travels. Team vaults are
|
|
745
|
+
* refused.
|
|
746
|
+
*/
|
|
747
|
+
objects: {
|
|
748
|
+
move(input: PluginObjectMoveInput): Promise<PluginObjectMoveOutcome>;
|
|
749
|
+
copy(input: PluginObjectMoveInput): Promise<PluginObjectMoveOutcome>;
|
|
750
|
+
};
|
|
751
|
+
|
|
632
752
|
// Vault — plugin-scoped secrets (requires vault:*)
|
|
633
753
|
vault: {
|
|
634
754
|
get(key: string): Promise<string | null>;
|
|
@@ -815,6 +935,9 @@ export interface PluginAPI {
|
|
|
815
935
|
// docker:read (list/services/checkUpdate/logs.*) / docker:manage (everything else).
|
|
816
936
|
docker: DockerAPI;
|
|
817
937
|
|
|
938
|
+
// Reach a published Docker port from this machine — GATED (ports:forward).
|
|
939
|
+
ports: PortsAPI;
|
|
940
|
+
|
|
818
941
|
// Lifecycle hooks (always available)
|
|
819
942
|
lifecycle: {
|
|
820
943
|
/** Fires when an SSH/local session transitions to "connected". */
|