@trycourier/courier 7.10.1 → 7.11.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.
Files changed (328) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +4 -4
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +4 -4
  11. package/client.d.ts.map +1 -1
  12. package/client.js +12 -1
  13. package/client.js.map +1 -1
  14. package/client.mjs +12 -1
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/uploads.d.mts.map +1 -1
  23. package/core/uploads.d.ts.map +1 -1
  24. package/core/uploads.mjs.map +1 -1
  25. package/error.d.mts +1 -0
  26. package/error.d.mts.map +1 -1
  27. package/error.d.ts +1 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.mjs +1 -0
  30. package/error.mjs.map +1 -1
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.mjs.map +1 -1
  34. package/internal/detect-platform.mjs.map +1 -1
  35. package/internal/headers.mjs.map +1 -1
  36. package/internal/parse.d.mts.map +1 -1
  37. package/internal/parse.d.ts.map +1 -1
  38. package/internal/parse.mjs.map +1 -1
  39. package/internal/qs/formats.d.mts.map +1 -1
  40. package/internal/qs/formats.d.ts.map +1 -1
  41. package/internal/qs/index.d.mts +2 -2
  42. package/internal/qs/index.d.mts.map +1 -1
  43. package/internal/qs/index.d.ts +2 -2
  44. package/internal/qs/index.d.ts.map +1 -1
  45. package/internal/qs/index.mjs.map +1 -1
  46. package/internal/qs/stringify.d.mts.map +1 -1
  47. package/internal/qs/stringify.d.ts.map +1 -1
  48. package/internal/qs/stringify.mjs.map +1 -1
  49. package/internal/qs/utils.d.mts.map +1 -1
  50. package/internal/qs/utils.d.ts.map +1 -1
  51. package/internal/qs/utils.mjs.map +1 -1
  52. package/internal/request-options.d.mts.map +1 -1
  53. package/internal/request-options.d.ts.map +1 -1
  54. package/internal/shims.d.mts +6 -0
  55. package/internal/shims.d.mts.map +1 -1
  56. package/internal/shims.d.ts +6 -0
  57. package/internal/shims.d.ts.map +1 -1
  58. package/internal/to-file.d.mts.map +1 -1
  59. package/internal/to-file.d.ts.map +1 -1
  60. package/internal/to-file.mjs.map +1 -1
  61. package/internal/types.d.mts +10 -10
  62. package/internal/types.d.mts.map +1 -1
  63. package/internal/types.d.ts +10 -10
  64. package/internal/types.d.ts.map +1 -1
  65. package/internal/uploads.d.mts.map +1 -1
  66. package/internal/uploads.d.ts.map +1 -1
  67. package/internal/uploads.mjs.map +1 -1
  68. package/internal/utils/base64.mjs.map +1 -1
  69. package/internal/utils/log.d.mts.map +1 -1
  70. package/internal/utils/log.d.ts.map +1 -1
  71. package/internal/utils/log.js +2 -0
  72. package/internal/utils/log.js.map +1 -1
  73. package/internal/utils/log.mjs +2 -0
  74. package/internal/utils/log.mjs.map +1 -1
  75. package/internal/utils/path.mjs.map +1 -1
  76. package/internal/utils/query.mjs.map +1 -1
  77. package/internal/utils/values.mjs.map +1 -1
  78. package/internal/utils.d.mts.map +1 -1
  79. package/internal/utils.d.ts.map +1 -1
  80. package/internal/utils.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/resource.d.mts +1 -0
  83. package/resource.d.mts.map +1 -1
  84. package/resource.d.ts +1 -0
  85. package/resource.d.ts.map +1 -1
  86. package/resource.mjs +1 -0
  87. package/resource.mjs.map +1 -1
  88. package/resources/audiences.d.mts.map +1 -1
  89. package/resources/audiences.d.ts.map +1 -1
  90. package/resources/audiences.mjs.map +1 -1
  91. package/resources/audit-events.d.mts.map +1 -1
  92. package/resources/audit-events.d.ts.map +1 -1
  93. package/resources/audit-events.mjs.map +1 -1
  94. package/resources/auth.d.mts.map +1 -1
  95. package/resources/auth.d.ts.map +1 -1
  96. package/resources/auth.mjs.map +1 -1
  97. package/resources/automations/automations.d.mts.map +1 -1
  98. package/resources/automations/automations.d.ts.map +1 -1
  99. package/resources/automations/automations.mjs.map +1 -1
  100. package/resources/automations/index.d.mts.map +1 -1
  101. package/resources/automations/index.d.ts.map +1 -1
  102. package/resources/automations/index.mjs.map +1 -1
  103. package/resources/automations/invoke.d.mts.map +1 -1
  104. package/resources/automations/invoke.d.ts.map +1 -1
  105. package/resources/automations/invoke.mjs.map +1 -1
  106. package/resources/automations.d.mts.map +1 -1
  107. package/resources/automations.d.ts.map +1 -1
  108. package/resources/automations.mjs.map +1 -1
  109. package/resources/brands.d.mts.map +1 -1
  110. package/resources/brands.d.ts.map +1 -1
  111. package/resources/brands.mjs.map +1 -1
  112. package/resources/bulk.d.mts.map +1 -1
  113. package/resources/bulk.d.ts.map +1 -1
  114. package/resources/bulk.mjs.map +1 -1
  115. package/resources/inbound.d.mts.map +1 -1
  116. package/resources/inbound.d.ts.map +1 -1
  117. package/resources/inbound.mjs.map +1 -1
  118. package/resources/index.d.mts +2 -2
  119. package/resources/index.d.mts.map +1 -1
  120. package/resources/index.d.ts +2 -2
  121. package/resources/index.d.ts.map +1 -1
  122. package/resources/index.js +1 -1
  123. package/resources/index.js.map +1 -1
  124. package/resources/index.mjs +1 -1
  125. package/resources/index.mjs.map +1 -1
  126. package/resources/journeys/index.d.mts +3 -0
  127. package/resources/journeys/index.d.mts.map +1 -0
  128. package/resources/journeys/index.d.ts +3 -0
  129. package/resources/journeys/index.d.ts.map +1 -0
  130. package/resources/journeys/index.js +9 -0
  131. package/resources/journeys/index.js.map +1 -0
  132. package/resources/journeys/index.mjs +4 -0
  133. package/resources/journeys/index.mjs.map +1 -0
  134. package/resources/journeys/journeys.d.mts +752 -0
  135. package/resources/journeys/journeys.d.mts.map +1 -0
  136. package/resources/journeys/journeys.d.ts +752 -0
  137. package/resources/journeys/journeys.d.ts.map +1 -0
  138. package/resources/journeys/journeys.js +148 -0
  139. package/resources/journeys/journeys.js.map +1 -0
  140. package/resources/journeys/journeys.mjs +143 -0
  141. package/resources/journeys/journeys.mjs.map +1 -0
  142. package/resources/journeys/templates.d.mts +219 -0
  143. package/resources/journeys/templates.d.mts.map +1 -0
  144. package/resources/journeys/templates.d.ts +219 -0
  145. package/resources/journeys/templates.d.ts.map +1 -0
  146. package/resources/journeys/templates.js +142 -0
  147. package/resources/journeys/templates.js.map +1 -0
  148. package/resources/journeys/templates.mjs +138 -0
  149. package/resources/journeys/templates.mjs.map +1 -0
  150. package/resources/journeys.d.mts +1 -142
  151. package/resources/journeys.d.mts.map +1 -1
  152. package/resources/journeys.d.ts +1 -142
  153. package/resources/journeys.d.ts.map +1 -1
  154. package/resources/journeys.js +2 -34
  155. package/resources/journeys.js.map +1 -1
  156. package/resources/journeys.mjs +1 -32
  157. package/resources/journeys.mjs.map +1 -1
  158. package/resources/lists/index.d.mts.map +1 -1
  159. package/resources/lists/index.d.ts.map +1 -1
  160. package/resources/lists/index.mjs.map +1 -1
  161. package/resources/lists/lists.d.mts.map +1 -1
  162. package/resources/lists/lists.d.ts.map +1 -1
  163. package/resources/lists/lists.mjs.map +1 -1
  164. package/resources/lists/subscriptions.d.mts.map +1 -1
  165. package/resources/lists/subscriptions.d.ts.map +1 -1
  166. package/resources/lists/subscriptions.mjs.map +1 -1
  167. package/resources/lists.d.mts.map +1 -1
  168. package/resources/lists.d.ts.map +1 -1
  169. package/resources/lists.mjs.map +1 -1
  170. package/resources/messages.d.mts.map +1 -1
  171. package/resources/messages.d.ts.map +1 -1
  172. package/resources/messages.mjs.map +1 -1
  173. package/resources/notifications/checks.d.mts +13 -1
  174. package/resources/notifications/checks.d.mts.map +1 -1
  175. package/resources/notifications/checks.d.ts +13 -1
  176. package/resources/notifications/checks.d.ts.map +1 -1
  177. package/resources/notifications/checks.js +6 -0
  178. package/resources/notifications/checks.js.map +1 -1
  179. package/resources/notifications/checks.mjs +6 -0
  180. package/resources/notifications/checks.mjs.map +1 -1
  181. package/resources/notifications/index.d.mts +1 -1
  182. package/resources/notifications/index.d.mts.map +1 -1
  183. package/resources/notifications/index.d.ts +1 -1
  184. package/resources/notifications/index.d.ts.map +1 -1
  185. package/resources/notifications/index.mjs.map +1 -1
  186. package/resources/notifications/notifications.d.mts +48 -62
  187. package/resources/notifications/notifications.d.mts.map +1 -1
  188. package/resources/notifications/notifications.d.ts +48 -62
  189. package/resources/notifications/notifications.d.ts.map +1 -1
  190. package/resources/notifications/notifications.js +3 -3
  191. package/resources/notifications/notifications.js.map +1 -1
  192. package/resources/notifications/notifications.mjs +3 -3
  193. package/resources/notifications/notifications.mjs.map +1 -1
  194. package/resources/notifications.d.mts.map +1 -1
  195. package/resources/notifications.d.ts.map +1 -1
  196. package/resources/notifications.mjs.map +1 -1
  197. package/resources/profiles/index.d.mts.map +1 -1
  198. package/resources/profiles/index.d.ts.map +1 -1
  199. package/resources/profiles/index.mjs.map +1 -1
  200. package/resources/profiles/lists.d.mts.map +1 -1
  201. package/resources/profiles/lists.d.ts.map +1 -1
  202. package/resources/profiles/lists.mjs.map +1 -1
  203. package/resources/profiles/profiles.d.mts.map +1 -1
  204. package/resources/profiles/profiles.d.ts.map +1 -1
  205. package/resources/profiles/profiles.mjs.map +1 -1
  206. package/resources/profiles.d.mts.map +1 -1
  207. package/resources/profiles.d.ts.map +1 -1
  208. package/resources/profiles.mjs.map +1 -1
  209. package/resources/providers/catalog.d.mts.map +1 -1
  210. package/resources/providers/catalog.d.ts.map +1 -1
  211. package/resources/providers/catalog.mjs.map +1 -1
  212. package/resources/providers/index.d.mts.map +1 -1
  213. package/resources/providers/index.d.ts.map +1 -1
  214. package/resources/providers/index.mjs.map +1 -1
  215. package/resources/providers/providers.d.mts.map +1 -1
  216. package/resources/providers/providers.d.ts.map +1 -1
  217. package/resources/providers/providers.mjs.map +1 -1
  218. package/resources/providers.d.mts.map +1 -1
  219. package/resources/providers.d.ts.map +1 -1
  220. package/resources/providers.mjs.map +1 -1
  221. package/resources/requests.d.mts.map +1 -1
  222. package/resources/requests.d.ts.map +1 -1
  223. package/resources/requests.mjs.map +1 -1
  224. package/resources/routing-strategies.d.mts.map +1 -1
  225. package/resources/routing-strategies.d.ts.map +1 -1
  226. package/resources/routing-strategies.mjs.map +1 -1
  227. package/resources/send.d.mts.map +1 -1
  228. package/resources/send.d.ts.map +1 -1
  229. package/resources/send.mjs.map +1 -1
  230. package/resources/shared.d.mts.map +1 -1
  231. package/resources/shared.d.ts.map +1 -1
  232. package/resources/tenants/index.d.mts +1 -1
  233. package/resources/tenants/index.d.mts.map +1 -1
  234. package/resources/tenants/index.d.ts +1 -1
  235. package/resources/tenants/index.d.ts.map +1 -1
  236. package/resources/tenants/index.js.map +1 -1
  237. package/resources/tenants/index.mjs.map +1 -1
  238. package/resources/tenants/preferences/index.d.mts.map +1 -1
  239. package/resources/tenants/preferences/index.d.ts.map +1 -1
  240. package/resources/tenants/preferences/index.mjs.map +1 -1
  241. package/resources/tenants/preferences/items.d.mts.map +1 -1
  242. package/resources/tenants/preferences/items.d.ts.map +1 -1
  243. package/resources/tenants/preferences/items.mjs.map +1 -1
  244. package/resources/tenants/preferences/preferences.d.mts.map +1 -1
  245. package/resources/tenants/preferences/preferences.d.ts.map +1 -1
  246. package/resources/tenants/preferences/preferences.mjs.map +1 -1
  247. package/resources/tenants/preferences.d.mts.map +1 -1
  248. package/resources/tenants/preferences.d.ts.map +1 -1
  249. package/resources/tenants/preferences.mjs.map +1 -1
  250. package/resources/tenants/templates/index.d.mts +1 -1
  251. package/resources/tenants/templates/index.d.mts.map +1 -1
  252. package/resources/tenants/templates/index.d.ts +1 -1
  253. package/resources/tenants/templates/index.d.ts.map +1 -1
  254. package/resources/tenants/templates/index.js.map +1 -1
  255. package/resources/tenants/templates/index.mjs.map +1 -1
  256. package/resources/tenants/templates/templates.d.mts +23 -1
  257. package/resources/tenants/templates/templates.d.mts.map +1 -1
  258. package/resources/tenants/templates/templates.d.ts +23 -1
  259. package/resources/tenants/templates/templates.d.ts.map +1 -1
  260. package/resources/tenants/templates/templates.js +23 -0
  261. package/resources/tenants/templates/templates.js.map +1 -1
  262. package/resources/tenants/templates/templates.mjs +23 -0
  263. package/resources/tenants/templates/templates.mjs.map +1 -1
  264. package/resources/tenants/templates/versions.d.mts.map +1 -1
  265. package/resources/tenants/templates/versions.d.ts.map +1 -1
  266. package/resources/tenants/templates/versions.mjs.map +1 -1
  267. package/resources/tenants/templates.d.mts.map +1 -1
  268. package/resources/tenants/templates.d.ts.map +1 -1
  269. package/resources/tenants/templates.mjs.map +1 -1
  270. package/resources/tenants/tenants.d.mts +2 -2
  271. package/resources/tenants/tenants.d.mts.map +1 -1
  272. package/resources/tenants/tenants.d.ts +2 -2
  273. package/resources/tenants/tenants.d.ts.map +1 -1
  274. package/resources/tenants/tenants.js.map +1 -1
  275. package/resources/tenants/tenants.mjs.map +1 -1
  276. package/resources/tenants.d.mts.map +1 -1
  277. package/resources/tenants.d.ts.map +1 -1
  278. package/resources/tenants.mjs.map +1 -1
  279. package/resources/translations.d.mts.map +1 -1
  280. package/resources/translations.d.ts.map +1 -1
  281. package/resources/translations.mjs.map +1 -1
  282. package/resources/users/index.d.mts.map +1 -1
  283. package/resources/users/index.d.ts.map +1 -1
  284. package/resources/users/index.mjs.map +1 -1
  285. package/resources/users/preferences.d.mts.map +1 -1
  286. package/resources/users/preferences.d.ts.map +1 -1
  287. package/resources/users/preferences.mjs.map +1 -1
  288. package/resources/users/tenants.d.mts.map +1 -1
  289. package/resources/users/tenants.d.ts.map +1 -1
  290. package/resources/users/tenants.mjs.map +1 -1
  291. package/resources/users/tokens.d.mts.map +1 -1
  292. package/resources/users/tokens.d.ts.map +1 -1
  293. package/resources/users/tokens.mjs.map +1 -1
  294. package/resources/users/users.d.mts.map +1 -1
  295. package/resources/users/users.d.ts.map +1 -1
  296. package/resources/users/users.mjs.map +1 -1
  297. package/resources/users.d.mts.map +1 -1
  298. package/resources/users.d.ts.map +1 -1
  299. package/resources/users.mjs.map +1 -1
  300. package/resources.d.mts.map +1 -1
  301. package/resources.d.ts.map +1 -1
  302. package/resources.mjs.map +1 -1
  303. package/src/client.ts +89 -11
  304. package/src/internal/types.ts +6 -8
  305. package/src/internal/utils/log.ts +2 -0
  306. package/src/resources/index.ts +35 -2
  307. package/src/resources/journeys/index.ts +54 -0
  308. package/src/resources/journeys/journeys.ts +1047 -0
  309. package/src/resources/journeys/templates.ts +318 -0
  310. package/src/resources/journeys.ts +1 -172
  311. package/src/resources/notifications/checks.ts +13 -1
  312. package/src/resources/notifications/index.ts +1 -1
  313. package/src/resources/notifications/notifications.ts +55 -73
  314. package/src/resources/tenants/index.ts +1 -0
  315. package/src/resources/tenants/templates/index.ts +1 -0
  316. package/src/resources/tenants/templates/templates.ts +32 -0
  317. package/src/resources/tenants/tenants.ts +2 -0
  318. package/src/version.ts +1 -1
  319. package/uploads.d.mts +1 -0
  320. package/uploads.d.mts.map +1 -1
  321. package/uploads.d.ts +1 -0
  322. package/uploads.d.ts.map +1 -1
  323. package/uploads.mjs +1 -0
  324. package/uploads.mjs.map +1 -1
  325. package/version.d.mts +1 -1
  326. package/version.d.ts +1 -1
  327. package/version.js +1 -1
  328. package/version.mjs +1 -1
