@mochabug/adapt-web 0.0.25 → 0.0.27

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 (57) hide show
  1. package/dist/cjs/genproto/buf/validate/validate_pb.js +58 -119
  2. package/dist/cjs/genproto/buf/validate/validate_pb.js.map +1 -1
  3. package/dist/cjs/genproto/mochabugapis/adapt/automations/v1/automations_pb.js +13 -7
  4. package/dist/cjs/genproto/mochabugapis/adapt/automations/v1/automations_pb.js.map +1 -1
  5. package/dist/cjs/genproto/mochabugapis/adapt/graph/signal_binding_pb.js +1 -2
  6. package/dist/cjs/genproto/mochabugapis/adapt/graph/signal_binding_pb.js.map +1 -1
  7. package/dist/cjs/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.js +1 -1
  8. package/dist/cjs/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.js.map +1 -1
  9. package/dist/cjs/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.js +1 -1
  10. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/file_pb.js +1 -1
  11. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.js +1 -1
  12. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.js +1 -1
  13. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.js.map +1 -1
  14. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.js +1 -1
  15. package/dist/cjs/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.js.map +1 -1
  16. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.js +10 -5
  17. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.js.map +1 -1
  18. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.js +17 -19
  19. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.js.map +1 -1
  20. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/store_pb.js +19 -14
  21. package/dist/cjs/genproto/mochabugapis/adapt/runtime/v1/store_pb.js.map +1 -1
  22. package/dist/cjs/index.js +160 -64
  23. package/dist/cjs/index.js.map +1 -1
  24. package/dist/esm/genproto/buf/validate/validate_pb.js +58 -119
  25. package/dist/esm/genproto/buf/validate/validate_pb.js.map +1 -1
  26. package/dist/esm/genproto/mochabugapis/adapt/automations/v1/automations_pb.js +14 -8
  27. package/dist/esm/genproto/mochabugapis/adapt/automations/v1/automations_pb.js.map +1 -1
  28. package/dist/esm/genproto/mochabugapis/adapt/graph/signal_binding_pb.js +1 -2
  29. package/dist/esm/genproto/mochabugapis/adapt/graph/signal_binding_pb.js.map +1 -1
  30. package/dist/esm/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.js +1 -1
  31. package/dist/esm/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.js.map +1 -1
  32. package/dist/esm/genproto/mochabugapis/adapt/graph/vertex_metadata_pb.js +1 -1
  33. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/file_pb.js +1 -1
  34. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.js +1 -1
  35. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.js +1 -1
  36. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.js.map +1 -1
  37. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.js +1 -1
  38. package/dist/esm/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.js.map +1 -1
  39. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.js +9 -4
  40. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.js.map +1 -1
  41. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.js +16 -18
  42. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.js.map +1 -1
  43. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/store_pb.js +19 -14
  44. package/dist/esm/genproto/mochabugapis/adapt/runtime/v1/store_pb.js.map +1 -1
  45. package/dist/esm/index.js +159 -60
  46. package/dist/esm/index.js.map +1 -1
  47. package/dist/types/genproto/buf/validate/validate_pb.d.ts +184 -219
  48. package/dist/types/genproto/mochabugapis/adapt/automations/v1/automations_pb.d.ts +150 -108
  49. package/dist/types/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +4 -5
  50. package/dist/types/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +4 -2
  51. package/dist/types/genproto/mochabugapis/adapt/plugins/v1/tls_service_pb.d.ts +0 -12
  52. package/dist/types/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts +16 -0
  53. package/dist/types/genproto/mochabugapis/adapt/runtime/v1/incoming_pb.d.ts +60 -39
  54. package/dist/types/genproto/mochabugapis/adapt/runtime/v1/runtime_pb.d.ts +90 -139
  55. package/dist/types/genproto/mochabugapis/adapt/runtime/v1/store_pb.d.ts +155 -84
  56. package/dist/types/index.d.ts +14 -7
  57. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
- import type { Timestamp, TimestampJson, Value, ValueJson } from "@bufbuild/protobuf/wkt";
2
+ import type { Timestamp, TimestampJson } from "@bufbuild/protobuf/wkt";
3
3
  import type { Message } from "@bufbuild/protobuf";
