activitysmith 1.9.0 → 1.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.
@@ -71,7 +71,77 @@ export interface AlertPayload {
71
71
  body?: string;
72
72
  }
73
73
  /**
74
- * App Icon Badge Count update. Send badge 0 to clear the count.
74
+ *
75
+ * @export
76
+ * @interface AppIconBadgeCountUpdateError
77
+ */
78
+ export interface AppIconBadgeCountUpdateError {
79
+ /**
80
+ *
81
+ * @type {string}
82
+ * @memberof AppIconBadgeCountUpdateError
83
+ */
84
+ error: string;
85
+ /**
86
+ *
87
+ * @type {string}
88
+ * @memberof AppIconBadgeCountUpdateError
89
+ */
90
+ code: AppIconBadgeCountUpdateErrorCodeEnum;
91
+ /**
92
+ *
93
+ * @type {string}
94
+ * @memberof AppIconBadgeCountUpdateError
95
+ */
96
+ message: string;
97
+ /**
98
+ *
99
+ * @type {number}
100
+ * @memberof AppIconBadgeCountUpdateError
101
+ */
102
+ badge: number;
103
+ /**
104
+ *
105
+ * @type {number}
106
+ * @memberof AppIconBadgeCountUpdateError
107
+ */
108
+ devices_targeted?: number;
109
+ /**
110
+ *
111
+ * @type {number}
112
+ * @memberof AppIconBadgeCountUpdateError
113
+ */
114
+ devices_updated: number;
115
+ /**
116
+ *
117
+ * @type {number}
118
+ * @memberof AppIconBadgeCountUpdateError
119
+ */
120
+ users_updated?: number;
121
+ /**
122
+ * Deprecated compatibility alias for devices_updated.
123
+ * @type {number}
124
+ * @memberof AppIconBadgeCountUpdateError
125
+ * @deprecated
126
+ */
127
+ devices_notified?: number;
128
+ /**
129
+ *
130
+ * @type {Array<string>}
131
+ * @memberof AppIconBadgeCountUpdateError
132
+ */
133
+ effective_channel_slugs?: Array<string>;
134
+ }
135
+ /**
136
+ * @export
137
+ */
138
+ export declare const AppIconBadgeCountUpdateErrorCodeEnum: {
139
+ readonly DeviceDisconnected: "badge_device_disconnected";
140
+ readonly UpdateFailed: "badge_update_failed";
141
+ };
142
+ export type AppIconBadgeCountUpdateErrorCodeEnum = typeof AppIconBadgeCountUpdateErrorCodeEnum[keyof typeof AppIconBadgeCountUpdateErrorCodeEnum];
143
+ /**
144
+ *
75
145
  * @export
76
146
  * @interface AppIconBadgeCountUpdateRequest
77
147
  */
