@azure/notification-hubs 1.0.0-alpha.20230206.1 → 1.0.0-alpha.20230309.2
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 +1 -1
- package/dist/index.cjs +86 -31
- package/dist/index.cjs.map +1 -1
- package/dist-esm/src/api/internal/_listRegistrations.js +5 -12
- package/dist-esm/src/api/internal/_listRegistrations.js.map +1 -1
- package/dist-esm/src/api/listRegistrationsByTag.js +5 -12
- package/dist-esm/src/api/listRegistrationsByTag.js.map +1 -1
- package/dist-esm/src/auth/sasTokenProvider.js +6 -6
- package/dist-esm/src/auth/sasTokenProvider.js.map +1 -1
- package/dist-esm/src/models/installation.js +8 -0
- package/dist-esm/src/models/installation.js.map +1 -1
- package/dist-esm/src/models/notification.js +9 -1
- package/dist-esm/src/models/notification.js.map +1 -1
- package/dist-esm/src/models/notificationDetails.js.map +1 -1
- package/dist-esm/src/models/registration.js +16 -0
- package/dist-esm/src/models/registration.js.map +1 -1
- package/dist-esm/src/serializers/notificationDetailsSerializer.js +5 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist-esm/src/serializers/registrationSerializer.js +28 -0
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
- package/package.json +10 -5
- package/types/3.1/notification-hubs.d.ts +97 -6
- package/types/latest/notification-hubs.d.ts +108 -6
- package/types/latest/tsdoc-metadata.json +1 -1
- package/types/src/auth/connectionStringUtils.d.ts +1 -1
- package/types/src/auth/connectionStringUtils.d.ts.map +1 -1
- package/types/src/models/installation.d.ts +18 -3
- package/types/src/models/installation.d.ts.map +1 -1
- package/types/src/models/notification.d.ts +18 -3
- package/types/src/models/notification.d.ts.map +1 -1
- package/types/src/models/notificationBodyBuilder.d.ts +1 -1
- package/types/src/models/notificationBodyBuilder.d.ts.map +1 -1
- package/types/src/models/notificationDetails.d.ts +5 -1
- package/types/src/models/notificationDetails.d.ts.map +1 -1
- package/types/src/models/notificationHubJob.d.ts +3 -3
- package/types/src/models/notificationHubJob.d.ts.map +1 -1
- package/types/src/models/registration.d.ts +60 -3
- package/types/src/models/registration.d.ts.map +1 -1
- package/types/src/serializers/notificationDetailsSerializer.d.ts.map +1 -1
- package/types/src/serializers/registrationSerializer.d.ts +21 -1
- package/types/src/serializers/registrationSerializer.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Azure Notification Hubs SDK for JavaScript
|
|
2
2
|
|
|
3
|
-
Azure Notification Hubs provide a scaled-out push engine that enables you to send notifications to any platform (Apple, Amazon Kindle, Android, Baidu, Web, Windows, etc.) from any back-end (cloud or on-premises). Notification Hubs works well for both enterprise and consumer scenarios. Here are a few example scenarios:
|
|
3
|
+
Azure Notification Hubs provide a scaled-out push engine that enables you to send notifications to any platform (Apple, Amazon Kindle, Android, Baidu, Xiaomi, Web, Windows, etc.) from any back-end (cloud or on-premises). Notification Hubs works well for both enterprise and consumer scenarios. Here are a few example scenarios:
|
|
4
4
|
|
|
5
5
|
- Send breaking news notifications to millions with low latency.
|
|
6
6
|
- Send location-based coupons to interested user segments.
|
package/dist/index.cjs
CHANGED
|
@@ -46,12 +46,6 @@ function createSasTokenProvider(data) {
|
|
|
46
46
|
* @internal
|
|
47
47
|
*/
|
|
48
48
|
class SasTokenProviderImpl {
|
|
49
|
-
/**
|
|
50
|
-
* Property used to distinguish TokenProvider from TokenCredential.
|
|
51
|
-
*/
|
|
52
|
-
get isSasTokenProvider() {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
49
|
/**
|
|
56
50
|
* Initializes a new instance of SasTokenProvider
|
|
57
51
|
* @param credential - The source `NamedKeyCredential` or `SASCredential`.
|
|
@@ -59,6 +53,12 @@ class SasTokenProviderImpl {
|
|
|
59
53
|
constructor(credential) {
|
|
60
54
|
this._credential = credential;
|
|
61
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Property used to distinguish TokenProvider from TokenCredential.
|
|
58
|
+
*/
|
|
59
|
+
get isSasTokenProvider() {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
62
|
/**
|
|
63
63
|
* Gets the sas token for the specified audience
|
|
64
64
|
* @param audience - The audience for which the token is desired.
|
|
@@ -891,6 +891,20 @@ const registrationDescriptionParser = {
|
|
|
891
891
|
var _a;
|
|
892
892
|
return Object.assign(Object.assign(Object.assign({ mpnsHeaders: getHeadersOrUndefined((_a = rawRegistrationDescription["MpnsHeaders"]) === null || _a === void 0 ? void 0 : _a["MpnsHeader"]) }, this.createWindowsRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "MpnsTemplate" });
|
|
893
893
|
},
|
|
894
|
+
/**
|
|
895
|
+
* @internal
|
|
896
|
+
* Creates a Xiaomi registration description from incoming XML property bag.
|
|
897
|
+
*/
|
|
898
|
+
createXiaomiRegistrationDescription(rawRegistrationDescription) {
|
|
899
|
+
return Object.assign(Object.assign({ xiaomiRegistrationId: getString(rawRegistrationDescription["XiaomiRegistrationId"], "xiaomiRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Xiaomi" });
|
|
900
|
+
},
|
|
901
|
+
/**
|
|
902
|
+
* @internal
|
|
903
|
+
* Creates a Xiaomi template registration description from incoming XML property bag.
|
|
904
|
+
*/
|
|
905
|
+
createXiaomiTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
906
|
+
return Object.assign(Object.assign(Object.assign({}, this.createXiaomiRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "XiaomiTemplate" });
|
|
907
|
+
},
|
|
894
908
|
/**
|
|
895
909
|
* @internal
|
|
896
910
|
* Creates a Windows registration description from incoming XML property bag.
|
|
@@ -1061,6 +1075,20 @@ const registrationDescriptionSerializer = {
|
|
|
1061
1075
|
}
|
|
1062
1076
|
return Object.assign(Object.assign(Object.assign({}, this.serializeMpnsRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { MpnsHeaders: mpnsHeaders });
|
|
1063
1077
|
},
|
|
1078
|
+
/**
|
|
1079
|
+
* @internal
|
|
1080
|
+
* Serializes an existing Xiaomi registration description to an object for serialization.
|
|
1081
|
+
*/
|
|
1082
|
+
serializeXiaomiRegistrationDescription(description) {
|
|
1083
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { XiaomiRegistrationId: getString(description.xiaomiRegistrationId, "xiaomiRegistrationId") });
|
|
1084
|
+
},
|
|
1085
|
+
/**
|
|
1086
|
+
* @internal
|
|
1087
|
+
* Serializes an existing Xiaomi template registration description to an object for serialization.
|
|
1088
|
+
*/
|
|
1089
|
+
serializeXiaomiTemplateRegistrationDescription(description) {
|
|
1090
|
+
return Object.assign(Object.assign({}, this.serializeXiaomiRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1091
|
+
},
|
|
1064
1092
|
/**
|
|
1065
1093
|
* @internal
|
|
1066
1094
|
* Serializes an existing Windows registration description to an object for serialization.
|
|
@@ -1314,6 +1342,10 @@ async function parseNotificationDetails(bodyText) {
|
|
|
1314
1342
|
if (isDefined(notificationDetails["GcmOutcomeCounts"])) {
|
|
1315
1343
|
fcmOutcomeCounts = parseOutcomeCounts(notificationDetails["GcmOutcomeCounts"]["Outcome"]);
|
|
1316
1344
|
}
|
|
1345
|
+
let xiaomiOutcomeCounts;
|
|
1346
|
+
if (isDefined(notificationDetails["XiaomiOutcomeCounts"])) {
|
|
1347
|
+
xiaomiOutcomeCounts = parseOutcomeCounts(notificationDetails["XiaomiOutcomeCounts"]["Outcome"]);
|
|
1348
|
+
}
|
|
1317
1349
|
let wnsOutcomeCounts;
|
|
1318
1350
|
if (isDefined(notificationDetails["WnsOutcomeCounts"])) {
|
|
1319
1351
|
wnsOutcomeCounts = parseOutcomeCounts(notificationDetails["WnsOutcomeCounts"]["Outcome"]);
|
|
@@ -1332,6 +1364,7 @@ async function parseNotificationDetails(bodyText) {
|
|
|
1332
1364
|
admOutcomeCounts,
|
|
1333
1365
|
baiduOutcomeCounts,
|
|
1334
1366
|
fcmOutcomeCounts,
|
|
1367
|
+
xiaomiOutcomeCounts,
|
|
1335
1368
|
wnsOutcomeCounts,
|
|
1336
1369
|
};
|
|
1337
1370
|
}
|
|
@@ -1409,24 +1442,17 @@ function listNotificationHubJobs(context, options = {}) {
|
|
|
1409
1442
|
// Copyright (c) Microsoft Corporation.
|
|
1410
1443
|
function listRegistrationsAll(context, options) {
|
|
1411
1444
|
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsAll_1() {
|
|
1412
|
-
var
|
|
1445
|
+
var e_1, _a;
|
|
1413
1446
|
try {
|
|
1414
|
-
for (var
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
try {
|
|
1418
|
-
const page = _c;
|
|
1419
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1420
|
-
}
|
|
1421
|
-
finally {
|
|
1422
|
-
_d = true;
|
|
1423
|
-
}
|
|
1447
|
+
for (var _b = tslib.__asyncValues(listRegistrationPagingPage(context, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
|
|
1448
|
+
const page = _c.value;
|
|
1449
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1424
1450
|
}
|
|
1425
1451
|
}
|
|
1426
1452
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1427
1453
|
finally {
|
|
1428
1454
|
try {
|
|
1429
|
-
if (
|
|
1455
|
+
if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
|
|
1430
1456
|
}
|
|
1431
1457
|
finally { if (e_1) throw e_1.error; }
|
|
1432
1458
|
}
|
|
@@ -1588,24 +1614,17 @@ function listRegistrationsByTag(context, tag, options = {}) {
|
|
|
1588
1614
|
}
|
|
1589
1615
|
function listRegistrationsByTagAll(context, tag, options) {
|
|
1590
1616
|
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsByTagAll_1() {
|
|
1591
|
-
var
|
|
1617
|
+
var e_1, _a;
|
|
1592
1618
|
try {
|
|
1593
|
-
for (var
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
try {
|
|
1597
|
-
const page = _c;
|
|
1598
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1599
|
-
}
|
|
1600
|
-
finally {
|
|
1601
|
-
_d = true;
|
|
1602
|
-
}
|
|
1619
|
+
for (var _b = tslib.__asyncValues(listRegistrationsByTagPagingPage(context, tag, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
|
|
1620
|
+
const page = _c.value;
|
|
1621
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1603
1622
|
}
|
|
1604
1623
|
}
|
|
1605
1624
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1606
1625
|
finally {
|
|
1607
1626
|
try {
|
|
1608
|
-
if (
|
|
1627
|
+
if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
|
|
1609
1628
|
}
|
|
1610
1629
|
finally { if (e_1) throw e_1.error; }
|
|
1611
1630
|
}
|
|
@@ -2100,6 +2119,14 @@ function createBaiduInstallation(installation) {
|
|
|
2100
2119
|
function createFcmLegacyInstallation(installation) {
|
|
2101
2120
|
return Object.assign(Object.assign({}, installation), { platform: "gcm" });
|
|
2102
2121
|
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Creates a Xiaomi based installation.
|
|
2124
|
+
* @param installation - A partial installation used to create the Xiaomi installation.
|
|
2125
|
+
* @returns The newly created Xiaomi installation.
|
|
2126
|
+
*/
|
|
2127
|
+
function createXiaomiInstallation(installation) {
|
|
2128
|
+
return Object.assign(Object.assign({}, installation), { platform: "xiaomi" });
|
|
2129
|
+
}
|
|
2103
2130
|
/**
|
|
2104
2131
|
* Creates a Windows Notification Services (WNS) based installation.
|
|
2105
2132
|
* @param installation - A partial installation used to create the WNS installation.
|
|
@@ -2153,11 +2180,19 @@ function createBrowserNotification(notification) {
|
|
|
2153
2180
|
/**
|
|
2154
2181
|
* Creates a notification to send to Firebase.
|
|
2155
2182
|
* @param notification - A partial message used to create a message for Firebase.
|
|
2156
|
-
* @returns A newly created Firebase.
|
|
2183
|
+
* @returns A newly created Firebase notification.
|
|
2157
2184
|
*/
|
|
2158
2185
|
function createFcmLegacyNotification(notification) {
|
|
2159
2186
|
return Object.assign(Object.assign({}, notification), { platform: "gcm", contentType: JSON_CONTENT_TYPE });
|
|
2160
2187
|
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Creates a notification to send to Xiaomi.
|
|
2190
|
+
* @param notification - A partial message used to create a message for Xiaomi.
|
|
2191
|
+
* @returns A newly created Xiaomi notification.
|
|
2192
|
+
*/
|
|
2193
|
+
function createXiaomiNotification(notification) {
|
|
2194
|
+
return Object.assign(Object.assign({}, notification), { platform: "xiaomi", contentType: JSON_CONTENT_TYPE });
|
|
2195
|
+
}
|
|
2161
2196
|
/**
|
|
2162
2197
|
* Creates a notification to send to Firebase.
|
|
2163
2198
|
* @param notification - A partial message used to create a message for Firebase.
|
|
@@ -2363,6 +2398,22 @@ function createWindowsRegistrationDescription(description) {
|
|
|
2363
2398
|
function createWindowsTemplateRegistrationDescription(description) {
|
|
2364
2399
|
return Object.assign(Object.assign({}, description), { kind: "WindowsTemplate" });
|
|
2365
2400
|
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Creates a Xiaomi registration description.
|
|
2403
|
+
* @param description - A partial Xiaomi registration description.
|
|
2404
|
+
* @returns A created Xiaomi registration description.
|
|
2405
|
+
*/
|
|
2406
|
+
function createXiaomiRegistrationDescription(description) {
|
|
2407
|
+
return Object.assign(Object.assign({}, description), { kind: "Xiaomi" });
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Creates a Xiaomi template registration description.
|
|
2411
|
+
* @param description - A partial Xiaomi template registration description.
|
|
2412
|
+
* @returns A created Xiaomi template registration description.
|
|
2413
|
+
*/
|
|
2414
|
+
function createXiaomiTemplateRegistrationDescription(description) {
|
|
2415
|
+
return Object.assign(Object.assign({}, description), { kind: "XiaomiTemplate" });
|
|
2416
|
+
}
|
|
2366
2417
|
|
|
2367
2418
|
// Copyright (c) Microsoft Corporation.
|
|
2368
2419
|
// Licensed under the MIT license.
|
|
@@ -2410,4 +2461,8 @@ exports.createWindowsRegistrationDescription = createWindowsRegistrationDescript
|
|
|
2410
2461
|
exports.createWindowsTemplateRegistrationDescription = createWindowsTemplateRegistrationDescription;
|
|
2411
2462
|
exports.createWindowsTileNotification = createWindowsTileNotification;
|
|
2412
2463
|
exports.createWindowsToastNotification = createWindowsToastNotification;
|
|
2464
|
+
exports.createXiaomiInstallation = createXiaomiInstallation;
|
|
2465
|
+
exports.createXiaomiNotification = createXiaomiNotification;
|
|
2466
|
+
exports.createXiaomiRegistrationDescription = createXiaomiRegistrationDescription;
|
|
2467
|
+
exports.createXiaomiTemplateRegistrationDescription = createXiaomiTemplateRegistrationDescription;
|
|
2413
2468
|
//# sourceMappingURL=index.js.map
|