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