@@ -108,17 +178,31 @@ export interface AppIconBadgeCountUpdateResponse {
108
178
  */
109
179
  badge: number;
110
180
  /**
111
- *
181
+ * Number of devices whose App Icon Badge Count was updated.
112
182
  * @type {number}
113
183
  * @memberof AppIconBadgeCountUpdateResponse
114
184
  */
115
- devices_notified: number;
185
+ devices_updated: number;
116
186
  /**
117
- *
187
+ * Number of account users with at least one updated device.
188
+ * @type {number}
189
+ * @memberof AppIconBadgeCountUpdateResponse
190
+ */
191
+ users_updated: number;
192
+ /**
193
+ * Deprecated compatibility alias for devices_updated.
194
+ * @type {number}
195
+ * @memberof AppIconBadgeCountUpdateResponse
196
+ * @deprecated
197
+ */
198
+ devices_notified?: number;
199
+ /**
200
+ * Deprecated compatibility alias for users_updated.
118
201
  * @type {number}
119
202
  * @memberof AppIconBadgeCountUpdateResponse
203
+ * @deprecated
120
204
  */
121
- users_notified: number;
205
+ users_notified?: number;
122
206
  /**
123
207
  *
124
208
  * @type {Array<string>}
@@ -734,7 +818,7 @@ export interface LiveActivityAction {
734
818
  */
735
819
  type: LiveActivityActionType;
736
820
  /**
737
- * Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend.
821
+ * Action URL. For open_url, use an HTTP or HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend.
738
822
  * @type {string}
739
823
  * @memberof LiveActivityAction
740
824
  */
@@ -822,12 +906,26 @@ export type LiveActivityColor = typeof LiveActivityColor[keyof typeof LiveActivi
822
906
  * @interface LiveActivityEndRequest
823
907
  */
824
908
  export interface LiveActivityEndRequest {
909
+ /**
910
+ * 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.
911
+ * @type {{ [key: string]: MetadataValue; }}
912
+ * @memberof LiveActivityEndRequest
913
+ */
914
+ metadata?: {
915
+ [key: string]: MetadataValue;
916
+ };
825
917
  /**
826
918
  *
827
919
  * @type {string}
828
920
  * @memberof LiveActivityEndRequest
829
921
  */
830
922
  activity_id: string;
923
+ /**
924
+ * Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
925
+ * @type {Array<string>}
926
+ * @memberof LiveActivityEndRequest
927
+ */
928
+ tags?: Array<string>;
831
929
  /**
832
930
  *
833
931
  * @type {ContentStateEnd}
@@ -841,7 +939,7 @@ export interface LiveActivityEndRequest {
841
939
  */
842
940
  action?: LiveActivityAction;
843
941
  /**
844
- * Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
942
+ * Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
845
943
  * @type {LiveActivityAction}
846
944
  * @memberof LiveActivityEndRequest
847
945
  */
@@ -909,11 +1007,23 @@ export interface LiveActivityLimitError {
909
1007
  */
910
1008
  limit: number;
911
1009
  /**
912
- * Current number of active Live Activities.
1010
+ * Highest number of active Live Activities among the targeted devices.
913
1011
  * @type {number}
914
1012
  * @memberof LiveActivityLimitError
915
1013
  */
916
1014
  active: number;
1015
+ /**
1016
+ * Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity.
1017
+ * @type {number}
1018
+ * @memberof LiveActivityLimitError
1019
+ */
1020
+ blocked_devices?: number;
1021
+ /**
1022
+ * Total number of targeted devices. Included only when targeted devices have mixed capacity.
1023
+ * @type {number}
1024
+ * @memberof LiveActivityLimitError
1025
+ */
1026
+ targeted_devices?: number;
917
1027
  }
918
1028
  /**
919
1029
  * Start a new Live Activity. The response includes activity_id for later update and end calls.
@@ -921,6 +1031,14 @@ export interface LiveActivityLimitError {
921
1031
  * @interface LiveActivityStartRequest
922
1032
  */
923
1033
  export interface LiveActivityStartRequest {
1034
+ /**
1035
+ * 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.
1036
+ * @type {{ [key: string]: MetadataValue; }}
1037
+ * @memberof LiveActivityStartRequest
1038
+ */
1039
+ metadata?: {
1040
+ [key: string]: MetadataValue;
1041
+ };
924
1042
  /**
925
1043
  *
926
1044
  * @type {ContentStateStart}
@@ -934,7 +1052,7 @@ export interface LiveActivityStartRequest {
934
1052
  */
935
1053
  action?: LiveActivityAction;
936
1054
  /**
937
- * Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1055
+ * Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
938
1056
  * @type {LiveActivityAction}
939
1057
  * @memberof LiveActivityStartRequest
940
1058
  */
@@ -951,6 +1069,12 @@ export interface LiveActivityStartRequest {
951
1069
  * @memberof LiveActivityStartRequest
952
1070
  */
953
1071
  target?: ChannelTarget;
1072
+ /**
1073
+ * Optional tags to organize and filter notification history.
1074
+ * @type {Array<string>}
1075
+ * @memberof LiveActivityStartRequest
1076
+ */
1077
+ tags?: Array<string>;
954
1078
  }
955
1079
  /**
956
1080
  * Returned after a Live Activity starts. Save activity_id and use it for all later updates and for the final end call.
@@ -988,6 +1112,12 @@ export interface LiveActivityStartResponse {
988
1112
  * @memberof LiveActivityStartResponse
989
1113
  */
990
1114
  effective_channel_slugs?: Array<string>;
1115
+ /**
1116
+ * Optional tags to organize and filter notification history.
1117
+ * @type {Array<string>}
1118
+ * @memberof LiveActivityStartResponse
1119
+ */
1120
+ tags?: Array<string>;
991
1121
  /**
992
1122
  *
993
1123
  * @type {string}
@@ -1001,6 +1131,20 @@ export interface LiveActivityStartResponse {
1001
1131
  * @interface LiveActivityStreamDeleteRequest
1002
1132
  */
1003
1133
  export interface LiveActivityStreamDeleteRequest {
1134
+ /**
1135
+ * 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.
1136
+ * @type {{ [key: string]: MetadataValue; }}
1137
+ * @memberof LiveActivityStreamDeleteRequest
1138
+ */
1139
+ metadata?: {
1140
+ [key: string]: MetadataValue;
1141
+ };
1142
+ /**
1143
+ * Optional tags to organize and filter notification history.
1144
+ * @type {Array<string>}
1145
+ * @memberof LiveActivityStreamDeleteRequest
1146
+ */
1147
+ tags?: Array<string>;
1004
1148
  /**
1005
1149
  *
1006
1150
  * @type {StreamContentState}
@@ -1014,7 +1158,7 @@ export interface LiveActivityStreamDeleteRequest {
1014
1158
  */
1015
1159
  action?: LiveActivityAction;
1016
1160
  /**
1017
- * Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1161
+ * Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1018
1162
  * @type {LiveActivityAction}
1019
1163
  * @memberof LiveActivityStreamDeleteRequest
1020
1164
  */
@@ -1142,6 +1286,12 @@ export interface LiveActivityStreamPutResponse {
1142
1286
  * @memberof LiveActivityStreamPutResponse
1143
1287
  */
1144
1288
  effective_channel_slugs?: Array<string>;
1289
+ /**
1290
+ * Optional tags to organize and filter notification history.
1291
+ * @type {Array<string>}
1292
+ * @memberof LiveActivityStreamPutResponse
1293
+ */
1294
+ tags?: Array<string>;
1145
1295
  /**
1146
1296
  *
1147
1297
  * @type {string}
@@ -1166,6 +1316,14 @@ export type LiveActivityStreamPutResponseOperationEnum = typeof LiveActivityStre
1166
1316
  * @interface LiveActivityStreamRequest
1167
1317
  */
1168
1318
  export interface LiveActivityStreamRequest {
1319
+ /**
1320
+ * 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.
1321
+ * @type {{ [key: string]: MetadataValue; }}
1322
+ * @memberof LiveActivityStreamRequest
1323
+ */
1324
+ metadata?: {
1325
+ [key: string]: MetadataValue;
1326
+ };
1169
1327
  /**
1170
1328
  *
1171
1329
  * @type {StreamContentState}
@@ -1179,7 +1337,7 @@ export interface LiveActivityStreamRequest {
1179
1337
  */
1180
1338
  action?: LiveActivityAction;
1181
1339
  /**
1182
- * Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1340
+ * Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1183
1341
  * @type {LiveActivityAction}
1184
1342
  * @memberof LiveActivityStreamRequest
1185
1343
  */
@@ -1202,6 +1360,12 @@ export interface LiveActivityStreamRequest {
1202
1360
  * @memberof LiveActivityStreamRequest
1203
1361
  */
1204
1362
  target?: ChannelTarget;
1363
+ /**
1364
+ * Optional tags to organize and filter notification history.
1365
+ * @type {Array<string>}
1366
+ * @memberof LiveActivityStreamRequest
1367
+ */
1368
+ tags?: Array<string>;
1205
1369
  }
1206
1370
  /**
1207
1371
  * Update an existing Live Activity by activity_id.
@@ -1209,12 +1373,26 @@ export interface LiveActivityStreamRequest {
1209
1373
  * @interface LiveActivityUpdateRequest
1210
1374
  */
1211
1375
  export interface LiveActivityUpdateRequest {
1376
+ /**
1377
+ * 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.
1378
+ * @type {{ [key: string]: MetadataValue; }}
1379
+ * @memberof LiveActivityUpdateRequest
1380
+ */
1381
+ metadata?: {
1382
+ [key: string]: MetadataValue;
1383
+ };
1212
1384
  /**
1213
1385
  *
1214
1386
  * @type {string}
1215
1387
  * @memberof LiveActivityUpdateRequest
1216
1388
  */
1217
1389
  activity_id: string;
1390
+ /**
1391
+ * Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
1392
+ * @type {Array<string>}
1393
+ * @memberof LiveActivityUpdateRequest
1394
+ */
1395
+ tags?: Array<string>;
1218
1396
  /**
1219
1397
  *
1220
1398
  * @type {ContentStateUpdate}
@@ -1228,7 +1406,7 @@ export interface LiveActivityUpdateRequest {
1228
1406
  */
1229
1407
  action?: LiveActivityAction;
1230
1408
  /**
1231
- * Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1409
+ * Optional secondary action button. Supported for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
1232
1410
  * @type {LiveActivityAction}
1233
1411
  * @memberof LiveActivityUpdateRequest
1234
1412
  */
@@ -1280,6 +1458,12 @@ export declare const LiveActivityWebhookMethod: {
1280
1458
  readonly Post: "POST";
1281
1459
  };
1282
1460
  export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof typeof LiveActivityWebhookMethod];
1461
+ /**
1462
+ * @type MetadataValue
1463
+ *
1464
+ * @export
1465
+ */
1466
+ export type MetadataValue = boolean | number | string;
1283
1467
  /**
1284
1468
  *
1285
1469
  * @export
@@ -1401,7 +1585,7 @@ export interface PushNotificationAction {
1401
1585
  */
1402
1586
  type: PushNotificationActionType;
1403
1587
  /**
1404
- * Action URL. For open_url, use an HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend.
1588
+ * Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend.
1405
1589
  * @type {string}
1406
1590
  * @memberof PushNotificationAction
1407
1591
  */
@@ -1435,6 +1619,14 @@ export type PushNotificationActionType = typeof PushNotificationActionType[keyof
1435
1619
  */
1436
1620
  export interface PushNotificationRequest {
1437
1621
  [key: string]: any | any;
1622
+ /**
1623
+ * 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.
1624
+ * @type {{ [key: string]: MetadataValue; }}
1625
+ * @memberof PushNotificationRequest
1626
+ */
1627
+ metadata?: {
1628
+ [key: string]: MetadataValue;
1629
+ };
1438
1630
  /**
1439
1631
  *
1440
1632
  * @type {string}
@@ -1460,7 +1652,7 @@ export interface PushNotificationRequest {
1460
1652
  */
1461
1653
  media?: string;
1462
1654
  /**
1463
- * Optional HTTPS URL or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided.
1655
+ * 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.
1464
1656
  * @type {string}
1465
1657
  * @memberof PushNotificationRequest
1466
1658
  */
@@ -1495,6 +1687,12 @@ export interface PushNotificationRequest {
1495
1687
  * @memberof PushNotificationRequest
1496
1688
  */
1497
1689
  target?: ChannelTarget;
1690
+ /**
1691
+ * Optional tags to organize and filter notification history.
1692
+ * @type {Array<string>}
1693
+ * @memberof PushNotificationRequest
1694
+ */
1695
+ tags?: Array<string>;
1498
1696
  }
1499
1697
  /**
1500
1698
  *
@@ -1526,6 +1724,12 @@ export interface PushNotificationResponse {
1526
1724
  * @memberof PushNotificationResponse
1527
1725
  */
1528
1726
  effective_channel_slugs?: Array<string>;
1727
+ /**
1728
+ * Optional tags to organize and filter notification history.
1729
+ * @type {Array<string>}
1730
+ * @memberof PushNotificationResponse
1731
+ */
1732
+ tags?: Array<string>;
1529
1733
  /**
1530
1734
  *
1531
1735
  * @type {string}
@@ -1754,3 +1958,9 @@ export declare const StreamContentStateStepColorsEnum: {
1754
1958
  readonly Gray: "gray";
1755
1959
  };
1756
1960
  export type StreamContentStateStepColorsEnum = typeof StreamContentStateStepColorsEnum[keyof typeof StreamContentStateStepColorsEnum];
1961
+ /**
1962
+ * @type UpdateAppIconBadgeCount422Response
1963
+ *
1964
+ * @export
1965
+ */
1966
+ export type UpdateAppIconBadgeCount422Response = AppIconBadgeCountUpdateError | NoRecipientsError;
@@ -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.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.ActivityMetricColorEnum = void 0;
3
+ exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = 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;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -16,6 +16,13 @@ exports.ActivityMetricColorEnum = {
16
16
  Yellow: 'yellow',
17
17
  Gray: 'gray'
18
18
  };
19
+ /**
20
+ * @export
21
+ */
22
+ exports.AppIconBadgeCountUpdateErrorCodeEnum = {
23
+ DeviceDisconnected: 'badge_device_disconnected',
24
+ UpdateFailed: 'badge_update_failed'
25
+ };
19
26
  /**
20
27
  * @export
21
28
  */
@@ -1,6 +1,10 @@
1
1
  import { AppIconBadgesApi, LiveActivitiesApi, MetricsApi, PushNotificationsApi } from "../generated/index";
2
2
  export interface ActivitySmithOptions {
3
3
  apiKey: string;
4
+ sdk?: {
5
+ name: string;
6
+ version: string;
7
+ };
4
8
  }
5
9
  type PushRequestBody = Parameters<PushNotificationsApi["sendPushNotification"]>[0]["pushNotificationRequest"];
6
10
  type PushSendParameters = Parameters<PushNotificationsApi["sendPushNotification"]>[0];
@@ -2,9 +2,10 @@
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.9.0";
5
+ const SDK_VERSION = "1.11.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
- const SDK_HEADER_VALUE = `node-v${SDK_VERSION}`;
7
+ const DEFAULT_SDK_NAME = "node";
8
+ const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
8
9
  const LiveActivityTypes = {
9
10
  segmentedProgress: "segmented_progress",
10
11
  progress: "progress",
@@ -28,6 +29,20 @@ function withTargetChannels(request) {
28
29
  function compactObject(value) {
29
30
  return Object.fromEntries(Object.entries(value).filter(([, entryValue]) => entryValue !== undefined));
30
31
  }
32
+ function sdkHeaderValue(sdk) {
33
+ if (!sdk) {
34
+ return SDK_HEADER_VALUE;
35
+ }
36
+ const name = sdk.name.trim().toLowerCase();
37
+ const version = sdk.version.trim();
38
+ if (!/^[a-z][a-z0-9]*$/.test(name)) {
39
+ throw new Error("ActivitySmith: sdk.name must start with a letter and contain only letters and numbers");
40
+ }
41
+ if (!version) {
42
+ throw new Error("ActivitySmith: sdk.version is required");
43
+ }
44
+ return `${name}-v${version}`;
45
+ }
31
46
  function contentState(value) {
32
47
  return compactObject(value);
33
48
  }
@@ -180,7 +195,7 @@ class ActivitySmith {
180
195
  const config = new index_1.Configuration({
181
196
  accessToken: opts.apiKey,
182
197
  headers: {
183
- [SDK_HEADER_NAME]: SDK_HEADER_VALUE,
198
+ [SDK_HEADER_NAME]: sdkHeaderValue(opts.sdk),
184
199
  },
185
200
  });
186
201
  this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",
@@ -44,7 +44,7 @@
44
44
  "node": ">=18"
45
45
  },
46
46
  "scripts": {
47
- "clean": "tsc -b --clean",
47
+ "clean": "tsc -b --clean && node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
48
48
  "build": "npm run clean && tsc -b",
49
49
  "prepublishOnly": "npm run build",
50
50
  "test": "npm run build && vitest run"