@@ -0,0 +1,219 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as Shared from "../shared.js";
3
+ import * as JourneysAPI from "./journeys.js";
4
+ import * as NotificationsAPI from "../notifications/notifications.js";
5
+ import { APIPromise } from "../../core/api-promise.js";
6
+ import { RequestOptions } from "../../internal/request-options.js";
7
+ export declare class Templates extends APIResource {
8
+ /**
9
+ * Create a notification template scoped to this journey. Defaults to `DRAFT`
10
+ * state; pass `state: "PUBLISHED"` to publish on create.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const journeyTemplateGetResponse =
15
+ * await client.journeys.templates.create('x', {
16
+ * channel: 'email',
17
+ * notification: {
18
+ * name: 'Welcome email',
19
+ * tags: [],
20
+ * brand: null,
21
+ * subscription: null,
22
+ * content: {
23
+ * version: '2022-01-01',
24
+ * elements: [{ type: 'text' }],
25
+ * },
26
+ * },
27
+ * });
28
+ * ```
29
+ */
30
+ create(templateID: string, body: TemplateCreateParams, options?: RequestOptions): APIPromise<JourneysAPI.JourneyTemplateGetResponse>;
31
+ /**
32
+ * Fetch a journey-scoped notification template by id. Pass `?version=draft`
33
+ * (default `published`) to retrieve the working draft, or `?version=vN` for a
34
+ * historical version.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const journeyTemplateGetResponse =
39
+ * await client.journeys.templates.retrieve('x', {
40
+ * templateId: 'x',
41
+ * });
42
+ * ```
43
+ */
44
+ retrieve(notificationID: string, params: TemplateRetrieveParams, options?: RequestOptions): APIPromise<JourneysAPI.JourneyTemplateGetResponse>;
45
+ /**
46
+ * List notification templates scoped to this journey. Journey-scoped notification
47
+ * templates can only be referenced from `send` nodes within the same journey.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const journeyTemplateListResponse =
52
+ * await client.journeys.templates.list('x');
53
+ * ```
54
+ */
55
+ list(templateID: string, query?: TemplateListParams | null | undefined, options?: RequestOptions): APIPromise<JourneysAPI.JourneyTemplateListResponse>;
56
+ /**
57
+ * Archive the journey-scoped notification template. Archived templates cannot be
58
+ * sent.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * await client.journeys.templates.archive('x', {
63
+ * templateId: 'x',
64
+ * });
65
+ * ```
66
+ */
67
+ archive(notificationID: string, params: TemplateArchiveParams, options?: RequestOptions): APIPromise<void>;
68
+ /**
69
+ * List published versions of the journey-scoped notification template, ordered
70
+ * most recent first.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const notificationTemplateVersionListResponse =
75
+ * await client.journeys.templates.listVersions('x', {
76
+ * templateId: 'x',
77
+ * });
78
+ * ```
79
+ */
80
+ listVersions(notificationID: string, params: TemplateListVersionsParams, options?: RequestOptions): APIPromise<NotificationsAPI.NotificationTemplateVersionListResponse>;
81
+ /**
82
+ * Publish the current draft of the journey-scoped notification template as a new
83
+ * version. Optionally roll back to a prior version by passing
84
+ * `{ "version": "vN" }`.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * await client.journeys.templates.publish('x', {
89
+ * templateId: 'x',
90
+ * });
91
+ * ```
92
+ */
93
+ publish(notificationID: string, params: TemplatePublishParams, options?: RequestOptions): APIPromise<void>;
94
+ /**
95
+ * Replace the journey-scoped notification template draft.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const journeyTemplateGetResponse =
100
+ * await client.journeys.templates.replace('x', {
101
+ * templateId: 'x',
102
+ * notification: {
103
+ * brand: { id: 'id' },
104
+ * content: { elements: [{}], version: '2022-01-01' },
105
+ * name: 'name',
106
+ * subscription: { topic_id: 'topic_id' },
107
+ * tags: ['string'],
108
+ * },
109
+ * });
110
+ * ```
111
+ */
112
+ replace(notificationID: string, params: TemplateReplaceParams, options?: RequestOptions): APIPromise<JourneysAPI.JourneyTemplateGetResponse>;
113
+ }
114
+ export interface TemplateCreateParams {
115
+ channel: string;
116
+ notification: TemplateCreateParams.Notification;
117
+ providerKey?: string;
118
+ state?: string;
119
+ }
120
+ export declare namespace TemplateCreateParams {
121
+ interface Notification {
122
+ brand: Notification.Brand | null;
123
+ content: Notification.Content;
124
+ name: string;
125
+ subscription: Notification.Subscription | null;
126
+ tags: Array<string>;
127
+ }
128
+ namespace Notification {
129
+ interface Brand {
130
+ id: string;
131
+ }
132
+ interface Content {
133
+ elements: Array<Shared.ElementalNode>;
134
+ version: '2022-01-01';
135
+ scope?: 'default' | 'strict';
136
+ }
137
+ interface Subscription {
138
+ topic_id: string;
139
+ }
140
+ }
141
+ }
142
+ export interface TemplateRetrieveParams {
143
+ /**
144
+ * Journey id
145
+ */
146
+ templateId: string;
147
+ }
148
+ export interface TemplateListParams {
149
+ /**
150
+ * Pagination cursor from a prior response.
151
+ */
152
+ cursor?: string;
153
+ /**
154
+ * Page size. Minimum 1, maximum 100.
155
+ */
156
+ limit?: number;
157
+ }
158
+ export interface TemplateArchiveParams {
159
+ /**
160
+ * Journey id
161
+ */
162
+ templateId: string;
163
+ }
164
+ export interface TemplateListVersionsParams {
165
+ /**
166
+ * Journey id
167
+ */
168
+ templateId: string;
169
+ }
170
+ export interface TemplatePublishParams {
171
+ /**
172
+ * Path param: Journey id
173
+ */
174
+ templateId: string;
175
+ /**
176
+ * Body param
177
+ */
178
+ version?: string;
179
+ }
180
+ export interface TemplateReplaceParams {
181
+ /**
182
+ * Path param: Journey id
183
+ */
184
+ templateId: string;
185
+ /**
186
+ * Body param
187
+ */
188
+ notification: TemplateReplaceParams.Notification;
189
+ /**
190
+ * Body param
191
+ */
192
+ state?: string;
193
+ }
194
+ export declare namespace TemplateReplaceParams {
195
+ interface Notification {
196
+ brand: Notification.Brand | null;
197
+ content: Notification.Content;
198
+ name: string;
199
+ subscription: Notification.Subscription | null;
200
+ tags: Array<string>;
201
+ }
202
+ namespace Notification {
203
+ interface Brand {
204
+ id: string;
205
+ }
206
+ interface Content {
207
+ elements: Array<Shared.ElementalNode>;
208
+ version: '2022-01-01';
209
+ scope?: 'default' | 'strict';
210
+ }
211
+ interface Subscription {
212
+ topic_id: string;
213
+ }
214
+ }
215
+ }
216
+ export declare namespace Templates {
217
+ export { type TemplateCreateParams as TemplateCreateParams, type TemplateRetrieveParams as TemplateRetrieveParams, type TemplateListParams as TemplateListParams, type TemplateArchiveParams as TemplateArchiveParams, type TemplateListVersionsParams as TemplateListVersionsParams, type TemplatePublishParams as TemplatePublishParams, type TemplateReplaceParams as TemplateReplaceParams, };
218
+ }
219
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/journeys/templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4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B,GACpD,CAAC;CACH"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Templates = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Templates extends resource_1.APIResource {
9
+ /**
10
+ * Create a notification template scoped to this journey. Defaults to `DRAFT`
11
+ * state; pass `state: "PUBLISHED"` to publish on create.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const journeyTemplateGetResponse =
16
+ * await client.journeys.templates.create('x', {
17
+ * channel: 'email',
18
+ * notification: {
19
+ * name: 'Welcome email',
20
+ * tags: [],
21
+ * brand: null,
22
+ * subscription: null,
23
+ * content: {
24
+ * version: '2022-01-01',
25
+ * elements: [{ type: 'text' }],
26
+ * },
27
+ * },
28
+ * });
29
+ * ```
30
+ */
31
+ create(templateID, body, options) {
32
+ return this._client.post((0, path_1.path) `/journeys/${templateID}/templates`, { body, ...options });
33
+ }
34
+ /**
35
+ * Fetch a journey-scoped notification template by id. Pass `?version=draft`
36
+ * (default `published`) to retrieve the working draft, or `?version=vN` for a
37
+ * historical version.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const journeyTemplateGetResponse =
42
+ * await client.journeys.templates.retrieve('x', {
43
+ * templateId: 'x',
44
+ * });
45
+ * ```
46
+ */
47
+ retrieve(notificationID, params, options) {
48
+ const { templateId } = params;
49
+ return this._client.get((0, path_1.path) `/journeys/${templateId}/templates/${notificationID}`, options);
50
+ }
51
+ /**
52
+ * List notification templates scoped to this journey. Journey-scoped notification
53
+ * templates can only be referenced from `send` nodes within the same journey.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const journeyTemplateListResponse =
58
+ * await client.journeys.templates.list('x');
59
+ * ```
60
+ */
61
+ list(templateID, query = {}, options) {
62
+ return this._client.get((0, path_1.path) `/journeys/${templateID}/templates`, { query, ...options });
63
+ }
64
+ /**
65
+ * Archive the journey-scoped notification template. Archived templates cannot be
66
+ * sent.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * await client.journeys.templates.archive('x', {
71
+ * templateId: 'x',
72
+ * });
73
+ * ```
74
+ */
75
+ archive(notificationID, params, options) {
76
+ const { templateId } = params;
77
+ return this._client.delete((0, path_1.path) `/journeys/${templateId}/templates/${notificationID}`, {
78
+ ...options,
79
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
80
+ });
81
+ }
82
+ /**
83
+ * List published versions of the journey-scoped notification template, ordered
84
+ * most recent first.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const notificationTemplateVersionListResponse =
89
+ * await client.journeys.templates.listVersions('x', {
90
+ * templateId: 'x',
91
+ * });
92
+ * ```
93
+ */
94
+ listVersions(notificationID, params, options) {
95
+ const { templateId } = params;
96
+ return this._client.get((0, path_1.path) `/journeys/${templateId}/templates/${notificationID}/versions`, options);
97
+ }
98
+ /**
99
+ * Publish the current draft of the journey-scoped notification template as a new
100
+ * version. Optionally roll back to a prior version by passing
101
+ * `{ "version": "vN" }`.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * await client.journeys.templates.publish('x', {
106
+ * templateId: 'x',
107
+ * });
108
+ * ```
109
+ */
110
+ publish(notificationID, params, options) {
111
+ const { templateId, ...body } = params;
112
+ return this._client.post((0, path_1.path) `/journeys/${templateId}/templates/${notificationID}/publish`, {
113
+ body,
114
+ ...options,
115
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
116
+ });
117
+ }
118
+ /**
119
+ * Replace the journey-scoped notification template draft.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * const journeyTemplateGetResponse =
124
+ * await client.journeys.templates.replace('x', {
125
+ * templateId: 'x',
126
+ * notification: {
127
+ * brand: { id: 'id' },
128
+ * content: { elements: [{}], version: '2022-01-01' },
129
+ * name: 'name',
130
+ * subscription: { topic_id: 'topic_id' },
131
+ * tags: ['string'],
132
+ * },
133
+ * });
134
+ * ```
135
+ */
136
+ replace(notificationID, params, options) {
137
+ const { templateId, ...body } = params;
138
+ return this._client.put((0, path_1.path) `/journeys/${templateId}/templates/${notificationID}`, { body, ...options });
139
+ }
140
+ }
141
+ exports.Templates = Templates;
142
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/journeys/templates.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CACJ,UAAkB,EAClB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,UAAU,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,QAAQ,CACN,cAAsB,EACtB,MAA8B,EAC9B,OAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,UAAU,cAAc,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CACF,UAAkB,EAClB,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,UAAU,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,cAAsB,EAAE,MAA6B,EAAE,OAAwB;QACrF,MAAM,E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G,OAAO,EAAE,CAAC,CAAC;IAC3G,CAAC;CACF;AA9JD,8BA8JC"}
@@ -0,0 +1,138 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class Templates extends APIResource {
6
+ /**
7
+ * Create a notification template scoped to this journey. Defaults to `DRAFT`
8
+ * state; pass `state: "PUBLISHED"` to publish on create.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const journeyTemplateGetResponse =
13
+ * await client.journeys.templates.create('x', {
14
+ * channel: 'email',
15
+ * notification: {
16
+ * name: 'Welcome email',
17
+ * tags: [],
18
+ * brand: null,
19
+ * subscription: null,
20
+ * content: {
21
+ * version: '2022-01-01',
22
+ * elements: [{ type: 'text' }],
23
+ * },
24
+ * },
25
+ * });
26
+ * ```
27
+ */
28
+ create(templateID, body, options) {
29
+ return this._client.post(path `/journeys/${templateID}/templates`, { body, ...options });
30
+ }
31
+ /**
32
+ * Fetch a journey-scoped notification template by id. Pass `?version=draft`
33
+ * (default `published`) to retrieve the working draft, or `?version=vN` for a
34
+ * historical version.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const journeyTemplateGetResponse =
39
+ * await client.journeys.templates.retrieve('x', {
40
+ * templateId: 'x',
41
+ * });
42
+ * ```
43
+ */
44
+ retrieve(notificationID, params, options) {
45
+ const { templateId } = params;
46
+ return this._client.get(path `/journeys/${templateId}/templates/${notificationID}`, options);
47
+ }
48
+ /**
49
+ * List notification templates scoped to this journey. Journey-scoped notification
50
+ * templates can only be referenced from `send` nodes within the same journey.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const journeyTemplateListResponse =
55
+ * await client.journeys.templates.list('x');
56
+ * ```
57
+ */
58
+ list(templateID, query = {}, options) {
59
+ return this._client.get(path `/journeys/${templateID}/templates`, { query, ...options });
60
+ }
61
+ /**
62
+ * Archive the journey-scoped notification template. Archived templates cannot be
63
+ * sent.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * await client.journeys.templates.archive('x', {
68
+ * templateId: 'x',
69
+ * });
70
+ * ```
71
+ */
72
+ archive(notificationID, params, options) {
73
+ const { templateId } = params;
74
+ return this._client.delete(path `/journeys/${templateId}/templates/${notificationID}`, {
75
+ ...options,
76
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
77
+ });
78
+ }
79
+ /**
80
+ * List published versions of the journey-scoped notification template, ordered
81
+ * most recent first.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const notificationTemplateVersionListResponse =
86
+ * await client.journeys.templates.listVersions('x', {
87
+ * templateId: 'x',
88
+ * });
89
+ * ```
90
+ */
91
+ listVersions(notificationID, params, options) {
92
+ const { templateId } = params;
93
+ return this._client.get(path `/journeys/${templateId}/templates/${notificationID}/versions`, options);
94
+ }
95
+ /**
96
+ * Publish the current draft of the journey-scoped notification template as a new
97
+ * version. Optionally roll back to a prior version by passing
98
+ * `{ "version": "vN" }`.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * await client.journeys.templates.publish('x', {
103
+ * templateId: 'x',
104
+ * });
105
+ * ```
106
+ */
107
+ publish(notificationID, params, options) {
108
+ const { templateId, ...body } = params;
109
+ return this._client.post(path `/journeys/${templateId}/templates/${notificationID}/publish`, {
110
+ body,
111
+ ...options,
112
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
113
+ });
114
+ }
115
+ /**
116
+ * Replace the journey-scoped notification template draft.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const journeyTemplateGetResponse =
121
+ * await client.journeys.templates.replace('x', {
122
+ * templateId: 'x',
123
+ * notification: {
124
+ * brand: { id: 'id' },
125
+ * content: { elements: [{}], version: '2022-01-01' },
126
+ * name: 'name',
127
+ * subscription: { topic_id: 'topic_id' },
128
+ * tags: ['string'],
129
+ * },
130
+ * });
131
+ * ```
132
+ */
133
+ replace(notificationID, params, options) {
134
+ const { templateId, ...body } = params;
135
+ return this._client.put(path `/journeys/${templateId}/templates/${notificationID}`, { body, ...options });
136
+ }
137
+ }
138
+ //# sourceMappingURL=templates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.mjs","sourceRoot":"","sources":["../../src/resources/journeys/templates.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAKlD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CACJ,UAAkB,EAClB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,UAAU,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,QAAQ,CACN,cAAsB,EACtB,MAA8B,EAC9B,OAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,UAAU,cAAc,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CACF,UAAkB,EAClB,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,UAAU,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,cAAsB,EAAE,MAA6B,EAAE,OAAwB;QACrF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,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{ APIPromise } from "../core/api-promise.mjs";
3
- import { RequestOptions } from "../internal/request-options.mjs";
4
- export declare class Journeys extends APIResource {
5
- /**
6
- * Get the list of journeys.
7
- *
8
- * @example
9
- * ```ts
10
- * const journeysListResponse = await client.journeys.list();
11
- * ```
12
- */
13
- list(query?: JourneyListParams | null | undefined, options?: RequestOptions): APIPromise<JourneysListResponse>;
14
- /**
15
- * Invoke a journey run from a journey template.
16
- *
17
- * @example
18
- * ```ts
19
- * const journeysInvokeResponse = await client.journeys.invoke(
20
- * 'templateId',
21
- * {
22
- * data: { order_id: 'order-456', amount: 99.99 },
23
- * user_id: 'user-123',
24
- * },
25
- * );
26
- * ```
27
- */
28
- invoke(templateID: string, body: JourneyInvokeParams, options?: RequestOptions): APIPromise<JourneysInvokeResponse>;
29
- }
30
- /**
31
- * A journey template representing an automation workflow.
32
- */
33
- export interface Journey {
34
- /**
35
- * The unique identifier of the journey.
36
- */
37
- id: string;
38
- /**
39
- * The name of the journey.
40
- */
41
- name: string;
42
- /**
43
- * The version of the journey (published or draft).
44
- */
45
- version: 'published' | 'draft';
46
- /**
47
- * ISO 8601 timestamp when the journey was created.
48
- */
49
- createdAt?: string;
50
- /**
51
- * ISO 8601 timestamp when the journey was last updated.
52
- */
53
- updatedAt?: string;
54
- }
55
- /**
56
- * Request body for invoking a journey. Requires either a user identifier or a
57
- * profile with contact information. User identifiers can be provided via user_id
58
- * field, or resolved from profile/data objects (user_id, userId, or anonymousId
59
- * fields).
60
- */
61
- export interface JourneysInvokeRequest {
62
- /**
63
- * Data payload passed to the journey. The expected shape can be predefined using
64
- * the schema builder in the journey editor. This data is available in journey
65
- * steps for condition evaluation and template variable interpolation. Can also
66
- * contain user identifiers (user_id, userId, anonymousId) if not provided
67
- * elsewhere.
68
- */
69
- data?: {
70
- [key: string]: unknown;
71
- };
72
- /**
73
- * Profile data for the user. Can contain contact information (email,
74
- * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
75
- * profile fields. Profile fields are merged with any existing stored profile for
76
- * the user. Include context.tenant_id to load a tenant-scoped profile for
77
- * multi-tenant scenarios.
78
- */
79
- profile?: {
80
- [key: string]: unknown;
81
- };
82
- /**
83
- * A unique identifier for the user. If not provided, the system will attempt to
84
- * resolve the user identifier from profile or data objects.
85
- */
86
- user_id?: string;
87
- }
88
- export interface JourneysInvokeResponse {
89
- /**
90
- * A unique identifier for the journey run that was created.
91
- */
92
- runId: string;
93
- }
94
- export interface JourneysListResponse {
95
- /**
96
- * A cursor token for pagination. Present when there are more results available.
97
- */
98
- cursor?: string;
99
- templates?: Array<Journey>;
100
- }
101
- export interface JourneyListParams {
102
- /**
103
- * A cursor token for pagination. Use the cursor from the previous response to
104
- * fetch the next page of results.
105
- */
106
- cursor?: string;
107
- /**
108
- * The version of journeys to retrieve. Accepted values are published (for
109
- * published journeys) or draft (for draft journeys). Defaults to published.
110
- */
111
- version?: 'published' | 'draft';
112
- }
113
- export interface JourneyInvokeParams {
114
- /**
115
- * Data payload passed to the journey. The expected shape can be predefined using
116
- * the schema builder in the journey editor. This data is available in journey
117
- * steps for condition evaluation and template variable interpolation. Can also
118
- * contain user identifiers (user_id, userId, anonymousId) if not provided
119
- * elsewhere.
120
- */
121
- data?: {
122
- [key: string]: unknown;
123
- };
124
- /**
125
- * Profile data for the user. Can contain contact information (email,
126
- * phone_number), user identifiers (user_id, userId, anonymousId), or any custom
127
- * profile fields. Profile fields are merged with any existing stored profile for
128
- * the user. Include context.tenant_id to load a tenant-scoped profile for
129
- * multi-tenant scenarios.
130
- */
131
- profile?: {
132
- [key: string]: unknown;
133
- };
134
- /**
135
- * A unique identifier for the user. If not provided, the system will attempt to
136
- * resolve the user identifier from profile or data objects.
137
- */
138
- user_id?: string;
139
- }
140
- export declare namespace Journeys {
141
- export { type Journey as Journey, type JourneysInvokeRequest as JourneysInvokeRequest, type JourneysInvokeResponse as JourneysInvokeResponse, type JourneysListResponse as JourneysListResponse, type JourneyListParams as JourneyListParams, type JourneyInvokeParams as JourneyInvokeParams, };
142
- }
1
+ export * from "./journeys/index.mjs";
143
2
  //# sourceMappingURL=journeys.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"journeys.d.mts","sourceRoot":"","sources":["../src/resources/journeys.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAInC;;;;;;;;;;;;;OAaG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,sBAAsB,CAAC;CAGtC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAElC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IAC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