@superdurable/connector-zoom 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,31 @@
1
1
  # Zoom TypeScript connector
2
2
 
3
- `@superdurable/connector-zoom` implements the five Zoom Meetings operations from the Go connector: `listMeetings`, `getMeeting`, `createMeeting`, `updateMeeting`, and `listPastMeetingParticipants`. Generated models, operation-specific Step factories, connection bindings, mock cases, and OAuth declarations come from `../connector.yaml`. Provider requests and operation invocation are hand-written in `src/client.ts`, `src/meeting.ts`, and `src/operations.ts`.
3
+ `@superdurable/connector-zoom` 0.2.0 implements the five Zoom Meetings operations from the Go connector: `listMeetings`, `getMeeting`, `createMeeting`, `updateMeeting`, and `listPastMeetingParticipants`, and the `meetingChanged` poll Trigger. Generated models, operation-specific Step factories, connection bindings, mock cases, and OAuth declarations come from `../connector.yaml`. Provider requests and operation invocation are hand-written in `src/client.ts`, `src/meeting.ts`, and `src/operations.ts`; the Trigger is in `src/trigger.ts`, `src/meeting_list_fetcher.ts`, and `src/meeting_snapshot.ts`.
4
4
 
5
- Install the package with `@superdurable/connectors-sdk` 0.6.0 and Dex TypeScript SDK 1.28.0 or later. Use Node.js 22 or 24. Keep Zoom credentials in Dex Web Connections. `newProjectConnection(project, ConnectionName)` binds generated private and shared credential decoders and durable OAuth refresh. It does not accept tokens in Flow inputs.
5
+ Install the package with `@superdurable/connectors-sdk` 0.12.0, which adds the poll Trigger kit, and Dex TypeScript SDK 1.45.4 or later. Use Node.js 22 or 24. Keep Zoom credentials in Dex Web Connections. `newProjectConnection(project, ConnectionName)` binds generated private and shared credential decoders and durable OAuth refresh. It does not accept tokens in Flow inputs.
6
6
 