4
4
  /**
5
5
  * Describes the file mochabugapis/adapt/runtime/v1/store.proto.
@@ -14,9 +14,9 @@ export type PutValue = Message<"mochabugapis.adapt.runtime.v1.PutValue"> & {
14
14
  /**
15
15
  * The actual value (can be anything, even not even set)
16
16
  *
17
- * @generated from field: google.protobuf.Value value = 1;
17
+ * @generated from field: bytes value = 1;
18
18
  */
19
- value?: Value;
19
+ value: Uint8Array;
20
20
  /**
21
21
  * Time-to-live in seconds. If zero or negative, no expiration
22
22
  *
@@ -33,9 +33,9 @@ export type PutValueJson = {
33
33
  /**
34
34
  * The actual value (can be anything, even not even set)
35
35
  *
36
- * @generated from field: google.protobuf.Value value = 1;
36
+ * @generated from field: bytes value = 1;
37
37
  */
38
- value?: ValueJson;
38
+ value?: string;
39
39
  /**
40
40
  * Time-to-live in seconds. If zero or negative, no expiration
41
41
  *
@@ -59,9 +59,9 @@ export type GetValue = Message<"mochabugapis.adapt.runtime.v1.GetValue"> & {
59
59
  /**
60
60
  * The actual value
61
61
  *
62
- * @generated from field: google.protobuf.Value value = 1;
62
+ * @generated from field: bytes value = 1;
63
63
  */
64
- value?: Value;
64
+ value: Uint8Array;
65
65
  /**
66
66
  * Time-to-live in seconds. If zero or negative, no expiration
67
67
  *
@@ -90,9 +90,9 @@ export type GetValueJson = {
90
90
  /**
91
91
  * The actual value
92
92
  *
93
- * @generated from field: google.protobuf.Value value = 1;
93
+ * @generated from field: bytes value = 1;
94
94
  */
95
- value?: ValueJson;
95
+ value?: string;
96
96
  /**
97
97
  * Time-to-live in seconds. If zero or negative, no expiration
98
98
  *
@@ -209,63 +209,6 @@ export type EtagConditionJson = {
209
209
  export declare const EtagConditionSchema: GenMessage<EtagCondition, {
210
210
  jsonType: EtagConditionJson;
211
211
  }>;
212
- /**
213
- * Represents preconditions for write operations on a value
214
- *
215
- * @generated from message mochabugapis.adapt.runtime.v1.Precondition
216
- */
217
- export type Precondition = Message<"mochabugapis.adapt.runtime.v1.Precondition"> & {
218
- /**
219
- * Specifies whether the key should exist (true) or not (false)
220
- *
221
- * @generated from field: optional bool exists = 1;
222
- */
223
- exists?: boolean;
224
- /**
225
- * Specifies the conditions for the last modified timestamp of the value (cannot be used for insert operations!)
226
- *
227
- * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 2;
228
- */
229
- lastModified: TimestampCondition[];
230
- /**
231
- * Specifies the conditions for the etag of the value (cannot be used for insert operations!)
232
- *
233
- * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 3;
234
- */
235
- etag?: EtagCondition;
236
- };
237
- /**
238
- * Represents preconditions for write operations on a value
239
- *
240
- * @generated from message mochabugapis.adapt.runtime.v1.Precondition
241
- */
242
- export type PreconditionJson = {
243
- /**
244
- * Specifies whether the key should exist (true) or not (false)
245
- *
246
- * @generated from field: optional bool exists = 1;
247
- */
248
- exists?: boolean;
249
- /**
250
- * Specifies the conditions for the last modified timestamp of the value (cannot be used for insert operations!)
251
- *
252
- * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 2;
253
- */
254
- lastModified?: TimestampConditionJson[];
255
- /**
256
- * Specifies the conditions for the etag of the value (cannot be used for insert operations!)
257
- *
258
- * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 3;
259
- */
260
- etag?: EtagConditionJson;
261
- };
262
- /**
263
- * Describes the message mochabugapis.adapt.runtime.v1.Precondition.
264
- * Use `create(PreconditionSchema)` to create a new message.
265
- */
266
- export declare const PreconditionSchema: GenMessage<Precondition, {
267
- jsonType: PreconditionJson;
268
- }>;
269
212
  /**
270
213
  * Operation to update a key-value pair.
271
214
  * Outcomes:
@@ -290,11 +233,33 @@ export type UpdateOp = Message<"mochabugapis.adapt.runtime.v1.UpdateOp"> & {
290
233
  */
