@azure/notification-hubs 1.2.1-alpha.20240410.1 → 1.2.1-alpha.20240412.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/dist/browser/auth/hmacSha256-browser.d.mts.map +1 -0
- package/dist/browser/auth/hmacSha256-browser.mjs.map +1 -0
- package/{types/src/auth/hmacSha256.browser.d.ts → dist/browser/auth/hmacSha256.d.ts} +1 -1
- package/{dist-esm/src/auth/hmacSha256.browser.js → dist/browser/auth/hmacSha256.js} +1 -1
- package/dist/browser/package.json +3 -0
- package/dist/commonjs/api/beginSubmitNotificationHubJob.d.ts +12 -0
- package/dist/commonjs/api/beginSubmitNotificationHubJob.d.ts.map +1 -0
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js +119 -0
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js.map +1 -0
- package/dist/commonjs/api/cancelScheduledNotification.d.ts +13 -0
- package/dist/commonjs/api/cancelScheduledNotification.d.ts.map +1 -0
- package/dist/commonjs/api/cancelScheduledNotification.js +28 -0
- package/dist/commonjs/api/cancelScheduledNotification.js.map +1 -0
- package/dist/commonjs/api/clientContext.d.ts +28 -0
- package/dist/commonjs/api/clientContext.d.ts.map +1 -0
- package/dist/commonjs/api/clientContext.js +60 -0
- package/dist/commonjs/api/clientContext.js.map +1 -0
- package/dist/commonjs/api/createOrUpdateInstallation.d.ts +13 -0
- package/dist/commonjs/api/createOrUpdateInstallation.d.ts.map +1 -0
- package/dist/commonjs/api/createOrUpdateInstallation.js +29 -0
- package/dist/commonjs/api/createOrUpdateInstallation.js.map +1 -0
- package/dist/commonjs/api/createOrUpdateRegistration.d.ts +12 -0
- package/dist/commonjs/api/createOrUpdateRegistration.d.ts.map +1 -0
- package/dist/commonjs/api/createOrUpdateRegistration.js +22 -0
- package/dist/commonjs/api/createOrUpdateRegistration.js.map +1 -0
- package/dist/commonjs/api/createRegistration.d.ts +13 -0
- package/dist/commonjs/api/createRegistration.d.ts.map +1 -0
- package/dist/commonjs/api/createRegistration.js +29 -0
- package/dist/commonjs/api/createRegistration.js.map +1 -0
- package/dist/commonjs/api/createRegistrationId.d.ts +10 -0
- package/dist/commonjs/api/createRegistrationId.d.ts.map +1 -0
- package/dist/commonjs/api/createRegistrationId.js +39 -0
- package/dist/commonjs/api/createRegistrationId.js.map +1 -0
- package/dist/commonjs/api/deleteInstallation.d.ts +12 -0
- package/dist/commonjs/api/deleteInstallation.d.ts.map +1 -0
- package/dist/commonjs/api/deleteInstallation.js +27 -0
- package/dist/commonjs/api/deleteInstallation.js.map +1 -0
- package/dist/commonjs/api/deleteRegistration.d.ts +12 -0
- package/dist/commonjs/api/deleteRegistration.d.ts.map +1 -0
- package/dist/commonjs/api/deleteRegistration.js +30 -0
- package/dist/commonjs/api/deleteRegistration.js.map +1 -0
- package/dist/commonjs/api/getFeedbackContainerUrl.d.ts +11 -0
- package/dist/commonjs/api/getFeedbackContainerUrl.d.ts.map +1 -0
- package/dist/commonjs/api/getFeedbackContainerUrl.js +28 -0
- package/dist/commonjs/api/getFeedbackContainerUrl.js.map +1 -0
- package/dist/commonjs/api/getInstallation.d.ts +12 -0
- package/dist/commonjs/api/getInstallation.d.ts.map +1 -0
- package/dist/commonjs/api/getInstallation.js +28 -0
- package/dist/commonjs/api/getInstallation.js.map +1 -0
- package/dist/commonjs/api/getNotificationHubJob.d.ts +12 -0
- package/dist/commonjs/api/getNotificationHubJob.d.ts.map +1 -0
- package/dist/commonjs/api/getNotificationHubJob.js +29 -0
- package/dist/commonjs/api/getNotificationHubJob.js.map +1 -0
- package/dist/commonjs/api/getNotificationOutcomeDetails.d.ts +13 -0
- package/dist/commonjs/api/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/dist/commonjs/api/getNotificationOutcomeDetails.js +29 -0
- package/dist/commonjs/api/getNotificationOutcomeDetails.js.map +1 -0
- package/dist/commonjs/api/getRegistration.d.ts +12 -0
- package/dist/commonjs/api/getRegistration.d.ts.map +1 -0
- package/dist/commonjs/api/getRegistration.js +29 -0
- package/dist/commonjs/api/getRegistration.js.map +1 -0
- package/dist/commonjs/api/index.d.ts +24 -0
- package/dist/commonjs/api/index.d.ts.map +1 -0
- package/dist/commonjs/api/index.js +29 -0
- package/dist/commonjs/api/index.js.map +1 -0
- package/dist/commonjs/api/internal/_client.d.ts +27 -0
- package/dist/commonjs/api/internal/_client.d.ts.map +1 -0
- package/dist/commonjs/api/internal/_client.js +98 -0
- package/dist/commonjs/api/internal/_client.js.map +1 -0
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js +35 -0
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist/commonjs/api/internal/_listRegistrations.d.ts +6 -0
- package/dist/commonjs/api/internal/_listRegistrations.d.ts.map +1 -0
- package/dist/commonjs/api/internal/_listRegistrations.js +65 -0
- package/dist/commonjs/api/internal/_listRegistrations.js.map +1 -0
- package/dist/commonjs/api/listNotificationHubJobs.d.ts +11 -0
- package/dist/commonjs/api/listNotificationHubJobs.d.ts.map +1 -0
- package/dist/commonjs/api/listNotificationHubJobs.js +28 -0
- package/dist/commonjs/api/listNotificationHubJobs.js.map +1 -0
- package/dist/commonjs/api/listRegistrations.d.ts +12 -0
- package/dist/commonjs/api/listRegistrations.d.ts.map +1 -0
- package/dist/commonjs/api/listRegistrations.js +39 -0
- package/dist/commonjs/api/listRegistrations.js.map +1 -0
- package/dist/commonjs/api/listRegistrationsByChannel.d.ts +13 -0
- package/dist/commonjs/api/listRegistrationsByChannel.d.ts.map +1 -0
- package/dist/commonjs/api/listRegistrationsByChannel.js +62 -0
- package/dist/commonjs/api/listRegistrationsByChannel.js.map +1 -0
- package/dist/commonjs/api/listRegistrationsByTag.d.ts +13 -0
- package/dist/commonjs/api/listRegistrationsByTag.d.ts.map +1 -0
- package/dist/commonjs/api/listRegistrationsByTag.js +94 -0
- package/dist/commonjs/api/listRegistrationsByTag.js.map +1 -0
- package/dist/commonjs/api/scheduleNotification.d.ts +15 -0
- package/dist/commonjs/api/scheduleNotification.d.ts.map +1 -0
- package/dist/commonjs/api/scheduleNotification.js +35 -0
- package/dist/commonjs/api/scheduleNotification.js.map +1 -0
- package/dist/commonjs/api/sendNotification.d.ts +13 -0
- package/dist/commonjs/api/sendNotification.d.ts.map +1 -0
- package/dist/commonjs/api/sendNotification.js +67 -0
- package/dist/commonjs/api/sendNotification.js.map +1 -0
- package/dist/commonjs/api/submitNotificationHubJob.d.ts +13 -0
- package/dist/commonjs/api/submitNotificationHubJob.d.ts.map +1 -0
- package/dist/commonjs/api/submitNotificationHubJob.js +31 -0
- package/dist/commonjs/api/submitNotificationHubJob.js.map +1 -0
- package/dist/commonjs/api/updateInstallation.d.ts +14 -0
- package/dist/commonjs/api/updateInstallation.d.ts.map +1 -0
- package/dist/commonjs/api/updateInstallation.js +30 -0
- package/dist/commonjs/api/updateInstallation.js.map +1 -0
- package/dist/commonjs/api/updateRegistration.d.ts +12 -0
- package/dist/commonjs/api/updateRegistration.d.ts.map +1 -0
- package/dist/commonjs/api/updateRegistration.js +26 -0
- package/dist/commonjs/api/updateRegistration.js.map +1 -0
- package/dist/commonjs/auth/connectionStringUtils.d.ts +43 -0
- package/dist/commonjs/auth/connectionStringUtils.d.ts.map +1 -0
- package/dist/commonjs/auth/connectionStringUtils.js +78 -0
- package/dist/commonjs/auth/connectionStringUtils.js.map +1 -0
- package/dist/commonjs/auth/hmacSha256.js +12 -0
- package/dist/commonjs/auth/hmacSha256.js.map +1 -0
- package/dist/commonjs/auth/sasTokenCredential.d.ts +37 -0
- package/dist/commonjs/auth/sasTokenCredential.d.ts.map +1 -0
- package/dist/commonjs/auth/sasTokenCredential.js +49 -0
- package/dist/commonjs/auth/sasTokenCredential.js.map +1 -0
- package/dist/commonjs/index.d.ts +3 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +8 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +11 -0
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +16 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/installation.d.ts +231 -0
- package/dist/commonjs/models/installation.d.ts.map +1 -0
- package/dist/commonjs/models/installation.js +78 -0
- package/dist/commonjs/models/installation.js.map +1 -0
- package/dist/commonjs/models/notification.d.ts +274 -0
- package/dist/commonjs/models/notification.d.ts.map +1 -0
- package/dist/commonjs/models/notification.js +181 -0
- package/dist/commonjs/models/notification.js.map +1 -0
- package/dist/commonjs/models/notificationBodyBuilder.d.ts +933 -0
- package/dist/commonjs/models/notificationBodyBuilder.d.ts.map +1 -0
- package/dist/commonjs/models/notificationBodyBuilder.js +65 -0
- package/dist/commonjs/models/notificationBodyBuilder.js.map +1 -0
- package/dist/commonjs/models/notificationDetails.d.ts +154 -0
- package/dist/commonjs/models/notificationDetails.d.ts.map +1 -0
- package/dist/commonjs/models/notificationDetails.js +5 -0
- package/dist/commonjs/models/notificationDetails.js.map +1 -0
- package/dist/commonjs/models/notificationHeaderBuilder.d.ts +47 -0
- package/dist/commonjs/models/notificationHeaderBuilder.d.ts.map +1 -0
- package/dist/commonjs/models/notificationHeaderBuilder.js +5 -0
- package/dist/commonjs/models/notificationHeaderBuilder.js.map +1 -0
- package/dist/commonjs/models/notificationHubJob.d.ts +109 -0
- package/dist/commonjs/models/notificationHubJob.d.ts.map +1 -0
- package/dist/commonjs/models/notificationHubJob.js +5 -0
- package/dist/commonjs/models/notificationHubJob.js.map +1 -0
- package/dist/commonjs/models/options.d.ts +77 -0
- package/dist/commonjs/models/options.d.ts.map +1 -0
- package/dist/commonjs/models/options.js +5 -0
- package/dist/commonjs/models/options.js.map +1 -0
- package/dist/commonjs/models/registration.d.ts +595 -0
- package/dist/commonjs/models/registration.d.ts.map +1 -0
- package/dist/commonjs/models/registration.js +150 -0
- package/dist/commonjs/models/registration.js.map +1 -0
- package/dist/commonjs/models/response.d.ts +15 -0
- package/dist/commonjs/models/response.d.ts.map +1 -0
- package/dist/commonjs/models/response.js +5 -0
- package/dist/commonjs/models/response.js.map +1 -0
- package/dist/commonjs/models/tagExpressionBuilder.d.ts +7 -0
- package/dist/commonjs/models/tagExpressionBuilder.d.ts.map +1 -0
- package/dist/commonjs/models/tagExpressionBuilder.js +15 -0
- package/dist/commonjs/models/tagExpressionBuilder.js.map +1 -0
- package/dist/commonjs/notificationHubsClient.d.ts +180 -0
- package/dist/commonjs/notificationHubsClient.d.ts.map +1 -0
- package/dist/commonjs/notificationHubsClient.js +246 -0
- package/dist/commonjs/notificationHubsClient.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/serializers/notificationDetailsSerializer.d.ts +7 -0
- package/dist/commonjs/serializers/notificationDetailsSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/notificationDetailsSerializer.js +68 -0
- package/dist/commonjs/serializers/notificationDetailsSerializer.js.map +1 -0
- package/dist/commonjs/serializers/notificationHubJobSerializer.d.ts +21 -0
- package/dist/commonjs/serializers/notificationHubJobSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/notificationHubJobSerializer.js +86 -0
- package/dist/commonjs/serializers/notificationHubJobSerializer.js.map +1 -0
- package/dist/commonjs/serializers/notificationOutcomeSerializer.d.ts +3 -0
- package/dist/commonjs/serializers/notificationOutcomeSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/notificationOutcomeSerializer.js +35 -0
- package/dist/commonjs/serializers/notificationOutcomeSerializer.js.map +1 -0
- package/dist/commonjs/serializers/registrationSerializer.d.ts +213 -0
- package/dist/commonjs/serializers/registrationSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/registrationSerializer.js +409 -0
- package/dist/commonjs/serializers/registrationSerializer.js.map +1 -0
- package/dist/commonjs/utils/constants.d.ts +10 -0
- package/dist/commonjs/utils/constants.d.ts.map +1 -0
- package/dist/commonjs/utils/constants.js +15 -0
- package/dist/commonjs/utils/constants.js.map +1 -0
- package/dist/commonjs/utils/notificationUtils.d.ts +6 -0
- package/dist/commonjs/utils/notificationUtils.d.ts.map +1 -0
- package/dist/commonjs/utils/notificationUtils.js +23 -0
- package/dist/commonjs/utils/notificationUtils.js.map +1 -0
- package/dist/commonjs/utils/optionUtils.d.ts +14 -0
- package/dist/commonjs/utils/optionUtils.d.ts.map +1 -0
- package/dist/commonjs/utils/optionUtils.js +25 -0
- package/dist/commonjs/utils/optionUtils.js.map +1 -0
- package/dist/commonjs/utils/tracing.d.ts +6 -0
- package/dist/commonjs/utils/tracing.d.ts.map +1 -0
- package/dist/commonjs/utils/tracing.js +17 -0
- package/dist/commonjs/utils/tracing.js.map +1 -0
- package/dist/commonjs/utils/utils.d.ts +67 -0
- package/dist/commonjs/utils/utils.d.ts.map +1 -0
- package/dist/commonjs/utils/utils.js +144 -0
- package/dist/commonjs/utils/utils.js.map +1 -0
- package/dist/commonjs/utils/xmlUtils.d.ts +46 -0
- package/dist/commonjs/utils/xmlUtils.d.ts.map +1 -0
- package/dist/commonjs/utils/xmlUtils.js +108 -0
- package/dist/commonjs/utils/xmlUtils.js.map +1 -0
- package/dist/esm/api/beginSubmitNotificationHubJob.d.ts +12 -0
- package/dist/esm/api/beginSubmitNotificationHubJob.d.ts.map +1 -0
- package/dist/esm/api/beginSubmitNotificationHubJob.js +115 -0
- package/dist/esm/api/beginSubmitNotificationHubJob.js.map +1 -0
- package/dist/esm/api/cancelScheduledNotification.d.ts +13 -0
- package/dist/esm/api/cancelScheduledNotification.d.ts.map +1 -0
- package/dist/esm/api/cancelScheduledNotification.js +24 -0
- package/dist/esm/api/cancelScheduledNotification.js.map +1 -0
- package/dist/esm/api/clientContext.d.ts +28 -0
- package/dist/esm/api/clientContext.d.ts.map +1 -0
- package/dist/esm/api/clientContext.js +55 -0
- package/dist/esm/api/clientContext.js.map +1 -0
- package/dist/esm/api/createOrUpdateInstallation.d.ts +13 -0
- package/dist/esm/api/createOrUpdateInstallation.d.ts.map +1 -0
- package/dist/esm/api/createOrUpdateInstallation.js +25 -0
- package/dist/esm/api/createOrUpdateInstallation.js.map +1 -0
- package/dist/esm/api/createOrUpdateRegistration.d.ts +12 -0
- package/dist/esm/api/createOrUpdateRegistration.d.ts.map +1 -0
- package/dist/esm/api/createOrUpdateRegistration.js +18 -0
- package/dist/esm/api/createOrUpdateRegistration.js.map +1 -0
- package/dist/esm/api/createRegistration.d.ts +13 -0
- package/dist/esm/api/createRegistration.d.ts.map +1 -0
- package/dist/esm/api/createRegistration.js +25 -0
- package/dist/esm/api/createRegistration.js.map +1 -0
- package/dist/esm/api/createRegistrationId.d.ts +10 -0
- package/dist/esm/api/createRegistrationId.d.ts.map +1 -0
- package/dist/esm/api/createRegistrationId.js +35 -0
- package/dist/esm/api/createRegistrationId.js.map +1 -0
- package/dist/esm/api/deleteInstallation.d.ts +12 -0
- package/dist/esm/api/deleteInstallation.d.ts.map +1 -0
- package/dist/esm/api/deleteInstallation.js +23 -0
- package/dist/esm/api/deleteInstallation.js.map +1 -0
- package/dist/esm/api/deleteRegistration.d.ts +12 -0
- package/dist/esm/api/deleteRegistration.d.ts.map +1 -0
- package/dist/esm/api/deleteRegistration.js +26 -0
- package/dist/esm/api/deleteRegistration.js.map +1 -0
- package/dist/esm/api/getFeedbackContainerUrl.d.ts +11 -0
- package/dist/esm/api/getFeedbackContainerUrl.d.ts.map +1 -0
- package/dist/esm/api/getFeedbackContainerUrl.js +24 -0
- package/dist/esm/api/getFeedbackContainerUrl.js.map +1 -0
- package/dist/esm/api/getInstallation.d.ts +12 -0
- package/dist/esm/api/getInstallation.d.ts.map +1 -0
- package/dist/esm/api/getInstallation.js +24 -0
- package/dist/esm/api/getInstallation.js.map +1 -0
- package/dist/esm/api/getNotificationHubJob.d.ts +12 -0
- package/dist/esm/api/getNotificationHubJob.d.ts.map +1 -0
- package/dist/esm/api/getNotificationHubJob.js +25 -0
- package/dist/esm/api/getNotificationHubJob.js.map +1 -0
- package/dist/esm/api/getNotificationOutcomeDetails.d.ts +13 -0
- package/dist/esm/api/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/dist/esm/api/getNotificationOutcomeDetails.js +25 -0
- package/dist/esm/api/getNotificationOutcomeDetails.js.map +1 -0
- package/dist/esm/api/getRegistration.d.ts +12 -0
- package/dist/esm/api/getRegistration.d.ts.map +1 -0
- package/dist/esm/api/getRegistration.js +25 -0
- package/dist/esm/api/getRegistration.js.map +1 -0
- package/dist/esm/api/index.d.ts +24 -0
- package/dist/esm/api/index.d.ts.map +1 -0
- package/dist/esm/api/index.js +26 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/api/internal/_client.d.ts +27 -0
- package/dist/esm/api/internal/_client.d.ts.map +1 -0
- package/dist/esm/api/internal/_client.js +91 -0
- package/dist/esm/api/internal/_client.js.map +1 -0
- package/dist/esm/api/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
- package/dist/esm/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/dist/esm/api/internal/_createOrUpdateRegistrationDescription.js +31 -0
- package/dist/esm/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist/esm/api/internal/_listRegistrations.d.ts +6 -0
- package/dist/esm/api/internal/_listRegistrations.d.ts.map +1 -0
- package/dist/esm/api/internal/_listRegistrations.js +60 -0
- package/dist/esm/api/internal/_listRegistrations.js.map +1 -0
- package/dist/esm/api/listNotificationHubJobs.d.ts +11 -0
- package/dist/esm/api/listNotificationHubJobs.d.ts.map +1 -0
- package/dist/esm/api/listNotificationHubJobs.js +24 -0
- package/dist/esm/api/listNotificationHubJobs.js.map +1 -0
- package/dist/esm/api/listRegistrations.d.ts +12 -0
- package/dist/esm/api/listRegistrations.d.ts.map +1 -0
- package/dist/esm/api/listRegistrations.js +35 -0
- package/dist/esm/api/listRegistrations.js.map +1 -0
- package/dist/esm/api/listRegistrationsByChannel.d.ts +13 -0
- package/dist/esm/api/listRegistrationsByChannel.d.ts.map +1 -0
- package/dist/esm/api/listRegistrationsByChannel.js +58 -0
- package/dist/esm/api/listRegistrationsByChannel.js.map +1 -0
- package/dist/esm/api/listRegistrationsByTag.d.ts +13 -0
- package/dist/esm/api/listRegistrationsByTag.d.ts.map +1 -0
- package/dist/esm/api/listRegistrationsByTag.js +90 -0
- package/dist/esm/api/listRegistrationsByTag.js.map +1 -0
- package/dist/esm/api/scheduleNotification.d.ts +15 -0
- package/dist/esm/api/scheduleNotification.d.ts.map +1 -0
- package/dist/esm/api/scheduleNotification.js +31 -0
- package/dist/esm/api/scheduleNotification.js.map +1 -0
- package/dist/esm/api/sendNotification.d.ts +13 -0
- package/dist/esm/api/sendNotification.d.ts.map +1 -0
- package/dist/esm/api/sendNotification.js +63 -0
- package/dist/esm/api/sendNotification.js.map +1 -0
- package/dist/esm/api/submitNotificationHubJob.d.ts +13 -0
- package/dist/esm/api/submitNotificationHubJob.d.ts.map +1 -0
- package/dist/esm/api/submitNotificationHubJob.js +27 -0
- package/dist/esm/api/submitNotificationHubJob.js.map +1 -0
- package/dist/esm/api/updateInstallation.d.ts +14 -0
- package/dist/esm/api/updateInstallation.d.ts.map +1 -0
- package/dist/esm/api/updateInstallation.js +26 -0
- package/dist/esm/api/updateInstallation.js.map +1 -0
- package/dist/esm/api/updateRegistration.d.ts +12 -0
- package/dist/esm/api/updateRegistration.d.ts.map +1 -0
- package/dist/esm/api/updateRegistration.js +22 -0
- package/dist/esm/api/updateRegistration.js.map +1 -0
- package/dist/esm/auth/connectionStringUtils.d.ts +43 -0
- package/dist/esm/auth/connectionStringUtils.d.ts.map +1 -0
- package/dist/esm/auth/connectionStringUtils.js +73 -0
- package/dist/esm/auth/connectionStringUtils.js.map +1 -0
- package/dist/esm/auth/hmacSha256.d.ts +2 -0
- package/dist/esm/auth/hmacSha256.d.ts.map +1 -0
- package/dist/esm/auth/sasTokenCredential.d.ts +37 -0
- package/dist/esm/auth/sasTokenCredential.d.ts.map +1 -0
- package/dist/esm/auth/sasTokenCredential.js +45 -0
- package/dist/esm/auth/sasTokenCredential.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/models/index.d.ts +11 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +13 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/installation.d.ts +231 -0
- package/dist/esm/models/installation.d.ts.map +1 -0
- package/dist/esm/models/installation.js +67 -0
- package/dist/esm/models/installation.js.map +1 -0
- package/dist/esm/models/notification.d.ts +274 -0
- package/dist/esm/models/notification.d.ts.map +1 -0
- package/dist/esm/models/notification.js +164 -0
- package/dist/esm/models/notification.js.map +1 -0
- package/dist/esm/models/notificationBodyBuilder.d.ts +933 -0
- package/dist/esm/models/notificationBodyBuilder.d.ts.map +1 -0
- package/dist/esm/models/notificationBodyBuilder.js +56 -0
- package/dist/esm/models/notificationBodyBuilder.js.map +1 -0
- package/dist/esm/models/notificationDetails.d.ts +154 -0
- package/dist/esm/models/notificationDetails.d.ts.map +1 -0
- package/dist/esm/models/notificationDetails.js +4 -0
- package/dist/esm/models/notificationDetails.js.map +1 -0
- package/dist/esm/models/notificationHeaderBuilder.d.ts +47 -0
- package/dist/esm/models/notificationHeaderBuilder.d.ts.map +1 -0
- package/dist/esm/models/notificationHeaderBuilder.js +4 -0
- package/dist/esm/models/notificationHeaderBuilder.js.map +1 -0
- package/dist/esm/models/notificationHubJob.d.ts +109 -0
- package/dist/esm/models/notificationHubJob.d.ts.map +1 -0
- package/dist/esm/models/notificationHubJob.js +4 -0
- package/dist/esm/models/notificationHubJob.js.map +1 -0
- package/dist/esm/models/options.d.ts +77 -0
- package/dist/esm/models/options.d.ts.map +1 -0
- package/dist/esm/models/options.js +4 -0
- package/dist/esm/models/options.js.map +1 -0
- package/dist/esm/models/registration.d.ts +595 -0
- package/dist/esm/models/registration.d.ts.map +1 -0
- package/dist/esm/models/registration.js +131 -0
- package/dist/esm/models/registration.js.map +1 -0
- package/dist/esm/models/response.d.ts +15 -0
- package/dist/esm/models/response.d.ts.map +1 -0
- package/dist/esm/models/response.js +4 -0
- package/dist/esm/models/response.js.map +1 -0
- package/dist/esm/models/tagExpressionBuilder.d.ts +7 -0
- package/dist/esm/models/tagExpressionBuilder.d.ts.map +1 -0
- package/dist/esm/models/tagExpressionBuilder.js +11 -0
- package/dist/esm/models/tagExpressionBuilder.js.map +1 -0
- package/dist/esm/notificationHubsClient.d.ts +180 -0
- package/dist/esm/notificationHubsClient.d.ts.map +1 -0
- package/dist/esm/notificationHubsClient.js +242 -0
- package/dist/esm/notificationHubsClient.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/serializers/notificationDetailsSerializer.d.ts +7 -0
- package/dist/esm/serializers/notificationDetailsSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/notificationDetailsSerializer.js +64 -0
- package/dist/esm/serializers/notificationDetailsSerializer.js.map +1 -0
- package/dist/esm/serializers/notificationHubJobSerializer.d.ts +21 -0
- package/dist/esm/serializers/notificationHubJobSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/notificationHubJobSerializer.js +80 -0
- package/dist/esm/serializers/notificationHubJobSerializer.js.map +1 -0
- package/dist/esm/serializers/notificationOutcomeSerializer.d.ts +3 -0
- package/dist/esm/serializers/notificationOutcomeSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/notificationOutcomeSerializer.js +31 -0
- package/dist/esm/serializers/notificationOutcomeSerializer.js.map +1 -0
- package/dist/esm/serializers/registrationSerializer.d.ts +213 -0
- package/dist/esm/serializers/registrationSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/registrationSerializer.js +406 -0
- package/dist/esm/serializers/registrationSerializer.js.map +1 -0
- package/dist/esm/utils/constants.d.ts +10 -0
- package/dist/esm/utils/constants.d.ts.map +1 -0
- package/dist/esm/utils/constants.js +12 -0
- package/dist/esm/utils/constants.js.map +1 -0
- package/dist/esm/utils/notificationUtils.d.ts +6 -0
- package/dist/esm/utils/notificationUtils.d.ts.map +1 -0
- package/dist/esm/utils/notificationUtils.js +19 -0
- package/dist/esm/utils/notificationUtils.js.map +1 -0
- package/dist/esm/utils/optionUtils.d.ts +14 -0
- package/dist/esm/utils/optionUtils.d.ts.map +1 -0
- package/dist/esm/utils/optionUtils.js +20 -0
- package/dist/esm/utils/optionUtils.js.map +1 -0
- package/dist/esm/utils/tracing.d.ts +6 -0
- package/dist/esm/utils/tracing.d.ts.map +1 -0
- package/dist/esm/utils/tracing.js +14 -0
- package/dist/esm/utils/tracing.js.map +1 -0
- package/dist/esm/utils/utils.d.ts +67 -0
- package/dist/esm/utils/utils.d.ts.map +1 -0
- package/dist/esm/utils/utils.js +130 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/utils/xmlUtils.d.ts +46 -0
- package/dist/esm/utils/xmlUtils.d.ts.map +1 -0
- package/dist/esm/utils/xmlUtils.js +101 -0
- package/dist/esm/utils/xmlUtils.js.map +1 -0
- package/dist/react-native/api/beginSubmitNotificationHubJob.d.ts +12 -0
- package/dist/react-native/api/beginSubmitNotificationHubJob.d.ts.map +1 -0
- package/dist/react-native/api/beginSubmitNotificationHubJob.js +115 -0
- package/dist/react-native/api/beginSubmitNotificationHubJob.js.map +1 -0
- package/dist/react-native/api/cancelScheduledNotification.d.ts +13 -0
- package/dist/react-native/api/cancelScheduledNotification.d.ts.map +1 -0
- package/dist/react-native/api/cancelScheduledNotification.js +24 -0
- package/dist/react-native/api/cancelScheduledNotification.js.map +1 -0
- package/dist/react-native/api/clientContext.d.ts +28 -0
- package/dist/react-native/api/clientContext.d.ts.map +1 -0
- package/dist/react-native/api/clientContext.js +55 -0
- package/dist/react-native/api/clientContext.js.map +1 -0
- package/dist/react-native/api/createOrUpdateInstallation.d.ts +13 -0
- package/dist/react-native/api/createOrUpdateInstallation.d.ts.map +1 -0
- package/dist/react-native/api/createOrUpdateInstallation.js +25 -0
- package/dist/react-native/api/createOrUpdateInstallation.js.map +1 -0
- package/dist/react-native/api/createOrUpdateRegistration.d.ts +12 -0
- package/dist/react-native/api/createOrUpdateRegistration.d.ts.map +1 -0
- package/dist/react-native/api/createOrUpdateRegistration.js +18 -0
- package/dist/react-native/api/createOrUpdateRegistration.js.map +1 -0
- package/dist/react-native/api/createRegistration.d.ts +13 -0
- package/dist/react-native/api/createRegistration.d.ts.map +1 -0
- package/dist/react-native/api/createRegistration.js +25 -0
- package/dist/react-native/api/createRegistration.js.map +1 -0
- package/dist/react-native/api/createRegistrationId.d.ts +10 -0
- package/dist/react-native/api/createRegistrationId.d.ts.map +1 -0
- package/dist/react-native/api/createRegistrationId.js +35 -0
- package/dist/react-native/api/createRegistrationId.js.map +1 -0
- package/dist/react-native/api/deleteInstallation.d.ts +12 -0
- package/dist/react-native/api/deleteInstallation.d.ts.map +1 -0
- package/dist/react-native/api/deleteInstallation.js +23 -0
- package/dist/react-native/api/deleteInstallation.js.map +1 -0
- package/dist/react-native/api/deleteRegistration.d.ts +12 -0
- package/dist/react-native/api/deleteRegistration.d.ts.map +1 -0
- package/dist/react-native/api/deleteRegistration.js +26 -0
- package/dist/react-native/api/deleteRegistration.js.map +1 -0
- package/dist/react-native/api/getFeedbackContainerUrl.d.ts +11 -0
- package/dist/react-native/api/getFeedbackContainerUrl.d.ts.map +1 -0
- package/dist/react-native/api/getFeedbackContainerUrl.js +24 -0
- package/dist/react-native/api/getFeedbackContainerUrl.js.map +1 -0
- package/dist/react-native/api/getInstallation.d.ts +12 -0
- package/dist/react-native/api/getInstallation.d.ts.map +1 -0
- package/dist/react-native/api/getInstallation.js +24 -0
- package/dist/react-native/api/getInstallation.js.map +1 -0
- package/dist/react-native/api/getNotificationHubJob.d.ts +12 -0
- package/dist/react-native/api/getNotificationHubJob.d.ts.map +1 -0
- package/dist/react-native/api/getNotificationHubJob.js +25 -0
- package/dist/react-native/api/getNotificationHubJob.js.map +1 -0
- package/dist/react-native/api/getNotificationOutcomeDetails.d.ts +13 -0
- package/dist/react-native/api/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/dist/react-native/api/getNotificationOutcomeDetails.js +25 -0
- package/dist/react-native/api/getNotificationOutcomeDetails.js.map +1 -0
- package/dist/react-native/api/getRegistration.d.ts +12 -0
- package/dist/react-native/api/getRegistration.d.ts.map +1 -0
- package/dist/react-native/api/getRegistration.js +25 -0
- package/dist/react-native/api/getRegistration.js.map +1 -0
- package/dist/react-native/api/index.d.ts +24 -0
- package/dist/react-native/api/index.d.ts.map +1 -0
- package/dist/react-native/api/index.js +26 -0
- package/dist/react-native/api/index.js.map +1 -0
- package/dist/react-native/api/internal/_client.d.ts +27 -0
- package/dist/react-native/api/internal/_client.d.ts.map +1 -0
- package/dist/react-native/api/internal/_client.js +91 -0
- package/dist/react-native/api/internal/_client.js.map +1 -0
- package/dist/react-native/api/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
- package/dist/react-native/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/dist/react-native/api/internal/_createOrUpdateRegistrationDescription.js +31 -0
- package/dist/react-native/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist/react-native/api/internal/_listRegistrations.d.ts +6 -0
- package/dist/react-native/api/internal/_listRegistrations.d.ts.map +1 -0
- package/dist/react-native/api/internal/_listRegistrations.js +60 -0
- package/dist/react-native/api/internal/_listRegistrations.js.map +1 -0
- package/dist/react-native/api/listNotificationHubJobs.d.ts +11 -0
- package/dist/react-native/api/listNotificationHubJobs.d.ts.map +1 -0
- package/dist/react-native/api/listNotificationHubJobs.js +24 -0
- package/dist/react-native/api/listNotificationHubJobs.js.map +1 -0
- package/dist/react-native/api/listRegistrations.d.ts +12 -0
- package/dist/react-native/api/listRegistrations.d.ts.map +1 -0
- package/dist/react-native/api/listRegistrations.js +35 -0
- package/dist/react-native/api/listRegistrations.js.map +1 -0
- package/dist/react-native/api/listRegistrationsByChannel.d.ts +13 -0
- package/dist/react-native/api/listRegistrationsByChannel.d.ts.map +1 -0
- package/dist/react-native/api/listRegistrationsByChannel.js +58 -0
- package/dist/react-native/api/listRegistrationsByChannel.js.map +1 -0
- package/dist/react-native/api/listRegistrationsByTag.d.ts +13 -0
- package/dist/react-native/api/listRegistrationsByTag.d.ts.map +1 -0
- package/dist/react-native/api/listRegistrationsByTag.js +90 -0
- package/dist/react-native/api/listRegistrationsByTag.js.map +1 -0
- package/dist/react-native/api/scheduleNotification.d.ts +15 -0
- package/dist/react-native/api/scheduleNotification.d.ts.map +1 -0
- package/dist/react-native/api/scheduleNotification.js +31 -0
- package/dist/react-native/api/scheduleNotification.js.map +1 -0
- package/dist/react-native/api/sendNotification.d.ts +13 -0
- package/dist/react-native/api/sendNotification.d.ts.map +1 -0
- package/dist/react-native/api/sendNotification.js +63 -0
- package/dist/react-native/api/sendNotification.js.map +1 -0
- package/dist/react-native/api/submitNotificationHubJob.d.ts +13 -0
- package/dist/react-native/api/submitNotificationHubJob.d.ts.map +1 -0
- package/dist/react-native/api/submitNotificationHubJob.js +27 -0
- package/dist/react-native/api/submitNotificationHubJob.js.map +1 -0
- package/dist/react-native/api/updateInstallation.d.ts +14 -0
- package/dist/react-native/api/updateInstallation.d.ts.map +1 -0
- package/dist/react-native/api/updateInstallation.js +26 -0
- package/dist/react-native/api/updateInstallation.js.map +1 -0
- package/dist/react-native/api/updateRegistration.d.ts +12 -0
- package/dist/react-native/api/updateRegistration.d.ts.map +1 -0
- package/dist/react-native/api/updateRegistration.js +22 -0
- package/dist/react-native/api/updateRegistration.js.map +1 -0
- package/dist/react-native/auth/connectionStringUtils.d.ts +43 -0
- package/dist/react-native/auth/connectionStringUtils.d.ts.map +1 -0
- package/dist/react-native/auth/connectionStringUtils.js +73 -0
- package/dist/react-native/auth/connectionStringUtils.js.map +1 -0
- package/dist/react-native/auth/hmacSha256.d.ts +2 -0
- package/dist/react-native/auth/hmacSha256.d.ts.map +1 -0
- package/dist/react-native/auth/hmacSha256.js +8 -0
- package/dist/react-native/auth/hmacSha256.js.map +1 -0
- package/dist/react-native/auth/sasTokenCredential.d.ts +37 -0
- package/dist/react-native/auth/sasTokenCredential.d.ts.map +1 -0
- package/dist/react-native/auth/sasTokenCredential.js +45 -0
- package/dist/react-native/auth/sasTokenCredential.js.map +1 -0
- package/dist/react-native/index.d.ts +3 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +5 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/models/index.d.ts +11 -0
- package/dist/react-native/models/index.d.ts.map +1 -0
- package/dist/react-native/models/index.js +13 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/installation.d.ts +231 -0
- package/dist/react-native/models/installation.d.ts.map +1 -0
- package/dist/react-native/models/installation.js +67 -0
- package/dist/react-native/models/installation.js.map +1 -0
- package/dist/react-native/models/notification.d.ts +274 -0
- package/dist/react-native/models/notification.d.ts.map +1 -0
- package/dist/react-native/models/notification.js +164 -0
- package/dist/react-native/models/notification.js.map +1 -0
- package/dist/react-native/models/notificationBodyBuilder.d.ts +933 -0
- package/dist/react-native/models/notificationBodyBuilder.d.ts.map +1 -0
- package/dist/react-native/models/notificationBodyBuilder.js +56 -0
- package/dist/react-native/models/notificationBodyBuilder.js.map +1 -0
- package/dist/react-native/models/notificationDetails.d.ts +154 -0
- package/dist/react-native/models/notificationDetails.d.ts.map +1 -0
- package/dist/react-native/models/notificationDetails.js +4 -0
- package/dist/react-native/models/notificationDetails.js.map +1 -0
- package/dist/react-native/models/notificationHeaderBuilder.d.ts +47 -0
- package/dist/react-native/models/notificationHeaderBuilder.d.ts.map +1 -0
- package/dist/react-native/models/notificationHeaderBuilder.js +4 -0
- package/dist/react-native/models/notificationHeaderBuilder.js.map +1 -0
- package/dist/react-native/models/notificationHubJob.d.ts +109 -0
- package/dist/react-native/models/notificationHubJob.d.ts.map +1 -0
- package/dist/react-native/models/notificationHubJob.js +4 -0
- package/dist/react-native/models/notificationHubJob.js.map +1 -0
- package/dist/react-native/models/options.d.ts +77 -0
- package/dist/react-native/models/options.d.ts.map +1 -0
- package/dist/react-native/models/options.js +4 -0
- package/dist/react-native/models/options.js.map +1 -0
- package/dist/react-native/models/registration.d.ts +595 -0
- package/dist/react-native/models/registration.d.ts.map +1 -0
- package/dist/react-native/models/registration.js +131 -0
- package/dist/react-native/models/registration.js.map +1 -0
- package/dist/react-native/models/response.d.ts +15 -0
- package/dist/react-native/models/response.d.ts.map +1 -0
- package/dist/react-native/models/response.js +4 -0
- package/dist/react-native/models/response.js.map +1 -0
- package/dist/react-native/models/tagExpressionBuilder.d.ts +7 -0
- package/dist/react-native/models/tagExpressionBuilder.d.ts.map +1 -0
- package/dist/react-native/models/tagExpressionBuilder.js +11 -0
- package/dist/react-native/models/tagExpressionBuilder.js.map +1 -0
- package/dist/react-native/notificationHubsClient.d.ts +180 -0
- package/dist/react-native/notificationHubsClient.d.ts.map +1 -0
- package/dist/react-native/notificationHubsClient.js +242 -0
- package/dist/react-native/notificationHubsClient.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/serializers/notificationDetailsSerializer.d.ts +7 -0
- package/dist/react-native/serializers/notificationDetailsSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/notificationDetailsSerializer.js +64 -0
- package/dist/react-native/serializers/notificationDetailsSerializer.js.map +1 -0
- package/dist/react-native/serializers/notificationHubJobSerializer.d.ts +21 -0
- package/dist/react-native/serializers/notificationHubJobSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/notificationHubJobSerializer.js +80 -0
- package/dist/react-native/serializers/notificationHubJobSerializer.js.map +1 -0
- package/dist/react-native/serializers/notificationOutcomeSerializer.d.ts +3 -0
- package/dist/react-native/serializers/notificationOutcomeSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/notificationOutcomeSerializer.js +31 -0
- package/dist/react-native/serializers/notificationOutcomeSerializer.js.map +1 -0
- package/dist/react-native/serializers/registrationSerializer.d.ts +213 -0
- package/dist/react-native/serializers/registrationSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/registrationSerializer.js +406 -0
- package/dist/react-native/serializers/registrationSerializer.js.map +1 -0
- package/dist/react-native/utils/constants.d.ts +10 -0
- package/dist/react-native/utils/constants.d.ts.map +1 -0
- package/dist/react-native/utils/constants.js +12 -0
- package/dist/react-native/utils/constants.js.map +1 -0
- package/dist/react-native/utils/notificationUtils.d.ts +6 -0
- package/dist/react-native/utils/notificationUtils.d.ts.map +1 -0
- package/dist/react-native/utils/notificationUtils.js +19 -0
- package/dist/react-native/utils/notificationUtils.js.map +1 -0
- package/dist/react-native/utils/optionUtils.d.ts +14 -0
- package/dist/react-native/utils/optionUtils.d.ts.map +1 -0
- package/dist/react-native/utils/optionUtils.js +20 -0
- package/dist/react-native/utils/optionUtils.js.map +1 -0
- package/dist/react-native/utils/tracing.d.ts +6 -0
- package/dist/react-native/utils/tracing.d.ts.map +1 -0
- package/dist/react-native/utils/tracing.js +14 -0
- package/dist/react-native/utils/tracing.js.map +1 -0
- package/dist/react-native/utils/utils.d.ts +67 -0
- package/dist/react-native/utils/utils.d.ts.map +1 -0
- package/dist/react-native/utils/utils.js +130 -0
- package/dist/react-native/utils/utils.js.map +1 -0
- package/dist/react-native/utils/xmlUtils.d.ts +46 -0
- package/dist/react-native/utils/xmlUtils.d.ts.map +1 -0
- package/dist/react-native/utils/xmlUtils.js +101 -0
- package/dist/react-native/utils/xmlUtils.js.map +1 -0
- package/package.json +105 -70
- package/dist/index.cjs +0 -2602
- package/dist/index.cjs.map +0 -1
- package/dist-esm/src/auth/hmacSha256.browser.js.map +0 -1
- package/types/latest/api/notification-hubs.d.ts +0 -1438
- package/types/latest/models/notification-hubs.d.ts +0 -2610
- package/types/src/auth/hmacSha256.browser.d.ts.map +0 -1
- /package/{types/src → dist/browser}/api/beginSubmitNotificationHubJob.d.ts +0 -0
- /package/{types/src → dist/browser}/api/beginSubmitNotificationHubJob.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/beginSubmitNotificationHubJob.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/beginSubmitNotificationHubJob.js.map +0 -0
- /package/{types/src → dist/browser}/api/cancelScheduledNotification.d.ts +0 -0
- /package/{types/src → dist/browser}/api/cancelScheduledNotification.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/cancelScheduledNotification.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/cancelScheduledNotification.js.map +0 -0
- /package/{types/src → dist/browser}/api/clientContext.d.ts +0 -0
- /package/{types/src → dist/browser}/api/clientContext.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/clientContext.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/clientContext.js.map +0 -0
- /package/{types/src → dist/browser}/api/createOrUpdateInstallation.d.ts +0 -0
- /package/{types/src → dist/browser}/api/createOrUpdateInstallation.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/createOrUpdateInstallation.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/createOrUpdateInstallation.js.map +0 -0
- /package/{types/src → dist/browser}/api/createOrUpdateRegistration.d.ts +0 -0
- /package/{types/src → dist/browser}/api/createOrUpdateRegistration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/createOrUpdateRegistration.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/createOrUpdateRegistration.js.map +0 -0
- /package/{types/src → dist/browser}/api/createRegistration.d.ts +0 -0
- /package/{types/src → dist/browser}/api/createRegistration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/createRegistration.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/createRegistration.js.map +0 -0
- /package/{types/src → dist/browser}/api/createRegistrationId.d.ts +0 -0
- /package/{types/src → dist/browser}/api/createRegistrationId.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/createRegistrationId.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/createRegistrationId.js.map +0 -0
- /package/{types/src → dist/browser}/api/deleteInstallation.d.ts +0 -0
- /package/{types/src → dist/browser}/api/deleteInstallation.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/deleteInstallation.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/deleteInstallation.js.map +0 -0
- /package/{types/src → dist/browser}/api/deleteRegistration.d.ts +0 -0
- /package/{types/src → dist/browser}/api/deleteRegistration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/deleteRegistration.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/deleteRegistration.js.map +0 -0
- /package/{types/src → dist/browser}/api/getFeedbackContainerUrl.d.ts +0 -0
- /package/{types/src → dist/browser}/api/getFeedbackContainerUrl.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/getFeedbackContainerUrl.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/getFeedbackContainerUrl.js.map +0 -0
- /package/{types/src → dist/browser}/api/getInstallation.d.ts +0 -0
- /package/{types/src → dist/browser}/api/getInstallation.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/getInstallation.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/getInstallation.js.map +0 -0
- /package/{types/src → dist/browser}/api/getNotificationHubJob.d.ts +0 -0
- /package/{types/src → dist/browser}/api/getNotificationHubJob.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/getNotificationHubJob.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/getNotificationHubJob.js.map +0 -0
- /package/{types/src → dist/browser}/api/getNotificationOutcomeDetails.d.ts +0 -0
- /package/{types/src → dist/browser}/api/getNotificationOutcomeDetails.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/getNotificationOutcomeDetails.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/getNotificationOutcomeDetails.js.map +0 -0
- /package/{types/src → dist/browser}/api/getRegistration.d.ts +0 -0
- /package/{types/src → dist/browser}/api/getRegistration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/getRegistration.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/getRegistration.js.map +0 -0
- /package/{types/src → dist/browser}/api/index.d.ts +0 -0
- /package/{types/src → dist/browser}/api/index.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/index.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/index.js.map +0 -0
- /package/{types/src → dist/browser}/api/internal/_client.d.ts +0 -0
- /package/{types/src → dist/browser}/api/internal/_client.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_client.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_client.js.map +0 -0
- /package/{types/src → dist/browser}/api/internal/_createOrUpdateRegistrationDescription.d.ts +0 -0
- /package/{types/src → dist/browser}/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_createOrUpdateRegistrationDescription.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_createOrUpdateRegistrationDescription.js.map +0 -0
- /package/{types/src → dist/browser}/api/internal/_listRegistrations.d.ts +0 -0
- /package/{types/src → dist/browser}/api/internal/_listRegistrations.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_listRegistrations.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/internal/_listRegistrations.js.map +0 -0
- /package/{types/src → dist/browser}/api/listNotificationHubJobs.d.ts +0 -0
- /package/{types/src → dist/browser}/api/listNotificationHubJobs.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/listNotificationHubJobs.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/listNotificationHubJobs.js.map +0 -0
- /package/{types/src → dist/browser}/api/listRegistrations.d.ts +0 -0
- /package/{types/src → dist/browser}/api/listRegistrations.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrations.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrations.js.map +0 -0
- /package/{types/src → dist/browser}/api/listRegistrationsByChannel.d.ts +0 -0
- /package/{types/src → dist/browser}/api/listRegistrationsByChannel.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrationsByChannel.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrationsByChannel.js.map +0 -0
- /package/{types/src → dist/browser}/api/listRegistrationsByTag.d.ts +0 -0
- /package/{types/src → dist/browser}/api/listRegistrationsByTag.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrationsByTag.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/listRegistrationsByTag.js.map +0 -0
- /package/{types/src → dist/browser}/api/scheduleNotification.d.ts +0 -0
- /package/{types/src → dist/browser}/api/scheduleNotification.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/scheduleNotification.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/scheduleNotification.js.map +0 -0
- /package/{types/src → dist/browser}/api/sendNotification.d.ts +0 -0
- /package/{types/src → dist/browser}/api/sendNotification.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/sendNotification.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/sendNotification.js.map +0 -0
- /package/{types/src → dist/browser}/api/submitNotificationHubJob.d.ts +0 -0
- /package/{types/src → dist/browser}/api/submitNotificationHubJob.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/submitNotificationHubJob.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/submitNotificationHubJob.js.map +0 -0
- /package/{types/src → dist/browser}/api/updateInstallation.d.ts +0 -0
- /package/{types/src → dist/browser}/api/updateInstallation.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/updateInstallation.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/updateInstallation.js.map +0 -0
- /package/{types/src → dist/browser}/api/updateRegistration.d.ts +0 -0
- /package/{types/src → dist/browser}/api/updateRegistration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/api/updateRegistration.js +0 -0
- /package/{dist-esm/src → dist/browser}/api/updateRegistration.js.map +0 -0
- /package/{types/src → dist/browser}/auth/connectionStringUtils.d.ts +0 -0
- /package/{types/src → dist/browser}/auth/connectionStringUtils.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/auth/connectionStringUtils.js +0 -0
- /package/{dist-esm/src → dist/browser}/auth/connectionStringUtils.js.map +0 -0
- /package/{types/src → dist/browser}/auth/sasTokenCredential.d.ts +0 -0
- /package/{types/src → dist/browser}/auth/sasTokenCredential.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/auth/sasTokenCredential.js +0 -0
- /package/{dist-esm/src → dist/browser}/auth/sasTokenCredential.js.map +0 -0
- /package/{types/src → dist/browser}/index.d.ts +0 -0
- /package/{types/src → dist/browser}/index.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/index.js +0 -0
- /package/{dist-esm/src → dist/browser}/index.js.map +0 -0
- /package/{types/src → dist/browser}/models/index.d.ts +0 -0
- /package/{types/src → dist/browser}/models/index.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/index.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/index.js.map +0 -0
- /package/{types/src → dist/browser}/models/installation.d.ts +0 -0
- /package/{types/src → dist/browser}/models/installation.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/installation.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/installation.js.map +0 -0
- /package/{types/src → dist/browser}/models/notification.d.ts +0 -0
- /package/{types/src → dist/browser}/models/notification.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/notification.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/notification.js.map +0 -0
- /package/{types/src → dist/browser}/models/notificationBodyBuilder.d.ts +0 -0
- /package/{types/src → dist/browser}/models/notificationBodyBuilder.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationBodyBuilder.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationBodyBuilder.js.map +0 -0
- /package/{types/src → dist/browser}/models/notificationDetails.d.ts +0 -0
- /package/{types/src → dist/browser}/models/notificationDetails.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationDetails.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationDetails.js.map +0 -0
- /package/{types/src → dist/browser}/models/notificationHeaderBuilder.d.ts +0 -0
- /package/{types/src → dist/browser}/models/notificationHeaderBuilder.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationHeaderBuilder.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationHeaderBuilder.js.map +0 -0
- /package/{types/src → dist/browser}/models/notificationHubJob.d.ts +0 -0
- /package/{types/src → dist/browser}/models/notificationHubJob.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationHubJob.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/notificationHubJob.js.map +0 -0
- /package/{types/src → dist/browser}/models/options.d.ts +0 -0
- /package/{types/src → dist/browser}/models/options.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/options.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/options.js.map +0 -0
- /package/{types/src → dist/browser}/models/registration.d.ts +0 -0
- /package/{types/src → dist/browser}/models/registration.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/registration.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/registration.js.map +0 -0
- /package/{types/src → dist/browser}/models/response.d.ts +0 -0
- /package/{types/src → dist/browser}/models/response.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/response.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/response.js.map +0 -0
- /package/{types/src → dist/browser}/models/tagExpressionBuilder.d.ts +0 -0
- /package/{types/src → dist/browser}/models/tagExpressionBuilder.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/tagExpressionBuilder.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/tagExpressionBuilder.js.map +0 -0
- /package/{types/src → dist/browser}/notificationHubsClient.d.ts +0 -0
- /package/{types/src → dist/browser}/notificationHubsClient.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/notificationHubsClient.js +0 -0
- /package/{dist-esm/src → dist/browser}/notificationHubsClient.js.map +0 -0
- /package/{types/src → dist/browser}/serializers/notificationDetailsSerializer.d.ts +0 -0
- /package/{types/src → dist/browser}/serializers/notificationDetailsSerializer.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationDetailsSerializer.js +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationDetailsSerializer.js.map +0 -0
- /package/{types/src → dist/browser}/serializers/notificationHubJobSerializer.d.ts +0 -0
- /package/{types/src → dist/browser}/serializers/notificationHubJobSerializer.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationHubJobSerializer.js +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationHubJobSerializer.js.map +0 -0
- /package/{types/src → dist/browser}/serializers/notificationOutcomeSerializer.d.ts +0 -0
- /package/{types/src → dist/browser}/serializers/notificationOutcomeSerializer.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationOutcomeSerializer.js +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/notificationOutcomeSerializer.js.map +0 -0
- /package/{types/src → dist/browser}/serializers/registrationSerializer.d.ts +0 -0
- /package/{types/src → dist/browser}/serializers/registrationSerializer.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/registrationSerializer.js +0 -0
- /package/{dist-esm/src → dist/browser}/serializers/registrationSerializer.js.map +0 -0
- /package/{types/src → dist/browser}/utils/constants.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/constants.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/constants.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/constants.js.map +0 -0
- /package/{types/src → dist/browser}/utils/notificationUtils.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/notificationUtils.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/notificationUtils.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/notificationUtils.js.map +0 -0
- /package/{types/src → dist/browser}/utils/optionUtils.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/optionUtils.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/optionUtils.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/optionUtils.js.map +0 -0
- /package/{types/src → dist/browser}/utils/tracing.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/tracing.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/tracing.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/tracing.js.map +0 -0
- /package/{types/src → dist/browser}/utils/utils.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/utils.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/utils.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/utils.js.map +0 -0
- /package/{types/src → dist/browser}/utils/xmlUtils.d.ts +0 -0
- /package/{types/src → dist/browser}/utils/xmlUtils.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/xmlUtils.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/xmlUtils.js.map +0 -0
- /package/{types/src → dist/commonjs}/auth/hmacSha256.d.ts +0 -0
- /package/{types/src → dist/commonjs}/auth/hmacSha256.d.ts.map +0 -0
- /package/{types/latest → dist/commonjs}/tsdoc-metadata.json +0 -0
- /package/{dist-esm/src → dist/esm}/auth/hmacSha256.js +0 -0
- /package/{dist-esm/src → dist/esm}/auth/hmacSha256.js.map +0 -0
- /package/{types/latest → dist}/notification-hubs.d.ts +0 -0
package/dist/index.cjs
DELETED
|
@@ -1,2602 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
6
|
-
var crypto = require('crypto');
|
|
7
|
-
var coreClient = require('@azure-rest/core-client');
|
|
8
|
-
var coreUtil = require('@azure/core-util');
|
|
9
|
-
var coreXml = require('@azure/core-xml');
|
|
10
|
-
var coreTracing = require('@azure/core-tracing');
|
|
11
|
-
var tslib = require('tslib');
|
|
12
|
-
|
|
13
|
-
// Copyright (c) Microsoft Corporation.
|
|
14
|
-
// Licensed under the MIT license.
|
|
15
|
-
const SDK_VERSION = "1.2.1";
|
|
16
|
-
const JSON_CONTENT_TYPE = "application/json;charset=utf-8";
|
|
17
|
-
const XML_CONTENT_TYPE = "application/xml";
|
|
18
|
-
const STREAM_CONTENT_TYPE = "application/octet-stream";
|
|
19
|
-
const WNS_TYPE_NAME = "X-WNS-Type";
|
|
20
|
-
const WNS_RAW = "wns/raw";
|
|
21
|
-
const WNS_BADGE = "wns/badge";
|
|
22
|
-
const WNS_TITLE = "wns/tile";
|
|
23
|
-
const WNS_TOAST = "wns/toast";
|
|
24
|
-
|
|
25
|
-
// Copyright (c) Microsoft Corporation.
|
|
26
|
-
// Licensed under the MIT license.
|
|
27
|
-
async function signString(key, toSign) {
|
|
28
|
-
const hmac = crypto.createHmac("sha256", key).update(toSign).digest("base64");
|
|
29
|
-
return encodeURIComponent(hmac);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Copyright (c) Microsoft Corporation.
|
|
33
|
-
// Licensed under the MIT license.
|
|
34
|
-
/**
|
|
35
|
-
* A TokenProvider that generates a Sas token:
|
|
36
|
-
* `SharedAccessSignature sr=<resource>&sig=<signature>&se=<expiry>&skn=<keyname>`
|
|
37
|
-
*
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
class SasTokenCredential {
|
|
41
|
-
/**
|
|
42
|
-
* Initializes a new instance of SasTokenProvider
|
|
43
|
-
* @param credential - The source `NamedKeyCredential` or `SASCredential`.
|
|
44
|
-
*/
|
|
45
|
-
constructor(credential) {
|
|
46
|
-
this._credential = credential;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Gets the sas token for the specified audience
|
|
50
|
-
* @param scopes - The scope for which the token is desired.
|
|
51
|
-
*/
|
|
52
|
-
async getToken(scopes) {
|
|
53
|
-
const audience = Array.isArray(scopes) ? scopes[0] : scopes;
|
|
54
|
-
return createToken(this._credential.sharedAccessKeyName, this._credential.sharedAccessKey, Math.floor(Date.now() / 1000) + 3600, audience);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates the sas token based on the provided information.
|
|
59
|
-
* @param keyName - The shared access key name.
|
|
60
|
-
* @param key - The shared access key.
|
|
61
|
-
* @param expiry - The time period in unix time after which the token will expire.
|
|
62
|
-
* @param audience - The audience for which the token is desired.
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
async function createToken(keyName, key, expiry, audience) {
|
|
66
|
-
audience = encodeURIComponent(audience.toLowerCase());
|
|
67
|
-
keyName = encodeURIComponent(keyName);
|
|
68
|
-
const stringToSign = audience + "\n" + expiry;
|
|
69
|
-
const sig = await signString(key, stringToSign);
|
|
70
|
-
return {
|
|
71
|
-
token: `SharedAccessSignature sr=${audience}&sig=${sig}&se=${expiry}&skn=${keyName}`,
|
|
72
|
-
expiresOnTimestamp: expiry,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Copyright (c) Microsoft Corporation.
|
|
77
|
-
// Licensed under the MIT license.
|
|
78
|
-
/**
|
|
79
|
-
* Parses the connection string and returns an object of type T.
|
|
80
|
-
*
|
|
81
|
-
* Connection strings have the following syntax:
|
|
82
|
-
*
|
|
83
|
-
* ConnectionString ::= `Part { ";" Part } [ ";" ] [ WhiteSpace ]`
|
|
84
|
-
* Part ::= [ PartLiteral [ "=" PartLiteral ] ]
|
|
85
|
-
* PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ]
|
|
86
|
-
* Literal ::= ? any sequence of characters except ; or = or WhiteSpace ?
|
|
87
|
-
* WhiteSpace ::= ? all whitespace characters including `\r` and `\n` ?
|
|
88
|
-
*
|
|
89
|
-
* @param connectionString - The connection string to be parsed.
|
|
90
|
-
* @returns ParsedOutput<T>.
|
|
91
|
-
*/
|
|
92
|
-
function parseConnectionString(connectionString) {
|
|
93
|
-
const output = {};
|
|
94
|
-
const parts = connectionString.trim().split(";");
|
|
95
|
-
for (let part of parts) {
|
|
96
|
-
part = part.trim();
|
|
97
|
-
if (part === "") {
|
|
98
|
-
// parts can be empty
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
const splitIndex = part.indexOf("=");
|
|
102
|
-
if (splitIndex === -1) {
|
|
103
|
-
throw new Error("Connection string malformed: each part of the connection string must have an `=` assignment.");
|
|
104
|
-
}
|
|
105
|
-
const key = part.substring(0, splitIndex).trim();
|
|
106
|
-
if (key === "") {
|
|
107
|
-
throw new Error("Connection string malformed: missing key for assignment");
|
|
108
|
-
}
|
|
109
|
-
const value = part.substring(splitIndex + 1).trim();
|
|
110
|
-
output[key] = value;
|
|
111
|
-
}
|
|
112
|
-
return output;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Creates a SasTokenCredential from a shared access key and shared access key name.
|
|
116
|
-
* @param sharedAccessKey - The shared access key value.
|
|
117
|
-
* @param sharedAccessKeyName - The shared access key name.
|
|
118
|
-
* @returns A SasTokenCredential with the given shared access token information.
|
|
119
|
-
*/
|
|
120
|
-
function createTokenCredentialFromConnection(sharedAccessKey, sharedAccessKeyName) {
|
|
121
|
-
return new SasTokenCredential({ sharedAccessKey, sharedAccessKeyName });
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Parses given connection string into the different properties applicable to Azure Service Bus.
|
|
125
|
-
* The properties are useful to then construct a ServiceBusClient.
|
|
126
|
-
* @param connectionString - The connection string associated with the Shared Access Policy created
|
|
127
|
-
* for the Service Bus namespace, queue or topic.
|
|
128
|
-
*/
|
|
129
|
-
function parseNotificationHubsConnectionString(connectionString) {
|
|
130
|
-
const parsedResult = parseConnectionString(connectionString);
|
|
131
|
-
if (!parsedResult.Endpoint) {
|
|
132
|
-
throw new Error("Connection string should have an Endpoint key.");
|
|
133
|
-
}
|
|
134
|
-
if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {
|
|
135
|
-
throw new Error("Connection string with SharedAccessKey should have SharedAccessKeyName.");
|
|
136
|
-
}
|
|
137
|
-
else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {
|
|
138
|
-
throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
|
|
139
|
-
}
|
|
140
|
-
const output = {
|
|
141
|
-
endpoint: parsedResult.Endpoint,
|
|
142
|
-
sharedAccessKey: parsedResult.SharedAccessKey,
|
|
143
|
-
sharedAccessKeyName: parsedResult.SharedAccessKeyName,
|
|
144
|
-
};
|
|
145
|
-
return output;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Copyright (c) Microsoft Corporation.
|
|
149
|
-
// Licensed under the MIT license.
|
|
150
|
-
const API_VERSION = "2020-06";
|
|
151
|
-
/**
|
|
152
|
-
* Creates a NotificationHubClient from the Access Policy connection string and hub name.
|
|
153
|
-
* @param connectionString - The Access Policy connection string for the notification hub.
|
|
154
|
-
* @param hubName - The notification hub name.
|
|
155
|
-
* @returns A NotificationHubsClientContext initialized from the connection string and hub name.
|
|
156
|
-
*/
|
|
157
|
-
function createClientContext(connectionString, hubName, options = {}) {
|
|
158
|
-
return new NotificationHubsServiceClient(connectionString, hubName, options);
|
|
159
|
-
}
|
|
160
|
-
class NotificationHubsServiceClient {
|
|
161
|
-
constructor(connectionString, hubName, options = {}) {
|
|
162
|
-
var _a, _b;
|
|
163
|
-
this.hubName = hubName;
|
|
164
|
-
const parsedConnection = parseNotificationHubsConnectionString(connectionString);
|
|
165
|
-
// Node doesn't allow change in protocol but browsers do, so doing a string replace
|
|
166
|
-
this.baseUrl = parsedConnection.endpoint.replace("sb://", "https://");
|
|
167
|
-
this.sasTokenCredential = createTokenCredentialFromConnection(parsedConnection.sharedAccessKey, parsedConnection.sharedAccessKeyName);
|
|
168
|
-
const packageDetails = `azsdk-js-notificationhubs/${SDK_VERSION}`;
|
|
169
|
-
const userAgentPrefix = ((_a = options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
|
|
170
|
-
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
171
|
-
: `${packageDetails}`;
|
|
172
|
-
this.httpClient = (_b = options === null || options === void 0 ? void 0 : options.httpClient) !== null && _b !== void 0 ? _b : coreRestPipeline.createDefaultHttpClient();
|
|
173
|
-
this.client = coreClient.getClient(this.baseUrl, Object.assign({ userAgentOptions: {
|
|
174
|
-
userAgentPrefix,
|
|
175
|
-
} }, options));
|
|
176
|
-
}
|
|
177
|
-
async createHeaders(operationName, rawHeaders) {
|
|
178
|
-
const authorization = await this.sasTokenCredential.getToken(this.baseUrl);
|
|
179
|
-
if (!authorization) {
|
|
180
|
-
throw new coreRestPipeline.RestError("Failed to get the authorization header", { statusCode: 401 });
|
|
181
|
-
}
|
|
182
|
-
const headers = coreRestPipeline.createHttpHeaders(rawHeaders);
|
|
183
|
-
headers.set("Authorization", authorization.token);
|
|
184
|
-
headers.set("x-ms-version", API_VERSION);
|
|
185
|
-
headers.set("x-ms-azsdk-telemetry", `class=NotificationHubsServiceClient;method=${operationName}`);
|
|
186
|
-
return headers;
|
|
187
|
-
}
|
|
188
|
-
sendRequest(request) {
|
|
189
|
-
return this.client.pipeline.sendRequest(this.httpClient, request);
|
|
190
|
-
}
|
|
191
|
-
requestUrl() {
|
|
192
|
-
const url = new URL(this.baseUrl);
|
|
193
|
-
url.pathname = this.hubName;
|
|
194
|
-
url.searchParams.set("api-version", API_VERSION);
|
|
195
|
-
return url;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Copyright (c) Microsoft Corporation.
|
|
200
|
-
// Licensed under the MIT license.
|
|
201
|
-
/**
|
|
202
|
-
* Helper TypeGuard that checks if something is defined or not.
|
|
203
|
-
* @param thing - Anything
|
|
204
|
-
* @internal
|
|
205
|
-
*/
|
|
206
|
-
function isDefined(thing) {
|
|
207
|
-
return typeof thing !== "undefined" && thing !== null;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* @internal
|
|
211
|
-
* Helper utility to retrieve `string` value from given string,
|
|
212
|
-
* or throws error if undefined.
|
|
213
|
-
*/
|
|
214
|
-
function getString(value, nameOfProperty) {
|
|
215
|
-
const result = getStringOrUndefined(value);
|
|
216
|
-
if (result === undefined) {
|
|
217
|
-
throw new Error(`"${nameOfProperty}" received from service expected to be a string value and not undefined.`);
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @internal
|
|
223
|
-
* Helper utility to retrieve `string` value from given input,
|
|
224
|
-
* or undefined if not passed in.
|
|
225
|
-
*/
|
|
226
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
227
|
-
function getStringOrUndefined(value) {
|
|
228
|
-
if (!isDefined(value)) {
|
|
229
|
-
return undefined;
|
|
230
|
-
}
|
|
231
|
-
return value.toString();
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @internal
|
|
235
|
-
* Helper utility to retrieve `integer` value from given string,
|
|
236
|
-
* or throws error if undefined.
|
|
237
|
-
*/
|
|
238
|
-
function getInteger(value, nameOfProperty) {
|
|
239
|
-
const result = getIntegerOrUndefined(value);
|
|
240
|
-
if (result === undefined) {
|
|
241
|
-
throw new Error(`"${nameOfProperty}" received from service expected to be a number value and not undefined.`);
|
|
242
|
-
}
|
|
243
|
-
return result;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* @internal
|
|
247
|
-
* Helper utility to retrieve `integer` value from given string,
|
|
248
|
-
* or undefined if not passed in.
|
|
249
|
-
*/
|
|
250
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
251
|
-
function getIntegerOrUndefined(value) {
|
|
252
|
-
if (!isDefined(value)) {
|
|
253
|
-
return undefined;
|
|
254
|
-
}
|
|
255
|
-
const result = parseInt(value.toString());
|
|
256
|
-
return isNaN(result) ? undefined : result;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* @internal
|
|
260
|
-
* Helper utility to retrieve `float` value from given string,
|
|
261
|
-
* or undefined if not passed in.
|
|
262
|
-
*/
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
264
|
-
function getFloatOrUndefined(value) {
|
|
265
|
-
if (!isDefined(value)) {
|
|
266
|
-
return undefined;
|
|
267
|
-
}
|
|
268
|
-
const result = parseFloat(value.toString());
|
|
269
|
-
return Number.isNaN(result) ? undefined : result;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* @internal
|
|
273
|
-
* Helper utility to convert ISO-8601 time into Date type,
|
|
274
|
-
* or undefined if not passed in.
|
|
275
|
-
*/
|
|
276
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
277
|
-
function getDateOrUndefined(value) {
|
|
278
|
-
const stringValue = getStringOrUndefined(value);
|
|
279
|
-
if (stringValue === undefined) {
|
|
280
|
-
return undefined;
|
|
281
|
-
}
|
|
282
|
-
const result = new Date(stringValue.toString());
|
|
283
|
-
return Number.isNaN(+result) ? undefined : result;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* @internal
|
|
287
|
-
* Helper utility to parse tags from a comma separated string.
|
|
288
|
-
*/
|
|
289
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
290
|
-
function getTagsOrUndefined(value) {
|
|
291
|
-
const result = getStringOrUndefined(value);
|
|
292
|
-
if (result === undefined) {
|
|
293
|
-
return undefined;
|
|
294
|
-
}
|
|
295
|
-
return result.split(",");
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Copyright (c) Microsoft Corporation.
|
|
299
|
-
// Licensed under the MIT license.
|
|
300
|
-
async function parseNotificationOutcome(bodyText) {
|
|
301
|
-
const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
302
|
-
const outcome = xml.NotificationOutcome;
|
|
303
|
-
return {
|
|
304
|
-
successCount: getInteger(outcome.Success, "Success"),
|
|
305
|
-
failureCount: getInteger(outcome.Failure, "Failure"),
|
|
306
|
-
results: parseRegistrationResults(outcome.Results.RegistrationResult),
|
|
307
|
-
state: "DetailedStateAvailable",
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function parseRegistrationResults(results) {
|
|
311
|
-
const registrationResults = [];
|
|
312
|
-
if (!isDefined(results)) {
|
|
313
|
-
return registrationResults;
|
|
314
|
-
}
|
|
315
|
-
const resultsArray = Array.isArray(results) ? results : [results];
|
|
316
|
-
for (const result of resultsArray) {
|
|
317
|
-
registrationResults.push({
|
|
318
|
-
applicationPlatform: getString(result.ApplicationPlatform, "ApplicationPlatform"),
|
|
319
|
-
registrationId: getString(result.RegistrationId, "RegistrationId"),
|
|
320
|
-
outcome: getString(result.Outcome, "Outcome"),
|
|
321
|
-
pnsHandle: getString(result.PnsHandle, "PnsHandle"),
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return registrationResults;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// Copyright (c) Microsoft Corporation.
|
|
328
|
-
// Licensed under the MIT license.
|
|
329
|
-
/**
|
|
330
|
-
* Marker for atom metadata.
|
|
331
|
-
*
|
|
332
|
-
* @internal
|
|
333
|
-
*/
|
|
334
|
-
const XML_METADATA_MARKER = "$";
|
|
335
|
-
/**
|
|
336
|
-
* @internal
|
|
337
|
-
* Helps in differentiating JSON like objects from other kinds of objects.
|
|
338
|
-
*/
|
|
339
|
-
const EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;
|
|
340
|
-
/**
|
|
341
|
-
* @internal
|
|
342
|
-
* Returns `true` if given input is a JSON like object.
|
|
343
|
-
*/
|
|
344
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
345
|
-
function isJSONLikeObject(value) {
|
|
346
|
-
// `value.constructor === {}.constructor` differentiates among the "object"s,
|
|
347
|
-
// would filter the JSON objects and won't match any array or other kinds of objects
|
|
348
|
-
// -------------------------------------------------------------------------------
|
|
349
|
-
// Few examples | typeof obj ==="object" | obj.constructor==={}.constructor
|
|
350
|
-
// -------------------------------------------------------------------------------
|
|
351
|
-
// {abc:1} | true | true
|
|
352
|
-
// ["a","b"] | true | false
|
|
353
|
-
// [{"a":1},{"b":2}] | true | false
|
|
354
|
-
// new Date() | true | false
|
|
355
|
-
// 123 | false | false
|
|
356
|
-
// -------------------------------------------------------------------------------
|
|
357
|
-
return typeof value === "object" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* @internal
|
|
361
|
-
* The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.
|
|
362
|
-
* Empty tags in the request body is problematic because of the following reasons.
|
|
363
|
-
* - ATOM based management operations throw a "Bad Request" error if empty tags are included in the XML request body at top level.
|
|
364
|
-
* - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.
|
|
365
|
-
*
|
|
366
|
-
* This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.
|
|
367
|
-
*
|
|
368
|
-
*/
|
|
369
|
-
function sanitizeSerializableObject(resource) {
|
|
370
|
-
Object.keys(resource).forEach(function (property) {
|
|
371
|
-
if (!isDefined(resource[property])) {
|
|
372
|
-
delete resource[property];
|
|
373
|
-
}
|
|
374
|
-
else if (isJSONLikeObject(resource[property])) {
|
|
375
|
-
sanitizeSerializableObject(resource[property]);
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* @internal
|
|
381
|
-
* Serializes input information to construct the Atom XML request
|
|
382
|
-
* @param resourceName - Name of the resource to be serialized like `QueueDescription`
|
|
383
|
-
* @param resource - The entity details
|
|
384
|
-
* @returns An object to be serialized into a string.
|
|
385
|
-
*/
|
|
386
|
-
function serializeToAtomXmlRequest(resourceName, resource) {
|
|
387
|
-
const content = {};
|
|
388
|
-
content[resourceName] = Object.assign({}, resource);
|
|
389
|
-
sanitizeSerializableObject(content[resourceName]);
|
|
390
|
-
content[resourceName][XML_METADATA_MARKER] = {
|
|
391
|
-
xmlns: "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect",
|
|
392
|
-
"xmlns:i": "http://www.w3.org/2001/XMLSchema-instance",
|
|
393
|
-
};
|
|
394
|
-
content[XML_METADATA_MARKER] = { type: "application/xml" };
|
|
395
|
-
const requestDetails = {
|
|
396
|
-
updated: new Date().toISOString(),
|
|
397
|
-
content: content,
|
|
398
|
-
};
|
|
399
|
-
requestDetails[XML_METADATA_MARKER] = {
|
|
400
|
-
xmlns: "http://www.w3.org/2005/Atom",
|
|
401
|
-
};
|
|
402
|
-
return requestDetails;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* @internal
|
|
406
|
-
* Parses the XML message from a Notification Hubs response
|
|
407
|
-
* @param bodyText - The HTTP response body.
|
|
408
|
-
* @returns The notification details if any from the XML.
|
|
409
|
-
*/
|
|
410
|
-
async function parseXMLError(bodyText) {
|
|
411
|
-
let result;
|
|
412
|
-
const xmlError = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
413
|
-
const detail = xmlError["Error"]["Detail"];
|
|
414
|
-
if (isDefined(detail)) {
|
|
415
|
-
return detail;
|
|
416
|
-
}
|
|
417
|
-
return result;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// Copyright (c) Microsoft Corporation.
|
|
421
|
-
// Licensed under the MIT license.
|
|
422
|
-
function createRequest(endpoint, method, headers, options) {
|
|
423
|
-
return coreRestPipeline.createPipelineRequest(Object.assign(Object.assign(Object.assign({}, options.tracingOptions), options.requestOptions), { url: endpoint.toString(), abortSignal: options.abortSignal, method,
|
|
424
|
-
headers }));
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.
|
|
428
|
-
* @param response - The HTTP response used to populate the result.
|
|
429
|
-
* @returns A NotificationHubsResponse with header information from the operation.
|
|
430
|
-
*/
|
|
431
|
-
function parseNotificationResponse(response) {
|
|
432
|
-
const correlationId = response.headers.get("x-ms-correlation-request-id");
|
|
433
|
-
const trackingId = response.headers.get("TrackingId");
|
|
434
|
-
const location = response.headers.get("Location");
|
|
435
|
-
return {
|
|
436
|
-
correlationId,
|
|
437
|
-
trackingId,
|
|
438
|
-
location,
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.
|
|
443
|
-
* @param response - The HTTP response used to populate the result.
|
|
444
|
-
* @returns A NotificationHubsMessageResponse with results from the notification.
|
|
445
|
-
*/
|
|
446
|
-
async function parseNotificationSendResponse(response) {
|
|
447
|
-
const result = parseNotificationResponse(response);
|
|
448
|
-
let notificationId;
|
|
449
|
-
if (result.location) {
|
|
450
|
-
const locationUrl = new URL(result.location);
|
|
451
|
-
notificationId = locationUrl.pathname.split("/")[3];
|
|
452
|
-
}
|
|
453
|
-
const requestUrl = new URL(response.request.url);
|
|
454
|
-
const isTestSend = requestUrl.searchParams.has("test");
|
|
455
|
-
const isDirectSend = requestUrl.searchParams.has("direct");
|
|
456
|
-
// Only broadcast/tag based sends are supported for test send
|
|
457
|
-
const responseBody = response.bodyAsText;
|
|
458
|
-
if (isTestSend && !isDirectSend && isDefined(responseBody)) {
|
|
459
|
-
const outcome = await parseNotificationOutcome(responseBody);
|
|
460
|
-
return Object.assign(Object.assign(Object.assign({}, result), outcome), { notificationId });
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
return createDefaultResponse(result, notificationId);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
function createDefaultResponse(response, notificationId) {
|
|
467
|
-
return Object.assign(Object.assign({}, response), { notificationId, successCount: 0, failureCount: 0, results: [], state: "Enqueued" });
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Sends a request through the client context.
|
|
471
|
-
* @param context - The client context to use.
|
|
472
|
-
* @param request - The HTTP request to send.
|
|
473
|
-
* @param successStatusCode - A status code or list of status codes to check for success.
|
|
474
|
-
* @returns The HTTP Response.
|
|
475
|
-
*/
|
|
476
|
-
async function sendRequest(context, request, successStatusCode) {
|
|
477
|
-
const statuses = Array.isArray(successStatusCode)
|
|
478
|
-
? successStatusCode
|
|
479
|
-
: [successStatusCode];
|
|
480
|
-
const response = await context.sendRequest(request);
|
|
481
|
-
if (!statuses.some((statusCode) => statusCode === response.status)) {
|
|
482
|
-
const responseBody = response.bodyAsText;
|
|
483
|
-
let details;
|
|
484
|
-
if (isDefined(responseBody)) {
|
|
485
|
-
try {
|
|
486
|
-
details = await parseXMLError(responseBody);
|
|
487
|
-
}
|
|
488
|
-
catch (err) {
|
|
489
|
-
// eslint-disable no-empty
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
let errorMessage;
|
|
493
|
-
if (isDefined(details)) {
|
|
494
|
-
errorMessage = `operations failed with: ${details}`;
|
|
495
|
-
}
|
|
496
|
-
else {
|
|
497
|
-
errorMessage = `operation failed with status ${response.status}`;
|
|
498
|
-
}
|
|
499
|
-
throw new coreRestPipeline.RestError(errorMessage, {
|
|
500
|
-
statusCode: response.status,
|
|
501
|
-
response,
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
return response;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
// Copyright (c) Microsoft Corporation.
|
|
508
|
-
// Licensed under the MIT license.
|
|
509
|
-
/**
|
|
510
|
-
* @internal
|
|
511
|
-
* Serializes a NotificationHubJob into an Atom XML entry.
|
|
512
|
-
* @param entry - The NotificationHubJob to turn into an Atom XML entry.
|
|
513
|
-
* @returns An Atom XML entry containing the notification hub job.
|
|
514
|
-
*/
|
|
515
|
-
function serializeNotificationHubJobEntry(entry) {
|
|
516
|
-
const job = {
|
|
517
|
-
Type: entry.type,
|
|
518
|
-
OutputContainerUri: { __cdata: entry.outputContainerUrl },
|
|
519
|
-
ImportFileUri: isDefined(entry.importFileUrl) ? { __cdata: entry.importFileUrl } : undefined,
|
|
520
|
-
};
|
|
521
|
-
const requestObject = serializeToAtomXmlRequest("NotificationHubJob", job);
|
|
522
|
-
return coreXml.stringifyXML(requestObject, { rootName: "entry", cdataPropName: "__cdata" });
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Parses an Atom XML of an notification hub job entry.
|
|
526
|
-
* @param bodyText - The incoming Atom XML entry to parse into a notification hub job.
|
|
527
|
-
* @returns A parsed NotificationHubJob.
|
|
528
|
-
*/
|
|
529
|
-
async function parseNotificationHubJobEntry(bodyText) {
|
|
530
|
-
const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
531
|
-
const content = xml.entry.content.NotificationHubJob;
|
|
532
|
-
return createNotificationHubJob(content);
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Parses an Atom XML feed of notification hub jobs.
|
|
536
|
-
* @param bodyText - The incoming Atom XML feed to parse into notification hub jobs.
|
|
537
|
-
* @returns A list of notification hub jobs.
|
|
538
|
-
*/
|
|
539
|
-
async function parseNotificationHubJobFeed(bodyText) {
|
|
540
|
-
const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
541
|
-
const results = [];
|
|
542
|
-
if (!isDefined(xml.feed.entry)) {
|
|
543
|
-
return results;
|
|
544
|
-
}
|
|
545
|
-
const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];
|
|
546
|
-
for (const item of entries) {
|
|
547
|
-
results.push(createNotificationHubJob(item.content.NotificationHubJob));
|
|
548
|
-
}
|
|
549
|
-
return results;
|
|
550
|
-
}
|
|
551
|
-
function createInputOutputProperties(content) {
|
|
552
|
-
const props = {};
|
|
553
|
-
const keyValues = content["d3p1:KeyValueOfstringstring"];
|
|
554
|
-
const keyValueArray = Array.isArray(keyValues) ? keyValues : [keyValues];
|
|
555
|
-
for (const item of keyValueArray) {
|
|
556
|
-
props[item["d3p1:Key"]] = item["d3p1:Value"];
|
|
557
|
-
}
|
|
558
|
-
return props;
|
|
559
|
-
}
|
|
560
|
-
function createNotificationHubJob(content) {
|
|
561
|
-
let outputProperties;
|
|
562
|
-
if (isDefined(content["OutputProperties"])) {
|
|
563
|
-
outputProperties = createInputOutputProperties(content["OutputProperties"]);
|
|
564
|
-
}
|
|
565
|
-
let inputProperties;
|
|
566
|
-
if (isDefined(content["InputProperties"])) {
|
|
567
|
-
inputProperties = createInputOutputProperties(content["InputProperties"]);
|
|
568
|
-
}
|
|
569
|
-
return {
|
|
570
|
-
jobId: getStringOrUndefined(content["JobId"]),
|
|
571
|
-
type: getString(content["Type"], "type"),
|
|
572
|
-
status: getStringOrUndefined(content["Status"]),
|
|
573
|
-
progress: getFloatOrUndefined(content["Progress"]),
|
|
574
|
-
outputContainerUrl: getString(content["OutputContainerUri"], "outputContainerUrl"),
|
|
575
|
-
importFileUrl: getStringOrUndefined(content["ImportFileUri"]),
|
|
576
|
-
failure: getStringOrUndefined(content["Failure"]),
|
|
577
|
-
createdAt: getDateOrUndefined(content["CreatedAt"]),
|
|
578
|
-
updatedAt: getDateOrUndefined(content["UpdatedAt"]),
|
|
579
|
-
inputProperties,
|
|
580
|
-
outputProperties,
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
// Copyright (c) Microsoft Corporation.
|
|
585
|
-
// Licensed under the MIT license.
|
|
586
|
-
/**
|
|
587
|
-
* A tracing client to handle spans.
|
|
588
|
-
* @internal
|
|
589
|
-
*/
|
|
590
|
-
const tracingClient = coreTracing.createTracingClient({
|
|
591
|
-
namespace: "Microsoft.NotificationHubs",
|
|
592
|
-
packageName: "@azure/notification-hubs",
|
|
593
|
-
packageVersion: SDK_VERSION,
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
// Copyright (c) Microsoft Corporation.
|
|
597
|
-
// Licensed under the MIT license.
|
|
598
|
-
const OPERATION_NAME$g = "getNotificationHubJob";
|
|
599
|
-
/**
|
|
600
|
-
* Gets a Notification Hub Job by the ID.
|
|
601
|
-
* @param context - The Notification Hubs client.
|
|
602
|
-
* @param jobId - The Notification Hub Job ID.
|
|
603
|
-
* @param options - The operation options.
|
|
604
|
-
* @returns The Notification Hub Job with the matching ID.
|
|
605
|
-
*/
|
|
606
|
-
function getNotificationHubJob(context, jobId, options = {}) {
|
|
607
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$g}`, options, async (updatedOptions) => {
|
|
608
|
-
const endpoint = context.requestUrl();
|
|
609
|
-
endpoint.pathname += `/jobs/${jobId}`;
|
|
610
|
-
const headers = await context.createHeaders(OPERATION_NAME$g);
|
|
611
|
-
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
612
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
613
|
-
const response = await sendRequest(context, request, 200);
|
|
614
|
-
return parseNotificationHubJobEntry(response.bodyAsText);
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// Copyright (c) Microsoft Corporation.
|
|
619
|
-
// Licensed under the MIT license.
|
|
620
|
-
const OPERATION_NAME$f = "submitNotificationHubJob";
|
|
621
|
-
/**
|
|
622
|
-
* Submits a Notification Hub Job.
|
|
623
|
-
* Note: this is available to Standard SKU namespace and above.
|
|
624
|
-
* @param context - The Notification Hubs client.
|
|
625
|
-
* @param job - The notification hub job to submit.
|
|
626
|
-
* @param options - The operation options.
|
|
627
|
-
* @returns The notification hub job details including job ID and status.
|
|
628
|
-
*/
|
|
629
|
-
function submitNotificationHubJob(context, job, options = {}) {
|
|
630
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$f}`, options, async (updatedOptions) => {
|
|
631
|
-
const endpoint = context.requestUrl();
|
|
632
|
-
endpoint.pathname += "/jobs";
|
|
633
|
-
const headers = await context.createHeaders(OPERATION_NAME$f);
|
|
634
|
-
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
635
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
636
|
-
request.body = serializeNotificationHubJobEntry(job);
|
|
637
|
-
const response = await sendRequest(context, request, 201);
|
|
638
|
-
return parseNotificationHubJobEntry(response.bodyAsText);
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// Copyright (c) Microsoft Corporation.
|
|
643
|
-
// Licensed under the MIT license.
|
|
644
|
-
/**
|
|
645
|
-
* Submits a Notification Hub job and creates a poller to poll for results.
|
|
646
|
-
* @param context - The Notification Hubs client.
|
|
647
|
-
* @param notificationHubJob - The Notification Hub import/export job to start.
|
|
648
|
-
* @param options - The operation options.
|
|
649
|
-
* @returns A poller which can be called to poll until completion of the job.
|
|
650
|
-
*/
|
|
651
|
-
async function beginSubmitNotificationHubJob(context, notificationHubJob, polledOperationOptions = {}) {
|
|
652
|
-
var _a;
|
|
653
|
-
let submittedJob = await submitNotificationHubJob(context, notificationHubJob, polledOperationOptions);
|
|
654
|
-
const state = {
|
|
655
|
-
status: "notStarted",
|
|
656
|
-
};
|
|
657
|
-
const progressCallbacks = new Map();
|
|
658
|
-
const processProgressCallbacks = async () => progressCallbacks.forEach((h) => h(state));
|
|
659
|
-
let resultPromise;
|
|
660
|
-
const abortController = new AbortController();
|
|
661
|
-
const currentPollIntervalInMs = (_a = polledOperationOptions.updateIntervalInMs) !== null && _a !== void 0 ? _a : 2000;
|
|
662
|
-
const poller = {
|
|
663
|
-
async poll(options) {
|
|
664
|
-
submittedJob = await getNotificationHubJob(context, submittedJob.jobId, options);
|
|
665
|
-
if (submittedJob.status === "Running" || submittedJob.status === "Started") {
|
|
666
|
-
state.status = "running";
|
|
667
|
-
}
|
|
668
|
-
if (submittedJob.status === "Completed") {
|
|
669
|
-
state.status = "succeeded";
|
|
670
|
-
state.result = submittedJob;
|
|
671
|
-
}
|
|
672
|
-
if (submittedJob.status === "Failed") {
|
|
673
|
-
state.status = "failed";
|
|
674
|
-
state.error = new Error(submittedJob.failure);
|
|
675
|
-
}
|
|
676
|
-
await processProgressCallbacks();
|
|
677
|
-
if (state.status === "canceled") {
|
|
678
|
-
throw new Error("Operation was canceled");
|
|
679
|
-
}
|
|
680
|
-
if (state.status === "failed") {
|
|
681
|
-
throw state.error;
|
|
682
|
-
}
|
|
683
|
-
},
|
|
684
|
-
pollUntilDone(pollOptions) {
|
|
685
|
-
return (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => {
|
|
686
|
-
const { abortSignal: inputAbortSignal } = pollOptions || {};
|
|
687
|
-
// In the future we can use AbortSignal.any() instead
|
|
688
|
-
function abortListener() {
|
|
689
|
-
abortController.abort();
|
|
690
|
-
}
|
|
691
|
-
const abortSignal = abortController.signal;
|
|
692
|
-
if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
|
|
693
|
-
abortController.abort();
|
|
694
|
-
}
|
|
695
|
-
else if (!abortSignal.aborted) {
|
|
696
|
-
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, { once: true });
|
|
697
|
-
}
|
|
698
|
-
try {
|
|
699
|
-
if (!poller.isDone()) {
|
|
700
|
-
await poller.poll({ abortSignal });
|
|
701
|
-
while (!poller.isDone()) {
|
|
702
|
-
await coreUtil.delay(currentPollIntervalInMs, { abortSignal });
|
|
703
|
-
await poller.poll({ abortSignal });
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
finally {
|
|
708
|
-
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener);
|
|
709
|
-
}
|
|
710
|
-
switch (state.status) {
|
|
711
|
-
case "succeeded":
|
|
712
|
-
return poller.getResult();
|
|
713
|
-
case "canceled":
|
|
714
|
-
throw new Error("Operation was canceled");
|
|
715
|
-
case "failed":
|
|
716
|
-
throw state.error;
|
|
717
|
-
case "notStarted":
|
|
718
|
-
case "running":
|
|
719
|
-
throw new Error(`Polling completed without succeeding or failing`);
|
|
720
|
-
}
|
|
721
|
-
})().finally(() => {
|
|
722
|
-
resultPromise = undefined;
|
|
723
|
-
})));
|
|
724
|
-
},
|
|
725
|
-
onProgress(callback) {
|
|
726
|
-
const s = Symbol();
|
|
727
|
-
progressCallbacks.set(s, callback);
|
|
728
|
-
return () => progressCallbacks.delete(s);
|
|
729
|
-
},
|
|
730
|
-
isDone() {
|
|
731
|
-
return ["succeeded", "failed", "canceled"].includes(state.status);
|
|
732
|
-
},
|
|
733
|
-
stopPolling() {
|
|
734
|
-
abortController.abort();
|
|
735
|
-
},
|
|
736
|
-
isStopped() {
|
|
737
|
-
return resultPromise === undefined;
|
|
738
|
-
},
|
|
739
|
-
getOperationState() {
|
|
740
|
-
return state;
|
|
741
|
-
},
|
|
742
|
-
getResult() {
|
|
743
|
-
return state.result;
|
|
744
|
-
},
|
|
745
|
-
toString() {
|
|
746
|
-
return JSON.stringify({ state });
|
|
747
|
-
},
|
|
748
|
-
};
|
|
749
|
-
return poller;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// Copyright (c) Microsoft Corporation.
|
|
753
|
-
// Licensed under the MIT license.
|
|
754
|
-
const OPERATION_NAME$e = "cancelScheduledNotification";
|
|
755
|
-
/**
|
|
756
|
-
* Cancels the scheduled notification with the given notification ID.
|
|
757
|
-
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
758
|
-
* @param context - The Notification Hubs client.
|
|
759
|
-
* @param notificationId - The notification ID from the scheduled notification.
|
|
760
|
-
* @param options - The operation options.
|
|
761
|
-
* @returns A notification hub response with correlation ID and tracking ID.
|
|
762
|
-
*/
|
|
763
|
-
function cancelScheduledNotification(context, notificationId, options = {}) {
|
|
764
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$e}`, options, async (updatedOptions) => {
|
|
765
|
-
const endpoint = context.requestUrl();
|
|
766
|
-
endpoint.pathname += `/schedulednotifications/${notificationId}`;
|
|
767
|
-
const headers = await context.createHeaders(OPERATION_NAME$e);
|
|
768
|
-
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
769
|
-
const response = await sendRequest(context, request, 200);
|
|
770
|
-
return parseNotificationSendResponse(response);
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// Copyright (c) Microsoft Corporation.
|
|
775
|
-
// Licensed under the MIT license.
|
|
776
|
-
const OPERATION_NAME$d = "createOrUpdateInstallation";
|
|
777
|
-
/**
|
|
778
|
-
* Creates or overwrites an installation to a Notification Hub.
|
|
779
|
-
* @param context - The Notification Hubs client.
|
|
780
|
-
* @param installation - The installation to create or overwrite.
|
|
781
|
-
* @param options - Configuration options for the create or update installation operation.
|
|
782
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
783
|
-
*/
|
|
784
|
-
function createOrUpdateInstallation(context, installation, options = {}) {
|
|
785
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$d}`, options, async (updatedOptions) => {
|
|
786
|
-
const endpoint = context.requestUrl();
|
|
787
|
-
endpoint.pathname += `/installations/${installation.installationId}`;
|
|
788
|
-
const headers = await context.createHeaders(OPERATION_NAME$d);
|
|
789
|
-
headers.set("Content-Type", "application/json");
|
|
790
|
-
const request = createRequest(endpoint, "PUT", headers, updatedOptions);
|
|
791
|
-
request.body = JSON.stringify(installation);
|
|
792
|
-
const response = await sendRequest(context, request, 200);
|
|
793
|
-
return parseNotificationResponse(response);
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
// Copyright (c) Microsoft Corporation.
|
|
798
|
-
// Licensed under the MIT license.
|
|
799
|
-
const registrationDescriptionParser = {
|
|
800
|
-
/**
|
|
801
|
-
* @internal
|
|
802
|
-
* Creates a registration type from the incoming entry.
|
|
803
|
-
*/
|
|
804
|
-
async parseRegistrationEntry(bodyText) {
|
|
805
|
-
const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
806
|
-
delete xml.entry.content["$"];
|
|
807
|
-
const keyName = Object.keys(xml.entry.content)[0];
|
|
808
|
-
const content = xml.entry.content[keyName];
|
|
809
|
-
const methodName = `create${keyName}`;
|
|
810
|
-
const method = this[methodName];
|
|
811
|
-
if (!methodName) {
|
|
812
|
-
throw new coreRestPipeline.RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });
|
|
813
|
-
}
|
|
814
|
-
return method.call(this, content);
|
|
815
|
-
},
|
|
816
|
-
/**
|
|
817
|
-
* @internal
|
|
818
|
-
* Creates a list of registrations from an incoming ATOM XML Feed.
|
|
819
|
-
*/
|
|
820
|
-
async parseRegistrationFeed(bodyText) {
|
|
821
|
-
const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
|
|
822
|
-
const results = [];
|
|
823
|
-
if (!isDefined(xml.feed.entry)) {
|
|
824
|
-
return results;
|
|
825
|
-
}
|
|
826
|
-
const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];
|
|
827
|
-
for (const entry of entries) {
|
|
828
|
-
delete entry.content["$"];
|
|
829
|
-
const keyName = Object.keys(entry.content)[0];
|
|
830
|
-
const methodName = `create${keyName}`;
|
|
831
|
-
const content = entry.content[keyName];
|
|
832
|
-
const method = this[methodName];
|
|
833
|
-
if (!methodName) {
|
|
834
|
-
throw new coreRestPipeline.RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });
|
|
835
|
-
}
|
|
836
|
-
results.push(method.call(this, content));
|
|
837
|
-
}
|
|
838
|
-
return results;
|
|
839
|
-
},
|
|
840
|
-
/**
|
|
841
|
-
* @internal
|
|
842
|
-
* Creates an ADM registration description from incoming XML property bag.
|
|
843
|
-
*/
|
|
844
|
-
createAdmRegistrationDescription(rawRegistrationDescription) {
|
|
845
|
-
return Object.assign(Object.assign({ admRegistrationId: getString(rawRegistrationDescription["AdmRegistrationId"], "admRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Adm" });
|
|
846
|
-
},
|
|
847
|
-
/**
|
|
848
|
-
* @internal
|
|
849
|
-
* Creates an ADM template registration description from incoming XML property bag.
|
|
850
|
-
*/
|
|
851
|
-
createAdmTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
852
|
-
return Object.assign(Object.assign(Object.assign({}, this.createAdmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "AdmTemplate" });
|
|
853
|
-
},
|
|
854
|
-
/**
|
|
855
|
-
* @internal
|
|
856
|
-
* Creates an Apple registration description from incoming XML property bag.
|
|
857
|
-
*/
|
|
858
|
-
createAppleRegistrationDescription(rawRegistrationDescription) {
|
|
859
|
-
return Object.assign(Object.assign({ deviceToken: getString(rawRegistrationDescription["DeviceToken"], "deviceToken") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Apple" });
|
|
860
|
-
},
|
|
861
|
-
/**
|
|
862
|
-
* @internal
|
|
863
|
-
* Creates an Apple template registration description from incoming XML property bag.
|
|
864
|
-
*/
|
|
865
|
-
createAppleTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
866
|
-
var _a;
|
|
867
|
-
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" });
|
|
868
|
-
},
|
|
869
|
-
/**
|
|
870
|
-
* @internal
|
|
871
|
-
* Creates a Baidu registration description from incoming XML property bag.
|
|
872
|
-
*/
|
|
873
|
-
createBaiduRegistrationDescription(rawRegistrationDescription) {
|
|
874
|
-
return Object.assign(Object.assign({ baiduChannelId: getString(rawRegistrationDescription["BaiduChannelId"], "baiduChannelId"), baiduUserId: getString(rawRegistrationDescription["BaiduUserId"], "baiduUserId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Baidu" });
|
|
875
|
-
},
|
|
876
|
-
/**
|
|
877
|
-
* @internal
|
|
878
|
-
* Creates a Baidu template registration description from incoming XML property bag.
|
|
879
|
-
*/
|
|
880
|
-
createBaiduTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
881
|
-
return Object.assign(Object.assign(Object.assign({}, this.createBaiduRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BaiduTemplate" });
|
|
882
|
-
},
|
|
883
|
-
/**
|
|
884
|
-
* @internal
|
|
885
|
-
* Creates a Browser registration description from incoming XML property bag.
|
|
886
|
-
*/
|
|
887
|
-
createBrowserRegistrationDescription(rawRegistrationDescription) {
|
|
888
|
-
return Object.assign(Object.assign({ endpoint: getString(rawRegistrationDescription["Endpoint"], "endpoint"), p256dh: getString(rawRegistrationDescription["P256DH"], "p256dh"), auth: getString(rawRegistrationDescription["Auth"], "auth") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Browser" });
|
|
889
|
-
},
|
|
890
|
-
/**
|
|
891
|
-
* @internal
|
|
892
|
-
* Creates a Browser template registration description from incoming XML property bag.
|
|
893
|
-
*/
|
|
894
|
-
createBrowserTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
895
|
-
return Object.assign(Object.assign(Object.assign({}, this.createBrowserRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BrowserTemplate" });
|
|
896
|
-
},
|
|
897
|
-
/**
|
|
898
|
-
* @internal
|
|
899
|
-
* Creates an GCM registration description from incoming XML property bag.
|
|
900
|
-
*/
|
|
901
|
-
createFcmV1RegistrationDescription(rawRegistrationDescription) {
|
|
902
|
-
return Object.assign(Object.assign({ fcmV1RegistrationId: getString(rawRegistrationDescription["FcmV1RegistrationId"], "fcmV1RegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "FcmV1" });
|
|
903
|
-
},
|
|
904
|
-
/**
|
|
905
|
-
* @internal
|
|
906
|
-
* Creates an FCM template registration description from incoming XML property bag.
|
|
907
|
-
*/
|
|
908
|
-
createFcmV1TemplateRegistrationDescription(rawRegistrationDescription) {
|
|
909
|
-
return Object.assign(Object.assign(Object.assign({}, this.createFcmV1RegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "FcmV1Template" });
|
|
910
|
-
},
|
|
911
|
-
/**
|
|
912
|
-
* @internal
|
|
913
|
-
* Creates an GCM registration description from incoming XML property bag.
|
|
914
|
-
*/
|
|
915
|
-
createGcmRegistrationDescription(rawRegistrationDescription) {
|
|
916
|
-
return Object.assign(Object.assign({ gcmRegistrationId: getString(rawRegistrationDescription["GcmRegistrationId"], "gcmRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Gcm" });
|
|
917
|
-
},
|
|
918
|
-
/**
|
|
919
|
-
* @internal
|
|
920
|
-
* Creates an FCM template registration description from incoming XML property bag.
|
|
921
|
-
*/
|
|
922
|
-
createGcmTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
923
|
-
return Object.assign(Object.assign(Object.assign({}, this.createGcmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "GcmTemplate" });
|
|
924
|
-
},
|
|
925
|
-
/**
|
|
926
|
-
* @internal
|
|
927
|
-
* Creates a Windows Phone registration description from incoming XML property bag.
|
|
928
|
-
*/
|
|
929
|
-
createMpnsRegistrationDescription(rawRegistrationDescription) {
|
|
930
|
-
return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Mpns" });
|
|
931
|
-
},
|
|
932
|
-
/**
|
|
933
|
-
* @internal
|
|
934
|
-
* Creates a Windows Phone template registration description from incoming XML property bag.
|
|
935
|
-
*/
|
|
936
|
-
createMpnsTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
937
|
-
var _a;
|
|
938
|
-
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" });
|
|
939
|
-
},
|
|
940
|
-
/**
|
|
941
|
-
* @internal
|
|
942
|
-
* Creates a Xiaomi registration description from incoming XML property bag.
|
|
943
|
-
*/
|
|
944
|
-
createXiaomiRegistrationDescription(rawRegistrationDescription) {
|
|
945
|
-
return Object.assign(Object.assign({ xiaomiRegistrationId: getString(rawRegistrationDescription["XiaomiRegistrationId"], "xiaomiRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Xiaomi" });
|
|
946
|
-
},
|
|
947
|
-
/**
|
|
948
|
-
* @internal
|
|
949
|
-
* Creates a Xiaomi template registration description from incoming XML property bag.
|
|
950
|
-
*/
|
|
951
|
-
createXiaomiTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
952
|
-
return Object.assign(Object.assign(Object.assign({}, this.createXiaomiRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "XiaomiTemplate" });
|
|
953
|
-
},
|
|
954
|
-
/**
|
|
955
|
-
* @internal
|
|
956
|
-
* Creates a Windows registration description from incoming XML property bag.
|
|
957
|
-
*/
|
|
958
|
-
createWindowsRegistrationDescription(rawRegistrationDescription) {
|
|
959
|
-
return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Windows" });
|
|
960
|
-
},
|
|
961
|
-
/**
|
|
962
|
-
* @internal
|
|
963
|
-
* Creates a Windows template registration description from incoming XML property bag.
|
|
964
|
-
*/
|
|
965
|
-
createWindowsTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
966
|
-
var _a;
|
|
967
|
-
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" });
|
|
968
|
-
},
|
|
969
|
-
};
|
|
970
|
-
function getHeadersOrUndefined(value) {
|
|
971
|
-
if (!isDefined(value)) {
|
|
972
|
-
return undefined;
|
|
973
|
-
}
|
|
974
|
-
const headerObj = {};
|
|
975
|
-
for (const { Header, Value } of value) {
|
|
976
|
-
headerObj[Header] = Value;
|
|
977
|
-
}
|
|
978
|
-
return headerObj;
|
|
979
|
-
}
|
|
980
|
-
function createRegistrationDescription(rawRegistrationDescription) {
|
|
981
|
-
let pushVariables;
|
|
982
|
-
const unparsed = getStringOrUndefined(rawRegistrationDescription["PushVariables"]);
|
|
983
|
-
if (unparsed) {
|
|
984
|
-
pushVariables = JSON.parse(unparsed);
|
|
985
|
-
}
|
|
986
|
-
return {
|
|
987
|
-
registrationId: getStringOrUndefined(rawRegistrationDescription["RegistrationId"]),
|
|
988
|
-
expirationTime: getDateOrUndefined(rawRegistrationDescription["ExpirationTime"]),
|
|
989
|
-
etag: getStringOrUndefined(rawRegistrationDescription["ETag"]),
|
|
990
|
-
tags: getTagsOrUndefined(rawRegistrationDescription["Tags"]),
|
|
991
|
-
pushVariables: pushVariables,
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
function createTemplateRegistrationDescription(rawRegistrationDescription) {
|
|
995
|
-
return Object.assign({ bodyTemplate: getString(rawRegistrationDescription["BodyTemplate"], "bodyTemplate"), templateName: getStringOrUndefined(rawRegistrationDescription["TemplateName"]) }, createRegistrationDescription(rawRegistrationDescription));
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Represents a RegistrationDescription serializer.
|
|
999
|
-
*/
|
|
1000
|
-
const registrationDescriptionSerializer = {
|
|
1001
|
-
serializeRegistrationDescription(description) {
|
|
1002
|
-
const rootName = `${description.kind}RegistrationDescription`;
|
|
1003
|
-
const methodName = `serialize${rootName}`;
|
|
1004
|
-
const method = this[methodName].bind(this);
|
|
1005
|
-
if (!isDefined(method)) {
|
|
1006
|
-
throw new coreRestPipeline.RestError(`Undefined platform ${description.kind}`, { statusCode: 400 });
|
|
1007
|
-
}
|
|
1008
|
-
const registration = method(description);
|
|
1009
|
-
const requestObject = serializeToAtomXmlRequest(rootName, registration);
|
|
1010
|
-
return coreXml.stringifyXML(requestObject, { rootName: "entry" });
|
|
1011
|
-
},
|
|
1012
|
-
/**
|
|
1013
|
-
* @internal
|
|
1014
|
-
* Serializes an existing ADM registration description to an object for serialization.
|
|
1015
|
-
*/
|
|
1016
|
-
serializeAdmRegistrationDescription(description) {
|
|
1017
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { AdmRegistrationId: getString(description.admRegistrationId, "admRegistrationId") });
|
|
1018
|
-
},
|
|
1019
|
-
/**
|
|
1020
|
-
* @internal
|
|
1021
|
-
* Serializes an existing ADM template registration description to an object for serialization.
|
|
1022
|
-
*/
|
|
1023
|
-
serializeAdmTemplateRegistrationDescription(description) {
|
|
1024
|
-
return Object.assign(Object.assign({}, this.serializeAdmRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1025
|
-
},
|
|
1026
|
-
/**
|
|
1027
|
-
* @internal
|
|
1028
|
-
* Serializes an existing Apple registration description to an object for serialization.
|
|
1029
|
-
*/
|
|
1030
|
-
serializeAppleRegistrationDescription(description) {
|
|
1031
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { DeviceToken: getString(description.deviceToken, "deviceToken") });
|
|
1032
|
-
},
|
|
1033
|
-
/**
|
|
1034
|
-
* @internal
|
|
1035
|
-
* Serializes an existing Apple template registration description to an object for serialization.
|
|
1036
|
-
*/
|
|
1037
|
-
serializeAppleTemplateRegistrationDescription(description) {
|
|
1038
|
-
let apnsHeaders;
|
|
1039
|
-
if (description.apnsHeaders) {
|
|
1040
|
-
apnsHeaders = {
|
|
1041
|
-
ApnsHeader: [],
|
|
1042
|
-
};
|
|
1043
|
-
for (const header of Object.keys(description.apnsHeaders)) {
|
|
1044
|
-
apnsHeaders["ApnsHeader"].push({
|
|
1045
|
-
Header: header,
|
|
1046
|
-
Value: description.apnsHeaders[header],
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
return Object.assign(Object.assign(Object.assign({}, this.serializeAppleRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { Expiry: getStringOrUndefined(description.expiry), ApnsHeaders: apnsHeaders });
|
|
1051
|
-
},
|
|
1052
|
-
/**
|
|
1053
|
-
* @internal
|
|
1054
|
-
* Serializes an existing Baidu registration description to an object for serialization.
|
|
1055
|
-
*/
|
|
1056
|
-
serializeBaiduRegistrationDescription(description) {
|
|
1057
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { BaiduChannelId: getString(description.baiduChannelId, "baiduChannelId"), BaiduUserId: getString(description.baiduUserId, "baiduUserId") });
|
|
1058
|
-
},
|
|
1059
|
-
/**
|
|
1060
|
-
* @internal
|
|
1061
|
-
* Serializes an existing Baidu template registration description to an object for serialization.
|
|
1062
|
-
*/
|
|
1063
|
-
serializeBaiduTemplateRegistrationDescription(description) {
|
|
1064
|
-
return Object.assign(Object.assign({}, this.serializeBaiduRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1065
|
-
},
|
|
1066
|
-
/**
|
|
1067
|
-
* @internal
|
|
1068
|
-
* Serializes an existing Browser registration description to an object for serialization.
|
|
1069
|
-
*/
|
|
1070
|
-
serializeBrowserRegistrationDescription(description) {
|
|
1071
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { Endpoint: description.endpoint, P256DH: description.p256dh, Auth: description.auth });
|
|
1072
|
-
},
|
|
1073
|
-
/**
|
|
1074
|
-
* @internal
|
|
1075
|
-
* Serializes an existing Browser template registration description to an object for serialization.
|
|
1076
|
-
*/
|
|
1077
|
-
serializeBrowserTemplateRegistrationDescription(description) {
|
|
1078
|
-
return Object.assign(Object.assign({}, this.serializeBrowserRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1079
|
-
},
|
|
1080
|
-
/**
|
|
1081
|
-
* @internal
|
|
1082
|
-
* Serializes an existing FCM V1 registration description to an object for serialization.
|
|
1083
|
-
*/
|
|
1084
|
-
serializeFcmV1RegistrationDescription(description) {
|
|
1085
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { FcmV1RegistrationId: getString(description.fcmV1RegistrationId, "fcmRegistrationId") });
|
|
1086
|
-
},
|
|
1087
|
-
/**
|
|
1088
|
-
* @internal
|
|
1089
|
-
* Serializes an existing FCM V1 template registration description to an object for serialization.
|
|
1090
|
-
*/
|
|
1091
|
-
serializeFcmV1TemplateRegistrationDescription(description) {
|
|
1092
|
-
return Object.assign(Object.assign({}, this.serializeFcmV1RegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1093
|
-
},
|
|
1094
|
-
/**
|
|
1095
|
-
* @internal
|
|
1096
|
-
* Serializes an existing GCM registration description to an object for serialization.
|
|
1097
|
-
*/
|
|
1098
|
-
serializeGcmRegistrationDescription(description) {
|
|
1099
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { GcmRegistrationId: getString(description.gcmRegistrationId, "gcmRegistrationId") });
|
|
1100
|
-
},
|
|
1101
|
-
/**
|
|
1102
|
-
* @internal
|
|
1103
|
-
* Serializes an existing GCM template registration description to an object for serialization.
|
|
1104
|
-
*/
|
|
1105
|
-
serializeGcmTemplateRegistrationDescription(description) {
|
|
1106
|
-
return Object.assign(Object.assign({}, this.serializeGcmRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1107
|
-
},
|
|
1108
|
-
/**
|
|
1109
|
-
* @internal
|
|
1110
|
-
* @deprecated Windows Phone is no longer supported.
|
|
1111
|
-
* Serializes an existing MPNS registration description to an object for serialization.
|
|
1112
|
-
*/
|
|
1113
|
-
serializeMpnsRegistrationDescription(description) {
|
|
1114
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { ChannelUri: description.channelUri });
|
|
1115
|
-
},
|
|
1116
|
-
/**
|
|
1117
|
-
* @internal
|
|
1118
|
-
* @deprecated Windows Phone is no longer supported.
|
|
1119
|
-
* Serializes an existing MPNS template registration description to an object for serialization.
|
|
1120
|
-
*/
|
|
1121
|
-
serializeMpnsTemplateRegistrationDescription(description) {
|
|
1122
|
-
let mpnsHeaders;
|
|
1123
|
-
if (description.mpnsHeaders) {
|
|
1124
|
-
mpnsHeaders = {
|
|
1125
|
-
MpnsHeader: [],
|
|
1126
|
-
};
|
|
1127
|
-
for (const header of Object.keys(description.mpnsHeaders)) {
|
|
1128
|
-
mpnsHeaders["MpnsHeader"].push({
|
|
1129
|
-
Header: header,
|
|
1130
|
-
Value: description.mpnsHeaders[header],
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
return Object.assign(Object.assign(Object.assign({}, this.serializeMpnsRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { MpnsHeaders: mpnsHeaders });
|
|
1135
|
-
},
|
|
1136
|
-
/**
|
|
1137
|
-
* @internal
|
|
1138
|
-
* Serializes an existing Xiaomi registration description to an object for serialization.
|
|
1139
|
-
*/
|
|
1140
|
-
serializeXiaomiRegistrationDescription(description) {
|
|
1141
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { XiaomiRegistrationId: getString(description.xiaomiRegistrationId, "xiaomiRegistrationId") });
|
|
1142
|
-
},
|
|
1143
|
-
/**
|
|
1144
|
-
* @internal
|
|
1145
|
-
* Serializes an existing Xiaomi template registration description to an object for serialization.
|
|
1146
|
-
*/
|
|
1147
|
-
serializeXiaomiTemplateRegistrationDescription(description) {
|
|
1148
|
-
return Object.assign(Object.assign({}, this.serializeXiaomiRegistrationDescription(description)), serializeTemplateRegistrationDescription(description));
|
|
1149
|
-
},
|
|
1150
|
-
/**
|
|
1151
|
-
* @internal
|
|
1152
|
-
* Serializes an existing Windows registration description to an object for serialization.
|
|
1153
|
-
*/
|
|
1154
|
-
serializeWindowsRegistrationDescription(description) {
|
|
1155
|
-
return Object.assign(Object.assign({}, serializeRegistrationDescription(description)), { ChannelUri: description.channelUri });
|
|
1156
|
-
},
|
|
1157
|
-
/**
|
|
1158
|
-
* @internal
|
|
1159
|
-
* Serializes an existing Windows template registration description to an object for serialization.
|
|
1160
|
-
*/
|
|
1161
|
-
serializeWindowsTemplateRegistrationDescription(description) {
|
|
1162
|
-
let wnsHeaders;
|
|
1163
|
-
if (description.wnsHeaders) {
|
|
1164
|
-
wnsHeaders = {
|
|
1165
|
-
WnsHeader: [],
|
|
1166
|
-
};
|
|
1167
|
-
for (const header of Object.keys(description.wnsHeaders)) {
|
|
1168
|
-
wnsHeaders["WnsHeader"].push({
|
|
1169
|
-
Header: header,
|
|
1170
|
-
Value: description.wnsHeaders[header],
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
return Object.assign(Object.assign(Object.assign({}, this.serializeWindowsRegistrationDescription(description)), serializeTemplateRegistrationDescription(description)), { WnsHeaders: wnsHeaders });
|
|
1175
|
-
},
|
|
1176
|
-
};
|
|
1177
|
-
function serializeRegistrationDescription(description) {
|
|
1178
|
-
let tags;
|
|
1179
|
-
if (description.tags) {
|
|
1180
|
-
tags = description.tags.join(",");
|
|
1181
|
-
}
|
|
1182
|
-
let pushVariables;
|
|
1183
|
-
if (description.pushVariables) {
|
|
1184
|
-
pushVariables = JSON.stringify(description.pushVariables);
|
|
1185
|
-
}
|
|
1186
|
-
return {
|
|
1187
|
-
RegistrationId: getStringOrUndefined(description.registrationId),
|
|
1188
|
-
Tags: tags,
|
|
1189
|
-
PushVariables: pushVariables,
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
function serializeTemplateRegistrationDescription(description) {
|
|
1193
|
-
return {
|
|
1194
|
-
BodyTemplate: { __cdata: description.bodyTemplate },
|
|
1195
|
-
TemplateName: getStringOrUndefined(description.templateName),
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
// Copyright (c) Microsoft Corporation.
|
|
1200
|
-
// Licensed under the MIT license.
|
|
1201
|
-
/**
|
|
1202
|
-
* @internal
|
|
1203
|
-
*/
|
|
1204
|
-
async function createOrUpdateRegistrationDescription(context, registration, operationName, options) {
|
|
1205
|
-
const endpoint = context.requestUrl();
|
|
1206
|
-
endpoint.pathname += "/registrations";
|
|
1207
|
-
let httpMethod = "POST";
|
|
1208
|
-
if (operationName === "createOrUpdate" || operationName === "update") {
|
|
1209
|
-
endpoint.pathname += `/${registration.registrationId}`;
|
|
1210
|
-
httpMethod = "PUT";
|
|
1211
|
-
}
|
|
1212
|
-
const etag = registration.etag;
|
|
1213
|
-
// Clear out readonly properties
|
|
1214
|
-
registration.registrationId = undefined;
|
|
1215
|
-
registration.etag = undefined;
|
|
1216
|
-
const headers = await context.createHeaders(`${operationName}Registration`);
|
|
1217
|
-
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
1218
|
-
if (operationName === "update") {
|
|
1219
|
-
headers.set("If-Match", isDefined(etag) ? `"${etag}"` : "*");
|
|
1220
|
-
}
|
|
1221
|
-
const request = createRequest(endpoint, httpMethod, headers, options);
|
|
1222
|
-
request.body = registrationDescriptionSerializer.serializeRegistrationDescription(registration);
|
|
1223
|
-
const response = await sendRequest(context, request, [200, 201]);
|
|
1224
|
-
return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText);
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
// Copyright (c) Microsoft Corporation.
|
|
1228
|
-
// Licensed under the MIT license.
|
|
1229
|
-
const OPERATION_NAME$c = "createOrUpdateRegistration";
|
|
1230
|
-
/**
|
|
1231
|
-
* Creates or updates a registration.
|
|
1232
|
-
* @param context - The Notification Hubs client.
|
|
1233
|
-
* @param registration - The registration to create or update.
|
|
1234
|
-
* @param options - The operation options.
|
|
1235
|
-
* @returns The created or updated registration description.
|
|
1236
|
-
*/
|
|
1237
|
-
function createOrUpdateRegistration(context, registration, options = {}) {
|
|
1238
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$c}`, options, async (updatedOptions) => {
|
|
1239
|
-
return createOrUpdateRegistrationDescription(context, registration, "createOrUpdate", updatedOptions);
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
// Copyright (c) Microsoft Corporation.
|
|
1244
|
-
// Licensed under the MIT license.
|
|
1245
|
-
const OPERATION_NAME$b = "createRegistrationId";
|
|
1246
|
-
/**
|
|
1247
|
-
* Creates a new registration ID.
|
|
1248
|
-
* @param context - The Notification Hubs client.
|
|
1249
|
-
* @param options - The options for creating a new registration ID.
|
|
1250
|
-
* @returns The newly created registration ID.
|
|
1251
|
-
*/
|
|
1252
|
-
function createRegistrationId(context, options = {}) {
|
|
1253
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$b}`, options, async (updatedOptions) => {
|
|
1254
|
-
const endpoint = context.requestUrl();
|
|
1255
|
-
endpoint.pathname += "/registrationIDs";
|
|
1256
|
-
const headers = await context.createHeaders(OPERATION_NAME$b);
|
|
1257
|
-
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
1258
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
1259
|
-
const response = await sendRequest(context, request, 201);
|
|
1260
|
-
// In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>
|
|
1261
|
-
const locationHeader = response.headers.get("Location");
|
|
1262
|
-
if (!locationHeader || !locationHeader.startsWith("https://")) {
|
|
1263
|
-
throw new coreRestPipeline.RestError(`Location header ${locationHeader} is an invalid URL`, {
|
|
1264
|
-
statusCode: 500,
|
|
1265
|
-
request,
|
|
1266
|
-
response,
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
const locationUrl = new URL(locationHeader);
|
|
1270
|
-
const registrationId = locationUrl.pathname.split("/")[3];
|
|
1271
|
-
return registrationId;
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
// Copyright (c) Microsoft Corporation.
|
|
1276
|
-
// Licensed under the MIT license.
|
|
1277
|
-
const OPERATION_NAME$a = "createRegistration";
|
|
1278
|
-
/**
|
|
1279
|
-
* Creates a new registration. This method generates a registration ID,
|
|
1280
|
-
* which you can subsequently use to retrieve, update, and delete this registration.
|
|
1281
|
-
* @param context - The Notification Hubs client.
|
|
1282
|
-
* @param registration - The registration to create.
|
|
1283
|
-
* @param options - Options for creating a new registration.
|
|
1284
|
-
* @returns The newly created registration description.
|
|
1285
|
-
*/
|
|
1286
|
-
function createRegistration(context, registration, options = {}) {
|
|
1287
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$a}`, options, async (updatedOptions) => {
|
|
1288
|
-
if (registration.registrationId) {
|
|
1289
|
-
throw new coreRestPipeline.RestError("registrationId must not be set during a create operation", {
|
|
1290
|
-
statusCode: 400,
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
return createOrUpdateRegistrationDescription(context, registration, "create", updatedOptions);
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
// Copyright (c) Microsoft Corporation.
|
|
1298
|
-
// Licensed under the MIT license.
|
|
1299
|
-
const OPERATION_NAME$9 = "deleteInstallation";
|
|
1300
|
-
/**
|
|
1301
|
-
* Deletes an installation from a Notification Hub.
|
|
1302
|
-
* @param context - The Notification Hubs client.
|
|
1303
|
-
* @param installationId - The installation ID of the installation to delete.
|
|
1304
|
-
* @param options - Configuration options for the installation delete operation.
|
|
1305
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1306
|
-
*/
|
|
1307
|
-
function deleteInstallation(context, installationId, options = {}) {
|
|
1308
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$9}`, options, async (updatedOptions) => {
|
|
1309
|
-
const endpoint = context.requestUrl();
|
|
1310
|
-
endpoint.pathname += `/installations/${installationId}`;
|
|
1311
|
-
const headers = await context.createHeaders(OPERATION_NAME$9);
|
|
1312
|
-
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
1313
|
-
const response = await sendRequest(context, request, 204);
|
|
1314
|
-
return parseNotificationResponse(response);
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
// Copyright (c) Microsoft Corporation.
|
|
1319
|
-
// Licensed under the MIT license.
|
|
1320
|
-
const OPERATION_NAME$8 = "deleteRegistration";
|
|
1321
|
-
/**
|
|
1322
|
-
* Deletes a registration with the given registration ID.
|
|
1323
|
-
* @param context - The Notification Hubs client.
|
|
1324
|
-
* @param registrationId - The registration ID of the registration to delete.
|
|
1325
|
-
* @param options - The options for delete operations including the ETag
|
|
1326
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1327
|
-
*/
|
|
1328
|
-
function deleteRegistration(context, registrationId, options = {}) {
|
|
1329
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$8}`, options, async (updatedOptions) => {
|
|
1330
|
-
const endpoint = context.requestUrl();
|
|
1331
|
-
endpoint.pathname += `/registrations/${registrationId}`;
|
|
1332
|
-
const headers = await context.createHeaders(OPERATION_NAME$8);
|
|
1333
|
-
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
1334
|
-
headers.set("If-Match", isDefined(options.etag) ? `"${options.etag}"` : "*");
|
|
1335
|
-
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
1336
|
-
const response = await sendRequest(context, request, 200);
|
|
1337
|
-
return parseNotificationResponse(response);
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
// Copyright (c) Microsoft Corporation.
|
|
1342
|
-
// Licensed under the MIT license.
|
|
1343
|
-
const OPERATION_NAME$7 = "getFeedbackContainerUrl";
|
|
1344
|
-
/**
|
|
1345
|
-
* Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.
|
|
1346
|
-
* The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.
|
|
1347
|
-
* @param context - The Notification Hubs client.
|
|
1348
|
-
* @param options - The options for getting the push notification feedback container URL.
|
|
1349
|
-
* @returns The URL of the Azure Storage Container containing the feedback data.
|
|
1350
|
-
*/
|
|
1351
|
-
function getFeedbackContainerUrl(context, options = {}) {
|
|
1352
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$7}`, options, async (updatedOptions) => {
|
|
1353
|
-
const endpoint = context.requestUrl();
|
|
1354
|
-
endpoint.pathname += "/feedbackcontainer";
|
|
1355
|
-
const headers = await context.createHeaders(OPERATION_NAME$7);
|
|
1356
|
-
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
1357
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
1358
|
-
const response = await sendRequest(context, request, 200);
|
|
1359
|
-
return response.bodyAsText;
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
// Copyright (c) Microsoft Corporation.
|
|
1364
|
-
// Licensed under the MIT license.
|
|
1365
|
-
const OPERATION_NAME$6 = "getInstallation";
|
|
1366
|
-
/**
|
|
1367
|
-
* Gets an Azure Notification Hub installation by the installation ID.
|
|
1368
|
-
* @param context - The Notification Hubs client.
|
|
1369
|
-
* @param installationId - The ID of the installation to get.
|
|
1370
|
-
* @param options - Configuration options for the get installation operation.
|
|
1371
|
-
* @returns The installation that matches the installation ID.
|
|
1372
|
-
*/
|
|
1373
|
-
function getInstallation(context, installationId, options = {}) {
|
|
1374
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$6}`, options, async (updatedOptions) => {
|
|
1375
|
-
const endpoint = context.requestUrl();
|
|
1376
|
-
endpoint.pathname += `/installations/${installationId}`;
|
|
1377
|
-
const headers = await context.createHeaders(OPERATION_NAME$6);
|
|
1378
|
-
headers.set("Content-Type", "application/json");
|
|
1379
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
1380
|
-
const response = await sendRequest(context, request, 200);
|
|
1381
|
-
return JSON.parse(response.bodyAsText);
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
// Copyright (c) Microsoft Corporation.
|
|
1386
|
-
// Licensed under the MIT license.
|
|
1387
|
-
/**
|
|
1388
|
-
* @internal
|
|
1389
|
-
* Parses a NotificationDetails from incoming XML.
|
|
1390
|
-
*/
|
|
1391
|
-
async function parseNotificationDetails(bodyText) {
|
|
1392
|
-
const xml = await coreXml.parseXML(bodyText, {
|
|
1393
|
-
includeRoot: true,
|
|
1394
|
-
});
|
|
1395
|
-
const notificationDetails = xml["NotificationDetails"];
|
|
1396
|
-
let apnsOutcomeCounts;
|
|
1397
|
-
if (isDefined(notificationDetails["ApnsOutcomeCounts"])) {
|
|
1398
|
-
apnsOutcomeCounts = parseOutcomeCounts(notificationDetails["ApnsOutcomeCounts"]["Outcome"]);
|
|
1399
|
-
}
|
|
1400
|
-
let admOutcomeCounts;
|
|
1401
|
-
if (isDefined(notificationDetails["AdmOutcomeCounts"])) {
|
|
1402
|
-
admOutcomeCounts = parseOutcomeCounts(notificationDetails["AdmOutcomeCounts"]["Outcome"]);
|
|
1403
|
-
}
|
|
1404
|
-
let baiduOutcomeCounts;
|
|
1405
|
-
if (isDefined(notificationDetails["BaiduOutcomeCounts"])) {
|
|
1406
|
-
baiduOutcomeCounts = parseOutcomeCounts(notificationDetails["BaiduOutcomeCounts"]["Outcome"]);
|
|
1407
|
-
}
|
|
1408
|
-
let fcmOutcomeCounts;
|
|
1409
|
-
if (isDefined(notificationDetails["GcmOutcomeCounts"])) {
|
|
1410
|
-
fcmOutcomeCounts = parseOutcomeCounts(notificationDetails["GcmOutcomeCounts"]["Outcome"]);
|
|
1411
|
-
}
|
|
1412
|
-
let xiaomiOutcomeCounts;
|
|
1413
|
-
if (isDefined(notificationDetails["XiaomiOutcomeCounts"])) {
|
|
1414
|
-
xiaomiOutcomeCounts = parseOutcomeCounts(notificationDetails["XiaomiOutcomeCounts"]["Outcome"]);
|
|
1415
|
-
}
|
|
1416
|
-
let wnsOutcomeCounts;
|
|
1417
|
-
if (isDefined(notificationDetails["WnsOutcomeCounts"])) {
|
|
1418
|
-
wnsOutcomeCounts = parseOutcomeCounts(notificationDetails["WnsOutcomeCounts"]["Outcome"]);
|
|
1419
|
-
}
|
|
1420
|
-
return {
|
|
1421
|
-
notificationId: getStringOrUndefined(notificationDetails["NotificationId"]),
|
|
1422
|
-
location: getStringOrUndefined(notificationDetails["Location"]),
|
|
1423
|
-
state: getStringOrUndefined(notificationDetails["State"]),
|
|
1424
|
-
enqueueTime: getDateOrUndefined(notificationDetails["EnqueueTime"]),
|
|
1425
|
-
startTime: getDateOrUndefined(notificationDetails["StartTime"]),
|
|
1426
|
-
endTime: getDateOrUndefined(notificationDetails["EndTime"]),
|
|
1427
|
-
pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails["PnsErrorDetailsUri"]),
|
|
1428
|
-
targetPlatforms: getStringOrUndefined(notificationDetails["TargetPlatforms"]),
|
|
1429
|
-
notificationBody: getStringOrUndefined(notificationDetails["NotificationBody"]),
|
|
1430
|
-
apnsOutcomeCounts,
|
|
1431
|
-
admOutcomeCounts,
|
|
1432
|
-
baiduOutcomeCounts,
|
|
1433
|
-
fcmOutcomeCounts,
|
|
1434
|
-
xiaomiOutcomeCounts,
|
|
1435
|
-
wnsOutcomeCounts,
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
function parseOutcomeCounts(counts) {
|
|
1439
|
-
const items = Array.isArray(counts) ? counts : [counts];
|
|
1440
|
-
const results = [];
|
|
1441
|
-
for (const item of items) {
|
|
1442
|
-
results.push({ state: item["Name"], count: getInteger(item["Count"], "Count") });
|
|
1443
|
-
}
|
|
1444
|
-
return results;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
// Copyright (c) Microsoft Corporation.
|
|
1448
|
-
// Licensed under the MIT license.
|
|
1449
|
-
const OPERATION_NAME$5 = "getNotificationOutcomeDetails";
|
|
1450
|
-
/**
|
|
1451
|
-
* Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed
|
|
1452
|
-
* or final results if the Send* has completed. This API can only be called for Standard SKU and above.
|
|
1453
|
-
* @param context - The Notification Hubs client.
|
|
1454
|
-
* @param notificationId - The notification ID returned from the send operation.
|
|
1455
|
-
* @param options - The operation options.
|
|
1456
|
-
* @returns The results of the send operation.
|
|
1457
|
-
*/
|
|
1458
|
-
function getNotificationOutcomeDetails(context, notificationId, options = {}) {
|
|
1459
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$5}`, options, async (updatedOptions) => {
|
|
1460
|
-
const endpoint = context.requestUrl();
|
|
1461
|
-
endpoint.pathname += `/messages/${notificationId}`;
|
|
1462
|
-
const headers = await context.createHeaders(OPERATION_NAME$5);
|
|
1463
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
1464
|
-
const response = await sendRequest(context, request, 200);
|
|
1465
|
-
return parseNotificationDetails(response.bodyAsText);
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
// Copyright (c) Microsoft Corporation.
|
|
1470
|
-
// Licensed under the MIT license.
|
|
1471
|
-
const OPERATION_NAME$4 = "getRegistration";
|
|
1472
|
-
/**
|
|
1473
|
-
* Gets a registration by the given registration ID.
|
|
1474
|
-
* @param context - The Notification Hubs client.
|
|
1475
|
-
* @param registrationId - The ID of the registration to get.
|
|
1476
|
-
* @param options - The options for getting a registration by ID.
|
|
1477
|
-
* @returns A RegistrationDescription that has the given registration ID.
|
|
1478
|
-
*/
|
|
1479
|
-
function getRegistration(context, registrationId, options = {}) {
|
|
1480
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$4}`, options, async (updatedOptions) => {
|
|
1481
|
-
const endpoint = context.requestUrl();
|
|
1482
|
-
endpoint.pathname += `/registrations/${registrationId}`;
|
|
1483
|
-
const headers = await context.createHeaders(OPERATION_NAME$4);
|
|
1484
|
-
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
1485
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
1486
|
-
const response = await sendRequest(context, request, 200);
|
|
1487
|
-
return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText);
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
// Copyright (c) Microsoft Corporation.
|
|
1492
|
-
// Licensed under the MIT license.
|
|
1493
|
-
const OPERATION_NAME$3 = "listNotificationHubJobs";
|
|
1494
|
-
/**
|
|
1495
|
-
* Gets all Notification Hub Jobs for this Notification Hub.
|
|
1496
|
-
* @param context - The Notification Hubs client.xs
|
|
1497
|
-
* @param options - The operation options.
|
|
1498
|
-
* @returns An array of all Notification Hub Jobs for this Notification Hub.
|
|
1499
|
-
*/
|
|
1500
|
-
function listNotificationHubJobs(context, options = {}) {
|
|
1501
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$3}`, options, async (updatedOptions) => {
|
|
1502
|
-
const endpoint = context.requestUrl();
|
|
1503
|
-
endpoint.pathname += "/jobs";
|
|
1504
|
-
const headers = await context.createHeaders(OPERATION_NAME$3);
|
|
1505
|
-
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
1506
|
-
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
1507
|
-
const response = await sendRequest(context, request, 200);
|
|
1508
|
-
return parseNotificationHubJobFeed(response.bodyAsText);
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
// Copyright (c) Microsoft Corporation.
|
|
1513
|
-
// Licensed under the MIT license.
|
|
1514
|
-
function listRegistrationsAll(context, options) {
|
|
1515
|
-
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsAll_1() {
|
|
1516
|
-
var _a, e_1, _b, _c;
|
|
1517
|
-
try {
|
|
1518
|
-
for (var _d = true, _e = tslib.__asyncValues(listRegistrationPagingPage(context, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1519
|
-
_c = _f.value;
|
|
1520
|
-
_d = false;
|
|
1521
|
-
const page = _c;
|
|
1522
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1526
|
-
finally {
|
|
1527
|
-
try {
|
|
1528
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1529
|
-
}
|
|
1530
|
-
finally { if (e_1) throw e_1.error; }
|
|
1531
|
-
}
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
function listRegistrationPagingPage(context, options) {
|
|
1535
|
-
return tslib.__asyncGenerator(this, arguments, function* listRegistrationPagingPage_1() {
|
|
1536
|
-
let result = yield tslib.__await(_listRegistrations(context, options));
|
|
1537
|
-
yield yield tslib.__await(result.registrations || []);
|
|
1538
|
-
let continuationToken = result.continuationToken;
|
|
1539
|
-
while (continuationToken) {
|
|
1540
|
-
result = yield tslib.__await(_listRegistrations(context, options, continuationToken));
|
|
1541
|
-
continuationToken = result.continuationToken;
|
|
1542
|
-
yield yield tslib.__await(result.registrations || []);
|
|
1543
|
-
}
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
async function _listRegistrations(context, options, continuationToken) {
|
|
1547
|
-
const endpoint = context.requestUrl();
|
|
1548
|
-
endpoint.pathname += "/registrations";
|
|
1549
|
-
if (options.top !== undefined) {
|
|
1550
|
-
endpoint.searchParams.set("$top", `${options.top}`);
|
|
1551
|
-
}
|
|
1552
|
-
if (options.filter !== undefined) {
|
|
1553
|
-
endpoint.searchParams.set("$filter", options.filter);
|
|
1554
|
-
}
|
|
1555
|
-
if (continuationToken !== undefined) {
|
|
1556
|
-
endpoint.searchParams.set("continuationtoken", continuationToken);
|
|
1557
|
-
}
|
|
1558
|
-
const headers = await context.createHeaders("listRegistrations");
|
|
1559
|
-
const request = createRequest(endpoint, "GET", headers, options);
|
|
1560
|
-
const response = await sendRequest(context, request, 200);
|
|
1561
|
-
const registrations = await registrationDescriptionParser.parseRegistrationFeed(response.bodyAsText);
|
|
1562
|
-
const nextToken = response.headers.get("x-ms-continuationtoken");
|
|
1563
|
-
return {
|
|
1564
|
-
registrations,
|
|
1565
|
-
continuationToken: nextToken,
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
// Copyright (c) Microsoft Corporation.
|
|
1570
|
-
// Licensed under the MIT license.
|
|
1571
|
-
/**
|
|
1572
|
-
* Gets all registrations for the notification hub with the given device information and options.
|
|
1573
|
-
* @param context - The Notification Hubs client.
|
|
1574
|
-
* @param channel - The Registration channel information to query per PNS type.
|
|
1575
|
-
* @param options - The options for querying the registrations such as $top.
|
|
1576
|
-
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
1577
|
-
*/
|
|
1578
|
-
function listRegistrationsByChannel(context, channel, options = {}) {
|
|
1579
|
-
const newOptions = Object.assign(Object.assign({}, options), { filter: getFilterByChannel(channel) });
|
|
1580
|
-
const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext.listRegistrationsByDevice", newOptions);
|
|
1581
|
-
try {
|
|
1582
|
-
const iter = listRegistrationsAll(context, updatedOptions);
|
|
1583
|
-
return {
|
|
1584
|
-
next() {
|
|
1585
|
-
return iter.next();
|
|
1586
|
-
},
|
|
1587
|
-
[Symbol.asyncIterator]() {
|
|
1588
|
-
return this;
|
|
1589
|
-
},
|
|
1590
|
-
byPage: () => {
|
|
1591
|
-
return listRegistrationPagingPage(context, updatedOptions);
|
|
1592
|
-
},
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
catch (e) {
|
|
1596
|
-
span.setStatus({ status: "error", error: e });
|
|
1597
|
-
throw e;
|
|
1598
|
-
}
|
|
1599
|
-
finally {
|
|
1600
|
-
span.end();
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
function getFilterByChannel(device) {
|
|
1604
|
-
switch (device.kind) {
|
|
1605
|
-
case "adm":
|
|
1606
|
-
return `AdmRegistrationId eq '${device.admRegistrationId}'`;
|
|
1607
|
-
case "apple":
|
|
1608
|
-
return `DeviceToken eq '${device.deviceToken.toLocaleUpperCase()}'`;
|
|
1609
|
-
case "baidu":
|
|
1610
|
-
return `BaiduChannelId eq ${device.baiduChannelId}' and BaiduUserId eq '${device.baiduUserId}'`;
|
|
1611
|
-
case "browser":
|
|
1612
|
-
return `Endpoint eq '${encodeURIComponent(device.endpoint)}' and P256DH eq '${device.p256dh}' and Auth eq '${device.auth}'`;
|
|
1613
|
-
case "gcm":
|
|
1614
|
-
return `GcmRegistrationId eq '${device.gcmRegistrationId}'`;
|
|
1615
|
-
case "windows":
|
|
1616
|
-
return `ChannelUri eq '${encodeURIComponent(device.channelUri)}'`;
|
|
1617
|
-
default:
|
|
1618
|
-
throw new coreRestPipeline.RestError(`Device type is unsupported`, {
|
|
1619
|
-
statusCode: 400,
|
|
1620
|
-
});
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
// Copyright (c) Microsoft Corporation.
|
|
1625
|
-
// Licensed under the MIT license.
|
|
1626
|
-
const OPERATION_NAME$2 = "listRegistrationsByTag";
|
|
1627
|
-
/**
|
|
1628
|
-
* Lists all registrations with the matching tag.
|
|
1629
|
-
* @param context - The Notification Hubs client.
|
|
1630
|
-
* @param tag - The tag to query for matching registrations.
|
|
1631
|
-
* @param options - The query options such as $top.
|
|
1632
|
-
* @returns A paged async iterable containing the matching registrations for the notification hub.
|
|
1633
|
-
*/
|
|
1634
|
-
function listRegistrationsByTag(context, tag, options = {}) {
|
|
1635
|
-
const { span, updatedOptions } = tracingClient.startSpan(`NotificationHubsClientContext.${OPERATION_NAME$2}`, options);
|
|
1636
|
-
try {
|
|
1637
|
-
const iter = listRegistrationsByTagAll(context, tag, updatedOptions);
|
|
1638
|
-
return {
|
|
1639
|
-
next() {
|
|
1640
|
-
return iter.next();
|
|
1641
|
-
},
|
|
1642
|
-
[Symbol.asyncIterator]() {
|
|
1643
|
-
return this;
|
|
1644
|
-
},
|
|
1645
|
-
byPage: () => {
|
|
1646
|
-
return listRegistrationsByTagPagingPage(context, tag, options);
|
|
1647
|
-
},
|
|
1648
|
-
};
|
|
1649
|
-
}
|
|
1650
|
-
catch (e) {
|
|
1651
|
-
span.setStatus({ status: "error", error: e });
|
|
1652
|
-
throw e;
|
|
1653
|
-
}
|
|
1654
|
-
finally {
|
|
1655
|
-
span.end();
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
function listRegistrationsByTagAll(context, tag, options) {
|
|
1659
|
-
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsByTagAll_1() {
|
|
1660
|
-
var _a, e_1, _b, _c;
|
|
1661
|
-
try {
|
|
1662
|
-
for (var _d = true, _e = tslib.__asyncValues(listRegistrationsByTagPagingPage(context, tag, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
1663
|
-
_c = _f.value;
|
|
1664
|
-
_d = false;
|
|
1665
|
-
const page = _c;
|
|
1666
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1670
|
-
finally {
|
|
1671
|
-
try {
|
|
1672
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
1673
|
-
}
|
|
1674
|
-
finally { if (e_1) throw e_1.error; }
|
|
1675
|
-
}
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
function listRegistrationsByTagPagingPage(context, tag, options) {
|
|
1679
|
-
return tslib.__asyncGenerator(this, arguments, function* listRegistrationsByTagPagingPage_1() {
|
|
1680
|
-
let result = yield tslib.__await(_listRegistrationsByTag(context, tag, options));
|
|
1681
|
-
yield yield tslib.__await(result.registrations || []);
|
|
1682
|
-
let continuationToken = result.continuationToken;
|
|
1683
|
-
while (continuationToken) {
|
|
1684
|
-
result = yield tslib.__await(_listRegistrationsByTag(context, tag, options, continuationToken));
|
|
1685
|
-
continuationToken = result.continuationToken;
|
|
1686
|
-
yield yield tslib.__await(result.registrations || []);
|
|
1687
|
-
}
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
async function _listRegistrationsByTag(context, tag, options, continuationToken) {
|
|
1691
|
-
const endpoint = context.requestUrl();
|
|
1692
|
-
endpoint.pathname += `/tags/${tag}/registrations`;
|
|
1693
|
-
if (options.top !== undefined) {
|
|
1694
|
-
endpoint.searchParams.set("$top", `${options.top}`);
|
|
1695
|
-
}
|
|
1696
|
-
if (continuationToken !== undefined) {
|
|
1697
|
-
endpoint.searchParams.set("continuationtoken", continuationToken);
|
|
1698
|
-
}
|
|
1699
|
-
const headers = await context.createHeaders(OPERATION_NAME$2);
|
|
1700
|
-
const request = createRequest(endpoint, "GET", headers, options);
|
|
1701
|
-
const response = await sendRequest(context, request, 200);
|
|
1702
|
-
const registrations = await registrationDescriptionParser.parseRegistrationFeed(response.bodyAsText);
|
|
1703
|
-
const nextToken = response.headers.get("x-ms-continuationtoken");
|
|
1704
|
-
return {
|
|
1705
|
-
registrations,
|
|
1706
|
-
continuationToken: nextToken,
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
// Copyright (c) Microsoft Corporation.
|
|
1711
|
-
// Licensed under the MIT license.
|
|
1712
|
-
/**
|
|
1713
|
-
* Gets all registrations for the notification hub with the given query options.
|
|
1714
|
-
* @param context - The Notification Hubs client.
|
|
1715
|
-
* @param options - The options for querying the registrations such as $top.
|
|
1716
|
-
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
1717
|
-
*/
|
|
1718
|
-
function listRegistrations(context, options = {}) {
|
|
1719
|
-
const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext.listRegistrations", options);
|
|
1720
|
-
try {
|
|
1721
|
-
const iter = listRegistrationsAll(context, updatedOptions);
|
|
1722
|
-
return {
|
|
1723
|
-
next() {
|
|
1724
|
-
return iter.next();
|
|
1725
|
-
},
|
|
1726
|
-
[Symbol.asyncIterator]() {
|
|
1727
|
-
return this;
|
|
1728
|
-
},
|
|
1729
|
-
byPage: () => {
|
|
1730
|
-
return listRegistrationPagingPage(context, updatedOptions);
|
|
1731
|
-
},
|
|
1732
|
-
};
|
|
1733
|
-
}
|
|
1734
|
-
catch (e) {
|
|
1735
|
-
span.setStatus({ status: "error", error: e });
|
|
1736
|
-
throw e;
|
|
1737
|
-
}
|
|
1738
|
-
finally {
|
|
1739
|
-
span.end();
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
// Copyright (c) Microsoft Corporation.
|
|
1744
|
-
// Licensed under the MIT license.
|
|
1745
|
-
/**
|
|
1746
|
-
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
1747
|
-
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
1748
|
-
* @param context - The Notification Hubs client.
|
|
1749
|
-
* @param scheduledTime - The Date to send the push notification.
|
|
1750
|
-
* @param notification - The notification to send to the matching devices.
|
|
1751
|
-
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
1752
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1753
|
-
*/
|
|
1754
|
-
function scheduleNotification(context, scheduledTime, notification, options = {}) {
|
|
1755
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.scheduleNotification`, options, async (updatedOptions) => {
|
|
1756
|
-
const endpoint = context.requestUrl();
|
|
1757
|
-
endpoint.pathname += "/schedulednotifications/";
|
|
1758
|
-
const headers = await context.createHeaders("scheduleNotification", notification.headers);
|
|
1759
|
-
headers.set("ServiceBusNotification-ScheduleTime", scheduledTime.toISOString());
|
|
1760
|
-
headers.set("Content-Type", notification.contentType);
|
|
1761
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
1762
|
-
if (options.tagExpression) {
|
|
1763
|
-
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
1764
|
-
}
|
|
1765
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
1766
|
-
request.body = notification.body;
|
|
1767
|
-
const response = await sendRequest(context, request, 201);
|
|
1768
|
-
return parseNotificationSendResponse(response);
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
// Copyright (c) Microsoft Corporation.
|
|
1773
|
-
// Licensed under the MIT license.
|
|
1774
|
-
/**
|
|
1775
|
-
* Determines whether the options are of type SendNotificationOptions.
|
|
1776
|
-
* @param options - The options to test if SendNotificationOptions.
|
|
1777
|
-
* @returns true if SendNotificationOptions otherwise false.
|
|
1778
|
-
*/
|
|
1779
|
-
function isSendNotificationOptions(options) {
|
|
1780
|
-
return (coreUtil.objectHasProperty(options, "tagExpression") || coreUtil.objectHasProperty(options, "enableTestSend"));
|
|
1781
|
-
}
|
|
1782
|
-
/**
|
|
1783
|
-
* Determines whether the options are of type DirectSendNotificationOptions.
|
|
1784
|
-
* @param options - The options to test if DirectSendNotificationOptions.
|
|
1785
|
-
* @returns true if DirectSendNotificationOptions otherwise false.
|
|
1786
|
-
*/
|
|
1787
|
-
function isDirectSendNotificationOptions(options) {
|
|
1788
|
-
return coreUtil.objectHasProperty(options, "deviceHandle");
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
// Copyright (c) Microsoft Corporation.
|
|
1792
|
-
// Licensed under the MIT license.
|
|
1793
|
-
/**
|
|
1794
|
-
* @internal
|
|
1795
|
-
*/
|
|
1796
|
-
function createMultipartDirectNotification(boundaryName, notification, deviceHandles) {
|
|
1797
|
-
return (`--${boundaryName}\r\n` +
|
|
1798
|
-
`Content-type: ${notification.contentType}\r\n` +
|
|
1799
|
-
"Content-Disposition: inline; name=notification\r\n\r\n" +
|
|
1800
|
-
notification.body +
|
|
1801
|
-
"\r\n" +
|
|
1802
|
-
`--${boundaryName}\r\n` +
|
|
1803
|
-
"Content-type: application/json\r\n" +
|
|
1804
|
-
"Content-Disposition: inline; name=devices\r\n\r\n" +
|
|
1805
|
-
JSON.stringify(deviceHandles) +
|
|
1806
|
-
"\r\n" +
|
|
1807
|
-
`--${boundaryName}--`);
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
// Copyright (c) Microsoft Corporation.
|
|
1811
|
-
// Licensed under the MIT license.
|
|
1812
|
-
/**
|
|
1813
|
-
* Sends push notifications to devices that match the given tags or tag expression.
|
|
1814
|
-
* @param context - The Notification Hubs client.
|
|
1815
|
-
* @param notification - The notification to send to the matching devices.
|
|
1816
|
-
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
1817
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1818
|
-
*/
|
|
1819
|
-
function sendNotification(context, notification, options = { enableTestSend: false }) {
|
|
1820
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.sendNotification`, options, async (updatedOptions) => {
|
|
1821
|
-
const endpoint = context.requestUrl();
|
|
1822
|
-
endpoint.pathname += "/messages/";
|
|
1823
|
-
// Check if batch direct send
|
|
1824
|
-
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
1825
|
-
endpoint.pathname += "$batch";
|
|
1826
|
-
}
|
|
1827
|
-
// Check for test send
|
|
1828
|
-
if (isSendNotificationOptions(options) && options.enableTestSend) {
|
|
1829
|
-
endpoint.searchParams.append("test", "true");
|
|
1830
|
-
}
|
|
1831
|
-
const headers = await context.createHeaders("sendNotification", notification.headers);
|
|
1832
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
1833
|
-
let body = notification.body;
|
|
1834
|
-
let contentType = notification.contentType;
|
|
1835
|
-
// Check for direct batch send
|
|
1836
|
-
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
1837
|
-
endpoint.searchParams.append("direct", "true");
|
|
1838
|
-
const boundary = `nh-boundary-${coreUtil.randomUUID()}`;
|
|
1839
|
-
contentType = `multipart/mixed; boundary = "${boundary}"`;
|
|
1840
|
-
body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);
|
|
1841
|
-
}
|
|
1842
|
-
else if (isDirectSendNotificationOptions(options)) {
|
|
1843
|
-
endpoint.searchParams.append("direct", "true");
|
|
1844
|
-
if (notification.platform === "browser") {
|
|
1845
|
-
const browserHandle = options.deviceHandle;
|
|
1846
|
-
headers.set("ServiceBusNotification-DeviceHandle", browserHandle.endpoint);
|
|
1847
|
-
headers.set("Auth", browserHandle.auth);
|
|
1848
|
-
headers.set("P256DH", browserHandle.p256dh);
|
|
1849
|
-
}
|
|
1850
|
-
else {
|
|
1851
|
-
headers.set("ServiceBusNotification-DeviceHandle", options.deviceHandle);
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
else if (isSendNotificationOptions(options)) {
|
|
1855
|
-
if (options.tagExpression) {
|
|
1856
|
-
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
headers.set("Content-Type", contentType);
|
|
1860
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
1861
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
1862
|
-
request.body = body;
|
|
1863
|
-
const response = await sendRequest(context, request, 201);
|
|
1864
|
-
return parseNotificationSendResponse(response);
|
|
1865
|
-
});
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
// Copyright (c) Microsoft Corporation.
|
|
1869
|
-
// Licensed under the MIT license.
|
|
1870
|
-
const OPERATION_NAME$1 = "updateInstallation";
|
|
1871
|
-
/**
|
|
1872
|
-
* Updates an installation using the JSON-Patch standard in RFC6902.
|
|
1873
|
-
* @param context - The Notification Hubs client.
|
|
1874
|
-
* @param installationId - The ID of the installation to update.
|
|
1875
|
-
* @param installationPatches - An array of patches following the JSON-Patch standard.
|
|
1876
|
-
* @param options - Configuration options for the patch installation operation.
|
|
1877
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1878
|
-
*/
|
|
1879
|
-
function updateInstallation(context, installationId, installationPatches, options = {}) {
|
|
1880
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME$1}`, options, async (updatedOptions) => {
|
|
1881
|
-
const endpoint = context.requestUrl();
|
|
1882
|
-
endpoint.pathname += `/installations/${installationId}`;
|
|
1883
|
-
const headers = await context.createHeaders(OPERATION_NAME$1);
|
|
1884
|
-
headers.set("Content-Type", "application/json");
|
|
1885
|
-
const request = createRequest(endpoint, "PATCH", headers, updatedOptions);
|
|
1886
|
-
request.body = JSON.stringify(installationPatches);
|
|
1887
|
-
const response = await sendRequest(context, request, 200);
|
|
1888
|
-
return parseNotificationResponse(response);
|
|
1889
|
-
});
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
// Copyright (c) Microsoft Corporation.
|
|
1893
|
-
// Licensed under the MIT license.
|
|
1894
|
-
const OPERATION_NAME = "updateRegistration";
|
|
1895
|
-
/**
|
|
1896
|
-
* Updates an existing registration.
|
|
1897
|
-
* @param context - The Notification Hubs client.
|
|
1898
|
-
* @param registration - The registration to update.
|
|
1899
|
-
* @param options - The operation options.
|
|
1900
|
-
* @returns The updated registration description.
|
|
1901
|
-
*/
|
|
1902
|
-
function updateRegistration(context, registration, options = {}) {
|
|
1903
|
-
return tracingClient.withSpan(`NotificationHubsClientContext.${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
1904
|
-
if (!registration.etag) {
|
|
1905
|
-
throw new coreRestPipeline.RestError("ETag is required for registration update", { statusCode: 400 });
|
|
1906
|
-
}
|
|
1907
|
-
return createOrUpdateRegistrationDescription(context, registration, "update", updatedOptions);
|
|
1908
|
-
});
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
// Copyright (c) Microsoft Corporation.
|
|
1912
|
-
// Licensed under the MIT license.
|
|
1913
|
-
/**
|
|
1914
|
-
* This represents a client for Azure Notification Hubs to manage installations and send
|
|
1915
|
-
* messages to devices.
|
|
1916
|
-
*/
|
|
1917
|
-
class NotificationHubsClient {
|
|
1918
|
-
/**
|
|
1919
|
-
* Creates a new instance of the NotificationClient with a connection string, hub name and options.
|
|
1920
|
-
* @param connectionString - The Notification Hub Access Policy connection string.
|
|
1921
|
-
* @param hubName - The name of the Azure Notification Hub.
|
|
1922
|
-
* @param options - Options for configuring the Azure Notification Hubs client.
|
|
1923
|
-
*/
|
|
1924
|
-
constructor(connectionString, hubName, options = {}) {
|
|
1925
|
-
this._client = createClientContext(connectionString, hubName, options);
|
|
1926
|
-
}
|
|
1927
|
-
/**
|
|
1928
|
-
* Creates or overwrites an installation to a Notification Hub.
|
|
1929
|
-
* @param installation - The installation to create or overwrite.
|
|
1930
|
-
* @param options - Configuration options for the create or update installation operation.
|
|
1931
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1932
|
-
*/
|
|
1933
|
-
createOrUpdateInstallation(installation, options = {}) {
|
|
1934
|
-
return createOrUpdateInstallation(this._client, installation, options);
|
|
1935
|
-
}
|
|
1936
|
-
/**
|
|
1937
|
-
* Deletes an installation from a Notification Hub.
|
|
1938
|
-
* @param installationId - The installation ID of the installation to delete.
|
|
1939
|
-
* @param options - Configuration options for the installation delete operation.
|
|
1940
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1941
|
-
*/
|
|
1942
|
-
deleteInstallation(installationId, options = {}) {
|
|
1943
|
-
return deleteInstallation(this._client, installationId, options);
|
|
1944
|
-
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Gets an Azure Notification Hub installation by the installation ID.
|
|
1947
|
-
* @param installationId - The ID of the installation to get.
|
|
1948
|
-
* @param options - Configuration options for the get installation operation.
|
|
1949
|
-
* @returns The installation that matches the installation ID.
|
|
1950
|
-
*/
|
|
1951
|
-
getInstallation(installationId, options = {}) {
|
|
1952
|
-
return getInstallation(this._client, installationId, options);
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Updates an installation using the JSON-Patch standard in RFC6902.
|
|
1956
|
-
* @param installationId - The ID of the installation to update.
|
|
1957
|
-
* @param patches - An array of patches following the JSON-Patch standard.
|
|
1958
|
-
* @param options - Configuration options for the patch installation operation.
|
|
1959
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1960
|
-
*/
|
|
1961
|
-
updateInstallation(installationId, patches, options = {}) {
|
|
1962
|
-
return updateInstallation(this._client, installationId, patches, options);
|
|
1963
|
-
}
|
|
1964
|
-
/**
|
|
1965
|
-
* Creates a new registration ID.
|
|
1966
|
-
* @param options - The options for creating a new registration ID.
|
|
1967
|
-
* @returns The newly created registration ID.
|
|
1968
|
-
*/
|
|
1969
|
-
createRegistrationId(options = {}) {
|
|
1970
|
-
return createRegistrationId(this._client, options);
|
|
1971
|
-
}
|
|
1972
|
-
/**
|
|
1973
|
-
* Creates a new registration. This method generates a registration ID,
|
|
1974
|
-
* which you can subsequently use to retrieve, update, and delete this registration.
|
|
1975
|
-
* @param registration - The registration to create.
|
|
1976
|
-
* @param options - Options for creating a new registration.
|
|
1977
|
-
* @returns The newly created registration description.
|
|
1978
|
-
*/
|
|
1979
|
-
createRegistration(registration, options = {}) {
|
|
1980
|
-
return createRegistration(this._client, registration, options);
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Creates or updates a registration.
|
|
1984
|
-
* @param registration - The registration to create or update.
|
|
1985
|
-
* @param options - The operation options.
|
|
1986
|
-
* @returns The created or updated registration description.
|
|
1987
|
-
*/
|
|
1988
|
-
createOrUpdateRegistration(registration, options = {}) {
|
|
1989
|
-
return createOrUpdateRegistration(this._client, registration, options);
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Updates an existing registration.
|
|
1993
|
-
* @param registration - The registration to update.
|
|
1994
|
-
* @param options - The operation options.
|
|
1995
|
-
* @returns The updated registration description.
|
|
1996
|
-
*/
|
|
1997
|
-
updateRegistration(registration, options = {}) {
|
|
1998
|
-
return updateRegistration(this._client, registration, options);
|
|
1999
|
-
}
|
|
2000
|
-
/**
|
|
2001
|
-
* Deletes a registration with the given registration ID.
|
|
2002
|
-
* @param context - The Notification Hubs client.
|
|
2003
|
-
* @param registrationId - The registration ID of the registration to delete.
|
|
2004
|
-
* @param options - The options for delete operations including the ETag
|
|
2005
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2006
|
-
*/
|
|
2007
|
-
deleteRegistration(registrationId, options = {}) {
|
|
2008
|
-
return deleteRegistration(this._client, registrationId, options);
|
|
2009
|
-
}
|
|
2010
|
-
/**
|
|
2011
|
-
* Gets a registration by the given registration ID.
|
|
2012
|
-
* @param registrationId - The ID of the registration to get.
|
|
2013
|
-
* @param options - The options for getting a registration by ID.
|
|
2014
|
-
* @returns A RegistrationDescription that has the given registration ID.
|
|
2015
|
-
*/
|
|
2016
|
-
getRegistration(registrationId, options = {}) {
|
|
2017
|
-
return getRegistration(this._client, registrationId, options);
|
|
2018
|
-
}
|
|
2019
|
-
/**
|
|
2020
|
-
* Gets all registrations for the notification hub with the given query options.
|
|
2021
|
-
* @param options - The options for querying the registrations such as $top.
|
|
2022
|
-
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
2023
|
-
*/
|
|
2024
|
-
listRegistrations(options = {}) {
|
|
2025
|
-
return listRegistrations(this._client, options);
|
|
2026
|
-
}
|
|
2027
|
-
/**
|
|
2028
|
-
* Gets all registrations for the notification hub with the given device information and options.
|
|
2029
|
-
* @param channel - The registration channel information to query per PNS type.
|
|
2030
|
-
* @param options - The options for querying the registrations such as $top.
|
|
2031
|
-
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
2032
|
-
*/
|
|
2033
|
-
listRegistrationsByChannel(channel, options = {}) {
|
|
2034
|
-
return listRegistrationsByChannel(this._client, channel, options);
|
|
2035
|
-
}
|
|
2036
|
-
/**
|
|
2037
|
-
* Lists all registrations with the matching tag.
|
|
2038
|
-
* @param tag - The tag to query for matching registrations.
|
|
2039
|
-
* @param options - The query options such as $top.
|
|
2040
|
-
* @returns A paged async iterable containing the matching registrations for the notification hub.
|
|
2041
|
-
*/
|
|
2042
|
-
listRegistrationsByTag(tag, options = {}) {
|
|
2043
|
-
return listRegistrationsByTag(this._client, tag, options);
|
|
2044
|
-
}
|
|
2045
|
-
/**
|
|
2046
|
-
* Sends push notifications to devices that match the given tags or tag expression.
|
|
2047
|
-
* @param notification - The notification to send to the matching devices.
|
|
2048
|
-
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
2049
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2050
|
-
*/
|
|
2051
|
-
sendNotification(notification, options = { enableTestSend: false }) {
|
|
2052
|
-
return sendNotification(this._client, notification, options);
|
|
2053
|
-
}
|
|
2054
|
-
/**
|
|
2055
|
-
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
2056
|
-
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
2057
|
-
* @param scheduledTime - The Date to send the push notification.
|
|
2058
|
-
* @param notification - The notification to send to the matching devices.
|
|
2059
|
-
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
2060
|
-
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2061
|
-
*/
|
|
2062
|
-
scheduleNotification(scheduledTime, notification, options = {}) {
|
|
2063
|
-
return scheduleNotification(this._client, scheduledTime, notification, options);
|
|
2064
|
-
}
|
|
2065
|
-
/**
|
|
2066
|
-
* Cancels the scheduled notification with the given notification ID.
|
|
2067
|
-
* @param notificationId - The notification ID from the scheduled notification.
|
|
2068
|
-
* @param options - The operation options.
|
|
2069
|
-
* @returns A notification hub response with correlation ID and tracking ID.
|
|
2070
|
-
*/
|
|
2071
|
-
cancelScheduledNotification(notificationId, options = {}) {
|
|
2072
|
-
return cancelScheduledNotification(this._client, notificationId, options);
|
|
2073
|
-
}
|
|
2074
|
-
/**
|
|
2075
|
-
* Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.
|
|
2076
|
-
* The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.
|
|
2077
|
-
* @param options - The options for getting the push notification feedback container URL.
|
|
2078
|
-
* @returns The URL of the Azure Storage Container containing the feedback data.
|
|
2079
|
-
*/
|
|
2080
|
-
getFeedbackContainerUrl(options = {}) {
|
|
2081
|
-
return getFeedbackContainerUrl(this._client, options);
|
|
2082
|
-
}
|
|
2083
|
-
/**
|
|
2084
|
-
* Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed
|
|
2085
|
-
* or final results if the Send* has completed. This API can only be called for Standard SKU and above.
|
|
2086
|
-
* @param notificationId - The notification ID returned from the send operation.
|
|
2087
|
-
* @param options - The operation options.
|
|
2088
|
-
* @returns The results of the send operation.
|
|
2089
|
-
*/
|
|
2090
|
-
getNotificationOutcomeDetails(notificationId, options = {}) {
|
|
2091
|
-
return getNotificationOutcomeDetails(this._client, notificationId, options);
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* Gets a Notification Hub Job by the ID.
|
|
2095
|
-
* @param jobId - The Notification Hub Job ID.
|
|
2096
|
-
* @param options - The operation options.
|
|
2097
|
-
* @returns The Notification Hub Job with the matching ID.
|
|
2098
|
-
*/
|
|
2099
|
-
getNotificationHubJob(jobId, options = {}) {
|
|
2100
|
-
return getNotificationHubJob(this._client, jobId, options);
|
|
2101
|
-
}
|
|
2102
|
-
/**
|
|
2103
|
-
* Submits a Notification Hub job and creates a poller to poll for results.
|
|
2104
|
-
* @param notificationHubJob - The Notification Hub import/export job to start.
|
|
2105
|
-
* @param options - The operation options.
|
|
2106
|
-
* @returns A poller which can be called to poll until completion of the job.
|
|
2107
|
-
*/
|
|
2108
|
-
beginSubmitNotificationHubJob(notificationHubJob, options = {}) {
|
|
2109
|
-
return beginSubmitNotificationHubJob(this._client, notificationHubJob, options);
|
|
2110
|
-
}
|
|
2111
|
-
/**
|
|
2112
|
-
* Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.
|
|
2113
|
-
* @param job - The notification hub job to submit.
|
|
2114
|
-
* @param options - The operation options.
|
|
2115
|
-
* @returns The notification hub job details including job ID and status.
|
|
2116
|
-
*/
|
|
2117
|
-
submitNotificationHubJob(job, options = {}) {
|
|
2118
|
-
return submitNotificationHubJob(this._client, job, options);
|
|
2119
|
-
}
|
|
2120
|
-
/**
|
|
2121
|
-
* Gets all Notification Hub Jobs for this Notification Hub.
|
|
2122
|
-
* @param options - The operation options.
|
|
2123
|
-
* @returns An array of all Notification Hub Jobs for this Notification Hub.
|
|
2124
|
-
*/
|
|
2125
|
-
listNotificationHubJobs(options = {}) {
|
|
2126
|
-
return listNotificationHubJobs(this._client, options);
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
// Copyright (c) Microsoft Corporation.
|
|
2131
|
-
// Licensed under the MIT license.
|
|
2132
|
-
/**
|
|
2133
|
-
* Creates an Apple based installation.
|
|
2134
|
-
* @param installation - A partial installation used to create the Apple installation.
|
|
2135
|
-
* @returns The newly created Apple installation.
|
|
2136
|
-
*/
|
|
2137
|
-
function createAppleInstallation(installation) {
|
|
2138
|
-
return Object.assign(Object.assign({}, installation), { platform: "apns" });
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Creates an Amazon Device Messaging (ADM) based installation.
|
|
2142
|
-
* @param installation - A partial installation used to create the ADM installation.
|
|
2143
|
-
* @returns The newly created ADM installation.
|
|
2144
|
-
*/
|
|
2145
|
-
function createAdmInstallation(installation) {
|
|
2146
|
-
return Object.assign(Object.assign({}, installation), { platform: "adm" });
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* Creates a Baidu based installation.
|
|
2150
|
-
* @param installation - A partial installation used to create the Baidu installation.
|
|
2151
|
-
* @returns The newly created Baidu installation.
|
|
2152
|
-
*/
|
|
2153
|
-
function createBaiduInstallation(installation) {
|
|
2154
|
-
return Object.assign(Object.assign({}, installation), { platform: "baidu" });
|
|
2155
|
-
}
|
|
2156
|
-
/**
|
|
2157
|
-
* Creates a Firebase legacy HTTP based installation.
|
|
2158
|
-
* @param installation - A partial installation used to create the Firebase Legacy HTTP installation.
|
|
2159
|
-
* @returns The newly created Baidu installation.
|
|
2160
|
-
*/
|
|
2161
|
-
function createFcmLegacyInstallation(installation) {
|
|
2162
|
-
return Object.assign(Object.assign({}, installation), { platform: "gcm" });
|
|
2163
|
-
}
|
|
2164
|
-
/**
|
|
2165
|
-
* Creates an Firebase V1 Cloud Messaging based installation.
|
|
2166
|
-
* @param installation - A partial installation used to create the Firebase V1 Cloud Messaging installation.
|
|
2167
|
-
* @returns The newly created Firebase V1 Cloud Messaging installation.
|
|
2168
|
-
*/
|
|
2169
|
-
function createFcmV1Installation(installation) {
|
|
2170
|
-
return Object.assign(Object.assign({}, installation), { platform: "fcmv1" });
|
|
2171
|
-
}
|
|
2172
|
-
/**
|
|
2173
|
-
* Creates a Xiaomi based installation.
|
|
2174
|
-
* @param installation - A partial installation used to create the Xiaomi installation.
|
|
2175
|
-
* @returns The newly created Xiaomi installation.
|
|
2176
|
-
*/
|
|
2177
|
-
function createXiaomiInstallation(installation) {
|
|
2178
|
-
return Object.assign(Object.assign({}, installation), { platform: "xiaomi" });
|
|
2179
|
-
}
|
|
2180
|
-
/**
|
|
2181
|
-
* Creates a Windows Notification Services (WNS) based installation.
|
|
2182
|
-
* @param installation - A partial installation used to create the WNS installation.
|
|
2183
|
-
* @returns The newly created WNS installation.
|
|
2184
|
-
*/
|
|
2185
|
-
function createWindowsInstallation(installation) {
|
|
2186
|
-
return Object.assign(Object.assign({}, installation), { platform: "wns" });
|
|
2187
|
-
}
|
|
2188
|
-
/**
|
|
2189
|
-
* Creates a Web Push based installation.
|
|
2190
|
-
* @param installation - A partial installation used to create the Web Push installation.
|
|
2191
|
-
* @returns The newly created Web Push installation.
|
|
2192
|
-
*/
|
|
2193
|
-
function createBrowserInstallation(installation) {
|
|
2194
|
-
return Object.assign(Object.assign({}, installation), { platform: "browser" });
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
// Copyright (c) Microsoft Corporation.
|
|
2198
|
-
// Licensed under the MIT license.
|
|
2199
|
-
function isString(value) {
|
|
2200
|
-
return typeof value === "string" || value instanceof String;
|
|
2201
|
-
}
|
|
2202
|
-
/**
|
|
2203
|
-
* Creates a notification to send to an Apple device.
|
|
2204
|
-
* @param notification - A partial message used to create a message for Apple.
|
|
2205
|
-
* @returns A newly created Apple.
|
|
2206
|
-
*/
|
|
2207
|
-
function createAppleNotification(notification) {
|
|
2208
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2209
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "apple", contentType: JSON_CONTENT_TYPE });
|
|
2210
|
-
}
|
|
2211
|
-
/**
|
|
2212
|
-
* Creates a notification to send to an Amazon Device Messaging device.
|
|
2213
|
-
* @param notification - A partial message used to create a message for Amazon Device Messaging.
|
|
2214
|
-
* @returns A newly created Amazon Device Messaging.
|
|
2215
|
-
*/
|
|
2216
|
-
function createAdmNotification(notification) {
|
|
2217
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2218
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "adm", contentType: JSON_CONTENT_TYPE });
|
|
2219
|
-
}
|
|
2220
|
-
/**
|
|
2221
|
-
* Creates a notification to send to a Baidu registered device.
|
|
2222
|
-
* @param notification - A partial message used to create a message for Baidu.
|
|
2223
|
-
* @returns A newly created Baidu.
|
|
2224
|
-
*/
|
|
2225
|
-
function createBaiduNotification(notification) {
|
|
2226
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2227
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "baidu", contentType: JSON_CONTENT_TYPE });
|
|
2228
|
-
}
|
|
2229
|
-
/**
|
|
2230
|
-
* Creates a notification to send to a browser.
|
|
2231
|
-
* @param notification - A partial message used to create a message for a browser.
|
|
2232
|
-
* @returns A newly created Web Push browser.
|
|
2233
|
-
*/
|
|
2234
|
-
function createBrowserNotification(notification) {
|
|
2235
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2236
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "browser", contentType: JSON_CONTENT_TYPE });
|
|
2237
|
-
}
|
|
2238
|
-
/**
|
|
2239
|
-
* Creates a notification to send to Firebase.
|
|
2240
|
-
* @param notification - A partial message used to create a message for Firebase.
|
|
2241
|
-
* @returns A newly created Firebase notification.
|
|
2242
|
-
*/
|
|
2243
|
-
function createFcmLegacyNotification(notification) {
|
|
2244
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2245
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "gcm", contentType: JSON_CONTENT_TYPE });
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Creates a notification to send to Firebase.
|
|
2249
|
-
* @param notification - A partial message used to create a message for Firebase.
|
|
2250
|
-
* @returns A newly created Firebase notification.
|
|
2251
|
-
*/
|
|
2252
|
-
function createFcmV1Notification(notification) {
|
|
2253
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2254
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "fcmv1", contentType: JSON_CONTENT_TYPE });
|
|
2255
|
-
}
|
|
2256
|
-
/**
|
|
2257
|
-
* Creates a notification to send to Xiaomi.
|
|
2258
|
-
* @param notification - A partial message used to create a message for Xiaomi.
|
|
2259
|
-
* @returns A newly created Xiaomi notification.
|
|
2260
|
-
*/
|
|
2261
|
-
function createXiaomiNotification(notification) {
|
|
2262
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2263
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "xiaomi", contentType: JSON_CONTENT_TYPE });
|
|
2264
|
-
}
|
|
2265
|
-
/**
|
|
2266
|
-
* Creates a template notification.
|
|
2267
|
-
* @param notification - A partial message used to be used for a template notification.
|
|
2268
|
-
* @returns A newly created Firebase.
|
|
2269
|
-
*/
|
|
2270
|
-
function createTemplateNotification(notification) {
|
|
2271
|
-
const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
|
|
2272
|
-
return Object.assign(Object.assign({}, notification), { body, platform: "template", contentType: JSON_CONTENT_TYPE });
|
|
2273
|
-
}
|
|
2274
|
-
/**
|
|
2275
|
-
* Creates a notification to send to WNS.
|
|
2276
|
-
* @param notification - The WNS notification to send.
|
|
2277
|
-
* @returns A newly created WNS message.
|
|
2278
|
-
*/
|
|
2279
|
-
function createWindowsNotification(notification) {
|
|
2280
|
-
if ((notification === null || notification === void 0 ? void 0 : notification.headers) && notification.headers["X-WNS-Type"]) {
|
|
2281
|
-
const wnsType = notification.headers["X-WNS-Type"];
|
|
2282
|
-
switch (wnsType) {
|
|
2283
|
-
case WNS_TOAST:
|
|
2284
|
-
return createWindowsToastNotification(notification);
|
|
2285
|
-
case WNS_TITLE:
|
|
2286
|
-
return createWindowsTileNotification(notification);
|
|
2287
|
-
case WNS_BADGE:
|
|
2288
|
-
return createWindowsBadgeNotification(notification);
|
|
2289
|
-
case WNS_RAW:
|
|
2290
|
-
return createWindowsRawNotification(notification);
|
|
2291
|
-
default:
|
|
2292
|
-
throw new Error(`Invalid WNS type: ${wnsType}`);
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
else {
|
|
2296
|
-
throw new Error(`Missing WNS type in headers`);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Creates a badge message to send to WNS.
|
|
2301
|
-
* @param notification - A partial message used to create a badge message for WNS.
|
|
2302
|
-
* @returns A newly created WNS badge.
|
|
2303
|
-
*/
|
|
2304
|
-
function createWindowsBadgeNotification(notification) {
|
|
2305
|
-
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2306
|
-
if (!result.headers) {
|
|
2307
|
-
result.headers = {};
|
|
2308
|
-
}
|
|
2309
|
-
if (!result.headers[WNS_TYPE_NAME]) {
|
|
2310
|
-
result.headers[WNS_TYPE_NAME] = WNS_BADGE;
|
|
2311
|
-
}
|
|
2312
|
-
return result;
|
|
2313
|
-
}
|
|
2314
|
-
/**
|
|
2315
|
-
* Creates a tile message to send to WNS.
|
|
2316
|
-
* @param notification - A partial message used to create a tile message for WNS.
|
|
2317
|
-
* @returns A newly created WNS tile.
|
|
2318
|
-
*/
|
|
2319
|
-
function createWindowsTileNotification(notification) {
|
|
2320
|
-
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2321
|
-
if (!result.headers) {
|
|
2322
|
-
result.headers = {};
|
|
2323
|
-
}
|
|
2324
|
-
if (!result.headers[WNS_TYPE_NAME]) {
|
|
2325
|
-
result.headers[WNS_TYPE_NAME] = WNS_TITLE;
|
|
2326
|
-
}
|
|
2327
|
-
return result;
|
|
2328
|
-
}
|
|
2329
|
-
/**
|
|
2330
|
-
* Creates a toast message to send to WNS.
|
|
2331
|
-
* @param notification - A partial message used to create a toast message for WNS.
|
|
2332
|
-
* @returns A newly created WNS toast.
|
|
2333
|
-
*/
|
|
2334
|
-
function createWindowsToastNotification(notification) {
|
|
2335
|
-
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: XML_CONTENT_TYPE });
|
|
2336
|
-
if (!result.headers) {
|
|
2337
|
-
result.headers = {};
|
|
2338
|
-
}
|
|
2339
|
-
if (!result.headers[WNS_TYPE_NAME]) {
|
|
2340
|
-
result.headers[WNS_TYPE_NAME] = WNS_TOAST;
|
|
2341
|
-
}
|
|
2342
|
-
return result;
|
|
2343
|
-
}
|
|
2344
|
-
/**
|
|
2345
|
-
* Creates a notification to send to WNS in wns/raw format..
|
|
2346
|
-
* @param notification - A partial message used to create a message for WNS in XML format.
|
|
2347
|
-
* @returns A newly created WNS message using XML.
|
|
2348
|
-
*/
|
|
2349
|
-
function createWindowsRawNotification(notification) {
|
|
2350
|
-
const result = Object.assign(Object.assign({}, notification), { platform: "windows", contentType: STREAM_CONTENT_TYPE });
|
|
2351
|
-
if (!result.headers) {
|
|
2352
|
-
result.headers = {};
|
|
2353
|
-
}
|
|
2354
|
-
if (!result.headers[WNS_TYPE_NAME]) {
|
|
2355
|
-
result.headers[WNS_TYPE_NAME] = WNS_RAW;
|
|
2356
|
-
}
|
|
2357
|
-
return result;
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
// Copyright (c) Microsoft Corporation.
|
|
2361
|
-
// Licensed under the MIT license.
|
|
2362
|
-
/**
|
|
2363
|
-
* Creates an APNs native message to send to Notification Hubs.
|
|
2364
|
-
* @param nativeMessage - The Apple native message properties to set.
|
|
2365
|
-
* @param additionalProperties - Additional properties for Apple messages.
|
|
2366
|
-
* @returns An AppleNotification to send to Notification Hubs.
|
|
2367
|
-
*/
|
|
2368
|
-
function createAppleNotificationBody(nativeMessage) {
|
|
2369
|
-
return JSON.stringify(nativeMessage);
|
|
2370
|
-
}
|
|
2371
|
-
/**
|
|
2372
|
-
* Creates a FcmLegacyNotification from a native Firebase payload.
|
|
2373
|
-
* @param nativeMessage - The native message payload to send to Notification Hubs.
|
|
2374
|
-
* @returns The JSON body to send to Notification Hubs.
|
|
2375
|
-
*/
|
|
2376
|
-
function createFirebaseLegacyNotificationBody(nativeMessage) {
|
|
2377
|
-
return JSON.stringify(nativeMessage);
|
|
2378
|
-
}
|
|
2379
|
-
/**
|
|
2380
|
-
* Creates a FcmV1Notification from a native Firebase payload.
|
|
2381
|
-
* @param nativeMessage - The native message payload to send to Notification Hubs.
|
|
2382
|
-
* @returns The JSON body to send to Notification Hubs.
|
|
2383
|
-
*/
|
|
2384
|
-
function createFirebaseV1NotificationBody(nativeMessage) {
|
|
2385
|
-
return JSON.stringify(nativeMessage);
|
|
2386
|
-
}
|
|
2387
|
-
/**
|
|
2388
|
-
* Creates a AdmNotification from a native ADM payload.
|
|
2389
|
-
* @param nativeMessage - The native message payload to send to Notification Hubs.
|
|
2390
|
-
* @returns The AdmNotification to send to Notification Hubs.
|
|
2391
|
-
*/
|
|
2392
|
-
function createAdmNotificationBody(nativeMessage) {
|
|
2393
|
-
return JSON.stringify(nativeMessage);
|
|
2394
|
-
}
|
|
2395
|
-
/**
|
|
2396
|
-
* Creates a BaiduNotification from a native Baidu payload.
|
|
2397
|
-
* @param nativeMessage - The native message payload to send to Notification Hubs.
|
|
2398
|
-
* @returns The JSON body to send to Notification Hubs.
|
|
2399
|
-
*/
|
|
2400
|
-
function createBaiduNotificationBody(nativeMessage) {
|
|
2401
|
-
return JSON.stringify(nativeMessage);
|
|
2402
|
-
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Builds a WindowsNotification from a Windows Badge.
|
|
2405
|
-
* @param nativeMessage - The Windows Badge Message to build.
|
|
2406
|
-
* @returns The WNS XML created with the badge information.
|
|
2407
|
-
*/
|
|
2408
|
-
function createWindowsBadgeNotificationBody(nativeMessage) {
|
|
2409
|
-
const badge = {
|
|
2410
|
-
$: { value: nativeMessage.value },
|
|
2411
|
-
};
|
|
2412
|
-
return coreXml.stringifyXML(badge, { rootName: "badge" });
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
// Copyright (c) Microsoft Corporation.
|
|
2416
|
-
// Licensed under the MIT license.
|
|
2417
|
-
/**
|
|
2418
|
-
* Creates an ADM registration description.
|
|
2419
|
-
* @param description - A partial ADM registration description.
|
|
2420
|
-
* @returns A created ADM registration description.
|
|
2421
|
-
*/
|
|
2422
|
-
function createAdmRegistrationDescription(description) {
|
|
2423
|
-
return Object.assign(Object.assign({}, description), { kind: "Adm" });
|
|
2424
|
-
}
|
|
2425
|
-
/**
|
|
2426
|
-
* Creates an ADM template registration description.
|
|
2427
|
-
* @param description - A partial ADM template registration description.
|
|
2428
|
-
* @returns A created ADM template registration description.
|
|
2429
|
-
*/
|
|
2430
|
-
function createAdmTemplateRegistrationDescription(description) {
|
|
2431
|
-
return Object.assign(Object.assign({}, description), { kind: "AdmTemplate" });
|
|
2432
|
-
}
|
|
2433
|
-
/**
|
|
2434
|
-
* Creates an Apple registration description.
|
|
2435
|
-
* @param description - A partial Apple registration description.
|
|
2436
|
-
* @returns A created Apple registration description.
|
|
2437
|
-
*/
|
|
2438
|
-
function createAppleRegistrationDescription(description) {
|
|
2439
|
-
return Object.assign(Object.assign({}, description), { kind: "Apple" });
|
|
2440
|
-
}
|
|
2441
|
-
/**
|
|
2442
|
-
* Creates an Apple template registration description.
|
|
2443
|
-
* @param description - A partial Apple template registration description.
|
|
2444
|
-
* @returns A created Apple template registration description.
|
|
2445
|
-
*/
|
|
2446
|
-
function createAppleTemplateRegistrationDescription(description) {
|
|
2447
|
-
return Object.assign(Object.assign({}, description), { kind: "AppleTemplate" });
|
|
2448
|
-
}
|
|
2449
|
-
/**
|
|
2450
|
-
* Creates a Baidu registration description.
|
|
2451
|
-
* @param description - A partial Baidu registration description.
|
|
2452
|
-
* @returns A created Baidu registration description.
|
|
2453
|
-
*/
|
|
2454
|
-
function createBaiduRegistrationDescription(description) {
|
|
2455
|
-
return Object.assign(Object.assign({}, description), { kind: "Baidu" });
|
|
2456
|
-
}
|
|
2457
|
-
/**
|
|
2458
|
-
* Creates a Baidu template registration description.
|
|
2459
|
-
* @param description - A partial Baidu template registration description.
|
|
2460
|
-
* @returns A created Baidu template registration description.
|
|
2461
|
-
*/
|
|
2462
|
-
function createBaiduTemplateRegistrationDescription(description) {
|
|
2463
|
-
return Object.assign(Object.assign({}, description), { kind: "BaiduTemplate" });
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Creates a Web Push registration description.
|
|
2467
|
-
* @param description - A partial Web Push registration description.
|
|
2468
|
-
* @returns A created Web Push registration description.
|
|
2469
|
-
*/
|
|
2470
|
-
function createBrowserRegistrationDescription(description) {
|
|
2471
|
-
return Object.assign(Object.assign({}, description), { kind: "Browser" });
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Creates a Web Push registration description.
|
|
2475
|
-
* @param description - A partial Web Push template registration description.
|
|
2476
|
-
* @returns A created Web Push template registration description.
|
|
2477
|
-
*/
|
|
2478
|
-
function createBrowserTemplateRegistrationDescription(description) {
|
|
2479
|
-
return Object.assign(Object.assign({}, description), { kind: "BrowserTemplate" });
|
|
2480
|
-
}
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates a Firebase Legacy registration description.
|
|
2483
|
-
* @param description - A partial GCM registration description.
|
|
2484
|
-
* @returns A created GCM registration description.
|
|
2485
|
-
*/
|
|
2486
|
-
function createFcmLegacyRegistrationDescription(description) {
|
|
2487
|
-
return Object.assign(Object.assign({}, description), { kind: "Gcm" });
|
|
2488
|
-
}
|
|
2489
|
-
/**
|
|
2490
|
-
* Creates a GCM template registration description.
|
|
2491
|
-
* @param description - A partial GCM template registration description.
|
|
2492
|
-
* @returns A created GCM template registration description.
|
|
2493
|
-
*/
|
|
2494
|
-
function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
2495
|
-
return Object.assign(Object.assign({}, description), { kind: "GcmTemplate" });
|
|
2496
|
-
}
|
|
2497
|
-
/**
|
|
2498
|
-
* Creates a Firebase V1 registration description.
|
|
2499
|
-
* @param description - A partial FCM V1 registration description.
|
|
2500
|
-
* @returns A created FCM V1 registration description.
|
|
2501
|
-
*/
|
|
2502
|
-
function createFcmV1RegistrationDescription(description) {
|
|
2503
|
-
return Object.assign(Object.assign({}, description), { kind: "FcmV1" });
|
|
2504
|
-
}
|
|
2505
|
-
/**
|
|
2506
|
-
* Creates a FCM V1 template registration description.
|
|
2507
|
-
* @param description - A partial FCM V1 template registration description.
|
|
2508
|
-
* @returns A created FCM V1 template registration description.
|
|
2509
|
-
*/
|
|
2510
|
-
function createFcmV1TemplateRegistrationDescription(description) {
|
|
2511
|
-
return Object.assign(Object.assign({}, description), { kind: "FcmV1Template" });
|
|
2512
|
-
}
|
|
2513
|
-
/**
|
|
2514
|
-
* Creates a Windows registration description.
|
|
2515
|
-
* @param description - A partial Windows registration description.
|
|
2516
|
-
* @returns A created Windows registration description.
|
|
2517
|
-
*/
|
|
2518
|
-
function createWindowsRegistrationDescription(description) {
|
|
2519
|
-
return Object.assign(Object.assign({}, description), { kind: "Windows" });
|
|
2520
|
-
}
|
|
2521
|
-
/**
|
|
2522
|
-
* Creates a Windows template registration description.
|
|
2523
|
-
* @param description - A partial Windows template registration description.
|
|
2524
|
-
* @returns A created Windows template registration description.
|
|
2525
|
-
*/
|
|
2526
|
-
function createWindowsTemplateRegistrationDescription(description) {
|
|
2527
|
-
return Object.assign(Object.assign({}, description), { kind: "WindowsTemplate" });
|
|
2528
|
-
}
|
|
2529
|
-
/**
|
|
2530
|
-
* Creates a Xiaomi registration description.
|
|
2531
|
-
* @param description - A partial Xiaomi registration description.
|
|
2532
|
-
* @returns A created Xiaomi registration description.
|
|
2533
|
-
*/
|
|
2534
|
-
function createXiaomiRegistrationDescription(description) {
|
|
2535
|
-
return Object.assign(Object.assign({}, description), { kind: "Xiaomi" });
|
|
2536
|
-
}
|
|
2537
|
-
/**
|
|
2538
|
-
* Creates a Xiaomi template registration description.
|
|
2539
|
-
* @param description - A partial Xiaomi template registration description.
|
|
2540
|
-
* @returns A created Xiaomi template registration description.
|
|
2541
|
-
*/
|
|
2542
|
-
function createXiaomiTemplateRegistrationDescription(description) {
|
|
2543
|
-
return Object.assign(Object.assign({}, description), { kind: "XiaomiTemplate" });
|
|
2544
|
-
}
|
|
2545
|
-
|
|
2546
|
-
// Copyright (c) Microsoft Corporation.
|
|
2547
|
-
// Licensed under the MIT license.
|
|
2548
|
-
/**
|
|
2549
|
-
* Creates a tag expression from a list of tags as a || expression.
|
|
2550
|
-
* @param tags - The tags to create the || expression
|
|
2551
|
-
* @returns The tag expression made from the array of strings into an || expression.
|
|
2552
|
-
*/
|
|
2553
|
-
function createTagExpression(tags) {
|
|
2554
|
-
return tags.join("||");
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
exports.NotificationHubsClient = NotificationHubsClient;
|
|
2558
|
-
exports.createAdmInstallation = createAdmInstallation;
|
|
2559
|
-
exports.createAdmNotification = createAdmNotification;
|
|
2560
|
-
exports.createAdmNotificationBody = createAdmNotificationBody;
|
|
2561
|
-
exports.createAdmRegistrationDescription = createAdmRegistrationDescription;
|
|
2562
|
-
exports.createAdmTemplateRegistrationDescription = createAdmTemplateRegistrationDescription;
|
|
2563
|
-
exports.createAppleInstallation = createAppleInstallation;
|
|
2564
|
-
exports.createAppleNotification = createAppleNotification;
|
|
2565
|
-
exports.createAppleNotificationBody = createAppleNotificationBody;
|
|
2566
|
-
exports.createAppleRegistrationDescription = createAppleRegistrationDescription;
|
|
2567
|
-
exports.createAppleTemplateRegistrationDescription = createAppleTemplateRegistrationDescription;
|
|
2568
|
-
exports.createBaiduInstallation = createBaiduInstallation;
|
|
2569
|
-
exports.createBaiduNotification = createBaiduNotification;
|
|
2570
|
-
exports.createBaiduNotificationBody = createBaiduNotificationBody;
|
|
2571
|
-
exports.createBaiduRegistrationDescription = createBaiduRegistrationDescription;
|
|
2572
|
-
exports.createBaiduTemplateRegistrationDescription = createBaiduTemplateRegistrationDescription;
|
|
2573
|
-
exports.createBrowserInstallation = createBrowserInstallation;
|
|
2574
|
-
exports.createBrowserNotification = createBrowserNotification;
|
|
2575
|
-
exports.createBrowserRegistrationDescription = createBrowserRegistrationDescription;
|
|
2576
|
-
exports.createBrowserTemplateRegistrationDescription = createBrowserTemplateRegistrationDescription;
|
|
2577
|
-
exports.createFcmLegacyInstallation = createFcmLegacyInstallation;
|
|
2578
|
-
exports.createFcmLegacyNotification = createFcmLegacyNotification;
|
|
2579
|
-
exports.createFcmLegacyRegistrationDescription = createFcmLegacyRegistrationDescription;
|
|
2580
|
-
exports.createFcmLegacyTemplateRegistrationDescription = createFcmLegacyTemplateRegistrationDescription;
|
|
2581
|
-
exports.createFcmV1Installation = createFcmV1Installation;
|
|
2582
|
-
exports.createFcmV1Notification = createFcmV1Notification;
|
|
2583
|
-
exports.createFcmV1RegistrationDescription = createFcmV1RegistrationDescription;
|
|
2584
|
-
exports.createFcmV1TemplateRegistrationDescription = createFcmV1TemplateRegistrationDescription;
|
|
2585
|
-
exports.createFirebaseLegacyNotificationBody = createFirebaseLegacyNotificationBody;
|
|
2586
|
-
exports.createFirebaseV1NotificationBody = createFirebaseV1NotificationBody;
|
|
2587
|
-
exports.createTagExpression = createTagExpression;
|
|
2588
|
-
exports.createTemplateNotification = createTemplateNotification;
|
|
2589
|
-
exports.createWindowsBadgeNotification = createWindowsBadgeNotification;
|
|
2590
|
-
exports.createWindowsBadgeNotificationBody = createWindowsBadgeNotificationBody;
|
|
2591
|
-
exports.createWindowsInstallation = createWindowsInstallation;
|
|
2592
|
-
exports.createWindowsNotification = createWindowsNotification;
|
|
2593
|
-
exports.createWindowsRawNotification = createWindowsRawNotification;
|
|
2594
|
-
exports.createWindowsRegistrationDescription = createWindowsRegistrationDescription;
|
|
2595
|
-
exports.createWindowsTemplateRegistrationDescription = createWindowsTemplateRegistrationDescription;
|
|
2596
|
-
exports.createWindowsTileNotification = createWindowsTileNotification;
|
|
2597
|
-
exports.createWindowsToastNotification = createWindowsToastNotification;
|
|
2598
|
-
exports.createXiaomiInstallation = createXiaomiInstallation;
|
|
2599
|
-
exports.createXiaomiNotification = createXiaomiNotification;
|
|
2600
|
-
exports.createXiaomiRegistrationDescription = createXiaomiRegistrationDescription;
|
|
2601
|
-
exports.createXiaomiTemplateRegistrationDescription = createXiaomiTemplateRegistrationDescription;
|
|
2602
|
-
//# sourceMappingURL=index.cjs.map
|