7
- ## Run the example
7
+ ## meetingChanged Trigger
8
+
9
+ `meetingChanged` delivers each meeting the authorized user schedules, changes, or that leaves Zoom's scheduled list, as a `MeetingChangedEvent` with `changeKind` `scheduled`, `updated` (with `previousMeeting`), or `removed` (with the last listed state). Each poll reads every page of `GET /users/me/meetings?type=scheduled` and diffs it with a keyed snapshot committed in the binding's poll cursor. Behavior matches the Go connector, which the [connector README](../README.md#meetingchanged-trigger) describes in full: the first poll records a baseline and delivers nothing, event IDs are stable across refetches, a recurring meeting tracks its next listed occurrence, an expired page token restarts the listing once, more than 100 changes commit 100 at a time, a cursor that is undecodable or holds another Zoom user's meetings reseeds with a WARN record, and every 429, including the daily limit, pauses the connection for `Retry-After`. The cursor token and snapshot entries are byte-compatible with Go, and inbox payloads use the Go JSON fields, so Go and TypeScript replicas can share one binding; `test/meeting_changed_go_parity.test.ts` replays a Go recording to prove it.
10
+
11
+ The connection's `pollInterval` setting, `Config.pollIntervalMs` in code, is the delay between polls; `ZoomClient` rejects one under 30 seconds. The Trigger reads with the `meeting:read:list_meetings` scope the connection already requests.
12
+
13
+ | Function | Use |
14
+ | --- | --- |
15
+ | `newProjectMeetingTriggerRunner(project, connection, routes)` | Durable delivery from a `LoadedProject`: each route's saved binding configuration is loaded (an unsaved binding delivers every kind), and each change is recorded in the binding's project Trigger inbox before its snapshot commits. |
16
+ | `newMeetingTriggerRunner(connection, routes)` | One poll `Runner` for `MeetingChangedTriggerRoute` values with your own targets and cursor stores; a route without a cursor keeps it in memory. |
17
+ | `newMeetingChangedTrigger({ connection, bindingName, target })` | One in-memory `TriggerRunner`, like Go's generated `NewMeetingChangedTrigger`; it records a new baseline on every start. |
18
+ | `defineMeetingChangedTriggerBinding({ connectionName, bindingName })` | Declares the binding in a Flow's `getConnectorTriggerBindings`. Dex Web shows no field for it. |
19
+
20
+ `MeetingChangedTriggerConfiguration.changeKinds` narrows deliveries in code; skipped kinds still advance the snapshot. The [meeting-changed example](examples/meeting-changed/README.md) wires a Flow target in [`app.ts`](examples/meeting-changed/app.ts):
21
+
22
+ ```ts
23
+ const runner = newProjectMeetingTriggerRunner(project, connection, [{ bindingName: MeetingChangedTriggerBinding, target: newMeetingChangeFlowTarget(client, flow, options) }], options.logger ? { logger: options.logger } : {});
24
+ ```
25
+
26
+ `runner.run(newTriggerContext(signal))` replays the inboxes, seeds, and polls until the signal aborts, then rejects with `TriggerDeliveryAbortedError`.
27
+
28
+ ## Run the examples
8
29
 
9
30
  The [meeting-list example](examples/meeting-list/) has the static `zoom-scheduler` connection name, a Worker entrypoint, a Client starter, and a real Dex integration check. Create the user-managed Zoom OAuth app and authorize it using the guide in the [connector README](../README.md). Start `dexcli dev`, set `DEX_FLOW_SERVICE_ADDRESS` to its server address, then run these commands from this directory:
10
31
 
@@ -20,4 +41,6 @@ The integration check uses a generated provider stand-in and needs no Zoom crede
20
41
  DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:<dex-port> npm run example:meeting-list:integration
21
42
  ```
22
43
 
23
- Run `npm run check` for package tests, types, and lint. From the repository root, run `make test-connector-conformance CONNECTOR_DIRECTORY=connectors/zoom` to replay the Go-recorded provider scenarios in TypeScript. Live Zoom authorization and provider behavior have not been verified.
44
+ The [meeting-changed example](examples/meeting-changed/README.md) starts one Flow per meeting change on `zoom-meeting-watcher`; run it with `npm run example:meeting-changed`.
45
+
46
+ Run `npm run check` for package tests, types, and lint. With `dexcli dev` running, `DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:<dex-port> npm run test:integration` runs both examples' real Dex integration tests. From the repository root, run `make test-connector-conformance CONNECTOR_DIRECTORY=connectors/zoom` to replay the Go-recorded provider scenarios in TypeScript. Live Zoom authorization, polling, and provider behavior have not been verified.
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "connectorId": "zoom",
3
- "releaseTag": "connectors/zoom/go/v0.24.0",
3
+ "releaseTag": "connectors/zoom/go/v0.25.0",
4
4
  "package": {
5
5
  "ecosystem": "npm",
6
6
  "name": "@superdurable/connector-zoom",
7
- "version": "0.1.0"
7
+ "version": "0.2.0"
8
8
  },
9
9
  "factories": [
10
10
  {
11
11
  "name": "newListMeetingsStep",
12
12
  "kind": "query",
13
13
  "operationId": "listMeetings",
14
+ "inputType": "ListMeetingsInput",
15
+ "description": "List one page of the authorized user's scheduled, upcoming, live, or previous meetings, at most 300 per page.",
14
16
  "fields": {
15
17
  "stepType": "stepType",
16
18
  "annotations": "annotations",
@@ -38,12 +40,39 @@
38
40
  "field": "defect",
39
41
  "optional": true
40
42
  }
41
- ]
43
+ ],
44
+ "inputSchema": {
45
+ "additionalProperties": false,
46
+ "description": "ListMeetingsInput selects one page of the authorized user's meetings.",
47
+ "properties": {
48
+ "pageSize": {
49
+ "description": "PageSize is the number of meetings per page, from 1 to 300; zero uses Zoom's default of 30.",
50
+ "type": "integer"
51
+ },
52
+ "pageToken": {
53
+ "description": "PageToken is the NextPageToken of the previous page; Zoom expires it after 15 minutes.",
54
+ "type": "string"
55
+ },
56
+ "type": {
57
+ "description": "Type selects the meetings to list; blank lists upcoming meetings.",
58
+ "enum": [
59
+ "live",
60
+ "previous_meetings",
61
+ "scheduled",
62
+ "upcoming"
63
+ ],
64
+ "type": "string"
65
+ }
66
+ },
67
+ "type": "object"
68
+ }
42
69
  },
43
70
  {
44
71
  "name": "newGetMeetingStep",
45
72
  "kind": "query",
46
73
  "operationId": "getMeeting",
74
+ "inputType": "GetMeetingInput",
75
+ "description": "Read one meeting by its numeric meeting ID, including its start instant, time zone, join URL, and settings.",
47
76
  "fields": {
48
77
  "stepType": "stepType",
49
78
  "annotations": "annotations",
@@ -76,12 +105,28 @@
76
105
  "field": "defect",
77
106
  "optional": true
78
107
  }
79
- ]
108
+ ],
109
+ "inputSchema": {
110
+ "additionalProperties": false,
111
+ "description": "GetMeetingInput identifies one meeting.",
112
+ "properties": {
113
+ "meetingId": {
114
+ "description": "MeetingID is Zoom's numeric meeting ID, such as the ID createMeeting returned.",
115
+ "type": "integer"
116
+ }
117
+ },
118
+ "required": [
119
+ "meetingId"
120
+ ],
121
+ "type": "object"
122
+ }
80
123
  },
81
124
  {
82
125
  "name": "newCreateMeetingStep",
83
126
  "kind": "mutation",
84
127
  "operationId": "createMeeting",
128
+ "inputType": "CreateMeetingInput",
129
+ "description": "Schedule one meeting for the authorized user at an explicit start instant and IANA time zone; a synchronous dispatch fence makes the pre-send checkpoint visible across attempts and prevents a second send after an unknown outcome.",
85
130
  "fields": {
86
131
  "stepType": "stepType",
87
132
  "annotations": "annotations",
@@ -109,12 +154,89 @@
109
154
  "field": "defect",
110
155
  "optional": true
111
156
  }
112
- ]
157
+ ],
158
+ "inputSchema": {
159
+ "$defs": {
160
+ "MeetingSettingsInput": {
161
+ "additionalProperties": false,
162
+ "description": "MeetingSettingsInput changes meeting settings. A nil field, or a blank AutoRecording, leaves Zoom's value, which defaults to the user's settings.",
163
+ "properties": {
164
+ "autoRecording": {
165
+ "description": "AutoRecording is none, local, or cloud.",
166
+ "enum": [
167
+ "cloud",
168
+ "local",
169
+ "none"
170
+ ],
171
+ "type": "string"
172
+ },
173
+ "hostVideo": {
174
+ "description": "HostVideo starts the meeting with the host's video on.",
175
+ "type": "boolean"
176
+ },
177
+ "joinBeforeHost": {
178
+ "description": "JoinBeforeHost lets participants join before the host.",
179
+ "type": "boolean"
180
+ },
181
+ "muteUponEntry": {
182
+ "description": "MuteUponEntry mutes participants when they join.",
183
+ "type": "boolean"
184
+ },
185
+ "participantVideo": {
186
+ "description": "ParticipantVideo starts the meeting with participants' video on.",
187
+ "type": "boolean"
188
+ },
189
+ "waitingRoom": {
190
+ "description": "WaitingRoom holds participants in a waiting room; Zoom then disables JoinBeforeHost.",
191
+ "type": "boolean"
192
+ }
193
+ },
194
+ "type": "object"
195
+ }
196
+ },
197
+ "additionalProperties": false,
198
+ "description": "CreateMeetingInput describes one scheduled meeting for the authorized user.",
199
+ "properties": {
200
+ "agenda": {
201
+ "description": "Agenda is the optional meeting description, at most 2000 characters.",
202
+ "type": "string"
203
+ },
204
+ "durationMinutes": {
205
+ "description": "DurationMinutes is the scheduled duration, from 1 to 1440 minutes.",
206
+ "type": "integer"
207
+ },
208
+ "settings": {
209
+ "$ref": "#/$defs/MeetingSettingsInput",
210
+ "description": "Settings optionally overrides the user's default meeting settings."
211
+ },
212
+ "startTime": {
213
+ "description": "StartTime is the start instant in RFC 3339 with an explicit Z or ±hh:mm offset, such as 2026-02-24T09:00:00-08:00. It must be in the future and a whole second; a value without an offset is rejected rather than guessed.",
214
+ "type": "string"
215
+ },
216
+ "timeZone": {
217
+ "description": "TimeZone is the IANA time zone Zoom uses to display the meeting, such as America/Los_Angeles. It never moves the instant StartTime names.",
218
+ "type": "string"
219
+ },
220
+ "topic": {
221
+ "description": "Topic is the meeting topic, 1 to 200 characters.",
222
+ "type": "string"
223
+ }
224
+ },
225
+ "required": [
226
+ "durationMinutes",
227
+ "startTime",
228
+ "timeZone",
229
+ "topic"
230
+ ],
231
+ "type": "object"
232
+ }
113
233
  },
114
234
  {
115
235
  "name": "newUpdateMeetingStep",
116
236
  "kind": "mutation",
117
237
  "operationId": "updateMeeting",
238
+ "inputType": "UpdateMeetingInput",
239
+ "description": "Patch the topic, agenda, start instant and time zone, duration, or settings of one meeting; the patch sets absolute values, so repeating it is safe.",
118
240
  "fields": {
119
241
  "stepType": "stepType",
120
242
  "annotations": "annotations",
@@ -142,12 +264,90 @@
142
264
  "field": "defect",
143
265
  "optional": true
144
266
  }
145
- ]
267
+ ],
268
+ "inputSchema": {
269
+ "$defs": {
270
+ "MeetingSettingsInput": {
271
+ "additionalProperties": false,
272
+ "description": "MeetingSettingsInput changes meeting settings. A nil field, or a blank AutoRecording, leaves Zoom's value, which defaults to the user's settings.",
273
+ "properties": {
274
+ "autoRecording": {
275
+ "description": "AutoRecording is none, local, or cloud.",
276
+ "enum": [
277
+ "cloud",
278
+ "local",
279
+ "none"
280
+ ],
281
+ "type": "string"
282
+ },
283
+ "hostVideo": {
284
+ "description": "HostVideo starts the meeting with the host's video on.",
285
+ "type": "boolean"
286
+ },
287
+ "joinBeforeHost": {
288
+ "description": "JoinBeforeHost lets participants join before the host.",
289
+ "type": "boolean"
290
+ },
291
+ "muteUponEntry": {
292
+ "description": "MuteUponEntry mutes participants when they join.",
293
+ "type": "boolean"
294
+ },
295
+ "participantVideo": {
296
+ "description": "ParticipantVideo starts the meeting with participants' video on.",
297
+ "type": "boolean"
298
+ },
299
+ "waitingRoom": {
300
+ "description": "WaitingRoom holds participants in a waiting room; Zoom then disables JoinBeforeHost.",
301
+ "type": "boolean"
302
+ }
303
+ },
304
+ "type": "object"
305
+ }
306
+ },
307
+ "additionalProperties": false,
308
+ "description": "UpdateMeetingInput patches one meeting. Every field other than MeetingID is optional, at least one must be set, and each set field replaces Zoom's value, so repeating the same patch leaves the same meeting.",
309
+ "properties": {
310
+ "agenda": {
311
+ "description": "Agenda replaces the agenda, at most 2000 characters; nil leaves it and an empty string clears it.",
312
+ "type": "string"
313
+ },
314
+ "durationMinutes": {
315
+ "description": "DurationMinutes replaces the duration, from 1 to 1440 minutes; zero leaves it.",
316
+ "type": "integer"
317
+ },
318
+ "meetingId": {
319
+ "description": "MeetingID is Zoom's numeric meeting ID.",
320
+ "type": "integer"
321
+ },
322
+ "settings": {
323
+ "$ref": "#/$defs/MeetingSettingsInput",
324
+ "description": "Settings changes the listed settings and leaves the others."
325
+ },
326
+ "startTime": {
327
+ "description": "StartTime moves the meeting to a future RFC 3339 instant with an explicit offset; blank leaves it. Zoom silently ignores a past start, so the connector rejects one.",
328
+ "type": "string"
329
+ },
330
+ "timeZone": {
331
+ "description": "TimeZone is the IANA time zone Zoom uses to display the meeting. It is required with StartTime and must be blank without it.",
332
+ "type": "string"
333
+ },
334
+ "topic": {
335
+ "description": "Topic replaces the topic, 1 to 200 characters; blank leaves it.",
336
+ "type": "string"
337
+ }
338
+ },
339
+ "required": [
340
+ "meetingId"
341
+ ],
342
+ "type": "object"
343
+ }
146
344
  },
147
345
  {
148
346
  "name": "newListPastMeetingParticipantsStep",
149
347
  "kind": "query",
150
348
  "operationId": "listPastMeetingParticipants",
349
+ "inputType": "ListPastMeetingParticipantsInput",
350
+ "description": "List one page of the people who joined the latest ended instance of a meeting, at most 300 per page.",
151
351
  "fields": {
152
352
  "stepType": "stepType",
153
353
  "annotations": "annotations",
@@ -180,7 +380,39 @@
180
380
  "field": "defect",
181
381
  "optional": true
182
382
  }
183
- ]
383
+ ],
384
+ "inputSchema": {
385
+ "additionalProperties": false,
386
+ "description": "ListPastMeetingParticipantsInput selects one page of a past meeting's participants.",
387
+ "properties": {
388
+ "meetingId": {
389
+ "description": "MeetingID is Zoom's numeric meeting ID; Zoom answers for its latest ended instance.",
390
+ "type": "integer"
391
+ },
392
+ "pageSize": {
393
+ "description": "PageSize is the number of participants per page, from 1 to 300; zero uses Zoom's default of 30.",
394
+ "type": "integer"
395
+ },
396
+ "pageToken": {
397
+ "description": "PageToken is the NextPageToken of the previous page; Zoom expires it after 15 minutes.",
398
+ "type": "string"
399
+ }
400
+ },
401
+ "required": [
402
+ "meetingId"
403
+ ],
404
+ "type": "object"
405
+ }
406
+ },
407
+ {
408
+ "name": "defineMeetingChangedTriggerBinding",
409
+ "kind": "trigger",
410
+ "triggerName": "meetingChanged",
411
+ "fields": {
412
+ "connectionName": "connectionName",
413
+ "bindingName": "bindingName",
414
+ "configurationUI": "configurationUI"
415
+ }
184
416
  }
185
417
  ]
186
418
  }
@@ -26,7 +26,8 @@ function canonicalGoTimeJSON(value) {
26
26
  var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
27
27
  var ConfigSchema = z.object({
28
28
  "endpoint": z.string().optional(),
29
- "maxResponseBytes": z.number().int().optional()
29
+ "maxResponseBytes": z.number().int().optional(),
30
+ "pollIntervalMs": z.number().int().optional()
30
31
  });
31
32
  function decodeCredentials(value) {
32
33
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
@@ -232,7 +233,9 @@ var CreateMeetingDefinition = {
232
233
  { id: "uncertain", description: "The request was dispatched but its outcome cannot be confirmed; the meeting may exist and must not be created again automatically.", optional: true },
233
234
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
234
235
  ],
235
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 3e4, maximumAttempts: 5, totalDurationMs: 12e4 } }
236
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 3e4, maximumAttempts: 5, totalDurationMs: 12e4 } },
237
+ repeatOnUnknown: "limited",
238
+ maxSends: 3
236
239
  };
237
240
  var CreateMeetingMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
238
241
  var UpdateMeetingBranch = {
@@ -253,7 +256,8 @@ var UpdateMeetingDefinition = {
253
256
  { id: "providerRejected", description: "Zoom conclusively rejected the patch, including a documented daily-limit 429 or an invalid field value.", optional: true },
254
257
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
255
258
  ],
256
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
259
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
260
+ repeatOnUnknown: "safe"
257
261
  };
258
262
  var UpdateMeetingMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
259
263
  var ListPastMeetingParticipantsBranch = {
@@ -7,11 +7,14 @@ interface Config {
7
7
  endpoint?: string;
8
8
  /** Maximum complete Zoom API response in bytes; enter a positive integer only to change the safety limit. A larger meeting or listing selects invalidResponse. */
9
9
  maxResponseBytes?: number;
10
+ /** Delay between meetingChanged Trigger polls of the authorized user's Zoom meeting list, as a Go duration of at least 30s such as 1m or 10m; change it only to see meeting changes sooner or to spend fewer requests. Each poll reads every page of up to 300 meetings from List meetings, a Medium API that Zoom limits to 2,000 requests per day on Free accounts, so keep at least 1m there; blank uses the displayed default. Runtime value in milliseconds. */
11
+ pollIntervalMs?: number;
10
12
  }
11
13
  /** Runtime schema for manifest configuration. */
12
14
  declare const ConfigSchema: z.ZodObject<{
13
15
  endpoint: z.ZodOptional<z.ZodString>;
14
16
  maxResponseBytes: z.ZodOptional<z.ZodNumber>;
17
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
15
18
  }, z.core.$strip>;
16
19
  /** Private connector credentials resolved by the host. */
17
20
  interface Credentials {
@@ -411,4 +414,4 @@ declare function newConnection(client: Operations, reference: ConnectionRef): Co
411
414
  /** Bind scripted operations to a named connection. */
412
415
  declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
413
416
 
414
- export { decodeSharedCredentials as A, newConnection as B, type CreateMeetingInput as C, newConnectionWithOperations as D, type GetMeetingInput as G, type ListMeetingsInput as L, type Meeting as M, type Operations as O, type ParticipantPage as P, type UpdateMeetingInput as U, Connection as a, type MeetingPage as b, type ListPastMeetingParticipantsInput as c, type UpdatedMeeting as d, type CredentialSource as e, type Config as f, type Credentials as g, ConfigSchema as h, CreateMeetingInputSchema as i, GetMeetingInputSchema as j, ListMeetingsInputSchema as k, ListPastMeetingParticipantsInputSchema as l, MeetingPageSchema as m, type MeetingParticipant as n, MeetingParticipantSchema as o, MeetingSchema as p, type MeetingSettings as q, type MeetingSettingsInput as r, MeetingSettingsInputSchema as s, MeetingSettingsSchema as t, type MeetingSummary as u, MeetingSummarySchema as v, ParticipantPageSchema as w, UpdateMeetingInputSchema as x, UpdatedMeetingSchema as y, decodeCredentials as z };
417
+ export { decodeSharedCredentials as A, newConnection as B, type CreateMeetingInput as C, newConnectionWithOperations as D, type GetMeetingInput as G, type ListMeetingsInput as L, type Meeting as M, type Operations as O, type ParticipantPage as P, type UpdateMeetingInput as U, Connection as a, type MeetingPage as b, type ListPastMeetingParticipantsInput as c, type UpdatedMeeting as d, type CredentialSource as e, type Credentials as f, type Config as g, ConfigSchema as h, CreateMeetingInputSchema as i, GetMeetingInputSchema as j, ListMeetingsInputSchema as k, ListPastMeetingParticipantsInputSchema as l, MeetingPageSchema as m, type MeetingParticipant as n, MeetingParticipantSchema as o, MeetingSchema as p, type MeetingSettings as q, type MeetingSettingsInput as r, MeetingSettingsInputSchema as s, MeetingSettingsSchema as t, type MeetingSummary as u, MeetingSummarySchema as v, ParticipantPageSchema as w, UpdateMeetingInputSchema as x, UpdatedMeetingSchema as y, decodeCredentials as z };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import { C as CreateMeetingInput, M as Meeting, a as Connection, G as GetMeetingInput, L as ListMeetingsInput, b as MeetingPage, c as ListPastMeetingParticipantsInput, P as ParticipantPage, U as UpdateMeetingInput, d as UpdatedMeeting, e as CredentialSource, f as Config, g as Credentials, O as Operations } from './connection-4reP5njk.js';
2
- export { h as ConfigSchema, i as CreateMeetingInputSchema, j as GetMeetingInputSchema, k as ListMeetingsInputSchema, l as ListPastMeetingParticipantsInputSchema, m as MeetingPageSchema, n as MeetingParticipant, o as MeetingParticipantSchema, p as MeetingSchema, q as MeetingSettings, r as MeetingSettingsInput, s as MeetingSettingsInputSchema, t as MeetingSettingsSchema, u as MeetingSummary, v as MeetingSummarySchema, w as ParticipantPageSchema, x as UpdateMeetingInputSchema, y as UpdatedMeetingSchema, z as decodeCredentials, A as decodeSharedCredentials, B as newConnection, D as newConnectionWithOperations } from './connection-4reP5njk.js';
1
+ import { C as CreateMeetingInput, M as Meeting, a as Connection, G as GetMeetingInput, L as ListMeetingsInput, b as MeetingPage, c as ListPastMeetingParticipantsInput, P as ParticipantPage, U as UpdateMeetingInput, d as UpdatedMeeting, e as CredentialSource, f as Credentials, g as Config, O as Operations } from './connection-Cq-pg7cw.js';
2
+ export { h as ConfigSchema, i as CreateMeetingInputSchema, j as GetMeetingInputSchema, k as ListMeetingsInputSchema, l as ListPastMeetingParticipantsInputSchema, m as MeetingPageSchema, n as MeetingParticipant, o as MeetingParticipantSchema, p as MeetingSchema, q as MeetingSettings, r as MeetingSettingsInput, s as MeetingSettingsInputSchema, t as MeetingSettingsSchema, u as MeetingSummary, v as MeetingSummarySchema, w as ParticipantPageSchema, x as UpdateMeetingInputSchema, y as UpdatedMeetingSchema, z as decodeCredentials, A as decodeSharedCredentials, B as newConnection, D as newConnectionWithOperations } from './connection-Cq-pg7cw.js';
3
3
  import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
4
- import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt, Failure, ReceiptDraft } from '@superdurable/connectors-sdk';
4
+ import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt, Failure, ReceiptDraft, ConnectorConfigurationUI, TriggerTarget, TriggerLogger, TriggerDefinition, TriggerBindingDefinition, TriggerRunner } from '@superdurable/connectors-sdk';
5
5
  import { StepTarget } from '@superdurable/dex';
6
6
  import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
7
7
  import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
8
- import 'zod';
8
+ import { ManifestCredentialRefreshDriver } from '@superdurable/connectors-sdk/oauthtoken';
9
+ import { z } from 'zod';
10
+ import { CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
9
11
 
10
12
  /** Stable connector identity. */
11
13
  declare const ConnectorID = "zoom";
@@ -253,7 +255,7 @@ declare class GetMeetingOperation implements Query<GetMeetingInput, Meeting> {
253
255
  declare class UpdateMeetingOperation implements Mutation<UpdateMeetingInput, UpdatedMeeting> {
254
256
  private readonly client;
255
257
  /** Bind one Zoom client. */ constructor(client: ZoomClient);
256
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
258
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
257
259
  /** Derive the receipt key from Dex's Call ID. */ idempotencyKey(callId: string): string;
258
260
  /** Invoke one repeat-safe meeting patch. */
259
261
  invoke(call: Call, input: UpdateMeetingInput): Promise<MutationAttempt<UpdatedMeeting>>;
@@ -270,13 +272,15 @@ declare class ListPastMeetingParticipantsOperation implements Query<ListPastMeet
270
272
  declare class CreateMeetingOperation implements Mutation<CreateMeetingInput, Meeting> {
271
273
  private readonly client;
272
274
  /** Bind one Zoom client. */ constructor(client: ZoomClient);
273
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
275
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
274
276
  /** Derive the receipt key from Dex's Call ID. */ idempotencyKey(callId: string): string;
275
277
  /** Invoke one fenced create attempt. */
276
278
  invoke(call: Call, input: CreateMeetingInput): Promise<MutationAttempt<Meeting>>;
277
279
  private readBack;
278
280
  }
279
281
 
282
+ /** Keeps one meetingChanged binding under Zoom's Free-plan Medium daily limit. */
283
+ declare const MinimumPollIntervalMs = 30000;
280
284
  /** Replace the provider transport or clock for deterministic tests. */
281
285
  interface ZoomClientOptions {
282
286
  /** Sends one provider request. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
@@ -295,11 +299,19 @@ declare class ZoomClient {
295
299
  readonly credentials: CredentialSource;
296
300
  readonly endpoint: string;
297
301
  readonly maxResponseBytes: number;
302
+ /** The meetingChanged Trigger's delay between polls in milliseconds; at least MinimumPollIntervalMs. */
303
+ readonly pollIntervalMs: number;
298
304
  private readonly send;
299
305
  private readonly now;
300
- private readonly refreshDriver;
301
- /** Validate connection settings before a Step resolves credentials. */
306
+ /** The generated OAuth refresh policy every credential resolution uses, including Trigger polls. */
307
+ readonly refreshDriver: ManifestCredentialRefreshDriver<Credentials>;
308
+ /**
309
+ * Validate connection settings before a Step resolves credentials. An omitted or zero pollIntervalMs uses
310
+ * the manifest's two minutes; one under 30 seconds throws, as Go's New does.
311
+ */
302
312
  constructor(config: Config, credentials: CredentialSource, options?: ZoomClientOptions);
313
+ /** The client clock, used for receipts, Retry-After, and Trigger observation times. */
314
+ currentTime(): Date;
303
315
  /** Bind the meeting list query. */ listMeetings(): ListMeetingsOperation;
304
316
  /** Bind the meeting detail query. */ getMeeting(): GetMeetingOperation;
305
317
  /** Bind the fenced meeting create mutation. */ createMeeting(): CreateMeetingOperation;
@@ -325,4 +337,145 @@ declare class ZoomClient {
325
337
  /** Open a named Zoom project connection with generated renewable credential decoders. */
326
338
  declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: ZoomClientOptions): Connection<Operations>;
327
339
 
328
- export { Config, Connection, ConnectorID, CreateMeetingBranch, CreateMeetingBranchCreated, CreateMeetingBranchDefect, CreateMeetingBranchProviderRejected, CreateMeetingBranchUncertain, CreateMeetingDefinition, CreateMeetingInput, CreateMeetingMetadata, CreateMeetingOperation, type CreateMeetingStepConfig, CredentialSource, Credentials, GetMeetingBranch, GetMeetingBranchDefect, GetMeetingBranchFound, GetMeetingBranchInvalidResponse, GetMeetingBranchNotFound, GetMeetingBranchProviderRejected, GetMeetingDefinition, GetMeetingInput, GetMeetingMetadata, GetMeetingOperation, type GetMeetingStepConfig, ListMeetingsBranch, ListMeetingsBranchDefect, ListMeetingsBranchInvalidResponse, ListMeetingsBranchListed, ListMeetingsBranchProviderRejected, ListMeetingsDefinition, ListMeetingsInput, ListMeetingsMetadata, ListMeetingsOperation, type ListMeetingsStepConfig, ListPastMeetingParticipantsBranch, ListPastMeetingParticipantsBranchDefect, ListPastMeetingParticipantsBranchInvalidResponse, ListPastMeetingParticipantsBranchListed, ListPastMeetingParticipantsBranchNotFound, ListPastMeetingParticipantsBranchProviderRejected, ListPastMeetingParticipantsDefinition, ListPastMeetingParticipantsInput, ListPastMeetingParticipantsMetadata, ListPastMeetingParticipantsOperation, type ListPastMeetingParticipantsStepConfig, Meeting, MeetingPage, ParticipantPage, ProviderID, UpdateMeetingBranch, UpdateMeetingBranchDefect, UpdateMeetingBranchNotFound, UpdateMeetingBranchProviderRejected, UpdateMeetingBranchUpdated, UpdateMeetingDefinition, UpdateMeetingInput, UpdateMeetingMetadata, UpdateMeetingOperation, type UpdateMeetingStepConfig, UpdatedMeeting, ZoomClient, type ZoomClientOptions, newCreateMeetingStep, newGetMeetingStep, newListMeetingsStep, newListPastMeetingParticipantsStep, newProjectConnection, newUpdateMeetingStep };
340
+ /** A meeting the previous poll did not list, such as a newly scheduled meeting. */
341
+ declare const MeetingChangeScheduled = "scheduled";
342
+ /**
343
+ * A listed meeting whose topic, type, start, duration, time zone, or listed agenda changed, such as a
344
+ * reschedule. A recurring meeting whose listed start moves to its next occurrence also arrives as updated.
345
+ */
346
+ declare const MeetingChangeUpdated = "updated";
347
+ /** A meeting the list no longer contains: it was deleted, or it expired after its scheduled time. */
348
+ declare const MeetingChangeRemoved = "removed";
349
+ /**
350
+ * The kind of one meetingChanged delivery. Zoom's meeting list reports no change type or modification time,
351
+ * so the kind comes from comparing two polls of the list.
352
+ */
353
+ declare const MeetingChangeKindSchema: z.ZodEnum<{
354
+ scheduled: "scheduled";
355
+ updated: "updated";
356
+ removed: "removed";
357
+ }>;
358
+ /** scheduled, updated, or removed. */
359
+ type MeetingChangeKind = z.infer<typeof MeetingChangeKindSchema>;
360
+ /**
361
+ * The meetingChanged binding configuration. The binding always watches the authorized user's own scheduled
362
+ * meetings, so Dex Web shows no field for it; an application may narrow the delivered kinds in code.
363
+ */
364
+ declare const MeetingChangedTriggerConfigurationSchema: z.ZodObject<{
365
+ changeKinds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
366
+ }, z.core.$strict>;
367
+ /** The meetingChanged binding configuration; the empty object delivers every kind. */
368
+ type MeetingChangedTriggerConfiguration = z.infer<typeof MeetingChangedTriggerConfigurationSchema>;
369
+ /**
370
+ * One meeting scheduled, updated, or removed between two polls of the authorized user's scheduled meetings;
371
+ * field names match the Go connector, so Go and TypeScript replicas share a binding's inbox.
372
+ */
373
+ declare const MeetingChangedEventSchema: z.ZodObject<{
374
+ changeKind: z.ZodEnum<{
375
+ scheduled: "scheduled";
376
+ updated: "updated";
377
+ removed: "removed";
378
+ }>;
379
+ meeting: z.ZodObject<{
380
+ id: z.ZodNumber;
381
+ uuid: z.ZodOptional<z.ZodString>;
382
+ hostId: z.ZodOptional<z.ZodString>;
383
+ topic: z.ZodString;
384
+ type: z.ZodOptional<z.ZodNumber>;
385
+ startTime: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
386
+ durationMinutes: z.ZodOptional<z.ZodNumber>;
387
+ timeZone: z.ZodOptional<z.ZodString>;
388
+ agenda: z.ZodOptional<z.ZodString>;
389
+ joinUrl: z.ZodOptional<z.ZodString>;
390
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
391
+ }, z.core.$strict>;
392
+ previousMeeting: z.ZodOptional<z.ZodObject<{
393
+ id: z.ZodNumber;
394
+ uuid: z.ZodOptional<z.ZodString>;
395
+ hostId: z.ZodOptional<z.ZodString>;
396
+ topic: z.ZodString;
397
+ type: z.ZodOptional<z.ZodNumber>;
398
+ startTime: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
399
+ durationMinutes: z.ZodOptional<z.ZodNumber>;
400
+ timeZone: z.ZodOptional<z.ZodString>;
401
+ agenda: z.ZodOptional<z.ZodString>;
402
+ joinUrl: z.ZodOptional<z.ZodString>;
403
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
404
+ }, z.core.$strict>>;
405
+ }, z.core.$strip>;
406
+ /** One meetingChanged delivery. */
407
+ type MeetingChangedEvent = z.infer<typeof MeetingChangedEventSchema>;
408
+
409
+ /** Manifest definition of meetingChanged. */
410
+ declare const MeetingChangedTriggerDefinition: TriggerDefinition;
411
+ /** One static application binding of meetingChanged. */
412
+ interface MeetingChangedTriggerBindingConfig {
413
+ /** Static connection name. */ connectionName: string;
414
+ /** Static binding name. */ bindingName: string;
415
+ /** Optional Connector Studio units; the binding has no field, because it always watches the authorized user. */ configurationUI?: ConnectorConfigurationUI;
416
+ }
417
+ /** Declare a static meetingChanged binding for Flow Definition tooling and Dex Web. */
418
+ declare function defineMeetingChangedTriggerBinding(config: MeetingChangedTriggerBindingConfig): TriggerBindingDefinition;
419
+ /** Binds one meetingChanged configuration to its application target and cursor. */
420
+ interface MeetingChangedTriggerRoute {
421
+ /** The stable application binding name, unique within the runner. */ bindingName: string;
422
+ /** Narrows the delivered change kinds; omitted delivers every kind. */ configuration?: MeetingChangedTriggerConfiguration;
423
+ /**
424
+ * Routes each change into the application. A target from newDurableTriggerTarget records each change before
425
+ * the cursor commits past it; any other target consumes it first.
426
+ */
427
+ target: TriggerTarget<MeetingChangedEvent>;
428
+ /**
429
+ * Stores the binding's meeting snapshot, such as LoadedProject.pollCursorStore. Omitted keeps it in memory,
430
+ * so every process start records a new baseline and changes made while stopped are lost.
431
+ */
432
+ cursor?: CursorStore;
433
+ }
434
+ /** Options of the meetingChanged runners. */
435
+ interface MeetingTriggerRunnerOptions {
436
+ /** Receives seed, reseed, poll failure, rate-limit, and inbox records, never payloads or credentials; omitted uses defaultTriggerLogger. */ logger?: TriggerLogger;
437
+ }
438
+ /**
439
+ * Create one poll Runner for the connection's meetingChanged bindings. Run replays each durable target,
440
+ * records the current meeting list as a baseline for a binding without a cursor, then lists every page of
441
+ * the authorized user's scheduled meetings each pollInterval with jitter and delivers the differences from
442
+ * the stored snapshot. A stored cursor that is undecodable or holds another Zoom user's meetings records a
443
+ * new baseline and logs a WARN record; differences in that gap are not delivered. A 429, including Zoom's
444
+ * daily-limit 429, pauses every binding of the connection for Retry-After, or backs off exponentially
445
+ * without it; other failures back off per binding up to 15 minutes. Delivery is at least once, and each
446
+ * change keeps one Trigger event ID across refetches. Throws for a connection without a ZoomClient, no
447
+ * routes, a blank binding name, a missing target, or an invalid configuration.
448
+ */
449
+ declare function newMeetingTriggerRunner(connection: Connection, routes: readonly MeetingChangedTriggerRoute[], options?: MeetingTriggerRunnerOptions): Runner;
450
+ /** Selects one meetingChanged binding saved in the project configuration. */
451
+ interface ProjectMeetingChangedTriggerRoute {
452
+ /** Names the saved binding. */ bindingName: string;
453
+ /** Routes each change into the application, usually newDexFlowTriggerTarget. */ target: TriggerTarget<MeetingChangedEvent>;
454
+ }
455
+ /**
456
+ * Create a durable Runner for meetingChanged bindings saved in the loaded project. connection is the one
457
+ * newProjectConnection opened from project. Each route loads its binding's saved configuration (an unsaved
458
+ * binding delivers every change kind) and records changes in the binding's project Trigger inbox before its
459
+ * meeting snapshot commits in the binding's project poll cursor, so a restarted or replaced replica neither
460
+ * misses nor repeats a change. Inbox payloads use the Go connector's JSON fields, so Go and TypeScript
461
+ * replicas share them. Throws for an invalid saved configuration and as newMeetingTriggerRunner does.
462
+ */
463
+ declare function newProjectMeetingTriggerRunner(project: LoadedProject, connection: Connection, routes: readonly ProjectMeetingChangedTriggerRoute[], options?: MeetingTriggerRunnerOptions): Runner;
464
+ /** Configuration of one in-memory meetingChanged Trigger. */
465
+ interface MeetingChangedTriggerConfig {
466
+ /** Zoom connection from newProjectConnection or newConnection with a ZoomClient. */ connection: Connection;
467
+ /** Static binding name. */ bindingName: string;
468
+ /** Narrows the delivered change kinds; omitted delivers every kind. */ configuration?: MeetingChangedTriggerConfiguration;
469
+ /** Routes accepted changes into the application. */ target: TriggerTarget<MeetingChangedEvent>;
470
+ /** Receives the Trigger's records; omitted uses defaultTriggerLogger. */ logger?: TriggerLogger;
471
+ }
472
+ /**
473
+ * Create a single meetingChanged TriggerRunner, as Go's generated NewMeetingChangedTrigger does. It has no
474
+ * project storage, so it keeps the cursor in memory and records a new baseline on every start; changes made
475
+ * while stopped are lost. Use newProjectMeetingTriggerRunner for durable delivery.
476
+ */
477
+ declare function newMeetingChangedTrigger(config: MeetingChangedTriggerConfig): TriggerRunner;
478
+ /** Decode a replayed inbox payload, written by a Go or TypeScript replica; throws for another payload. */
479
+ declare function decodeMeetingChangedEventPayload(payloadJSON: string): MeetingChangedEvent;
480
+
481
+ export { Config, Connection, ConnectorID, CreateMeetingBranch, CreateMeetingBranchCreated, CreateMeetingBranchDefect, CreateMeetingBranchProviderRejected, CreateMeetingBranchUncertain, CreateMeetingDefinition, CreateMeetingInput, CreateMeetingMetadata, CreateMeetingOperation, type CreateMeetingStepConfig, CredentialSource, Credentials, GetMeetingBranch, GetMeetingBranchDefect, GetMeetingBranchFound, GetMeetingBranchInvalidResponse, GetMeetingBranchNotFound, GetMeetingBranchProviderRejected, GetMeetingDefinition, GetMeetingInput, GetMeetingMetadata, GetMeetingOperation, type GetMeetingStepConfig, ListMeetingsBranch, ListMeetingsBranchDefect, ListMeetingsBranchInvalidResponse, ListMeetingsBranchListed, ListMeetingsBranchProviderRejected, ListMeetingsDefinition, ListMeetingsInput, ListMeetingsMetadata, ListMeetingsOperation, type ListMeetingsStepConfig, ListPastMeetingParticipantsBranch, ListPastMeetingParticipantsBranchDefect, ListPastMeetingParticipantsBranchInvalidResponse, ListPastMeetingParticipantsBranchListed, ListPastMeetingParticipantsBranchNotFound, ListPastMeetingParticipantsBranchProviderRejected, ListPastMeetingParticipantsDefinition, ListPastMeetingParticipantsInput, ListPastMeetingParticipantsMetadata, ListPastMeetingParticipantsOperation, type ListPastMeetingParticipantsStepConfig, Meeting, type MeetingChangeKind, MeetingChangeKindSchema, MeetingChangeRemoved, MeetingChangeScheduled, MeetingChangeUpdated, type MeetingChangedEvent, MeetingChangedEventSchema, type MeetingChangedTriggerBindingConfig, type MeetingChangedTriggerConfig, type MeetingChangedTriggerConfiguration, MeetingChangedTriggerConfigurationSchema, MeetingChangedTriggerDefinition, type MeetingChangedTriggerRoute, MeetingPage, type MeetingTriggerRunnerOptions, MinimumPollIntervalMs, ParticipantPage, type ProjectMeetingChangedTriggerRoute, ProviderID, UpdateMeetingBranch, UpdateMeetingBranchDefect, UpdateMeetingBranchNotFound, UpdateMeetingBranchProviderRejected, UpdateMeetingBranchUpdated, UpdateMeetingDefinition, UpdateMeetingInput, UpdateMeetingMetadata, UpdateMeetingOperation, type UpdateMeetingStepConfig, UpdatedMeeting, ZoomClient, type ZoomClientOptions, decodeMeetingChangedEventPayload, defineMeetingChangedTriggerBinding, newCreateMeetingStep, newGetMeetingStep, newListMeetingsStep, newListPastMeetingParticipantsStep, newMeetingChangedTrigger, newMeetingTriggerRunner, newProjectConnection, newProjectMeetingTriggerRunner, newUpdateMeetingStep };
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ import {
59
59
  newConnectionWithOperations,
60
60
  newProjectConnection,
61
61
  newProjectCredentialProvider
62
- } from "./chunk-IOSXDBUC.js";
62
+ } from "./chunk-RBP47TKQ.js";
63
63
 
64
64
  // src/generated/steps.ts
65
65
  import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
@@ -167,7 +167,8 @@ var Authorization = {
167
167
  "invalid_client",
168
168
  "invalid_grant",
169
169
  "unauthorized_client"
170
- ]
170
+ ],
171
+ "tokenExchangeTimeout": "8s"
171
172
  },
172
173
  "scopes": [
173
174
  "meeting:read:list_meetings",
@@ -762,23 +763,37 @@ var CreateMeetingOperation = class {
762
763
 
763
764
  // src/client.ts
764
765
  var defaultEndpoint = "https://api.zoom.us/v2";
766
+ var defaultPollIntervalMs = 12e4;
767
+ var MinimumPollIntervalMs = 3e4;
765
768
  var ZoomClient2 = class {
766
- /** Validate connection settings before a Step resolves credentials. */
769
+ /**
770
+ * Validate connection settings before a Step resolves credentials. An omitted or zero pollIntervalMs uses
771
+ * the manifest's two minutes; one under 30 seconds throws, as Go's New does.
772
+ */
767
773
  constructor(config, credentials, options = {}) {
768
774
  this.credentials = credentials;
769
775
  if (!credentials) throw new TypeError("Zoom credential provider is required");
770
776
  this.endpoint = validateBaseURL(config.endpoint || defaultEndpoint);
771
777
  this.maxResponseBytes = config.maxResponseBytes || 2097152;
772
778
  if (!Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes < 1) throw new TypeError("Zoom maxResponseBytes must be positive");
779
+ this.pollIntervalMs = config.pollIntervalMs || defaultPollIntervalMs;
780
+ if (!Number.isFinite(this.pollIntervalMs) || this.pollIntervalMs < MinimumPollIntervalMs) throw new TypeError("Zoom pollInterval must be at least 30s");
773
781
  this.send = options.send ?? sendProviderRequest;
774
782
  this.now = options.now ?? (() => /* @__PURE__ */ new Date());
775
783
  }
776
784
  credentials;
777
785
  endpoint;
778
786
  maxResponseBytes;
787
+ /** The meetingChanged Trigger's delay between polls in milliseconds; at least MinimumPollIntervalMs. */
788
+ pollIntervalMs;
779
789
  send;
780
790
  now;
791
+ /** The generated OAuth refresh policy every credential resolution uses, including Trigger polls. */
781
792
  refreshDriver = new ManifestCredentialRefreshDriver({ providerName: "Zoom", auth: Authorization, credentialFields: CredentialFields });
793
+ /** The client clock, used for receipts, Retry-After, and Trigger observation times. */
794
+ currentTime() {
795
+ return this.now();
796
+ }
782
797
  /** Bind the meeting list query. */
783
798
  listMeetings() {
784
799
  return new ListMeetingsOperation(this);
@@ -903,9 +918,435 @@ function newProjectConnection2(project, connectionName, options = {}) {
903
918
  const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "zoom" && entry.connectionName === name);
904
919
  if (!selected) throw new TypeError("Zoom project connection is not configured");
905
920
  const config = ConfigSchema.parse(selected.configuration);
906
- return new ZoomClient2({ ...config.endpoint !== void 0 ? { endpoint: config.endpoint } : {}, ...config.maxResponseBytes !== void 0 ? { maxResponseBytes: config.maxResponseBytes } : {} }, newProjectCredentialProvider(loadedProject, name, decodeCredentials, encodeCredentials, decodeSharedCredentials), options);
921
+ const pollIntervalMs = pollIntervalMilliseconds(selected.configuration.pollInterval);
922
+ return new ZoomClient2({
923
+ ...config.endpoint !== void 0 ? { endpoint: config.endpoint } : {},
924
+ ...config.maxResponseBytes !== void 0 ? { maxResponseBytes: config.maxResponseBytes } : {},
925
+ ...pollIntervalMs !== void 0 ? { pollIntervalMs } : {}
926
+ }, newProjectCredentialProvider(loadedProject, name, decodeCredentials, encodeCredentials, decodeSharedCredentials), options);
907
927
  });
908
928
  }
929
+ function pollIntervalMilliseconds(value) {
930
+ if (value === void 0 || value === null) return void 0;
931
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) throw new TypeError("Zoom configuration pollInterval has an invalid type");
932
+ return value / 1e6;
933
+ }
934
+
935
+ // src/meeting_snapshot.ts
936
+ import { createHash } from "crypto";
937
+ import { z } from "zod";
938
+ var MeetingChangeScheduled = "scheduled";
939
+ var MeetingChangeUpdated = "updated";
940
+ var MeetingChangeRemoved = "removed";
941
+ var MeetingChangeKindSchema = z.enum([MeetingChangeScheduled, MeetingChangeUpdated, MeetingChangeRemoved]);
942
+ var MeetingChangedTriggerConfigurationSchema = z.strictObject({
943
+ /**
944
+ * Limits deliveries to these kinds; empty delivers scheduled, updated, and removed. Skipped kinds still
945
+ * advance the stored snapshot, so they are never delivered later.
946
+ */
947
+ changeKinds: z.array(z.string()).nullable().optional()
948
+ }).superRefine((configuration, context) => {
949
+ const seen = /* @__PURE__ */ new Set();
950
+ for (const kind of configuration.changeKinds ?? []) {
951
+ if (!MeetingChangeKindSchema.safeParse(kind).success) context.addIssue({ code: "custom", message: `meetingChanged changeKinds entry ${JSON.stringify(kind)} must be scheduled, updated, or removed` });
952
+ else if (seen.has(kind)) context.addIssue({ code: "custom", message: `meetingChanged changeKinds repeats ${JSON.stringify(kind)}` });
953
+ seen.add(kind);
954
+ }
955
+ });
956
+ var MeetingChangedEventSchema = z.object({
957
+ /** The derived change kind. */
958
+ changeKind: MeetingChangeKindSchema,
959
+ /**
960
+ * The meeting as this poll listed it. For a removed meeting it is the last listed state, without uuid or
961
+ * joinUrl, which the stored snapshot never keeps.
962
+ */
963
+ meeting: MeetingSummarySchema,
964
+ /** The state the previous poll listed, without uuid or joinUrl; set only for updated. */
965
+ previousMeeting: MeetingSummarySchema.optional()
966
+ });
967
+ function deliversMeetingChange(configuration, kind) {
968
+ const kinds = configuration.changeKinds ?? [];
969
+ return kinds.length === 0 || kinds.includes(kind);
970
+ }
971
+ function goJSON(value) {
972
+ const text = typeof value === "string" ? JSON.stringify(wellFormed(value)) : JSON.stringify(value);
973
+ return text.replace(/[<>&\u2028\u2029]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
974
+ }
975
+ function trackedMeetingJSON(summary) {
976
+ const fields = [["id", summary.id]];
977
+ if (summary.hostId) fields.push(["hostId", summary.hostId]);
978
+ fields.push(["topic", summary.topic]);
979
+ if (summary.type) fields.push(["type", summary.type]);
980
+ if (summary.startTime) fields.push(["startTime", summary.startTime]);
981
+ if (summary.durationMinutes) fields.push(["durationMinutes", summary.durationMinutes]);
982
+ if (summary.timeZone) fields.push(["timeZone", summary.timeZone]);
983
+ if (summary.agenda) fields.push(["agenda", summary.agenda]);
984
+ if (summary.createdAt) fields.push(["createdAt", summary.createdAt]);
985
+ return Buffer.from(`{${fields.map(([name, value]) => `${goJSON(name)}:${goJSON(value)}`).join(",")}}`, "utf8");
986
+ }
987
+ function instantNanoseconds(timestamp) {
988
+ const [whole = "", fraction = ""] = timestamp.replace(/Z$/, "").split(".");
989
+ return BigInt(Date.parse(`${whole}Z`)) * 1000000n + BigInt(fraction.padEnd(9, "0").slice(0, 9) || "0");
990
+ }
991
+ function wellFormed(text) {
992
+ return text.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "\uFFFD");
993
+ }
994
+ var ListedMeeting = class {
995
+ /** Keep the listed summary beside its tracked JSON. */
996
+ constructor(summary) {
997
+ this.summary = summary;
998
+ this.value = trackedMeetingJSON(summary);
999
+ this.#hash = createHash("sha256").update(this.value).digest().subarray(0, 16).toString("hex");
1000
+ }
1001
+ summary;
1002
+ /** The tracked JSON, so a removal or update carries the last listed state. */
1003
+ value;
1004
+ #hash;
1005
+ /** The decimal meeting ID. */
1006
+ snapshotKey() {
1007
+ return String(this.summary.id);
1008
+ }
1009
+ /** The first 16 bytes of SHA-256 over the tracked fields. */
1010
+ snapshotHash() {
1011
+ return this.#hash;
1012
+ }
1013
+ /** The tracked JSON. */
1014
+ snapshotValue() {
1015
+ return this.value;
1016
+ }
1017
+ /** Order two listings of one meeting ID: the earlier start, then the smaller hash. */
1018
+ listsBefore(other) {
1019
+ const start2 = this.summary.startTime, otherStart = other.summary.startTime;
1020
+ if (start2 && otherStart) {
1021
+ const startNanoseconds = instantNanoseconds(start2), otherNanoseconds = instantNanoseconds(otherStart);
1022
+ if (startNanoseconds !== otherNanoseconds) return startNanoseconds < otherNanoseconds;
1023
+ } else if (!start2 !== !otherStart) return Boolean(start2);
1024
+ return this.#hash < other.#hash;
1025
+ }
1026
+ };
1027
+ var trackedMeetingSchema = z.object({
1028
+ id: z.number().int().positive(),
1029
+ hostId: z.string().nullish(),
1030
+ topic: z.string().nullish(),
1031
+ type: z.number().int().nullish(),
1032
+ startTime: z.string().nullish(),
1033
+ durationMinutes: z.number().int().nullish(),
1034
+ timeZone: z.string().nullish(),
1035
+ agenda: z.string().nullish(),
1036
+ createdAt: z.string().nullish()
1037
+ });
1038
+ function decodeTrackedMeeting(entry) {
1039
+ let tracked;
1040
+ try {
1041
+ tracked = trackedMeetingSchema.parse(JSON.parse(Buffer.from(entry.value ?? new Uint8Array()).toString("utf8")));
1042
+ } catch {
1043
+ throw new Error("stored Zoom meeting snapshot entry is invalid");
1044
+ }
1045
+ if (String(tracked.id) !== entry.key) throw new Error("stored Zoom meeting snapshot entry is invalid");
1046
+ const summary = { id: tracked.id, topic: tracked.topic ?? "" };
1047
+ if (tracked.hostId) summary.hostId = tracked.hostId;
1048
+ if (tracked.type) summary.type = tracked.type;
1049
+ if (tracked.startTime) summary.startTime = tracked.startTime;
1050
+ if (tracked.durationMinutes) summary.durationMinutes = tracked.durationMinutes;
1051
+ if (tracked.timeZone) summary.timeZone = tracked.timeZone;
1052
+ if (tracked.agenda) summary.agenda = tracked.agenda;
1053
+ if (tracked.createdAt) summary.createdAt = tracked.createdAt;
1054
+ return summary;
1055
+ }
1056
+ function meetingChangeId(kind, key, previous, currentHash, sequence) {
1057
+ const parts = [kind, key, currentHash];
1058
+ if (previous) parts.push(previous.hash, String(previous.seen));
1059
+ else if (sequence > 0) parts.push(String(sequence));
1060
+ const digest = createHash("sha256").update(wellFormed(parts.join("\0")), "utf8").digest();
1061
+ return `zoom-meeting-${digest.subarray(0, 16).toString("hex")}`;
1062
+ }
1063
+ function newMeetingChangedTriggerEvent(previous, currentHash, sequence, payload, observedAt) {
1064
+ const key = String(payload.meeting.id);
1065
+ const occurredAt = payload.changeKind === MeetingChangeScheduled && payload.meeting.createdAt ? new Date(payload.meeting.createdAt) : observedAt;
1066
+ return { id: meetingChangeId(payload.changeKind, key, previous, currentHash, sequence), occurredAt, payload };
1067
+ }
1068
+
1069
+ // src/trigger.ts
1070
+ import {
1071
+ mustTriggerBindingDefinition,
1072
+ newTrigger
1073
+ } from "@superdurable/connectors-sdk";
1074
+ import { newBindingPoller, newBindingTriggerSource, newMemoryCursorStore, newRunner } from "@superdurable/connectors-sdk/pollingtrigger";
1075
+ import { ObjectNotFoundError, decodeTriggerConfiguration, newDurableTriggerTarget } from "@superdurable/connectors-sdk/projectconfig";
1076
+
1077
+ // src/meeting_list_fetcher.ts
1078
+ import { ReauthorizationRequiredError as ReauthorizationRequiredError2, TriggerDeliveryAbortedError, resolveCredential as resolveCredential2 } from "@superdurable/connectors-sdk";
1079
+ import {
1080
+ DefaultKeyedSnapshotEntries,
1081
+ applyKeyedSnapshotChanges,
1082
+ diffKeyedSnapshot,
1083
+ markCursorInvalid,
1084
+ markRateLimited,
1085
+ newTriggerCredentialCall,
1086
+ waitForPollRequest
1087
+ } from "@superdurable/connectors-sdk/pollingtrigger";
1088
+ import { isHeaderSafeCredential as isHeaderSafeCredential2 } from "@superdurable/connectors-sdk/providerhttp";
1089
+ var meetingListCursorVersion = 1;
1090
+ var maximumPageSize = 300;
1091
+ var maximumMeetingListPages = Math.floor(DefaultKeyedSnapshotEntries / maximumPageSize) + 2;
1092
+ var MeetingChangesPerPage = 100;
1093
+ var MeetingSnapshotOptions = { keepValues: true };
1094
+ var PageTokenRejectedError = class extends Error {
1095
+ };
1096
+ function encodeMeetingListCursor(position) {
1097
+ const fields = [`"version":${position.version}`];
1098
+ if (position.hostId) fields.push(`"hostId":${goJSON(position.hostId)}`);
1099
+ if (position.sequence) fields.push(`"sequence":${position.sequence}`);
1100
+ return `{${fields.join(",")}}`;
1101
+ }
1102
+ function decodeMeetingListCursor(token) {
1103
+ let value;
1104
+ try {
1105
+ value = responseObjectOrNull(token);
1106
+ } catch {
1107
+ return void 0;
1108
+ }
1109
+ if (value === null) return { version: 0, hostId: "", sequence: 0 };
1110
+ const raw = value;
1111
+ try {
1112
+ const hostId = raw.hostId ?? "";
1113
+ if (typeof hostId !== "string") return void 0;
1114
+ return { version: integer(raw.version), hostId, sequence: integer(raw.sequence) };
1115
+ } catch {
1116
+ return void 0;
1117
+ }
1118
+ }
1119
+ function responseObjectOrNull(token) {
1120
+ if (token.trim() === "null") return null;
1121
+ return responseObject(Buffer.from(token, "utf8"));
1122
+ }
1123
+ function soleHostId(listing) {
1124
+ return listing.hostIds.size === 1 ? [...listing.hostIds][0] : "";
1125
+ }
1126
+ var compareKeys = (left, right) => Buffer.compare(Buffer.from(left), Buffer.from(right));
1127
+ var MeetingListFetcher = class {
1128
+ /** Bind the client, connection, Trigger identity, and validated configuration. */
1129
+ constructor(client, connection, trigger, configuration) {
1130
+ this.client = client;
1131
+ this.connection = connection;
1132
+ this.trigger = trigger;
1133
+ this.configuration = configuration;
1134
+ }
1135
+ client;
1136
+ connection;
1137
+ trigger;
1138
+ configuration;
1139
+ /** List every scheduled meeting and keep the listing as the baseline without delivering it. */
1140
+ async seedCursor(context) {
1141
+ const listing = await this.listAllMeetings(context);
1142
+ const diff = withMessagePrefix("Zoom meeting baseline", () => diffKeyedSnapshot(void 0, listing.meetings, MeetingSnapshotOptions));
1143
+ return { token: encodeMeetingListCursor({ version: meetingListCursorVersion, hostId: soleHostId(listing), sequence: 0 }), snapshot: diff.next };
1144
+ }
1145
+ /** Return up to MeetingChangesPerPage snapshot differences; a foreign or undecodable cursor reseeds. */
1146
+ async fetchChanges(context, cursor) {
1147
+ const position = decodeMeetingListCursor(cursor.token);
1148
+ if (!position || position.version !== meetingListCursorVersion || !cursor.snapshot) throw markCursorInvalid(new Error("Zoom meeting list cursor is not decodable"));
1149
+ const listing = await this.listAllMeetings(context);
1150
+ if (position.hostId && listing.meetings.length > 0 && !listing.hostIds.has(position.hostId)) {
1151
+ throw markCursorInvalid(new Error("Zoom meeting list belongs to another Zoom user than the stored snapshot"));
1152
+ }
1153
+ if (!position.hostId) position.hostId = soleHostId(listing);
1154
+ const stored = cursor.snapshot;
1155
+ const diff = withMessagePrefix("Zoom meeting snapshot", () => diffKeyedSnapshot(stored, listing.meetings, MeetingSnapshotOptions));
1156
+ let changes = orderedMeetingChanges(diff, listing);
1157
+ let next = diff.next, hasMorePages = false;
1158
+ const sequence = position.sequence;
1159
+ if (changes.length > 0) position.sequence++;
1160
+ if (changes.length > MeetingChangesPerPage) {
1161
+ changes = changes.slice(0, MeetingChangesPerPage);
1162
+ hasMorePages = true;
1163
+ next = applyMeetingChanges(stored, changes);
1164
+ }
1165
+ const observedAt = this.client.currentTime();
1166
+ const events = changes.filter((change) => deliversMeetingChange(this.configuration, change.kind)).map((change) => changeTriggerEvent(change, sequence, observedAt));
1167
+ return { changes: events, next: { token: encodeMeetingListCursor(position), snapshot: next }, hasMorePages };
1168
+ }
1169
+ // Zoom expires page tokens after 15 minutes, so a 400 on a later page restarts the listing once.
1170
+ async listAllMeetings(context) {
1171
+ try {
1172
+ return await this.doListAllMeetings(context);
1173
+ } catch (error) {
1174
+ if (!(error instanceof PageTokenRejectedError)) throw error;
1175
+ }
1176
+ try {
1177
+ return await this.doListAllMeetings(context);
1178
+ } catch (error) {
1179
+ if (error instanceof PageTokenRejectedError) throw new Error(error.message);
1180
+ throw error;
1181
+ }
1182
+ }
1183
+ async doListAllMeetings(context) {
1184
+ const listing = { meetings: [], byKey: /* @__PURE__ */ new Map(), hostIds: /* @__PURE__ */ new Set() };
1185
+ const requestedPageTokens = /* @__PURE__ */ new Set();
1186
+ let currentPageToken = "";
1187
+ for (let pageNumber = 0; pageNumber < maximumMeetingListPages; pageNumber++) {
1188
+ const listed = await this.listMeetingPage(context, currentPageToken);
1189
+ for (const summary of listed.meetings ?? []) {
1190
+ const meeting = new ListedMeeting(summary), key = meeting.snapshotKey();
1191
+ const existing = listing.byKey.get(key);
1192
+ if (!existing || meeting.listsBefore(existing)) listing.byKey.set(key, meeting);
1193
+ if (summary.hostId) listing.hostIds.add(summary.hostId);
1194
+ }
1195
+ if (!listed.nextPageToken) {
1196
+ listing.meetings = [...listing.byKey.keys()].sort(compareKeys).map((key) => listing.byKey.get(key));
1197
+ return listing;
1198
+ }
1199
+ if (requestedPageTokens.has(listed.nextPageToken)) throw new Error("Zoom meeting list repeated a page token");
1200
+ requestedPageTokens.add(listed.nextPageToken);
1201
+ currentPageToken = listed.nextPageToken;
1202
+ }
1203
+ throw new Error(`Zoom meeting list exceeded ${maximumMeetingListPages} pages`);
1204
+ }
1205
+ /** Send one List meetings request; a 400 to a page token rejects with PageTokenRejectedError. */
1206
+ async listMeetingPage(context, currentPageToken) {
1207
+ await waitForPollRequest(context);
1208
+ const call = newTriggerCredentialCall(this.connection, this.trigger, context.signal);
1209
+ const credentials = await this.resolveCredentials(call, context.signal);
1210
+ const query = new URLSearchParams({ type: "scheduled", page_size: String(maximumPageSize) });
1211
+ if (currentPageToken) query.set("next_page_token", currentPageToken);
1212
+ const exchange = await this.client.exchange(call, credentials, "GET", "/users/me/meetings", query, void 0, false, context.signal);
1213
+ if (context.signal.aborted) throw new TriggerDeliveryAbortedError();
1214
+ if ("error" in exchange) throw new Error("Zoom meeting list request could not reach Zoom");
1215
+ if (currentPageToken && exchange.response.status === 400) throw new PageTokenRejectedError("Zoom rejected the meeting list page token with HTTP 400");
1216
+ const classified = classify(this.client, "listMeetings", exchange);
1217
+ if (classified.outcome !== "usable") {
1218
+ const failure = new Error(`Zoom meeting list request: ${classified.failure?.message ?? "Zoom returned an unusable meeting page"}`);
1219
+ if (exchange.response.status === 429) throw markRateLimited(failure, this.client.retryAfter(exchange.response.headers));
1220
+ throw failure;
1221
+ }
1222
+ try {
1223
+ return decodeMeetingPage(exchange.response.body);
1224
+ } catch {
1225
+ throw new Error("Zoom returned an unusable meeting page");
1226
+ }
1227
+ }
1228
+ async resolveCredentials(call, signal) {
1229
+ let credentials;
1230
+ try {
1231
+ credentials = await resolveCredential2(this.client.credentials, call, this.client.refreshDriver, signal);
1232
+ } catch (error) {
1233
+ if (error instanceof ReauthorizationRequiredError2) throw new Error("Zoom connection requires reauthorization; reconnect the connection");
1234
+ throw new Error("Zoom Trigger credentials are unavailable");
1235
+ }
1236
+ if (!credentials.accessToken || !isHeaderSafeCredential2(credentials.accessToken.reveal())) throw new Error("Zoom Trigger credentials are unavailable");
1237
+ return credentials;
1238
+ }
1239
+ };
1240
+ function decodeMeetingPage(body) {
1241
+ const raw = responseObject(body), total = integer(raw.total_records), next = raw.next_page_token ?? "";
1242
+ if (total < 0 || typeof next !== "string" || raw.meetings !== void 0 && raw.meetings !== null && !Array.isArray(raw.meetings)) throw new TypeError("invalid page");
1243
+ pageToken(next);
1244
+ const meetings = (raw.meetings ?? []).map((item) => meetingSummary(decodeMeeting(item)));
1245
+ return { meetings, totalRecords: total, ...next ? { nextPageToken: next } : {} };
1246
+ }
1247
+ function withMessagePrefix(prefix, compute) {
1248
+ try {
1249
+ return compute();
1250
+ } catch (error) {
1251
+ if (error instanceof Error) error.message = `${prefix}: ${error.message}`;
1252
+ throw error;
1253
+ }
1254
+ }
1255
+ function orderedMeetingChanges(diff, listing) {
1256
+ const changes = [
1257
+ ...diff.added.map((added) => ({ kind: MeetingChangeScheduled, key: added.key, current: listing.byKey.get(added.key) })),
1258
+ ...diff.changed.map((changed) => ({ kind: MeetingChangeUpdated, key: changed.current.key, previous: changed.previous, current: listing.byKey.get(changed.current.key) })),
1259
+ ...diff.removed.map((removed) => ({ kind: MeetingChangeRemoved, key: removed.key, previous: removed }))
1260
+ ];
1261
+ return changes.sort((left, right) => compareKeys(left.key, right.key));
1262
+ }
1263
+ function applyMeetingChanges(previous, changes) {
1264
+ const upserted = changes.flatMap((change) => change.current ? [change.current] : []);
1265
+ const removedKeys = changes.filter((change) => change.kind === MeetingChangeRemoved).map((change) => change.key);
1266
+ return withMessagePrefix("Zoom meeting snapshot", () => applyKeyedSnapshotChanges(previous, upserted, removedKeys, MeetingSnapshotOptions));
1267
+ }
1268
+ function changeTriggerEvent(change, sequence, observedAt) {
1269
+ const payload = { changeKind: change.kind, meeting: change.current?.summary ?? { id: 0, topic: "" } };
1270
+ if (change.previous) {
1271
+ const previous = decodeTrackedMeeting(change.previous);
1272
+ if (change.kind === MeetingChangeRemoved) payload.meeting = previous;
1273
+ else payload.previousMeeting = previous;
1274
+ }
1275
+ return newMeetingChangedTriggerEvent(change.previous, change.current?.snapshotHash() ?? "", sequence, payload, observedAt);
1276
+ }
1277
+
1278
+ // src/trigger.ts
1279
+ var MeetingChangedTriggerDefinition = {
1280
+ trigger: { connectorId: ConnectorID, triggerName: "meetingChanged" },
1281
+ description: "Receive each meeting the authorized user schedules, changes, or that leaves Zoom's scheduled list, found by comparing each poll of List meetings with the last; the first run records a baseline and delivers no existing meetings."
1282
+ };
1283
+ function defineMeetingChangedTriggerBinding(config) {
1284
+ return mustTriggerBindingDefinition({ definition: MeetingChangedTriggerDefinition, ...config });
1285
+ }
1286
+ function newMeetingTriggerRunner(connection, routes, options = {}) {
1287
+ const client = zoomClientOf(connection);
1288
+ if (!routes?.length) throw new TypeError("Zoom meetingChanged routes are required");
1289
+ const pollers = routes.map((route) => {
1290
+ if (!route?.bindingName?.trim() || !route.target) throw new TypeError("Zoom meetingChanged binding name and target are required");
1291
+ const configuration = parseConfiguration(route.configuration ?? {});
1292
+ return newBindingPoller({
1293
+ definition: MeetingChangedTriggerDefinition,
1294
+ binding: { connection: connection.reference, trigger: MeetingChangedTriggerDefinition.trigger, name: route.bindingName },
1295
+ cursor: route.cursor ?? newMemoryCursorStore(),
1296
+ fetcher: new MeetingListFetcher(client, connection.reference, MeetingChangedTriggerDefinition.trigger, configuration),
1297
+ target: route.target,
1298
+ snapshot: MeetingSnapshotOptions
1299
+ });
1300
+ });
1301
+ return newRunner({ connection: connection.reference, schedule: pollSchedule(client), pollers, ...options.logger ? { logger: options.logger } : {} });
1302
+ }
1303
+ function newProjectMeetingTriggerRunner(project, connection, routes, options = {}) {
1304
+ if (!project) throw new TypeError("Zoom meetingChanged runner requires the loaded project configuration");
1305
+ const durableRoutes = (routes ?? []).map((route) => {
1306
+ if (!route?.target) throw new TypeError(`Zoom meetingChanged binding ${JSON.stringify(route?.bindingName)} target is required`);
1307
+ const key = { connectorId: ConnectorID, connectionName: connection.reference.name, triggerName: MeetingChangedTriggerDefinition.trigger.triggerName, bindingName: route.bindingName };
1308
+ let configuration = {};
1309
+ try {
1310
+ configuration = decodeTriggerConfiguration(project.configuration, key, MeetingChangedTriggerConfigurationSchema);
1311
+ } catch (error) {
1312
+ if (!(error instanceof ObjectNotFoundError)) throw new TypeError(`zoom meetingChanged binding ${JSON.stringify(route.bindingName)} configuration: ${error instanceof Error ? error.message : String(error)}`);
1313
+ }
1314
+ const target = newDurableTriggerTarget(project.triggerInbox(key), key, route.target, { decodePayload: decodeMeetingChangedEventPayload, ...options.logger ? { logger: options.logger } : {} });
1315
+ return { bindingName: route.bindingName, configuration, target, cursor: project.pollCursorStore(key) };
1316
+ });
1317
+ return newMeetingTriggerRunner(connection, durableRoutes, options);
1318
+ }
1319
+ function newMeetingChangedTrigger(config) {
1320
+ const client = zoomClientOf(config.connection);
1321
+ if (!config.bindingName?.trim() || !config.target) throw new TypeError("Zoom meetingChanged binding name and target are required");
1322
+ const configuration = parseConfiguration(config.configuration ?? {});
1323
+ const binding = { connection: config.connection.reference, trigger: MeetingChangedTriggerDefinition.trigger, name: config.bindingName };
1324
+ const source = newBindingTriggerSource({
1325
+ definition: MeetingChangedTriggerDefinition,
1326
+ binding,
1327
+ cursor: newMemoryCursorStore(),
1328
+ fetcher: new MeetingListFetcher(client, config.connection.reference, MeetingChangedTriggerDefinition.trigger, configuration),
1329
+ snapshot: MeetingSnapshotOptions
1330
+ }, pollSchedule(client), config.logger);
1331
+ return newTrigger({ definition: MeetingChangedTriggerDefinition, binding, source, target: config.target, ...config.logger ? { logger: config.logger } : {} });
1332
+ }
1333
+ function decodeMeetingChangedEventPayload(payloadJSON) {
1334
+ const parsed = MeetingChangedEventSchema.safeParse(JSON.parse(payloadJSON));
1335
+ if (!parsed.success) throw new TypeError("stored Zoom meetingChanged payload is invalid");
1336
+ return parsed.data;
1337
+ }
1338
+ function parseConfiguration(configuration) {
1339
+ const parsed = MeetingChangedTriggerConfigurationSchema.safeParse(configuration);
1340
+ if (!parsed.success) throw new TypeError(`zoom meetingChanged configuration: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
1341
+ return parsed.data;
1342
+ }
1343
+ function zoomClientOf(connection) {
1344
+ if (!(connection?.operations instanceof ZoomClient2)) throw new TypeError("Zoom meetingChanged Trigger requires a connection from newProjectConnection or newConnection with a ZoomClient");
1345
+ return connection.operations;
1346
+ }
1347
+ function pollSchedule(client) {
1348
+ return { intervalMs: client.pollIntervalMs };
1349
+ }
909
1350
  export {
910
1351
  ConfigSchema,
911
1352
  Connection,
@@ -948,12 +1389,20 @@ export {
948
1389
  ListPastMeetingParticipantsInputSchema,
949
1390
  ListPastMeetingParticipantsMetadata,
950
1391
  ListPastMeetingParticipantsOperation,
1392
+ MeetingChangeKindSchema,
1393
+ MeetingChangeRemoved,
1394
+ MeetingChangeScheduled,
1395
+ MeetingChangeUpdated,
1396
+ MeetingChangedEventSchema,
1397
+ MeetingChangedTriggerConfigurationSchema,
1398
+ MeetingChangedTriggerDefinition,
951
1399
  MeetingPageSchema,
952
1400
  MeetingParticipantSchema,
953
1401
  MeetingSchema,
954
1402
  MeetingSettingsInputSchema,
955
1403
  MeetingSettingsSchema,
956
1404
  MeetingSummarySchema,
1405
+ MinimumPollIntervalMs,
957
1406
  ParticipantPageSchema,
958
1407
  ProviderID,
959
1408
  UpdateMeetingBranch,
@@ -968,13 +1417,18 @@ export {
968
1417
  UpdatedMeetingSchema,
969
1418
  ZoomClient2 as ZoomClient,
970
1419
  decodeCredentials,
1420
+ decodeMeetingChangedEventPayload,
971
1421
  decodeSharedCredentials,
1422
+ defineMeetingChangedTriggerBinding,
972
1423
  newConnection,
973
1424
  newConnectionWithOperations,
974
1425
  newCreateMeetingStep,
975
1426
  newGetMeetingStep,
976
1427
  newListMeetingsStep,
977
1428
  newListPastMeetingParticipantsStep,
1429
+ newMeetingChangedTrigger,
1430
+ newMeetingTriggerRunner,
978
1431
  newProjectConnection2 as newProjectConnection,
1432
+ newProjectMeetingTriggerRunner,
979
1433
  newUpdateMeetingStep
980
1434
  };
package/dist/mock.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
2
2
  import { Failure } from '@superdurable/connectors-sdk';
3
- import { O as Operations, a as Connection, L as ListMeetingsInput, b as MeetingPage, G as GetMeetingInput, M as Meeting, C as CreateMeetingInput, U as UpdateMeetingInput, d as UpdatedMeeting, c as ListPastMeetingParticipantsInput, P as ParticipantPage, n as MeetingParticipant, q as MeetingSettings, r as MeetingSettingsInput, u as MeetingSummary } from './connection-4reP5njk.js';
3
+ import { O as Operations, a as Connection, L as ListMeetingsInput, b as MeetingPage, G as GetMeetingInput, M as Meeting, C as CreateMeetingInput, U as UpdateMeetingInput, d as UpdatedMeeting, c as ListPastMeetingParticipantsInput, P as ParticipantPage, n as MeetingParticipant, q as MeetingSettings, r as MeetingSettingsInput, u as MeetingSummary } from './connection-Cq-pg7cw.js';
4
4
  import 'zod';
5
5
 
6
6
  /** Go zero value for ListMeetingsInput in scripted cases. */
package/dist/mock.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  UpdateMeetingInputSchema,
21
21
  UpdatedMeetingSchema,
22
22
  newConnectionWithOperations
23
- } from "./chunk-IOSXDBUC.js";
23
+ } from "./chunk-RBP47TKQ.js";
24
24
 
