@azure/notification-hubs 1.0.0-beta.6 → 1.0.0-beta.7

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.
Files changed (215) hide show
  1. package/README.md +84 -77
  2. package/dist/index.cjs +312 -369
  3. package/dist/index.cjs.map +1 -1
  4. package/dist-esm/src/{client → api}/beginSubmitNotificationHubJob.js +0 -0
  5. package/dist-esm/src/api/beginSubmitNotificationHubJob.js.map +1 -0
  6. package/dist-esm/src/{client → api}/cancelScheduledNotification.js +0 -0
  7. package/dist-esm/src/api/cancelScheduledNotification.js.map +1 -0
  8. package/dist-esm/src/{client → api}/createOrUpdateInstallation.js +0 -0
  9. package/dist-esm/src/api/createOrUpdateInstallation.js.map +1 -0
  10. package/dist-esm/src/{client → api}/createOrUpdateRegistration.js +0 -0
  11. package/dist-esm/src/api/createOrUpdateRegistration.js.map +1 -0
  12. package/dist-esm/src/{client → api}/createRegistration.js +0 -0
  13. package/dist-esm/src/api/createRegistration.js.map +1 -0
  14. package/dist-esm/src/{client → api}/createRegistrationId.js +0 -0
  15. package/dist-esm/src/api/createRegistrationId.js.map +1 -0
  16. package/dist-esm/src/{client → api}/deleteInstallation.js +0 -0
  17. package/dist-esm/src/api/deleteInstallation.js.map +1 -0
  18. package/dist-esm/src/{client → api}/deleteRegistration.js +0 -0
  19. package/dist-esm/src/api/deleteRegistration.js.map +1 -0
  20. package/dist-esm/src/{client → api}/getFeedbackContainerUrl.js +0 -0
  21. package/dist-esm/src/api/getFeedbackContainerUrl.js.map +1 -0
  22. package/dist-esm/src/{client → api}/getInstallation.js +0 -0
  23. package/dist-esm/src/api/getInstallation.js.map +1 -0
  24. package/dist-esm/src/{client → api}/getNotificationHubJob.js +0 -0
  25. package/dist-esm/src/api/getNotificationHubJob.js.map +1 -0
  26. package/dist-esm/src/{client → api}/getNotificationOutcomeDetails.js +0 -0
  27. package/dist-esm/src/api/getNotificationOutcomeDetails.js.map +1 -0
  28. package/dist-esm/src/{client → api}/getRegistration.js +0 -0
  29. package/dist-esm/src/api/getRegistration.js.map +1 -0
  30. package/dist-esm/src/{client → api}/index.js +22 -0
  31. package/dist-esm/src/api/index.js.map +1 -0
  32. package/dist-esm/src/{client → api}/internal/_client.js +1 -1
  33. package/dist-esm/src/api/internal/_client.js.map +1 -0
  34. package/dist-esm/src/{client → api}/internal/_createOrUpdateRegistrationDescription.js +0 -0
  35. package/dist-esm/src/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
  36. package/dist-esm/src/{client/listRegistrations.js → api/internal/_listRegistrations.js} +6 -38
  37. package/dist-esm/src/api/internal/_listRegistrations.js.map +1 -0
  38. package/dist-esm/src/{client → api}/listNotificationHubJobs.js +0 -0
  39. package/dist-esm/src/api/listNotificationHubJobs.js.map +1 -0
  40. package/dist-esm/src/api/listRegistrations.js +35 -0
  41. package/dist-esm/src/api/listRegistrations.js.map +1 -0
  42. package/dist-esm/src/api/listRegistrationsByChannel.js +58 -0
  43. package/dist-esm/src/api/listRegistrationsByChannel.js.map +1 -0
  44. package/dist-esm/src/{client → api}/listRegistrationsByTag.js +0 -0
  45. package/dist-esm/src/api/listRegistrationsByTag.js.map +1 -0
  46. package/dist-esm/src/{client → api}/scheduleNotification.js +2 -3
  47. package/dist-esm/src/api/scheduleNotification.js.map +1 -0
  48. package/dist-esm/src/{client → api}/sendNotification.js +3 -3
  49. package/dist-esm/src/api/sendNotification.js.map +1 -0
  50. package/dist-esm/src/{client → api}/submitNotificationHubJob.js +0 -0
  51. package/dist-esm/src/api/submitNotificationHubJob.js.map +1 -0
  52. package/dist-esm/src/{client → api}/updateInstallation.js +0 -0
  53. package/dist-esm/src/api/updateInstallation.js.map +1 -0
  54. package/dist-esm/src/{client → api}/updateRegistration.js +0 -0
  55. package/dist-esm/src/api/updateRegistration.js.map +1 -0
  56. package/dist-esm/src/index.js +3 -2
  57. package/dist-esm/src/index.js.map +1 -1
  58. package/dist-esm/src/models/index.js +12 -0
  59. package/dist-esm/src/models/index.js.map +1 -0
  60. package/dist-esm/src/models/installation.js.map +1 -1
  61. package/dist-esm/src/models/notification.js.map +1 -1
  62. package/dist-esm/src/models/notificationBodyBuilder.js +48 -0
  63. package/dist-esm/src/models/notificationBodyBuilder.js.map +1 -0
  64. package/dist-esm/src/models/notificationDetails.js.map +1 -1
  65. package/dist-esm/src/models/options.js.map +1 -1
  66. package/dist-esm/src/models/registration.js +12 -12
  67. package/dist-esm/src/models/registration.js.map +1 -1
  68. package/dist-esm/src/models/tagExpressionBuilder.js +11 -0
  69. package/dist-esm/src/models/tagExpressionBuilder.js.map +1 -0
  70. package/dist-esm/src/notificationHubsClient.js +34 -24
  71. package/dist-esm/src/notificationHubsClient.js.map +1 -1
  72. package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -1
  73. package/dist-esm/src/serializers/notificationOutcomeSerializer.js +2 -2
  74. package/dist-esm/src/serializers/notificationOutcomeSerializer.js.map +1 -1
  75. package/dist-esm/src/serializers/registrationSerializer.js +16 -16
  76. package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
  77. package/dist-esm/src/utils/constants.js +1 -1
  78. package/dist-esm/src/utils/constants.js.map +1 -1
  79. package/dist-esm/src/utils/notificationUtils.js +0 -6
  80. package/dist-esm/src/utils/notificationUtils.js.map +1 -1
  81. package/package.json +9 -13
  82. package/types/3.1/notification-hubs.d.ts +420 -249
  83. package/types/latest/notification-hubs.d.ts +448 -254
  84. package/types/latest/tsdoc-metadata.json +1 -1
  85. package/types/src/{client → api}/beginSubmitNotificationHubJob.d.ts +0 -0
  86. package/types/src/api/beginSubmitNotificationHubJob.d.ts.map +1 -0
  87. package/types/src/{client → api}/cancelScheduledNotification.d.ts +0 -0
  88. package/types/src/api/cancelScheduledNotification.d.ts.map +1 -0
  89. package/types/src/{client → api}/createOrUpdateInstallation.d.ts +0 -0
  90. package/types/src/api/createOrUpdateInstallation.d.ts.map +1 -0
  91. package/types/src/{client → api}/createOrUpdateRegistration.d.ts +0 -0
  92. package/types/src/api/createOrUpdateRegistration.d.ts.map +1 -0
  93. package/types/src/{client → api}/createRegistration.d.ts +0 -0
  94. package/types/src/api/createRegistration.d.ts.map +1 -0
  95. package/types/src/{client → api}/createRegistrationId.d.ts +0 -0
  96. package/types/src/api/createRegistrationId.d.ts.map +1 -0
  97. package/types/src/{client → api}/deleteInstallation.d.ts +0 -0
  98. package/types/src/api/deleteInstallation.d.ts.map +1 -0
  99. package/types/src/{client → api}/deleteRegistration.d.ts +0 -0
  100. package/types/src/api/deleteRegistration.d.ts.map +1 -0
  101. package/types/src/{client → api}/getFeedbackContainerUrl.d.ts +0 -0
  102. package/types/src/api/getFeedbackContainerUrl.d.ts.map +1 -0
  103. package/types/src/{client → api}/getInstallation.d.ts +0 -0
  104. package/types/src/api/getInstallation.d.ts.map +1 -0
  105. package/types/src/{client → api}/getNotificationHubJob.d.ts +0 -0
  106. package/types/src/api/getNotificationHubJob.d.ts.map +1 -0
  107. package/types/src/{client → api}/getNotificationOutcomeDetails.d.ts +0 -0
  108. package/types/src/api/getNotificationOutcomeDetails.d.ts.map +1 -0
  109. package/types/src/{client → api}/getRegistration.d.ts +0 -0
  110. package/types/src/api/getRegistration.d.ts.map +1 -0
  111. package/types/src/{client → api}/index.d.ts +22 -0
  112. package/types/src/api/index.d.ts.map +1 -0
  113. package/types/src/{client → api}/internal/_client.d.ts +0 -0
  114. package/types/src/api/internal/_client.d.ts.map +1 -0
  115. package/types/src/{client → api}/internal/_createOrUpdateRegistrationDescription.d.ts +0 -0
  116. package/types/src/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
  117. package/types/src/api/internal/_listRegistrations.d.ts +6 -0
  118. package/types/src/api/internal/_listRegistrations.d.ts.map +1 -0
  119. package/types/src/{client → api}/listNotificationHubJobs.d.ts +0 -0
  120. package/types/src/api/listNotificationHubJobs.d.ts.map +1 -0
  121. package/types/src/{client → api}/listRegistrations.d.ts +3 -3
  122. package/types/src/api/listRegistrations.d.ts.map +1 -0
  123. package/types/src/api/listRegistrationsByChannel.d.ts +13 -0
  124. package/types/src/api/listRegistrationsByChannel.d.ts.map +1 -0
  125. package/types/src/{client → api}/listRegistrationsByTag.d.ts +0 -0
  126. package/types/src/api/listRegistrationsByTag.d.ts.map +1 -0
  127. package/types/src/{client → api}/scheduleNotification.d.ts +0 -0
  128. package/types/src/api/scheduleNotification.d.ts.map +1 -0
  129. package/types/src/{client → api}/sendNotification.d.ts +0 -0
  130. package/types/src/api/sendNotification.d.ts.map +1 -0
  131. package/types/src/{client → api}/submitNotificationHubJob.d.ts +0 -0
  132. package/types/src/api/submitNotificationHubJob.d.ts.map +1 -0
  133. package/types/src/{client → api}/updateInstallation.d.ts +0 -0
  134. package/types/src/api/updateInstallation.d.ts.map +1 -0
  135. package/types/src/{client → api}/updateRegistration.d.ts +0 -0
  136. package/types/src/api/updateRegistration.d.ts.map +1 -0
  137. package/types/src/index.d.ts +3 -2
  138. package/types/src/index.d.ts.map +1 -1
  139. package/types/src/models/index.d.ts +10 -0
  140. package/types/src/models/index.d.ts.map +1 -0
  141. package/types/src/models/installation.d.ts +12 -11
  142. package/types/src/models/installation.d.ts.map +1 -1
  143. package/types/src/models/notification.d.ts +10 -18
  144. package/types/src/models/notification.d.ts.map +1 -1
  145. package/types/src/models/{notificationBuilder.d.ts → notificationBodyBuilder.d.ts} +62 -64
  146. package/types/src/models/notificationBodyBuilder.d.ts.map +1 -0
  147. package/types/src/models/notificationDetails.d.ts +9 -9
  148. package/types/src/models/notificationDetails.d.ts.map +1 -1
  149. package/types/src/models/options.d.ts +4 -4
  150. package/types/src/models/options.d.ts.map +1 -1
  151. package/types/src/models/registration.d.ts +235 -69
  152. package/types/src/models/registration.d.ts.map +1 -1
  153. package/types/src/models/tagExpressionBuilder.d.ts +7 -0
  154. package/types/src/models/tagExpressionBuilder.d.ts.map +1 -0
  155. package/types/src/notificationHubsClient.d.ts +12 -5
  156. package/types/src/notificationHubsClient.d.ts.map +1 -1
  157. package/types/src/serializers/registrationSerializer.d.ts +14 -14
  158. package/types/src/serializers/registrationSerializer.d.ts.map +1 -1
  159. package/types/src/utils/notificationUtils.d.ts +0 -4
  160. package/types/src/utils/notificationUtils.d.ts.map +1 -1
  161. package/dist-esm/src/client/beginSubmitNotificationHubJob.js.map +0 -1
  162. package/dist-esm/src/client/cancelScheduledNotification.js.map +0 -1
  163. package/dist-esm/src/client/createOrUpdateInstallation.js.map +0 -1
  164. package/dist-esm/src/client/createOrUpdateRegistration.js.map +0 -1
  165. package/dist-esm/src/client/createRegistration.js.map +0 -1
  166. package/dist-esm/src/client/createRegistrationId.js.map +0 -1
  167. package/dist-esm/src/client/deleteInstallation.js.map +0 -1
  168. package/dist-esm/src/client/deleteRegistration.js.map +0 -1
  169. package/dist-esm/src/client/getFeedbackContainerUrl.js.map +0 -1
  170. package/dist-esm/src/client/getInstallation.js.map +0 -1
  171. package/dist-esm/src/client/getNotificationHubJob.js.map +0 -1
  172. package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +0 -1
  173. package/dist-esm/src/client/getRegistration.js.map +0 -1
  174. package/dist-esm/src/client/index.js.map +0 -1
  175. package/dist-esm/src/client/internal/_client.js.map +0 -1
  176. package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +0 -1
  177. package/dist-esm/src/client/listNotificationHubJobs.js.map +0 -1
  178. package/dist-esm/src/client/listRegistrations.js.map +0 -1
  179. package/dist-esm/src/client/listRegistrationsByTag.js.map +0 -1
  180. package/dist-esm/src/client/scheduleNotification.js.map +0 -1
  181. package/dist-esm/src/client/sendNotification.js.map +0 -1
  182. package/dist-esm/src/client/submitNotificationHubJob.js.map +0 -1
  183. package/dist-esm/src/client/updateInstallation.js.map +0 -1
  184. package/dist-esm/src/client/updateRegistration.js.map +0 -1
  185. package/dist-esm/src/models/notificationBuilder.js +0 -169
  186. package/dist-esm/src/models/notificationBuilder.js.map +0 -1
  187. package/dist-esm/src/utils/retryPolicy.js +0 -144
  188. package/dist-esm/src/utils/retryPolicy.js.map +0 -1
  189. package/types/src/client/beginSubmitNotificationHubJob.d.ts.map +0 -1
  190. package/types/src/client/cancelScheduledNotification.d.ts.map +0 -1
  191. package/types/src/client/createOrUpdateInstallation.d.ts.map +0 -1
  192. package/types/src/client/createOrUpdateRegistration.d.ts.map +0 -1
  193. package/types/src/client/createRegistration.d.ts.map +0 -1
  194. package/types/src/client/createRegistrationId.d.ts.map +0 -1
  195. package/types/src/client/deleteInstallation.d.ts.map +0 -1
  196. package/types/src/client/deleteRegistration.d.ts.map +0 -1
  197. package/types/src/client/getFeedbackContainerUrl.d.ts.map +0 -1
  198. package/types/src/client/getInstallation.d.ts.map +0 -1
  199. package/types/src/client/getNotificationHubJob.d.ts.map +0 -1
  200. package/types/src/client/getNotificationOutcomeDetails.d.ts.map +0 -1
  201. package/types/src/client/getRegistration.d.ts.map +0 -1
  202. package/types/src/client/index.d.ts.map +0 -1
  203. package/types/src/client/internal/_client.d.ts.map +0 -1
  204. package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts.map +0 -1
  205. package/types/src/client/listNotificationHubJobs.d.ts.map +0 -1
  206. package/types/src/client/listRegistrations.d.ts.map +0 -1
  207. package/types/src/client/listRegistrationsByTag.d.ts.map +0 -1
  208. package/types/src/client/scheduleNotification.d.ts.map +0 -1
  209. package/types/src/client/sendNotification.d.ts.map +0 -1
  210. package/types/src/client/submitNotificationHubJob.d.ts.map +0 -1
  211. package/types/src/client/updateInstallation.d.ts.map +0 -1
  212. package/types/src/client/updateRegistration.d.ts.map +0 -1
  213. package/types/src/models/notificationBuilder.d.ts.map +0 -1
  214. package/types/src/utils/retryPolicy.d.ts +0 -72
  215. package/types/src/utils/retryPolicy.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"notificationHubsClient.js","sourceRoot":"","sources":["../../src/notificationHubsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAmBlC,OAAO,EAAiC,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;A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AAE;QAEzC,OAAO,0BAA0B,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACH,2BAA2B,CACzB,cAAsB,EACtB,UAA4B,EAAE;QAE9B,OAAO,iCAAiC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,6BAA6B,CAC3B,cAAsB,EACtB,UAA4B,EAAE;QAE9B,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CACnB,KAAa,EACb,UAA4B,EAAE;QAE9B,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,6BAA6B,CAC3B,kBAAsC,EACtC,UAAkC,EAAE;QAEpC,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACH,wBAAwB,CACtB,GAAuB,EACvB,UAA4B,EAAE;QAE9B,OAAO,8BAA8B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DirectSendNotificationOptions,\n EntityOperationOptions,\n NotificationHubsClientOptions,\n PolledOperationOptions,\n RegistrationQueryLimitOptions,\n RegistrationQueryOptions,\n ScheduleNotificationOptions,\n SendNotificationOptions,\n} from \"./models/options.js\";\nimport { Installation, JsonPatch } from \"./models/installation.js\";\nimport {\n NotificationDetails,\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"./models/notificationDetails.js\";\nimport { NotificationHubJob, NotificationHubJobPoller } from \"./models/notificationHubJob.js\";\nimport { NotificationHubsClientContext, createClientContext } from \"./client/index.js\";\nimport { Notification } from \"./models/notification.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"./models/registration.js\";\nimport { beginSubmitNotificationHubJob as beginSubmitNotificationHubJobMethod } from \"./client/beginSubmitNotificationHubJob.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./client/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./client/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./client/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./client/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./client/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./client/deleteInstallation.js\";\nimport { deleteRegistration } from \"./client/deleteRegistration.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./client/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./client/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./client/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./client/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./client/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./client/listNotificationHubJobs.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./client/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./client/listRegistrations.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./client/scheduleNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./client/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./client/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./client/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./client/updateRegistration.js\";\n\n/**\n * This represents a client for Azure Notification Hubs to manage installations and send\n * messages to devices.\n */\nexport class NotificationHubsServiceClient {\n private _client: NotificationHubsClientContext;\n\n /**\n * Creates a new instance of the NotificationClient with a connection string, hub name and options.\n * @param connectionString - The Notification Hub Access Policy connection string.\n * @param hubName - The name of the Azure Notification Hub.\n * @param options - Options for configuring the Azure Notification Hubs client.\n */\n constructor(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n ) {\n this._client = createClientContext(connectionString, hubName, options);\n }\n\n /**\n * Creates or overwrites an installation to a Notification Hub.\n * @param installation - The installation to create or overwrite.\n * @param options - Configuration options for the create or update installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n createOrUpdateInstallation(\n installation: Installation,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return createOrUpdateInstallationMethod(this._client, installation, options);\n }\n\n /**\n * Deletes an installation from a Notification Hub.\n * @param installationId - The installation ID of the installation to delete.\n * @param options - Configuration options for the installation delete operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteInstallation(\n installationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param installationId - The ID of the installation to get.\n * @param options - Configuration options for the get installation operation.\n * @returns The installation that matches the installation ID.\n */\n getInstallation(installationId: string, options: OperationOptions = {}): Promise<Installation> {\n return getInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param installationId - The ID of the installation to update.\n * @param patches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n updateInstallation(\n installationId: string,\n patches: JsonPatch[],\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return updateInstallationMethod(this._client, installationId, patches, options);\n }\n\n /**\n * Creates a new registration ID.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\n createRegistrationId(options: OperationOptions = {}): Promise<string> {\n return createRegistrationIdMethod(this._client, options);\n }\n\n /**\n * Creates a new registration. This method generates a registration ID,\n * which you can subsequently use to retrieve, update, and delete this registration.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\n createRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Creates or updates a registration.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\n createOrUpdateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createOrUpdateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Updates an existing registration.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\n updateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return updateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Deletes a registration with the given registration ID.\n * @param context - The Notification Hubs client.\n * @param registrationId - The registration ID of the registration to delete.\n * @param options - The options for delete operations including the ETag\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteRegistration(\n registrationId: string,\n options: EntityOperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteRegistration(this._client, registrationId, options);\n }\n\n /**\n * Gets a registration by the given registration ID.\n * @param registrationId - The ID of the registration to get.\n * @param options - The options for getting a registration by ID.\n * @returns A RegistrationDescription that has the given registration ID.\n */\n getRegistration(\n registrationId: string,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return getRegistrationMethod(this._client, registrationId, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given query options.\n * @param options - The options for querying the registrations such as $top and $filter.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n options: RegistrationQueryOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Lists all registrations with the matching tag.\n * @param tag - The tag to query for matching registrations.\n * @param options - The query options such as $top.\n * @returns A paged async iterable containing the matching registrations for the notification hub.\n */\n listRegistrationsByTag(\n tag: string,\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions = { enableTestSend: false }\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(this._client, scheduledTime, notification, options);\n }\n\n /**\n * Cancels the scheduled notification with the given notification ID.\n * @param notificationId - The notification ID from the scheduled notification.\n * @param options - The operation options.\n * @returns A notification hub response with correlation ID and tracking ID.\n */\n cancelScheduledNotification(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return cancelScheduledNotificationMethod(this._client, notificationId, options);\n }\n\n /**\n * Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.\n * The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.\n * @param options - The options for getting the push notification feedback container URL.\n * @returns The URL of the Azure Storage Container containing the feedback data.\n */\n getFeedbackContainerUrl(options: OperationOptions = {}): Promise<string> {\n return getFeedbackContainerUrlMethod(this._client, options);\n }\n\n /**\n * Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed\n * or final results if the Send* has completed. This API can only be called for Standard SKU and above.\n * @param notificationId - The notification ID returned from the send operation.\n * @param options - The operation options.\n * @returns The results of the send operation.\n */\n getNotificationOutcomeDetails(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationDetails> {\n return getNotificationOutcomeDetailsMethod(this._client, notificationId, options);\n }\n\n /**\n * Gets a Notification Hub Job by the ID.\n * @param jobId - The Notification Hub Job ID.\n * @param options - The operation options.\n * @returns The Notification Hub Job with the matching ID.\n */\n getNotificationHubJob(\n jobId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return getNotificationHubJobMethod(this._client, jobId, options);\n }\n\n /**\n * Submits a Notification Hub job and creates a poller to poll for results.\n * @param notificationHubJob - The Notification Hub import/export job to start.\n * @param options - The operation options.\n * @returns A poller which can be called to poll until completion of the job.\n */\n beginSubmitNotificationHubJob(\n notificationHubJob: NotificationHubJob,\n options: PolledOperationOptions = {}\n ): Promise<NotificationHubJobPoller> {\n return beginSubmitNotificationHubJobMethod(this._client, notificationHubJob, options);\n }\n\n /**\n * Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.\n * @param job - The notification hub job to submit.\n * @param options - The operation options.\n * @returns The notification hub job details including job ID and status.\n */\n submitNotificationHubJob(\n job: NotificationHubJob,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return submitNotificationHubJobMethod(this._client, job, options);\n }\n\n /**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\n listNotificationHubJobs(options: OperationOptions = {}): Promise<NotificationHubJob[]> {\n return listNotificationHubJobsMethod(this._client, options);\n }\n}\n"]}
