@voltius/plugin-types 0.21.1 → 0.22.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.
Files changed (2) hide show
  1. package/index.d.ts +130 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -114,7 +114,21 @@ export type PluginAuditAction =
114
114
 
115
115
  // ─── Types exposés aux plugins ─────────────────────────────────────────────
116
116
 
117
- export interface PluginConnection {
117
+ /**
118
+ * Where a vault object is filed. Carried by every object a read verb returns and
119
+ * by everything the create verbs hand back, so a caller that relocated something
120
+ * with `objects.move` can observe where it landed — before this nothing could.
121
+ *
122
+ * `vault_id` is a `vaults.list()` id, "personal" when the object is in no other
123
+ * vault; `folder_id` is null at that vault's root. Both feed straight back into
124
+ * `PluginObjectMoveInput`.
125
+ */
126
+ export interface PluginObjectPlacement {
127
+ vault_id?: string;
128
+ folder_id?: string | null;
129
+ }
130
+
131
+ export interface PluginConnection extends PluginObjectPlacement {
118
132
  id: string;
119
133
  name?: string;
120
134
  host: string;
@@ -150,14 +164,14 @@ export interface PluginConnectionInput {
150
164
  jump_hosts?: JumpHost[];
151
165
  }
152
166
 
153
- export interface PluginKey {
167
+ export interface PluginKey extends PluginObjectPlacement {
154
168
  id: string;
155
169
  name?: string;
156
170
  key_type?: string;
157
171
  tags: string[];
158
172
  }
159
173
 
160
- export interface PluginIdentity {
174
+ export interface PluginIdentity extends PluginObjectPlacement {
161
175
  id: string;
162
176
  name?: string;
163
177
  username: string;
@@ -165,6 +179,76 @@ export interface PluginIdentity {
165
179
  tags: string[];
166
180
  }
167
181
 
182
+ export interface PluginSnippet extends PluginObjectPlacement {
183
+ id: string;
184
+ name: string;
185
+ steps: import("@/types").SnippetStep[];
186
+ description?: string;
187
+ tags: string[];
188
+ favorite: boolean;
189
+ /** Empty means the snippet offers itself everywhere. */
190
+ only_for_connection_tags: string[];
191
+ only_for_distros: string[];
192
+ }
193
+
194
+ export interface PluginSnippetInput {
195
+ name: string;
196
+ steps: import("@/types").SnippetStep[];
197
+ description?: string;
198
+ tags?: string[];
199
+ favorite?: boolean;
200
+ only_for_connection_tags?: string[];
201
+ only_for_distros?: string[];
202
+ folder_id?: string;
203
+ vault_id?: string;
204
+ }
205
+
206
+ /**
207
+ * A SAVED port-forwarding rule: a shape, not a live listener. Opening one is
208
+ * `portForwards.start`, which needs an open session to hang the tunnel on.
209
+ */
210
+ export interface PluginPortForward extends PluginObjectPlacement {
211
+ id: string;
212
+ name: string;
213
+ local_port: number;
214
+ remote_port: number;
215
+ remote_host: string;
216
+ tunnel_type: import("@/types").TunnelType;
217
+ bind_host: string;
218
+ target_host: string;
219
+ description?: string;
220
+ /** Connections this rule offers itself on. Empty means all of them. */
221
+ connection_ids: string[];
222
+ }
223
+
224
+ export interface PluginPortForwardInput {
225
+ name: string;
226
+ local_port: number;
227
+ remote_port: number;
228
+ remote_host: string;
229
+ tunnel_type: import("@/types").TunnelType;
230
+ bind_host?: string;
231
+ target_host?: string;
232
+ description?: string;
233
+ connection_ids?: string[];
234
+ folder_id?: string;
235
+ vault_id?: string;
236
+ }
237
+
238
+ /** A tunnel that is open right now on one session. Dies with the session. */
239
+ export interface PluginActiveTunnel {
240
+ id: string;
241
+ tunnel_type: import("@/types").TunnelType;
242
+ local_port: number;
243
+ remote_port: number;
244
+ remote_host: string;
245
+ bind_host?: string;
246
+ target_host?: string;
247
+ /** "active", or the error it failed with. */
248
+ state: import("@/types").TunnelState;
249
+ bytes_transferred: number;
250
+ }
251
+
168
252
  /** A vault the user organizes objects into. Unrelated to `api.vault`, which is plugin storage. */
169
253
  export interface PluginVault {
170
254
  id: string;
@@ -209,6 +293,17 @@ export interface PluginObjectMoveOutcome {
209
293
  created: number;
210
294
  /** Ids that no longer exist, or objects already where the call would put them. */
211
295
  skipped: number;
296
+ /**
297
+ * Where the objects ended up, so a move confirms itself without a follow-up
298
+ * read. `folder_id` is null at the destination vault's root.
299
+ *
300
+ * `vault_id` is null only when the call named no destination vault and no
301
+ * destination folder to take one from — every object kept the vault it had,
302
+ * and there is no single id to report. It is the adapter's own resolved
303
+ * target, not an echo of the request.
304
+ */
305
+ vault_id: string | null;
306
+ folder_id: string | null;
212
307
  }
213
308
 
214
309
  export interface OmniCommand {
@@ -722,6 +817,38 @@ export interface PluginAPI {
722
817
  delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
723
818
  };
724
819
 
820
+ // Saved snippets (requires snippets:read / snippets:write)
821
+ snippets: {
822
+ list(): Promise<PluginSnippet[]>;
823
+ create(input: PluginSnippetInput): Promise<PluginSnippet>;
824
+ /** Only the fields given are altered. Rejects a team vault. */
825
+ update(id: string, patch: Partial<PluginSnippetInput>): Promise<void>;
826
+ /** Rejects a team vault. */
827
+ delete(id: string): Promise<void>;
828
+ };
829
+
830
+ /**
831
+ * Saved port-forwarding rules, and the tunnels open right now.
832
+ *
833
+ * A rule is a vault object; a tunnel is a live listening socket bound to one
834
+ * SSH session and gone when that session closes. `start` is what turns the
835
+ * first into the second (requires port_forwarding:read / port_forwarding:write,
836
+ * and sessions:read for the tunnel methods).
837
+ */
838
+ portForwards: {
839
+ list(): Promise<PluginPortForward[]>;
840
+ create(input: PluginPortForwardInput): Promise<PluginPortForward>;
841
+ /** Only the fields given are altered. Rejects a team vault. */
842
+ update(id: string, patch: Partial<PluginPortForwardInput>): Promise<void>;
843
+ /** Rejects a team vault. */
844
+ delete(id: string): Promise<void>;
845
+ /** Tunnels open on one session. */
846
+ tunnels(sessionId: string): Promise<PluginActiveTunnel[]>;
847
+ /** Opens a saved rule's tunnel on an open session. */
848
+ start(ruleId: string, sessionId: string): Promise<PluginActiveTunnel>;
849
+ stop(sessionId: string, tunnelId: string): Promise<void>;
850
+ };
851
+
725
852
  // Folders across all four trees (requires the gated folders:*)
726
853
  folders: {
727
854
  list(kind?: PluginFolderKind): PluginFolder[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltius/plugin-types",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "description": "TypeScript definitions for the Voltius plugin API",
5
5
  "types": "index.d.ts",
6
6
  "files": [