25
25
  // src/generated/mock.ts
26
26
  import { branchCase, retryCase, uncertainCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdurable/connector-zoom",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Zoom meeting operations for Dex",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,8 @@
25
25
  "./mock": {
26
26
  "types": "./dist/mock.d.ts",
27
27
  "import": "./dist/mock.js"
28
- }
28
+ },
29
+ "./dex-connector.json": "./dex-connector.json"
29
30
  },
30
31
  "files": [
31
32
  "dist",
@@ -42,11 +43,12 @@
42
43
  "check": "npm test && npm run typecheck && npm run lint",
43
44
  "example:meeting-list": "npm run build && tsx examples/meeting-list/main.ts",
44
45
  "example:meeting-list:integration": "npm run build && tsx examples/meeting-list/integration.ts",
45
- "example:meeting-list:start": "npm run build && tsx examples/meeting-list/start.ts"
46
+ "example:meeting-list:start": "npm run build && tsx examples/meeting-list/start.ts",
47
+ "example:meeting-changed": "npm run build && tsx examples/meeting-changed/main.ts"
46
48
  },
47
49
  "dependencies": {
48
- "@superdurable/connectors-sdk": "0.7.0",
49
- "@superdurable/dex": ">=1.28.0",
50
+ "@superdurable/connectors-sdk": "0.12.0",
51
+ "@superdurable/dex": ">=1.45.4",
50
52
  "zod": "^4.1.0"
51
53
  },
52
54
  "devDependencies": {