@azure/notification-hubs 1.0.4-alpha.20240112.1 → 1.0.4-alpha.20240116.1
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/dist/index.cjs +144 -367
- package/dist/index.cjs.map +1 -1
- package/dist-esm/src/api/beginSubmitNotificationHubJob.js +4 -3
- package/dist-esm/src/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist-esm/src/api/clientContext.js +5 -7
- package/dist-esm/src/api/clientContext.js.map +1 -1
- package/dist-esm/src/api/internal/_client.js +4 -21
- package/dist-esm/src/api/internal/_client.js.map +1 -1
- package/dist-esm/src/api/internal/_listRegistrations.js +31 -13
- package/dist-esm/src/api/internal/_listRegistrations.js.map +1 -1
- package/dist-esm/src/api/listRegistrationsByChannel.js +1 -4
- package/dist-esm/src/api/listRegistrationsByChannel.js.map +1 -1
- package/dist-esm/src/api/listRegistrationsByTag.js +31 -13
- package/dist-esm/src/api/listRegistrationsByTag.js.map +1 -1
- package/dist-esm/src/models/installation.js +7 -28
- package/dist-esm/src/models/installation.js.map +1 -1
- package/dist-esm/src/models/notification.js +12 -59
- package/dist-esm/src/models/notification.js.map +1 -1
- package/dist-esm/src/models/registration.js +14 -56
- package/dist-esm/src/models/registration.js.map +1 -1
- package/dist-esm/src/serializers/registrationSerializer.js +36 -163
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var coreClient = require('@azure-rest/core-client');
|
|
|
8
8
|
var abortController = require('@azure/abort-controller');
|
|
9
9
|
var coreXml = require('@azure/core-xml');
|
|
10
10
|
var coreTracing = require('@azure/core-tracing');
|
|
11
|
+
var tslib = require('tslib');
|
|
11
12
|
var coreUtil = require('@azure/core-util');
|
|
12
13
|
|
|
13
14
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -159,22 +160,20 @@ function createClientContext(connectionString, hubName, options = {}) {
|
|
|
159
160
|
}
|
|
160
161
|
class NotificationHubsServiceClient {
|
|
161
162
|
constructor(connectionString, hubName, options = {}) {
|
|
163
|
+
var _a, _b;
|
|
162
164
|
this.hubName = hubName;
|
|
163
165
|
const parsedConnection = parseNotificationHubsConnectionString(connectionString);
|
|
164
166
|
// Node doesn't allow change in protocol but browsers do, so doing a string replace
|
|
165
167
|
this.baseUrl = parsedConnection.endpoint.replace("sb://", "https://");
|
|
166
168
|
this.sasTokenCredential = createTokenCredentialFromConnection(parsedConnection.sharedAccessKey, parsedConnection.sharedAccessKeyName);
|
|
167
169
|
const packageDetails = `azsdk-js-notificationhubs/${SDK_VERSION}`;
|
|
168
|
-
const userAgentPrefix = options.userAgentOptions
|
|
170
|
+
const userAgentPrefix = ((_a = options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
|
|
169
171
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
170
172
|
: `${packageDetails}`;
|
|
171
|
-
this.httpClient = options
|
|
172
|
-
this.client = coreClient.getClient(this.baseUrl, {
|
|
173
|
-
userAgentOptions: {
|
|
173
|
+
this.httpClient = (_b = options === null || options === void 0 ? void 0 : options.httpClient) !== null && _b !== void 0 ? _b : coreRestPipeline.createDefaultHttpClient();
|
|
174
|
+
this.client = coreClient.getClient(this.baseUrl, Object.assign({ userAgentOptions: {
|
|
174
175
|
userAgentPrefix,
|
|
175
|
-
},
|
|
176
|
-
...options,
|
|
177
|
-
});
|
|
176
|
+
} }, options));
|
|
178
177
|
}
|
|
179
178
|
async createHeaders(operationName, rawHeaders) {
|
|
180
179
|
const authorization = await this.sasTokenCredential.getToken(this.baseUrl);
|
|
@@ -422,14 +421,8 @@ async function parseXMLError(bodyText) {
|
|
|
422
421
|
// Copyright (c) Microsoft Corporation.
|
|
423
422
|
// Licensed under the MIT license.
|
|
424
423
|
function createRequest(endpoint, method, headers, options) {
|
|
425
|
-
return coreRestPipeline.createPipelineRequest({
|
|
426
|
-
|
|
427
|
-
...options.requestOptions,
|
|
428
|
-
url: endpoint.toString(),
|
|
429
|
-
abortSignal: options.abortSignal,
|
|
430
|
-
method,
|
|
431
|
-
headers,
|
|
432
|
-
});
|
|
424
|
+
return coreRestPipeline.createPipelineRequest(Object.assign(Object.assign(Object.assign({}, options.tracingOptions), options.requestOptions), { url: endpoint.toString(), abortSignal: options.abortSignal, method,
|
|
425
|
+
headers }));
|
|
433
426
|
}
|
|
434
427
|
/**
|
|
435
428
|
* Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.
|
|
@@ -465,25 +458,14 @@ async function parseNotificationSendResponse(response) {
|
|
|
465
458
|
const responseBody = response.bodyAsText;
|
|
466
459
|
if (isTestSend && !isDirectSend && isDefined(responseBody)) {
|
|
467
460
|
const outcome = await parseNotificationOutcome(responseBody);
|
|
468
|
-
return {
|
|
469
|
-
...result,
|
|
470
|
-
...outcome,
|
|
471
|
-
notificationId,
|
|
472
|
-
};
|
|
461
|
+
return Object.assign(Object.assign(Object.assign({}, result), outcome), { notificationId });
|
|
473
462
|
}
|
|
474
463
|
else {
|
|
475
464
|
return createDefaultResponse(result, notificationId);
|
|
476
465
|
}
|
|
477
466
|
}
|
|
478
467
|
function createDefaultResponse(response, notificationId) {
|
|
479
|
-
return {
|
|
480
|
-
...response,
|
|
481
|
-
notificationId,
|
|
482
|
-
successCount: 0,
|
|
483
|
-
failureCount: 0,
|
|
484
|
-
results: [],
|
|
485
|
-
state: "Enqueued",
|
|
486
|
-
};
|
|
468
|
+
return Object.assign(Object.assign({}, response), { notificationId, successCount: 0, failureCount: 0, results: [], state: "Enqueued" });
|
|
487
469
|
}
|
|
488
470
|
/**
|
|
489
471
|
* Sends a request through the client context.
|
|
@@ -668,6 +650,7 @@ function submitNotificationHubJob(context, job, options = {}) {
|
|
|
668
650
|
* @returns A poller which can be called to poll until completion of the job.
|
|
669
651
|
*/
|
|
670
652
|
async function beginSubmitNotificationHubJob(context, notificationHubJob, polledOperationOptions = {}) {
|
|
653
|
+
var _a;
|
|
671
654
|
let submittedJob = await submitNotificationHubJob(context, notificationHubJob, polledOperationOptions);
|
|
672
655
|
const state = {
|
|
673
656
|
status: "notStarted",
|
|
@@ -677,7 +660,7 @@ async function beginSubmitNotificationHubJob(context, notificationHubJob, polled
|
|
|
677
660
|
let resultPromise;
|
|
678
661
|
let cancelJob;
|
|
679
662
|
const abortController$1 = new abortController.AbortController();
|
|
680
|
-
const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs
|
|
663
|
+
const currentPollIntervalInMs = (_a = polledOperationOptions.updateIntervalInMs) !== null && _a !== void 0 ? _a : 2000;
|
|
681
664
|
const poller = {
|
|
682
665
|
async poll(options) {
|
|
683
666
|
submittedJob = await getNotificationHubJob(context, submittedJob.jobId, options);
|
|
@@ -701,7 +684,7 @@ async function beginSubmitNotificationHubJob(context, notificationHubJob, polled
|
|
|
701
684
|
}
|
|
702
685
|
},
|
|
703
686
|
pollUntilDone(pollOptions) {
|
|
704
|
-
return (resultPromise
|
|
687
|
+
return (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => {
|
|
705
688
|
const { abortSignal: inputAbortSignal } = pollOptions || {};
|
|
706
689
|
const { signal: abortSignal } = inputAbortSignal
|
|
707
690
|
? new abortController.AbortController([inputAbortSignal, abortController$1.signal])
|
|
@@ -745,7 +728,7 @@ async function beginSubmitNotificationHubJob(context, notificationHubJob, polled
|
|
|
745
728
|
},
|
|
746
729
|
stopPolling() {
|
|
747
730
|
abortController$1.abort();
|
|
748
|
-
cancelJob
|
|
731
|
+
cancelJob === null || cancelJob === void 0 ? void 0 : cancelJob();
|
|
749
732
|
},
|
|
750
733
|
isStopped() {
|
|
751
734
|
return resultPromise === undefined;
|
|
@@ -878,183 +861,115 @@ const registrationDescriptionParser = {
|
|
|
878
861
|
* Creates an ADM registration description from incoming XML property bag.
|
|
879
862
|
*/
|
|
880
863
|
createAdmRegistrationDescription(rawRegistrationDescription) {
|
|
881
|
-
return {
|
|
882
|
-
admRegistrationId: getString(rawRegistrationDescription["AdmRegistrationId"], "admRegistrationId"),
|
|
883
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
884
|
-
kind: "Adm",
|
|
885
|
-
};
|
|
864
|
+
return Object.assign(Object.assign({ admRegistrationId: getString(rawRegistrationDescription["AdmRegistrationId"], "admRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Adm" });
|
|
886
865
|
},
|
|
887
866
|
/**
|
|
888
867
|
* @internal
|
|
889
868
|
* Creates an ADM template registration description from incoming XML property bag.
|
|
890
869
|
*/
|
|
891
870
|
createAdmTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
892
|
-
return {
|
|
893
|
-
...this.createAdmRegistrationDescription(rawRegistrationDescription),
|
|
894
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
895
|
-
kind: "AdmTemplate",
|
|
896
|
-
};
|
|
871
|
+
return Object.assign(Object.assign(Object.assign({}, this.createAdmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "AdmTemplate" });
|
|
897
872
|
},
|
|
898
873
|
/**
|
|
899
874
|
* @internal
|
|
900
875
|
* Creates an Apple registration description from incoming XML property bag.
|
|
901
876
|
*/
|
|
902
877
|
createAppleRegistrationDescription(rawRegistrationDescription) {
|
|
903
|
-
return {
|
|
904
|
-
deviceToken: getString(rawRegistrationDescription["DeviceToken"], "deviceToken"),
|
|
905
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
906
|
-
kind: "Apple",
|
|
907
|
-
};
|
|
878
|
+
return Object.assign(Object.assign({ deviceToken: getString(rawRegistrationDescription["DeviceToken"], "deviceToken") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Apple" });
|
|
908
879
|
},
|
|
909
880
|
/**
|
|
910
881
|
* @internal
|
|
911
882
|
* Creates an Apple template registration description from incoming XML property bag.
|
|
912
883
|
*/
|
|
913
884
|
createAppleTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
apnsHeaders: getHeadersOrUndefined(rawRegistrationDescription["ApnsHeaders"]?.["ApnsHeader"]),
|
|
917
|
-
...this.createAppleRegistrationDescription(rawRegistrationDescription),
|
|
918
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
919
|
-
kind: "AppleTemplate",
|
|
920
|
-
};
|
|
885
|
+
var _a;
|
|
886
|
+
return Object.assign(Object.assign(Object.assign({ priority: getStringOrUndefined(rawRegistrationDescription["Priority"]), apnsHeaders: getHeadersOrUndefined((_a = rawRegistrationDescription["ApnsHeaders"]) === null || _a === void 0 ? void 0 : _a["ApnsHeader"]) }, this.createAppleRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "AppleTemplate" });
|
|
921
887
|
},
|
|
922
888
|
/**
|
|
923
889
|
* @internal
|
|
924
890
|
* Creates a Baidu registration description from incoming XML property bag.
|
|
925
891
|
*/
|
|
926
892
|
createBaiduRegistrationDescription(rawRegistrationDescription) {
|
|
927
|
-
return {
|
|
928
|
-
baiduChannelId: getString(rawRegistrationDescription["BaiduChannelId"], "baiduChannelId"),
|
|
929
|
-
baiduUserId: getString(rawRegistrationDescription["BaiduUserId"], "baiduUserId"),
|
|
930
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
931
|
-
kind: "Baidu",
|
|
932
|
-
};
|
|
893
|
+
return Object.assign(Object.assign({ baiduChannelId: getString(rawRegistrationDescription["BaiduChannelId"], "baiduChannelId"), baiduUserId: getString(rawRegistrationDescription["BaiduUserId"], "baiduUserId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Baidu" });
|
|
933
894
|
},
|
|
934
895
|
/**
|
|
935
896
|
* @internal
|
|
936
897
|
* Creates a Baidu template registration description from incoming XML property bag.
|
|
937
898
|
*/
|
|
938
899
|
createBaiduTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
939
|
-
return {
|
|
940
|
-
...this.createBaiduRegistrationDescription(rawRegistrationDescription),
|
|
941
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
942
|
-
kind: "BaiduTemplate",
|
|
943
|
-
};
|
|
900
|
+
return Object.assign(Object.assign(Object.assign({}, this.createBaiduRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BaiduTemplate" });
|
|
944
901
|
},
|
|
945
902
|
/**
|
|
946
903
|
* @internal
|
|
947
904
|
* Creates a Browser registration description from incoming XML property bag.
|
|
948
905
|
*/
|
|
949
906
|
createBrowserRegistrationDescription(rawRegistrationDescription) {
|
|
950
|
-
return {
|
|
951
|
-
endpoint: getString(rawRegistrationDescription["Endpoint"], "endpoint"),
|
|
952
|
-
p256dh: getString(rawRegistrationDescription["P256DH"], "p256dh"),
|
|
953
|
-
auth: getString(rawRegistrationDescription["Auth"], "auth"),
|
|
954
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
955
|
-
kind: "Browser",
|
|
956
|
-
};
|
|
907
|
+
return Object.assign(Object.assign({ endpoint: getString(rawRegistrationDescription["Endpoint"], "endpoint"), p256dh: getString(rawRegistrationDescription["P256DH"], "p256dh"), auth: getString(rawRegistrationDescription["Auth"], "auth") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Browser" });
|
|
957
908
|
},
|
|
958
909
|
/**
|
|
959
910
|
* @internal
|
|
960
911
|
* Creates a Browser template registration description from incoming XML property bag.
|
|
961
912
|
*/
|
|
962
913
|
createBrowserTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
963
|
-
return {
|
|
964
|
-
...this.createBrowserRegistrationDescription(rawRegistrationDescription),
|
|
965
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
966
|
-
kind: "BrowserTemplate",
|
|
967
|
-
};
|
|
914
|
+
return Object.assign(Object.assign(Object.assign({}, this.createBrowserRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BrowserTemplate" });
|
|
968
915
|
},
|
|
969
916
|
/**
|
|
970
917
|
* @internal
|
|
971
918
|
* Creates an GCM registration description from incoming XML property bag.
|
|
972
919
|
*/
|
|
973
920
|
createGcmRegistrationDescription(rawRegistrationDescription) {
|
|
974
|
-
return {
|
|
975
|
-
gcmRegistrationId: getString(rawRegistrationDescription["GcmRegistrationId"], "gcmRegistrationId"),
|
|
976
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
977
|
-
kind: "Gcm",
|
|
978
|
-
};
|
|
921
|
+
return Object.assign(Object.assign({ gcmRegistrationId: getString(rawRegistrationDescription["GcmRegistrationId"], "gcmRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Gcm" });
|
|
979
922
|
},
|
|
980
923
|
/**
|
|
981
924
|
* @internal
|
|
982
925
|
* Creates an FCM template registration description from incoming XML property bag.
|
|
983
926
|
*/
|
|
984
927
|
createGcmTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
985
|
-
return {
|
|
986
|
-
...this.createGcmRegistrationDescription(rawRegistrationDescription),
|
|
987
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
988
|
-
kind: "GcmTemplate",
|
|
989
|
-
};
|
|
928
|
+
return Object.assign(Object.assign(Object.assign({}, this.createGcmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "GcmTemplate" });
|
|
990
929
|
},
|
|
991
930
|
/**
|
|
992
931
|
* @internal
|
|
993
932
|
* Creates a Windows Phone registration description from incoming XML property bag.
|
|
994
933
|
*/
|
|
995
934
|
createMpnsRegistrationDescription(rawRegistrationDescription) {
|
|
996
|
-
return {
|
|
997
|
-
channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri"),
|
|
998
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
999
|
-
kind: "Mpns",
|
|
1000
|
-
};
|
|
935
|
+
return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Mpns" });
|
|
1001
936
|
},
|
|
1002
937
|
/**
|
|
1003
938
|
* @internal
|
|
1004
939
|
* Creates a Windows Phone template registration description from incoming XML property bag.
|
|
1005
940
|
*/
|
|
1006
941
|
createMpnsTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
...this.createWindowsRegistrationDescription(rawRegistrationDescription),
|
|
1010
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
1011
|
-
kind: "MpnsTemplate",
|
|
1012
|
-
};
|
|
942
|
+
var _a;
|
|
943
|
+
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" });
|
|
1013
944
|
},
|
|
1014
945
|
/**
|
|
1015
946
|
* @internal
|
|
1016
947
|
* Creates a Xiaomi registration description from incoming XML property bag.
|
|
1017
948
|
*/
|
|
1018
949
|
createXiaomiRegistrationDescription(rawRegistrationDescription) {
|
|
1019
|
-
return {
|
|
1020
|
-
xiaomiRegistrationId: getString(rawRegistrationDescription["XiaomiRegistrationId"], "xiaomiRegistrationId"),
|
|
1021
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
1022
|
-
kind: "Xiaomi",
|
|
1023
|
-
};
|
|
950
|
+
return Object.assign(Object.assign({ xiaomiRegistrationId: getString(rawRegistrationDescription["XiaomiRegistrationId"], "xiaomiRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Xiaomi" });
|
|
1024
951
|
},
|
|
1025
952
|
/**
|
|
1026
953
|
* @internal
|
|
1027
954
|
* Creates a Xiaomi template registration description from incoming XML property bag.
|
|
1028
955
|
*/
|
|
1029
956
|
createXiaomiTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
1030
|
-
return {
|
|
1031
|
-
...this.createXiaomiRegistrationDescription(rawRegistrationDescription),
|
|
1032
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
1033
|
-
kind: "XiaomiTemplate",
|
|
1034
|
-
};
|
|
957
|
+
return Object.assign(Object.assign(Object.assign({}, this.createXiaomiRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "XiaomiTemplate" });
|
|
1035
958
|
},
|
|
1036
959
|
/**
|
|
1037
960
|
* @internal
|
|
1038
961
|
* Creates a Windows registration description from incoming XML property bag.
|
|
1039
962
|
*/
|
|
1040
963
|
createWindowsRegistrationDescription(rawRegistrationDescription) {
|
|
1041
|
-
return {
|
|
1042
|
-
channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri"),
|
|
1043
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
1044
|
-
kind: "Windows",
|
|
1045
|
-
};
|
|
964
|
+
return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Windows" });
|
|
1046
965
|
},
|
|
1047
966
|
/**
|
|
1048
967
|
* @internal
|
|
1049
968
|
* Creates a Windows template registration description from incoming XML property bag.
|
|
1050
969
|
*/
|
|
1051
970
|
createWindowsTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
...this.createWindowsRegistrationDescription(rawRegistrationDescription),
|
|
1055
|
-
...createTemplateRegistrationDescription(rawRegistrationDescription),
|
|
1056
|
-
kind: "WindowsTemplate",
|
|
1057
|
-
};
|
|
971
|
+
var _a;
|
|
972
|
+
return Object.assign(Object.assign(Object.assign({ wnsHeaders: getHeadersOrUndefined((_a = rawRegistrationDescription["WnsHeaders"]) === null || _a === void 0 ? void 0 : _a["WnsHeader"]) }, this.createWindowsRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "WindowsTemplate" });
|
|
1058
973
|
},
|
|
1059
974
|
};
|
|
1060
975
|
function getHeadersOrUndefined(value) {
|
|
@@ -1082,11 +997,7 @@ function createRegistrationDescription(rawRegistrationDescription) {
|
|
|
1082
997
|
};
|
|
1083
998
|
}
|
|
1084
999
|
function createTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
1085
|
-
return {
|
|
1086
|
-
bodyTemplate: getString(rawRegistrationDescription["BodyTemplate"], "bodyTemplate"),
|
|
1087
|
-
templateName: getStringOrUndefined(rawRegistrationDescription["TemplateName"]),
|
|
1088
|
-
...createRegistrationDescription(rawRegistrationDescription),
|
|
1089
|
-
};
|
|
1000
|
+
return Object.assign({ bodyTemplate: getString(rawRegistrationDescription["BodyTemplate"], "bodyTemplate"), templateName: getStringOrUndefined(rawRegistrationDescription["TemplateName"]) }, createRegistrationDescription(rawRegistrationDescription));
|
|
1090
1001
|
}
|
|
1091
1002
|
/**
|
|
1092
1003
|
* Represents a RegistrationDescription serializer.
|
|
@@ -1108,30 +1019,21 @@ const registrationDescriptionSerializer = {
|
|
|
1108
1019
|
* Serializes an existing ADM registration description to an object for serialization.
|
|
1109
1020
|
*/
|
|
1110
1021
|
serializeAdmRegistrationDescription(description) {
|
|
1111
|
-
return {
|
|
1112
|
-
...serializeRegistrationDescription(description),
|
|
1113
|
-
AdmRegistrationId: getString(description.admRegistrationId, "admRegistrationId"),
|
|
1114
|
-
};
|
|
1022
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { AdmRegistrationId: getString(description.admRegistrationId, "admRegistrationId") });
|
|
1115
1023
|
},
|
|
1116
1024
|
/**
|
|
1117
1025
|
* @internal
|
|
1118
1026
|
* Serializes an existing ADM template registration description to an object for serialization.
|
|
1119
1027
|
*/
|
|
1120
1028
|
serializeAdmTemplateRegistrationDescription(description) {
|
|
1121
|
-
return {
|
|
1122
|
-
...this.serializeAdmRegistrationDescription(description),
|
|
1123
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1124
|
-
};
|
|
1029
|
+
return Object.assign(Object.assign({}, this.serializeAdmRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1125
1030
|
},
|
|
1126
1031
|
/**
|
|
1127
1032
|
* @internal
|
|
1128
1033
|
* Serializes an existing Apple registration description to an object for serialization.
|
|
1129
1034
|
*/
|
|
1130
1035
|
serializeAppleRegistrationDescription(description) {
|
|
1131
|
-
return {
|
|
1132
|
-
...serializeRegistrationDescription(description),
|
|
1133
|
-
DeviceToken: getString(description.deviceToken, "deviceToken"),
|
|
1134
|
-
};
|
|
1036
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { DeviceToken: getString(description.deviceToken, "deviceToken") });
|
|
1135
1037
|
},
|
|
1136
1038
|
/**
|
|
1137
1039
|
* @internal
|
|
@@ -1150,55 +1052,35 @@ const registrationDescriptionSerializer = {
|
|
|
1150
1052
|
});
|
|
1151
1053
|
}
|
|
1152
1054
|
}
|
|
1153
|
-
return {
|
|
1154
|
-
...this.serializeAppleRegistrationDescription(description),
|
|
1155
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1156
|
-
Expiry: getStringOrUndefined(description.expiry),
|
|
1157
|
-
ApnsHeaders: apnsHeaders,
|
|
1158
|
-
};
|
|
1055
|
+
return Object.assign(Object.assign(Object.assign({}, this.serializeAppleRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { Expiry: getStringOrUndefined(description.expiry), ApnsHeaders: apnsHeaders });
|
|
1159
1056
|
},
|
|
1160
1057
|
/**
|
|
1161
1058
|
* @internal
|
|
1162
1059
|
* Serializes an existing Baidu registration description to an object for serialization.
|
|
1163
1060
|
*/
|
|
1164
1061
|
serializeBaiduRegistrationDescription(description) {
|
|
1165
|
-
return {
|
|
1166
|
-
...serializeRegistrationDescription(description),
|
|
1167
|
-
BaiduChannelId: getString(description.baiduChannelId, "baiduChannelId"),
|
|
1168
|
-
BaiduUserId: getString(description.baiduUserId, "baiduUserId"),
|
|
1169
|
-
};
|
|
1062
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { BaiduChannelId: getString(description.baiduChannelId, "baiduChannelId"), BaiduUserId: getString(description.baiduUserId, "baiduUserId") });
|
|
1170
1063
|
},
|
|
1171
1064
|
/**
|
|
1172
1065
|
* @internal
|
|
1173
1066
|
* Serializes an existing Baidu template registration description to an object for serialization.
|
|
1174
1067
|
*/
|
|
1175
1068
|
serializeBaiduTemplateRegistrationDescription(description) {
|
|
1176
|
-
return {
|
|
1177
|
-
...this.serializeBaiduRegistrationDescription(description),
|
|
1178
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1179
|
-
};
|
|
1069
|
+
return Object.assign(Object.assign({}, this.serializeBaiduRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1180
1070
|
},
|
|
1181
1071
|
/**
|
|
1182
1072
|
* @internal
|
|
1183
1073
|
* Serializes an existing Browser registration description to an object for serialization.
|
|
1184
1074
|
*/
|
|
1185
1075
|
serializeBrowserRegistrationDescription(description) {
|
|
1186
|
-
return {
|
|
1187
|
-
...serializeRegistrationDescription(description),
|
|
1188
|
-
Endpoint: description.endpoint,
|
|
1189
|
-
Auth: description.auth,
|
|
1190
|
-
P256DH: description.p256dh,
|
|
1191
|
-
};
|
|
1076
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { Endpoint: description.endpoint, Auth: description.auth, P256DH: description.p256dh });
|
|
1192
1077
|
},
|
|
1193
1078
|
/**
|
|
1194
1079
|
* @internal
|
|
1195
1080
|
* Serializes an existing Browser template registration description to an object for serialization.
|
|
1196
1081
|
*/
|
|
1197
1082
|
serializeBrowserTemplateRegistrationDescription(description) {
|
|
1198
|
-
return {
|
|
1199
|
-
...this.serializeBrowserRegistrationDescription(description),
|
|
1200
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1201
|
-
};
|
|
1083
|
+
return Object.assign(Object.assign({}, this.serializeBrowserRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1202
1084
|
},
|
|
1203
1085
|
/**
|
|
1204
1086
|
* @internal
|
|
@@ -1206,10 +1088,7 @@ const registrationDescriptionSerializer = {
|
|
|
1206
1088
|
* Serializes an existing GCM registration description to an object for serialization.
|
|
1207
1089
|
*/
|
|
1208
1090
|
serializeGcmRegistrationDescription(description) {
|
|
1209
|
-
return {
|
|
1210
|
-
...serializeRegistrationDescription(description),
|
|
1211
|
-
GcmRegistrationId: getString(description.gcmRegistrationId, "gcmRegistrationId"),
|
|
1212
|
-
};
|
|
1091
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { GcmRegistrationId: getString(description.gcmRegistrationId, "gcmRegistrationId") });
|
|
1213
1092
|
},
|
|
1214
1093
|
/**
|
|
1215
1094
|
* @internal
|
|
@@ -1217,10 +1096,7 @@ const registrationDescriptionSerializer = {
|
|
|
1217
1096
|
* Serializes an existing GCM template registration description to an object for serialization.
|
|
1218
1097
|
*/
|
|
1219
1098
|
serializeGcmTemplateRegistrationDescription(description) {
|
|
1220
|
-
return {
|
|
1221
|
-
...this.serializeGcmRegistrationDescription(description),
|
|
1222
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1223
|
-
};
|
|
1099
|
+
return Object.assign(Object.assign({}, this.serializeGcmRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1224
1100
|
},
|
|
1225
1101
|
/**
|
|
1226
1102
|
* @internal
|
|
@@ -1228,10 +1104,7 @@ const registrationDescriptionSerializer = {
|
|
|
1228
1104
|
* Serializes an existing MPNS registration description to an object for serialization.
|
|
1229
1105
|
*/
|
|
1230
1106
|
serializeMpnsRegistrationDescription(description) {
|
|
1231
|
-
return {
|
|
1232
|
-
...serializeRegistrationDescription(description),
|
|
1233
|
-
ChannelUri: description.channelUri,
|
|
1234
|
-
};
|
|
1107
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { ChannelUri: description.channelUri });
|
|
1235
1108
|
},
|
|
1236
1109
|
/**
|
|
1237
1110
|
* @internal
|
|
@@ -1251,41 +1124,28 @@ const registrationDescriptionSerializer = {
|
|
|
1251
1124
|
});
|
|
1252
1125
|
}
|
|
1253
1126
|
}
|
|
1254
|
-
return {
|
|
1255
|
-
...this.serializeMpnsRegistrationDescription(description),
|
|
1256
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1257
|
-
MpnsHeaders: mpnsHeaders,
|
|
1258
|
-
};
|
|
1127
|
+
return Object.assign(Object.assign(Object.assign({}, this.serializeMpnsRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { MpnsHeaders: mpnsHeaders });
|
|
1259
1128
|
},
|
|
1260
1129
|
/**
|
|
1261
1130
|
* @internal
|
|
1262
1131
|
* Serializes an existing Xiaomi registration description to an object for serialization.
|
|
1263
1132
|
*/
|
|
1264
1133
|
serializeXiaomiRegistrationDescription(description) {
|
|
1265
|
-
return {
|
|
1266
|
-
...serializeRegistrationDescription(description),
|
|
1267
|
-
XiaomiRegistrationId: getString(description.xiaomiRegistrationId, "xiaomiRegistrationId"),
|
|
1268
|
-
};
|
|
1134
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { XiaomiRegistrationId: getString(description.xiaomiRegistrationId, "xiaomiRegistrationId") });
|
|
1269
1135
|
},
|
|
1270
1136
|
/**
|
|
1271
1137
|
* @internal
|
|
1272
1138
|
* Serializes an existing Xiaomi template registration description to an object for serialization.
|
|
1273
1139
|
*/
|
|
1274
1140
|
serializeXiaomiTemplateRegistrationDescription(description) {
|
|
1275
|
-
return {
|
|
1276
|
-
...this.serializeXiaomiRegistrationDescription(description),
|
|
1277
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1278
|
-
};
|
|
1141
|
+
return Object.assign(Object.assign({}, this.serializeXiaomiRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1279
1142
|
},
|
|
1280
1143
|
/**
|
|
1281
1144
|
* @internal
|
|
1282
1145
|
* Serializes an existing Windows registration description to an object for serialization.
|
|
1283
1146
|
*/
|
|
1284
1147
|
serializeWindowsRegistrationDescription(description) {
|
|
1285
|
-
return {
|
|
1286
|
-
...serializeRegistrationDescription(description),
|
|
1287
|
-
ChannelUri: description.channelUri,
|
|
1288
|
-
};
|
|
1148
|
+
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { ChannelUri: description.channelUri });
|
|
1289
1149
|
},
|
|
1290
1150
|
/**
|
|
1291
1151
|
* @internal
|
|
@@ -1304,11 +1164,7 @@ const registrationDescriptionSerializer = {
|
|
|
1304
1164
|
});
|
|
1305
1165
|
}
|
|
1306
1166
|
}
|
|
1307
|
-
return {
|
|
1308
|
-
...this.serializeWindowsRegistrationDescription(description),
|
|
1309
|
-
...serializeTemplateRegistrationDescription(description),
|
|
1310
|
-
WnsHeaders: wnsHeaders,
|
|
1311
|
-
};
|
|
1167
|
+
return Object.assign(Object.assign(Object.assign({}, this.serializeWindowsRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { WnsHeaders: wnsHeaders });
|
|
1312
1168
|
},
|
|
1313
1169
|
};
|
|
1314
1170
|
function serializeRegistrationDescription(description) {
|
|
@@ -1648,20 +1504,37 @@ function listNotificationHubJobs(context, options = {}) {
|
|
|
1648
1504
|
|
|
1649
1505
|
// Copyright (c) Microsoft Corporation.
|
|
1650
1506
|
// Licensed under the MIT license.
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1507
|
+
function listRegistrationsAll(context, options) {
|
|
1508
|
+
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsAll_1() {
|
|
1509
|
+
var _a, e_1, _b, _c;
|
|
1510
|
+
try {
|
|
1511
|
+
for (var _d = true, _e = tslib.__asyncValues(listRegistrationPagingPage(context, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1512
|
+
_c = _f.value;
|
|
1513
|
+
_d = false;
|
|
1514
|
+
const page = _c;
|
|
1515
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1519
|
+
finally {
|
|
1520
|
+
try {
|
|
1521
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1522
|
+
}
|
|
1523
|
+
finally { if (e_1) throw e_1.error; }
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1655
1526
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1527
|
+
function listRegistrationPagingPage(context, options) {
|
|
1528
|
+
return tslib.__asyncGenerator(this, arguments, function* listRegistrationPagingPage_1() {
|
|
1529
|
+
let result = yield tslib.__await(_listRegistrations(context, options));
|
|
1530
|
+
yield yield tslib.__await(result.registrations || []);
|
|
1531
|
+
let continuationToken = result.continuationToken;
|
|
1532
|
+
while (continuationToken) {
|
|
1533
|
+
result = yield tslib.__await(_listRegistrations(context, options, continuationToken));
|
|
1534
|
+
continuationToken = result.continuationToken;
|
|
1535
|
+
yield yield tslib.__await(result.registrations || []);
|
|
1536
|
+
}
|
|
1537
|
+
});
|
|
1665
1538
|
}
|
|
1666
1539
|
async function _listRegistrations(context, options, continuationToken) {
|
|
1667
1540
|
const endpoint = context.requestUrl();
|
|
@@ -1696,10 +1569,7 @@ async function _listRegistrations(context, options, continuationToken) {
|
|
|
1696
1569
|
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
1697
1570
|
*/
|
|
1698
1571
|
function listRegistrationsByChannel(context, channel, options = {}) {
|
|
1699
|
-
const newOptions = {
|
|
1700
|
-
...options,
|
|
1701
|
-
filter: getFilterByChannel(channel),
|
|
1702
|
-
};
|
|
1572
|
+
const newOptions = Object.assign(Object.assign({}, options), { filter: getFilterByChannel(channel) });
|
|
1703
1573
|
const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext.listRegistrationsByDevice", newOptions);
|
|
1704
1574
|
try {
|
|
1705
1575
|
const iter = listRegistrationsAll(context, updatedOptions);
|
|
@@ -1778,20 +1648,37 @@ function listRegistrationsByTag(context, tag, options = {}) {
|
|
|
1778
1648
|
span.end();
|
|
1779
1649
|
}
|
|
1780
1650
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1651
|
+
function listRegistrationsByTagAll(context, tag, options) {
|
|
1652
|
+
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsByTagAll_1() {
|
|
1653
|
+
var _a, e_1, _b, _c;
|
|
1654
|
+
try {
|
|
1655
|
+
for (var _d = true, _e = tslib.__asyncValues(listRegistrationsByTagPagingPage(context, tag, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1656
|
+
_c = _f.value;
|
|
1657
|
+
_d = false;
|
|
1658
|
+
const page = _c;
|
|
1659
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1663
|
+
finally {
|
|
1664
|
+
try {
|
|
1665
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1666
|
+
}
|
|
1667
|
+
finally { if (e_1) throw e_1.error; }
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1785
1670
|
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1671
|
+
function listRegistrationsByTagPagingPage(context, tag, options) {
|
|
1672
|
+
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsByTagPagingPage_1() {
|
|
1673
|
+
let result = yield tslib.__await(_listRegistrationsByTag(context, tag, options));
|
|
1674
|
+
yield yield tslib.__await(result.registrations || []);
|
|
1675
|
+
let continuationToken = result.continuationToken;
|
|
1676
|
+
while (continuationToken) {
|
|
1677
|
+
result = yield tslib.__await(_listRegistrationsByTag(context, tag, options, continuationToken));
|
|
1678
|
+
continuationToken = result.continuationToken;
|
|
1679
|
+
yield yield tslib.__await(result.registrations || []);
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1795
1682
|
}
|
|
1796
1683
|
async function _listRegistrationsByTag(context, tag, options, continuationToken) {
|
|
1797
1684
|
const endpoint = context.requestUrl();
|
|
@@ -2241,10 +2128,7 @@ class NotificationHubsClient {
|
|
|
2241
2128
|
* @returns The newly created Apple installation.
|
|
2242
2129
|
*/
|
|
2243
2130
|
function createAppleInstallation(installation) {
|
|
2244
|
-
return {
|
|
2245
|
-
...installation,
|
|
2246
|
-
platform: "apns",
|
|
2247
|
-
};
|
|
2131
|
+
return Object.assign(Object.assign({}, installation), { platform: "apns" });
|
|
2248
2132
|
}
|
|
2249
2133
|
/**
|
|
2250
2134
|
* Creates an Amazon Device Messaging (ADM) based installation.
|
|
@@ -2252,10 +2136,7 @@ function createAppleInstallation(installation) {
|
|
|
2252
2136
|
* @returns The newly created ADM installation.
|
|
2253
2137
|
*/
|
|
2254
2138
|
function createAdmInstallation(installation) {
|
|
2255
|
-
return {
|
|
2256
|
-
...installation,
|
|
2257
|
-
platform: "adm",
|
|
2258
|
-
};
|
|
2139
|
+
return Object.assign(Object.assign({}, installation), { platform: "adm" });
|
|
2259
2140
|
}
|
|
2260
2141
|
/**
|
|
2261
2142
|
* Creates a Baidu based installation.
|
|
@@ -2263,10 +2144,7 @@ function createAdmInstallation(installation) {
|
|
|
2263
2144
|
* @returns The newly created Baidu installation.
|
|
2264
2145
|
*/
|
|
2265
2146
|
function createBaiduInstallation(installation) {
|
|
2266
|
-
return {
|
|
2267
|
-
...installation,
|
|
2268
|
-
platform: "baidu",
|
|
2269
|
-
};
|
|
2147
|
+
return Object.assign(Object.assign({}, installation), { platform: "baidu" });
|
|
2270
2148
|
}
|
|
2271
2149
|
/**
|
|
2272
2150
|
* Creates a Firebase legacy HTTP based installation.
|
|
@@ -2274,10 +2152,7 @@ function createBaiduInstallation(installation) {
|
|
|
2274
2152
|
* @returns The newly created Baidu installation.
|
|
2275
2153
|
*/
|
|
2276
2154
|
function createFcmLegacyInstallation(installation) {
|
|
2277
|
-
return {
|
|
2278
|
-
...installation,
|
|
2279
|
-
platform: "gcm",
|
|
2280
|
-
};
|
|
2155
|
+
return Object.assign(Object.assign({}, installation), { platform: "gcm" });
|
|
2281
2156
|
}
|
|
2282
2157
|
/**
|
|
2283
2158
|
* Creates a Xiaomi based installation.
|
|
@@ -2285,10 +2160,7 @@ function createFcmLegacyInstallation(installation) {
|
|
|
2285
2160
|
* @returns The newly created Xiaomi installation.
|
|
2286
2161
|
*/
|
|
2287
2162
|
function createXiaomiInstallation(installation) {
|
|
2288
|
-
return {
|
|
2289
|
-
...installation,
|
|
2290
|
-
platform: "xiaomi",
|
|
2291
|
-
};
|
|
2163
|
+
return Object.assign(Object.assign({}, installation), { platform: "xiaomi" });
|
|
2292
2164
|
}
|
|
2293
2165
|
/**
|
|
2294
2166
|
* Creates a Windows Notification Services (WNS) based installation.
|
|
@@ -2296,10 +2168,7 @@ function createXiaomiInstallation(installation) {
|
|
|
2296
2168
|
* @returns The newly created WNS installation.
|
|
2297
2169
|
*/
|
|
2298
2170
|
function createWindowsInstallation(installation) {
|
|
2299
|
-
return {
|
|
2300
|
-
...installation,
|
|
2301
|
-
platform: "wns",
|
|
2302
|
-
};
|
|
2171
|
+
return Object.assign(Object.assign({}, installation), { platform: "wns" });
|
|
2303
2172
|
}
|
|
2304
2173
|
/**
|
|
2305
2174
|
* Creates a Web Push based installation.
|
|
@@ -2307,10 +2176,7 @@ function createWindowsInstallation(installation) {
|
|
|
2307
2176
|
* @returns The newly created Web Push installation.
|
|
2308
2177
|
*/
|
|
2309
2178
|
function createBrowserInstallation(installation) {
|
|
2310
|
-
return {
|
|
2311
|
-
...installation,
|
|
2312
|
-
platform: "browser",
|
|
2313
|
-
};
|
|
2179
|
+
return Object.assign(Object.assign({}, installation), { platform: "browser" });
|
|
2314
2180
|
}
|
|
2315
2181
|
|
|
2316
2182
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -2325,12 +2191,7 @@ function isString(value) {
|
|
|
2325
2191
|
*/
|
|
2326
2192
|
function createAppleNotification(notification) {
|
|
2327
2193
|
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2328
|
-
return {
|
|
2329
|
-
...notification,
|
|
2330
|
-
body,
|
|
2331
|
-
platform: "apple",
|
|
2332
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2333
|
-
};
|
|
2194
|
+
return Object.assign(Object.assign({}, notification), { body, platform: "apple", contentType: JSON_CONTENT_TYPE });
|
|
2334
2195
|
}
|
|
2335
2196
|
/**
|
|
2336
2197
|
* Creates a notification to send to an Amazon Device Messaging device.
|
|
@@ -2339,12 +2200,7 @@ function createAppleNotification(notification) {
|
|
|
2339
2200
|
*/
|
|
2340
2201
|
function createAdmNotification(notification) {
|
|
2341
2202
|
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2342
|
-
return {
|
|
2343
|
-
...notification,
|
|
2344
|
-
body,
|
|
2345
|
-
platform: "adm",
|
|
2346
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2347
|
-
};
|
|
2203
|
+
return Object.assign(Object.assign({}, notification), { body, platform: "adm", contentType: JSON_CONTENT_TYPE });
|
|
2348
2204
|
}
|
|
2349
2205
|
/**
|
|
2350
2206
|
* Creates a notification to send to a Baidu registered device.
|
|
@@ -2352,11 +2208,7 @@ function createAdmNotification(notification) {
|
|
|
2352
2208
|
* @returns A newly created Baidu.
|
|
2353
2209
|
*/
|
|
2354
2210
|
function createBaiduNotification(notification) {
|
|
2355
|
-
return {
|
|
2356
|
-
...notification,
|
|
2357
|
-
platform: "baidu",
|
|
2358
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2359
|
-
};
|
|
2211
|
+
return Object.assign(Object.assign({}, notification), { platform: "baidu", contentType: JSON_CONTENT_TYPE });
|
|
2360
2212
|
}
|
|
2361
2213
|
/**
|
|
2362
2214
|
* Creates a notification to send to a browser.
|
|
@@ -2364,11 +2216,7 @@ function createBaiduNotification(notification) {
|
|
|
2364
2216
|
* @returns A newly created Web Push browser.
|
|
2365
2217
|
*/
|
|
2366
2218
|
function createBrowserNotification(notification) {
|
|
2367
|
-
return {
|
|
2368
|
-
...notification,
|
|
2369
|
-
platform: "browser",
|
|
2370
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2371
|
-
};
|
|
2219
|
+
return Object.assign(Object.assign({}, notification), { platform: "browser", contentType: JSON_CONTENT_TYPE });
|
|
2372
2220
|
}
|
|
2373
2221
|
/**
|
|
2374
2222
|
* Creates a notification to send to Firebase.
|
|
@@ -2377,12 +2225,7 @@ function createBrowserNotification(notification) {
|
|
|
2377
2225
|
*/
|
|
2378
2226
|
function createFcmLegacyNotification(notification) {
|
|
2379
2227
|
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2380
|
-
return {
|
|
2381
|
-
...notification,
|
|
2382
|
-
body,
|
|
2383
|
-
platform: "gcm",
|
|
2384
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2385
|
-
};
|
|
2228
|
+
return Object.assign(Object.assign({}, notification), { body, platform: "gcm", contentType: JSON_CONTENT_TYPE });
|
|
2386
2229
|
}
|
|
2387
2230
|
/**
|
|
2388
2231
|
* Creates a notification to send to Xiaomi.
|
|
@@ -2390,11 +2233,7 @@ function createFcmLegacyNotification(notification) {
|
|
|
2390
2233
|
* @returns A newly created Xiaomi notification.
|
|
2391
2234
|
*/
|
|
2392
2235
|
function createXiaomiNotification(notification) {
|
|
2393
|
-
return {
|
|
2394
|
-
...notification,
|
|
2395
|
-
platform: "xiaomi",
|
|
2396
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2397
|
-
};
|
|
2236
|
+
return Object.assign(Object.assign({}, notification), { platform: "xiaomi", contentType: JSON_CONTENT_TYPE });
|
|
2398
2237
|
}
|
|
2399
2238
|
/**
|
|
2400
2239
|
* Creates a notification to send to Firebase.
|
|
@@ -2402,11 +2241,7 @@ function createXiaomiNotification(notification) {
|
|
|
2402
2241
|
* @returns A newly created Firebase.
|
|
2403
2242
|
*/
|
|
2404
2243
|
function createTemplateNotification(notification) {
|
|
2405
|
-
return {
|
|
2406
|
-
...notification,
|
|
2407
|
-
platform: "template",
|
|
2408
|
-
contentType: JSON_CONTENT_TYPE,
|
|
2409
|
-
};
|
|
2244
|
+
return Object.assign(Object.assign({}, notification), { platform: "template", contentType: JSON_CONTENT_TYPE });
|
|
2410
2245
|
}
|
|
2411
2246
|
/**
|
|
2412
2247
|
* Creates a notification to send to WNS.
|
|
@@ -2414,7 +2249,7 @@ function createTemplateNotification(notification) {
|
|
|
2414
2249
|
* @returns A newly created WNS message.
|
|
2415
2250
|
*/
|
|
2416
2251
|
function createWindowsNotification(notification) {
|
|
2417
|
-
if (notification
|
|
2252
|
+
if ((notification === null || notification === void 0 ? void 0 : notification.headers) && notification.headers["X-WNS-Type"]) {
|
|
2418
2253
|
const wnsType = notification.headers["X-WNS-Type"];
|
|
2419
2254
|
switch (wnsType) {
|
|
2420
2255
|
case WNS_TOAST:
|
|
@@ -2439,11 +2274,7 @@ function createWindowsNotification(notification) {
|
|
|
2439
2274
|
* @returns A newly created WNS badge.
|
|
2440
2275
|
*/
|
|
2441
2276
|
function createWindowsBadgeNotification(notification) {
|
|
2442
|
-
const result = {
|
|
2443
|
-
...notification,
|
|
2444
|
-
platform: "windows",
|
|
2445
|
-
contentType: XML_CONTENT_TYPE,
|
|
2446
|
-
};
|
|
2277
|
+
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2447
2278
|
if (!result.headers) {
|
|
2448
2279
|
result.headers = {};
|
|
2449
2280
|
}
|
|
@@ -2458,11 +2289,7 @@ function createWindowsBadgeNotification(notification) {
|
|
|
2458
2289
|
* @returns A newly created WNS tile.
|
|
2459
2290
|
*/
|
|
2460
2291
|
function createWindowsTileNotification(notification) {
|
|
2461
|
-
const result = {
|
|
2462
|
-
...notification,
|
|
2463
|
-
platform: "windows",
|
|
2464
|
-
contentType: XML_CONTENT_TYPE,
|
|
2465
|
-
};
|
|
2292
|
+
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2466
2293
|
if (!result.headers) {
|
|
2467
2294
|
result.headers = {};
|
|
2468
2295
|
}
|
|
@@ -2477,11 +2304,7 @@ function createWindowsTileNotification(notification) {
|
|
|
2477
2304
|
* @returns A newly created WNS toast.
|
|
2478
2305
|
*/
|
|
2479
2306
|
function createWindowsToastNotification(notification) {
|
|
2480
|
-
const result = {
|
|
2481
|
-
...notification,
|
|
2482
|
-
platform: "windows",
|
|
2483
|
-
contentType: XML_CONTENT_TYPE,
|
|
2484
|
-
};
|
|
2307
|
+
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2485
2308
|
if (!result.headers) {
|
|
2486
2309
|
result.headers = {};
|
|
2487
2310
|
}
|
|
@@ -2496,11 +2319,7 @@ function createWindowsToastNotification(notification) {
|
|
|
2496
2319
|
* @returns A newly created WNS message using XML.
|
|
2497
2320
|
*/
|
|
2498
2321
|
function createWindowsRawNotification(notification) {
|
|
2499
|
-
const result = {
|
|
2500
|
-
...notification,
|
|
2501
|
-
platform: "windows",
|
|
2502
|
-
contentType: STREAM_CONTENT_TYPE,
|
|
2503
|
-
};
|
|
2322
|
+
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: STREAM_CONTENT_TYPE });
|
|
2504
2323
|
if (!result.headers) {
|
|
2505
2324
|
result.headers = {};
|
|
2506
2325
|
}
|
|
@@ -2565,10 +2384,7 @@ function createWindowsBadgeNotificationBody(nativeMessage) {
|
|
|
2565
2384
|
* @returns A created ADM registration description.
|
|
2566
2385
|
*/
|
|
2567
2386
|
function createAdmRegistrationDescription(description) {
|
|
2568
|
-
return {
|
|
2569
|
-
...description,
|
|
2570
|
-
kind: "Adm",
|
|
2571
|
-
};
|
|
2387
|
+
return Object.assign(Object.assign({}, description), { kind: "Adm" });
|
|
2572
2388
|
}
|
|
2573
2389
|
/**
|
|
2574
2390
|
* Creates an ADM template registration description.
|
|
@@ -2576,10 +2392,7 @@ function createAdmRegistrationDescription(description) {
|
|
|
2576
2392
|
* @returns A created ADM template registration description.
|
|
2577
2393
|
*/
|
|
2578
2394
|
function createAdmTemplateRegistrationDescription(description) {
|
|
2579
|
-
return {
|
|
2580
|
-
...description,
|
|
2581
|
-
kind: "AdmTemplate",
|
|
2582
|
-
};
|
|
2395
|
+
return Object.assign(Object.assign({}, description), { kind: "AdmTemplate" });
|
|
2583
2396
|
}
|
|
2584
2397
|
/**
|
|
2585
2398
|
* Creates an Apple registration description.
|
|
@@ -2587,10 +2400,7 @@ function createAdmTemplateRegistrationDescription(description) {
|
|
|
2587
2400
|
* @returns A created Apple registration description.
|
|
2588
2401
|
*/
|
|
2589
2402
|
function createAppleRegistrationDescription(description) {
|
|
2590
|
-
return {
|
|
2591
|
-
...description,
|
|
2592
|
-
kind: "Apple",
|
|
2593
|
-
};
|
|
2403
|
+
return Object.assign(Object.assign({}, description), { kind: "Apple" });
|
|
2594
2404
|
}
|
|
2595
2405
|
/**
|
|
2596
2406
|
* Creates an Apple template registration description.
|
|
@@ -2598,10 +2408,7 @@ function createAppleRegistrationDescription(description) {
|
|
|
2598
2408
|
* @returns A created Apple template registration description.
|
|
2599
2409
|
*/
|
|
2600
2410
|
function createAppleTemplateRegistrationDescription(description) {
|
|
2601
|
-
return {
|
|
2602
|
-
...description,
|
|
2603
|
-
kind: "AppleTemplate",
|
|
2604
|
-
};
|
|
2411
|
+
return Object.assign(Object.assign({}, description), { kind: "AppleTemplate" });
|
|
2605
2412
|
}
|
|
2606
2413
|
/**
|
|
2607
2414
|
* Creates a Baidu registration description.
|
|
@@ -2609,10 +2416,7 @@ function createAppleTemplateRegistrationDescription(description) {
|
|
|
2609
2416
|
* @returns A created Baidu registration description.
|
|
2610
2417
|
*/
|
|
2611
2418
|
function createBaiduRegistrationDescription(description) {
|
|
2612
|
-
return {
|
|
2613
|
-
...description,
|
|
2614
|
-
kind: "Baidu",
|
|
2615
|
-
};
|
|
2419
|
+
return Object.assign(Object.assign({}, description), { kind: "Baidu" });
|
|
2616
2420
|
}
|
|
2617
2421
|
/**
|
|
2618
2422
|
* Creates a Baidu template registration description.
|
|
@@ -2620,10 +2424,7 @@ function createBaiduRegistrationDescription(description) {
|
|
|
2620
2424
|
* @returns A created Baidu template registration description.
|
|
2621
2425
|
*/
|
|
2622
2426
|
function createBaiduTemplateRegistrationDescription(description) {
|
|
2623
|
-
return {
|
|
2624
|
-
...description,
|
|
2625
|
-
kind: "BaiduTemplate",
|
|
2626
|
-
};
|
|
2427
|
+
return Object.assign(Object.assign({}, description), { kind: "BaiduTemplate" });
|
|
2627
2428
|
}
|
|
2628
2429
|
/**
|
|
2629
2430
|
* Creates a Web Push registration description.
|
|
@@ -2631,10 +2432,7 @@ function createBaiduTemplateRegistrationDescription(description) {
|
|
|
2631
2432
|
* @returns A created Web Push registration description.
|
|
2632
2433
|
*/
|
|
2633
2434
|
function createBrowserRegistrationDescription(description) {
|
|
2634
|
-
return {
|
|
2635
|
-
...description,
|
|
2636
|
-
kind: "Browser",
|
|
2637
|
-
};
|
|
2435
|
+
return Object.assign(Object.assign({}, description), { kind: "Browser" });
|
|
2638
2436
|
}
|
|
2639
2437
|
/**
|
|
2640
2438
|
* Creates a Web Push registration description.
|
|
@@ -2642,10 +2440,7 @@ function createBrowserRegistrationDescription(description) {
|
|
|
2642
2440
|
* @returns A created Web Push template registration description.
|
|
2643
2441
|
*/
|
|
2644
2442
|
function createBrowserTemplateRegistrationDescription(description) {
|
|
2645
|
-
return {
|
|
2646
|
-
...description,
|
|
2647
|
-
kind: "BrowserTemplate",
|
|
2648
|
-
};
|
|
2443
|
+
return Object.assign(Object.assign({}, description), { kind: "BrowserTemplate" });
|
|
2649
2444
|
}
|
|
2650
2445
|
/**
|
|
2651
2446
|
* Creates a Firebase Legacy registration description.
|
|
@@ -2653,10 +2448,7 @@ function createBrowserTemplateRegistrationDescription(description) {
|
|
|
2653
2448
|
* @returns A created GCM registration description.
|
|
2654
2449
|
*/
|
|
2655
2450
|
function createFcmLegacyRegistrationDescription(description) {
|
|
2656
|
-
return {
|
|
2657
|
-
...description,
|
|
2658
|
-
kind: "Gcm",
|
|
2659
|
-
};
|
|
2451
|
+
return Object.assign(Object.assign({}, description), { kind: "Gcm" });
|
|
2660
2452
|
}
|
|
2661
2453
|
/**
|
|
2662
2454
|
* Creates a GCM template registration description.
|
|
@@ -2664,10 +2456,7 @@ function createFcmLegacyRegistrationDescription(description) {
|
|
|
2664
2456
|
* @returns A created GCM template registration description.
|
|
2665
2457
|
*/
|
|
2666
2458
|
function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
2667
|
-
return {
|
|
2668
|
-
...description,
|
|
2669
|
-
kind: "GcmTemplate",
|
|
2670
|
-
};
|
|
2459
|
+
return Object.assign(Object.assign({}, description), { kind: "GcmTemplate" });
|
|
2671
2460
|
}
|
|
2672
2461
|
/**
|
|
2673
2462
|
* Creates a Windows registration description.
|
|
@@ -2675,10 +2464,7 @@ function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
|
2675
2464
|
* @returns A created Windows registration description.
|
|
2676
2465
|
*/
|
|
2677
2466
|
function createWindowsRegistrationDescription(description) {
|
|
2678
|
-
return {
|
|
2679
|
-
...description,
|
|
2680
|
-
kind: "Windows",
|
|
2681
|
-
};
|
|
2467
|
+
return Object.assign(Object.assign({}, description), { kind: "Windows" });
|
|
2682
2468
|
}
|
|
2683
2469
|
/**
|
|
2684
2470
|
* Creates a Windows template registration description.
|
|
@@ -2686,10 +2472,7 @@ function createWindowsRegistrationDescription(description) {
|
|
|
2686
2472
|
* @returns A created Windows template registration description.
|
|
2687
2473
|
*/
|
|
2688
2474
|
function createWindowsTemplateRegistrationDescription(description) {
|
|
2689
|
-
return {
|
|
2690
|
-
...description,
|
|
2691
|
-
kind: "WindowsTemplate",
|
|
2692
|
-
};
|
|
2475
|
+
return Object.assign(Object.assign({}, description), { kind: "WindowsTemplate" });
|
|
2693
2476
|
}
|
|
2694
2477
|
/**
|
|
2695
2478
|
* Creates a Xiaomi registration description.
|
|
@@ -2697,10 +2480,7 @@ function createWindowsTemplateRegistrationDescription(description) {
|
|
|
2697
2480
|
* @returns A created Xiaomi registration description.
|
|
2698
2481
|
*/
|
|
2699
2482
|
function createXiaomiRegistrationDescription(description) {
|
|
2700
|
-
return {
|
|
2701
|
-
...description,
|
|
2702
|
-
kind: "Xiaomi",
|
|
2703
|
-
};
|
|
2483
|
+
return Object.assign(Object.assign({}, description), { kind: "Xiaomi" });
|
|
2704
2484
|
}
|
|
2705
2485
|
/**
|
|
2706
2486
|
* Creates a Xiaomi template registration description.
|
|
@@ -2708,10 +2488,7 @@ function createXiaomiRegistrationDescription(description) {
|
|
|
2708
2488
|
* @returns A created Xiaomi template registration description.
|
|
2709
2489
|
*/
|
|
2710
2490
|
function createXiaomiTemplateRegistrationDescription(description) {
|
|
2711
|
-
return {
|
|
2712
|
-
...description,
|
|
2713
|
-
kind: "XiaomiTemplate",
|
|
2714
|
-
};
|
|
2491
|
+
return Object.assign(Object.assign({}, description), { kind: "XiaomiTemplate" });
|
|
2715
2492
|
}
|
|
2716
2493
|
|
|
2717
2494
|
// Copyright (c) Microsoft Corporation.
|