1
+ {"version":3,"file":"notificationHubsClient.js","sourceRoot":"","sources":["../../src/notificationHubsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkBlC,OAAO,EAAiC,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAKpF,OAAO,EAAE,6BAA6B,IAAI,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC9H,OAAO,EAAE,2BAA2B,IAAI,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AACxH,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACrH,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACrH,OAAO,EAAE,oBAAoB,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,kBAAkB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,kBAAkB,IAAI,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,uBAAuB,IAAI,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAC5G,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,qBAAqB,IAAI,2BAA2B,EAAE,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,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CACnB,KAAa,EACb,UAA4B,EAAE;QAE9B,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,6BAA6B,CAC3B,kBAAsC,EACtC,UAAkC,EAAE;QAEpC,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACH,wBAAwB,CACtB,GAAuB,EACvB,UAA4B,EAAE;QAE9B,OAAO,8BAA8B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DirectSendNotificationOptions,\n EntityOperationOptions,\n NotificationHubsClientOptions,\n PolledOperationOptions,\n RegistrationQueryLimitOptions,\n ScheduleNotificationOptions,\n SendNotificationOptions,\n} from \"./models/options.js\";\nimport { Installation, JsonPatch } from \"./models/installation.js\";\nimport {\n NotificationDetails,\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"./models/notificationDetails.js\";\nimport { NotificationHubJob, NotificationHubJobPoller } from \"./models/notificationHubJob.js\";\nimport { NotificationHubsClientContext, createClientContext } from \"./api/index.js\";\nimport { RegistrationDescription, RegistrationChannel } from \"./models/registration.js\";\nimport { Notification } from \"./models/notification.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { beginSubmitNotificationHubJob as beginSubmitNotificationHubJobMethod } from \"./api/beginSubmitNotificationHubJob.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./api/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./api/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./api/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./api/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./api/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./api/deleteInstallation.js\";\nimport { deleteRegistration } from \"./api/deleteRegistration.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./api/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./api/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./api/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./api/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./api/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./api/listNotificationHubJobs.js\";\nimport { listRegistrationsByChannel as listRegistrationsByChannelMethod } from \"./api/listRegistrationsByChannel.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./api/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./api/listRegistrations.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./api/scheduleNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./api/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./api/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./api/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./api/updateRegistration.js\";\n\n/**\n * This represents a client for Azure Notification Hubs to manage installations and send\n * messages to devices.\n */\nexport class NotificationHubsClient {\n private _client: NotificationHubsClientContext;\n\n /**\n * Creates a new instance of the NotificationClient with a connection string, hub name and options.\n * @param connectionString - The Notification Hub Access Policy connection string.\n * @param hubName - The name of the Azure Notification Hub.\n * @param options - Options for configuring the Azure Notification Hubs client.\n */\n constructor(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n ) {\n this._client = createClientContext(connectionString, hubName, options);\n }\n\n /**\n * Creates or overwrites an installation to a Notification Hub.\n * @param installation - The installation to create or overwrite.\n * @param options - Configuration options for the create or update installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n createOrUpdateInstallation(\n installation: Installation,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return createOrUpdateInstallationMethod(this._client, installation, options);\n }\n\n /**\n * Deletes an installation from a Notification Hub.\n * @param installationId - The installation ID of the installation to delete.\n * @param options - Configuration options for the installation delete operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteInstallation(\n installationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param installationId - The ID of the installation to get.\n * @param options - Configuration options for the get installation operation.\n * @returns The installation that matches the installation ID.\n */\n getInstallation(installationId: string, options: OperationOptions = {}): Promise<Installation> {\n return getInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param installationId - The ID of the installation to update.\n * @param patches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n updateInstallation(\n installationId: string,\n patches: JsonPatch[],\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return updateInstallationMethod(this._client, installationId, patches, options);\n }\n\n /**\n * Creates a new registration ID.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\n createRegistrationId(options: OperationOptions = {}): Promise<string> {\n return createRegistrationIdMethod(this._client, options);\n }\n\n /**\n * Creates a new registration. This method generates a registration ID,\n * which you can subsequently use to retrieve, update, and delete this registration.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\n createRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Creates or updates a registration.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\n createOrUpdateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createOrUpdateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Updates an existing registration.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\n updateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return updateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Deletes a registration with the given registration ID.\n * @param context - The Notification Hubs client.\n * @param registrationId - The registration ID of the registration to delete.\n * @param options - The options for delete operations including the ETag\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteRegistration(\n registrationId: string,\n options: EntityOperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteRegistration(this._client, registrationId, options);\n }\n\n /**\n * Gets a registration by the given registration ID.\n * @param registrationId - The ID of the registration to get.\n * @param options - The options for getting a registration by ID.\n * @returns A RegistrationDescription that has the given registration ID.\n */\n getRegistration(\n registrationId: string,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return getRegistrationMethod(this._client, registrationId, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given query options.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given device information and options.\n * @param channel - The registration channel information to query per PNS type.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrationsByChannel(\n channel: RegistrationChannel,\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByChannelMethod(this._client, channel, options);\n }\n\n /**\n * Lists all registrations with the matching tag.\n * @param tag - The tag to query for matching registrations.\n * @param options - The query options such as $top.\n * @returns A paged async iterable containing the matching registrations for the notification hub.\n */\n listRegistrationsByTag(\n tag: string,\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions = { enableTestSend: false }\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(this._client, scheduledTime, notification, options);\n }\n\n /**\n * Cancels the scheduled notification with the given notification ID.\n * @param notificationId - The notification ID from the scheduled notification.\n * @param options - The operation options.\n * @returns A notification hub response with correlation ID and tracking ID.\n */\n cancelScheduledNotification(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return cancelScheduledNotificationMethod(this._client, notificationId, options);\n }\n\n /**\n * Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.\n * The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.\n * @param options - The options for getting the push notification feedback container URL.\n * @returns The URL of the Azure Storage Container containing the feedback data.\n */\n getFeedbackContainerUrl(options: OperationOptions = {}): Promise<string> {\n return getFeedbackContainerUrlMethod(this._client, options);\n }\n\n /**\n * Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed\n * or final results if the Send* has completed. This API can only be called for Standard SKU and above.\n * @param notificationId - The notification ID returned from the send operation.\n * @param options - The operation options.\n * @returns The results of the send operation.\n */\n getNotificationOutcomeDetails(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationDetails> {\n return getNotificationOutcomeDetailsMethod(this._client, notificationId, options);\n }\n\n /**\n * Gets a Notification Hub Job by the ID.\n * @param jobId - The Notification Hub Job ID.\n * @param options - The operation options.\n * @returns The Notification Hub Job with the matching ID.\n */\n getNotificationHubJob(\n jobId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return getNotificationHubJobMethod(this._client, jobId, options);\n }\n\n /**\n * Submits a Notification Hub job and creates a poller to poll for results.\n * @param notificationHubJob - The Notification Hub import/export job to start.\n * @param options - The operation options.\n * @returns A poller which can be called to poll until completion of the job.\n */\n beginSubmitNotificationHubJob(\n notificationHubJob: NotificationHubJob,\n options: PolledOperationOptions = {}\n ): Promise<NotificationHubJobPoller> {\n return beginSubmitNotificationHubJobMethod(this._client, notificationHubJob, options);\n }\n\n /**\n * Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.\n * @param job - The notification hub job to submit.\n * @param options - The operation options.\n * @returns The notification hub job details including job ID and status.\n */\n submitNotificationHubJob(\n job: NotificationHubJob,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return submitNotificationHubJobMethod(this._client, job, options);\n }\n\n /**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\n listNotificationHubJobs(options: OperationOptions = {}): Promise<NotificationHubJob[]> {\n return listNotificationHubJobsMethod(this._client, options);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"notificationDetailsSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationDetailsSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB;IAC7D,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE;QACnC,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,CAAC,sCAAsC,CAAC;KACpD,CAAC,CAAC;IACH,MAAM,mBAAmB,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAEvD,IAAI,iBAAkE,CAAC;IACvE,IAAI,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,EAAE;QACvD,iBAAiB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;KAC7F;IAED,IAAI,gBAAiE,CAAC;IACtE,IAAI,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,EAAE;QACtD,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;KAC3F;IAED,IAAI,kBAAmE,CAAC;IACxE,IAAI,SAAS,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,EAAE;QACxD,kBAAkB,GAAG,kBAAkB,CA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CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,OAAO,GAAwC,EAAE,CAAC;IACxD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;KAClF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationDetails,\n NotificationOutcomeCollectionItem,\n NotificationOutcomeState,\n} from \"../models/notificationDetails.js\";\nimport { getDateOrUndefined, getInteger, getStringOrUndefined, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * @internal\n * Parses a NotificationDetails from incoming XML.\n */\nexport async function parseNotificationDetails(bodyText: string): Promise<NotificationDetails> {\n const xml = await parseXML(bodyText, {\n includeRoot: true,\n stopNodes: [\"NotificationDetails.NotificationBody\"],\n });\n const notificationDetails = xml[\"NotificationDetails\"];\n\n let apnsOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"ApnsOutcomeCounts\"])) {\n apnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"ApnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n let admOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"AdmOutcomeCounts\"])) {\n admOutcomeCounts = parseOutcomeCounts(notificationDetails[\"AdmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let baiduOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"BaiduOutcomeCounts\"])) {\n baiduOutcomeCounts = parseOutcomeCounts(notificationDetails[\"BaiduOutcomeCounts\"][\"Outcome\"]);\n }\n\n let fcmOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"GcmOutcomeCounts\"])) {\n fcmOutcomeCounts = parseOutcomeCounts(notificationDetails[\"GcmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let wnsOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"WnsOutcomeCounts\"])) {\n wnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"WnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n return {\n notificationId: getStringOrUndefined(notificationDetails[\"NotificationId\"]),\n location: getStringOrUndefined(notificationDetails[\"Location\"]),\n state: getStringOrUndefined(notificationDetails[\"State\"]) as NotificationOutcomeState,\n enqueueTime: getDateOrUndefined(notificationDetails[\"EnqueueTime\"]),\n startTime: getDateOrUndefined(notificationDetails[\"StartTime\"]),\n endTime: getDateOrUndefined(notificationDetails[\"EndTime\"]),\n pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails[\"PnsErrorDetailsUri\"]),\n targetPlatforms: getStringOrUndefined(notificationDetails[\"TargetPlatforms\"]),\n apnsOutcomeCounts,\n admOutcomeCounts,\n baiduOutcomeCounts,\n fcmOutcomeCounts,\n wnsOutcomeCounts,\n };\n}\n\nfunction parseOutcomeCounts(\n counts: Record<string, any>[] | Record<string, any>\n): NotificationOutcomeCollectionItem[] {\n const items = Array.isArray(counts) ? counts : [counts];\n const results: NotificationOutcomeCollectionItem[] = [];\n for (const item of items) {\n results.push({ state: item[\"Name\"], count: getInteger(item[\"Count\"], \"Count\") });\n }\n\n return results;\n}\n"]}
1
+ {"version":3,"file":"notificationDetailsSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationDetailsSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;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Ac,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QAC3E,QAAQ,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC/D,KAAK,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAA6B;QACrF,WAAW,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACnE,SAAS,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC/D,OAAO,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC3D,kBAAkB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;QACnF,eAAe,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;QAC7E,iBAAiB;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAmD;IAEnD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;KAClF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationDetails,\n NotificationOutcome,\n NotificationOutcomeState,\n} from \"../models/notificationDetails.js\";\nimport { getDateOrUndefined, getInteger, getStringOrUndefined, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * @internal\n * Parses a NotificationDetails from incoming XML.\n */\nexport async function parseNotificationDetails(bodyText: string): Promise<NotificationDetails> {\n const xml = await parseXML(bodyText, {\n includeRoot: true,\n stopNodes: [\"NotificationDetails.NotificationBody\"],\n });\n const notificationDetails = xml[\"NotificationDetails\"];\n\n let apnsOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"ApnsOutcomeCounts\"])) {\n apnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"ApnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n let admOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"AdmOutcomeCounts\"])) {\n admOutcomeCounts = parseOutcomeCounts(notificationDetails[\"AdmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let baiduOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"BaiduOutcomeCounts\"])) {\n baiduOutcomeCounts = parseOutcomeCounts(notificationDetails[\"BaiduOutcomeCounts\"][\"Outcome\"]);\n }\n\n let fcmOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"GcmOutcomeCounts\"])) {\n fcmOutcomeCounts = parseOutcomeCounts(notificationDetails[\"GcmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let wnsOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"WnsOutcomeCounts\"])) {\n wnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"WnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n return {\n notificationId: getStringOrUndefined(notificationDetails[\"NotificationId\"]),\n location: getStringOrUndefined(notificationDetails[\"Location\"]),\n state: getStringOrUndefined(notificationDetails[\"State\"]) as NotificationOutcomeState,\n enqueueTime: getDateOrUndefined(notificationDetails[\"EnqueueTime\"]),\n startTime: getDateOrUndefined(notificationDetails[\"StartTime\"]),\n endTime: getDateOrUndefined(notificationDetails[\"EndTime\"]),\n pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails[\"PnsErrorDetailsUri\"]),\n targetPlatforms: getStringOrUndefined(notificationDetails[\"TargetPlatforms\"]),\n apnsOutcomeCounts,\n admOutcomeCounts,\n baiduOutcomeCounts,\n fcmOutcomeCounts,\n wnsOutcomeCounts,\n };\n}\n\nfunction parseOutcomeCounts(\n counts: Record<string, any>[] | Record<string, any>\n): NotificationOutcome[] {\n const items = Array.isArray(counts) ? counts : [counts];\n const results: NotificationOutcome[] = [];\n for (const item of items) {\n results.push({ state: item[\"Name\"], count: getInteger(item[\"Count\"], \"Count\") });\n }\n\n return results;\n}\n"]}
@@ -6,8 +6,8 @@ export async function parseNotificationOutcome(bodyText) {
6
6
  const xml = await parseXML(bodyText, { includeRoot: true });
7
7
  const outcome = xml.NotificationOutcome;
8
8
  return {
9
- success: getInteger(outcome.Success, "Success"),
10
- failure: getInteger(outcome.Failure, "Failure"),
9
+ successCount: getInteger(outcome.Success, "Success"),
10
+ failureCount: getInteger(outcome.Failure, "Failure"),
11
11
  results: parseRegistrationResults(outcome.Results.RegistrationResult),
12
12
  state: "DetailedStateAvailable",
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"notificationOutcomeSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationOutcomeSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,GAAG,CAAC,mBAAmB,CAAC;IAExC,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QAC/C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QAC/C,OAAO,EAAE,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACrE,KAAK,EAAE,wBAAwB;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,OAA6B;IAC7D,MAAM,mBAAmB,GAAyB,EAAE,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QACvB,OAAO,mBAAmB,CAAC;KAC5B;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAElE,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE;QACjC,mBAAmB,CAAC,IAAI,CAAC;YACvB,mBAAmB,EAAE,SAAS,CAAC,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;YACjF,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC;YAClE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;YAC7C,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;SACpD,CAAC,CAAC;KACJ;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationHubsMessageResponse,\n RegistrationResult,\n} from \"../models/notificationDetails.js\";\nimport { getInteger, getString, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\nexport async function parseNotificationOutcome(\n bodyText: string\n): Promise<NotificationHubsMessageResponse> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const outcome = xml.NotificationOutcome;\n\n return {\n success: getInteger(outcome.Success, \"Success\"),\n failure: getInteger(outcome.Failure, \"Failure\"),\n results: parseRegistrationResults(outcome.Results.RegistrationResult),\n state: \"DetailedStateAvailable\",\n };\n}\n\nfunction parseRegistrationResults(results?: Record<string, any>): RegistrationResult[] {\n const registrationResults: RegistrationResult[] = [];\n\n if (!isDefined(results)) {\n return registrationResults;\n }\n\n const resultsArray = Array.isArray(results) ? results : [results];\n\n for (const result of resultsArray) {\n registrationResults.push({\n applicationPlatform: getString(result.ApplicationPlatform, \"ApplicationPlatform\"),\n registrationId: getString(result.RegistrationId, \"RegistrationId\"),\n outcome: getString(result.Outcome, \"Outcome\"),\n pnsHandle: getString(result.PnsHandle, \"PnsHandle\"),\n });\n }\n\n return registrationResults;\n}\n"]}
1
+ {"version":3,"file":"notificationOutcomeSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationOutcomeSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,GAAG,CAAC,mBAAmB,CAAC;IAExC,OAAO;QACL,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACpD,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACpD,OAAO,EAAE,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACrE,KAAK,EAAE,wBAAwB;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,OAA6B;IAC7D,MAAM,mBAAmB,GAAyB,EAAE,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QACvB,OAAO,mBAAmB,CAAC;KAC5B;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAElE,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE;QACjC,mBAAmB,CAAC,IAAI,CAAC;YACvB,mBAAmB,EAAE,SAAS,CAAC,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;YACjF,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC;YAClE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;YAC7C,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;SACpD,CAAC,CAAC;KACJ;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationHubsMessageResponse,\n RegistrationResult,\n} from \"../models/notificationDetails.js\";\nimport { getInteger, getString, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\nexport async function parseNotificationOutcome(\n bodyText: string\n): Promise<NotificationHubsMessageResponse> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const outcome = xml.NotificationOutcome;\n\n return {\n successCount: getInteger(outcome.Success, \"Success\"),\n failureCount: getInteger(outcome.Failure, \"Failure\"),\n results: parseRegistrationResults(outcome.Results.RegistrationResult),\n state: \"DetailedStateAvailable\",\n };\n}\n\nfunction parseRegistrationResults(results?: Record<string, any>): RegistrationResult[] {\n const registrationResults: RegistrationResult[] = [];\n\n if (!isDefined(results)) {\n return registrationResults;\n }\n\n const resultsArray = Array.isArray(results) ? results : [results];\n\n for (const result of resultsArray) {\n registrationResults.push({\n applicationPlatform: getString(result.ApplicationPlatform, \"ApplicationPlatform\"),\n registrationId: getString(result.RegistrationId, \"RegistrationId\"),\n outcome: getString(result.Outcome, \"Outcome\"),\n pnsHandle: getString(result.PnsHandle, \"PnsHandle\"),\n });\n }\n\n return registrationResults;\n}\n"]}
@@ -49,21 +49,21 @@ export const registrationDescriptionParser = {
49
49
  * Creates an ADM registration description from incoming XML property bag.
50
50
  */
51
51
  createAdmRegistrationDescription(rawRegistrationDescription) {
52
- return Object.assign(Object.assign({ admRegistrationId: getString(rawRegistrationDescription["AdmRegistrationId"], "admRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Adm" });
52
+ return Object.assign(Object.assign({ admRegistrationId: getString(rawRegistrationDescription["AdmRegistrationId"], "admRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Adm" });
53
53
  },
54
54
  /**
55
55
  * @internal
56
56
  * Creates an ADM template registration description from incoming XML property bag.
57
57
  */
58
58
  createAdmTemplateRegistrationDescription(rawRegistrationDescription) {
59
- return Object.assign(Object.assign(Object.assign({}, this.createAdmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { type: "AdmTemplate" });
59
+ return Object.assign(Object.assign(Object.assign({}, this.createAdmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "AdmTemplate" });
60
60
  },
61
61
  /**
62
62
  * @internal
63
63
  * Creates an Apple registration description from incoming XML property bag.
64
64
  */
65
65
  createAppleRegistrationDescription(rawRegistrationDescription) {
66
- return Object.assign(Object.assign({ deviceToken: getString(rawRegistrationDescription["DeviceToken"], "deviceToken") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Apple" });
66
+ return Object.assign(Object.assign({ deviceToken: getString(rawRegistrationDescription["DeviceToken"], "deviceToken") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Apple" });
67
67
  },
68
68
  /**
69
69
  * @internal
@@ -71,56 +71,56 @@ export const registrationDescriptionParser = {
71
71
  */
72
72
  createAppleTemplateRegistrationDescription(rawRegistrationDescription) {
73
73
  var _a;
74
- 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)), { type: "AppleTemplate" });
74
+ 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" });
75
75
  },
76
76
  /**
77
77
  * @internal
78
78
  * Creates a Baidu registration description from incoming XML property bag.
79
79
  */
80
80
  createBaiduRegistrationDescription(rawRegistrationDescription) {
81
- return Object.assign(Object.assign({ baiduChannelId: getString(rawRegistrationDescription["BaiduChannelId"], "baiduChannelId"), baiduUserId: getString(rawRegistrationDescription["BaiduUserId"], "baiduUserId") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Baidu" });
81
+ return Object.assign(Object.assign({ baiduChannelId: getString(rawRegistrationDescription["BaiduChannelId"], "baiduChannelId"), baiduUserId: getString(rawRegistrationDescription["BaiduUserId"], "baiduUserId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Baidu" });
82
82
  },
83
83
  /**
84
84
  * @internal
85
85
  * Creates a Baidu template registration description from incoming XML property bag.
86
86
  */
87
87
  createBaiduTemplateRegistrationDescription(rawRegistrationDescription) {
88
- return Object.assign(Object.assign(Object.assign({}, this.createBaiduRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { type: "BaiduTemplate" });
88
+ return Object.assign(Object.assign(Object.assign({}, this.createBaiduRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BaiduTemplate" });
89
89
  },
90
90
  /**
91
91
  * @internal
92
92
  * Creates a Browser registration description from incoming XML property bag.
93
93
  */
94
94
  createBrowserRegistrationDescription(rawRegistrationDescription) {
95
- return Object.assign(Object.assign({ endpoint: getString(rawRegistrationDescription["Endpoint"], "endpoint"), p256dh: getString(rawRegistrationDescription["P256DH"], "p256dh"), auth: getString(rawRegistrationDescription["Auth"], "auth") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Browser" });
95
+ return Object.assign(Object.assign({ endpoint: getString(rawRegistrationDescription["Endpoint"], "endpoint"), p256dh: getString(rawRegistrationDescription["P256DH"], "p256dh"), auth: getString(rawRegistrationDescription["Auth"], "auth") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Browser" });
96
96
  },
97
97
  /**
98
98
  * @internal
99
99
  * Creates a Browser template registration description from incoming XML property bag.
100
100
  */
101
101
  createBrowserTemplateRegistrationDescription(rawRegistrationDescription) {
102
- return Object.assign(Object.assign(Object.assign({}, this.createBrowserRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { type: "BrowserTemplate" });
102
+ return Object.assign(Object.assign(Object.assign({}, this.createBrowserRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "BrowserTemplate" });
103
103
  },
104
104
  /**
105
105
  * @internal
106
106
  * Creates an GCM registration description from incoming XML property bag.
107
107
  */
108
108
  createGcmRegistrationDescription(rawRegistrationDescription) {
109
- return Object.assign(Object.assign({ gcmRegistrationId: getString(rawRegistrationDescription["GcmRegistrationId"], "gcmRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Gcm" });
109
+ return Object.assign(Object.assign({ gcmRegistrationId: getString(rawRegistrationDescription["GcmRegistrationId"], "gcmRegistrationId") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Gcm" });
110
110
  },
111
111
  /**
112
112
  * @internal
113
113
  * Creates an FCM template registration description from incoming XML property bag.
114
114
  */
115
115
  createGcmTemplateRegistrationDescription(rawRegistrationDescription) {
116
- return Object.assign(Object.assign(Object.assign({}, this.createGcmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { type: "GcmTemplate" });
116
+ return Object.assign(Object.assign(Object.assign({}, this.createGcmRegistrationDescription(rawRegistrationDescription)), createTemplateRegistrationDescription(rawRegistrationDescription)), { kind: "GcmTemplate" });
117
117
  },
118
118
  /**
119
119
  * @internal
120
120
  * Creates a Windows Phone registration description from incoming XML property bag.
121
121
  */
122
122
  createMpnsRegistrationDescription(rawRegistrationDescription) {
123
- return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Mpns" });
123
+ return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Mpns" });
124
124
  },
125
125
  /**
126
126
  * @internal
@@ -128,14 +128,14 @@ export const registrationDescriptionParser = {
128
128
  */
129
129
  createMpnsTemplateRegistrationDescription(rawRegistrationDescription) {
130
130
  var _a;
131
- 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)), { type: "MpnsTemplate" });
131
+ 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" });
132
132
  },
133
133
  /**
134
134
  * @internal
135
135
  * Creates a Windows registration description from incoming XML property bag.
136
136
  */
137
137
  createWindowsRegistrationDescription(rawRegistrationDescription) {
138
- return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { type: "Windows" });
138
+ return Object.assign(Object.assign({ channelUri: getString(rawRegistrationDescription["ChannelUri"], "channelUri") }, createRegistrationDescription(rawRegistrationDescription)), { kind: "Windows" });
139
139
  },
140
140
  /**
141
141
  * @internal
@@ -143,7 +143,7 @@ export const registrationDescriptionParser = {
143
143
  */
144
144
  createWindowsTemplateRegistrationDescription(rawRegistrationDescription) {
145
145
  var _a;
146
- 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)), { type: "WindowsTemplate" });
146
+ 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" });
147
147
  },
148
148
  };
149
149
  function getHeadersOrUndefined(value) {
@@ -178,11 +178,11 @@ function createTemplateRegistrationDescription(rawRegistrationDescription) {
178
178
  */
179
179
  export const registrationDescriptionSerializer = {
180
180
  serializeRegistrationDescription(description) {
181
- const rootName = `${description.type}RegistrationDescription`;
181
+ const rootName = `${description.kind}RegistrationDescription`;
182
182
  const methodName = `serialize${rootName}`;
183
183
  const method = this[methodName].bind(this);
184
184
  if (!isDefined(method)) {
185
- throw new RestError(`Undefined platform ${description.type}`, { statusCode: 400 });
185
+ throw new RestError(`Undefined platform ${description.kind}`, { statusCode: 400 });
186
186
  }
187
187
  const registration = method(description);
188
188
  const requestObject = serializeToAtomXmlRequest(rootName, registration);
@@ -1 +1 @@
1
- {"version":3,"file":"registrationSerializer.js","sourceRoot":"","sources":["../../../src/serializers/registrationSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsBlC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAoHjE,MAAM,CAAC,MAAM,6BAA6B,GAAkC;IAC1E;;;OAGG;IACH,KAAK,CAAC,sBAAsB,CAAC,QAAgB;QAC3C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,SAAS,OAAO,EAAE,CAAC;QAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAiD,CAAQ,CAAC;QAC9E,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,SAAS,CAAC,GAAG,OAAO,uCAAuC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;SAC7F;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAA4B,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,qBAAqB,CAAC,QAAgB;QAC1C,MAAM,GAAG,GAAG,MA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;QAChE,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,aAAa;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,wCAAwC,CAC/C,WAA4C;IAE5C,OAAO;QACL,YAAY,EAAE,EAAE,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE;QACnD,YAAY,EAAE,oBAAoB,CAAC,WAAW,CAAC,YAAY,CAAC;KAC7D,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmRegistrationDescription,\n AdmTemplateRegistrationDescription,\n ApplePriority,\n AppleRegistrationDescription,\n AppleTemplateRegistrationDescription,\n BaiduRegistrationDescription,\n BaiduTemplateRegistrationDescription,\n BrowserRegistrationDescription,\n BrowserTemplateRegistrationDescription,\n GcmRegistrationDescription,\n GcmTemplateRegistrationDescription,\n MpnsRegistrationDescription,\n MpnsTemplateRegistrationDescription,\n RegistrationDescription,\n RegistrationDescriptionCommon,\n TemplateRegistrationDescription,\n WindowsRegistrationDescription,\n WindowsTemplateRegistrationDescription,\n} from \"../models/registration.js\";\nimport {\n getDateOrUndefined,\n getString,\n getStringOrUndefined,\n getTagsOrUndefined,\n isDefined,\n} from \"../utils/utils.js\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { serializeToAtomXmlRequest } from \"../utils/xmlUtils.js\";\n\n/**\n * Represents a registration description parser from the incoming XML.\n */\nexport interface RegistrationDescriptionParser {\n /**\n * @internal\n * Creates a registration type from the incoming entry.\n */\n parseRegistrationEntry: (bodyText: string) => Promise<RegistrationDescription>;\n /**\n * @internal\n * Creates a list of registrations from an incoming ATOM XML Feed.\n */\n parseRegistrationFeed: (bodyText: string) => Promise<RegistrationDescription[]>;\n /**\n * @internal\n * Creates an Amazon Device Messaging (ADM) registration description from the incoming parsed XML.\n */\n createAdmRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AdmRegistrationDescription;\n /**\n * @internal\n * Creates an Amazon Device Messaging (ADM) template registration description from the incoming parsed XML.\n */\n createAdmTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AdmTemplateRegistrationDescription;\n /**\n * @internal\n * Creates an Apple Platform Notification Services (APNs) registration description from the incoming parsed XML.\n */\n createAppleRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AppleRegistrationDescription;\n /**\n * @internal\n * Creates an Apple Platform Notification Services (APNs) template registration description from the incoming parsed XML.\n */\n createAppleTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AppleTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Baidu registration description from the incoming parsed XML.\n */\n createBaiduRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BaiduRegistrationDescription;\n /**\n * @internal\n * Creates a Baidu template registration description from the incoming parsed XML.\n */\n createBaiduTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BaiduTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Web Push registration description from the incoming parsed XML.\n */\n createBrowserRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BrowserRegistrationDescription;\n /**\n * @internal\n * Creates a Web Push template registration description from the incoming parsed XML.\n */\n createBrowserTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BrowserTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Google Cloud Messaging (GCM) registration description from the incoming parsed XML.\n */\n createGcmRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => GcmRegistrationDescription;\n /**\n * @internal\n * Creates a Google Cloud Messaging (GCM) template registration description from the incoming parsed XML.\n */\n createGcmTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => GcmTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Microsoft Phone Notification Services (MPNS) registration description from the incoming parsed XML.\n */\n createMpnsRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => MpnsRegistrationDescription;\n /**\n * @internal\n * Creates a Microsoft Phone Notification Services (MPNS) template registration description from the incoming parsed XML.\n */\n createMpnsTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => MpnsTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Windows Notification Services (WNS) registration description from the incoming parsed XML.\n */\n createWindowsRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => WindowsRegistrationDescription;\n /**\n * @internal\n * Creates a Windows Notification Services (WNS) template registration description from the incoming parsed XML.\n */\n createWindowsTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => WindowsTemplateRegistrationDescription;\n}\n\nexport const registrationDescriptionParser: RegistrationDescriptionParser = {\n /**\n * @internal\n * Creates a registration type from the incoming entry.\n */\n async parseRegistrationEntry(bodyText: string): Promise<RegistrationDescription> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const keyName = Object.keys(xml.entry.content)[0];\n const content = xml.entry.content[keyName];\n const methodName = `create${keyName}`;\n\n const method = this[methodName as keyof RegistrationDescriptionParser] as any;\n if (!methodName) {\n throw new RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });\n }\n\n return method.call(this, content) as RegistrationDescription;\n },\n\n /**\n * @internal\n * Creates a list of registrations from an incoming ATOM XML Feed.\n */\n async parseRegistrationFeed(bodyText: string): Promise<RegistrationDescription[]> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const results: RegistrationDescription[] = [];\n if (!isDefined(xml.feed.entry)) {\n return results;\n }\n\n const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];\n\n for (const entry of entries) {\n delete entry.content[\"$\"];\n\n const keyName = Object.keys(entry.content)[0];\n const methodName = `create${keyName}`;\n const content = entry.content[keyName];\n const method = this[methodName as keyof RegistrationDescriptionParser] as any;\n if (!methodName) {\n throw new RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });\n }\n\n results.push(method.call(this, content) as RegistrationDescription);\n }\n\n return results;\n },\n\n /**\n * @internal\n * Creates an ADM registration description from incoming XML property bag.\n */\n createAdmRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AdmRegistrationDescription {\n return {\n admRegistrationId: getString(\n rawRegistrationDescription[\"AdmRegistrationId\"],\n \"admRegistrationId\"\n ),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Adm\",\n };\n },\n\n /**\n * @internal\n * Creates an ADM template registration description from incoming XML property bag.\n */\n createAdmTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AdmTemplateRegistrationDescription {\n return {\n ...this.createAdmRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"AdmTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates an Apple registration description from incoming XML property bag.\n */\n createAppleRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AppleRegistrationDescription {\n return {\n deviceToken: getString(rawRegistrationDescription[\"DeviceToken\"], \"deviceToken\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Apple\",\n };\n },\n\n /**\n * @internal\n * Creates an Apple template registration description from incoming XML property bag.\n */\n createAppleTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AppleTemplateRegistrationDescription {\n return {\n priority: getStringOrUndefined(rawRegistrationDescription[\"Priority\"]) as ApplePriority,\n apnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"ApnsHeaders\"]?.[\"ApnsHeader\"]),\n ...this.createAppleRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"AppleTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Baidu registration description from incoming XML property bag.\n */\n createBaiduRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BaiduRegistrationDescription {\n return {\n baiduChannelId: getString(rawRegistrationDescription[\"BaiduChannelId\"], \"baiduChannelId\"),\n baiduUserId: getString(rawRegistrationDescription[\"BaiduUserId\"], \"baiduUserId\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Baidu\",\n };\n },\n\n /**\n * @internal\n * Creates a Baidu template registration description from incoming XML property bag.\n */\n createBaiduTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BaiduTemplateRegistrationDescription {\n return {\n ...this.createBaiduRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"BaiduTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Browser registration description from incoming XML property bag.\n */\n createBrowserRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BrowserRegistrationDescription {\n return {\n endpoint: getString(rawRegistrationDescription[\"Endpoint\"], \"endpoint\"),\n p256dh: getString(rawRegistrationDescription[\"P256DH\"], \"p256dh\"),\n auth: getString(rawRegistrationDescription[\"Auth\"], \"auth\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Browser\",\n };\n },\n\n /**\n * @internal\n * Creates a Browser template registration description from incoming XML property bag.\n */\n createBrowserTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BrowserTemplateRegistrationDescription {\n return {\n ...this.createBrowserRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"BrowserTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates an GCM registration description from incoming XML property bag.\n */\n createGcmRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): GcmRegistrationDescription {\n return {\n gcmRegistrationId: getString(\n rawRegistrationDescription[\"GcmRegistrationId\"],\n \"gcmRegistrationId\"\n ),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Gcm\",\n };\n },\n\n /**\n * @internal\n * Creates an FCM template registration description from incoming XML property bag.\n */\n createGcmTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): GcmTemplateRegistrationDescription {\n return {\n ...this.createGcmRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"GcmTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows Phone registration description from incoming XML property bag.\n */\n createMpnsRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): MpnsRegistrationDescription {\n return {\n channelUri: getString(rawRegistrationDescription[\"ChannelUri\"], \"channelUri\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Mpns\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows Phone template registration description from incoming XML property bag.\n */\n createMpnsTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): MpnsTemplateRegistrationDescription {\n return {\n mpnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"MpnsHeaders\"]?.[\"MpnsHeader\"]),\n ...this.createWindowsRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"MpnsTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows registration description from incoming XML property bag.\n */\n createWindowsRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): WindowsRegistrationDescription {\n return {\n channelUri: getString(rawRegistrationDescription[\"ChannelUri\"], \"channelUri\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n type: \"Windows\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows template registration description from incoming XML property bag.\n */\n createWindowsTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): WindowsTemplateRegistrationDescription {\n return {\n wnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"WnsHeaders\"]?.[\"WnsHeader\"]),\n ...this.createWindowsRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n type: \"WindowsTemplate\",\n };\n },\n};\n\nfunction getHeadersOrUndefined(\n value?: { Header: string; Value: string }[]\n): Record<string, string> | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n\n const headerObj: Record<string, string> = {};\n for (const { Header, Value } of value) {\n headerObj[Header] = Value;\n }\n\n return headerObj;\n}\n\nfunction createRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n): Omit<RegistrationDescriptionCommon, \"type\"> {\n let pushVariables: Record<string, string> | undefined;\n const unparsed = getStringOrUndefined(rawRegistrationDescription[\"PushVariables\"]);\n if (unparsed) {\n pushVariables = JSON.parse(unparsed) as Record<string, string>;\n }\n\n return {\n registrationId: getStringOrUndefined(rawRegistrationDescription[\"RegistrationId\"]),\n expirationTime: getDateOrUndefined(rawRegistrationDescription[\"ExpirationTime\"]),\n etag: getStringOrUndefined(rawRegistrationDescription[\"ETag\"]),\n tags: getTagsOrUndefined(rawRegistrationDescription[\"Tags\"]),\n pushVariables: pushVariables,\n };\n}\n\nfunction createTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n): TemplateRegistrationDescription {\n return {\n bodyTemplate: getString(rawRegistrationDescription[\"BodyTemplate\"], \"bodyTemplate\"),\n templateName: getStringOrUndefined(rawRegistrationDescription[\"TemplateName\"]),\n ...createRegistrationDescription(rawRegistrationDescription),\n };\n}\n\n/**\n * @internal\n * Represents a serializer for all registration descriptions.\n */\nexport interface RegistrationDescriptionSerializer {\n /**\n * @internal\n * Serializes a registration description into an ATOM XML string.\n */\n serializeRegistrationDescription(description: RegistrationDescription): string;\n /**\n * @internal\n * Serializes an Amazon Device Messaging (ADM) registration description into an XML object for serialization.\n */\n serializeAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Amazon Device Messaging (ADM) template registration description into an XML object for serialization.\n */\n serializeAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Apple registration description into an XML object for serialization.\n */\n serializeAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Apple template registration description into an XML object for serialization.\n */\n serializeAppleTemplateRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Baidu registration description into an XML object for serialization.\n */\n serializeBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Baidu template registration description into an XML object for serialization.\n */\n serializeBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Web Push registration description into an XML object for serialization.\n */\n serializeBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Web Push template registration description into an XML object for serialization.\n */\n serializeBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Google Cloud Messaging (GCM) registration description into an XML object for serialization.\n */\n serializeGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Google Cloud Messaging (GCM) template registration description into an XML object for serialization.\n */\n serializeGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Phone registration description into an XML object for serialization.\n */\n serializeMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Phone template registration description into an XML object for serialization.\n */\n serializeMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Notification Services (WNS) registration description into an XML object for serialization.\n */\n serializeWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Notification Services (WNS) template registration description into an XML object for serialization.\n */\n serializeWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n ): Record<string, any>;\n}\n\n/**\n * Represents a RegistrationDescription serializer.\n */\nexport const registrationDescriptionSerializer: RegistrationDescriptionSerializer = {\n serializeRegistrationDescription(description: RegistrationDescription): string {\n const rootName = `${description.type}RegistrationDescription`;\n const methodName = `serialize${rootName}`;\n\n const method = this[methodName as keyof RegistrationDescriptionSerializer].bind(this) as (\n description: RegistrationDescription\n ) => Record<string, any>;\n if (!isDefined(method)) {\n throw new RestError(`Undefined platform ${description.type}`, { statusCode: 400 });\n }\n\n const registration = method(description) as Record<string, any>;\n const requestObject = serializeToAtomXmlRequest(rootName, registration);\n\n return stringifyXML(requestObject, { rootName: \"entry\" });\n },\n\n /**\n * @internal\n * Serializes an existing ADM registration description to an object for serialization.\n */\n serializeAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n AdmRegistrationId: getString(description.admRegistrationId, \"admRegistrationId\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing ADM template registration description to an object for serialization.\n */\n serializeAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...this.serializeAdmRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Apple registration description to an object for serialization.\n */\n serializeAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n DeviceToken: getString(description.deviceToken, \"deviceToken\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Apple template registration description to an object for serialization.\n */\n serializeAppleTemplateRegistrationDescription(\n description: AppleTemplateRegistrationDescription\n ): Record<string, any> {\n let apnsHeaders: Record<string, any> | undefined;\n if (description.apnsHeaders) {\n apnsHeaders = {\n ApnsHeader: [],\n };\n\n for (const header of Object.keys(description.apnsHeaders)) {\n apnsHeaders[\"ApnsHeader\"].push({\n Header: header,\n Value: description.apnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeAppleRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n Expiry: getStringOrUndefined(description.expiry),\n ApnsHeaders: apnsHeaders,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Baidu registration description to an object for serialization.\n */\n serializeBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n BaiduChannelId: getString(description.baiduChannelId, \"baiduChannelId\"),\n BaiduUserId: getString(description.baiduUserId, \"baiduUserId\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Baidu template registration description to an object for serialization.\n */\n serializeBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...this.serializeBaiduRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Browser registration description to an object for serialization.\n */\n serializeBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n Endpoint: description.endpoint,\n Auth: description.auth,\n P256DH: description.p256dh,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Browser template registration description to an object for serialization.\n */\n serializeBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...this.serializeBrowserRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * @deprecated Should use FCM registrations instead of GCM.\n * Serializes an existing GCM registration description to an object for serialization.\n */\n serializeGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n GcmRegistrationId: getString(description.gcmRegistrationId, \"gcmRegistrationId\"),\n };\n },\n\n /**\n * @internal\n * @deprecated Should use FCM template registrations instead of GCM.\n * Serializes an existing GCM template registration description to an object for serialization.\n */\n serializeGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...this.serializeGcmRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * @deprecated Windows Phone is no longer supported.\n * Serializes an existing MPNS registration description to an object for serialization.\n */\n serializeMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n ChannelUri: description.channelUri,\n };\n },\n\n /**\n * @internal\n * @deprecated Windows Phone is no longer supported.\n * Serializes an existing MPNS template registration description to an object for serialization.\n */\n serializeMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n let mpnsHeaders: Record<string, any> | undefined;\n if (description.mpnsHeaders) {\n mpnsHeaders = {\n MpnsHeader: [],\n };\n\n for (const header of Object.keys(description.mpnsHeaders)) {\n mpnsHeaders[\"MpnsHeader\"].push({\n Header: header,\n Value: description.mpnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeMpnsRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n MpnsHeaders: mpnsHeaders,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Windows registration description to an object for serialization.\n */\n serializeWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n ChannelUri: description.channelUri,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Windows template registration description to an object for serialization.\n */\n serializeWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n ): Record<string, any> {\n let wnsHeaders: Record<string, any> | undefined;\n if (description.wnsHeaders) {\n wnsHeaders = {\n WnsHeader: [],\n };\n\n for (const header of Object.keys(description.wnsHeaders)) {\n wnsHeaders[\"WnsHeader\"].push({\n Header: header,\n Value: description.wnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeWindowsRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n WnsHeaders: wnsHeaders,\n };\n },\n};\n\nfunction serializeRegistrationDescription(\n description: Omit<RegistrationDescriptionCommon, \"type\">\n): Record<string, any> {\n let tags: string | undefined;\n if (description.tags) {\n tags = description.tags.join(\",\");\n }\n\n let pushVariables: string | undefined;\n if (description.pushVariables) {\n pushVariables = JSON.stringify(description.pushVariables);\n }\n\n return {\n RegistrationId: getStringOrUndefined(description.registrationId),\n Tags: tags,\n PushVariables: pushVariables,\n };\n}\n\nfunction serializeTemplateRegistrationDescription(\n description: TemplateRegistrationDescription\n): Record<string, any> {\n return {\n BodyTemplate: { __cdata: description.bodyTemplate },\n TemplateName: getStringOrUndefined(description.templateName),\n };\n}\n"]}
1
+ {"version":3,"file":"registrationSerializer.js","sourceRoot":"","sources":["../../../src/serializers/registrationSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAoHjE,MAAM,CAAC,MAAM,6BAA6B,GAAkC;IAC1E;;;OAGG;IACH,KAAK,CAAC,sBAAsB,CAAC,QAAgB;QAC3C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CA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AAC,WAAW,CAAC,GACzD,wCAAwC,CAAC,WAAW,CAAC,KACxD,UAAU,EAAE,UAAU,IACtB;IACJ,CAAC;CACF,CAAC;AAEF,SAAS,gCAAgC,CACvC,WAAwD;IAExD,IAAI,IAAwB,CAAC;IAC7B,IAAI,WAAW,CAAC,IAAI,EAAE;QACpB,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnC;IAED,IAAI,aAAiC,CAAC;IACtC,IAAI,WAAW,CAAC,aAAa,EAAE;QAC7B,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;KAC3D;IAED,OAAO;QACL,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC,cAAc,CAAC;QAChE,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,aAAa;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,wCAAwC,CAC/C,WAA4C;IAE5C,OAAO;QACL,YAAY,EAAE,EAAE,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE;QACnD,YAAY,EAAE,oBAAoB,CAAC,WAAW,CAAC,YAAY,CAAC;KAC7D,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmRegistrationDescription,\n AdmTemplateRegistrationDescription,\n AppleRegistrationDescription,\n AppleTemplateRegistrationDescription,\n BaiduRegistrationDescription,\n BaiduTemplateRegistrationDescription,\n BrowserRegistrationDescription,\n BrowserTemplateRegistrationDescription,\n GcmRegistrationDescription,\n GcmTemplateRegistrationDescription,\n MpnsRegistrationDescription,\n MpnsTemplateRegistrationDescription,\n RegistrationDescription,\n RegistrationDescriptionCommon,\n TemplateRegistrationDescription,\n WindowsRegistrationDescription,\n WindowsTemplateRegistrationDescription,\n} from \"../models/registration.js\";\nimport {\n getDateOrUndefined,\n getString,\n getStringOrUndefined,\n getTagsOrUndefined,\n isDefined,\n} from \"../utils/utils.js\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { serializeToAtomXmlRequest } from \"../utils/xmlUtils.js\";\n\n/**\n * Represents a registration description parser from the incoming XML.\n */\nexport interface RegistrationDescriptionParser {\n /**\n * @internal\n * Creates a registration type from the incoming entry.\n */\n parseRegistrationEntry: (bodyText: string) => Promise<RegistrationDescription>;\n /**\n * @internal\n * Creates a list of registrations from an incoming ATOM XML Feed.\n */\n parseRegistrationFeed: (bodyText: string) => Promise<RegistrationDescription[]>;\n /**\n * @internal\n * Creates an Amazon Device Messaging (ADM) registration description from the incoming parsed XML.\n */\n createAdmRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AdmRegistrationDescription;\n /**\n * @internal\n * Creates an Amazon Device Messaging (ADM) template registration description from the incoming parsed XML.\n */\n createAdmTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AdmTemplateRegistrationDescription;\n /**\n * @internal\n * Creates an Apple Platform Notification Services (APNs) registration description from the incoming parsed XML.\n */\n createAppleRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AppleRegistrationDescription;\n /**\n * @internal\n * Creates an Apple Platform Notification Services (APNs) template registration description from the incoming parsed XML.\n */\n createAppleTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => AppleTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Baidu registration description from the incoming parsed XML.\n */\n createBaiduRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BaiduRegistrationDescription;\n /**\n * @internal\n * Creates a Baidu template registration description from the incoming parsed XML.\n */\n createBaiduTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BaiduTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Web Push registration description from the incoming parsed XML.\n */\n createBrowserRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BrowserRegistrationDescription;\n /**\n * @internal\n * Creates a Web Push template registration description from the incoming parsed XML.\n */\n createBrowserTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => BrowserTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Google Cloud Messaging (GCM) registration description from the incoming parsed XML.\n */\n createGcmRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => GcmRegistrationDescription;\n /**\n * @internal\n * Creates a Google Cloud Messaging (GCM) template registration description from the incoming parsed XML.\n */\n createGcmTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => GcmTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Microsoft Phone Notification Services (MPNS) registration description from the incoming parsed XML.\n */\n createMpnsRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => MpnsRegistrationDescription;\n /**\n * @internal\n * Creates a Microsoft Phone Notification Services (MPNS) template registration description from the incoming parsed XML.\n */\n createMpnsTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => MpnsTemplateRegistrationDescription;\n /**\n * @internal\n * Creates a Windows Notification Services (WNS) registration description from the incoming parsed XML.\n */\n createWindowsRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => WindowsRegistrationDescription;\n /**\n * @internal\n * Creates a Windows Notification Services (WNS) template registration description from the incoming parsed XML.\n */\n createWindowsTemplateRegistrationDescription: (\n rawRegistrationDescription: Record<string, any>\n ) => WindowsTemplateRegistrationDescription;\n}\n\nexport const registrationDescriptionParser: RegistrationDescriptionParser = {\n /**\n * @internal\n * Creates a registration type from the incoming entry.\n */\n async parseRegistrationEntry(bodyText: string): Promise<RegistrationDescription> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const keyName = Object.keys(xml.entry.content)[0];\n const content = xml.entry.content[keyName];\n const methodName = `create${keyName}`;\n\n const method = this[methodName as keyof RegistrationDescriptionParser] as any;\n if (!methodName) {\n throw new RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });\n }\n\n return method.call(this, content) as RegistrationDescription;\n },\n\n /**\n * @internal\n * Creates a list of registrations from an incoming ATOM XML Feed.\n */\n async parseRegistrationFeed(bodyText: string): Promise<RegistrationDescription[]> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const results: RegistrationDescription[] = [];\n if (!isDefined(xml.feed.entry)) {\n return results;\n }\n\n const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];\n\n for (const entry of entries) {\n delete entry.content[\"$\"];\n\n const keyName = Object.keys(entry.content)[0];\n const methodName = `create${keyName}`;\n const content = entry.content[keyName];\n const method = this[methodName as keyof RegistrationDescriptionParser] as any;\n if (!methodName) {\n throw new RestError(`${keyName} is not a supported registration type`, { statusCode: 500 });\n }\n\n results.push(method.call(this, content) as RegistrationDescription);\n }\n\n return results;\n },\n\n /**\n * @internal\n * Creates an ADM registration description from incoming XML property bag.\n */\n createAdmRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AdmRegistrationDescription {\n return {\n admRegistrationId: getString(\n rawRegistrationDescription[\"AdmRegistrationId\"],\n \"admRegistrationId\"\n ),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Adm\",\n };\n },\n\n /**\n * @internal\n * Creates an ADM template registration description from incoming XML property bag.\n */\n createAdmTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AdmTemplateRegistrationDescription {\n return {\n ...this.createAdmRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"AdmTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates an Apple registration description from incoming XML property bag.\n */\n createAppleRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AppleRegistrationDescription {\n return {\n deviceToken: getString(rawRegistrationDescription[\"DeviceToken\"], \"deviceToken\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Apple\",\n };\n },\n\n /**\n * @internal\n * Creates an Apple template registration description from incoming XML property bag.\n */\n createAppleTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): AppleTemplateRegistrationDescription {\n return {\n priority: getStringOrUndefined(rawRegistrationDescription[\"Priority\"]) as \"10\" | \"5\",\n apnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"ApnsHeaders\"]?.[\"ApnsHeader\"]),\n ...this.createAppleRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"AppleTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Baidu registration description from incoming XML property bag.\n */\n createBaiduRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BaiduRegistrationDescription {\n return {\n baiduChannelId: getString(rawRegistrationDescription[\"BaiduChannelId\"], \"baiduChannelId\"),\n baiduUserId: getString(rawRegistrationDescription[\"BaiduUserId\"], \"baiduUserId\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Baidu\",\n };\n },\n\n /**\n * @internal\n * Creates a Baidu template registration description from incoming XML property bag.\n */\n createBaiduTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BaiduTemplateRegistrationDescription {\n return {\n ...this.createBaiduRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"BaiduTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Browser registration description from incoming XML property bag.\n */\n createBrowserRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BrowserRegistrationDescription {\n return {\n endpoint: getString(rawRegistrationDescription[\"Endpoint\"], \"endpoint\"),\n p256dh: getString(rawRegistrationDescription[\"P256DH\"], \"p256dh\"),\n auth: getString(rawRegistrationDescription[\"Auth\"], \"auth\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Browser\",\n };\n },\n\n /**\n * @internal\n * Creates a Browser template registration description from incoming XML property bag.\n */\n createBrowserTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): BrowserTemplateRegistrationDescription {\n return {\n ...this.createBrowserRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"BrowserTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates an GCM registration description from incoming XML property bag.\n */\n createGcmRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): GcmRegistrationDescription {\n return {\n gcmRegistrationId: getString(\n rawRegistrationDescription[\"GcmRegistrationId\"],\n \"gcmRegistrationId\"\n ),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Gcm\",\n };\n },\n\n /**\n * @internal\n * Creates an FCM template registration description from incoming XML property bag.\n */\n createGcmTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): GcmTemplateRegistrationDescription {\n return {\n ...this.createGcmRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"GcmTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows Phone registration description from incoming XML property bag.\n */\n createMpnsRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): MpnsRegistrationDescription {\n return {\n channelUri: getString(rawRegistrationDescription[\"ChannelUri\"], \"channelUri\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Mpns\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows Phone template registration description from incoming XML property bag.\n */\n createMpnsTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): MpnsTemplateRegistrationDescription {\n return {\n mpnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"MpnsHeaders\"]?.[\"MpnsHeader\"]),\n ...this.createWindowsRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"MpnsTemplate\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows registration description from incoming XML property bag.\n */\n createWindowsRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): WindowsRegistrationDescription {\n return {\n channelUri: getString(rawRegistrationDescription[\"ChannelUri\"], \"channelUri\"),\n ...createRegistrationDescription(rawRegistrationDescription),\n kind: \"Windows\",\n };\n },\n\n /**\n * @internal\n * Creates a Windows template registration description from incoming XML property bag.\n */\n createWindowsTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n ): WindowsTemplateRegistrationDescription {\n return {\n wnsHeaders: getHeadersOrUndefined(rawRegistrationDescription[\"WnsHeaders\"]?.[\"WnsHeader\"]),\n ...this.createWindowsRegistrationDescription(rawRegistrationDescription),\n ...createTemplateRegistrationDescription(rawRegistrationDescription),\n kind: \"WindowsTemplate\",\n };\n },\n};\n\nfunction getHeadersOrUndefined(\n value?: { Header: string; Value: string }[]\n): Record<string, string> | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n\n const headerObj: Record<string, string> = {};\n for (const { Header, Value } of value) {\n headerObj[Header] = Value;\n }\n\n return headerObj;\n}\n\nfunction createRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n): Omit<RegistrationDescriptionCommon, \"kind\"> {\n let pushVariables: Record<string, string> | undefined;\n const unparsed = getStringOrUndefined(rawRegistrationDescription[\"PushVariables\"]);\n if (unparsed) {\n pushVariables = JSON.parse(unparsed) as Record<string, string>;\n }\n\n return {\n registrationId: getStringOrUndefined(rawRegistrationDescription[\"RegistrationId\"]),\n expirationTime: getDateOrUndefined(rawRegistrationDescription[\"ExpirationTime\"]),\n etag: getStringOrUndefined(rawRegistrationDescription[\"ETag\"]),\n tags: getTagsOrUndefined(rawRegistrationDescription[\"Tags\"]),\n pushVariables: pushVariables,\n };\n}\n\nfunction createTemplateRegistrationDescription(\n rawRegistrationDescription: Record<string, any>\n): TemplateRegistrationDescription {\n return {\n bodyTemplate: getString(rawRegistrationDescription[\"BodyTemplate\"], \"bodyTemplate\"),\n templateName: getStringOrUndefined(rawRegistrationDescription[\"TemplateName\"]),\n ...createRegistrationDescription(rawRegistrationDescription),\n };\n}\n\n/**\n * @internal\n * Represents a serializer for all registration descriptions.\n */\nexport interface RegistrationDescriptionSerializer {\n /**\n * @internal\n * Serializes a registration description into an ATOM XML string.\n */\n serializeRegistrationDescription(description: RegistrationDescription): string;\n /**\n * @internal\n * Serializes an Amazon Device Messaging (ADM) registration description into an XML object for serialization.\n */\n serializeAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Amazon Device Messaging (ADM) template registration description into an XML object for serialization.\n */\n serializeAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Apple registration description into an XML object for serialization.\n */\n serializeAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes an Apple template registration description into an XML object for serialization.\n */\n serializeAppleTemplateRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Baidu registration description into an XML object for serialization.\n */\n serializeBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Baidu template registration description into an XML object for serialization.\n */\n serializeBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Web Push registration description into an XML object for serialization.\n */\n serializeBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Web Push template registration description into an XML object for serialization.\n */\n serializeBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Google Cloud Messaging (GCM) registration description into an XML object for serialization.\n */\n serializeGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Google Cloud Messaging (GCM) template registration description into an XML object for serialization.\n */\n serializeGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Phone registration description into an XML object for serialization.\n */\n serializeMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Phone template registration description into an XML object for serialization.\n */\n serializeMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Notification Services (WNS) registration description into an XML object for serialization.\n */\n serializeWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"kind\">\n ): Record<string, any>;\n /**\n * @internal\n * Serializes a Windows Notification Services (WNS) template registration description into an XML object for serialization.\n */\n serializeWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"kind\">\n ): Record<string, any>;\n}\n\n/**\n * Represents a RegistrationDescription serializer.\n */\nexport const registrationDescriptionSerializer: RegistrationDescriptionSerializer = {\n serializeRegistrationDescription(description: RegistrationDescription): string {\n const rootName = `${description.kind}RegistrationDescription`;\n const methodName = `serialize${rootName}`;\n\n const method = this[methodName as keyof RegistrationDescriptionSerializer].bind(this) as (\n description: RegistrationDescription\n ) => Record<string, any>;\n if (!isDefined(method)) {\n throw new RestError(`Undefined platform ${description.kind}`, { statusCode: 400 });\n }\n\n const registration = method(description) as Record<string, any>;\n const requestObject = serializeToAtomXmlRequest(rootName, registration);\n\n return stringifyXML(requestObject, { rootName: \"entry\" });\n },\n\n /**\n * @internal\n * Serializes an existing ADM registration description to an object for serialization.\n */\n serializeAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n AdmRegistrationId: getString(description.admRegistrationId, \"admRegistrationId\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing ADM template registration description to an object for serialization.\n */\n serializeAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...this.serializeAdmRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Apple registration description to an object for serialization.\n */\n serializeAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n DeviceToken: getString(description.deviceToken, \"deviceToken\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Apple template registration description to an object for serialization.\n */\n serializeAppleTemplateRegistrationDescription(\n description: AppleTemplateRegistrationDescription\n ): Record<string, any> {\n let apnsHeaders: Record<string, any> | undefined;\n if (description.apnsHeaders) {\n apnsHeaders = {\n ApnsHeader: [],\n };\n\n for (const header of Object.keys(description.apnsHeaders)) {\n apnsHeaders[\"ApnsHeader\"].push({\n Header: header,\n Value: description.apnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeAppleRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n Expiry: getStringOrUndefined(description.expiry),\n ApnsHeaders: apnsHeaders,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Baidu registration description to an object for serialization.\n */\n serializeBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n BaiduChannelId: getString(description.baiduChannelId, \"baiduChannelId\"),\n BaiduUserId: getString(description.baiduUserId, \"baiduUserId\"),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Baidu template registration description to an object for serialization.\n */\n serializeBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...this.serializeBaiduRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * Serializes an existing Browser registration description to an object for serialization.\n */\n serializeBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n Endpoint: description.endpoint,\n Auth: description.auth,\n P256DH: description.p256dh,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Browser template registration description to an object for serialization.\n */\n serializeBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...this.serializeBrowserRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * @deprecated Should use FCM registrations instead of GCM.\n * Serializes an existing GCM registration description to an object for serialization.\n */\n serializeGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n GcmRegistrationId: getString(description.gcmRegistrationId, \"gcmRegistrationId\"),\n };\n },\n\n /**\n * @internal\n * @deprecated Should use FCM template registrations instead of GCM.\n * Serializes an existing GCM template registration description to an object for serialization.\n */\n serializeGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...this.serializeGcmRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n };\n },\n\n /**\n * @internal\n * @deprecated Windows Phone is no longer supported.\n * Serializes an existing MPNS registration description to an object for serialization.\n */\n serializeMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n ChannelUri: description.channelUri,\n };\n },\n\n /**\n * @internal\n * @deprecated Windows Phone is no longer supported.\n * Serializes an existing MPNS template registration description to an object for serialization.\n */\n serializeMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n let mpnsHeaders: Record<string, any> | undefined;\n if (description.mpnsHeaders) {\n mpnsHeaders = {\n MpnsHeader: [],\n };\n\n for (const header of Object.keys(description.mpnsHeaders)) {\n mpnsHeaders[\"MpnsHeader\"].push({\n Header: header,\n Value: description.mpnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeMpnsRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n MpnsHeaders: mpnsHeaders,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Windows registration description to an object for serialization.\n */\n serializeWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"kind\">\n ): Record<string, any> {\n return {\n ...serializeRegistrationDescription(description),\n ChannelUri: description.channelUri,\n };\n },\n\n /**\n * @internal\n * Serializes an existing Windows template registration description to an object for serialization.\n */\n serializeWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"kind\">\n ): Record<string, any> {\n let wnsHeaders: Record<string, any> | undefined;\n if (description.wnsHeaders) {\n wnsHeaders = {\n WnsHeader: [],\n };\n\n for (const header of Object.keys(description.wnsHeaders)) {\n wnsHeaders[\"WnsHeader\"].push({\n Header: header,\n Value: description.wnsHeaders[header],\n });\n }\n }\n\n return {\n ...this.serializeWindowsRegistrationDescription(description),\n ...serializeTemplateRegistrationDescription(description),\n WnsHeaders: wnsHeaders,\n };\n },\n};\n\nfunction serializeRegistrationDescription(\n description: Omit<RegistrationDescriptionCommon, \"kind\">\n): Record<string, any> {\n let tags: string | undefined;\n if (description.tags) {\n tags = description.tags.join(\",\");\n }\n\n let pushVariables: string | undefined;\n if (description.pushVariables) {\n pushVariables = JSON.stringify(description.pushVariables);\n }\n\n return {\n RegistrationId: getStringOrUndefined(description.registrationId),\n Tags: tags,\n PushVariables: pushVariables,\n };\n}\n\nfunction serializeTemplateRegistrationDescription(\n description: TemplateRegistrationDescription\n): Record<string, any> {\n return {\n BodyTemplate: { __cdata: description.bodyTemplate },\n TemplateName: getStringOrUndefined(description.templateName),\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- export const SDK_VERSION = "1.0.0-beta.6";
3
+ export const SDK_VERSION = "1.0.0-beta.7";
4
4
  export const JSON_CONTENT_TYPE = "application/json;charset=utf-8";
5
5
  export const XML_CONTENT_TYPE = "application/xml";
6
6
  export const STREAM_CONTENT_TYPE = "application/octet-stream";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.6\";\n\nexport const JSON_CONTENT_TYPE = \"application/json;charset=utf-8\";\nexport const XML_CONTENT_TYPE = \"application/xml\";\nexport const STREAM_CONTENT_TYPE = \"application/octet-stream\";\n\nexport const WNS_TYPE_NAME = \"X-WNS-Type\";\nexport const WNS_RAW = \"wns/raw\";\nexport const WNS_BADGE = \"wns/badge\";\nexport const WNS_TITLE = \"wns/tile\";\nexport const WNS_TOAST = \"wns/toast\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.7\";\n\nexport const JSON_CONTENT_TYPE = \"application/json;charset=utf-8\";\nexport const XML_CONTENT_TYPE = \"application/xml\";\nexport const STREAM_CONTENT_TYPE = \"application/octet-stream\";\n\nexport const WNS_TYPE_NAME = \"X-WNS-Type\";\nexport const WNS_RAW = \"wns/raw\";\nexport const WNS_BADGE = \"wns/badge\";\nexport const WNS_TITLE = \"wns/tile\";\nexport const WNS_TOAST = \"wns/toast\";\n"]}
@@ -16,10 +16,4 @@ export function createMultipartDirectNotification(boundaryName, notification, de
16
16
  "\r\n" +
17
17
  `--${boundaryName}--`);
18
18
  }
19
- /**
20
- * @internal
21
- */
22
- export function normalizeTags(tags) {
23
- return Array.isArray(tags) ? tags.join("||") : tags;
24
- }
25
19
  //# sourceMappingURL=notificationUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notificationUtils.js","sourceRoot":"","sources":["../../../src/utils/notificationUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,YAAoB,EACpB,YAA0B,EAC1B,aAAuB;IAEvB,OAAO,CACL,KAAK,YAAY,MAAM;QACvB,iBAAiB,YAAY,CAAC,WAAW,MAAM;QAC/C,wDAAwD;QACxD,YAAY,CAAC,IAAI;QACjB,MAAM;QACN,KAAK,YAAY,MAAM;QACvB,oCAAoC;QACpC,mDAAmD;QACnD,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;QAC7B,MAAM;QACN,KAAK,YAAY,IAAI,CACtB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\n\n/**\n * @internal\n */\nexport function createMultipartDirectNotification(\n boundaryName: string,\n notification: Notification,\n deviceHandles: string[]\n): string {\n return (\n `--${boundaryName}\\r\\n` +\n `Content-type: ${notification.contentType}\\r\\n` +\n \"Content-Disposition: inline; name=notification\\r\\n\\r\\n\" +\n notification.body +\n \"\\r\\n\" +\n `--${boundaryName}\\r\\n` +\n \"Content-type: application/json\\r\\n\" +\n \"Content-Disposition: inline; name=devices\\r\\n\\r\\n\" +\n JSON.stringify(deviceHandles) +\n \"\\r\\n\" +\n `--${boundaryName}--`\n );\n}\n\n/**\n * @internal\n */\nexport function normalizeTags(tags: string | string[]): string {\n return Array.isArray(tags) ? tags.join(\"||\") : tags;\n}\n"]}
1
+ {"version":3,"file":"notificationUtils.js","sourceRoot":"","sources":["../../../src/utils/notificationUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,YAAoB,EACpB,YAA0B,EAC1B,aAAuB;IAEvB,OAAO,CACL,KAAK,YAAY,MAAM;QACvB,iBAAiB,YAAY,CAAC,WAAW,MAAM;QAC/C,wDAAwD;QACxD,YAAY,CAAC,IAAI;QACjB,MAAM;QACN,KAAK,YAAY,MAAM;QACvB,oCAAoC;QACpC,mDAAmD;QACnD,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;QAC7B,MAAM;QACN,KAAK,YAAY,IAAI,CACtB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\n\n/**\n * @internal\n */\nexport function createMultipartDirectNotification(\n boundaryName: string,\n notification: Notification,\n deviceHandles: string[]\n): string {\n return (\n `--${boundaryName}\\r\\n` +\n `Content-type: ${notification.contentType}\\r\\n` +\n \"Content-Disposition: inline; name=notification\\r\\n\\r\\n\" +\n notification.body +\n \"\\r\\n\" +\n `--${boundaryName}\\r\\n` +\n \"Content-type: application/json\\r\\n\" +\n \"Content-Disposition: inline; name=devices\\r\\n\\r\\n\" +\n JSON.stringify(deviceHandles) +\n \"\\r\\n\" +\n `--${boundaryName}--`\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/notification-hubs",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "Azure Notification Hubs SDK for JavaScript",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -18,17 +18,13 @@
18
18
  "require": "./dist/index.cjs",
19
19
  "import": "./dist-esm/src/index.js"
20
20
  },
21
- "./client": {
22
- "types": "./types/src/client/index.d.ts",
23
- "import": "./dist-esm/src/client/index.js"
21
+ "./api": {
22
+ "types": "./types/src/api/index.d.ts",
23
+ "import": "./dist-esm/src/api/index.js"
24
24
  },
25
- "./client/*": {
26
- "types": "./types/src/client/*.d.ts",
27
- "import": "./dist-esm/src/client/*.js"
28
- },
29
- "./models/*": {
30
- "types": "./types/src/models/*.d.ts",
31
- "import": "./dist-esm/src/models/*.js"
25
+ "./models": {
26
+ "types": "./types/src/models/index.d.ts",
27
+ "import": "./dist-esm/src/models/index.js"
32
28
  }
33
29
  },
34
30
  "//metadata": {
@@ -83,7 +79,7 @@
83
79
  ],
84
80
  "repository": "github:Azure/azure-sdk-for-js",
85
81
  "engines": {
86
- "node": ">=12.0.0"
82
+ "node": ">=14.0.0"
87
83
  },
88
84
  "keywords": [
89
85
  "azure",
@@ -105,7 +101,7 @@
105
101
  "@microsoft/api-extractor": "^7.31.1",
106
102
  "@types/chai": "^4.3.1",
107
103
  "@types/mocha": "^9.1.1",
108
- "@types/node": "^12.0.0",
104
+ "@types/node": "^14.0.0",
109
105
  "@types/uuid": "^8.3.4",
110
106
  "chai": "^4.3.6",
111
107
  "cross-env": "^7.0.3",