@corsair-dev/ably 0.1.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.
@@ -0,0 +1,507 @@
1
+ import type { AuthTypes, BindEndpoints, BindWebhooks, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, KeyBuilderContext, PickAuth, PluginPermissionsConfig } from 'corsair/core';
2
+ import type { AblyEndpointInputs, AblyEndpointOutputs } from './endpoints/types';
3
+ import { AblySchema } from './schema';
4
+ export type AblyPluginOptions = {
5
+ authType?: PickAuth<'api_key'>;
6
+ key?: string;
7
+ hooks?: InternalAblyPlugin['hooks'];
8
+ webhookHooks?: InternalAblyPlugin['webhookHooks'];
9
+ errorHandlers?: CorsairErrorHandler;
10
+ permissions?: PluginPermissionsConfig<typeof ablyEndpointsNested>;
11
+ };
12
+ export type AblyContext = CorsairPluginContext<typeof AblySchema, AblyPluginOptions>;
13
+ export type AblyKeyBuilderContext = KeyBuilderContext<AblyPluginOptions>;
14
+ export type AblyBoundEndpoints = BindEndpoints<typeof ablyEndpointsNested>;
15
+ type AblyEndpoint<K extends keyof AblyEndpointOutputs> = CorsairEndpoint<AblyContext, AblyEndpointInputs[K], AblyEndpointOutputs[K]>;
16
+ export type AblyEndpoints = {
17
+ publishBatchMessages: AblyEndpoint<'publishBatchMessages'>;
18
+ getChannelDetails: AblyEndpoint<'getChannelDetails'>;
19
+ getChannelHistory: AblyEndpoint<'getChannelHistory'>;
20
+ getChannelPresence: AblyEndpoint<'getChannelPresence'>;
21
+ getPresenceHistory: AblyEndpoint<'getPresenceHistory'>;
22
+ getMessageVersions: AblyEndpoint<'getMessageVersions'>;
23
+ listChannels: AblyEndpoint<'listChannels'>;
24
+ publishMessageToChannel: AblyEndpoint<'publishMessageToChannel'>;
25
+ batchPresence: AblyEndpoint<'batchPresence'>;
26
+ batchPresenceHistory: AblyEndpoint<'batchPresenceHistory'>;
27
+ getServiceTime: AblyEndpoint<'getServiceTime'>;
28
+ getStats: AblyEndpoint<'getStats'>;
29
+ requestAccessToken: AblyEndpoint<'requestAccessToken'>;
30
+ publishPushNotificationsBatch: AblyEndpoint<'publishPushNotificationsBatch'>;
31
+ deleteChannelSubscription: AblyEndpoint<'deleteChannelSubscription'>;
32
+ createPushChannelSubscription: AblyEndpoint<'createPushChannelSubscription'>;
33
+ getPushDevice: AblyEndpoint<'getPushDevice'>;
34
+ listPushChannelSubscriptions: AblyEndpoint<'listPushChannelSubscriptions'>;
35
+ listPushChannels: AblyEndpoint<'listPushChannels'>;
36
+ listRegisteredPushDevices: AblyEndpoint<'listRegisteredPushDevices'>;
37
+ patchPushDeviceRegistration: AblyEndpoint<'patchPushDeviceRegistration'>;
38
+ publishPushNotification: AblyEndpoint<'publishPushNotification'>;
39
+ registerPushDevice: AblyEndpoint<'registerPushDevice'>;
40
+ unregisterAllPushDevices: AblyEndpoint<'unregisterAllPushDevices'>;
41
+ unregisterPushDevice: AblyEndpoint<'unregisterPushDevice'>;
42
+ updatePushDevice: AblyEndpoint<'updatePushDevice'>;
43
+ };
44
+ export type AblyWebhooks = Record<string, never>;
45
+ export type AblyBoundWebhooks = BindWebhooks<AblyWebhooks>;
46
+ declare const ablyEndpointsNested: {
47
+ readonly application: {
48
+ readonly getServiceTime: AblyEndpoint<"getServiceTime">;
49
+ readonly getStats: AblyEndpoint<"getStats">;
50
+ readonly requestAccessToken: AblyEndpoint<"requestAccessToken">;
51
+ };
52
+ readonly channels: {
53
+ readonly publishBatchMessages: AblyEndpoint<"publishBatchMessages">;
54
+ readonly getChannelDetails: AblyEndpoint<"getChannelDetails">;
55
+ readonly getChannelHistory: AblyEndpoint<"getChannelHistory">;
56
+ readonly getChannelPresence: AblyEndpoint<"getChannelPresence">;
57
+ readonly getPresenceHistory: AblyEndpoint<"getPresenceHistory">;
58
+ readonly getMessageVersions: AblyEndpoint<"getMessageVersions">;
59
+ readonly listChannels: AblyEndpoint<"listChannels">;
60
+ readonly publishMessageToChannel: AblyEndpoint<"publishMessageToChannel">;
61
+ readonly batchPresence: AblyEndpoint<"batchPresence">;
62
+ readonly batchPresenceHistory: AblyEndpoint<"batchPresenceHistory">;
63
+ };
64
+ readonly push: {
65
+ readonly publishPushNotificationsBatch: AblyEndpoint<"publishPushNotificationsBatch">;
66
+ readonly deleteChannelSubscription: AblyEndpoint<"deleteChannelSubscription">;
67
+ readonly createPushChannelSubscription: AblyEndpoint<"createPushChannelSubscription">;
68
+ readonly getPushDevice: AblyEndpoint<"getPushDevice">;
69
+ readonly listPushChannelSubscriptions: AblyEndpoint<"listPushChannelSubscriptions">;
70
+ readonly listPushChannels: AblyEndpoint<"listPushChannels">;
71
+ readonly listRegisteredPushDevices: AblyEndpoint<"listRegisteredPushDevices">;
72
+ readonly patchPushDeviceRegistration: AblyEndpoint<"patchPushDeviceRegistration">;
73
+ readonly publishPushNotification: AblyEndpoint<"publishPushNotification">;
74
+ readonly registerPushDevice: AblyEndpoint<"registerPushDevice">;
75
+ readonly unregisterAllPushDevices: AblyEndpoint<"unregisterAllPushDevices">;
76
+ readonly unregisterPushDevice: AblyEndpoint<"unregisterPushDevice">;
77
+ readonly updatePushDevice: AblyEndpoint<"updatePushDevice">;
78
+ };
79
+ };
80
+ declare const ablyWebhooksNested: {};
81
+ export declare const ablyEndpointSchemas: {
82
+ readonly 'application.getServiceTime': {
83
+ readonly input: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
84
+ readonly output: import("zod").ZodArray<import("zod").ZodNumber>;
85
+ };
86
+ readonly 'application.getStats': {
87
+ readonly input: import("zod").ZodObject<{
88
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
89
+ start: import("zod").ZodOptional<import("zod").ZodNumber>;
90
+ end: import("zod").ZodOptional<import("zod").ZodNumber>;
91
+ direction: import("zod").ZodOptional<import("zod").ZodEnum<{
92
+ forwards: "forwards";
93
+ backwards: "backwards";
94
+ }>>;
95
+ unit: import("zod").ZodOptional<import("zod").ZodEnum<{
96
+ minute: "minute";
97
+ hour: "hour";
98
+ day: "day";
99
+ month: "month";
100
+ }>>;
101
+ }, import("zod/v4/core").$strip>;
102
+ readonly output: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
103
+ };
104
+ readonly 'application.requestAccessToken': {
105
+ readonly input: import("zod").ZodObject<{
106
+ keyName: import("zod").ZodString;
107
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
108
+ ttl: import("zod").ZodOptional<import("zod").ZodNumber>;
109
+ capability: import("zod").ZodOptional<import("zod").ZodString>;
110
+ }, import("zod/v4/core").$strip>;
111
+ readonly output: import("zod").ZodObject<{
112
+ token: import("zod").ZodString;
113
+ expires: import("zod").ZodOptional<import("zod").ZodNumber>;
114
+ issued: import("zod").ZodOptional<import("zod").ZodNumber>;
115
+ capability: import("zod").ZodOptional<import("zod").ZodString>;
116
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
117
+ }, import("zod/v4/core").$loose>;
118
+ };
119
+ readonly 'channels.publishBatchMessages': {
120
+ readonly input: import("zod").ZodObject<{
121
+ messages: import("zod").ZodArray<import("zod").ZodObject<{
122
+ channels: import("zod").ZodArray<import("zod").ZodString>;
123
+ messages: import("zod").ZodArray<import("zod").ZodObject<{
124
+ id: import("zod").ZodOptional<import("zod").ZodString>;
125
+ name: import("zod").ZodOptional<import("zod").ZodString>;
126
+ data: import("zod").ZodOptional<import("zod").ZodUnknown>;
127
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
128
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
129
+ timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
130
+ encoding: import("zod").ZodOptional<import("zod").ZodString>;
131
+ extras: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
132
+ }, import("zod/v4/core").$loose>>;
133
+ }, import("zod/v4/core").$strip>>;
134
+ }, import("zod/v4/core").$strip>;
135
+ readonly output: import("zod").ZodArray<import("zod").ZodUnknown>;
136
+ };
137
+ readonly 'channels.getChannelDetails': {
138
+ readonly input: import("zod").ZodObject<{
139
+ channelId: import("zod").ZodString;
140
+ }, import("zod/v4/core").$strip>;
141
+ readonly output: import("zod").ZodObject<{
142
+ channelId: import("zod").ZodOptional<import("zod").ZodString>;
143
+ status: import("zod").ZodOptional<import("zod").ZodObject<{
144
+ isActive: import("zod").ZodOptional<import("zod").ZodBoolean>;
145
+ occupancy: import("zod").ZodOptional<import("zod").ZodObject<{
146
+ metrics: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodNumber>>;
147
+ }, import("zod/v4/core").$loose>>;
148
+ }, import("zod/v4/core").$loose>>;
149
+ }, import("zod/v4/core").$loose>;
150
+ };
151
+ readonly 'channels.getChannelHistory': {
152
+ readonly input: import("zod").ZodObject<{
153
+ channelId: import("zod").ZodString;
154
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
155
+ start: import("zod").ZodOptional<import("zod").ZodNumber>;
156
+ end: import("zod").ZodOptional<import("zod").ZodNumber>;
157
+ direction: import("zod").ZodOptional<import("zod").ZodEnum<{
158
+ forwards: "forwards";
159
+ backwards: "backwards";
160
+ }>>;
161
+ }, import("zod/v4/core").$strip>;
162
+ readonly output: import("zod").ZodArray<import("zod").ZodObject<{
163
+ id: import("zod").ZodOptional<import("zod").ZodString>;
164
+ name: import("zod").ZodOptional<import("zod").ZodString>;
165
+ data: import("zod").ZodOptional<import("zod").ZodUnknown>;
166
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
167
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
168
+ timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
169
+ encoding: import("zod").ZodOptional<import("zod").ZodString>;
170
+ extras: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
171
+ }, import("zod/v4/core").$loose>>;
172
+ };
173
+ readonly 'channels.getChannelPresence': {
174
+ readonly input: import("zod").ZodObject<{
175
+ channelId: import("zod").ZodString;
176
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
177
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
178
+ }, import("zod/v4/core").$strip>;
179
+ readonly output: import("zod").ZodArray<import("zod").ZodObject<{
180
+ id: import("zod").ZodOptional<import("zod").ZodString>;
181
+ action: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
182
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
183
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
184
+ data: import("zod").ZodOptional<import("zod").ZodUnknown>;
185
+ timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
186
+ encoding: import("zod").ZodOptional<import("zod").ZodString>;
187
+ }, import("zod/v4/core").$loose>>;
188
+ };
189
+ readonly 'channels.getPresenceHistory': {
190
+ readonly input: import("zod").ZodObject<{
191
+ channelId: import("zod").ZodString;
192
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
193
+ start: import("zod").ZodOptional<import("zod").ZodNumber>;
194
+ end: import("zod").ZodOptional<import("zod").ZodNumber>;
195
+ direction: import("zod").ZodOptional<import("zod").ZodEnum<{
196
+ forwards: "forwards";
197
+ backwards: "backwards";
198
+ }>>;
199
+ }, import("zod/v4/core").$strip>;
200
+ readonly output: import("zod").ZodArray<import("zod").ZodObject<{
201
+ id: import("zod").ZodOptional<import("zod").ZodString>;
202
+ action: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
203
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
204
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
205
+ data: import("zod").ZodOptional<import("zod").ZodUnknown>;
206
+ timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
207
+ encoding: import("zod").ZodOptional<import("zod").ZodString>;
208
+ }, import("zod/v4/core").$loose>>;
209
+ };
210
+ readonly 'channels.getMessageVersions': {
211
+ readonly input: import("zod").ZodObject<{
212
+ channelId: import("zod").ZodString;
213
+ serial: import("zod").ZodString;
214
+ }, import("zod/v4/core").$strip>;
215
+ readonly output: import("zod").ZodArray<import("zod").ZodObject<{
216
+ id: import("zod").ZodOptional<import("zod").ZodString>;
217
+ name: import("zod").ZodOptional<import("zod").ZodString>;
218
+ data: import("zod").ZodOptional<import("zod").ZodUnknown>;
219
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
220
+ connectionId: import("zod").ZodOptional<import("zod").ZodString>;
221
+ timestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
222
+ encoding: import("zod").ZodOptional<import("zod").ZodString>;
223
+ extras: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
224
+ }, import("zod/v4/core").$loose>>;
225
+ };
226
+ readonly 'channels.listChannels': {
227
+ readonly input: import("zod").ZodObject<{
228
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
229
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
230
+ by: import("zod").ZodOptional<import("zod").ZodEnum<{
231
+ value: "value";
232
+ id: "id";
233
+ }>>;
234
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
235
+ }, import("zod/v4/core").$strip>;
236
+ readonly output: import("zod").ZodObject<{
237
+ items: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
238
+ channelId: import("zod").ZodOptional<import("zod").ZodString>;
239
+ status: import("zod").ZodOptional<import("zod").ZodObject<{
240
+ isActive: import("zod").ZodOptional<import("zod").ZodBoolean>;
241
+ occupancy: import("zod").ZodOptional<import("zod").ZodObject<{
242
+ metrics: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodNumber>>;
243
+ }, import("zod/v4/core").$loose>>;
244
+ }, import("zod/v4/core").$loose>>;
245
+ }, import("zod/v4/core").$loose>]>>;
246
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
247
+ }, import("zod/v4/core").$strip>;
248
+ };
249
+ readonly 'channels.publishMessageToChannel': {
250
+ readonly input: import("zod").ZodObject<{
251
+ channelId: import("zod").ZodString;
252
+ name: import("zod").ZodOptional<import("zod").ZodString>;
253
+ data: import("zod").ZodUnknown;
254
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
255
+ extras: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
256
+ }, import("zod/v4/core").$strip>;
257
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
258
+ };
259
+ readonly 'channels.batchPresence': {
260
+ readonly input: import("zod").ZodObject<{
261
+ channels: import("zod").ZodArray<import("zod").ZodString>;
262
+ }, import("zod/v4/core").$strip>;
263
+ readonly output: import("zod").ZodArray<import("zod").ZodUnknown>;
264
+ };
265
+ readonly 'channels.batchPresenceHistory': {
266
+ readonly input: import("zod").ZodObject<{
267
+ channels: import("zod").ZodArray<import("zod").ZodString>;
268
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
269
+ start: import("zod").ZodOptional<import("zod").ZodNumber>;
270
+ end: import("zod").ZodOptional<import("zod").ZodNumber>;
271
+ direction: import("zod").ZodOptional<import("zod").ZodEnum<{
272
+ forwards: "forwards";
273
+ backwards: "backwards";
274
+ }>>;
275
+ }, import("zod/v4/core").$strip>;
276
+ readonly output: import("zod").ZodArray<import("zod").ZodUnknown>;
277
+ };
278
+ readonly 'push.publishPushNotificationsBatch': {
279
+ readonly input: import("zod").ZodObject<{
280
+ notifications: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
281
+ }, import("zod/v4/core").$strip>;
282
+ readonly output: import("zod").ZodArray<import("zod").ZodUnknown>;
283
+ };
284
+ readonly 'push.deleteChannelSubscription': {
285
+ readonly input: import("zod").ZodObject<{
286
+ channel: import("zod").ZodString;
287
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
288
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
289
+ }, import("zod/v4/core").$strip>;
290
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
291
+ };
292
+ readonly 'push.createPushChannelSubscription': {
293
+ readonly input: import("zod").ZodObject<{
294
+ channel: import("zod").ZodString;
295
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
296
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
297
+ }, import("zod/v4/core").$strip>;
298
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
299
+ };
300
+ readonly 'push.getPushDevice': {
301
+ readonly input: import("zod").ZodObject<{
302
+ deviceId: import("zod").ZodString;
303
+ }, import("zod/v4/core").$strip>;
304
+ readonly output: import("zod").ZodObject<{
305
+ id: import("zod").ZodString;
306
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
307
+ platform: import("zod").ZodOptional<import("zod").ZodString>;
308
+ formFactor: import("zod").ZodOptional<import("zod").ZodString>;
309
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
310
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
311
+ push: import("zod").ZodOptional<import("zod").ZodObject<{
312
+ state: import("zod").ZodOptional<import("zod").ZodString>;
313
+ recipient: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
314
+ }, import("zod/v4/core").$loose>>;
315
+ }, import("zod/v4/core").$loose>;
316
+ };
317
+ readonly 'push.listPushChannelSubscriptions': {
318
+ readonly input: import("zod").ZodObject<{
319
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
320
+ channel: import("zod").ZodOptional<import("zod").ZodString>;
321
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
322
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
323
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
324
+ }, import("zod/v4/core").$strip>;
325
+ readonly output: import("zod").ZodObject<{
326
+ items: import("zod").ZodArray<import("zod").ZodObject<{
327
+ channel: import("zod").ZodString;
328
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
329
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
330
+ }, import("zod/v4/core").$loose>>;
331
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
332
+ }, import("zod/v4/core").$strip>;
333
+ };
334
+ readonly 'push.listPushChannels': {
335
+ readonly input: import("zod").ZodObject<{
336
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
337
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
338
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
339
+ }, import("zod/v4/core").$strip>;
340
+ readonly output: import("zod").ZodObject<{
341
+ items: import("zod").ZodArray<import("zod").ZodString>;
342
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
343
+ }, import("zod/v4/core").$strip>;
344
+ };
345
+ readonly 'push.listRegisteredPushDevices': {
346
+ readonly input: import("zod").ZodObject<{
347
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
348
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
349
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
350
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
351
+ }, import("zod/v4/core").$strip>;
352
+ readonly output: import("zod").ZodObject<{
353
+ items: import("zod").ZodArray<import("zod").ZodObject<{
354
+ id: import("zod").ZodString;
355
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
356
+ platform: import("zod").ZodOptional<import("zod").ZodString>;
357
+ formFactor: import("zod").ZodOptional<import("zod").ZodString>;
358
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
359
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
360
+ push: import("zod").ZodOptional<import("zod").ZodObject<{
361
+ state: import("zod").ZodOptional<import("zod").ZodString>;
362
+ recipient: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
363
+ }, import("zod/v4/core").$loose>>;
364
+ }, import("zod/v4/core").$loose>>;
365
+ next: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
366
+ }, import("zod/v4/core").$strip>;
367
+ };
368
+ readonly 'push.patchPushDeviceRegistration': {
369
+ readonly input: import("zod").ZodObject<{
370
+ deviceId: import("zod").ZodString;
371
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
372
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
373
+ push: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
374
+ }, import("zod/v4/core").$strip>;
375
+ readonly output: import("zod").ZodObject<{
376
+ id: import("zod").ZodString;
377
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
378
+ platform: import("zod").ZodOptional<import("zod").ZodString>;
379
+ formFactor: import("zod").ZodOptional<import("zod").ZodString>;
380
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
381
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
382
+ push: import("zod").ZodOptional<import("zod").ZodObject<{
383
+ state: import("zod").ZodOptional<import("zod").ZodString>;
384
+ recipient: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
385
+ }, import("zod/v4/core").$loose>>;
386
+ }, import("zod/v4/core").$loose>;
387
+ };
388
+ readonly 'push.publishPushNotification': {
389
+ readonly input: import("zod").ZodObject<{
390
+ recipient: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
391
+ data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
392
+ notification: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
393
+ }, import("zod/v4/core").$strip>;
394
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
395
+ };
396
+ readonly 'push.registerPushDevice': {
397
+ readonly input: import("zod").ZodObject<{
398
+ id: import("zod").ZodString;
399
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
400
+ platform: import("zod").ZodEnum<{
401
+ browser: "browser";
402
+ android: "android";
403
+ ios: "ios";
404
+ }>;
405
+ formFactor: import("zod").ZodEnum<{
406
+ phone: "phone";
407
+ tablet: "tablet";
408
+ desktop: "desktop";
409
+ tv: "tv";
410
+ watch: "watch";
411
+ car: "car";
412
+ embedded: "embedded";
413
+ }>;
414
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
415
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
416
+ push: import("zod").ZodObject<{
417
+ recipient: import("zod").ZodObject<{
418
+ transportType: import("zod").ZodEnum<{
419
+ fcm: "fcm";
420
+ apns: "apns";
421
+ web: "web";
422
+ }>;
423
+ }, import("zod/v4/core").$loose>;
424
+ }, import("zod/v4/core").$strip>;
425
+ }, import("zod/v4/core").$strip>;
426
+ readonly output: import("zod").ZodObject<{
427
+ id: import("zod").ZodString;
428
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
429
+ platform: import("zod").ZodOptional<import("zod").ZodString>;
430
+ formFactor: import("zod").ZodOptional<import("zod").ZodString>;
431
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
432
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
433
+ push: import("zod").ZodOptional<import("zod").ZodObject<{
434
+ state: import("zod").ZodOptional<import("zod").ZodString>;
435
+ recipient: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
436
+ }, import("zod/v4/core").$loose>>;
437
+ }, import("zod/v4/core").$loose>;
438
+ };
439
+ readonly 'push.unregisterAllPushDevices': {
440
+ readonly input: import("zod").ZodObject<{
441
+ deviceId: import("zod").ZodOptional<import("zod").ZodString>;
442
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
443
+ }, import("zod/v4/core").$strip>;
444
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
445
+ };
446
+ readonly 'push.unregisterPushDevice': {
447
+ readonly input: import("zod").ZodObject<{
448
+ deviceId: import("zod").ZodString;
449
+ }, import("zod/v4/core").$strip>;
450
+ readonly output: import("zod").ZodOptional<import("zod").ZodUnknown>;
451
+ };
452
+ readonly 'push.updatePushDevice': {
453
+ readonly input: import("zod").ZodObject<{
454
+ id: import("zod").ZodString;
455
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
456
+ platform: import("zod").ZodEnum<{
457
+ browser: "browser";
458
+ android: "android";
459
+ ios: "ios";
460
+ }>;
461
+ formFactor: import("zod").ZodEnum<{
462
+ phone: "phone";
463
+ tablet: "tablet";
464
+ desktop: "desktop";
465
+ tv: "tv";
466
+ watch: "watch";
467
+ car: "car";
468
+ embedded: "embedded";
469
+ }>;
470
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
471
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
472
+ push: import("zod").ZodObject<{
473
+ recipient: import("zod").ZodObject<{
474
+ transportType: import("zod").ZodEnum<{
475
+ fcm: "fcm";
476
+ apns: "apns";
477
+ web: "web";
478
+ }>;
479
+ }, import("zod/v4/core").$loose>;
480
+ }, import("zod/v4/core").$strip>;
481
+ }, import("zod/v4/core").$strip>;
482
+ readonly output: import("zod").ZodObject<{
483
+ id: import("zod").ZodString;
484
+ clientId: import("zod").ZodOptional<import("zod").ZodString>;
485
+ platform: import("zod").ZodOptional<import("zod").ZodString>;
486
+ formFactor: import("zod").ZodOptional<import("zod").ZodString>;
487
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
488
+ updateToken: import("zod").ZodOptional<import("zod").ZodString>;
489
+ push: import("zod").ZodOptional<import("zod").ZodObject<{
490
+ state: import("zod").ZodOptional<import("zod").ZodString>;
491
+ recipient: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
492
+ }, import("zod/v4/core").$loose>>;
493
+ }, import("zod/v4/core").$loose>;
494
+ };
495
+ };
496
+ declare const defaultAuthType: AuthTypes;
497
+ export declare const ablyAuthConfig: {
498
+ readonly api_key: {
499
+ readonly account: readonly ["tenant_external_id"];
500
+ };
501
+ };
502
+ export type BaseAblyPlugin<T extends AblyPluginOptions> = CorsairPlugin<'ably', typeof AblySchema, typeof ablyEndpointsNested, typeof ablyWebhooksNested, T, typeof defaultAuthType>;
503
+ export type InternalAblyPlugin = BaseAblyPlugin<AblyPluginOptions>;
504
+ export type ExternalAblyPlugin<T extends AblyPluginOptions> = BaseAblyPlugin<T>;
505
+ export declare function ably<const T extends AblyPluginOptions>(incomingOptions?: AblyPluginOptions & T): ExternalAblyPlugin<T>;
506
+ export type { AblyDevice, AblyEndpointInputs, AblyEndpointOutputs, AblyMessage, AblyPresenceMessage, } from './endpoints/types';
507
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,QAAQ,EAER,uBAAuB,EAIvB,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EACX,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC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});import{logEventFromContext as I}from"corsair/core";import{request as $}from"corsair/http";var m=class extends Error{constructor(s,o,i,g){super(s);this.code=o;this.statusCode=i;this.retryAfter=g;this.name="AblyAPIError"}},R="https://rest.ably.io";async function c(t,n,s={}){let{method:o="GET",body:i,query:g}=s,P={BASE:R,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:void 0,HEADERS:{Accept:"application/json","Content-Type":"application/json",Authorization:`Basic ${Buffer.from(n).toString("base64")}`}},d={method:o,url:t,body:o==="POST"||o==="PUT"||o==="PATCH"?i:void 0,mediaType:"application/json; charset=utf-8",query:g};try{return await $(P,d)}catch(l){if(l instanceof Error){let y=l,v=y.body?.error;throw new m(v?.message??l.message,v?.code===void 0?void 0:String(v.code),v?.statusCode??y.status,y.retryAfter)}throw new m("Unknown Ably API error")}}function _(t){if(t)for(let n of t.split(",")){let s=/<([^>]+)>\s*;\s*rel="?next"?/i.exec(n);if(!s?.[1])continue;let o=new URL(s[1],`${R}/`),i={};return o.searchParams.forEach((g,P)=>{i[P]=g}),Object.keys(i).length>0?i:void 0}}async function f(t,n,s={}){let o=new URL(t,`${R}/`);for(let[d,l]of Object.entries(s.query??{}))l!==void 0&&o.searchParams.set(d,String(l));let i=await fetch(o,{method:"GET",headers:{Accept:"application/json",Authorization:`Basic ${Buffer.from(n).toString("base64")}`},signal:AbortSignal.timeout(2e4)});if(!i.ok){let d=await i.text(),l=d;try{l=JSON.parse(d)}catch{l=d}let y=typeof l=="object"&&l!==null&&"error"in l?l.error:void 0,v=i.headers.get("Retry-After"),H=v?Number(v):Number.NaN;throw new m(y?.message??`HTTP ${i.status}: ${i.statusText}`,y?.code===void 0?void 0:String(y.code),y?.statusCode??i.status,Number.isFinite(H)?H*1e3:void 0)}let g=await i.json(),P=Array.isArray(g)?g:[],k=_(i.headers.get("Link"));return k?{items:P,next:k}:{items:P}}var V=async t=>{let n=await c("time",t.key);return await I(t,"ably.application.getServiceTime",{},"completed"),n},W=async(t,n)=>{let s=await c("stats",t.key,{method:"GET",query:n});return await I(t,"ably.application.getStats",n,"completed"),s},K=async(t,n)=>{let{keyName:s,...o}=n,i=await c(`keys/${encodeURIComponent(s)}/requestToken`,t.key,{method:"POST",body:o});return await I(t,"ably.application.requestAccessToken",{keyName:s},"completed"),i};var p={};x(p,{batchPresence:()=>ee,batchPresenceHistory:()=>te,getChannelDetails:()=>F,getChannelHistory:()=>G,getChannelPresence:()=>Y,getMessageVersions:()=>Q,getPresenceHistory:()=>J,listChannels:()=>X,publishBatchMessages:()=>z,publishMessageToChannel:()=>Z});import{logEventFromContext as b}from"corsair/core";var A=encodeURIComponent,U=5,z=async(t,n)=>{let s=await c("messages",t.key,{method:"POST",body:n.messages});return await b(t,"ably.channels.publishBatchMessages",{},"completed"),s},F=async(t,n)=>{let s=await c(`channels/${A(n.channelId)}`,t.key);return await b(t,"ably.channels.getDetails",{channelId:n.channelId},"completed"),s},G=async(t,n)=>{let{channelId:s,...o}=n,i=await c(`channels/${A(s)}/messages`,t.key,{query:o});return await b(t,"ably.channels.getHistory",{channelId:s},"completed"),i},Y=async(t,n)=>{let{channelId:s,...o}=n,i=await c(`channels/${A(s)}/presence`,t.key,{query:o});return await b(t,"ably.channels.getPresence",{channelId:s},"completed"),i},J=async(t,n)=>{let{channelId:s,...o}=n,i=await c(`channels/${A(s)}/presence/history`,t.key,{query:o});return await b(t,"ably.channels.getPresenceHistory",{channelId:s},"completed"),i},Q=async(t,n)=>{let s=await c(`channels/${A(n.channelId)}/messages/${A(n.serial)}/versions`,t.key);return await b(t,"ably.channels.getMessageVersions",{channelId:n.channelId},"completed"),s},X=async(t,n)=>{let{next:s,...o}=n,i=await f("channels",t.key,{query:{...o,...s}});return await b(t,"ably.channels.list",{},"completed"),i},Z=async(t,n)=>{let{channelId:s,...o}=n,i=await c(`channels/${A(s)}/messages`,t.key,{method:"POST",body:o});return await b(t,"ably.channels.publishMessage",{channelId:s},"completed"),i},ee=async(t,n)=>{let s=await c("presence",t.key,{query:{channels:n.channels.join(",")}});return await b(t,"ably.channels.batchPresence",{},"completed"),s},te=async(t,n)=>{let{channels:s,...o}=n,i=new Array(s.length),g=0,P=async()=>{for(;;){let d=g++;if(d>=s.length)return;let l=s[d],y=await c(`channels/${A(l)}/presence/history`,t.key,{query:o});i[d]={channelId:l,history:y}}},k=Math.min(U,s.length);return await Promise.all(Array.from({length:k},()=>P())),await b(t,"ably.channels.batchPresenceHistory",{},"completed"),i};var u={};x(u,{createPushChannelSubscription:()=>ie,deleteChannelSubscription:()=>se,getPushDevice:()=>oe,listPushChannelSubscriptions:()=>re,listPushChannels:()=>ae,listRegisteredPushDevices:()=>ce,patchPushDeviceRegistration:()=>le,publishPushNotification:()=>ue,publishPushNotificationsBatch:()=>ne,registerPushDevice:()=>pe,unregisterAllPushDevices:()=>he,unregisterPushDevice:()=>de,updatePushDevice:()=>ye});import{logEventFromContext as h}from"corsair/core";var w=encodeURIComponent,ne=async(t,n)=>{let s=await c("push/batch/publish",t.key,{method:"POST",body:n.notifications});return await h(t,"ably.push.publishBatch",{},"completed"),s},se=async(t,n)=>{let s=await c("push/channelSubscriptions",t.key,{method:"DELETE",query:n});return await h(t,"ably.push.deleteChannelSubscription",{channel:n.channel},"completed"),s},ie=async(t,n)=>{let s=await c("push/channelSubscriptions",t.key,{method:"POST",body:n});return await h(t,"ably.push.createChannelSubscription",{channel:n.channel},"completed"),s},oe=async(t,n)=>{let s=await c(`push/deviceRegistrations/${w(n.deviceId)}`,t.key);return await h(t,"ably.push.getDevice",{},"completed"),s},re=async(t,n)=>{let{next:s,...o}=n,i=await f("push/channelSubscriptions",t.key,{query:{...o,...s}});return await h(t,"ably.push.listChannelSubscriptions",{channel:n.channel,limit:n.limit},"completed"),i},ae=async(t,n)=>{let{next:s,...o}=n,i=await f("push/channels",t.key,{query:{...o,...s}});return await h(t,"ably.push.listChannels",{prefix:n.prefix,limit:n.limit},"completed"),i},ce=async(t,n)=>{let{next:s,...o}=n,i=await f("push/deviceRegistrations",t.key,{query:{...o,...s}});return await h(t,"ably.push.listDevices",{limit:n.limit},"completed"),i},le=async(t,n)=>{let{deviceId:s,...o}=n,i=await c(`push/deviceRegistrations/${w(s)}`,t.key,{method:"PATCH",body:o});return await h(t,"ably.push.patchDevice",{},"completed"),i},ue=async(t,n)=>{let s=await c("push/publish",t.key,{method:"POST",body:n});return await h(t,"ably.push.publish",{},"completed"),s},pe=async(t,n)=>{let s=await c("push/deviceRegistrations",t.key,{method:"POST",body:n});return await h(t,"ably.push.registerDevice",{},"completed"),s},he=async(t,n)=>{let s=await c("push/deviceRegistrations",t.key,{method:"DELETE",query:n});return await h(t,"ably.push.unregisterDevices",{},"completed"),s},de=async(t,n)=>{let s=await c(`push/deviceRegistrations/${w(n.deviceId)}`,t.key,{method:"DELETE"});return await h(t,"ably.push.unregisterDevice",{},"completed"),s},ye=async(t,n)=>{let{id:s,...o}=n,i=await c(`push/deviceRegistrations/${w(s)}`,t.key,{method:"PUT",body:{id:s,...o}});return await h(t,"ably.push.updateDevice",{},"completed"),i};import{z as e}from"zod";var be=e.object({}),ge=e.enum(["forwards","backwards"]),D=e.object({limit:e.number().int().positive().max(1e3).optional()}),T=D.extend({start:e.number().int().optional(),end:e.number().int().optional(),direction:ge.optional()}),O=e.object({id:e.string().optional(),name:e.string().optional(),data:e.unknown().optional(),clientId:e.string().optional(),connectionId:e.string().optional(),timestamp:e.number().optional(),encoding:e.string().optional(),extras:e.record(e.string(),e.unknown()).optional()}).loose(),M=e.object({id:e.string().optional(),action:e.union([e.string(),e.number()]).optional(),clientId:e.string().optional(),connectionId:e.string().optional(),data:e.unknown().optional(),timestamp:e.number().optional(),encoding:e.string().optional()}).loose(),N=e.object({channelId:e.string().optional(),status:e.object({isActive:e.boolean().optional(),occupancy:e.object({metrics:e.record(e.string(),e.number()).optional()}).loose().optional()}).loose().optional()}).loose(),S=e.object({id:e.string(),clientId:e.string().optional(),platform:e.string().optional(),formFactor:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),updateToken:e.string().optional(),push:e.object({state:e.string().optional(),recipient:e.record(e.string(),e.unknown()).optional()}).loose().optional()}).loose(),q=e.object({id:e.string().min(1),clientId:e.string().optional(),platform:e.enum(["ios","android","browser"]),formFactor:e.enum(["phone","tablet","desktop","tv","watch","car","embedded"]),metadata:e.record(e.string(),e.unknown()).optional(),updateToken:e.string().optional(),push:e.object({recipient:e.object({transportType:e.enum(["fcm","apns","web"])}).loose()})}),me=e.object({channel:e.string(),deviceId:e.string().optional(),clientId:e.string().optional()}).loose(),E=e.unknown().optional(),r={publishBatchMessages:e.object({messages:e.array(e.object({channels:e.array(e.string().min(1)).min(1),messages:e.array(O).min(1)}))}),getChannelDetails:e.object({channelId:e.string().min(1)}),getChannelHistory:e.object({channelId:e.string().min(1)}).extend(T.shape),getChannelPresence:e.object({channelId:e.string().min(1),clientId:e.string().optional(),connectionId:e.string().optional()}),getPresenceHistory:e.object({channelId:e.string().min(1)}).extend(T.shape),getMessageVersions:e.object({channelId:e.string().min(1),serial:e.string().min(1)}),listChannels:D.extend({prefix:e.string().optional(),by:e.enum(["id","value"]).optional(),next:e.record(e.string(),e.string()).optional()}),publishMessageToChannel:e.object({channelId:e.string().min(1),name:e.string().optional(),data:e.unknown(),clientId:e.string().optional(),extras:e.record(e.string(),e.unknown()).optional()}),batchPresence:e.object({channels:e.array(e.string().min(1)).min(1).max(100)}),batchPresenceHistory:e.object({channels:e.array(e.string().min(1)).min(1).max(100)}).extend(T.shape),getServiceTime:be,getStats:T.extend({unit:e.enum(["minute","hour","day","month"]).optional()}),requestAccessToken:e.object({keyName:e.string().min(1),clientId:e.string().optional(),ttl:e.number().int().positive().optional(),capability:e.string().optional()}),publishPushNotificationsBatch:e.object({notifications:e.array(e.record(e.string(),e.unknown())).min(1).max(1e4)}),deleteChannelSubscription:e.object({channel:e.string().min(1),deviceId:e.string().optional(),clientId:e.string().optional()}),createPushChannelSubscription:e.object({channel:e.string().min(1),deviceId:e.string().min(1).optional(),clientId:e.string().min(1).optional()}).refine(t=>+(t.deviceId!==void 0)+ +(t.clientId!==void 0)==1),getPushDevice:e.object({deviceId:e.string().min(1)}),listPushChannelSubscriptions:D.extend({channel:e.string().optional(),deviceId:e.string().optional(),clientId:e.string().optional(),next:e.record(e.string(),e.string()).optional()}),listPushChannels:D.extend({prefix:e.string().optional(),next:e.record(e.string(),e.string()).optional()}),listRegisteredPushDevices:D.extend({deviceId:e.string().optional(),clientId:e.string().optional(),next:e.record(e.string(),e.string()).optional()}),patchPushDeviceRegistration:e.object({deviceId:e.string().min(1),clientId:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),push:e.record(e.string(),e.unknown()).optional()}),publishPushNotification:e.object({recipient:e.record(e.string(),e.unknown()),data:e.record(e.string(),e.unknown()).optional(),notification:e.record(e.string(),e.unknown()).optional()}),registerPushDevice:q,unregisterAllPushDevices:e.object({deviceId:e.string().min(1).optional(),clientId:e.string().min(1).optional()}).refine(t=>+(t.deviceId!==void 0)+ +(t.clientId!==void 0)==1),unregisterPushDevice:e.object({deviceId:e.string().min(1)}),updatePushDevice:q},a={publishBatchMessages:e.array(e.unknown()),getChannelDetails:N,getChannelHistory:e.array(O),getChannelPresence:e.array(M),getPresenceHistory:e.array(M),getMessageVersions:e.array(O),listChannels:e.object({items:e.array(e.union([e.string(),N])),next:e.record(e.string(),e.string()).optional()}),publishMessageToChannel:E,batchPresence:e.array(e.unknown()),batchPresenceHistory:e.array(e.unknown()),getServiceTime:e.array(e.number()),getStats:e.array(e.record(e.string(),e.unknown())),requestAccessToken:e.object({token:e.string(),expires:e.number().optional(),issued:e.number().optional(),capability:e.string().optional(),clientId:e.string().optional()}).loose(),publishPushNotificationsBatch:e.array(e.unknown()),deleteChannelSubscription:E,createPushChannelSubscription:E,getPushDevice:S,listPushChannelSubscriptions:e.object({items:e.array(me),next:e.record(e.string(),e.string()).optional()}),listPushChannels:e.object({items:e.array(e.string()),next:e.record(e.string(),e.string()).optional()}),listRegisteredPushDevices:e.object({items:e.array(S),next:e.record(e.string(),e.string()).optional()}),patchPushDeviceRegistration:S,publishPushNotification:E,registerPushDevice:S,unregisterAllPushDevices:E,unregisterPushDevice:E,updatePushDevice:S};var B={RATE_LIMIT_ERROR:{match:t=>t instanceof m&&t.statusCode===429,handler:async t=>({maxRetries:5,headersRetryAfterMs:t instanceof m?t.retryAfter:void 0})},AUTH_ERROR:{match:t=>t instanceof m&&t.statusCode===401,handler:async()=>({maxRetries:0})},DEFAULT:{match:()=>!0,handler:async()=>({maxRetries:0})}};var j={version:"1.0.0",entities:{}};var Pe={application:{getServiceTime:C.getServiceTime,getStats:C.getStats,requestAccessToken:C.requestAccessToken},channels:{publishBatchMessages:p.publishBatchMessages,getChannelDetails:p.getChannelDetails,getChannelHistory:p.getChannelHistory,getChannelPresence:p.getChannelPresence,getPresenceHistory:p.getPresenceHistory,getMessageVersions:p.getMessageVersions,listChannels:p.listChannels,publishMessageToChannel:p.publishMessageToChannel,batchPresence:p.batchPresence,batchPresenceHistory:p.batchPresenceHistory},push:{publishPushNotificationsBatch:u.publishPushNotificationsBatch,deleteChannelSubscription:u.deleteChannelSubscription,createPushChannelSubscription:u.createPushChannelSubscription,getPushDevice:u.getPushDevice,listPushChannelSubscriptions:u.listPushChannelSubscriptions,listPushChannels:u.listPushChannels,listRegisteredPushDevices:u.listRegisteredPushDevices,patchPushDeviceRegistration:u.patchPushDeviceRegistration,publishPushNotification:u.publishPushNotification,registerPushDevice:u.registerPushDevice,unregisterAllPushDevices:u.unregisterAllPushDevices,unregisterPushDevice:u.unregisterPushDevice,updatePushDevice:u.updatePushDevice}},Ae={},ve={"application.getServiceTime":{input:r.getServiceTime,output:a.getServiceTime},"application.getStats":{input:r.getStats,output:a.getStats},"application.requestAccessToken":{input:r.requestAccessToken,output:a.requestAccessToken},"channels.publishBatchMessages":{input:r.publishBatchMessages,output:a.publishBatchMessages},"channels.getChannelDetails":{input:r.getChannelDetails,output:a.getChannelDetails},"channels.getChannelHistory":{input:r.getChannelHistory,output:a.getChannelHistory},"channels.getChannelPresence":{input:r.getChannelPresence,output:a.getChannelPresence},"channels.getPresenceHistory":{input:r.getPresenceHistory,output:a.getPresenceHistory},"channels.getMessageVersions":{input:r.getMessageVersions,output:a.getMessageVersions},"channels.listChannels":{input:r.listChannels,output:a.listChannels},"channels.publishMessageToChannel":{input:r.publishMessageToChannel,output:a.publishMessageToChannel},"channels.batchPresence":{input:r.batchPresence,output:a.batchPresence},"channels.batchPresenceHistory":{input:r.batchPresenceHistory,output:a.batchPresenceHistory},"push.publishPushNotificationsBatch":{input:r.publishPushNotificationsBatch,output:a.publishPushNotificationsBatch},"push.deleteChannelSubscription":{input:r.deleteChannelSubscription,output:a.deleteChannelSubscription},"push.createPushChannelSubscription":{input:r.createPushChannelSubscription,output:a.createPushChannelSubscription},"push.getPushDevice":{input:r.getPushDevice,output:a.getPushDevice},"push.listPushChannelSubscriptions":{input:r.listPushChannelSubscriptions,output:a.listPushChannelSubscriptions},"push.listPushChannels":{input:r.listPushChannels,output:a.listPushChannels},"push.listRegisteredPushDevices":{input:r.listRegisteredPushDevices,output:a.listRegisteredPushDevices},"push.patchPushDeviceRegistration":{input:r.patchPushDeviceRegistration,output:a.patchPushDeviceRegistration},"push.publishPushNotification":{input:r.publishPushNotification,output:a.publishPushNotification},"push.registerPushDevice":{input:r.registerPushDevice,output:a.registerPushDevice},"push.unregisterAllPushDevices":{input:r.unregisterAllPushDevices,output:a.unregisterAllPushDevices},"push.unregisterPushDevice":{input:r.unregisterPushDevice,output:a.unregisterPushDevice},"push.updatePushDevice":{input:r.updatePushDevice,output:a.updatePushDevice}},fe={},Ce={"application.getServiceTime":{riskLevel:"read",description:"Get the current Ably service time."},"application.getStats":{riskLevel:"read",description:"Retrieve application usage statistics."},"application.requestAccessToken":{riskLevel:"write",description:"Request an Ably access token."},"channels.publishBatchMessages":{riskLevel:"write",description:"Publish messages to multiple Ably channels."},"channels.getChannelDetails":{riskLevel:"read",description:"Retrieve details for an active channel."},"channels.getChannelHistory":{riskLevel:"read",description:"Retrieve message history for a channel."},"channels.getChannelPresence":{riskLevel:"read",description:"Retrieve current channel presence members."},"channels.getPresenceHistory":{riskLevel:"read",description:"Retrieve presence history for a channel."},"channels.getMessageVersions":{riskLevel:"read",description:"Retrieve historical versions of a message."},"channels.listChannels":{riskLevel:"read",description:"List active Ably channels."},"channels.publishMessageToChannel":{riskLevel:"write",description:"Publish a message to an Ably channel."},"channels.batchPresence":{riskLevel:"read",description:"Retrieve presence information for multiple channels."},"channels.batchPresenceHistory":{riskLevel:"read",description:"Retrieve presence history for multiple channels."},"push.publishPushNotificationsBatch":{riskLevel:"write",description:"Publish a batch of push notifications."},"push.deleteChannelSubscription":{riskLevel:"destructive",description:"Delete matching push channel subscriptions."},"push.createPushChannelSubscription":{riskLevel:"write",description:"Subscribe a device or client to a push channel."},"push.getPushDevice":{riskLevel:"read",description:"Retrieve a push device registration."},"push.listPushChannelSubscriptions":{riskLevel:"read",description:"List push channel subscriptions."},"push.listPushChannels":{riskLevel:"read",description:"List channels with push subscribers."},"push.listRegisteredPushDevices":{riskLevel:"read",description:"List registered push notification devices."},"push.patchPushDeviceRegistration":{riskLevel:"write",description:"Partially update a push device registration."},"push.publishPushNotification":{riskLevel:"write",description:"Publish a push notification."},"push.registerPushDevice":{riskLevel:"write",description:"Register a device for push notifications."},"push.unregisterAllPushDevices":{riskLevel:"destructive",description:"Delete matching push device registrations."},"push.unregisterPushDevice":{riskLevel:"destructive",description:"Delete a push device registration."},"push.updatePushDevice":{riskLevel:"write",description:"Create or replace a push device registration."}},Ee="api_key",ke={api_key:{account:["tenant_external_id"]}};function Ke(t={}){let n={...t,authType:t.authType??Ee};return{id:"ably",authConfig:ke,schema:j,options:n,hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:Pe,webhooks:Ae,endpointMeta:Ce,endpointSchemas:ve,webhookSchemas:fe,pluginWebhookMatcher:()=>!1,errorHandlers:{...B,...n.errorHandlers},keyBuilder:async(s,o)=>o==="endpoint"&&n.key?n.key:o==="endpoint"&&s.authType==="api_key"?await s.keys.get_api_key()??"":""}}export{Ke as ably,ke as ablyAuthConfig,ve as ablyEndpointSchemas};
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../schema/database.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare const AblySchema: {
2
+ readonly version: "1.0.0";
3
+ readonly entities: {};
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schema/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;CAGb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../schema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("tsup").Options | import("tsup").Options[] | ((overrideOptions: import("tsup").Options) => import("tsup").Options | import("tsup").Options[] | Promise<import("tsup").Options | import("tsup").Options[]>);
2
+ export default _default;
3
+ //# sourceMappingURL=tsup.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBAYG"}