activitysmith 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,20 @@ await activitysmith.notifications.send({
38
38
  });
39
39
  ```
40
40
 
41
+ ### Custom Push Notification Icons
42
+
43
+ ![Push Notifications with custom icons](https://cdn.activitysmith.com/features/push-notifications-with-custom-icons.png)
44
+
45
+ Set `icon` to a publicly accessible HTTPS image URL to show a logo or avatar alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit `subtitle` from the notification.
46
+
47
+ ```js
48
+ await activitysmith.notifications.send({
49
+ title: "MRR just crossed $10,000 🎉",
50
+ message: "Up 18% this month from 31 new subscriptions.",
51
+ icon: "https://cdn.activitysmith.com/integrations/icons/stripe.png",
52
+ });
53
+ ```
54
+
41
55
  ### Rich Push Notifications with Media
42
56
 
43
57
  ![Rich Push Notification with image](https://cdn.activitysmith.com/features/rich-push-notification-with-image.png)
@@ -128,28 +142,111 @@ await activitysmith.notifications.send({
128
142
  });
129
143
  ```
130
144
 
145
+ ### Push Notification Interruption Levels
146
+
147
+ ![Time Sensitive Push Notification](https://cdn.activitysmith.com/features/time-sensitive-push-notifications.png)
148
+
149
+ Use `interruption_level` to choose how urgently iOS presents a Push Notification. Omit it for normal delivery. Explicit `active` has the same behavior as the default.
150
+
151
+ | Value | Behavior |
152
+ | --- | --- |
153
+ | `passive` | Appears quietly in the notification list, without sound or waking the screen. |
154
+ | `active` | Normal delivery, subject to the device's notification settings and Focus. This is the default. |
155
+ | `time-sensitive` | Can bypass Scheduled Summary and Focus when the user allows Time Sensitive Notifications for ActivitySmith. |
156
+
157
+ See Apple's [interruption levels](https://developer.apple.com/documentation/usernotifications/unnotificationinterruptionlevel) for the system behavior.
158
+
159
+ The SDK also exports these values as `ActivitySmith.pushInterruptionLevels.passive`, `.active`, and `.timeSensitive`.
160
+
161
+ #### Passive
162
+
163
+ ```js
164
+ await activitysmith.notifications.send({
165
+ title: "Daily summary",
166
+ message: "All scheduled jobs completed successfully.",
167
+ interruption_level: "passive",
168
+ });
169
+ ```
170
+
171
+ #### Active (default)
172
+
173
+ ```js
174
+ await activitysmith.notifications.send({
175
+ title: "Deployment complete",
176
+ message: "Your latest changes are live.",
177
+ interruption_level: "active",
178
+ });
179
+ ```
180
+
181
+ Removing `interruption_level` from this example produces the same delivery behavior.
182
+
183
+ #### Time Sensitive
184
+
185
+ ```js
186
+ await activitysmith.notifications.send({
187
+ title: "🚨 checkout-api is down",
188
+ message: "500 errors on 62% of requests. Customers can't complete payments.",
189
+ interruption_level: "time-sensitive",
190
+ });
191
+ ```
192
+
193
+ ### Replace a Push Notification
194
+
195
+ Every send returns a `notification_id`. Pass it to `replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original.
196
+
197
+ Omit `metadata` or `tags` to keep their stored values.
198
+
199
+ ```js
200
+ const sent = await activitysmith.notifications.send({
201
+ title: "🚨 checkout-api is down",
202
+ message: "500 errors on 62% of requests.",
203
+ });
204
+
205
+ await activitysmith.notifications.replace(sent.notification_id, {
206
+ title: "✅ checkout-api recovered",
207
+ message: "Error rate is back to normal. Incident resolved.",
208
+ });
209
+ ```
210
+
131
211
  ## Live Activities
132
212
 
133
213
  Choose the Live Activity type that matches what you want to show:
134
214
 
135
- - ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png) **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
215
+ ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png)
216
+
217
+ **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
218
+
219
+ ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png)
220
+
221
+ **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
222
+
223
+ ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png)
136
224
 
137
- - ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png) **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
225
+ **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
138
226
 
139
- - ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png) **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
227
+ ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
140
228
 
141
- - ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) **Metrics**: Track two related values with segmented bars, such as CPU and memory.
229
+ **Metrics**: Track two related values with segmented bars, such as CPU and memory.
142
230
 
143
- - ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png) **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
231
+ ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png)
144
232
 
145
- - ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png) **Progress**: Show percentage progress for jobs that move continuously toward completion.
233
+ **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
146
234
 
147
- - ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png) **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
235
+ ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png)
236
+
237
+ **Progress**: Show percentage progress for jobs that move continuously toward completion.
238
+
239
+ ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png)
240
+
241
+ **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
148
242
 
149
243
  ### Start & Update Live Activity
150
244
 
151
245
  Use a stable `streamKey` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `streamKey` update it.
152
246
 
247
+ > [!WARNING]
248
+ > iOS limits how often a Live Activity can update. Short bursts that end, like deployment steps, are fine. If one Live Activity keeps updating more often than every couple of minutes, iOS throttles it until the budget refills, roughly an hour, even though the API still returns `200`. [Learn more](https://activitysmith.com/docs/live-activity-stream#update-frequency-and-ios-limits)
249
+
153
250
  #### Value
154
251
 
155
252
  ![Value Live Activity stream example](https://cdn.activitysmith.com/features/value-live-activity.png)
@@ -613,7 +710,3 @@ try {
613
710
  ### [NPM Package](https://www.npmjs.com/package/activitysmith)
614
711
 
615
712
  Install the ActivitySmith Node.js SDK from npm
616
-
617
- ### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-node)
618
-
619
- View the Node.js SDK source on GitHub
@@ -10,7 +10,11 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { PushNotificationRequest, PushNotificationResponse } from '../models/index';
13
+ import type { PushNotificationReplaceRequest, PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse } from '../models/index';
14
+ export interface ReplacePushNotificationRequest {
15
+ notificationId: string;
16
+ pushNotificationReplaceRequest: PushNotificationReplaceRequest;
17
+ }
14
18
  export interface SendPushNotificationRequest {
15
19
  pushNotificationRequest: PushNotificationRequest;
16
20
  }
@@ -19,12 +23,22 @@ export interface SendPushNotificationRequest {
19
23
  */
20
24
  export declare class PushNotificationsApi extends runtime.BaseAPI {
21
25
  /**
22
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
26
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
27
+ * Replace a push notification
28
+ */
29
+ replacePushNotificationRaw(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationReplaceResponse>>;
30
+ /**
31
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
32
+ * Replace a push notification
33
+ */
34
+ replacePushNotification(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationReplaceResponse>;
35
+ /**
36
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
23
37
  * Send a push notification
24
38
  */
25
39
  sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
26
40
  /**
27
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
41
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
28
42
  * Send a push notification
29
43
  */
30
44
  sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
@@ -20,7 +20,45 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class PushNotificationsApi extends runtime.BaseAPI {
22
22
  /**
23
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
23
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
24
+ * Replace a push notification
25
+ */
26
+ async replacePushNotificationRaw(requestParameters, initOverrides) {
27
+ if (requestParameters['notificationId'] == null) {
28
+ throw new runtime.RequiredError('notificationId', 'Required parameter "notificationId" was null or undefined when calling replacePushNotification().');
29
+ }
30
+ if (requestParameters['pushNotificationReplaceRequest'] == null) {
31
+ throw new runtime.RequiredError('pushNotificationReplaceRequest', 'Required parameter "pushNotificationReplaceRequest" was null or undefined when calling replacePushNotification().');
32
+ }
33
+ const queryParameters = {};
34
+ const headerParameters = {};
35
+ headerParameters['Content-Type'] = 'application/json';
36
+ if (this.configuration && this.configuration.accessToken) {
37
+ const token = this.configuration.accessToken;
38
+ const tokenString = await token("apiKeyAuth", []);
39
+ if (tokenString) {
40
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
41
+ }
42
+ }
43
+ const response = await this.request({
44
+ path: `/push-notification/{notification_id}`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))),
45
+ method: 'PUT',
46
+ headers: headerParameters,
47
+ query: queryParameters,
48
+ body: requestParameters['pushNotificationReplaceRequest'],
49
+ }, initOverrides);
50
+ return new runtime.JSONApiResponse(response);
51
+ }
52
+ /**
53
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
54
+ * Replace a push notification
55
+ */
56
+ async replacePushNotification(requestParameters, initOverrides) {
57
+ const response = await this.replacePushNotificationRaw(requestParameters, initOverrides);
58
+ return await response.value();
59
+ }
60
+ /**
61
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
24
62
  * Send a push notification
25
63
  */
26
64
  async sendPushNotificationRaw(requestParameters, initOverrides) {
@@ -47,7 +85,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
47
85
  return new runtime.JSONApiResponse(response);
48
86
  }
49
87
  /**
50
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
88
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
51
89
  * Send a push notification
52
90
  */
53
91
  async sendPushNotification(requestParameters, initOverrides) {
@@ -215,6 +215,24 @@ export interface AppIconBadgeCountUpdateResponse {
215
215
  * @memberof AppIconBadgeCountUpdateResponse
216
216
  */
217
217
  timestamp: string;
218
+ /**
219
+ * Number of device tokens targeted.
220
+ * @type {number}
221
+ * @memberof AppIconBadgeCountUpdateResponse
222
+ */
223
+ devices_targeted?: number;
224
+ /**
225
+ * Number of device tokens deactivated because APNs reported them unregistered.
226
+ * @type {number}
227
+ * @memberof AppIconBadgeCountUpdateResponse
228
+ */
229
+ devices_deactivated?: number;
230
+ /**
231
+ * Number of targeted device tokens APNs reported as unregistered.
232
+ * @type {number}
233
+ * @memberof AppIconBadgeCountUpdateResponse
234
+ */
235
+ devices_unregistered?: number;
218
236
  }
219
237
  /**
220
238
  *
@@ -235,6 +253,65 @@ export interface BadRequestError {
235
253
  */
236
254
  message: string;
237
255
  }
256
+ /**
257
+ *
258
+ * @export
259
+ * @interface BillingBlockedError
260
+ */
261
+ export interface BillingBlockedError {
262
+ /**
263
+ *
264
+ * @type {string}
265
+ * @memberof BillingBlockedError
266
+ */
267
+ error: BillingBlockedErrorErrorEnum;
268
+ /**
269
+ *
270
+ * @type {string}
271
+ * @memberof BillingBlockedError
272
+ */
273
+ message: string;
274
+ /**
275
+ *
276
+ * @type {BillingBlockedErrorTrialPeriod}
277
+ * @memberof BillingBlockedError
278
+ */
279
+ trial_period?: BillingBlockedErrorTrialPeriod;
280
+ /**
281
+ *
282
+ * @type {string}
283
+ * @memberof BillingBlockedError
284
+ */
285
+ upgrade_url: string;
286
+ }
287
+ /**
288
+ * @export
289
+ */
290
+ export declare const BillingBlockedErrorErrorEnum: {
291
+ readonly TrialExpired: "trial_expired";
292
+ readonly TrialExhausted: "trial_exhausted";
293
+ readonly BillingOverageCapReached: "billing_overage_cap_reached";
294
+ };
295
+ export type BillingBlockedErrorErrorEnum = typeof BillingBlockedErrorErrorEnum[keyof typeof BillingBlockedErrorErrorEnum];
296
+ /**
297
+ *
298
+ * @export
299
+ * @interface BillingBlockedErrorTrialPeriod
300
+ */
301
+ export interface BillingBlockedErrorTrialPeriod {
302
+ /**
303
+ *
304
+ * @type {string}
305
+ * @memberof BillingBlockedErrorTrialPeriod
306
+ */
307
+ started_at: string;
308
+ /**
309
+ *
310
+ * @type {string}
311
+ * @memberof BillingBlockedErrorTrialPeriod
312
+ */
313
+ ends_at: string;
314
+ }
238
315
  /**
239
316
  *
240
317
  * @export
@@ -984,6 +1061,42 @@ export interface LiveActivityEndResponse {
984
1061
  * @memberof LiveActivityEndResponse
985
1062
  */
986
1063
  timestamp: string;
1064
+ /**
1065
+ * True when the Live Activity had already ended and the request had no effect.
1066
+ * @type {boolean}
1067
+ * @memberof LiveActivityEndResponse
1068
+ */
1069
+ ignored?: boolean;
1070
+ /**
1071
+ *
1072
+ * @type {string}
1073
+ * @memberof LiveActivityEndResponse
1074
+ */
1075
+ message?: string;
1076
+ /**
1077
+ *
1078
+ * @type {string}
1079
+ * @memberof LiveActivityEndResponse
1080
+ */
1081
+ end_reason?: string | null;
1082
+ /**
1083
+ * True when the Live Activity was marked complete without a confirmed APNs end delivery.
1084
+ * @type {boolean}
1085
+ * @memberof LiveActivityEndResponse
1086
+ */
1087
+ forced_completion?: boolean;
1088
+ /**
1089
+ *
1090
+ * @type {string}
1091
+ * @memberof LiveActivityEndResponse
1092
+ */
1093
+ warning?: string;
1094
+ /**
1095
+ * Per-device delivery errors when some devices could not be reached.
1096
+ * @type {Array<string>}
1097
+ * @memberof LiveActivityEndResponse
1098
+ */
1099
+ errors?: Array<string>;
987
1100
  }
988
1101
  /**
989
1102
  *
@@ -1127,6 +1240,24 @@ export interface LiveActivityStartResponse {
1127
1240
  * @memberof LiveActivityStartResponse
1128
1241
  */
1129
1242
  timestamp: string;
1243
+ /**
1244
+ * Present when starting this Live Activity ended an older one to stay within the device limit.
1245
+ * @type {string}
1246
+ * @memberof LiveActivityStartResponse
1247
+ */
1248
+ ended_activity_id?: string;
1249
+ /**
1250
+ *
1251
+ * @type {string}
1252
+ * @memberof LiveActivityStartResponse
1253
+ */
1254
+ message?: string;
1255
+ /**
1256
+ * Per-device delivery errors when some devices could not be reached.
1257
+ * @type {Array<string>}
1258
+ * @memberof LiveActivityStartResponse
1259
+ */
1260
+ errors?: Array<string>;
1130
1261
  }
1131
1262
  /**
1132
1263
  * Optional payload for ending a managed stream. When omitted, ActivitySmith ends the stream using the latest known state when possible.
@@ -1221,6 +1352,36 @@ export interface LiveActivityStreamDeleteResponse {
1221
1352
  * @memberof LiveActivityStreamDeleteResponse
1222
1353
  */
1223
1354
  timestamp: string;
1355
+ /**
1356
+ * True when the stream was already ended and the request had no effect.
1357
+ * @type {boolean}
1358
+ * @memberof LiveActivityStreamDeleteResponse
1359
+ */
1360
+ ignored?: boolean;
1361
+ /**
1362
+ *
1363
+ * @type {string}
1364
+ * @memberof LiveActivityStreamDeleteResponse
1365
+ */
1366
+ message?: string;
1367
+ /**
1368
+ *
1369
+ * @type {boolean}
1370
+ * @memberof LiveActivityStreamDeleteResponse
1371
+ */
1372
+ forced_completion?: boolean;
1373
+ /**
1374
+ *
1375
+ * @type {string}
1376
+ * @memberof LiveActivityStreamDeleteResponse
1377
+ */
1378
+ warning?: string;
1379
+ /**
1380
+ * Per-device delivery errors when some devices could not be reached.
1381
+ * @type {Array<string>}
1382
+ * @memberof LiveActivityStreamDeleteResponse
1383
+ */
1384
+ errors?: Array<string>;
1224
1385
  }
1225
1386
  /**
1226
1387
  * @export
@@ -1295,12 +1456,42 @@ export interface LiveActivityStreamPutResponse {
1295
1456
  * @memberof LiveActivityStreamPutResponse
1296
1457
  */
1297
1458
  tags?: Array<string>;
1459
+ /**
1460
+ * Present on `updated` responses when the current Live Activity has received more than 12 updates and has averaged more than one update every 2 minutes since it started. The update is still sent, but iOS may throttle Live Activities that update this often.
1461
+ * @type {string}
1462
+ * @memberof LiveActivityStreamPutResponse
1463
+ */
1464
+ warning?: string;
1298
1465
  /**
1299
1466
  *
1300
1467
  * @type {string}
1301
1468
  * @memberof LiveActivityStreamPutResponse
1302
1469
  */
1303
1470
  timestamp: string;
1471
+ /**
1472
+ * True when the request had no effect.
1473
+ * @type {boolean}
1474
+ * @memberof LiveActivityStreamPutResponse
1475
+ */
1476
+ ignored?: boolean;
1477
+ /**
1478
+ *
1479
+ * @type {boolean}
1480
+ * @memberof LiveActivityStreamPutResponse
1481
+ */
1482
+ remote_push_sent?: boolean;
1483
+ /**
1484
+ *
1485
+ * @type {string}
1486
+ * @memberof LiveActivityStreamPutResponse
1487
+ */
1488
+ message?: string;
1489
+ /**
1490
+ * Per-device delivery errors when some devices could not be reached.
1491
+ * @type {Array<string>}
1492
+ * @memberof LiveActivityStreamPutResponse
1493
+ */
1494
+ errors?: Array<string>;
1304
1495
  }
1305
1496
  /**
1306
1497
  * @export
@@ -1451,6 +1642,48 @@ export interface LiveActivityUpdateResponse {
1451
1642
  * @memberof LiveActivityUpdateResponse
1452
1643
  */
1453
1644
  timestamp: string;
1645
+ /**
1646
+ *
1647
+ * @type {number}
1648
+ * @memberof LiveActivityUpdateResponse
1649
+ */
1650
+ users_notified?: number;
1651
+ /**
1652
+ *
1653
+ * @type {Array<string>}
1654
+ * @memberof LiveActivityUpdateResponse
1655
+ */
1656
+ effective_channel_slugs?: Array<string>;
1657
+ /**
1658
+ * Optional tags to organize and filter notification history.
1659
+ * @type {Array<string>}
1660
+ * @memberof LiveActivityUpdateResponse
1661
+ */
1662
+ tags?: Array<string>;
1663
+ /**
1664
+ * Present when the update started a new Live Activity for a managed stream.
1665
+ * @type {string}
1666
+ * @memberof LiveActivityUpdateResponse
1667
+ */
1668
+ operation?: string;
1669
+ /**
1670
+ *
1671
+ * @type {string}
1672
+ * @memberof LiveActivityUpdateResponse
1673
+ */
1674
+ stream_key?: string;
1675
+ /**
1676
+ *
1677
+ * @type {string}
1678
+ * @memberof LiveActivityUpdateResponse
1679
+ */
1680
+ previous_activity_id?: string;
1681
+ /**
1682
+ * Per-device delivery errors when some devices could not be reached.
1683
+ * @type {Array<string>}
1684
+ * @memberof LiveActivityUpdateResponse
1685
+ */
1686
+ errors?: Array<string>;
1454
1687
  }
1455
1688
  /**
1456
1689
  * @type LiveActivityValue
@@ -1574,6 +1807,16 @@ export interface NotFoundError {
1574
1807
  */
1575
1808
  message: string;
1576
1809
  }
1810
+ /**
1811
+ * How urgently iOS presents the notification. `passive` arrives quietly in the notification list without sound or lighting up the screen. `active` is normal delivery and the default when omitted. `time-sensitive` can break through Focus and Scheduled Summary when the user allows Time Sensitive Notifications for ActivitySmith.
1812
+ * @export
1813
+ */
1814
+ export declare const PushInterruptionLevel: {
1815
+ readonly Passive: "passive";
1816
+ readonly Active: "active";
1817
+ readonly TimeSensitive: "time-sensitive";
1818
+ };
1819
+ export type PushInterruptionLevel = typeof PushInterruptionLevel[keyof typeof PushInterruptionLevel];
1577
1820
  /**
1578
1821
  *
1579
1822
  * @export
@@ -1621,6 +1864,131 @@ export declare const PushNotificationActionType: {
1621
1864
  readonly Webhook: "webhook";
1622
1865
  };
1623
1866
  export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType];
1867
+ /**
1868
+ * Replacement content. title, subtitle, message, redirection, media, icon, actions, and payload fully replace the original values. Omit metadata or tags to keep the stored values; send {} or [] to clear them.
1869
+ * @export
1870
+ * @interface PushNotificationReplaceRequest
1871
+ */
1872
+ export interface PushNotificationReplaceRequest {
1873
+ [key: string]: any | any;
1874
+ /**
1875
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1876
+ * @type {{ [key: string]: MetadataValue; }}
1877
+ * @memberof PushNotificationReplaceRequest
1878
+ */
1879
+ metadata?: {
1880
+ [key: string]: MetadataValue;
1881
+ };
1882
+ /**
1883
+ *
1884
+ * @type {string}
1885
+ * @memberof PushNotificationReplaceRequest
1886
+ */
1887
+ title: string;
1888
+ /**
1889
+ *
1890
+ * @type {string}
1891
+ * @memberof PushNotificationReplaceRequest
1892
+ */
1893
+ message?: string;
1894
+ /**
1895
+ *
1896
+ * @type {string}
1897
+ * @memberof PushNotificationReplaceRequest
1898
+ */
1899
+ subtitle?: string;
1900
+ /**
1901
+ * Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon.
1902
+ * @type {string}
1903
+ * @memberof PushNotificationReplaceRequest
1904
+ */
1905
+ icon?: string;
1906
+ /**
1907
+ * Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
1908
+ * @type {string}
1909
+ * @memberof PushNotificationReplaceRequest
1910
+ */
1911
+ media?: string;
1912
+ /**
1913
+ * Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
1914
+ * @type {string}
1915
+ * @memberof PushNotificationReplaceRequest
1916
+ */
1917
+ redirection?: string;
1918
+ /**
1919
+ * Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
1920
+ * @type {Array<PushNotificationAction>}
1921
+ * @memberof PushNotificationReplaceRequest
1922
+ */
1923
+ actions?: Array<PushNotificationAction>;
1924
+ /**
1925
+ *
1926
+ * @type {object}
1927
+ * @memberof PushNotificationReplaceRequest
1928
+ */
1929
+ payload?: object;
1930
+ /**
1931
+ *
1932
+ * @type {number}
1933
+ * @memberof PushNotificationReplaceRequest
1934
+ */
1935
+ badge?: number;
1936
+ /**
1937
+ * Optional tags to organize and filter notification history.
1938
+ * @type {Array<string>}
1939
+ * @memberof PushNotificationReplaceRequest
1940
+ */
1941
+ tags?: Array<string>;
1942
+ }
1943
+ /**
1944
+ * Apple APNs acceptance result for the replacement. Acceptance does not confirm device delivery or presentation.
1945
+ * @export
1946
+ * @interface PushNotificationReplaceResponse
1947
+ */
1948
+ export interface PushNotificationReplaceResponse {
1949
+ /**
1950
+ * True when APNs accepts the replacement for at least one device.
1951
+ * @type {boolean}
1952
+ * @memberof PushNotificationReplaceResponse
1953
+ */
1954
+ success: boolean;
1955
+ /**
1956
+ * ID of the replaced Push Notification. It stays the same, so you can replace it again.
1957
+ * @type {string}
1958
+ * @memberof PushNotificationReplaceResponse
1959
+ */
1960
+ notification_id: string;
1961
+ /**
1962
+ * Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
1963
+ * @type {number}
1964
+ * @memberof PushNotificationReplaceResponse
1965
+ */
1966
+ devices_notified?: number;
1967
+ /**
1968
+ *
1969
+ * @type {number}
1970
+ * @memberof PushNotificationReplaceResponse
1971
+ */
1972
+ users_notified?: number;
1973
+ /**
1974
+ *
1975
+ * @type {Array<string>}
1976
+ * @memberof PushNotificationReplaceResponse
1977
+ */
1978
+ effective_channel_slugs?: Array<string>;
1979
+ /**
1980
+ * Optional tags to organize and filter notification history.
1981
+ * @type {Array<string>}
1982
+ * @memberof PushNotificationReplaceResponse
1983
+ */
1984
+ tags?: Array<string>;
1985
+ /**
1986
+ *
1987
+ * @type {string}
1988
+ * @memberof PushNotificationReplaceResponse
1989
+ */
1990
+ timestamp: string;
1991
+ }
1624
1992
  /**
1625
1993
  *
1626
1994
  * @export
@@ -1654,6 +2022,18 @@ export interface PushNotificationRequest {
1654
2022
  * @memberof PushNotificationRequest
1655
2023
  */
1656
2024
  subtitle?: string;
2025
+ /**
2026
+ * Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon.
2027
+ * @type {string}
2028
+ * @memberof PushNotificationRequest
2029
+ */
2030
+ icon?: string;
2031
+ /**
2032
+ * Optional. How urgently iOS presents the notification: `passive` (quiet, no sound or screen wake), `active` (default), or `time-sensitive` (can break through Focus and Scheduled Summary when allowed). Omit for normal delivery.
2033
+ * @type {PushInterruptionLevel}
2034
+ * @memberof PushNotificationRequest
2035
+ */
2036
+ interruption_level?: PushInterruptionLevel;
1657
2037
  /**
1658
2038
  * Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
1659
2039
  * @type {string}
@@ -1704,19 +2084,25 @@ export interface PushNotificationRequest {
1704
2084
  tags?: Array<string>;
1705
2085
  }
1706
2086
  /**
1707
- *
2087
+ * Apple APNs acceptance result. Acceptance does not confirm device delivery or presentation. Alerts remain eligible for APNs delivery retries for 24 hours; device settings and APNs storage policies still apply.
1708
2088
  * @export
1709
2089
  * @interface PushNotificationResponse
1710
2090
  */
1711
2091
  export interface PushNotificationResponse {
1712
2092
  /**
1713
- *
2093
+ * True when APNs accepts the notification for at least one targeted device.
1714
2094
  * @type {boolean}
1715
2095
  * @memberof PushNotificationResponse
1716
2096
  */
1717
2097
  success: boolean;
1718
2098
  /**
1719
- *
2099
+ * ID of this Push Notification. Pass it to `PUT /push-notification/{notification_id}` to replace the notification later.
2100
+ * @type {string}
2101
+ * @memberof PushNotificationResponse
2102
+ */
2103
+ notification_id?: string;
2104
+ /**
2105
+ * Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
1720
2106
  * @type {number}
1721
2107
  * @memberof PushNotificationResponse
1722
2108
  */
@@ -1745,6 +2131,36 @@ export interface PushNotificationResponse {
1745
2131
  * @memberof PushNotificationResponse
1746
2132
  */
1747
2133
  timestamp: string;
2134
+ /**
2135
+ * Number of device tokens targeted.
2136
+ * @type {number}
2137
+ * @memberof PushNotificationResponse
2138
+ */
2139
+ devices_targeted?: number;
2140
+ /**
2141
+ * Number of device tokens deactivated because APNs reported them unregistered.
2142
+ * @type {number}
2143
+ * @memberof PushNotificationResponse
2144
+ */
2145
+ devices_deactivated?: number;
2146
+ /**
2147
+ * Number of targeted device tokens APNs reported as unregistered.
2148
+ * @type {number}
2149
+ * @memberof PushNotificationResponse
2150
+ */
2151
+ devices_unregistered?: number;
2152
+ /**
2153
+ * True when the request was an integration connection test and no paired devices were available.
2154
+ * @type {boolean}
2155
+ * @memberof PushNotificationResponse
2156
+ */
2157
+ credential_test?: boolean;
2158
+ /**
2159
+ *
2160
+ * @type {string}
2161
+ * @memberof PushNotificationResponse
2162
+ */
2163
+ message?: string;
1748
2164
  }
1749
2165
  /**
1750
2166
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
3
+ exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.PushInterruptionLevel = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.BillingBlockedErrorErrorEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -23,6 +23,14 @@ exports.AppIconBadgeCountUpdateErrorCodeEnum = {
23
23
  DeviceDisconnected: 'badge_device_disconnected',
24
24
  UpdateFailed: 'badge_update_failed'
25
25
  };
26
+ /**
27
+ * @export
28
+ */
29
+ exports.BillingBlockedErrorErrorEnum = {
30
+ TrialExpired: 'trial_expired',
31
+ TrialExhausted: 'trial_exhausted',
32
+ BillingOverageCapReached: 'billing_overage_cap_reached'
33
+ };
26
34
  /**
27
35
  * @export
28
36
  */
@@ -242,6 +250,15 @@ exports.LiveActivityWebhookMethod = {
242
250
  Get: 'GET',
243
251
  Post: 'POST'
244
252
  };
253
+ /**
254
+ * How urgently iOS presents the notification. `passive` arrives quietly in the notification list without sound or lighting up the screen. `active` is normal delivery and the default when omitted. `time-sensitive` can break through Focus and Scheduled Summary when the user allows Time Sensitive Notifications for ActivitySmith.
255
+ * @export
256
+ */
257
+ exports.PushInterruptionLevel = {
258
+ Passive: 'passive',
259
+ Active: 'active',
260
+ TimeSensitive: 'time-sensitive'
261
+ };
245
262
  /**
246
263
  *
247
264
  * @export
@@ -10,6 +10,8 @@ type PushRequestBody = Parameters<PushNotificationsApi["sendPushNotification"]>[
10
10
  type PushSendParameters = Parameters<PushNotificationsApi["sendPushNotification"]>[0];
11
11
  type PushRawParameters = Parameters<PushNotificationsApi["sendPushNotificationRaw"]>[0];
12
12
  type SendInitOverrides = Parameters<PushNotificationsApi["sendPushNotification"]>[1];
13
+ type PushReplaceRequestBody = Parameters<PushNotificationsApi["replacePushNotification"]>[0]["pushNotificationReplaceRequest"];
14
+ type PushReplaceParameters = Parameters<PushNotificationsApi["replacePushNotification"]>[0];
13
15
  type StartRequestBody = Parameters<LiveActivitiesApi["startLiveActivity"]>[0]["liveActivityStartRequest"];
14
16
  type UpdateRequestBody = Parameters<LiveActivitiesApi["updateLiveActivity"]>[0]["liveActivityUpdateRequest"];
15
17
  type EndRequestBody = Parameters<LiveActivitiesApi["endLiveActivity"]>[0]["liveActivityEndRequest"];
@@ -89,6 +91,12 @@ export declare class NotificationsResource {
89
91
  private readonly api;
90
92
  constructor(api: PushNotificationsApi);
91
93
  send(request: PushSendRequest, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
94
+ /**
95
+ * Silently replaces a sent Push Notification, using the notification_id returned by send().
96
+ * The replacement takes the original's place on the Lock Screen and in history.
97
+ */
98
+ replace(notificationId: string, request: PushReplaceRequestBody, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
99
+ replacePushNotification(requestParameters: PushReplaceParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
92
100
  sendPushNotification(requestParameters: PushSendParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
93
101
  sendPushNotificationRaw(requestParameters: PushRawParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").PushNotificationResponse>>;
94
102
  }
@@ -140,6 +148,12 @@ export declare class ActivitySmith {
140
148
  static readonly contentState: typeof contentState;
141
149
  static readonly alertIcon: typeof alertIcon;
142
150
  static readonly alertBadge: typeof alertBadge;
151
+ /** Push Notification interruption levels. */
152
+ static readonly pushInterruptionLevels: {
153
+ readonly passive: "passive";
154
+ readonly active: "active";
155
+ readonly timeSensitive: "time-sensitive";
156
+ };
143
157
  readonly notifications: NotificationsResource;
144
158
  readonly liveActivities: LiveActivitiesResource;
145
159
  readonly metrics: MetricsResource;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
4
4
  const index_1 = require("../generated/index");
5
- const SDK_VERSION = "1.12.0";
5
+ const SDK_VERSION = "1.14.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
7
  const DEFAULT_SDK_NAME = "node";
8
8
  const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
@@ -65,7 +65,11 @@ function hasActionsValue(actions) {
65
65
  }
66
66
  return actions !== null && actions !== undefined;
67
67
  }
68
+ const PUSH_INTERRUPTION_LEVELS = Object.values(index_1.PushInterruptionLevel);
68
69
  function assertValidPushRequest(request) {
70
+ if (request.interruption_level !== undefined && !PUSH_INTERRUPTION_LEVELS.includes(request.interruption_level)) {
71
+ throw new Error("ActivitySmith: interruption_level must be passive, active, or time-sensitive");
72
+ }
69
73
  if (hasMediaValue(request.media) && hasActionsValue(request.actions)) {
70
74
  throw new Error("ActivitySmith: media cannot be combined with actions");
71
75
  }
@@ -93,6 +97,19 @@ class NotificationsResource {
93
97
  assertValidPushRequest(normalized);
94
98
  return this.api.sendPushNotification({ pushNotificationRequest: normalized }, initOverrides);
95
99
  }
100
+ /**
101
+ * Silently replaces a sent Push Notification, using the notification_id returned by send().
102
+ * The replacement takes the original's place on the Lock Screen and in history.
103
+ */
104
+ replace(notificationId, request, initOverrides) {
105
+ assertValidPushRequest(request);
106
+ return this.api.replacePushNotification({ notificationId, pushNotificationReplaceRequest: request }, initOverrides);
107
+ }
108
+ // Generated-style alias.
109
+ replacePushNotification(requestParameters, initOverrides) {
110
+ assertValidPushRequest(requestParameters.pushNotificationReplaceRequest);
111
+ return this.api.replacePushNotification(requestParameters, initOverrides);
112
+ }
96
113
  // Backward-compatible alias.
97
114
  sendPushNotification(requestParameters, initOverrides) {
98
115
  assertValidPushRequest(requestParameters.pushNotificationRequest);
@@ -218,3 +235,9 @@ ActivitySmith.liveActivityTypes = LiveActivityTypes;
218
235
  ActivitySmith.contentState = contentState;
219
236
  ActivitySmith.alertIcon = alertIcon;
220
237
  ActivitySmith.alertBadge = alertBadge;
238
+ /** Push Notification interruption levels. */
239
+ ActivitySmith.pushInterruptionLevels = {
240
+ passive: index_1.PushInterruptionLevel.Passive,
241
+ active: index_1.PushInterruptionLevel.Active,
242
+ timeSensitive: index_1.PushInterruptionLevel.TimeSensitive,
243
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",