@polymorfa/sdk 0.1.0-dev.20260922093854

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.
Files changed (347) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1881 -0
  3. package/dist/bridge.d.ts +31 -0
  4. package/dist/bridge.d.ts.map +1 -0
  5. package/dist/bridge.js +39 -0
  6. package/dist/bridge.js.map +1 -0
  7. package/dist/calls/api.d.ts +109 -0
  8. package/dist/calls/api.d.ts.map +1 -0
  9. package/dist/calls/api.js +179 -0
  10. package/dist/calls/api.js.map +1 -0
  11. package/dist/calls/call.d.ts +286 -0
  12. package/dist/calls/call.d.ts.map +1 -0
  13. package/dist/calls/call.js +860 -0
  14. package/dist/calls/call.js.map +1 -0
  15. package/dist/calls/client.d.ts +124 -0
  16. package/dist/calls/client.d.ts.map +1 -0
  17. package/dist/calls/client.js +447 -0
  18. package/dist/calls/client.js.map +1 -0
  19. package/dist/calls/diagnostics.d.ts +74 -0
  20. package/dist/calls/diagnostics.d.ts.map +1 -0
  21. package/dist/calls/diagnostics.js +133 -0
  22. package/dist/calls/diagnostics.js.map +1 -0
  23. package/dist/calls/errors.d.ts +37 -0
  24. package/dist/calls/errors.d.ts.map +1 -0
  25. package/dist/calls/errors.js +52 -0
  26. package/dist/calls/errors.js.map +1 -0
  27. package/dist/calls/events.d.ts +15 -0
  28. package/dist/calls/events.d.ts.map +1 -0
  29. package/dist/calls/events.js +34 -0
  30. package/dist/calls/events.js.map +1 -0
  31. package/dist/calls/index.d.ts +6 -0
  32. package/dist/calls/index.d.ts.map +1 -0
  33. package/dist/calls/index.js +7 -0
  34. package/dist/calls/index.js.map +1 -0
  35. package/dist/calls/internal.d.ts +18 -0
  36. package/dist/calls/internal.d.ts.map +1 -0
  37. package/dist/calls/internal.js +18 -0
  38. package/dist/calls/internal.js.map +1 -0
  39. package/dist/calls/lifecycle.d.ts +111 -0
  40. package/dist/calls/lifecycle.d.ts.map +1 -0
  41. package/dist/calls/lifecycle.js +490 -0
  42. package/dist/calls/lifecycle.js.map +1 -0
  43. package/dist/calls/media.d.ts +102 -0
  44. package/dist/calls/media.d.ts.map +1 -0
  45. package/dist/calls/media.js +414 -0
  46. package/dist/calls/media.js.map +1 -0
  47. package/dist/calls/protocol.d.ts +216 -0
  48. package/dist/calls/protocol.d.ts.map +1 -0
  49. package/dist/calls/protocol.js +268 -0
  50. package/dist/calls/protocol.js.map +1 -0
  51. package/dist/calls/token.d.ts +43 -0
  52. package/dist/calls/token.d.ts.map +1 -0
  53. package/dist/calls/token.js +146 -0
  54. package/dist/calls/token.js.map +1 -0
  55. package/dist/client.d.ts +65 -0
  56. package/dist/client.d.ts.map +1 -0
  57. package/dist/client.js +119 -0
  58. package/dist/client.js.map +1 -0
  59. package/dist/credentials.d.ts +50 -0
  60. package/dist/credentials.d.ts.map +1 -0
  61. package/dist/credentials.js +73 -0
  62. package/dist/credentials.js.map +1 -0
  63. package/dist/errors.d.ts +71 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +129 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/index.d.ts +70 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +61 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/media/whatsapp.d.ts +105 -0
  72. package/dist/media/whatsapp.d.ts.map +1 -0
  73. package/dist/media/whatsapp.js +624 -0
  74. package/dist/media/whatsapp.js.map +1 -0
  75. package/dist/messaging/bansafe.d.ts +30 -0
  76. package/dist/messaging/bansafe.d.ts.map +1 -0
  77. package/dist/messaging/bansafe.js +86 -0
  78. package/dist/messaging/bansafe.js.map +1 -0
  79. package/dist/messaging/business.d.ts +35 -0
  80. package/dist/messaging/business.d.ts.map +1 -0
  81. package/dist/messaging/business.js +145 -0
  82. package/dist/messaging/business.js.map +1 -0
  83. package/dist/messaging/calls.d.ts +9 -0
  84. package/dist/messaging/calls.d.ts.map +1 -0
  85. package/dist/messaging/calls.js +16 -0
  86. package/dist/messaging/calls.js.map +1 -0
  87. package/dist/messaging/campaigns.d.ts +19 -0
  88. package/dist/messaging/campaigns.d.ts.map +1 -0
  89. package/dist/messaging/campaigns.js +77 -0
  90. package/dist/messaging/campaigns.js.map +1 -0
  91. package/dist/messaging/channels.d.ts +23 -0
  92. package/dist/messaging/channels.d.ts.map +1 -0
  93. package/dist/messaging/channels.js +104 -0
  94. package/dist/messaging/channels.js.map +1 -0
  95. package/dist/messaging/chats.d.ts +14 -0
  96. package/dist/messaging/chats.d.ts.map +1 -0
  97. package/dist/messaging/chats.js +51 -0
  98. package/dist/messaging/chats.js.map +1 -0
  99. package/dist/messaging/client-tokens.d.ts +15 -0
  100. package/dist/messaging/client-tokens.d.ts.map +1 -0
  101. package/dist/messaging/client-tokens.js +64 -0
  102. package/dist/messaging/client-tokens.js.map +1 -0
  103. package/dist/messaging/client.d.ts +58 -0
  104. package/dist/messaging/client.d.ts.map +1 -0
  105. package/dist/messaging/client.js +100 -0
  106. package/dist/messaging/client.js.map +1 -0
  107. package/dist/messaging/contacts.d.ts +20 -0
  108. package/dist/messaging/contacts.d.ts.map +1 -0
  109. package/dist/messaging/contacts.js +75 -0
  110. package/dist/messaging/contacts.js.map +1 -0
  111. package/dist/messaging/groups.d.ts +34 -0
  112. package/dist/messaging/groups.d.ts.map +1 -0
  113. package/dist/messaging/groups.js +97 -0
  114. package/dist/messaging/groups.js.map +1 -0
  115. package/dist/messaging/identities.d.ts +9 -0
  116. package/dist/messaging/identities.d.ts.map +1 -0
  117. package/dist/messaging/identities.js +21 -0
  118. package/dist/messaging/identities.js.map +1 -0
  119. package/dist/messaging/labels.d.ts +16 -0
  120. package/dist/messaging/labels.d.ts.map +1 -0
  121. package/dist/messaging/labels.js +65 -0
  122. package/dist/messaging/labels.js.map +1 -0
  123. package/dist/messaging/media.d.ts +72 -0
  124. package/dist/messaging/media.d.ts.map +1 -0
  125. package/dist/messaging/media.js +142 -0
  126. package/dist/messaging/media.js.map +1 -0
  127. package/dist/messaging/messages.d.ts +18 -0
  128. package/dist/messaging/messages.d.ts.map +1 -0
  129. package/dist/messaging/messages.js +32 -0
  130. package/dist/messaging/messages.js.map +1 -0
  131. package/dist/messaging/observation-policies.d.ts +10 -0
  132. package/dist/messaging/observation-policies.d.ts.map +1 -0
  133. package/dist/messaging/observation-policies.js +28 -0
  134. package/dist/messaging/observation-policies.js.map +1 -0
  135. package/dist/messaging/onboarding.d.ts +53 -0
  136. package/dist/messaging/onboarding.d.ts.map +1 -0
  137. package/dist/messaging/onboarding.js +69 -0
  138. package/dist/messaging/onboarding.js.map +1 -0
  139. package/dist/messaging/presence.d.ts +12 -0
  140. package/dist/messaging/presence.d.ts.map +1 -0
  141. package/dist/messaging/presence.js +43 -0
  142. package/dist/messaging/presence.js.map +1 -0
  143. package/dist/messaging/privacy.d.ts +11 -0
  144. package/dist/messaging/privacy.d.ts.map +1 -0
  145. package/dist/messaging/privacy.js +34 -0
  146. package/dist/messaging/privacy.js.map +1 -0
  147. package/dist/messaging/profile.d.ts +13 -0
  148. package/dist/messaging/profile.d.ts.map +1 -0
  149. package/dist/messaging/profile.js +49 -0
  150. package/dist/messaging/profile.js.map +1 -0
  151. package/dist/messaging/quick-replies.d.ts +13 -0
  152. package/dist/messaging/quick-replies.d.ts.map +1 -0
  153. package/dist/messaging/quick-replies.js +45 -0
  154. package/dist/messaging/quick-replies.js.map +1 -0
  155. package/dist/messaging/quicklinks.d.ts +69 -0
  156. package/dist/messaging/quicklinks.d.ts.map +1 -0
  157. package/dist/messaging/quicklinks.js +45 -0
  158. package/dist/messaging/quicklinks.js.map +1 -0
  159. package/dist/messaging/session-configuration.d.ts +67 -0
  160. package/dist/messaging/session-configuration.d.ts.map +1 -0
  161. package/dist/messaging/session-configuration.js +2 -0
  162. package/dist/messaging/session-configuration.js.map +1 -0
  163. package/dist/messaging/sessions.d.ts +26 -0
  164. package/dist/messaging/sessions.d.ts.map +1 -0
  165. package/dist/messaging/sessions.js +108 -0
  166. package/dist/messaging/sessions.js.map +1 -0
  167. package/dist/messaging/templates.d.ts +15 -0
  168. package/dist/messaging/templates.d.ts.map +1 -0
  169. package/dist/messaging/templates.js +67 -0
  170. package/dist/messaging/templates.js.map +1 -0
  171. package/dist/messaging/testing-configuration.d.ts +89 -0
  172. package/dist/messaging/testing-configuration.d.ts.map +1 -0
  173. package/dist/messaging/testing-configuration.js +14 -0
  174. package/dist/messaging/testing-configuration.js.map +1 -0
  175. package/dist/messaging/types.d.ts +1793 -0
  176. package/dist/messaging/types.d.ts.map +1 -0
  177. package/dist/messaging/types.js +25 -0
  178. package/dist/messaging/types.js.map +1 -0
  179. package/dist/messaging/users.d.ts +9 -0
  180. package/dist/messaging/users.d.ts.map +1 -0
  181. package/dist/messaging/users.js +15 -0
  182. package/dist/messaging/users.js.map +1 -0
  183. package/dist/messaging/voip.d.ts +51 -0
  184. package/dist/messaging/voip.d.ts.map +1 -0
  185. package/dist/messaging/voip.js +293 -0
  186. package/dist/messaging/voip.js.map +1 -0
  187. package/dist/messaging/webhooks.d.ts +13 -0
  188. package/dist/messaging/webhooks.d.ts.map +1 -0
  189. package/dist/messaging/webhooks.js +48 -0
  190. package/dist/messaging/webhooks.js.map +1 -0
  191. package/dist/node.d.ts +55 -0
  192. package/dist/node.d.ts.map +1 -0
  193. package/dist/node.js +237 -0
  194. package/dist/node.js.map +1 -0
  195. package/dist/pagination.d.ts +24 -0
  196. package/dist/pagination.d.ts.map +1 -0
  197. package/dist/pagination.js +28 -0
  198. package/dist/pagination.js.map +1 -0
  199. package/dist/platform/api-keys.d.ts +10 -0
  200. package/dist/platform/api-keys.d.ts.map +1 -0
  201. package/dist/platform/api-keys.js +22 -0
  202. package/dist/platform/api-keys.js.map +1 -0
  203. package/dist/platform/audiences.d.ts +16 -0
  204. package/dist/platform/audiences.d.ts.map +1 -0
  205. package/dist/platform/audiences.js +46 -0
  206. package/dist/platform/audiences.js.map +1 -0
  207. package/dist/platform/audit-logs.d.ts +9 -0
  208. package/dist/platform/audit-logs.d.ts.map +1 -0
  209. package/dist/platform/audit-logs.js +20 -0
  210. package/dist/platform/audit-logs.js.map +1 -0
  211. package/dist/platform/bansafe.d.ts +24 -0
  212. package/dist/platform/bansafe.d.ts.map +1 -0
  213. package/dist/platform/bansafe.js +70 -0
  214. package/dist/platform/bansafe.js.map +1 -0
  215. package/dist/platform/billing.d.ts +13 -0
  216. package/dist/platform/billing.d.ts.map +1 -0
  217. package/dist/platform/billing.js +27 -0
  218. package/dist/platform/billing.js.map +1 -0
  219. package/dist/platform/campaigns.d.ts +28 -0
  220. package/dist/platform/campaigns.d.ts.map +1 -0
  221. package/dist/platform/campaigns.js +92 -0
  222. package/dist/platform/campaigns.js.map +1 -0
  223. package/dist/platform/customers.d.ts +23 -0
  224. package/dist/platform/customers.d.ts.map +1 -0
  225. package/dist/platform/customers.js +140 -0
  226. package/dist/platform/customers.js.map +1 -0
  227. package/dist/platform/developer-resources.d.ts +101 -0
  228. package/dist/platform/developer-resources.d.ts.map +1 -0
  229. package/dist/platform/developer-resources.js +250 -0
  230. package/dist/platform/developer-resources.js.map +1 -0
  231. package/dist/platform/developer-types.d.ts +378 -0
  232. package/dist/platform/developer-types.d.ts.map +1 -0
  233. package/dist/platform/developer-types.js +2 -0
  234. package/dist/platform/developer-types.js.map +1 -0
  235. package/dist/platform/event-stream.d.ts +114 -0
  236. package/dist/platform/event-stream.d.ts.map +1 -0
  237. package/dist/platform/event-stream.js +308 -0
  238. package/dist/platform/event-stream.js.map +1 -0
  239. package/dist/platform/media.d.ts +13 -0
  240. package/dist/platform/media.d.ts.map +1 -0
  241. package/dist/platform/media.js +33 -0
  242. package/dist/platform/media.js.map +1 -0
  243. package/dist/platform/members.d.ts +9 -0
  244. package/dist/platform/members.d.ts.map +1 -0
  245. package/dist/platform/members.js +15 -0
  246. package/dist/platform/members.js.map +1 -0
  247. package/dist/platform/opt-outs.d.ts +15 -0
  248. package/dist/platform/opt-outs.d.ts.map +1 -0
  249. package/dist/platform/opt-outs.js +36 -0
  250. package/dist/platform/opt-outs.js.map +1 -0
  251. package/dist/platform/organizations.d.ts +9 -0
  252. package/dist/platform/organizations.d.ts.map +1 -0
  253. package/dist/platform/organizations.js +15 -0
  254. package/dist/platform/organizations.js.map +1 -0
  255. package/dist/platform/project-tokens.d.ts +9 -0
  256. package/dist/platform/project-tokens.d.ts.map +1 -0
  257. package/dist/platform/project-tokens.js +16 -0
  258. package/dist/platform/project-tokens.js.map +1 -0
  259. package/dist/platform/projects.d.ts +24 -0
  260. package/dist/platform/projects.d.ts.map +1 -0
  261. package/dist/platform/projects.js +83 -0
  262. package/dist/platform/projects.js.map +1 -0
  263. package/dist/platform/quicklink-settings.d.ts +85 -0
  264. package/dist/platform/quicklink-settings.d.ts.map +1 -0
  265. package/dist/platform/quicklink-settings.js +35 -0
  266. package/dist/platform/quicklink-settings.js.map +1 -0
  267. package/dist/platform/response.d.ts +10 -0
  268. package/dist/platform/response.d.ts.map +1 -0
  269. package/dist/platform/response.js +41 -0
  270. package/dist/platform/response.js.map +1 -0
  271. package/dist/platform/security-incidents.d.ts +10 -0
  272. package/dist/platform/security-incidents.d.ts.map +1 -0
  273. package/dist/platform/security-incidents.js +22 -0
  274. package/dist/platform/security-incidents.js.map +1 -0
  275. package/dist/platform/session-bans.d.ts +13 -0
  276. package/dist/platform/session-bans.d.ts.map +1 -0
  277. package/dist/platform/session-bans.js +21 -0
  278. package/dist/platform/session-bans.js.map +1 -0
  279. package/dist/platform/session-configuration.d.ts +15 -0
  280. package/dist/platform/session-configuration.d.ts.map +1 -0
  281. package/dist/platform/session-configuration.js +36 -0
  282. package/dist/platform/session-configuration.js.map +1 -0
  283. package/dist/platform/sessions.d.ts +26 -0
  284. package/dist/platform/sessions.d.ts.map +1 -0
  285. package/dist/platform/sessions.js +121 -0
  286. package/dist/platform/sessions.js.map +1 -0
  287. package/dist/platform/sip-trunks.d.ts +141 -0
  288. package/dist/platform/sip-trunks.d.ts.map +1 -0
  289. package/dist/platform/sip-trunks.js +140 -0
  290. package/dist/platform/sip-trunks.js.map +1 -0
  291. package/dist/platform/types.d.ts +897 -0
  292. package/dist/platform/types.d.ts.map +1 -0
  293. package/dist/platform/types.js +2 -0
  294. package/dist/platform/types.js.map +1 -0
  295. package/dist/raw.d.ts +26 -0
  296. package/dist/raw.d.ts.map +1 -0
  297. package/dist/raw.js +79 -0
  298. package/dist/raw.js.map +1 -0
  299. package/dist/system.d.ts +37 -0
  300. package/dist/system.d.ts.map +1 -0
  301. package/dist/system.js +45 -0
  302. package/dist/system.js.map +1 -0
  303. package/dist/transport/body.d.ts +6 -0
  304. package/dist/transport/body.d.ts.map +1 -0
  305. package/dist/transport/body.js +33 -0
  306. package/dist/transport/body.js.map +1 -0
  307. package/dist/transport/content-disposition.d.ts +9 -0
  308. package/dist/transport/content-disposition.d.ts.map +1 -0
  309. package/dist/transport/content-disposition.js +107 -0
  310. package/dist/transport/content-disposition.js.map +1 -0
  311. package/dist/transport/http.d.ts +35 -0
  312. package/dist/transport/http.d.ts.map +1 -0
  313. package/dist/transport/http.js +660 -0
  314. package/dist/transport/http.js.map +1 -0
  315. package/dist/transport/idempotency.d.ts +10 -0
  316. package/dist/transport/idempotency.d.ts.map +1 -0
  317. package/dist/transport/idempotency.js +13 -0
  318. package/dist/transport/idempotency.js.map +1 -0
  319. package/dist/transport/retry.d.ts +11 -0
  320. package/dist/transport/retry.d.ts.map +1 -0
  321. package/dist/transport/retry.js +45 -0
  322. package/dist/transport/retry.js.map +1 -0
  323. package/dist/transport/types.d.ts +58 -0
  324. package/dist/transport/types.d.ts.map +1 -0
  325. package/dist/transport/types.js +2 -0
  326. package/dist/transport/types.js.map +1 -0
  327. package/dist/version.d.ts +2 -0
  328. package/dist/version.d.ts.map +1 -0
  329. package/dist/version.js +2 -0
  330. package/dist/version.js.map +1 -0
  331. package/dist/webhooks/events.d.ts +741 -0
  332. package/dist/webhooks/events.d.ts.map +1 -0
  333. package/dist/webhooks/events.js +80 -0
  334. package/dist/webhooks/events.js.map +1 -0
  335. package/dist/webhooks/index.d.ts +4 -0
  336. package/dist/webhooks/index.d.ts.map +1 -0
  337. package/dist/webhooks/index.js +4 -0
  338. package/dist/webhooks/index.js.map +1 -0
  339. package/dist/webhooks/utilities.d.ts +33 -0
  340. package/dist/webhooks/utilities.d.ts.map +1 -0
  341. package/dist/webhooks/utilities.js +67 -0
  342. package/dist/webhooks/utilities.js.map +1 -0
  343. package/dist/webhooks/verify.d.ts +9 -0
  344. package/dist/webhooks/verify.d.ts.map +1 -0
  345. package/dist/webhooks/verify.js +77 -0
  346. package/dist/webhooks/verify.js.map +1 -0
  347. package/package.json +58 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"developer-types.js","sourceRoot":"","sources":["../../src/platform/developer-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,114 @@
1
+ import type { HttpTransport } from "../transport/http.js";
2
+ import type { EncodedEventPayload, JsonValue } from "./developer-types.js";
3
+ /** The event object in an `event` frame. Same fields as a project event. */
4
+ export interface StreamedEvent {
5
+ readonly id: string;
6
+ readonly organizationId: string;
7
+ readonly projectId: string;
8
+ readonly type: string;
9
+ readonly source: "runtime" | "platform" | "test";
10
+ readonly environment: "development" | "production";
11
+ readonly createdAt: string;
12
+ readonly payloadAvailability: "available" | "not_retained" | "unavailable";
13
+ readonly payload: EncodedEventPayload | null;
14
+ readonly replayableUntil: string | null;
15
+ readonly metadataExpiresAt: string;
16
+ }
17
+ /** The decoded webhook body carried in `payload`, when available. */
18
+ export interface WebhookEnvelope {
19
+ readonly id: string;
20
+ readonly session: string;
21
+ readonly externalId?: string;
22
+ readonly timestamp: string;
23
+ readonly event: string;
24
+ readonly payload: JsonValue;
25
+ }
26
+ /** One delivered event. Save `cursor` after processing to resume later. */
27
+ export interface EventStreamItem {
28
+ readonly event: StreamedEvent;
29
+ /** The connection that delivered this event; use with `acknowledgeStream`. */
30
+ readonly streamId: string;
31
+ /** Frame number on that connection; use with `acknowledgeStream`. */
32
+ readonly sequence: number;
33
+ /** The exact webhook body, or null when `event.payload` is null. */
34
+ readonly webhook: WebhookEnvelope | null;
35
+ readonly cursor: string;
36
+ }
37
+ export interface EventStreamAcknowledgement {
38
+ readonly cursor: string;
39
+ readonly sequence: number;
40
+ }
41
+ export interface EventStreamAcknowledgementReceipt {
42
+ readonly streamId: string;
43
+ readonly acknowledgedCursor: string;
44
+ readonly sequence: number;
45
+ readonly replayed: boolean;
46
+ }
47
+ export interface EventStreamGap {
48
+ readonly reason: "retention_exceeded";
49
+ readonly missedEvents: number;
50
+ readonly requestedCursor: string | null;
51
+ }
52
+ export interface EventStreamParams {
53
+ /** Event types to include. A trailing `*` matches a prefix. Omit for all. */
54
+ readonly types?: readonly string[];
55
+ /** Resume after this cursor, for example the last `EventStreamItem.cursor` you saved. */
56
+ readonly since?: string;
57
+ /** Stops the stream. The iterator then ends without an error. */
58
+ readonly signal?: AbortSignal;
59
+ /** Reconnect delay bounds. Defaults: 1 000 ms initial, 30 000 ms maximum. */
60
+ readonly reconnect?: {
61
+ readonly initialDelayMs?: number;
62
+ readonly maxDelayMs?: number;
63
+ };
64
+ /** Called when retention removed events after `since`. The stream continues. */
65
+ readonly onGap?: (gap: EventStreamGap) => void;
66
+ /** Called before each reconnect with the error that ended the last connection. */
67
+ readonly onReconnect?: (error: unknown, delayMs: number) => void;
68
+ /** Maximum wait for response headers per connection. Defaults to the client timeout. */
69
+ readonly timeoutMs?: number;
70
+ /**
71
+ * `auto` (default) releases events as they are written. `manual` holds up
72
+ * to `maxInFlight` events until you call `events.acknowledgeStream`.
73
+ */
74
+ readonly ack?: "auto" | "manual";
75
+ }
76
+ export interface OrganizationEventStreamParams extends EventStreamParams {
77
+ /** Organization credentials stream one project at a time. */
78
+ readonly projectId: string;
79
+ }
80
+ /** A structural match for `LiveEventSource` from `@polymorfa/store`. */
81
+ export interface LiveEventSourceAdapter {
82
+ subscribe(listener: (events: WebhookEnvelope | readonly WebhookEnvelope[], meta?: {
83
+ readonly cursor?: string;
84
+ }) => void, options?: {
85
+ readonly cursor?: string;
86
+ readonly onError?: (error: unknown) => void;
87
+ }): () => void;
88
+ }
89
+ /**
90
+ * Streams project events with automatic reconnect and resume.
91
+ *
92
+ * Iterate with `for await`. The stream reconnects with exponential backoff
93
+ * and jitter after a dropped connection, an `expiry`, or a recoverable `gap`,
94
+ * sending the last delivered cursor as `Last-Event-ID`. Authentication,
95
+ * authorization, invalid or expired cursors, and `revoked` end the iterator
96
+ * with an error. Aborting `signal` or leaving the loop ends it without one.
97
+ */
98
+ export declare class EventStream implements AsyncIterable<EventStreamItem> {
99
+ #private;
100
+ private readonly transport;
101
+ private readonly path;
102
+ private readonly params;
103
+ constructor(transport: HttpTransport, path: string, params: EventStreamParams);
104
+ /** The cursor of the last event this stream delivered. */
105
+ get cursor(): string | undefined;
106
+ [Symbol.asyncIterator](): AsyncIterator<EventStreamItem>;
107
+ }
108
+ /**
109
+ * Adapts a stream factory to the `LiveEventSource` shape used by
110
+ * `@polymorfa/store`'s `connectEventSource`. Events without a webhook body
111
+ * (hosted message storage off) are skipped, because the store needs the body.
112
+ */
113
+ export declare function eventStreamSource(open: (params: EventStreamParams) => EventStream, params?: Omit<EventStreamParams, "since" | "signal">): LiveEventSourceAdapter;
114
+ //# sourceMappingURL=event-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-stream.d.ts","sourceRoot":"","sources":["../../src/platform/event-stream.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE3E,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACt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ACP,QAAQ,EAAE,CACR,MAAM,EAAE,eAAe,GAAG,SAAS,eAAe,EAAE,EACpD,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAChC,IAAI,EACT,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;KAC7C,GACA,MAAM,IAAI,CAAC;CACf;AAkHD;;;;;;;;GAQG;AACH,qBAAa,WAAY,YAAW,aAAa,CAAC,eAAe,CAAC;;IAI9D,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,iBAAiB;IAK5C,0DAA0D;IAC1D,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAEM,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,eAAe,CAAC;CA6JhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,WAAW,EAChD,MAAM,GAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAM,GACvD,sBAAsB,CAsBxB"}
@@ -0,0 +1,308 @@
1
+ import { PolymorfaAuthenticationError, PolymorfaAuthorizationError, PolymorfaError, PolymorfaNotFoundError, PolymorfaRateLimitError, PolymorfaServerError, PolymorfaValidationError, } from "../errors.js";
2
+ /** Incremental `text/event-stream` parser (WHATWG rules, UTF-8 input). */
3
+ class SseParser {
4
+ #buffer = "";
5
+ #event = "";
6
+ #data = [];
7
+ #id;
8
+ #carriageReturn = false;
9
+ feed(chunk) {
10
+ if (this.#carriageReturn && chunk.startsWith("\n"))
11
+ chunk = chunk.slice(1);
12
+ this.#carriageReturn = chunk.endsWith("\r");
13
+ const lines = (this.#buffer + chunk).split(/\r\n|\r|\n/);
14
+ this.#buffer = lines.pop() ?? "";
15
+ const messages = [];
16
+ for (const line of lines) {
17
+ if (line === "") {
18
+ if (this.#data.length > 0) {
19
+ messages.push({
20
+ event: this.#event === "" ? "message" : this.#event,
21
+ data: this.#data.join("\n"),
22
+ ...(this.#id === undefined ? {} : { id: this.#id }),
23
+ });
24
+ }
25
+ this.#event = "";
26
+ this.#data = [];
27
+ this.#id = undefined;
28
+ continue;
29
+ }
30
+ if (line.startsWith(":"))
31
+ continue;
32
+ const colon = line.indexOf(":");
33
+ const field = colon < 0 ? line : line.slice(0, colon);
34
+ let value = colon < 0 ? "" : line.slice(colon + 1);
35
+ if (value.startsWith(" "))
36
+ value = value.slice(1);
37
+ if (field === "event")
38
+ this.#event = value;
39
+ else if (field === "data")
40
+ this.#data.push(value);
41
+ else if (field === "id" && !value.includes("\u0000"))
42
+ this.#id = value;
43
+ }
44
+ return messages;
45
+ }
46
+ }
47
+ class ReconnectSignal extends Error {
48
+ reason;
49
+ resetBackoff;
50
+ constructor(reason, resetBackoff) {
51
+ super(`Event stream closed: ${reason}.`);
52
+ this.reason = reason;
53
+ this.resetBackoff = resetBackoff;
54
+ }
55
+ }
56
+ function decodeWebhook(payload) {
57
+ if (payload === null || payload === undefined)
58
+ return null;
59
+ const bytes = Uint8Array.from(atob(payload.data), (char) => char.charCodeAt(0));
60
+ return JSON.parse(new TextDecoder().decode(bytes));
61
+ }
62
+ /** Parses `Retry-After` as delta-seconds or an HTTP-date. Blank values are ignored. */
63
+ function retryAfterMs(error, now = Date.now()) {
64
+ const header = error.metadata?.headers["retry-after"]?.trim();
65
+ if (header === undefined || header === "")
66
+ return undefined;
67
+ if (/^\d+$/.test(header))
68
+ return Number(header) * 1_000;
69
+ const date = Date.parse(header);
70
+ return Number.isFinite(date) ? Math.max(0, date - now) : undefined;
71
+ }
72
+ /** Waits `delayMs`, ending early when `signal` aborts. Never leaves a listener behind. */
73
+ function waitForReconnect(delayMs, signal) {
74
+ if (signal?.aborted === true)
75
+ return Promise.resolve();
76
+ return new Promise((resolve) => {
77
+ const finish = () => {
78
+ clearTimeout(timer);
79
+ signal?.removeEventListener("abort", finish);
80
+ resolve();
81
+ };
82
+ const timer = setTimeout(finish, delayMs);
83
+ signal?.addEventListener("abort", finish, { once: true });
84
+ });
85
+ }
86
+ /** Errors that no reconnect can fix end the iterator; everything else retries. */
87
+ function isTerminal(error) {
88
+ if (error instanceof PolymorfaRateLimitError ||
89
+ error instanceof PolymorfaServerError)
90
+ return false;
91
+ return (error instanceof PolymorfaAuthenticationError ||
92
+ error instanceof PolymorfaAuthorizationError ||
93
+ error instanceof PolymorfaNotFoundError ||
94
+ error instanceof PolymorfaValidationError ||
95
+ (error instanceof PolymorfaError && error.status === 410) ||
96
+ (error instanceof PolymorfaError && error.code === "stream_revoked"));
97
+ }
98
+ /**
99
+ * Streams project events with automatic reconnect and resume.
100
+ *
101
+ * Iterate with `for await`. The stream reconnects with exponential backoff
102
+ * and jitter after a dropped connection, an `expiry`, or a recoverable `gap`,
103
+ * sending the last delivered cursor as `Last-Event-ID`. Authentication,
104
+ * authorization, invalid or expired cursors, and `revoked` end the iterator
105
+ * with an error. Aborting `signal` or leaving the loop ends it without one.
106
+ */
107
+ export class EventStream {
108
+ transport;
109
+ path;
110
+ params;
111
+ #cursor;
112
+ constructor(transport, path, params) {
113
+ this.transport = transport;
114
+ this.path = path;
115
+ this.params = params;
116
+ this.#cursor = params.since;
117
+ }
118
+ /** The cursor of the last event this stream delivered. */
119
+ get cursor() {
120
+ return this.#cursor;
121
+ }
122
+ async *[Symbol.asyncIterator]() {
123
+ const initialDelay = this.params.reconnect?.initialDelayMs ?? 1_000;
124
+ const maxDelay = this.params.reconnect?.maxDelayMs ?? 30_000;
125
+ let attempt = 0;
126
+ const outer = this.params.signal;
127
+ const stopped = () => outer?.aborted === true;
128
+ while (!stopped()) {
129
+ const controller = new AbortController();
130
+ const forward = () => controller.abort(outer?.reason);
131
+ outer?.addEventListener("abort", forward, { once: true });
132
+ let failure;
133
+ let serverDelay;
134
+ try {
135
+ for await (const item of this.#connect(controller)) {
136
+ attempt = 0;
137
+ yield item;
138
+ }
139
+ if (stopped())
140
+ return;
141
+ failure = new ReconnectSignal("closed", false);
142
+ }
143
+ catch (error) {
144
+ if (stopped())
145
+ return;
146
+ if (isTerminal(error))
147
+ throw error;
148
+ failure = error;
149
+ if (error instanceof ReconnectSignal && error.resetBackoff)
150
+ attempt = 0;
151
+ if (error instanceof PolymorfaError)
152
+ serverDelay = retryAfterMs(error);
153
+ }
154
+ finally {
155
+ outer?.removeEventListener("abort", forward);
156
+ controller.abort();
157
+ }
158
+ const ceiling = Math.min(maxDelay, initialDelay * 2 ** attempt);
159
+ const delay = serverDelay === undefined
160
+ ? Math.round(ceiling / 2 + Math.random() * (ceiling / 2))
161
+ : Math.min(serverDelay, maxDelay);
162
+ attempt += 1;
163
+ this.params.onReconnect?.(failure, delay);
164
+ if (stopped())
165
+ return;
166
+ await waitForReconnect(delay, outer);
167
+ }
168
+ }
169
+ async *#connect(controller) {
170
+ const query = {};
171
+ if (this.params.types !== undefined && this.params.types.length > 0) {
172
+ query.types = this.params.types.join(",");
173
+ }
174
+ if (this.params.ack === "manual")
175
+ query.ack = "manual";
176
+ const { response } = await this.transport.openStream({
177
+ method: "GET",
178
+ path: this.path,
179
+ query,
180
+ accept: "text/event-stream",
181
+ headers: this.#cursor === undefined ? {} : { "last-event-id": this.#cursor },
182
+ signal: controller.signal,
183
+ ...(this.params.timeoutMs === undefined
184
+ ? {}
185
+ : { timeoutMs: this.params.timeoutMs }),
186
+ });
187
+ if (response.body === null)
188
+ throw new ReconnectSignal("empty_body", false);
189
+ const reader = response.body
190
+ .pipeThrough(new TextDecoderStream())
191
+ .getReader();
192
+ const parser = new SseParser();
193
+ // Some fetch implementations do not error a body when its request signal
194
+ // aborts; cancel the reader directly so a pending read always settles.
195
+ const cancelRead = () => void reader.cancel(controller.signal.reason).catch(() => undefined);
196
+ controller.signal.addEventListener("abort", cancelRead, { once: true });
197
+ let heartbeatMs = 15_000;
198
+ let watchdog;
199
+ const arm = () => {
200
+ clearTimeout(watchdog);
201
+ watchdog = setTimeout(() => controller.abort(new ReconnectSignal("heartbeat_missed", false)), heartbeatMs * 2);
202
+ };
203
+ arm();
204
+ try {
205
+ for (;;) {
206
+ let chunk;
207
+ try {
208
+ chunk = await reader.read();
209
+ }
210
+ catch (error) {
211
+ if (controller.signal.reason instanceof ReconnectSignal)
212
+ throw controller.signal.reason;
213
+ throw error;
214
+ }
215
+ if (chunk.done) {
216
+ if (controller.signal.reason instanceof ReconnectSignal)
217
+ throw controller.signal.reason;
218
+ return;
219
+ }
220
+ arm();
221
+ for (const message of parser.feed(chunk.value)) {
222
+ const frame = JSON.parse(message.data);
223
+ switch (frame.type) {
224
+ case "ready":
225
+ if (typeof frame.heartbeatIntervalMs === "number") {
226
+ heartbeatMs = frame.heartbeatIntervalMs;
227
+ arm();
228
+ }
229
+ break;
230
+ case "event": {
231
+ const event = frame.event;
232
+ const cursor = String(frame.cursor);
233
+ this.#cursor = cursor;
234
+ yield Object.freeze({
235
+ event,
236
+ webhook: decodeWebhook(event.payload),
237
+ cursor,
238
+ streamId: String(frame.streamId),
239
+ sequence: Number(frame.sequence),
240
+ });
241
+ break;
242
+ }
243
+ case "checkpoint":
244
+ // Checkpoints advance the resume position on quiet or filtered
245
+ // streams, so a reconnect does not replay from an older cursor.
246
+ if (typeof frame.cursor === "string")
247
+ this.#cursor = frame.cursor;
248
+ break;
249
+ case "gap":
250
+ if (frame.reason === "retention_exceeded") {
251
+ this.params.onGap?.({
252
+ reason: "retention_exceeded",
253
+ missedEvents: Number(frame.missedEvents ?? 0),
254
+ requestedCursor: frame.requestedCursor ?? null,
255
+ });
256
+ break;
257
+ }
258
+ throw new ReconnectSignal(`gap_${String(frame.reason)}`, false);
259
+ case "expiry":
260
+ throw new ReconnectSignal("expiry", true);
261
+ case "dropped":
262
+ throw new ReconnectSignal("dropped", false);
263
+ case "revoked":
264
+ throw new PolymorfaAuthorizationError("The event stream was revoked. Check the credential, its events:listen permission, and the team's Event streams enrollment.", { code: "stream_revoked" });
265
+ default:
266
+ break;
267
+ }
268
+ }
269
+ }
270
+ }
271
+ finally {
272
+ clearTimeout(watchdog);
273
+ controller.signal.removeEventListener("abort", cancelRead);
274
+ await reader.cancel().catch(() => undefined);
275
+ }
276
+ }
277
+ }
278
+ /**
279
+ * Adapts a stream factory to the `LiveEventSource` shape used by
280
+ * `@polymorfa/store`'s `connectEventSource`. Events without a webhook body
281
+ * (hosted message storage off) are skipped, because the store needs the body.
282
+ */
283
+ export function eventStreamSource(open, params = {}) {
284
+ return {
285
+ subscribe(listener, options = {}) {
286
+ const controller = new AbortController();
287
+ const stream = open({
288
+ ...params,
289
+ ...(options.cursor === undefined ? {} : { since: options.cursor }),
290
+ signal: controller.signal,
291
+ });
292
+ void (async () => {
293
+ try {
294
+ for await (const item of stream) {
295
+ if (item.webhook !== null)
296
+ listener([item.webhook], { cursor: item.cursor });
297
+ }
298
+ }
299
+ catch (error) {
300
+ if (!controller.signal.aborted)
301
+ options.onError?.(error);
302
+ }
303
+ })();
304
+ return () => controller.abort();
305
+ },
306
+ };
307
+ }
308
+ //# sourceMappingURL=event-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-stream.js","sourceRoot":"","sources":["../../src/platform/event-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AA6GtB,0EAA0E;AAC1E,MAAM,SAAS;IACb,OAAO,GAAG,EAAE,CAAC;IACb,MAAM,GAAG,EAAE,CAAC;IACZ,KAAK,GAAa,EAAE,CAAC;IACrB,GAAG,CA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iB,CAC/B,IAAgD,EAChD,SAAsD,EAAE;IAExD,OAAO;QACL,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,EAAE;YAC9B,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC;gBAClB,GAAG,MAAM;gBACT,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;gBAClE,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YACH,KAAK,CAAC,KAAK,IAAI,EAAE;gBACf,IAAI,CAAC;oBACH,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;wBAChC,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;4BACvB,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;oBACtD,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;wBAAE,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;YACL,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ import type { ApiResponse, RequestOptions } from "../transport/types.js";
3
+ import type { DataEnvelope, PlatformPayload } from "./types.js";
4
+ type MediaResponse = Promise<ApiResponse<DataEnvelope<PlatformPayload>>>;
5
+ export declare class MediaResource {
6
+ private readonly transport;
7
+ constructor(transport: HttpTransport);
8
+ retrieve(mediaId: string, options?: RequestOptions): MediaResponse;
9
+ delete(mediaId: string, options?: RequestOptions): MediaResponse;
10
+ createUpload(body?: PlatformPayload, options?: RequestOptions): MediaResponse;
11
+ }
12
+ export {};
13
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/platform/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,KAAK,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AAEzE,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa;IAQtE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa;IAQpE,YAAY,CACV,IAAI,CAAC,EAAE,eAAe,EACtB,OAAO,GAAE,cAAmB,GAC3B,aAAa;CAQjB"}
@@ -0,0 +1,33 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ export class MediaResource {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ retrieve(mediaId, options = {}) {
8
+ return this.transport.request({
9
+ method: "GET",
10
+ path: mediaPath(mediaId),
11
+ ...options,
12
+ });
13
+ }
14
+ delete(mediaId, options = {}) {
15
+ return this.transport.request({
16
+ method: "DELETE",
17
+ path: mediaPath(mediaId),
18
+ ...options,
19
+ });
20
+ }
21
+ createUpload(body, options = {}) {
22
+ return this.transport.request({
23
+ method: "POST",
24
+ path: "/platform/media/uploads",
25
+ ...(body === undefined ? {} : { body }),
26
+ ...options,
27
+ });
28
+ }
29
+ }
30
+ function mediaPath(mediaId) {
31
+ return `/platform/media/${encodeURIComponent(mediaId)}`;
32
+ }
33
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/platform/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,QAAQ,CAAC,OAAe,EAAE,UAA0B,EAAE;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC;YACxB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,OAAe,EAAE,UAA0B,EAAE;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC;YACxB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CACV,IAAsB,EACtB,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAyB;YAC/B,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;YACvC,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,mBAAmB,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ import type { ApiResponse, RequestOptions } from "../transport/types.js";
3
+ import type { DataEnvelope, OrganizationMember } from "./types.js";
4
+ export declare class MembersResource {
5
+ private readonly transport;
6
+ constructor(transport: HttpTransport);
7
+ list(options?: RequestOptions): Promise<ApiResponse<DataEnvelope<readonly OrganizationMember[]>>>;
8
+ }
9
+ //# sourceMappingURL=members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../src/platform/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEnE,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,IAAI,CACF,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAAC,CAAC;CAOrE"}
@@ -0,0 +1,15 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ export class MembersResource {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ list(options = {}) {
8
+ return this.transport.request({
9
+ method: "GET",
10
+ path: "/platform/members",
11
+ ...options,
12
+ });
13
+ }
14
+ }
15
+ //# sourceMappingURL=members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.js","sourceRoot":"","sources":["../../src/platform/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,IAAI,CACF,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ import type { ApiResponse, RequestOptions } from "../transport/types.js";
3
+ import type { DataEnvelope, PlatformPayload } from "./types.js";
4
+ type OptOutResponse = Promise<ApiResponse<DataEnvelope<PlatformPayload>>>;
5
+ export declare class OptOutsResource {
6
+ private readonly transport;
7
+ constructor(transport: HttpTransport);
8
+ list(options?: RequestOptions): OptOutResponse;
9
+ create(body?: PlatformPayload, options?: RequestOptions): OptOutResponse;
10
+ createBatch(body?: PlatformPayload, options?: RequestOptions): OptOutResponse;
11
+ delete(phone: string, options?: RequestOptions): OptOutResponse;
12
+ private write;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=opt-outs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opt-outs.d.ts","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,KAAK,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AAE1E,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,cAAc;IAQlD,MAAM,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc;IAI5E,WAAW,CACT,IAAI,CAAC,EAAE,eAAe,EACtB,OAAO,GAAE,cAAmB,GAC3B,cAAc;IAIjB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc;IAQnE,OAAO,CAAC,KAAK;CAYd"}
@@ -0,0 +1,36 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ export class OptOutsResource {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ list(options = {}) {
8
+ return this.transport.request({
9
+ method: "GET",
10
+ path: "/platform/optouts",
11
+ ...options,
12
+ });
13
+ }
14
+ create(body, options = {}) {
15
+ return this.write("/platform/optouts", body, options);
16
+ }
17
+ createBatch(body, options = {}) {
18
+ return this.write("/platform/optouts/batch", body, options);
19
+ }
20
+ delete(phone, options = {}) {
21
+ return this.transport.request({
22
+ method: "DELETE",
23
+ path: `/platform/optouts/${encodeURIComponent(phone)}`,
24
+ ...options,
25
+ });
26
+ }
27
+ write(path, body, options) {
28
+ return this.transport.request({
29
+ method: "POST",
30
+ path,
31
+ ...(body === undefined ? {} : { body }),
32
+ ...options,
33
+ });
34
+ }
35
+ }
36
+ //# sourceMappingURL=opt-outs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opt-outs.js","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,IAAI,CAAC,UAA0B,EAAE;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAsB,EAAE,UAA0B,EAAE;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,WAAW,CACT,IAAsB,EACtB,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,UAA0B,EAAE;QAChD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,KAAK,CAAC,EAAE;YACtD,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CACX,IAAY,EACZ,IAAiC,EACjC,OAAuB;QAEvB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;YACvC,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ import type { ApiResponse, RequestOptions } from "../transport/types.js";
3
+ import type { DataEnvelope, Organization } from "./types.js";
4
+ export declare class OrganizationsResource {
5
+ private readonly transport;
6
+ constructor(transport: HttpTransport);
7
+ retrieve(options?: RequestOptions): Promise<ApiResponse<DataEnvelope<Organization>>>;
8
+ }
9
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/platform/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,QAAQ,CACN,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;CAOpD"}
@@ -0,0 +1,15 @@
1
+ import { HttpTransport } from "../transport/http.js";
2
+ export class OrganizationsResource {
3
+ transport;
4
+ constructor(transport) {
5
+ this.transport = transport;
6
+ }
7
+ retrieve(options = {}) {
8
+ return this.transport.request({
9
+ method: "GET",
10
+ path: "/platform/team",
11
+ ...options,
12
+ });
13
+ }
14
+ }
15
+ //# sourceMappingURL=organizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../src/platform/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,MAAM,OAAO,qBAAqB;IACH;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,QAAQ,CACN,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB;YACtB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}