291
234
  value?: PutValue;
292
235
  /**
293
- * The precondition of the operation
236
+ * Precondition to be checked before the operation
237
+ * If upsert is requested, then the precondition will always be false
238
+ * meaning that it's effectivly useless in combination with upsert
239
+ * Default behaviour is upsert without any conditions
294
240
  *
295
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 3;
241
+ * @generated from oneof mochabugapis.adapt.runtime.v1.UpdateOp.precondition
296
242
  */
297
- precondition?: Precondition;
243
+ precondition: {
244
+ /**
245
+ * The precondition to be checked before the operation
246
+ *
247
+ * @generated from field: mochabugapis.adapt.runtime.v1.UpdateOp.Precondition condition = 3;
248
+ */
249
+ value: UpdateOp_Precondition;
250
+ case: "condition";
251
+ } | {
252
+ /**
253
+ * The precondition to be checked before the operation
254
+ *
255
+ * @generated from field: bool upsert = 4;
256
+ */
257
+ value: boolean;
258
+ case: "upsert";
259
+ } | {
260
+ case: undefined;
261
+ value?: undefined;
262
+ };
298
263
  };
299
264
  /**
300
265
  * Operation to update a key-value pair.
@@ -320,11 +285,17 @@ export type UpdateOpJson = {
320
285
  */
321
286
  value?: PutValueJson;
322
287
  /**
323
- * The precondition of the operation
288
+ * The precondition to be checked before the operation
289
+ *
290
+ * @generated from field: mochabugapis.adapt.runtime.v1.UpdateOp.Precondition condition = 3;
291
+ */
292
+ condition?: UpdateOp_PreconditionJson;
293
+ /**
294
+ * The precondition to be checked before the operation
324
295
  *
325
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 3;
296
+ * @generated from field: bool upsert = 4;
326
297
  */
327
- precondition?: PreconditionJson;
298
+ upsert?: boolean;
328
299
  };
329
300
  /**
330
301
  * Describes the message mochabugapis.adapt.runtime.v1.UpdateOp.
@@ -333,11 +304,55 @@ export type UpdateOpJson = {
333
304
  export declare const UpdateOpSchema: GenMessage<UpdateOp, {
334
305
  jsonType: UpdateOpJson;
335
306
  }>;
307
+ /**
308
+ * Represents preconditions for write operations on a value
309
+ *
310
+ * @generated from message mochabugapis.adapt.runtime.v1.UpdateOp.Precondition
311
+ */
312
+ export type UpdateOp_Precondition = Message<"mochabugapis.adapt.runtime.v1.UpdateOp.Precondition"> & {
313
+ /**
314
+ * Specifies the conditions for the last modified timestamp of the value
315
+ *
316
+ * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 1;
317
+ */
318
+ lastModified: TimestampCondition[];
319
+ /**
320
+ * Specifies the conditions for the etag of the value
321
+ *
322
+ * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 2;
323
+ */
324
+ etag?: EtagCondition;
325
+ };
326
+ /**
327
+ * Represents preconditions for write operations on a value
328
+ *
329
+ * @generated from message mochabugapis.adapt.runtime.v1.UpdateOp.Precondition
330
+ */
331
+ export type UpdateOp_PreconditionJson = {
332
+ /**
333
+ * Specifies the conditions for the last modified timestamp of the value
334
+ *
335
+ * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 1;
336
+ */
337
+ lastModified?: TimestampConditionJson[];
338
+ /**
339
+ * Specifies the conditions for the etag of the value
340
+ *
341
+ * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 2;
342
+ */
343
+ etag?: EtagConditionJson;
344
+ };
345
+ /**
346
+ * Describes the message mochabugapis.adapt.runtime.v1.UpdateOp.Precondition.
347
+ * Use `create(UpdateOp_PreconditionSchema)` to create a new message.
348
+ */
349
+ export declare const UpdateOp_PreconditionSchema: GenMessage<UpdateOp_Precondition, {
350
+ jsonType: UpdateOp_PreconditionJson;
351
+ }>;
336
352
  /**
337
353
  * Operation to insert
338
354
  * Outcomes:
339
355
  * If the key already exists, and `fail_if_exists` is true: Status is BAD_REQUEST (HTTP 400)
340
- * If the precondition has failed: Status is PRECONDITION_FAILED (HTTP 412)
341
356
  * If the key already exists, and `fail_if_exists` is false or not set: Status is OK (HTTP 200)
342
357
  * If there's any internal server error: Status is INTERNAL_SERVER_ERROR (HTTP 500)
343
358
  *
@@ -357,17 +372,16 @@ export type InsertOp = Message<"mochabugapis.adapt.runtime.v1.InsertOp"> & {
357
372
  */
