@mastra/google-cloud-pubsub 0.0.0-ai-telementry-ui-20250908094819

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/CHANGELOG.md ADDED
@@ -0,0 +1,693 @@
1
+ # @mastra/inngest
2
+
3
+ ## 0.0.0-ai-telementry-ui-20250908094819
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0662d02]
8
+ - Updated dependencies [6189844]
9
+ - Updated dependencies [d7a8f59]
10
+ - Updated dependencies [4dda259]
11
+ - Updated dependencies [defed1c]
12
+ - Updated dependencies [6991ced]
13
+ - Updated dependencies [9cb9c42]
14
+ - Updated dependencies [8334859]
15
+ - @mastra/core@0.0.0-ai-telementry-ui-20250908094819
16
+
17
+ ## 0.1.3
18
+
19
+ ### Patch Changes
20
+
21
+ - 376913a: Update peerdeps
22
+ - Updated dependencies [8fbf79e]
23
+ - Updated dependencies [fd83526]
24
+ - Updated dependencies [d0b90ab]
25
+ - Updated dependencies [6f5eb7a]
26
+ - Updated dependencies [a01cf14]
27
+ - Updated dependencies [a9e50ee]
28
+ - Updated dependencies [5397eb4]
29
+ - Updated dependencies [c9f4e4a]
30
+ - Updated dependencies [0acbc80]
31
+ - @mastra/core@0.16.0
32
+
33
+ ## 0.1.3-alpha.0
34
+
35
+ ### Patch Changes
36
+
37
+ - 376913a: Update peerdeps
38
+ - Updated dependencies [8fbf79e]
39
+ - @mastra/core@0.16.0-alpha.1
40
+
41
+ ## 0.1.2
42
+
43
+ ### Patch Changes
44
+
45
+ - ab48c97: dependencies updates:
46
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
47
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
48
+ - f0dfcac: updated core peerdep
49
+ - Updated dependencies [ab48c97]
50
+ - Updated dependencies [85ef90b]
51
+ - Updated dependencies [aedbbfa]
52
+ - Updated dependencies [ff89505]
53
+ - Updated dependencies [637f323]
54
+ - Updated dependencies [de3cbc6]
55
+ - Updated dependencies [c19bcf7]
56
+ - Updated dependencies [4474d04]
57
+ - Updated dependencies [183dc95]
58
+ - Updated dependencies [a1111e2]
59
+ - Updated dependencies [b42a961]
60
+ - Updated dependencies [61debef]
61
+ - Updated dependencies [9beaeff]
62
+ - Updated dependencies [29de0e1]
63
+ - Updated dependencies [f643c65]
64
+ - Updated dependencies [00c74e7]
65
+ - Updated dependencies [fef7375]
66
+ - Updated dependencies [e3d8fea]
67
+ - Updated dependencies [45e4d39]
68
+ - Updated dependencies [9eee594]
69
+ - Updated dependencies [7149d8d]
70
+ - Updated dependencies [822c2e8]
71
+ - Updated dependencies [979912c]
72
+ - Updated dependencies [7dcf4c0]
73
+ - Updated dependencies [4106a58]
74
+ - Updated dependencies [ad78bfc]
75
+ - Updated dependencies [0302f50]
76
+ - Updated dependencies [6ac697e]
77
+ - Updated dependencies [74db265]
78
+ - Updated dependencies [0ce418a]
79
+ - Updated dependencies [af90672]
80
+ - Updated dependencies [8387952]
81
+ - Updated dependencies [7f3b8da]
82
+ - Updated dependencies [905352b]
83
+ - Updated dependencies [599d04c]
84
+ - Updated dependencies [56041d0]
85
+ - Updated dependencies [3412597]
86
+ - Updated dependencies [5eca5d2]
87
+ - Updated dependencies [f2cda47]
88
+ - Updated dependencies [5de1555]
89
+ - Updated dependencies [cfd377a]
90
+ - Updated dependencies [1ed5a3e]
91
+ - @mastra/core@0.15.3
92
+
93
+ ## 0.1.2-alpha.2
94
+
95
+ ### Patch Changes
96
+
97
+ - [#7394](https://github.com/mastra-ai/mastra/pull/7394) [`f0dfcac`](https://github.com/mastra-ai/mastra/commit/f0dfcac4458bdf789b975e2d63e984f5d1e7c4d3) Thanks [@NikAiyer](https://github.com/NikAiyer)! - updated core peerdep
98
+
99
+ - Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
100
+ - @mastra/core@0.15.3-alpha.7
101
+
102
+ ## 0.1.2-alpha.1
103
+
104
+ ### Patch Changes
105
+
106
+ - [#7343](https://github.com/mastra-ai/mastra/pull/7343) [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e) Thanks [@LekoArts](https://github.com/LekoArts)! - Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
107
+
108
+ - Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
109
+ - @mastra/core@0.15.3-alpha.5
110
+
111
+ ## 0.1.2-alpha.0
112
+
113
+ ### Patch Changes
114
+
115
+ - [#5816](https://github.com/mastra-ai/mastra/pull/5816) [`ab48c97`](https://github.com/mastra-ai/mastra/commit/ab48c979098ea571faf998a55d3a00e7acd7a715) Thanks [@dane-ai-mastra](https://github.com/apps/dane-ai-mastra)! - dependencies updates:
116
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
117
+ - Updated dependencies [[`ab48c97`](https://github.com/mastra-ai/mastra/commit/ab48c979098ea571faf998a55d3a00e7acd7a715), [`ff89505`](https://github.com/mastra-ai/mastra/commit/ff895057c8c7e91a5535faef46c5e5391085ddfa), [`183dc95`](https://github.com/mastra-ai/mastra/commit/183dc95596f391b977bd1a2c050b8498dac74891), [`a1111e2`](https://github.com/mastra-ai/mastra/commit/a1111e24e705488adfe5e0a6f20c53bddf26cb22), [`61debef`](https://github.com/mastra-ai/mastra/commit/61debefd80ad3a7ed5737e19df6a23d40091689a), [`9beaeff`](https://github.com/mastra-ai/mastra/commit/9beaeffa4a97b1d5fd01a7f8af8708b16067f67c), [`9eee594`](https://github.com/mastra-ai/mastra/commit/9eee594e35e0ca2a650fcc33fa82009a142b9ed0), [`979912c`](https://github.com/mastra-ai/mastra/commit/979912cfd180aad53287cda08af771df26454e2c), [`7dcf4c0`](https://github.com/mastra-ai/mastra/commit/7dcf4c04f44d9345b1f8bc5d41eae3f11ac61611), [`ad78bfc`](https://github.com/mastra-ai/mastra/commit/ad78bfc4ea6a1fff140432bf4f638e01af7af668), [`0ce418a`](https://github.com/mastra-ai/mastra/commit/0ce418a1ccaa5e125d4483a9651b635046152569), [`8387952`](https://github.com/mastra-ai/mastra/commit/838795227b4edf758c84a2adf6f7fba206c27719), [`5eca5d2`](https://github.com/mastra-ai/mastra/commit/5eca5d2655788863ea0442a46c9ef5d3c6dbe0a8)]:
118
+ - @mastra/core@0.15.3-alpha.4
119
+
120
+ ## 0.1.1
121
+
122
+ ### Patch Changes
123
+
124
+ - [`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdpes for @mastra/core
125
+
126
+ - Updated dependencies []:
127
+ - @mastra/core@0.15.2
128
+
129
+ ## 0.11.3
130
+
131
+ ### Patch Changes
132
+
133
+ - 515488a: dependencies updates:
134
+ - Updated dependency [`inngest@^3.39.2` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.2) (from `^3.39.1`, in `dependencies`)
135
+ - defb5ae: dependencies updates:
136
+ - Updated dependency [`inngest@^3.40.0` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.0) (from `^3.39.2`, in `dependencies`)
137
+ - b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
138
+ - c1cceea: Bump peerdeps of @matra/core
139
+ - Updated dependencies [2873c7f]
140
+ - Updated dependencies [1c1c6a1]
141
+ - Updated dependencies [f8ce2cc]
142
+ - Updated dependencies [8c846b6]
143
+ - Updated dependencies [c7bbf1e]
144
+ - Updated dependencies [8722d53]
145
+ - Updated dependencies [565cc0c]
146
+ - Updated dependencies [b790fd1]
147
+ - Updated dependencies [132027f]
148
+ - Updated dependencies [0c85311]
149
+ - Updated dependencies [d7ed04d]
150
+ - Updated dependencies [cb16baf]
151
+ - Updated dependencies [f36e4f1]
152
+ - Updated dependencies [7f6e403]
153
+ - @mastra/core@0.10.11
154
+
155
+ ## 0.11.3-alpha.3
156
+
157
+ ### Patch Changes
158
+
159
+ - c1cceea: Bump peerdeps of @matra/core
160
+ - @mastra/core@0.10.11-alpha.4
161
+
162
+ ## 0.11.3-alpha.2
163
+
164
+ ### Patch Changes
165
+
166
+ - defb5ae: dependencies updates:
167
+ - Updated dependency [`inngest@^3.40.0` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.0) (from `^3.39.2`, in `dependencies`)
168
+ - Updated dependencies [c7bbf1e]
169
+ - Updated dependencies [8722d53]
170
+ - Updated dependencies [132027f]
171
+ - Updated dependencies [0c85311]
172
+ - Updated dependencies [cb16baf]
173
+ - @mastra/core@0.10.11-alpha.3
174
+
175
+ ## 0.11.3-alpha.1
176
+
177
+ ### Patch Changes
178
+
179
+ - 515488a: dependencies updates:
180
+ - Updated dependency [`inngest@^3.39.2` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.2) (from `^3.39.1`, in `dependencies`)
181
+ - Updated dependencies [7f6e403]
182
+ - @mastra/core@0.10.11-alpha.1
183
+
184
+ ## 0.11.3-alpha.0
185
+
186
+ ### Patch Changes
187
+
188
+ - b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
189
+ - Updated dependencies [f8ce2cc]
190
+ - Updated dependencies [8c846b6]
191
+ - Updated dependencies [b790fd1]
192
+ - Updated dependencies [d7ed04d]
193
+ - Updated dependencies [f36e4f1]
194
+ - @mastra/core@0.10.11-alpha.0
195
+
196
+ ## 0.11.2
197
+
198
+ ### Patch Changes
199
+
200
+ - 48d9738: Fix inngest sleep stream events
201
+ - Updated dependencies [4d3fbdf]
202
+ - @mastra/core@0.10.10
203
+
204
+ ## 0.11.2-alpha.0
205
+
206
+ ### Patch Changes
207
+
208
+ - 48d9738: Fix inngest sleep stream events
209
+ - Updated dependencies [4d3fbdf]
210
+ - @mastra/core@0.10.10-alpha.0
211
+
212
+ ## 0.11.1
213
+
214
+ ### Patch Changes
215
+
216
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
217
+ - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
218
+ - 1760a1c: Use workflow stream in playground instead of watch
219
+ - 038e5ae: Add cancel workflow run
220
+ - 81a1b3b: Update peerdeps
221
+ - Updated dependencies [9dda1ac]
222
+ - Updated dependencies [c984582]
223
+ - Updated dependencies [7e801dd]
224
+ - Updated dependencies [a606c75]
225
+ - Updated dependencies [7aa70a4]
226
+ - Updated dependencies [764f86a]
227
+ - Updated dependencies [1760a1c]
228
+ - Updated dependencies [038e5ae]
229
+ - Updated dependencies [7dda16a]
230
+ - Updated dependencies [5ebfcdd]
231
+ - Updated dependencies [b2d0c91]
232
+ - Updated dependencies [4e809ad]
233
+ - Updated dependencies [57929df]
234
+ - Updated dependencies [b7852ed]
235
+ - Updated dependencies [6320a61]
236
+ - @mastra/core@0.10.9
237
+
238
+ ## 0.11.1-alpha.0
239
+
240
+ ### Patch Changes
241
+
242
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
243
+ - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
244
+ - 1760a1c: Use workflow stream in playground instead of watch
245
+ - 038e5ae: Add cancel workflow run
246
+ - 81a1b3b: Update peerdeps
247
+ - Updated dependencies [9dda1ac]
248
+ - Updated dependencies [c984582]
249
+ - Updated dependencies [7e801dd]
250
+ - Updated dependencies [a606c75]
251
+ - Updated dependencies [7aa70a4]
252
+ - Updated dependencies [764f86a]
253
+ - Updated dependencies [1760a1c]
254
+ - Updated dependencies [038e5ae]
255
+ - Updated dependencies [7dda16a]
256
+ - Updated dependencies [5ebfcdd]
257
+ - Updated dependencies [b2d0c91]
258
+ - Updated dependencies [4e809ad]
259
+ - Updated dependencies [57929df]
260
+ - Updated dependencies [b7852ed]
261
+ - Updated dependencies [6320a61]
262
+ - @mastra/core@0.10.9-alpha.0
263
+
264
+ ## 0.11.0
265
+
266
+ ### Minor Changes
267
+
268
+ - 8a3bfd2: Update peerdeps to latest core
269
+
270
+ ### Patch Changes
271
+
272
+ - 8e1b6e9: dependencies updates:
273
+ - Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
274
+ - 9d52b17: Fix inngest workflows streaming and add step metadata
275
+ - 4fb0cc2: Type safe variable mapping
276
+ - 502fe05: createRun() -> createRunAsync()
277
+ - 4efcfa0: Added bail() method and more ergonomic suspend function return value
278
+ - Updated dependencies [15e9d26]
279
+ - Updated dependencies [d1baedb]
280
+ - Updated dependencies [d8f2d19]
281
+ - Updated dependencies [4d21bf2]
282
+ - Updated dependencies [07d6d88]
283
+ - Updated dependencies [9d52b17]
284
+ - Updated dependencies [2097952]
285
+ - Updated dependencies [792c4c0]
286
+ - Updated dependencies [5d74aab]
287
+ - Updated dependencies [a8b194f]
288
+ - Updated dependencies [4fb0cc2]
289
+ - Updated dependencies [d2a7a31]
290
+ - Updated dependencies [502fe05]
291
+ - Updated dependencies [144eb0b]
292
+ - Updated dependencies [8ba1b51]
293
+ - Updated dependencies [4efcfa0]
294
+ - Updated dependencies [0e17048]
295
+ - @mastra/core@0.10.7
296
+
297
+ ## 0.11.0-alpha.3
298
+
299
+ ### Minor Changes
300
+
301
+ - 8a3bfd2: Update peerdeps to latest core
302
+
303
+ ### Patch Changes
304
+
305
+ - 502fe05: createRun() -> createRunAsync()
306
+ - 4efcfa0: Added bail() method and more ergonomic suspend function return value
307
+ - Updated dependencies [792c4c0]
308
+ - Updated dependencies [502fe05]
309
+ - Updated dependencies [4efcfa0]
310
+ - @mastra/core@0.10.7-alpha.3
311
+
312
+ ## 0.10.6-alpha.2
313
+
314
+ ### Patch Changes
315
+
316
+ - 8e1b6e9: dependencies updates:
317
+ - Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
318
+ - Updated dependencies [15e9d26]
319
+ - Updated dependencies [07d6d88]
320
+ - Updated dependencies [5d74aab]
321
+ - Updated dependencies [144eb0b]
322
+ - @mastra/core@0.10.7-alpha.2
323
+
324
+ ## 0.10.6-alpha.1
325
+
326
+ ### Patch Changes
327
+
328
+ - 4fb0cc2: Type safe variable mapping
329
+ - Updated dependencies [d1baedb]
330
+ - Updated dependencies [4d21bf2]
331
+ - Updated dependencies [2097952]
332
+ - Updated dependencies [4fb0cc2]
333
+ - Updated dependencies [d2a7a31]
334
+ - Updated dependencies [0e17048]
335
+ - @mastra/core@0.10.7-alpha.1
336
+
337
+ ## 0.10.6-alpha.0
338
+
339
+ ### Patch Changes
340
+
341
+ - 9d52b17: Fix inngest workflows streaming and add step metadata
342
+ - Updated dependencies [d8f2d19]
343
+ - Updated dependencies [9d52b17]
344
+ - Updated dependencies [8ba1b51]
345
+ - @mastra/core@0.10.7-alpha.0
346
+
347
+ ## 0.10.5
348
+
349
+ ### Patch Changes
350
+
351
+ - 63f6b7d: dependencies updates:
352
+ - Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
353
+ - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
354
+ - ee9af57: Add api for polling run execution result and get run by id
355
+ - Updated dependencies [63f6b7d]
356
+ - Updated dependencies [12a95fc]
357
+ - Updated dependencies [4b0f8a6]
358
+ - Updated dependencies [51264a5]
359
+ - Updated dependencies [8e6f677]
360
+ - Updated dependencies [d70c420]
361
+ - Updated dependencies [ee9af57]
362
+ - Updated dependencies [36f1c36]
363
+ - Updated dependencies [2a16996]
364
+ - Updated dependencies [10d352e]
365
+ - Updated dependencies [9589624]
366
+ - Updated dependencies [53d3c37]
367
+ - Updated dependencies [751c894]
368
+ - Updated dependencies [577ce3a]
369
+ - Updated dependencies [9260b3a]
370
+ - @mastra/core@0.10.6
371
+
372
+ ## 0.10.5-alpha.1
373
+
374
+ ### Patch Changes
375
+
376
+ - ee9af57: Add api for polling run execution result and get run by id
377
+ - Updated dependencies [ee9af57]
378
+ - Updated dependencies [751c894]
379
+ - Updated dependencies [577ce3a]
380
+ - Updated dependencies [9260b3a]
381
+ - @mastra/core@0.10.6-alpha.1
382
+
383
+ ## 0.10.5-alpha.0
384
+
385
+ ### Patch Changes
386
+
387
+ - 63f6b7d: dependencies updates:
388
+ - Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
389
+ - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
390
+ - Updated dependencies [63f6b7d]
391
+ - Updated dependencies [36f1c36]
392
+ - Updated dependencies [10d352e]
393
+ - Updated dependencies [53d3c37]
394
+ - @mastra/core@0.10.6-alpha.0
395
+
396
+ ## 0.10.4
397
+
398
+ ### Patch Changes
399
+
400
+ - 13c97f9: Save run status, result and error in storage snapshot
401
+ - Updated dependencies [13c97f9]
402
+ - @mastra/core@0.10.5
403
+
404
+ ## 0.10.3
405
+
406
+ ### Patch Changes
407
+
408
+ - 1ccccff: dependencies updates:
409
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
410
+ - 1ccccff: dependencies updates:
411
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
412
+ - Updated dependencies [d1ed912]
413
+ - Updated dependencies [f6fd25f]
414
+ - Updated dependencies [dffb67b]
415
+ - Updated dependencies [f1f1f1b]
416
+ - Updated dependencies [925ab94]
417
+ - Updated dependencies [f9816ae]
418
+ - Updated dependencies [82090c1]
419
+ - Updated dependencies [1b443fd]
420
+ - Updated dependencies [ce97900]
421
+ - Updated dependencies [f1309d3]
422
+ - Updated dependencies [14a2566]
423
+ - Updated dependencies [f7f8293]
424
+ - Updated dependencies [48eddb9]
425
+ - @mastra/core@0.10.4
426
+
427
+ ## 0.10.3-alpha.0
428
+
429
+ ### Patch Changes
430
+
431
+ - 1ccccff: dependencies updates:
432
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
433
+ - 1ccccff: dependencies updates:
434
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
435
+ - Updated dependencies [f6fd25f]
436
+ - Updated dependencies [dffb67b]
437
+ - Updated dependencies [f1309d3]
438
+ - Updated dependencies [f7f8293]
439
+ - @mastra/core@0.10.4-alpha.1
440
+
441
+ ## 0.10.2
442
+
443
+ ### Patch Changes
444
+
445
+ - 195c428: Add runId to step execute fn
446
+ - 12b7002: Add serializedStepGraph to workflow run snapshot in storage
447
+ - f0d559f: Fix peerdeps for alpha channel
448
+ - 1ee6894: inngest production url fix
449
+ - Updated dependencies [ee77e78]
450
+ - Updated dependencies [592a2db]
451
+ - Updated dependencies [e5dc18d]
452
+ - Updated dependencies [ab5adbe]
453
+ - Updated dependencies [1e8bb40]
454
+ - Updated dependencies [1b5fc55]
455
+ - Updated dependencies [195c428]
456
+ - Updated dependencies [f73e11b]
457
+ - Updated dependencies [37643b8]
458
+ - Updated dependencies [99fd6cf]
459
+ - Updated dependencies [c5bf1ce]
460
+ - Updated dependencies [add596e]
461
+ - Updated dependencies [8dc94d8]
462
+ - Updated dependencies [ecebbeb]
463
+ - Updated dependencies [79d5145]
464
+ - Updated dependencies [12b7002]
465
+ - Updated dependencies [2901125]
466
+ - @mastra/core@0.10.2
467
+
468
+ ## 0.10.2-alpha.3
469
+
470
+ ### Patch Changes
471
+
472
+ - 1ee6894: inngest production url fix
473
+ - Updated dependencies [1b5fc55]
474
+ - Updated dependencies [add596e]
475
+ - Updated dependencies [ecebbeb]
476
+ - @mastra/core@0.10.2-alpha.5
477
+
478
+ ## 0.10.2-alpha.2
479
+
480
+ ### Patch Changes
481
+
482
+ - 12b7002: Add serializedStepGraph to workflow run snapshot in storage
483
+ - Updated dependencies [c5bf1ce]
484
+ - Updated dependencies [12b7002]
485
+ - @mastra/core@0.10.2-alpha.4
486
+
487
+ ## 0.10.2-alpha.1
488
+
489
+ ### Patch Changes
490
+
491
+ - 195c428: Add runId to step execute fn
492
+ - Updated dependencies [ab5adbe]
493
+ - Updated dependencies [195c428]
494
+ - Updated dependencies [f73e11b]
495
+ - @mastra/core@0.10.2-alpha.3
496
+
497
+ ## 0.10.2-alpha.0
498
+
499
+ ### Patch Changes
500
+
501
+ - f0d559f: Fix peerdeps for alpha channel
502
+ - Updated dependencies [1e8bb40]
503
+ - @mastra/core@0.10.2-alpha.2
504
+
505
+ ## 0.10.1
506
+
507
+ ### Patch Changes
508
+
509
+ - 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
510
+ Return error stack for failed workflow runs
511
+ - 5343f93: Move emitter to symbol to make private
512
+ - Updated dependencies [d70b807]
513
+ - Updated dependencies [6d16390]
514
+ - Updated dependencies [1e4a421]
515
+ - Updated dependencies [200d0da]
516
+ - Updated dependencies [bf5f17b]
517
+ - Updated dependencies [5343f93]
518
+ - Updated dependencies [38aee50]
519
+ - Updated dependencies [5c41100]
520
+ - Updated dependencies [d6a759b]
521
+ - Updated dependencies [6015bdf]
522
+ - @mastra/core@0.10.1
523
+
524
+ ## 0.10.1-alpha.0
525
+
526
+ ### Patch Changes
527
+
528
+ - 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
529
+ Return error stack for failed workflow runs
530
+ - 5343f93: Move emitter to symbol to make private
531
+ - Updated dependencies [200d0da]
532
+ - Updated dependencies [bf5f17b]
533
+ - Updated dependencies [5343f93]
534
+ - Updated dependencies [38aee50]
535
+ - Updated dependencies [5c41100]
536
+ - Updated dependencies [d6a759b]
537
+ - @mastra/core@0.10.1-alpha.1
538
+
539
+ ## 0.10.0
540
+
541
+ ### Minor Changes
542
+
543
+ - 83da932: Move @mastra/core to peerdeps
544
+
545
+ ### Patch Changes
546
+
547
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
548
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
549
+ - Updated dependencies [b3a3d63]
550
+ - Updated dependencies [344f453]
551
+ - Updated dependencies [0a3ae6d]
552
+ - Updated dependencies [95911be]
553
+ - Updated dependencies [f53a6ac]
554
+ - Updated dependencies [5eb5a99]
555
+ - Updated dependencies [7e632c5]
556
+ - Updated dependencies [1e9fbfa]
557
+ - Updated dependencies [eabdcd9]
558
+ - Updated dependencies [90be034]
559
+ - Updated dependencies [99f050a]
560
+ - Updated dependencies [d0ee3c6]
561
+ - Updated dependencies [b2ae5aa]
562
+ - Updated dependencies [23f258c]
563
+ - Updated dependencies [a7292b0]
564
+ - Updated dependencies [0dcb9f0]
565
+ - Updated dependencies [2672a05]
566
+ - @mastra/core@0.10.0
567
+
568
+ ## 0.1.0-alpha.1
569
+
570
+ ### Minor Changes
571
+
572
+ - 83da932: Move @mastra/core to peerdeps
573
+
574
+ ### Patch Changes
575
+
576
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
577
+ - Updated dependencies [b3a3d63]
578
+ - Updated dependencies [344f453]
579
+ - Updated dependencies [0a3ae6d]
580
+ - Updated dependencies [95911be]
581
+ - Updated dependencies [5eb5a99]
582
+ - Updated dependencies [7e632c5]
583
+ - Updated dependencies [1e9fbfa]
584
+ - Updated dependencies [b2ae5aa]
585
+ - Updated dependencies [a7292b0]
586
+ - Updated dependencies [0dcb9f0]
587
+ - @mastra/core@0.10.0-alpha.1
588
+
589
+ ## 0.0.4-alpha.0
590
+
591
+ ### Patch Changes
592
+
593
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
594
+ - Updated dependencies [f53a6ac]
595
+ - Updated dependencies [eabdcd9]
596
+ - Updated dependencies [90be034]
597
+ - Updated dependencies [99f050a]
598
+ - Updated dependencies [d0ee3c6]
599
+ - Updated dependencies [23f258c]
600
+ - Updated dependencies [2672a05]
601
+ - @mastra/core@0.9.5-alpha.0
602
+
603
+ ## 0.0.3
604
+
605
+ ### Patch Changes
606
+
607
+ - Updated dependencies [396be50]
608
+ - Updated dependencies [ab80e7e]
609
+ - Updated dependencies [c3bd795]
610
+ - Updated dependencies [da082f8]
611
+ - Updated dependencies [a5810ce]
612
+ - Updated dependencies [3e9c131]
613
+ - Updated dependencies [3171b5b]
614
+ - Updated dependencies [973e5ac]
615
+ - Updated dependencies [daf942f]
616
+ - Updated dependencies [0b8b868]
617
+ - Updated dependencies [9e1eff5]
618
+ - Updated dependencies [6fa1ad1]
619
+ - Updated dependencies [c28d7a0]
620
+ - Updated dependencies [edf1e88]
621
+ - @mastra/core@0.9.4
622
+
623
+ ## 0.0.3-alpha.4
624
+
625
+ ### Patch Changes
626
+
627
+ - Updated dependencies [3e9c131]
628
+ - @mastra/core@0.9.4-alpha.4
629
+
630
+ ## 0.0.3-alpha.3
631
+
632
+ ### Patch Changes
633
+
634
+ - Updated dependencies [396be50]
635
+ - Updated dependencies [c3bd795]
636
+ - Updated dependencies [da082f8]
637
+ - Updated dependencies [a5810ce]
638
+ - @mastra/core@0.9.4-alpha.3
639
+
640
+ ## 0.0.3-alpha.2
641
+
642
+ ### Patch Changes
643
+
644
+ - Updated dependencies [3171b5b]
645
+ - Updated dependencies [973e5ac]
646
+ - Updated dependencies [9e1eff5]
647
+ - @mastra/core@0.9.4-alpha.2
648
+
649
+ ## 0.0.3-alpha.1
650
+
651
+ ### Patch Changes
652
+
653
+ - Updated dependencies [ab80e7e]
654
+ - Updated dependencies [6fa1ad1]
655
+ - Updated dependencies [c28d7a0]
656
+ - Updated dependencies [edf1e88]
657
+ - @mastra/core@0.9.4-alpha.1
658
+
659
+ ## 0.0.3-alpha.0
660
+
661
+ ### Patch Changes
662
+
663
+ - Updated dependencies [daf942f]
664
+ - Updated dependencies [0b8b868]
665
+ - @mastra/core@0.9.4-alpha.0
666
+
667
+ ## 0.0.2
668
+
669
+ ### Patch Changes
670
+
671
+ - e450778: vnext: Inngest playground fixes
672
+ - Updated dependencies [e450778]
673
+ - Updated dependencies [8902157]
674
+ - Updated dependencies [ca0dc88]
675
+ - Updated dependencies [526c570]
676
+ - Updated dependencies [d7a6a33]
677
+ - Updated dependencies [9cd1a46]
678
+ - Updated dependencies [b5d2de0]
679
+ - Updated dependencies [644f8ad]
680
+ - Updated dependencies [70dbf51]
681
+ - @mastra/core@0.9.3
682
+
683
+ ## 0.0.2-alpha.0
684
+
685
+ ### Patch Changes
686
+
687
+ - e450778: vnext: Inngest playground fixes
688
+ - Updated dependencies [e450778]
689
+ - Updated dependencies [8902157]
690
+ - Updated dependencies [ca0dc88]
691
+ - Updated dependencies [9cd1a46]
692
+ - Updated dependencies [70dbf51]
693
+ - @mastra/core@0.9.3-alpha.1
package/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ # Apache License 2.0
2
+
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/dist/index.cjs ADDED
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ var pubsub = require('@google-cloud/pubsub');
4
+ var events = require('@mastra/core/events');
5
+
6
+ // src/index.ts
7
+ var GoogleCloudPubSub = class extends events.PubSub {
8
+ instanceId;
9
+ pubsub;
10
+ ackBuffer = {};
11
+ activeSubscriptions = {};
12
+ activeCbs = {};
13
+ constructor(config) {
14
+ super();
15
+ this.pubsub = new pubsub.PubSub(config);
16
+ this.instanceId = crypto.randomUUID();
17
+ }
18
+ getSubscriptionName(topic) {
19
+ return `${topic}-${this.instanceId}`;
20
+ }
21
+ async ackMessage(topic, message) {
22
+ try {
23
+ const ackResponse = Promise.race([message.ackWithResponse(), new Promise((resolve) => setTimeout(resolve, 5e3))]);
24
+ this.ackBuffer[topic + "-" + message.id] = ackResponse.catch(() => {
25
+ });
26
+ await ackResponse;
27
+ delete this.ackBuffer[topic + "-" + message.id];
28
+ } catch (e) {
29
+ console.error("Error acking message", e);
30
+ }
31
+ }
32
+ async init(topicName) {
33
+ try {
34
+ await this.pubsub.createTopic(topicName);
35
+ } catch (error) {
36
+ }
37
+ try {
38
+ const [sub] = await this.pubsub.topic(topicName).createSubscription(this.getSubscriptionName(topicName), {
39
+ enableMessageOrdering: true,
40
+ enableExactlyOnceDelivery: topicName === "workflows" ? true : false
41
+ });
42
+ this.activeSubscriptions[topicName] = sub;
43
+ return sub;
44
+ } catch (error) {
45
+ }
46
+ return void 0;
47
+ }
48
+ async destroy(topicName) {
49
+ const subName = this.getSubscriptionName(topicName);
50
+ delete this.activeSubscriptions[topicName];
51
+ this.pubsub.subscription(subName).removeAllListeners();
52
+ await this.pubsub.subscription(subName).close();
53
+ await this.pubsub.subscription(subName).delete();
54
+ await this.pubsub.topic(topicName).delete();
55
+ }
56
+ async publish(topicName, event) {
57
+ if (topicName.startsWith("workflow.events.")) {
58
+ const parts = topicName.split(".");
59
+ if (parts[parts.length - 2] === "v2") {
60
+ topicName = "workflow.events.v2";
61
+ } else {
62
+ topicName = "workflow.events.v1";
63
+ }
64
+ }
65
+ let topic = this.pubsub.topic(topicName);
66
+ try {
67
+ await topic.publishMessage({
68
+ data: Buffer.from(JSON.stringify(event)),
69
+ orderingKey: "workflows"
70
+ });
71
+ } catch (e) {
72
+ if (e.code === 5) {
73
+ await this.pubsub.createTopic(topicName);
74
+ await this.publish(topicName, event);
75
+ } else {
76
+ throw e;
77
+ }
78
+ }
79
+ }
80
+ async subscribe(topic, cb) {
81
+ if (topic.startsWith("workflow.events.")) {
82
+ const parts = topic.split(".");
83
+ if (parts[parts.length - 2] === "v2") {
84
+ topic = "workflow.events.v2";
85
+ } else {
86
+ topic = "workflow.events.v1";
87
+ }
88
+ }
89
+ const subscription = this.activeSubscriptions[topic] ?? await this.init(topic);
90
+ if (!subscription) {
91
+ throw new Error(`Failed to subscribe to topic: ${topic}`);
92
+ }
93
+ this.activeSubscriptions[topic] = subscription;
94
+ const activeCbs = this.activeCbs[topic] ?? /* @__PURE__ */ new Set();
95
+ activeCbs.add(cb);
96
+ this.activeCbs[topic] = activeCbs;
97
+ if (subscription.isOpen) {
98
+ return;
99
+ }
100
+ subscription.on("message", async (message) => {
101
+ const event = JSON.parse(message.data.toString());
102
+ event.id = message.id;
103
+ event.createdAt = message.publishTime;
104
+ try {
105
+ const activeCbs2 = this.activeCbs[topic] ?? [];
106
+ for (const cb2 of activeCbs2) {
107
+ cb2(event, async () => {
108
+ try {
109
+ await this.ackMessage(topic, message);
110
+ } catch (e) {
111
+ console.error("Error acking message", e);
112
+ }
113
+ });
114
+ }
115
+ } catch (error) {
116
+ console.error("Error processing event", error);
117
+ }
118
+ });
119
+ subscription.on("error", async (error) => {
120
+ console.error("subscription error", error);
121
+ });
122
+ }
123
+ async unsubscribe(topic, cb) {
124
+ const subscription = this.activeSubscriptions[topic] ?? this.pubsub.subscription(this.getSubscriptionName(topic));
125
+ const activeCbs = this.activeCbs[topic] ?? /* @__PURE__ */ new Set();
126
+ activeCbs.delete(cb);
127
+ this.activeCbs[topic] = activeCbs;
128
+ if (activeCbs.size === 0) {
129
+ subscription.removeListener("message", cb);
130
+ await subscription.close();
131
+ }
132
+ }
133
+ async flush() {
134
+ await Promise.all(Object.values(this.ackBuffer));
135
+ }
136
+ };
137
+
138
+ exports.GoogleCloudPubSub = GoogleCloudPubSub;
139
+ //# sourceMappingURL=index.cjs.map
140
+ //# sourceMappingURL=index.cjs.map
@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S;AAUtC,MAAA,OAAA,CAAQ,KAAA,CAAM,sBAAsB,KAAK,CAAA;AAAA,IAC3C,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAM,WAAA,CAAY,KAAA,EAAe,EAAA,EAAsE;AACrG,IAAA,MAAM,YAAA,GAAe,IAAA,CAAK,mBAAA,CAAoB,KAAK,CAAA,IAAK,IAAA,CAAK,MAAA,CAAO,YAAA,CAAa,IAAA,CAAK,mBAAA,CAAoB,KAAK,CAAC,CAAA;AAChH,IAAA,MAAM,YAAY,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA,wBAAS,GAAA,EAAI;AACnD,IAAA,SAAA,CAAU,OAAO,EAAE,CAAA;AACnB,IAAA,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA,GAAI,SAAA;AAExB,IAAA,IAAI,SAAA,CAAU,SAAS,CAAA,EAAG;AACxB,MAAA,YAAA,CAAa,cAAA,CAAe,WAAW,EAAE,CAAA;AACzC,MAAA,MAAM,aAAa,KAAA,EAAM;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,KAAA,GAAuB;AAC3B,IAAA,MAAM,QAAQ,GAAA,CAAI,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,EACjD;AACF","file":"index.cjs","sourcesContent":["import { PubSub as PubSubClient } from '@google-cloud/pubsub';\nimport type { ClientConfig, Message, Subscription } from '@google-cloud/pubsub';\nimport { PubSub } from '@mastra/core/events';\nimport type { Event } from '@mastra/core/events';\n\nexport class GoogleCloudPubSub extends PubSub {\n private instanceId: string;\n private pubsub: PubSubClient;\n private ackBuffer: Record<string, Promise<any>> = {};\n private activeSubscriptions: Record<string, Subscription> = {};\n private activeCbs: Record<string, Set<(event: Event, ack: () => Promise<void>) => void>> = {};\n\n constructor(config: ClientConfig) {\n super();\n this.pubsub = new PubSubClient(config);\n this.instanceId = crypto.randomUUID();\n }\n\n getSubscriptionName(topic: string) {\n return `${topic}-${this.instanceId}`;\n }\n\n async ackMessage(topic: string, message: Message) {\n try {\n const ackResponse = Promise.race([message.ackWithResponse(), new Promise(resolve => setTimeout(resolve, 5000))]);\n this.ackBuffer[topic + '-' + message.id] = ackResponse.catch(() => {});\n await ackResponse;\n delete this.ackBuffer[topic + '-' + message.id];\n } catch (e) {\n console.error('Error acking message', e);\n }\n }\n\n async init(topicName: string) {\n try {\n await this.pubsub.createTopic(topicName);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // no-op\n }\n try {\n const [sub] = await this.pubsub.topic(topicName).createSubscription(this.getSubscriptionName(topicName), {\n enableMessageOrdering: true,\n enableExactlyOnceDelivery: topicName === 'workflows' ? true : false,\n });\n this.activeSubscriptions[topicName] = sub;\n return sub;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // no-op\n }\n\n return undefined;\n }\n\n async destroy(topicName: string) {\n const subName = this.getSubscriptionName(topicName);\n delete this.activeSubscriptions[topicName];\n this.pubsub.subscription(subName).removeAllListeners();\n await this.pubsub.subscription(subName).close();\n await this.pubsub.subscription(subName).delete();\n await this.pubsub.topic(topicName).delete();\n }\n\n async publish(topicName: string, event: Omit<Event, 'id' | 'createdAt'>): Promise<void> {\n if (topicName.startsWith('workflow.events.')) {\n const parts = topicName.split('.');\n if (parts[parts.length - 2] === 'v2') {\n topicName = 'workflow.events.v2';\n } else {\n topicName = 'workflow.events.v1';\n }\n }\n\n let topic = this.pubsub.topic(topicName);\n\n try {\n await topic.publishMessage({\n data: Buffer.from(JSON.stringify(event)),\n orderingKey: 'workflows',\n });\n } catch (e: any) {\n if (e.code === 5) {\n await this.pubsub.createTopic(topicName);\n await this.publish(topicName, event);\n } else {\n throw e;\n }\n }\n }\n\n async subscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void> {\n if (topic.startsWith('workflow.events.')) {\n const parts = topic.split('.');\n if (parts[parts.length - 2] === 'v2') {\n topic = 'workflow.events.v2';\n } else {\n topic = 'workflow.events.v1';\n }\n }\n\n // Update tracked callbacks\n const subscription = this.activeSubscriptions[topic] ?? (await this.init(topic));\n if (!subscription) {\n throw new Error(`Failed to subscribe to topic: ${topic}`);\n }\n\n this.activeSubscriptions[topic] = subscription;\n\n const activeCbs = this.activeCbs[topic] ?? new Set();\n activeCbs.add(cb);\n this.activeCbs[topic] = activeCbs;\n\n if (subscription.isOpen) {\n return;\n }\n\n subscription.on('message', async message => {\n const event = JSON.parse(message.data.toString()) as Event;\n event.id = message.id;\n event.createdAt = message.publishTime;\n\n try {\n const activeCbs = this.activeCbs[topic] ?? [];\n for (const cb of activeCbs) {\n cb(event, async () => {\n try {\n await this.ackMessage(topic, message);\n } catch (e) {\n console.error('Error acking message', e);\n }\n });\n }\n } catch (error) {\n console.error('Error processing event', error);\n }\n });\n\n subscription.on('error', async error => {\n // if (error.code === 5) {\n // await this.init(topic);\n // } else {\n // // TODO: determine if other errors require re-subscription\n // // console.error('subscription error, retrying in 5 seconds', error);\n // // await new Promise(resolve => setTimeout(resolve, 5000));\n // // await this.subscribe(topic, cb);\n // console.error('subscription error', error);\n // }\n console.error('subscription error', error);\n });\n }\n\n async unsubscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void> {\n const subscription = this.activeSubscriptions[topic] ?? this.pubsub.subscription(this.getSubscriptionName(topic));\n const activeCbs = this.activeCbs[topic] ?? new Set();\n activeCbs.delete(cb);\n this.activeCbs[topic] = activeCbs;\n\n if (activeCbs.size === 0) {\n subscription.removeListener('message', cb);\n await subscription.close();\n }\n }\n\n async flush(): Promise<void> {\n await Promise.all(Object.values(this.ackBuffer));\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { ClientConfig, Message, Subscription } from '@google-cloud/pubsub';
2
+ import { PubSub } from '@mastra/core/events';
3
+ import type { Event } from '@mastra/core/events';
4
+ export declare class GoogleCloudPubSub extends PubSub {
5
+ private instanceId;
6
+ private pubsub;
7
+ private ackBuffer;
8
+ private activeSubscriptions;
9
+ private activeCbs;
10
+ constructor(config: ClientConfig);
11
+ getSubscriptionName(topic: string): string;
12
+ ackMessage(topic: string, message: Message): Promise<void>;
13
+ init(topicName: string): Promise<Subscription | undefined>;
14
+ destroy(topicName: string): Promise<void>;
15
+ publish(topicName: string, event: Omit<Event, 'id' | 'createdAt'>): Promise<void>;
16
+ subscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void>;
17
+ unsubscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void>;
18
+ flush(): Promise<void>;
19
+ }
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,mBAAmB,CAAoC;IAC/D,OAAO,CAAC,SAAS,CAA6E;gBAElF,MAAM,EAAE,YAAY;IAMhC,mBAAmB,CAAC,KAAK,EAAE,MAAM;IAI3B,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAW1C,IAAI,CAAC,SAAS,EAAE,MAAM;IAsBtB,OAAO,CAAC,SAAS,EAAE,MAAM;IASzB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BjF,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA6D9F,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
package/dist/index.js ADDED
@@ -0,0 +1,138 @@
1
+ import { PubSub as PubSub$1 } from '@google-cloud/pubsub';
2
+ import { PubSub } from '@mastra/core/events';
3
+
4
+ // src/index.ts
5
+ var GoogleCloudPubSub = class extends PubSub {
6
+ instanceId;
7
+ pubsub;
8
+ ackBuffer = {};
9
+ activeSubscriptions = {};
10
+ activeCbs = {};
11
+ constructor(config) {
12
+ super();
13
+ this.pubsub = new PubSub$1(config);
14
+ this.instanceId = crypto.randomUUID();
15
+ }
16
+ getSubscriptionName(topic) {
17
+ return `${topic}-${this.instanceId}`;
18
+ }
19
+ async ackMessage(topic, message) {
20
+ try {
21
+ const ackResponse = Promise.race([message.ackWithResponse(), new Promise((resolve) => setTimeout(resolve, 5e3))]);
22
+ this.ackBuffer[topic + "-" + message.id] = ackResponse.catch(() => {
23
+ });
24
+ await ackResponse;
25
+ delete this.ackBuffer[topic + "-" + message.id];
26
+ } catch (e) {
27
+ console.error("Error acking message", e);
28
+ }
29
+ }
30
+ async init(topicName) {
31
+ try {
32
+ await this.pubsub.createTopic(topicName);
33
+ } catch (error) {
34
+ }
35
+ try {
36
+ const [sub] = await this.pubsub.topic(topicName).createSubscription(this.getSubscriptionName(topicName), {
37
+ enableMessageOrdering: true,
38
+ enableExactlyOnceDelivery: topicName === "workflows" ? true : false
39
+ });
40
+ this.activeSubscriptions[topicName] = sub;
41
+ return sub;
42
+ } catch (error) {
43
+ }
44
+ return void 0;
45
+ }
46
+ async destroy(topicName) {
47
+ const subName = this.getSubscriptionName(topicName);
48
+ delete this.activeSubscriptions[topicName];
49
+ this.pubsub.subscription(subName).removeAllListeners();
50
+ await this.pubsub.subscription(subName).close();
51
+ await this.pubsub.subscription(subName).delete();
52
+ await this.pubsub.topic(topicName).delete();
53
+ }
54
+ async publish(topicName, event) {
55
+ if (topicName.startsWith("workflow.events.")) {
56
+ const parts = topicName.split(".");
57
+ if (parts[parts.length - 2] === "v2") {
58
+ topicName = "workflow.events.v2";
59
+ } else {
60
+ topicName = "workflow.events.v1";
61
+ }
62
+ }
63
+ let topic = this.pubsub.topic(topicName);
64
+ try {
65
+ await topic.publishMessage({
66
+ data: Buffer.from(JSON.stringify(event)),
67
+ orderingKey: "workflows"
68
+ });
69
+ } catch (e) {
70
+ if (e.code === 5) {
71
+ await this.pubsub.createTopic(topicName);
72
+ await this.publish(topicName, event);
73
+ } else {
74
+ throw e;
75
+ }
76
+ }
77
+ }
78
+ async subscribe(topic, cb) {
79
+ if (topic.startsWith("workflow.events.")) {
80
+ const parts = topic.split(".");
81
+ if (parts[parts.length - 2] === "v2") {
82
+ topic = "workflow.events.v2";
83
+ } else {
84
+ topic = "workflow.events.v1";
85
+ }
86
+ }
87
+ const subscription = this.activeSubscriptions[topic] ?? await this.init(topic);
88
+ if (!subscription) {
89
+ throw new Error(`Failed to subscribe to topic: ${topic}`);
90
+ }
91
+ this.activeSubscriptions[topic] = subscription;
92
+ const activeCbs = this.activeCbs[topic] ?? /* @__PURE__ */ new Set();
93
+ activeCbs.add(cb);
94
+ this.activeCbs[topic] = activeCbs;
95
+ if (subscription.isOpen) {
96
+ return;
97
+ }
98
+ subscription.on("message", async (message) => {
99
+ const event = JSON.parse(message.data.toString());
100
+ event.id = message.id;
101
+ event.createdAt = message.publishTime;
102
+ try {
103
+ const activeCbs2 = this.activeCbs[topic] ?? [];
104
+ for (const cb2 of activeCbs2) {
105
+ cb2(event, async () => {
106
+ try {
107
+ await this.ackMessage(topic, message);
108
+ } catch (e) {
109
+ console.error("Error acking message", e);
110
+ }
111
+ });
112
+ }
113
+ } catch (error) {
114
+ console.error("Error processing event", error);
115
+ }
116
+ });
117
+ subscription.on("error", async (error) => {
118
+ console.error("subscription error", error);
119
+ });
120
+ }
121
+ async unsubscribe(topic, cb) {
122
+ const subscription = this.activeSubscriptions[topic] ?? this.pubsub.subscription(this.getSubscriptionName(topic));
123
+ const activeCbs = this.activeCbs[topic] ?? /* @__PURE__ */ new Set();
124
+ activeCbs.delete(cb);
125
+ this.activeCbs[topic] = activeCbs;
126
+ if (activeCbs.size === 0) {
127
+ subscription.removeListener("message", cb);
128
+ await subscription.close();
129
+ }
130
+ }
131
+ async flush() {
132
+ await Promise.all(Object.values(this.ackBuffer));
133
+ }
134
+ };
135
+
136
+ export { GoogleCloudPubSub };
137
+ //# sourceMappingURL=index.js.map
138
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["PubSubClient","activeCbs","cb"],"mappings":";;;;AAKO,IAAM,iBAAA,GAAN,cAAgC,MAAA,CAAO;AAAA,EACpC,UAAA;AAAA,EACA,MAAA;AAAA,EACA,YAA0C,EAAC;AAAA,EAC3C,sBAAoD,EAAC;AAAA,EACrD,YAAmF,EAAC;AAAA,EAE5F,YAAY,MAAA,EAAsB;AAChC,IAAA,KAAA,EAAM;AACN,IAAA,IAAA,CAAK,MAAA,GAAS,IAAIA,QAAA,CAAa,MAAM,CAAA;AACrC,IAAA,IAAA,CAAK,UAAA,GAAa,OAAO,UAAA,EAAW;AAAA,EACtC;AAAA,EAEA,oBAAoB,KAAA,EAAe;AACjC,IAAA,OAAO,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAA,CAAK,UAAU,CAAA,CAAA;AAAA,EACpC;AAAA,EAEA,MAAM,UAAA,CAAW,KAAA,EAAe,OAAA,EAAkB;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,WAAA,GAAc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AAM,KAAA,GAAuB;AAC3B,IAAA,MAAM,QAAQ,GAAA,CAAI,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,EACjD;AACF","file":"index.js","sourcesContent":["import { PubSub as PubSubClient } from '@google-cloud/pubsub';\nimport type { ClientConfig, Message, Subscription } from '@google-cloud/pubsub';\nimport { PubSub } from '@mastra/core/events';\nimport type { Event } from '@mastra/core/events';\n\nexport class GoogleCloudPubSub extends PubSub {\n private instanceId: string;\n private pubsub: PubSubClient;\n private ackBuffer: Record<string, Promise<any>> = {};\n private activeSubscriptions: Record<string, Subscription> = {};\n private activeCbs: Record<string, Set<(event: Event, ack: () => Promise<void>) => void>> = {};\n\n constructor(config: ClientConfig) {\n super();\n this.pubsub = new PubSubClient(config);\n this.instanceId = crypto.randomUUID();\n }\n\n getSubscriptionName(topic: string) {\n return `${topic}-${this.instanceId}`;\n }\n\n async ackMessage(topic: string, message: Message) {\n try {\n const ackResponse = Promise.race([message.ackWithResponse(), new Promise(resolve => setTimeout(resolve, 5000))]);\n this.ackBuffer[topic + '-' + message.id] = ackResponse.catch(() => {});\n await ackResponse;\n delete this.ackBuffer[topic + '-' + message.id];\n } catch (e) {\n console.error('Error acking message', e);\n }\n }\n\n async init(topicName: string) {\n try {\n await this.pubsub.createTopic(topicName);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // no-op\n }\n try {\n const [sub] = await this.pubsub.topic(topicName).createSubscription(this.getSubscriptionName(topicName), {\n enableMessageOrdering: true,\n enableExactlyOnceDelivery: topicName === 'workflows' ? true : false,\n });\n this.activeSubscriptions[topicName] = sub;\n return sub;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // no-op\n }\n\n return undefined;\n }\n\n async destroy(topicName: string) {\n const subName = this.getSubscriptionName(topicName);\n delete this.activeSubscriptions[topicName];\n this.pubsub.subscription(subName).removeAllListeners();\n await this.pubsub.subscription(subName).close();\n await this.pubsub.subscription(subName).delete();\n await this.pubsub.topic(topicName).delete();\n }\n\n async publish(topicName: string, event: Omit<Event, 'id' | 'createdAt'>): Promise<void> {\n if (topicName.startsWith('workflow.events.')) {\n const parts = topicName.split('.');\n if (parts[parts.length - 2] === 'v2') {\n topicName = 'workflow.events.v2';\n } else {\n topicName = 'workflow.events.v1';\n }\n }\n\n let topic = this.pubsub.topic(topicName);\n\n try {\n await topic.publishMessage({\n data: Buffer.from(JSON.stringify(event)),\n orderingKey: 'workflows',\n });\n } catch (e: any) {\n if (e.code === 5) {\n await this.pubsub.createTopic(topicName);\n await this.publish(topicName, event);\n } else {\n throw e;\n }\n }\n }\n\n async subscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void> {\n if (topic.startsWith('workflow.events.')) {\n const parts = topic.split('.');\n if (parts[parts.length - 2] === 'v2') {\n topic = 'workflow.events.v2';\n } else {\n topic = 'workflow.events.v1';\n }\n }\n\n // Update tracked callbacks\n const subscription = this.activeSubscriptions[topic] ?? (await this.init(topic));\n if (!subscription) {\n throw new Error(`Failed to subscribe to topic: ${topic}`);\n }\n\n this.activeSubscriptions[topic] = subscription;\n\n const activeCbs = this.activeCbs[topic] ?? new Set();\n activeCbs.add(cb);\n this.activeCbs[topic] = activeCbs;\n\n if (subscription.isOpen) {\n return;\n }\n\n subscription.on('message', async message => {\n const event = JSON.parse(message.data.toString()) as Event;\n event.id = message.id;\n event.createdAt = message.publishTime;\n\n try {\n const activeCbs = this.activeCbs[topic] ?? [];\n for (const cb of activeCbs) {\n cb(event, async () => {\n try {\n await this.ackMessage(topic, message);\n } catch (e) {\n console.error('Error acking message', e);\n }\n });\n }\n } catch (error) {\n console.error('Error processing event', error);\n }\n });\n\n subscription.on('error', async error => {\n // if (error.code === 5) {\n // await this.init(topic);\n // } else {\n // // TODO: determine if other errors require re-subscription\n // // console.error('subscription error, retrying in 5 seconds', error);\n // // await new Promise(resolve => setTimeout(resolve, 5000));\n // // await this.subscribe(topic, cb);\n // console.error('subscription error', error);\n // }\n console.error('subscription error', error);\n });\n }\n\n async unsubscribe(topic: string, cb: (event: Event, ack?: () => Promise<void>) => void): Promise<void> {\n const subscription = this.activeSubscriptions[topic] ?? this.pubsub.subscription(this.getSubscriptionName(topic));\n const activeCbs = this.activeCbs[topic] ?? new Set();\n activeCbs.delete(cb);\n this.activeCbs[topic] = activeCbs;\n\n if (activeCbs.size === 0) {\n subscription.removeListener('message', cb);\n await subscription.close();\n }\n }\n\n async flush(): Promise<void> {\n await Promise.all(Object.values(this.ackBuffer));\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@mastra/google-cloud-pubsub",
3
+ "version": "0.0.0-ai-telementry-ui-20250908094819",
4
+ "description": "Mastra Google Cloud PubSub integration",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "CHANGELOG.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "dependencies": {
26
+ "@google-cloud/pubsub": "^5.1.0",
27
+ "@inngest/realtime": "^0.3.1",
28
+ "@opentelemetry/api": "^1.9.0",
29
+ "inngest": "^3.40.0",
30
+ "zod": "^3.25.76"
31
+ },
32
+ "devDependencies": {
33
+ "ai": "^4.3.16",
34
+ "@types/node": "^20.19.0",
35
+ "typescript": "^5.8.3",
36
+ "eslint": "^9.30.1",
37
+ "vitest": "^3.2.4",
38
+ "tsup": "^8.4.0",
39
+ "@internal/lint": "0.0.0-ai-telementry-ui-20250908094819",
40
+ "@mastra/deployer": "0.0.0-ai-telementry-ui-20250908094819",
41
+ "@internal/types-builder": "0.0.0-ai-telementry-ui-20250908094819",
42
+ "@mastra/core": "0.0.0-ai-telementry-ui-20250908094819",
43
+ "@mastra/libsql": "0.0.0-ai-telementry-ui-20250908094819"
44
+ },
45
+ "peerDependencies": {
46
+ "@mastra/core": "0.0.0-ai-telementry-ui-20250908094819"
47
+ },
48
+ "homepage": "https://mastra.ai",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/mastra-ai/mastra.git",
52
+ "directory": "pubsub/google-cloud-pubsub"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/mastra-ai/mastra/issues"
56
+ },
57
+ "scripts": {
58
+ "build": "tsup --silent --config tsup.config.ts",
59
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
60
+ "test": "vitest run --bail=1",
61
+ "lint": "eslint ."
62
+ }
63
+ }