@mastra/google-cloud-pubsub 0.0.0-consolidate-changesets-20250904042643

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,677 @@
1
+ # @mastra/inngest
2
+
3
+ ## 0.0.0-consolidate-changesets-20250904042643
4
+
5
+ ### Patch Changes
6
+
7
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
8
+ - a32248b: dependencies updates:
9
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
10
+ dependencies updates:
11
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
12
+ dependencies updates:
13
+ - Updated dependency [`rollup@~4.49.0` ↗︎](https://www.npmjs.com/package/rollup/v/4.49.0) (from `~4.47.1`, in `dependencies`)
14
+ dependencies updates:
15
+ - Updated dependency [`rollup@~4.50.0` ↗︎](https://www.npmjs.com/package/rollup/v/4.50.0) (from `~4.49.0`, in `dependencies`)
16
+ dependencies updates:
17
+ - Updated dependency [`redis@^5.8.2` ↗︎](https://www.npmjs.com/package/redis/v/5.8.2) (from `^5.8.0`, in `dependencies`)
18
+ dependencies updates:
19
+ - Updated dependency [`@libsql/client@^0.15.14` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.14) (from `^0.15.12`, in `dependencies`)
20
+ dependencies updates:
21
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
22
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.24.5`, in `dependencies`)
23
+ dependencies updates:
24
+ - Updated dependency [`zod@^4.1.5` ↗︎](https://www.npmjs.com/package/zod/v/4.1.5) (from `^4.0.15`, in `dependencies`)
25
+ dependencies updates:
26
+ - Updated dependency [`@assistant-ui/react@^0.10.44` ↗︎](https://www.npmjs.com/package/@assistant-ui/react/v/0.10.44) (from `^0.7.91`, in `dependencies`)
27
+ - Updated dependency [`@assistant-ui/react-markdown@^0.10.9` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-markdown/v/0.10.9) (from `^0.7.21`, in `dependencies`)
28
+ - Updated dependency [`@assistant-ui/react-syntax-highlighter@^0.10.10` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-syntax-highlighter/v/0.10.10) (from `^0.7.10`, in `dependencies`)
29
+ - Added dependency [`@assistant-ui/react-ui@^0.1.8` ↗︎](https://www.npmjs.com/package/@assistant-ui/react-ui/v/0.1.8) (to `dependencies`)
30
+ dependencies updates:
31
+ - Updated dependency [`@xyflow/react@^12.8.4` ↗︎](https://www.npmjs.com/package/@xyflow/react/v/12.8.4) (from `^12.8.2`, in `dependencies`)
32
+ dependencies updates:
33
+ - Updated dependency [`@assistant-ui/react@^0.10.45` ↗︎](https://www.npmjs.com/package/@assistant-ui/react/v/0.10.45) (from `^0.10.44`, in `dependencies`)
34
+ dependencies updates:
35
+ - Updated dependency [`@qdrant/js-client-rest@^1.15.1` ↗︎](https://www.npmjs.com/package/@qdrant/js-client-rest/v/1.15.1) (from `^1.15.0`, in `dependencies`)
36
+ dependencies updates:
37
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
38
+ - Updated dependency [`zod-to-json-schema@^3.24.6` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.6) (from `^3.23.5`, in `dependencies`)
39
+ - f0dfcac: updated core peerdep
40
+ - Updated dependencies [85ef90b]
41
+ - Updated dependencies [aedbbfa]
42
+ - Updated dependencies [ff89505]
43
+ - Updated dependencies [637f323]
44
+ - Updated dependencies [de3cbc6]
45
+ - Updated dependencies [c19bcf7]
46
+ - Updated dependencies [4474d04]
47
+ - Updated dependencies [183dc95]
48
+ - Updated dependencies [f5e7282]
49
+ - Updated dependencies [a32248b]
50
+ - Updated dependencies [a1111e2]
51
+ - Updated dependencies [b42a961]
52
+ - Updated dependencies [61debef]
53
+ - Updated dependencies [9beaeff]
54
+ - Updated dependencies [00c74e7]
55
+ - Updated dependencies [fef7375]
56
+ - Updated dependencies [e3d8fea]
57
+ - Updated dependencies [45e4d39]
58
+ - Updated dependencies [9eee594]
59
+ - Updated dependencies [822c2e8]
60
+ - Updated dependencies [979912c]
61
+ - Updated dependencies [4106a58]
62
+ - Updated dependencies [ad78bfc]
63
+ - Updated dependencies [0302f50]
64
+ - Updated dependencies [74db265]
65
+ - Updated dependencies [8387952]
66
+ - Updated dependencies [7f3b8da]
67
+ - Updated dependencies [905352b]
68
+ - Updated dependencies [599d04c]
69
+ - Updated dependencies [56041d0]
70
+ - Updated dependencies [5eca5d2]
71
+ - Updated dependencies [f2cda47]
72
+ - Updated dependencies [5de1555]
73
+ - Updated dependencies [cfd377a]
74
+ - Updated dependencies [1ed5a3e]
75
+ - @mastra/core@0.0.0-consolidate-changesets-20250904042643
76
+
77
+ ## 0.1.2-alpha.2
78
+
79
+ ### Patch Changes
80
+
81
+ - [#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
82
+
83
+ - Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
84
+ - @mastra/core@0.15.3-alpha.7
85
+
86
+ ## 0.1.2-alpha.1
87
+
88
+ ### Patch Changes
89
+
90
+ - [#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`.
91
+
92
+ - Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
93
+ - @mastra/core@0.15.3-alpha.5
94
+
95
+ ## 0.1.2-alpha.0
96
+
97
+ ### Patch Changes
98
+
99
+ - [#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:
100
+ - Updated dependency [`zod@^3.25.76` ↗︎](https://www.npmjs.com/package/zod/v/3.25.76) (from `^3.25.67`, in `dependencies`)
101
+ - 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)]:
102
+ - @mastra/core@0.15.3-alpha.4
103
+
104
+ ## 0.1.1
105
+
106
+ ### Patch Changes
107
+
108
+ - [`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdpes for @mastra/core
109
+
110
+ - Updated dependencies []:
111
+ - @mastra/core@0.15.2
112
+
113
+ ## 0.11.3
114
+
115
+ ### Patch Changes
116
+
117
+ - 515488a: dependencies updates:
118
+ - Updated dependency [`inngest@^3.39.2` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.2) (from `^3.39.1`, in `dependencies`)
119
+ - defb5ae: dependencies updates:
120
+ - Updated dependency [`inngest@^3.40.0` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.0) (from `^3.39.2`, in `dependencies`)
121
+ - b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
122
+ - c1cceea: Bump peerdeps of @matra/core
123
+ - Updated dependencies [2873c7f]
124
+ - Updated dependencies [1c1c6a1]
125
+ - Updated dependencies [f8ce2cc]
126
+ - Updated dependencies [8c846b6]
127
+ - Updated dependencies [c7bbf1e]
128
+ - Updated dependencies [8722d53]
129
+ - Updated dependencies [565cc0c]
130
+ - Updated dependencies [b790fd1]
131
+ - Updated dependencies [132027f]
132
+ - Updated dependencies [0c85311]
133
+ - Updated dependencies [d7ed04d]
134
+ - Updated dependencies [cb16baf]
135
+ - Updated dependencies [f36e4f1]
136
+ - Updated dependencies [7f6e403]
137
+ - @mastra/core@0.10.11
138
+
139
+ ## 0.11.3-alpha.3
140
+
141
+ ### Patch Changes
142
+
143
+ - c1cceea: Bump peerdeps of @matra/core
144
+ - @mastra/core@0.10.11-alpha.4
145
+
146
+ ## 0.11.3-alpha.2
147
+
148
+ ### Patch Changes
149
+
150
+ - defb5ae: dependencies updates:
151
+ - Updated dependency [`inngest@^3.40.0` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.0) (from `^3.39.2`, in `dependencies`)
152
+ - Updated dependencies [c7bbf1e]
153
+ - Updated dependencies [8722d53]
154
+ - Updated dependencies [132027f]
155
+ - Updated dependencies [0c85311]
156
+ - Updated dependencies [cb16baf]
157
+ - @mastra/core@0.10.11-alpha.3
158
+
159
+ ## 0.11.3-alpha.1
160
+
161
+ ### Patch Changes
162
+
163
+ - 515488a: dependencies updates:
164
+ - Updated dependency [`inngest@^3.39.2` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.2) (from `^3.39.1`, in `dependencies`)
165
+ - Updated dependencies [7f6e403]
166
+ - @mastra/core@0.10.11-alpha.1
167
+
168
+ ## 0.11.3-alpha.0
169
+
170
+ ### Patch Changes
171
+
172
+ - b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
173
+ - Updated dependencies [f8ce2cc]
174
+ - Updated dependencies [8c846b6]
175
+ - Updated dependencies [b790fd1]
176
+ - Updated dependencies [d7ed04d]
177
+ - Updated dependencies [f36e4f1]
178
+ - @mastra/core@0.10.11-alpha.0
179
+
180
+ ## 0.11.2
181
+
182
+ ### Patch Changes
183
+
184
+ - 48d9738: Fix inngest sleep stream events
185
+ - Updated dependencies [4d3fbdf]
186
+ - @mastra/core@0.10.10
187
+
188
+ ## 0.11.2-alpha.0
189
+
190
+ ### Patch Changes
191
+
192
+ - 48d9738: Fix inngest sleep stream events
193
+ - Updated dependencies [4d3fbdf]
194
+ - @mastra/core@0.10.10-alpha.0
195
+
196
+ ## 0.11.1
197
+
198
+ ### Patch Changes
199
+
200
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
201
+ - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
202
+ - 1760a1c: Use workflow stream in playground instead of watch
203
+ - 038e5ae: Add cancel workflow run
204
+ - 81a1b3b: Update peerdeps
205
+ - Updated dependencies [9dda1ac]
206
+ - Updated dependencies [c984582]
207
+ - Updated dependencies [7e801dd]
208
+ - Updated dependencies [a606c75]
209
+ - Updated dependencies [7aa70a4]
210
+ - Updated dependencies [764f86a]
211
+ - Updated dependencies [1760a1c]
212
+ - Updated dependencies [038e5ae]
213
+ - Updated dependencies [7dda16a]
214
+ - Updated dependencies [5ebfcdd]
215
+ - Updated dependencies [b2d0c91]
216
+ - Updated dependencies [4e809ad]
217
+ - Updated dependencies [57929df]
218
+ - Updated dependencies [b7852ed]
219
+ - Updated dependencies [6320a61]
220
+ - @mastra/core@0.10.9
221
+
222
+ ## 0.11.1-alpha.0
223
+
224
+ ### Patch Changes
225
+
226
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
227
+ - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
228
+ - 1760a1c: Use workflow stream in playground instead of watch
229
+ - 038e5ae: Add cancel workflow run
230
+ - 81a1b3b: Update peerdeps
231
+ - Updated dependencies [9dda1ac]
232
+ - Updated dependencies [c984582]
233
+ - Updated dependencies [7e801dd]
234
+ - Updated dependencies [a606c75]
235
+ - Updated dependencies [7aa70a4]
236
+ - Updated dependencies [764f86a]
237
+ - Updated dependencies [1760a1c]
238
+ - Updated dependencies [038e5ae]
239
+ - Updated dependencies [7dda16a]
240
+ - Updated dependencies [5ebfcdd]
241
+ - Updated dependencies [b2d0c91]
242
+ - Updated dependencies [4e809ad]
243
+ - Updated dependencies [57929df]
244
+ - Updated dependencies [b7852ed]
245
+ - Updated dependencies [6320a61]
246
+ - @mastra/core@0.10.9-alpha.0
247
+
248
+ ## 0.11.0
249
+
250
+ ### Minor Changes
251
+
252
+ - 8a3bfd2: Update peerdeps to latest core
253
+
254
+ ### Patch Changes
255
+
256
+ - 8e1b6e9: dependencies updates:
257
+ - Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
258
+ - 9d52b17: Fix inngest workflows streaming and add step metadata
259
+ - 4fb0cc2: Type safe variable mapping
260
+ - 502fe05: createRun() -> createRunAsync()
261
+ - 4efcfa0: Added bail() method and more ergonomic suspend function return value
262
+ - Updated dependencies [15e9d26]
263
+ - Updated dependencies [d1baedb]
264
+ - Updated dependencies [d8f2d19]
265
+ - Updated dependencies [4d21bf2]
266
+ - Updated dependencies [07d6d88]
267
+ - Updated dependencies [9d52b17]
268
+ - Updated dependencies [2097952]
269
+ - Updated dependencies [792c4c0]
270
+ - Updated dependencies [5d74aab]
271
+ - Updated dependencies [a8b194f]
272
+ - Updated dependencies [4fb0cc2]
273
+ - Updated dependencies [d2a7a31]
274
+ - Updated dependencies [502fe05]
275
+ - Updated dependencies [144eb0b]
276
+ - Updated dependencies [8ba1b51]
277
+ - Updated dependencies [4efcfa0]
278
+ - Updated dependencies [0e17048]
279
+ - @mastra/core@0.10.7
280
+
281
+ ## 0.11.0-alpha.3
282
+
283
+ ### Minor Changes
284
+
285
+ - 8a3bfd2: Update peerdeps to latest core
286
+
287
+ ### Patch Changes
288
+
289
+ - 502fe05: createRun() -> createRunAsync()
290
+ - 4efcfa0: Added bail() method and more ergonomic suspend function return value
291
+ - Updated dependencies [792c4c0]
292
+ - Updated dependencies [502fe05]
293
+ - Updated dependencies [4efcfa0]
294
+ - @mastra/core@0.10.7-alpha.3
295
+
296
+ ## 0.10.6-alpha.2
297
+
298
+ ### Patch Changes
299
+
300
+ - 8e1b6e9: dependencies updates:
301
+ - Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
302
+ - Updated dependencies [15e9d26]
303
+ - Updated dependencies [07d6d88]
304
+ - Updated dependencies [5d74aab]
305
+ - Updated dependencies [144eb0b]
306
+ - @mastra/core@0.10.7-alpha.2
307
+
308
+ ## 0.10.6-alpha.1
309
+
310
+ ### Patch Changes
311
+
312
+ - 4fb0cc2: Type safe variable mapping
313
+ - Updated dependencies [d1baedb]
314
+ - Updated dependencies [4d21bf2]
315
+ - Updated dependencies [2097952]
316
+ - Updated dependencies [4fb0cc2]
317
+ - Updated dependencies [d2a7a31]
318
+ - Updated dependencies [0e17048]
319
+ - @mastra/core@0.10.7-alpha.1
320
+
321
+ ## 0.10.6-alpha.0
322
+
323
+ ### Patch Changes
324
+
325
+ - 9d52b17: Fix inngest workflows streaming and add step metadata
326
+ - Updated dependencies [d8f2d19]
327
+ - Updated dependencies [9d52b17]
328
+ - Updated dependencies [8ba1b51]
329
+ - @mastra/core@0.10.7-alpha.0
330
+
331
+ ## 0.10.5
332
+
333
+ ### Patch Changes
334
+
335
+ - 63f6b7d: dependencies updates:
336
+ - Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
337
+ - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
338
+ - ee9af57: Add api for polling run execution result and get run by id
339
+ - Updated dependencies [63f6b7d]
340
+ - Updated dependencies [12a95fc]
341
+ - Updated dependencies [4b0f8a6]
342
+ - Updated dependencies [51264a5]
343
+ - Updated dependencies [8e6f677]
344
+ - Updated dependencies [d70c420]
345
+ - Updated dependencies [ee9af57]
346
+ - Updated dependencies [36f1c36]
347
+ - Updated dependencies [2a16996]
348
+ - Updated dependencies [10d352e]
349
+ - Updated dependencies [9589624]
350
+ - Updated dependencies [53d3c37]
351
+ - Updated dependencies [751c894]
352
+ - Updated dependencies [577ce3a]
353
+ - Updated dependencies [9260b3a]
354
+ - @mastra/core@0.10.6
355
+
356
+ ## 0.10.5-alpha.1
357
+
358
+ ### Patch Changes
359
+
360
+ - ee9af57: Add api for polling run execution result and get run by id
361
+ - Updated dependencies [ee9af57]
362
+ - Updated dependencies [751c894]
363
+ - Updated dependencies [577ce3a]
364
+ - Updated dependencies [9260b3a]
365
+ - @mastra/core@0.10.6-alpha.1
366
+
367
+ ## 0.10.5-alpha.0
368
+
369
+ ### Patch Changes
370
+
371
+ - 63f6b7d: dependencies updates:
372
+ - Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
373
+ - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
374
+ - Updated dependencies [63f6b7d]
375
+ - Updated dependencies [36f1c36]
376
+ - Updated dependencies [10d352e]
377
+ - Updated dependencies [53d3c37]
378
+ - @mastra/core@0.10.6-alpha.0
379
+
380
+ ## 0.10.4
381
+
382
+ ### Patch Changes
383
+
384
+ - 13c97f9: Save run status, result and error in storage snapshot
385
+ - Updated dependencies [13c97f9]
386
+ - @mastra/core@0.10.5
387
+
388
+ ## 0.10.3
389
+
390
+ ### Patch Changes
391
+
392
+ - 1ccccff: dependencies updates:
393
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
394
+ - 1ccccff: dependencies updates:
395
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
396
+ - Updated dependencies [d1ed912]
397
+ - Updated dependencies [f6fd25f]
398
+ - Updated dependencies [dffb67b]
399
+ - Updated dependencies [f1f1f1b]
400
+ - Updated dependencies [925ab94]
401
+ - Updated dependencies [f9816ae]
402
+ - Updated dependencies [82090c1]
403
+ - Updated dependencies [1b443fd]
404
+ - Updated dependencies [ce97900]
405
+ - Updated dependencies [f1309d3]
406
+ - Updated dependencies [14a2566]
407
+ - Updated dependencies [f7f8293]
408
+ - Updated dependencies [48eddb9]
409
+ - @mastra/core@0.10.4
410
+
411
+ ## 0.10.3-alpha.0
412
+
413
+ ### Patch Changes
414
+
415
+ - 1ccccff: dependencies updates:
416
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
417
+ - 1ccccff: dependencies updates:
418
+ - Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
419
+ - Updated dependencies [f6fd25f]
420
+ - Updated dependencies [dffb67b]
421
+ - Updated dependencies [f1309d3]
422
+ - Updated dependencies [f7f8293]
423
+ - @mastra/core@0.10.4-alpha.1
424
+
425
+ ## 0.10.2
426
+
427
+ ### Patch Changes
428
+
429
+ - 195c428: Add runId to step execute fn
430
+ - 12b7002: Add serializedStepGraph to workflow run snapshot in storage
431
+ - f0d559f: Fix peerdeps for alpha channel
432
+ - 1ee6894: inngest production url fix
433
+ - Updated dependencies [ee77e78]
434
+ - Updated dependencies [592a2db]
435
+ - Updated dependencies [e5dc18d]
436
+ - Updated dependencies [ab5adbe]
437
+ - Updated dependencies [1e8bb40]
438
+ - Updated dependencies [1b5fc55]
439
+ - Updated dependencies [195c428]
440
+ - Updated dependencies [f73e11b]
441
+ - Updated dependencies [37643b8]
442
+ - Updated dependencies [99fd6cf]
443
+ - Updated dependencies [c5bf1ce]
444
+ - Updated dependencies [add596e]
445
+ - Updated dependencies [8dc94d8]
446
+ - Updated dependencies [ecebbeb]
447
+ - Updated dependencies [79d5145]
448
+ - Updated dependencies [12b7002]
449
+ - Updated dependencies [2901125]
450
+ - @mastra/core@0.10.2
451
+
452
+ ## 0.10.2-alpha.3
453
+
454
+ ### Patch Changes
455
+
456
+ - 1ee6894: inngest production url fix
457
+ - Updated dependencies [1b5fc55]
458
+ - Updated dependencies [add596e]
459
+ - Updated dependencies [ecebbeb]
460
+ - @mastra/core@0.10.2-alpha.5
461
+
462
+ ## 0.10.2-alpha.2
463
+
464
+ ### Patch Changes
465
+
466
+ - 12b7002: Add serializedStepGraph to workflow run snapshot in storage
467
+ - Updated dependencies [c5bf1ce]
468
+ - Updated dependencies [12b7002]
469
+ - @mastra/core@0.10.2-alpha.4
470
+
471
+ ## 0.10.2-alpha.1
472
+
473
+ ### Patch Changes
474
+
475
+ - 195c428: Add runId to step execute fn
476
+ - Updated dependencies [ab5adbe]
477
+ - Updated dependencies [195c428]
478
+ - Updated dependencies [f73e11b]
479
+ - @mastra/core@0.10.2-alpha.3
480
+
481
+ ## 0.10.2-alpha.0
482
+
483
+ ### Patch Changes
484
+
485
+ - f0d559f: Fix peerdeps for alpha channel
486
+ - Updated dependencies [1e8bb40]
487
+ - @mastra/core@0.10.2-alpha.2
488
+
489
+ ## 0.10.1
490
+
491
+ ### Patch Changes
492
+
493
+ - 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
494
+ Return error stack for failed workflow runs
495
+ - 5343f93: Move emitter to symbol to make private
496
+ - Updated dependencies [d70b807]
497
+ - Updated dependencies [6d16390]
498
+ - Updated dependencies [1e4a421]
499
+ - Updated dependencies [200d0da]
500
+ - Updated dependencies [bf5f17b]
501
+ - Updated dependencies [5343f93]
502
+ - Updated dependencies [38aee50]
503
+ - Updated dependencies [5c41100]
504
+ - Updated dependencies [d6a759b]
505
+ - Updated dependencies [6015bdf]
506
+ - @mastra/core@0.10.1
507
+
508
+ ## 0.10.1-alpha.0
509
+
510
+ ### Patch Changes
511
+
512
+ - 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
513
+ Return error stack for failed workflow runs
514
+ - 5343f93: Move emitter to symbol to make private
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
+ - @mastra/core@0.10.1-alpha.1
522
+
523
+ ## 0.10.0
524
+
525
+ ### Minor Changes
526
+
527
+ - 83da932: Move @mastra/core to peerdeps
528
+
529
+ ### Patch Changes
530
+
531
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
532
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
533
+ - Updated dependencies [b3a3d63]
534
+ - Updated dependencies [344f453]
535
+ - Updated dependencies [0a3ae6d]
536
+ - Updated dependencies [95911be]
537
+ - Updated dependencies [f53a6ac]
538
+ - Updated dependencies [5eb5a99]
539
+ - Updated dependencies [7e632c5]
540
+ - Updated dependencies [1e9fbfa]
541
+ - Updated dependencies [eabdcd9]
542
+ - Updated dependencies [90be034]
543
+ - Updated dependencies [99f050a]
544
+ - Updated dependencies [d0ee3c6]
545
+ - Updated dependencies [b2ae5aa]
546
+ - Updated dependencies [23f258c]
547
+ - Updated dependencies [a7292b0]
548
+ - Updated dependencies [0dcb9f0]
549
+ - Updated dependencies [2672a05]
550
+ - @mastra/core@0.10.0
551
+
552
+ ## 0.1.0-alpha.1
553
+
554
+ ### Minor Changes
555
+
556
+ - 83da932: Move @mastra/core to peerdeps
557
+
558
+ ### Patch Changes
559
+
560
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
561
+ - Updated dependencies [b3a3d63]
562
+ - Updated dependencies [344f453]
563
+ - Updated dependencies [0a3ae6d]
564
+ - Updated dependencies [95911be]
565
+ - Updated dependencies [5eb5a99]
566
+ - Updated dependencies [7e632c5]
567
+ - Updated dependencies [1e9fbfa]
568
+ - Updated dependencies [b2ae5aa]
569
+ - Updated dependencies [a7292b0]
570
+ - Updated dependencies [0dcb9f0]
571
+ - @mastra/core@0.10.0-alpha.1
572
+
573
+ ## 0.0.4-alpha.0
574
+
575
+ ### Patch Changes
576
+
577
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
578
+ - Updated dependencies [f53a6ac]
579
+ - Updated dependencies [eabdcd9]
580
+ - Updated dependencies [90be034]
581
+ - Updated dependencies [99f050a]
582
+ - Updated dependencies [d0ee3c6]
583
+ - Updated dependencies [23f258c]
584
+ - Updated dependencies [2672a05]
585
+ - @mastra/core@0.9.5-alpha.0
586
+
587
+ ## 0.0.3
588
+
589
+ ### Patch Changes
590
+
591
+ - Updated dependencies [396be50]
592
+ - Updated dependencies [ab80e7e]
593
+ - Updated dependencies [c3bd795]
594
+ - Updated dependencies [da082f8]
595
+ - Updated dependencies [a5810ce]
596
+ - Updated dependencies [3e9c131]
597
+ - Updated dependencies [3171b5b]
598
+ - Updated dependencies [973e5ac]
599
+ - Updated dependencies [daf942f]
600
+ - Updated dependencies [0b8b868]
601
+ - Updated dependencies [9e1eff5]
602
+ - Updated dependencies [6fa1ad1]
603
+ - Updated dependencies [c28d7a0]
604
+ - Updated dependencies [edf1e88]
605
+ - @mastra/core@0.9.4
606
+
607
+ ## 0.0.3-alpha.4
608
+
609
+ ### Patch Changes
610
+
611
+ - Updated dependencies [3e9c131]
612
+ - @mastra/core@0.9.4-alpha.4
613
+
614
+ ## 0.0.3-alpha.3
615
+
616
+ ### Patch Changes
617
+
618
+ - Updated dependencies [396be50]
619
+ - Updated dependencies [c3bd795]
620
+ - Updated dependencies [da082f8]
621
+ - Updated dependencies [a5810ce]
622
+ - @mastra/core@0.9.4-alpha.3
623
+
624
+ ## 0.0.3-alpha.2
625
+
626
+ ### Patch Changes
627
+
628
+ - Updated dependencies [3171b5b]
629
+ - Updated dependencies [973e5ac]
630
+ - Updated dependencies [9e1eff5]
631
+ - @mastra/core@0.9.4-alpha.2
632
+
633
+ ## 0.0.3-alpha.1
634
+
635
+ ### Patch Changes
636
+
637
+ - Updated dependencies [ab80e7e]
638
+ - Updated dependencies [6fa1ad1]
639
+ - Updated dependencies [c28d7a0]
640
+ - Updated dependencies [edf1e88]
641
+ - @mastra/core@0.9.4-alpha.1
642
+
643
+ ## 0.0.3-alpha.0
644
+
645
+ ### Patch Changes
646
+
647
+ - Updated dependencies [daf942f]
648
+ - Updated dependencies [0b8b868]
649
+ - @mastra/core@0.9.4-alpha.0
650
+
651
+ ## 0.0.2
652
+
653
+ ### Patch Changes
654
+
655
+ - e450778: vnext: Inngest playground fixes
656
+ - Updated dependencies [e450778]
657
+ - Updated dependencies [8902157]
658
+ - Updated dependencies [ca0dc88]
659
+ - Updated dependencies [526c570]
660
+ - Updated dependencies [d7a6a33]
661
+ - Updated dependencies [9cd1a46]
662
+ - Updated dependencies [b5d2de0]
663
+ - Updated dependencies [644f8ad]
664
+ - Updated dependencies [70dbf51]
665
+ - @mastra/core@0.9.3
666
+
667
+ ## 0.0.2-alpha.0
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 [9cd1a46]
676
+ - Updated dependencies [70dbf51]
677
+ - @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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["PubSub","PubSubClient","activeCbs","cb"],"mappings":";;;;;;AAKO,IAAM,iBAAA,GAAN,cAAgCA,aAAA,CAAO;AAAA,EACpC,UAAA;AAAA,EACA,MAAA;AAAA,EACA,YAA0C,EAAC;AAAA,EAC3C,sBAAoD,EAAC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,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,OAAA,CAAQ,IAAA,CAAK,CAAC,QAAQ,eAAA,EAAgB,EAAG,IAAI,OAAA,CAAQ,aAAW,UAAA,CAAW,OAAA,EAAS,GAAI,CAAC,CAAC,CAAC,CAAA;AAC/G,MAAA,IAAA,CAAK,SAAA,CAAU,QAAQ,GAAA,GAAM,OAAA,CAAQ,EAAE,CAAA,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CAAW,KAAA,EAAO,OAAO,CAAA;AAAA,YACtC,SAAS,CAAA,EAAG;AACV,cAAA,OAAA,CAAQ,KAAA,CAAM,wBAAwB,CAAC,CAAA;AAAA,YACzC;AAAA,UACF,CAAC,CAAA;AAAA,QACH;AAAA,MACF,SAAS,KAAA,EAAO;AACd,QAAA,OAAA,CAAQ,KAAA,CAAM,0BAA0B,KAAK,CAAA;AAAA,MAC/C;AAAA,IACF,CAAC,CAAA;AAED,IAAA,YAAA,CAAa,EAAA,CAAG,OAAA,EAAS,OAAM,KAAA,KAAS;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.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-consolidate-changesets-20250904042643",
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/types-builder": "0.0.0-consolidate-changesets-20250904042643",
40
+ "@internal/lint": "0.0.0-consolidate-changesets-20250904042643",
41
+ "@mastra/deployer": "0.0.0-consolidate-changesets-20250904042643",
42
+ "@mastra/libsql": "0.0.0-consolidate-changesets-20250904042643",
43
+ "@mastra/core": "0.0.0-consolidate-changesets-20250904042643"
44
+ },
45
+ "peerDependencies": {
46
+ "@mastra/core": "0.0.0-consolidate-changesets-20250904042643"
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
+ }