358
373
  value?: PutValue;
359
374
  /**
360
- * The precondition of the operation
375
+ * Fail if the key already exists
361
376
  *
362
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 3;
377
+ * @generated from field: bool fail_if_exists = 3;
363
378
  */
364
- precondition?: Precondition;
379
+ failIfExists: boolean;
365
380
  };
366
381
  /**
367
382
  * Operation to insert
368
383
  * Outcomes:
369
384
  * If the key already exists, and `fail_if_exists` is true: Status is BAD_REQUEST (HTTP 400)
370
- * If the precondition has failed: Status is PRECONDITION_FAILED (HTTP 412)
371
385
  * If the key already exists, and `fail_if_exists` is false or not set: Status is OK (HTTP 200)
372
386
  * If there's any internal server error: Status is INTERNAL_SERVER_ERROR (HTTP 500)
373
387
  *
@@ -387,11 +401,11 @@ export type InsertOpJson = {
387
401
  */
388
402
  value?: PutValueJson;
389
403
  /**
390
- * The precondition of the operation
404
+ * Fail if the key already exists
391
405
  *
392
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 3;
406
+ * @generated from field: bool fail_if_exists = 3;
393
407
  */
394
- precondition?: PreconditionJson;
408
+ failIfExists?: boolean;
395
409
  };
396
410
  /**
397
411
  * Describes the message mochabugapis.adapt.runtime.v1.InsertOp.
@@ -461,9 +475,9 @@ export type DeleteOp = Message<"mochabugapis.adapt.runtime.v1.DeleteOp"> & {
461
475
  /**
462
476
  * The precondition of the operation
463
477
  *
464
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 2;
478
+ * @generated from field: mochabugapis.adapt.runtime.v1.DeleteOp.Precondition precondition = 2;
465
479
  */
466
- precondition?: Precondition;
480
+ precondition?: DeleteOp_Precondition;
467
481
  };
468
482
  /**
469
483
  * Operation to delete a given key-value pair.
@@ -485,9 +499,9 @@ export type DeleteOpJson = {
485
499
  /**
486
500
  * The precondition of the operation
487
501
  *
488
- * @generated from field: mochabugapis.adapt.runtime.v1.Precondition precondition = 2;
502
+ * @generated from field: mochabugapis.adapt.runtime.v1.DeleteOp.Precondition precondition = 2;
489
503
  */
490
- precondition?: PreconditionJson;
504
+ precondition?: DeleteOp_PreconditionJson;
491
505
  };
