@fatagnus/remote-cmd-relay-convex 1.0.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.
@@ -0,0 +1,565 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type { FunctionReference } from "convex/server";
12
+
13
+ /**
14
+ * A utility for referencing a Convex component's exposed API.
15
+ *
16
+ * Useful when expecting a parameter like `components.myComponent`.
17
+ * Usage:
18
+ * ```ts
19
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
20
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
21
+ * }
22
+ * ```
23
+ */
24
+ export type ComponentApi<Name extends string | undefined = string | undefined> =
25
+ {
26
+ assignments: {
27
+ create: FunctionReference<
28
+ "mutation",
29
+ "internal",
30
+ {
31
+ apiKeyId: string;
32
+ createdBy: string;
33
+ machineId: string;
34
+ name: string;
35
+ },
36
+ string,
37
+ Name
38
+ >;
39
+ getByApiKeyId: FunctionReference<
40
+ "query",
41
+ "internal",
42
+ { apiKeyId: string },
43
+ {
44
+ _id: string;
45
+ apiKeyId: string;
46
+ createdAt: number;
47
+ createdBy: string;
48
+ enabled: boolean;
49
+ lastSeenAt?: number;
50
+ machineId: string;
51
+ name: string;
52
+ updatedAt: number;
53
+ } | null,
54
+ Name
55
+ >;
56
+ heartbeat: FunctionReference<
57
+ "mutation",
58
+ "internal",
59
+ { apiKeyId: string },
60
+ null,
61
+ Name
62
+ >;
63
+ listAll: FunctionReference<
64
+ "query",
65
+ "internal",
66
+ {},
67
+ Array<{
68
+ _id: string;
69
+ apiKeyId: string;
70
+ createdAt: number;
71
+ createdBy: string;
72
+ enabled: boolean;
73
+ lastSeenAt?: number;
74
+ machineId: string;
75
+ name: string;
76
+ updatedAt: number;
77
+ }>,
78
+ Name
79
+ >;
80
+ listByMachineId: FunctionReference<
81
+ "query",
82
+ "internal",
83
+ { machineId: string },
84
+ Array<{
85
+ _id: string;
86
+ apiKeyId: string;
87
+ createdAt: number;
88
+ createdBy: string;
89
+ enabled: boolean;
90
+ lastSeenAt?: number;
91
+ machineId: string;
92
+ name: string;
93
+ updatedAt: number;
94
+ }>,
95
+ Name
96
+ >;
97
+ remove: FunctionReference<
98
+ "mutation",
99
+ "internal",
100
+ { id: string },
101
+ null,
102
+ Name
103
+ >;
104
+ update: FunctionReference<
105
+ "mutation",
106
+ "internal",
107
+ { enabled?: boolean; id: string; name?: string },
108
+ null,
109
+ Name
110
+ >;
111
+ };
112
+ commands: {
113
+ claim: FunctionReference<
114
+ "mutation",
115
+ "internal",
116
+ { claimedBy: string; id: string },
117
+ boolean,
118
+ Name
119
+ >;
120
+ complete: FunctionReference<
121
+ "mutation",
122
+ "internal",
123
+ {
124
+ durationMs?: number;
125
+ error?: string;
126
+ exitCode?: number;
127
+ id: string;
128
+ output?: string;
129
+ stderr?: string;
130
+ success: boolean;
131
+ },
132
+ null,
133
+ Name
134
+ >;
135
+ get: FunctionReference<
136
+ "query",
137
+ "internal",
138
+ { id: string },
139
+ {
140
+ _id: string;
141
+ claimedAt?: number;
142
+ claimedBy?: string;
143
+ command: string;
144
+ completedAt?: number;
145
+ createdAt: number;
146
+ createdBy: string;
147
+ durationMs?: number;
148
+ error?: string;
149
+ exitCode?: number;
150
+ machineId: string;
151
+ output?: string;
152
+ status:
153
+ | "pending"
154
+ | "claimed"
155
+ | "executing"
156
+ | "completed"
157
+ | "failed"
158
+ | "timeout";
159
+ stderr?: string;
160
+ targetHost?: string;
161
+ targetPort?: number;
162
+ targetType: "local" | "ssh";
163
+ targetUsername?: string;
164
+ timeoutMs: number;
165
+ updatedAt: number;
166
+ } | null,
167
+ Name
168
+ >;
169
+ listPending: FunctionReference<
170
+ "query",
171
+ "internal",
172
+ { limit?: number; machineId: string },
173
+ Array<{
174
+ _id: string;
175
+ command: string;
176
+ createdAt: number;
177
+ createdBy: string;
178
+ machineId: string;
179
+ status:
180
+ | "pending"
181
+ | "claimed"
182
+ | "executing"
183
+ | "completed"
184
+ | "failed"
185
+ | "timeout";
186
+ targetHost?: string;
187
+ targetPort?: number;
188
+ targetType: "local" | "ssh";
189
+ targetUsername?: string;
190
+ timeoutMs: number;
191
+ }>,
192
+ Name
193
+ >;
194
+ listRecent: FunctionReference<
195
+ "query",
196
+ "internal",
197
+ { limit?: number; machineId: string },
198
+ Array<{
199
+ _id: string;
200
+ command: string;
201
+ completedAt?: number;
202
+ createdAt: number;
203
+ durationMs?: number;
204
+ error?: string;
205
+ exitCode?: number;
206
+ machineId: string;
207
+ status:
208
+ | "pending"
209
+ | "claimed"
210
+ | "executing"
211
+ | "completed"
212
+ | "failed"
213
+ | "timeout";
214
+ targetType: "local" | "ssh";
215
+ }>,
216
+ Name
217
+ >;
218
+ queue: FunctionReference<
219
+ "mutation",
220
+ "internal",
221
+ {
222
+ command: string;
223
+ createdBy: string;
224
+ machineId: string;
225
+ targetHost?: string;
226
+ targetPort?: number;
227
+ targetType: "local" | "ssh";
228
+ targetUsername?: string;
229
+ timeoutMs?: number;
230
+ },
231
+ string,
232
+ Name
233
+ >;
234
+ startExecution: FunctionReference<
235
+ "mutation",
236
+ "internal",
237
+ { id: string },
238
+ null,
239
+ Name
240
+ >;
241
+ };
242
+ configPush: {
243
+ get: FunctionReference<
244
+ "query",
245
+ "internal",
246
+ { id: string },
247
+ {
248
+ _id: string;
249
+ ackedAt?: number;
250
+ createdAt: number;
251
+ errorMessage?: string;
252
+ payload: string;
253
+ pushType: string;
254
+ relayId: string;
255
+ status: string;
256
+ } | null,
257
+ Name
258
+ >;
259
+ listAll: FunctionReference<
260
+ "query",
261
+ "internal",
262
+ {},
263
+ Array<{
264
+ _id: string;
265
+ createdAt: number;
266
+ payload: string;
267
+ pushType: string;
268
+ relayId: string;
269
+ status: string;
270
+ }>,
271
+ Name
272
+ >;
273
+ queue: FunctionReference<
274
+ "mutation",
275
+ "internal",
276
+ { payload: string; pushType: string; relayId: string },
277
+ string,
278
+ Name
279
+ >;
280
+ };
281
+ credentials: {
282
+ create: FunctionReference<
283
+ "mutation",
284
+ "internal",
285
+ {
286
+ assignedRelays: Array<string>;
287
+ credentialType: "ssh_key" | "password" | "api_key";
288
+ encryptedValue: string;
289
+ name: string;
290
+ targetHost?: string;
291
+ },
292
+ string,
293
+ Name
294
+ >;
295
+ listAll: FunctionReference<
296
+ "query",
297
+ "internal",
298
+ {},
299
+ Array<{
300
+ _id: string;
301
+ assignedRelays: Array<string>;
302
+ createdAt: number;
303
+ credentialType: "ssh_key" | "password" | "api_key";
304
+ name: string;
305
+ targetHost?: string;
306
+ updatedAt: number;
307
+ }>,
308
+ Name
309
+ >;
310
+ listByRelay: FunctionReference<
311
+ "query",
312
+ "internal",
313
+ { relayId: string },
314
+ Array<{
315
+ _id: string;
316
+ credentialName: string;
317
+ credentialType: "ssh_key" | "password" | "api_key";
318
+ lastUpdatedAt: number;
319
+ relayId: string;
320
+ reportedAt: number;
321
+ storageMode: "relay_only" | "shared";
322
+ targetHost?: string;
323
+ }>,
324
+ Name
325
+ >;
326
+ remove: FunctionReference<
327
+ "mutation",
328
+ "internal",
329
+ { id: string },
330
+ null,
331
+ Name
332
+ >;
333
+ };
334
+ public: {
335
+ acknowledgeConfigPush: FunctionReference<
336
+ "mutation",
337
+ "internal",
338
+ { errorMessage?: string; pushId: string; success: boolean },
339
+ { success: boolean },
340
+ Name
341
+ >;
342
+ claimCommand: FunctionReference<
343
+ "mutation",
344
+ "internal",
345
+ { assignmentId: string; commandId: string },
346
+ | {
347
+ command: {
348
+ _id: string;
349
+ command: string;
350
+ targetHost?: string;
351
+ targetPort?: number;
352
+ targetType: "local" | "ssh";
353
+ targetUsername?: string;
354
+ timeoutMs: number;
355
+ };
356
+ success: true;
357
+ }
358
+ | { error: string; success: false },
359
+ Name
360
+ >;
361
+ getPendingCommands: FunctionReference<
362
+ "query",
363
+ "internal",
364
+ { machineId: string },
365
+ Array<{
366
+ _id: string;
367
+ command: string;
368
+ createdAt: number;
369
+ targetHost?: string;
370
+ targetPort?: number;
371
+ targetType: "local" | "ssh";
372
+ targetUsername?: string;
373
+ timeoutMs: number;
374
+ }>,
375
+ Name
376
+ >;
377
+ getPendingConfigPushes: FunctionReference<
378
+ "query",
379
+ "internal",
380
+ { relayId: string },
381
+ Array<{
382
+ _id: string;
383
+ createdAt: number;
384
+ payload: string;
385
+ pushType: string;
386
+ }>,
387
+ Name
388
+ >;
389
+ getSharedCredentials: FunctionReference<
390
+ "query",
391
+ "internal",
392
+ { relayId: string },
393
+ Array<{
394
+ credentialType: "ssh_key" | "password" | "api_key";
395
+ encryptedValue: string;
396
+ name: string;
397
+ targetHost?: string;
398
+ updatedAt: number;
399
+ }>,
400
+ Name
401
+ >;
402
+ reportFullStatus: FunctionReference<
403
+ "mutation",
404
+ "internal",
405
+ {
406
+ capabilities: Array<"ssh" | "local_cmd" | "perf_metrics">;
407
+ credentials: Array<{
408
+ credentialName: string;
409
+ credentialType: "ssh_key" | "password" | "api_key";
410
+ lastUpdatedAt: number;
411
+ storageMode: "relay_only" | "shared";
412
+ targetHost?: string;
413
+ }>;
414
+ hostname?: string;
415
+ metrics?: {
416
+ cpuPercent?: number;
417
+ diskPercent?: number;
418
+ diskTotalGb?: number;
419
+ diskUsedGb?: number;
420
+ loadAvg15m?: number;
421
+ loadAvg1m?: number;
422
+ loadAvg5m?: number;
423
+ memoryPercent?: number;
424
+ memoryTotalMb?: number;
425
+ memoryUsedMb?: number;
426
+ };
427
+ platform?: string;
428
+ relayId: string;
429
+ version?: string;
430
+ },
431
+ {
432
+ pendingConfigPushes: number;
433
+ sharedCredentialsCount: number;
434
+ success: boolean;
435
+ },
436
+ Name
437
+ >;
438
+ sendHeartbeat: FunctionReference<
439
+ "mutation",
440
+ "internal",
441
+ { apiKeyId: string },
442
+ { success: boolean },
443
+ Name
444
+ >;
445
+ submitResult: FunctionReference<
446
+ "mutation",
447
+ "internal",
448
+ {
449
+ commandId: string;
450
+ durationMs?: number;
451
+ error?: string;
452
+ exitCode?: number;
453
+ output?: string;
454
+ stderr?: string;
455
+ success: boolean;
456
+ },
457
+ { success: boolean },
458
+ Name
459
+ >;
460
+ verifyRelay: FunctionReference<
461
+ "query",
462
+ "internal",
463
+ { apiKeyId: string },
464
+ | { assignmentId: string; machineId: string; name: string; valid: true }
465
+ | { error: string; valid: false },
466
+ Name
467
+ >;
468
+ };
469
+ status: {
470
+ findByCapability: FunctionReference<
471
+ "query",
472
+ "internal",
473
+ { capability: "ssh" | "local_cmd" | "perf_metrics" },
474
+ Array<{
475
+ capabilities: Array<"ssh" | "local_cmd" | "perf_metrics">;
476
+ isOnline: boolean;
477
+ lastHeartbeatAt: number;
478
+ relayId: string;
479
+ }>,
480
+ Name
481
+ >;
482
+ getByRelayId: FunctionReference<
483
+ "query",
484
+ "internal",
485
+ { relayId: string },
486
+ {
487
+ _id: string;
488
+ capabilities: Array<"ssh" | "local_cmd" | "perf_metrics">;
489
+ createdAt: number;
490
+ hostname?: string;
491
+ lastHeartbeatAt: number;
492
+ metrics?: {
493
+ cpuPercent?: number;
494
+ diskPercent?: number;
495
+ diskTotalGb?: number;
496
+ diskUsedGb?: number;
497
+ loadAvg15m?: number;
498
+ loadAvg1m?: number;
499
+ loadAvg5m?: number;
500
+ memoryPercent?: number;
501
+ memoryTotalMb?: number;
502
+ memoryUsedMb?: number;
503
+ };
504
+ platform?: string;
505
+ relayId: string;
506
+ updatedAt: number;
507
+ version?: string;
508
+ } | null,
509
+ Name
510
+ >;
511
+ listAll: FunctionReference<
512
+ "query",
513
+ "internal",
514
+ {},
515
+ Array<{
516
+ _id: string;
517
+ capabilities: Array<"ssh" | "local_cmd" | "perf_metrics">;
518
+ hostname?: string;
519
+ isOnline: boolean;
520
+ lastHeartbeatAt: number;
521
+ metrics?: {
522
+ cpuPercent?: number;
523
+ diskPercent?: number;
524
+ diskTotalGb?: number;
525
+ diskUsedGb?: number;
526
+ loadAvg15m?: number;
527
+ loadAvg1m?: number;
528
+ loadAvg5m?: number;
529
+ memoryPercent?: number;
530
+ memoryTotalMb?: number;
531
+ memoryUsedMb?: number;
532
+ };
533
+ platform?: string;
534
+ relayId: string;
535
+ version?: string;
536
+ }>,
537
+ Name
538
+ >;
539
+ reportStatus: FunctionReference<
540
+ "mutation",
541
+ "internal",
542
+ {
543
+ capabilities: Array<"ssh" | "local_cmd" | "perf_metrics">;
544
+ hostname?: string;
545
+ metrics?: {
546
+ cpuPercent?: number;
547
+ diskPercent?: number;
548
+ diskTotalGb?: number;
549
+ diskUsedGb?: number;
550
+ loadAvg15m?: number;
551
+ loadAvg1m?: number;
552
+ loadAvg5m?: number;
553
+ memoryPercent?: number;
554
+ memoryTotalMb?: number;
555
+ memoryUsedMb?: number;
556
+ };
557
+ platform?: string;
558
+ relayId: string;
559
+ version?: string;
560
+ },
561
+ { statusId?: string; success: boolean },
562
+ Name
563
+ >;
564
+ };
565
+ };
@@ -0,0 +1,60 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type {
12
+ DataModelFromSchemaDefinition,
13
+ DocumentByName,
14
+ TableNamesInDataModel,
15
+ SystemTableNames,
16
+ } from "convex/server";
17
+ import type { GenericId } from "convex/values";
18
+ import schema from "../schema.js";
19
+
20
+ /**
21
+ * The names of all of your Convex tables.
22
+ */
23
+ export type TableNames = TableNamesInDataModel<DataModel>;
24
+
25
+ /**
26
+ * The type of a document stored in Convex.
27
+ *
28
+ * @typeParam TableName - A string literal type of the table name (like "users").
29
+ */
30
+ export type Doc<TableName extends TableNames> = DocumentByName<
31
+ DataModel,
32
+ TableName
33
+ >;
34
+
35
+ /**
36
+ * An identifier for a document in Convex.
37
+ *
38
+ * Convex documents are uniquely identified by their `Id`, which is accessible
39
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
40
+ *
41
+ * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
42
+ *
43
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
44
+ * strings when type checking.
45
+ *
46
+ * @typeParam TableName - A string literal type of the table name (like "users").
47
+ */
48
+ export type Id<TableName extends TableNames | SystemTableNames> =
49
+ GenericId<TableName>;
50
+
51
+ /**
52
+ * A type describing your Convex data model.
53
+ *
54
+ * This type includes information about what tables you have, the type of
55
+ * documents stored in those tables, and the indexes defined on them.
56
+ *
57
+ * This type is used to parameterize methods like `queryGeneric` and
58
+ * `mutationGeneric` to make them type-safe.
59
+ */
60
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;