492
506
  /**
493
507
  * Describes the message mochabugapis.adapt.runtime.v1.DeleteOp.
@@ -496,6 +510,63 @@ export type DeleteOpJson = {
496
510
  export declare const DeleteOpSchema: GenMessage<DeleteOp, {
497
511
  jsonType: DeleteOpJson;
498
512
  }>;
513
+ /**
514
+ * Represents preconditions for write operations on a value
515
+ *
516
+ * @generated from message mochabugapis.adapt.runtime.v1.DeleteOp.Precondition
517
+ */
518
+ export type DeleteOp_Precondition = Message<"mochabugapis.adapt.runtime.v1.DeleteOp.Precondition"> & {
519
+ /**
520
+ * Optionally fail if the key doesn't exist
521
+ *
522
+ * @generated from field: optional bool must_exists = 3;
523
+ */
524
+ mustExists?: boolean;
525
+ /**
526
+ * Specifies the conditions for the last modified timestamp of the value
527
+ *
528
+ * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 1;
529
+ */
530
+ lastModified: TimestampCondition[];
531
+ /**
532
+ * Specifies the conditions for the etag of the value
533
+ *
534
+ * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 2;
535
+ */
536
+ etag?: EtagCondition;
537
+ };
538
+ /**
539
+ * Represents preconditions for write operations on a value
540
+ *
541
+ * @generated from message mochabugapis.adapt.runtime.v1.DeleteOp.Precondition
542
+ */
543
+ export type DeleteOp_PreconditionJson = {
544
+ /**
545
+ * Optionally fail if the key doesn't exist
546
+ *
547
+ * @generated from field: optional bool must_exists = 3;
548
+ */
549
+ mustExists?: boolean;
550
+ /**
551
+ * Specifies the conditions for the last modified timestamp of the value
552
+ *
553
+ * @generated from field: repeated mochabugapis.adapt.runtime.v1.TimestampCondition last_modified = 1;
554
+ */
555
+ lastModified?: TimestampConditionJson[];
556
+ /**
557
+ * Specifies the conditions for the etag of the value
558
+ *
559
+ * @generated from field: optional mochabugapis.adapt.runtime.v1.EtagCondition etag = 2;
560
+ */
561
+ etag?: EtagConditionJson;
562
+ };
563
+ /**
564
+ * Describes the message mochabugapis.adapt.runtime.v1.DeleteOp.Precondition.
565
+ * Use `create(DeleteOp_PreconditionSchema)` to create a new message.
566
+ */
567
+ export declare const DeleteOp_PreconditionSchema: GenMessage<DeleteOp_Precondition, {
568
+ jsonType: DeleteOp_PreconditionJson;
569
+ }>;
499
570
  /**
500
571
  * WriteOperation represents a single operation to be performed on the key-value store.
501
572
  * An operation can be of type PutOp, GetOp, or DeleteOp.
@@ -14,23 +14,30 @@ export declare class RestClientError extends Error {
14
14
  }
15
15
  export interface Output {
16
16
  vertex: string;
17
+ fork: string;
17
18
  data: {
18
19
  [key: string]: ValueJson;
19
20
  };
20
21
  created?: Date;
21
22
  }
22
23
  export type SubscriptionOptions = {
23
- sessionToken: string;
24
- session: string;
25
- automation: AutomationIdJson;
24
+ credentials: Uint8Array;
25
+ subject: string;
26
26
  onOutput?: (output: Output) => void;
27
27
  onSession?: (session: SessionJson) => void;
28
28
  onUrl?: (url: UrlJson) => void;
29
29
  };
30
- export declare class MqttClient {
31
- private readonly clientId;
32
- private mqttClient;
33
- constructor(clientId: string);
30
+ export declare class PubsubClient {
31
+ private nc;
32
+ private subscriptions;
33
+ private subject;
34
+ private outputHandler;
35
+ private sessionHandler;
36
+ private urlHandler;
37
+ constructor();
34
38
  subscribe(opts: SubscriptionOptions): Promise<void>;
39
+ private createSubscriptions;
40
+ private clearSubscriptions;
41
+ private resubscribe;
35
42
  unsubscribe(): Promise<void>;
36
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adapt-web",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "The client library to execute automations, without effort, in a browser environment",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -53,10 +53,10 @@
53
53
  },
54
54
  "homepage": "https://github.com/mochabug/adapt-automation-clients#readme",
55
55
  "devDependencies": {
56
- "typescript": "^5.8.3"
56
+ "typescript": "^5.9.2"
57
57
  },
58
58
  "dependencies": {
59
- "@bufbuild/protobuf": "^2.5.2",
60
- "mqtt": "^5.13.1"
59
+ "@bufbuild/protobuf": "^2.6.3",
60
+ "nats.ws": "^1.30.3"
61
61
  }
62
62
  }