@azure/notification-hubs 1.0.0-beta.1 → 1.0.0-beta.4

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 (165) hide show
  1. package/README.md +15 -20
  2. package/dist/{index.js → index.cjs} +245 -146
  3. package/dist/index.cjs.map +1 -0
  4. package/dist-esm/src/{utils → auth}/connectionStringUtils.js +37 -1
  5. package/dist-esm/src/auth/connectionStringUtils.js.map +1 -0
  6. package/dist-esm/src/auth/hmacSha256.browser.js +12 -0
  7. package/dist-esm/src/auth/hmacSha256.browser.js.map +1 -0
  8. package/dist-esm/src/auth/hmacSha256.js +8 -0
  9. package/dist-esm/src/auth/hmacSha256.js.map +1 -0
  10. package/dist-esm/src/auth/sasTokenProvider.js +58 -0
  11. package/dist-esm/src/auth/sasTokenProvider.js.map +1 -0
  12. package/dist-esm/src/client/cancelScheduledNotification.js +3 -2
  13. package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -1
  14. package/dist-esm/src/client/createOrUpdateInstallation.js +3 -2
  15. package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -1
  16. package/dist-esm/src/client/createOrUpdateRegistration.js +2 -1
  17. package/dist-esm/src/client/createOrUpdateRegistration.js.map +1 -1
  18. package/dist-esm/src/client/createRegistration.js +2 -1
  19. package/dist-esm/src/client/createRegistration.js.map +1 -1
  20. package/dist-esm/src/client/createRegistrationId.js +3 -2
  21. package/dist-esm/src/client/createRegistrationId.js.map +1 -1
  22. package/dist-esm/src/client/deleteInstallation.js +3 -2
  23. package/dist-esm/src/client/deleteInstallation.js.map +1 -1
  24. package/dist-esm/src/client/deleteRegistration.js +3 -2
  25. package/dist-esm/src/client/deleteRegistration.js.map +1 -1
  26. package/dist-esm/src/client/getFeedbackContainerUrl.js +3 -2
  27. package/dist-esm/src/client/getFeedbackContainerUrl.js.map +1 -1
  28. package/dist-esm/src/client/getInstallation.js +3 -2
  29. package/dist-esm/src/client/getInstallation.js.map +1 -1
  30. package/dist-esm/src/client/getNotificationHubJob.js +3 -2
  31. package/dist-esm/src/client/getNotificationHubJob.js.map +1 -1
  32. package/dist-esm/src/client/getNotificationOutcomeDetails.js +3 -2
  33. package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +1 -1
  34. package/dist-esm/src/client/getRegistration.js +3 -2
  35. package/dist-esm/src/client/getRegistration.js.map +1 -1
  36. package/dist-esm/src/client/index.js +7 -3
  37. package/dist-esm/src/client/index.js.map +1 -1
  38. package/dist-esm/src/client/internal/_client.js +23 -7
  39. package/dist-esm/src/client/internal/_client.js.map +1 -1
  40. package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js +1 -1
  41. package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +1 -1
  42. package/dist-esm/src/client/internal/_scheduleNotificationPayload.js +3 -2
  43. package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -1
  44. package/dist-esm/src/client/internal/_sendNotificationPayload.js +2 -2
  45. package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -1
  46. package/dist-esm/src/client/listNotificationHubJobs.js +3 -2
  47. package/dist-esm/src/client/listNotificationHubJobs.js.map +1 -1
  48. package/dist-esm/src/client/listRegistrations.js +3 -2
  49. package/dist-esm/src/client/listRegistrations.js.map +1 -1
  50. package/dist-esm/src/client/listRegistrationsByTag.js +3 -2
  51. package/dist-esm/src/client/listRegistrationsByTag.js.map +1 -1
  52. package/dist-esm/src/client/scheduleBroadcastNotification.js.map +1 -1
  53. package/dist-esm/src/client/scheduleNotification.js.map +1 -1
  54. package/dist-esm/src/client/sendBroadcastNotification.js.map +1 -1
  55. package/dist-esm/src/client/sendDirectNotification.js +1 -2
  56. package/dist-esm/src/client/sendDirectNotification.js.map +1 -1
  57. package/dist-esm/src/client/sendNotification.js.map +1 -1
  58. package/dist-esm/src/client/submitNotificationHubJob.js +3 -2
  59. package/dist-esm/src/client/submitNotificationHubJob.js.map +1 -1
  60. package/dist-esm/src/client/updateInstallation.js +3 -2
  61. package/dist-esm/src/client/updateInstallation.js.map +1 -1
  62. package/dist-esm/src/client/updateRegistration.js +2 -1
  63. package/dist-esm/src/client/updateRegistration.js.map +1 -1
  64. package/dist-esm/src/models/installation.js +1 -1
  65. package/dist-esm/src/models/installation.js.map +1 -1
  66. package/dist-esm/src/models/notification.js +1 -1
  67. package/dist-esm/src/models/notification.js.map +1 -1
  68. package/dist-esm/src/models/notificationBuilder.js +6 -6
  69. package/dist-esm/src/models/notificationBuilder.js.map +1 -1
  70. package/dist-esm/src/models/notificationDetails.js.map +1 -1
  71. package/dist-esm/src/models/registration.js +3 -39
  72. package/dist-esm/src/models/registration.js.map +1 -1
  73. package/dist-esm/src/models/response.js.map +1 -1
  74. package/dist-esm/src/notificationHubsClient.js +1 -2
  75. package/dist-esm/src/notificationHubsClient.js.map +1 -1
  76. package/dist-esm/src/serializers/notificationHubJobSerializer.js +3 -0
  77. package/dist-esm/src/serializers/notificationHubJobSerializer.js.map +1 -1
  78. package/dist-esm/src/serializers/notificationOutcomeSerializer.js +31 -0
  79. package/dist-esm/src/serializers/notificationOutcomeSerializer.js.map +1 -0
  80. package/dist-esm/src/serializers/registrationSerializer.js +3 -28
  81. package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
  82. package/dist-esm/src/utils/constants.js +1 -0
  83. package/dist-esm/src/utils/constants.js.map +1 -1
  84. package/dist-esm/src/utils/retryPolicy.js +2 -2
  85. package/dist-esm/src/utils/retryPolicy.js.map +1 -1
  86. package/dist-esm/src/utils/tracing.js +2 -1
  87. package/dist-esm/src/utils/tracing.js.map +1 -1
  88. package/package.json +18 -13
  89. package/types/3.1/notification-hubs.d.ts +60 -77
  90. package/types/latest/notification-hubs.d.ts +61 -83
  91. package/types/latest/tsdoc-metadata.json +1 -1
  92. package/types/src/{utils → auth}/connectionStringUtils.d.ts +7 -1
  93. package/types/src/auth/connectionStringUtils.d.ts.map +1 -0
  94. package/types/src/auth/hmacSha256.browser.d.ts +3 -0
  95. package/types/src/auth/hmacSha256.browser.d.ts.map +1 -0
  96. package/types/src/auth/hmacSha256.d.ts +2 -0
  97. package/types/src/auth/hmacSha256.d.ts.map +1 -0
  98. package/types/src/auth/sasTokenProvider.d.ts +77 -0
  99. package/types/src/auth/sasTokenProvider.d.ts.map +1 -0
  100. package/types/src/client/cancelScheduledNotification.d.ts +1 -1
  101. package/types/src/client/cancelScheduledNotification.d.ts.map +1 -1
  102. package/types/src/client/createOrUpdateInstallation.d.ts +1 -1
  103. package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -1
  104. package/types/src/client/createOrUpdateRegistration.d.ts.map +1 -1
  105. package/types/src/client/createRegistration.d.ts.map +1 -1
  106. package/types/src/client/createRegistrationId.d.ts.map +1 -1
  107. package/types/src/client/deleteInstallation.d.ts +1 -1
  108. package/types/src/client/deleteInstallation.d.ts.map +1 -1
  109. package/types/src/client/deleteRegistration.d.ts +1 -1
  110. package/types/src/client/deleteRegistration.d.ts.map +1 -1
  111. package/types/src/client/getFeedbackContainerUrl.d.ts.map +1 -1
  112. package/types/src/client/getInstallation.d.ts.map +1 -1
  113. package/types/src/client/getNotificationHubJob.d.ts.map +1 -1
  114. package/types/src/client/getNotificationOutcomeDetails.d.ts.map +1 -1
  115. package/types/src/client/getRegistration.d.ts.map +1 -1
  116. package/types/src/client/index.d.ts +2 -3
  117. package/types/src/client/index.d.ts.map +1 -1
  118. package/types/src/client/internal/_client.d.ts +8 -8
  119. package/types/src/client/internal/_client.d.ts.map +1 -1
  120. package/types/src/client/internal/_scheduleNotificationPayload.d.ts +1 -1
  121. package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -1
  122. package/types/src/client/internal/_sendNotificationPayload.d.ts +1 -1
  123. package/types/src/client/internal/_sendNotificationPayload.d.ts.map +1 -1
  124. package/types/src/client/listNotificationHubJobs.d.ts.map +1 -1
  125. package/types/src/client/listRegistrations.d.ts.map +1 -1
  126. package/types/src/client/listRegistrationsByTag.d.ts.map +1 -1
  127. package/types/src/client/scheduleBroadcastNotification.d.ts +1 -1
  128. package/types/src/client/scheduleBroadcastNotification.d.ts.map +1 -1
  129. package/types/src/client/scheduleNotification.d.ts +1 -1
  130. package/types/src/client/scheduleNotification.d.ts.map +1 -1
  131. package/types/src/client/sendBroadcastNotification.d.ts +1 -1
  132. package/types/src/client/sendBroadcastNotification.d.ts.map +1 -1
  133. package/types/src/client/sendDirectNotification.d.ts +4 -5
  134. package/types/src/client/sendDirectNotification.d.ts.map +1 -1
  135. package/types/src/client/sendNotification.d.ts +1 -1
  136. package/types/src/client/sendNotification.d.ts.map +1 -1
  137. package/types/src/client/submitNotificationHubJob.d.ts.map +1 -1
  138. package/types/src/client/updateInstallation.d.ts +1 -1
  139. package/types/src/client/updateInstallation.d.ts.map +1 -1
  140. package/types/src/client/updateRegistration.d.ts.map +1 -1
  141. package/types/src/models/installation.d.ts +3 -3
  142. package/types/src/models/installation.d.ts.map +1 -1
  143. package/types/src/models/notification.d.ts +3 -3
  144. package/types/src/models/notification.d.ts.map +1 -1
  145. package/types/src/models/notificationBuilder.d.ts +4 -4
  146. package/types/src/models/notificationBuilder.d.ts.map +1 -1
  147. package/types/src/models/notificationDetails.d.ts +63 -0
  148. package/types/src/models/notificationDetails.d.ts.map +1 -1
  149. package/types/src/models/registration.d.ts +6 -59
  150. package/types/src/models/registration.d.ts.map +1 -1
  151. package/types/src/models/response.d.ts +0 -26
  152. package/types/src/models/response.d.ts.map +1 -1
  153. package/types/src/notificationHubsClient.d.ts +3 -5
  154. package/types/src/notificationHubsClient.d.ts.map +1 -1
  155. package/types/src/serializers/notificationHubJobSerializer.d.ts.map +1 -1
  156. package/types/src/serializers/notificationOutcomeSerializer.d.ts +3 -0
  157. package/types/src/serializers/notificationOutcomeSerializer.d.ts.map +1 -0
  158. package/types/src/serializers/registrationSerializer.d.ts +1 -21
  159. package/types/src/serializers/registrationSerializer.d.ts.map +1 -1
  160. package/types/src/utils/constants.d.ts +1 -0
  161. package/types/src/utils/constants.d.ts.map +1 -1
  162. package/types/src/utils/tracing.d.ts.map +1 -1
  163. package/dist/index.js.map +0 -1
  164. package/dist-esm/src/utils/connectionStringUtils.js.map +0 -1
  165. package/types/src/utils/connectionStringUtils.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"updateInstallation.js","sourceRoot":"","sources":["../../../src/client/updateInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,mBAAgC,EAChC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,kDAAkD,EAClD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAEnD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { JsonPatch } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param context - The Notification Hubs client.\n * @param installationId - The ID of the installation to update.\n * @param installationPatches - 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 */\nexport function updateInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n installationPatches: JsonPatch[],\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n \"NotificationHubsClientContext-updateInstallation\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n const headers = context.createHeaders();\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"PATCH\", headers, updatedOptions);\n request.body = JSON.stringify(installationPatches);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
1
+ {"version":3,"file":"updateInstallation.js","sourceRoot":"","sources":["../../../src/client/updateInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,mBAAgC,EAChC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { JsonPatch } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"updateInstallation\";\n\n/**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param context - The Notification Hubs client.\n * @param installationId - The ID of the installation to update.\n * @param installationPatches - 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 */\nexport function updateInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n installationPatches: JsonPatch[],\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"PATCH\", headers, updatedOptions);\n request.body = JSON.stringify(installationPatches);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  import { RestError } from "@azure/core-rest-pipeline";
4
4
  import { createOrUpdateRegistrationDescription } from "./internal/_createOrUpdateRegistrationDescription.js";
5
5
  import { tracingClient } from "../utils/tracing.js";
6
+ const OPERATION_NAME = "updateRegistration";
6
7
  /**
7
8
  * Updates an existing registration.
8
9
  * @param context - The Notification Hubs client.
@@ -11,7 +12,7 @@ import { tracingClient } from "../utils/tracing.js";
11
12
  * @returns The updated registration description.
12
13
  */
13
14
  export function updateRegistration(context, registration, options = {}) {
14
- return tracingClient.withSpan("NotificationHubsClientContext-updateRegistration", options, async (updatedOptions) => {
15
+ return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
15
16
  if (!registration.etag) {
16
17
  throw new RestError("ETag is required for registration update", { statusCode: 400 });
17
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"updateRegistration.js","sourceRoot":"","sources":["../../../src/client/updateRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,kDAAkD,EAClD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;YACtB,MAAM,IAAI,SAAS,CAAC,0CAA0C,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,qCAAqC,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChG,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Updates an existing registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\nexport function updateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n \"NotificationHubsClientContext-updateRegistration\",\n options,\n async (updatedOptions) => {\n if (!registration.etag) {\n throw new RestError(\"ETag is required for registration update\", { statusCode: 400 });\n }\n return createOrUpdateRegistrationDescription(context, registration, \"update\", updatedOptions);\n }\n );\n}\n"]}
1
+ {"version":3,"file":"updateRegistration.js","sourceRoot":"","sources":["../../../src/client/updateRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;YACtB,MAAM,IAAI,SAAS,CAAC,0CAA0C,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,qCAAqC,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChG,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"updateRegistration\";\n\n/**\n * Updates an existing registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\nexport function updateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n if (!registration.etag) {\n throw new RestError(\"ETag is required for registration update\", { statusCode: 400 });\n }\n return createOrUpdateRegistrationDescription(context, registration, \"update\", updatedOptions);\n }\n );\n}\n"]}
@@ -29,7 +29,7 @@ export function createBaiduInstallation(installation) {
29
29
  * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.
30
30
  * @returns The newly created Baidu installation.
31
31
  */
32
- export function createFirebaseLegacyInstallation(installation) {
32
+ export function createFcmLegacyInstallation(installation) {
33
33
  return Object.assign(Object.assign({}, installation), { platform: "gcm" });
34
34
  }
35
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/models/installation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA8DlC;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiD;IAEjD,uCACK,YAAY,KACf,QAAQ,EAAE,MAAM,IAChB;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAA+C;IAE/C,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiD;IAEjD,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,YAA0D;IAE1D,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAmD;IAEnD,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAqCD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAmD;IAEnD,uCACK,YAAY,KACf,QAAQ,EAAE,SAAS,IACnB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents an installation for a device for Notification Hubs.\n */\nexport interface InstallationCommon {\n /**\n * The ID for the installation.\n */\n installationId: string;\n\n /**\n * The User ID for the installation used for targeting.\n */\n userId?: string;\n\n /**\n * The installation expiration time.\n */\n readonly expirationTime?: string;\n\n /**\n * The last update date of the installation.\n */\n readonly lastUpdate?: string;\n\n /**\n * The platform for the installation.\n */\n platform: \"apns\" | \"adm\" | \"baidu\" | \"browser\" | \"gcm\" | \"wns\";\n\n /**\n * The tags used for targeting this installation.\n */\n tags?: string[];\n\n /**\n * The templates for the installation.\n */\n templates?: Record<string, InstallationTemplate>;\n}\n\n/**\n * Represents an installation with a string based device token.\n */\nexport interface DeviceTokenInstallation extends InstallationCommon {\n /**\n * The push channel for a device.\n */\n pushChannel: string;\n}\n\n/**\n * Represents an Apple APNs based installation.\n */\nexport interface AppleInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"apns\";\n}\n\n/**\n * Creates an Apple based installation.\n * @param installation - A partial installation used to create the Apple installation.\n * @returns The newly created Apple installation.\n */\nexport function createAppleInstallation(\n installation: Omit<AppleInstallation, \"platform\">\n): AppleInstallation {\n return {\n ...installation,\n platform: \"apns\",\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) based installation.\n */\nexport interface AdmInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates an Amazon Device Messaging (ADM) based installation.\n * @param installation - A partial installation used to create the ADM installation.\n * @returns The newly created ADM installation.\n */\nexport function createAdmInstallation(\n installation: Omit<AdmInstallation, \"platform\">\n): AdmInstallation {\n return {\n ...installation,\n platform: \"adm\",\n };\n}\n\n/**\n * Represents a Baidu based installation.\n */\nexport interface BaiduInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a Baidu based installation.\n * @param installation - A partial installation used to create the Baidu installation.\n * @returns The newly created Baidu installation.\n */\nexport function createBaiduInstallation(\n installation: Omit<BaiduInstallation, \"platform\">\n): BaiduInstallation {\n return {\n ...installation,\n platform: \"baidu\",\n };\n}\n\n/**\n * Represents a Firebase Legacy HTTP installation.\n */\nexport interface FirebaseLegacyInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a Firebase legacy HTTP based installation.\n * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.\n * @returns The newly created Baidu installation.\n */\nexport function createFirebaseLegacyInstallation(\n installation: Omit<FirebaseLegacyInstallation, \"platform\">\n): FirebaseLegacyInstallation {\n return {\n ...installation,\n platform: \"gcm\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) based installation.\n */\nexport interface WindowsInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"wns\";\n}\n\n/**\n * Creates a Windows Notification Services (WNS) based installation.\n * @param installation - A partial installation used to create the WNS installation.\n * @returns The newly created WNS installation.\n */\nexport function createWindowsInstallation(\n installation: Omit<WindowsInstallation, \"platform\">\n): WindowsInstallation {\n return {\n ...installation,\n platform: \"wns\",\n };\n}\n\n/**\n * Represents the push channel for a Browser Push installation.\n */\nexport interface BrowserPushChannel {\n /**\n * The P256DH for the browser push installation.\n */\n p256dh: string;\n\n /**\n * The auth secret for the browser push installation.\n */\n auth: string;\n\n /**\n * The endpoint URL for the browser push installation.\n */\n endpoint: string;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallation extends InstallationCommon {\n /**\n * The push channel for the Web Push API.\n */\n pushChannel: BrowserPushChannel;\n\n /**\n * The platform for the installation.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a Web Push based installation.\n * @param installation - A partial installation used to create the Web Push installation.\n * @returns The newly created Web Push installation.\n */\nexport function createBrowserInstallation(\n installation: Omit<BrowserInstallation, \"platform\">\n): BrowserInstallation {\n return {\n ...installation,\n platform: \"browser\",\n };\n}\n\n/**\n * Represents the types of installations available in Notification Hubs.\n */\nexport type Installation =\n | AppleInstallation\n | AdmInstallation\n | BaiduInstallation\n | BrowserInstallation\n | FirebaseLegacyInstallation\n | WindowsInstallation;\n\n/**\n * Represents an installation template.\n */\nexport interface InstallationTemplate {\n /**\n * The body for the installation template.\n */\n body: string;\n\n /**\n * Headers to include for the template send.\n */\n headers: Record<string, string>;\n\n /**\n * The tags to include for the template.\n */\n tags?: string[];\n}\n\n/**\n * Represents the JSON Patch types of add, remove and replace.\n */\nexport type JsonPatchOperation = \"add\" | \"remove\" | \"replace\";\n\n/**\n * Represents a patch operation.\n */\nexport interface JsonPatch {\n /**\n * The patch operation.\n */\n op: JsonPatchOperation;\n\n /**\n * The path for the patch operation.\n */\n path: string;\n\n /**\n * The value to add or replace for the operation.\n */\n value?: string;\n}\n\n/**\n * Represents the types of push channels available for Notification Hubs.\n */\nexport type PushHandle = BrowserPushChannel | string;\n"]}
1
+ {"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/models/installation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA8DlC;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiD;IAEjD,uCACK,YAAY,KACf,QAAQ,EAAE,MAAM,IAChB;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAA+C;IAE/C,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiD;IAEjD,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,YAAqD;IAErD,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAmD;IAEnD,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAqCD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAmD;IAEnD,uCACK,YAAY,KACf,QAAQ,EAAE,SAAS,IACnB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents an installation for a device for Notification Hubs.\n */\nexport interface InstallationCommon {\n /**\n * The ID for the installation.\n */\n installationId: string;\n\n /**\n * The User ID for the installation used for targeting.\n */\n userId?: string;\n\n /**\n * The installation expiration time.\n */\n readonly expirationTime?: string;\n\n /**\n * The last update date of the installation.\n */\n readonly lastUpdate?: string;\n\n /**\n * The platform for the installation.\n */\n platform: \"apns\" | \"adm\" | \"baidu\" | \"browser\" | \"gcm\" | \"wns\";\n\n /**\n * The tags used for targeting this installation.\n */\n tags?: string[];\n\n /**\n * The templates for the installation.\n */\n templates?: Record<string, InstallationTemplate>;\n}\n\n/**\n * Represents an installation with a string based device token.\n */\nexport interface DeviceTokenInstallation extends InstallationCommon {\n /**\n * The push channel for a device.\n */\n pushChannel: string;\n}\n\n/**\n * Represents an Apple APNs based installation.\n */\nexport interface AppleInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"apns\";\n}\n\n/**\n * Creates an Apple based installation.\n * @param installation - A partial installation used to create the Apple installation.\n * @returns The newly created Apple installation.\n */\nexport function createAppleInstallation(\n installation: Omit<AppleInstallation, \"platform\">\n): AppleInstallation {\n return {\n ...installation,\n platform: \"apns\",\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) based installation.\n */\nexport interface AdmInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates an Amazon Device Messaging (ADM) based installation.\n * @param installation - A partial installation used to create the ADM installation.\n * @returns The newly created ADM installation.\n */\nexport function createAdmInstallation(\n installation: Omit<AdmInstallation, \"platform\">\n): AdmInstallation {\n return {\n ...installation,\n platform: \"adm\",\n };\n}\n\n/**\n * Represents a Baidu based installation.\n */\nexport interface BaiduInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a Baidu based installation.\n * @param installation - A partial installation used to create the Baidu installation.\n * @returns The newly created Baidu installation.\n */\nexport function createBaiduInstallation(\n installation: Omit<BaiduInstallation, \"platform\">\n): BaiduInstallation {\n return {\n ...installation,\n platform: \"baidu\",\n };\n}\n\n/**\n * Represents a Firebase Legacy HTTP installation.\n */\nexport interface FcmLegacyInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a Firebase legacy HTTP based installation.\n * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.\n * @returns The newly created Baidu installation.\n */\nexport function createFcmLegacyInstallation(\n installation: Omit<FcmLegacyInstallation, \"platform\">\n): FcmLegacyInstallation {\n return {\n ...installation,\n platform: \"gcm\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) based installation.\n */\nexport interface WindowsInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"wns\";\n}\n\n/**\n * Creates a Windows Notification Services (WNS) based installation.\n * @param installation - A partial installation used to create the WNS installation.\n * @returns The newly created WNS installation.\n */\nexport function createWindowsInstallation(\n installation: Omit<WindowsInstallation, \"platform\">\n): WindowsInstallation {\n return {\n ...installation,\n platform: \"wns\",\n };\n}\n\n/**\n * Represents the push channel for a Browser Push installation.\n */\nexport interface BrowserPushChannel {\n /**\n * The P256DH for the browser push installation.\n */\n p256dh: string;\n\n /**\n * The auth secret for the browser push installation.\n */\n auth: string;\n\n /**\n * The endpoint URL for the browser push installation.\n */\n endpoint: string;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallation extends InstallationCommon {\n /**\n * The push channel for the Web Push API.\n */\n pushChannel: BrowserPushChannel;\n\n /**\n * The platform for the installation.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a Web Push based installation.\n * @param installation - A partial installation used to create the Web Push installation.\n * @returns The newly created Web Push installation.\n */\nexport function createBrowserInstallation(\n installation: Omit<BrowserInstallation, \"platform\">\n): BrowserInstallation {\n return {\n ...installation,\n platform: \"browser\",\n };\n}\n\n/**\n * Represents the types of installations available in Notification Hubs.\n */\nexport type Installation =\n | AppleInstallation\n | AdmInstallation\n | BaiduInstallation\n | BrowserInstallation\n | FcmLegacyInstallation\n | WindowsInstallation;\n\n/**\n * Represents an installation template.\n */\nexport interface InstallationTemplate {\n /**\n * The body for the installation template.\n */\n body: string;\n\n /**\n * Headers to include for the template send.\n */\n headers: Record<string, string>;\n\n /**\n * The tags to include for the template.\n */\n tags?: string[];\n}\n\n/**\n * Represents the JSON Patch types of add, remove and replace.\n */\nexport type JsonPatchOperation = \"add\" | \"remove\" | \"replace\";\n\n/**\n * Represents a patch operation.\n */\nexport interface JsonPatch {\n /**\n * The patch operation.\n */\n op: JsonPatchOperation;\n\n /**\n * The path for the patch operation.\n */\n path: string;\n\n /**\n * The value to add or replace for the operation.\n */\n value?: string;\n}\n\n/**\n * Represents the types of push channels available for Notification Hubs.\n */\nexport type PushHandle = BrowserPushChannel | string;\n"]}
@@ -38,7 +38,7 @@ export function createBrowserNotification(notification) {
38
38
  * @param notification - A partial message used to create a message for Firebase.
39
39
  * @returns A newly created Firebase.
40
40
  */
41
- export function createFirebaseLegacyNotification(notification) {
41
+ export function createFcmLegacyNotification(notification) {
42
42
  return Object.assign(Object.assign({}, notification), { platform: "gcm", contentType: Constants.JSON_CONTENT_TYPE });
43
43
  }
44
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AA+CnD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiE;IAEjE,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAA+D;IAE/D,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiE;IAEjE,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,S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B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,YAAmE;IAEnE,MAAM,MAAM,mCACP,YAAY,KACf,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,gBAAgB,GACxC,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAE9D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,YAAmE;IAEnE,MAAM,MAAM,mCACP,YAAY,KACf,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAC3C,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;IAE5D,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Constants from \"../utils/constants.js\";\n\n/**\n * Represents a notification hub.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n\n /**\n * The platform for the push notification.\n */\n platform: string;\n\n /**\n * The content type for the push notification.\n */\n contentType: string;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(\n notification: Omit<AppleNotification, \"platform\" | \"contentType\">\n): AppleNotification {\n return {\n ...notification,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(\n notification: Omit<AdmNotification, \"platform\" | \"contentType\">\n): AdmNotification {\n return {\n ...notification,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(\n notification: Omit<BaiduNotification, \"platform\" | \"contentType\">\n): BaiduNotification {\n return {\n ...notification,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: Omit<BrowserNotification, \"platform\" | \"contentType\">\n): BrowserNotification {\n return {\n ...notification,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FirebaseLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase.\n */\nexport function createFirebaseLegacyNotification(\n notification: Omit<FirebaseLegacyNotification, \"platform\" | \"contentType\">\n): FirebaseLegacyNotification {\n return {\n ...notification,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: Omit<TemplateNotification, \"platform\" | \"contentType\">\n): TemplateNotification {\n return {\n ...notification,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"wns\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FirebaseLegacyNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AA+CnD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiE;IAEjE,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AAYD;;;;GA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AK,EACf,WAAW,EAAE,SAAS,CAAC,gBAAgB,GACxC,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAE9D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,YAAmE;IAEnE,MAAM,MAAM,mCACP,YAAY,KACf,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,gBAAgB,GACxC,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAE9D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,YAAmE;IAEnE,MAAM,MAAM,mCACP,YAAY,KACf,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAC3C,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IAED,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;IAE5D,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Constants from \"../utils/constants.js\";\n\n/**\n * Represents a notification hub.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n\n /**\n * The platform for the push notification.\n */\n platform: string;\n\n /**\n * The content type for the push notification.\n */\n contentType: string;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(\n notification: Omit<AppleNotification, \"platform\" | \"contentType\">\n): AppleNotification {\n return {\n ...notification,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(\n notification: Omit<AdmNotification, \"platform\" | \"contentType\">\n): AdmNotification {\n return {\n ...notification,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(\n notification: Omit<BaiduNotification, \"platform\" | \"contentType\">\n): BaiduNotification {\n return {\n ...notification,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: Omit<BrowserNotification, \"platform\" | \"contentType\">\n): BrowserNotification {\n return {\n ...notification,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FcmLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase.\n */\nexport function createFcmLegacyNotification(\n notification: Omit<FcmLegacyNotification, \"platform\" | \"contentType\">\n): FcmLegacyNotification {\n return {\n ...notification,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: Omit<TemplateNotification, \"platform\" | \"contentType\">\n): TemplateNotification {\n return {\n ...notification,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"wns\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: Omit<WindowsNotification, \"platform\" | \"contentType\">\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"wns\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FcmLegacyNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { createAdmNotification, createAppleNotification, createBaiduNotification, createFirebaseLegacyNotification, createWindowsBadgeNotification, } from "./notification.js";
3
+ import { createAdmNotification, createAppleNotification, createBaiduNotification, createFcmLegacyNotification, createWindowsBadgeNotification, } from "./notification.js";
4
4
  import { isDefined, isString } from "../utils/utils.js";
5
5
  import { stringifyXML } from "@azure/core-xml";
6
6
  function createAppleNativeAlert(nativeAlert) {
@@ -52,7 +52,7 @@ export function buildAppleNativeMessage(nativeMessage, additionalProperties) {
52
52
  headers: headers,
53
53
  });
54
54
  }
55
- function buildFirebaseLegacyNativePayload(nativeNotification) {
55
+ function buildFcmLegacyNativePayload(nativeNotification) {
56
56
  if (!isDefined(nativeNotification)) {
57
57
  return undefined;
58
58
  }
@@ -79,9 +79,9 @@ function buildFirebaseLegacyNativePayload(nativeNotification) {
79
79
  return notification;
80
80
  }
81
81
  /**
82
- * Creates a FirebaseLegacyNotification from a native Firebase payload.
82
+ * Creates a FcmLegacyNotification from a native Firebase payload.
83
83
  * @param nativeMessage - The native message payload to send to Notification Hubs.
84
- * @returns The FirebaseLegacyNotification to send to Notification Hubs.
84
+ * @returns The FcmLegacyNotification to send to Notification Hubs.
85
85
  */
86
86
  export function buildFirebaseLegacyNativeMessage(nativeMessage) {
87
87
  const jsonMessage = {
@@ -96,9 +96,9 @@ export function buildFirebaseLegacyNativeMessage(nativeMessage) {
96
96
  restricted_package_name: nativeMessage.restrictedPackageName,
97
97
  dry_run: nativeMessage.dryRun,
98
98
  data: nativeMessage.data,
99
- notification: buildFirebaseLegacyNativePayload(nativeMessage.notification),
99
+ notification: buildFcmLegacyNativePayload(nativeMessage.notification),
100
100
  };
101
- return createFirebaseLegacyNotification({
101
+ return createFcmLegacyNotification({
102
102
  body: JSON.stringify(jsonMessage),
103
103
  });
104
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notificationBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,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AAU,EACrC,YAAY,EAAE,aAAa,CAAC,WAAW,EACvC,GAAG,EAAE,aAAa,CAAC,GAAG,EACtB,WAAW,EAAE,aAAa,CAAC,UAAU,EACrC,WAAW,EAAE,aAAa,CAAC,UAAU,EACrC,cAAc,EAAE,aAAa,CAAC,aAAa,EAC3C,GAAG,EAAE,aAAa,CAAC,GAAG,IACnB,oBAAoB,CACxB,CAAC;IAEF,OAAO,uBAAuB,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AA8BD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,8BAA8B,CAAC;QACpC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmNotification,\n AppleNotification,\n BaiduNotification,\n FirebaseLegacyNotification,\n WindowsNotification,\n createAdmNotification,\n createAppleNotification,\n createBaiduNotification,\n createFirebaseLegacyNotification,\n createWindowsBadgeNotification,\n} from \"./notification.js\";\nimport { isDefined, isString } from \"../utils/utils.js\";\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n launchImage?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n titleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n titleLocArgs?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n subtitleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n subtitleLocArgs?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n locKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n locArgs?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n threadId?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n targetContentId?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n interruptionLevel?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n relevanceScore?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n filterCriteria?: string;\n}\n\nfunction createAppleNativeAlert(\n nativeAlert?: string | AppleAlert\n): Record<string, any> | string | undefined {\n if (!isDefined(nativeAlert)) {\n return undefined;\n }\n\n if (isString(nativeAlert)) {\n return nativeAlert;\n }\n\n const alert: Record<string, any> = {\n title: nativeAlert.title,\n subtitle: nativeAlert.subtitle,\n body: nativeAlert.body,\n \"launch-image\": nativeAlert.launchImage,\n \"title-loc-key\": nativeAlert.titleLocKey,\n \"title-loc-args\": nativeAlert.titleLocArgs,\n \"subtitle-loc-key\": nativeAlert.subtitleLocKey,\n \"subtitle-loc-args\": nativeAlert.subtitleLocArgs,\n \"loc-key\": nativeAlert.locKey,\n \"loc-args\": nativeAlert.locArgs,\n };\n\n return alert;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function buildAppleNativeMessage(\n nativeMessage: AppleNativeMessage,\n additionalProperties?: Record<string, any>\n): AppleNotification {\n const headers: Record<string, string> = {};\n\n const message: Record<string, any> = {\n aps: {\n alert: createAppleNativeAlert(nativeMessage.alert),\n sound: nativeMessage.sound,\n badge: nativeMessage.badge,\n \"thread-id\": nativeMessage.threadId,\n category: nativeMessage.category,\n \"content-available\": nativeMessage.contentAvailable,\n \"mutable-content\": nativeMessage.mutableContent,\n \"target-content-id\": nativeMessage.targetContentId,\n \"interruption-level\": nativeMessage.interruptionLevel,\n \"relevance-score\": nativeMessage.relevanceScore,\n \"filter-criteria\": nativeMessage.filterCriteria,\n },\n ...additionalProperties,\n };\n\n const apnsPriority = nativeMessage?.contentAvailable === 1 ? \"5\" : \"10\";\n headers[\"apns-priority\"] = apnsPriority;\n\n return createAppleNotification({\n body: JSON.stringify(message),\n headers: headers,\n });\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registrationIds?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapseKey?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n timeToLive?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restrictedPackageName?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dryRun?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n clickAction?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n androidChannelId?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n}\n\nfunction buildFirebaseLegacyNativePayload(\n nativeNotification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n const androidMessage = nativeNotification as FirebaseLegacyAndroidNativePayload;\n const appleMessage = nativeNotification as FirebaseLegacyAppleNativePayload;\n\n const notification: Record<string, any> = {\n title: nativeNotification.title,\n body: nativeNotification.body,\n click_action: nativeNotification.clickAction,\n\n // Apple/Android fields\n sound: appleMessage.sound,\n badge: appleMessage.badge,\n subtitle: appleMessage.subtitle,\n body_loc_key: appleMessage.bodyLocKey,\n body_loc_args: appleMessage.bodyLocArgs,\n title_loc_key: appleMessage.bodyLocKey,\n title_loc_args: appleMessage.bodyLocArgs,\n\n // Android/Web fields\n android_channel_id: androidMessage.androidChannelId,\n icon: androidMessage.icon,\n tag: androidMessage.tag,\n color: androidMessage.color,\n };\n\n return notification;\n}\n\n/**\n * Creates a FirebaseLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The FirebaseLegacyNotification to send to Notification Hubs.\n */\nexport function buildFirebaseLegacyNativeMessage(\n nativeMessage: FirebaseLegacyNativeMessage\n): FirebaseLegacyNotification {\n const jsonMessage: Record<string, any> = {\n to: nativeMessage.to,\n registration_ids: nativeMessage.registrationIds,\n condition: nativeMessage.condition,\n collapse_key: nativeMessage.collapseKey,\n priority: nativeMessage.priority,\n content_available: nativeMessage.contentAvailable,\n mutable_content: nativeMessage.mutableContent,\n time_to_live: nativeMessage.timeToLive,\n restricted_package_name: nativeMessage.restrictedPackageName,\n dry_run: nativeMessage.dryRun,\n data: nativeMessage.data,\n notification: buildFirebaseLegacyNativePayload(nativeMessage.notification),\n };\n\n return createFirebaseLegacyNotification({\n body: JSON.stringify(jsonMessage),\n });\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n\n /**\n * The notification's channel id.\n */\n channelId?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n eventTime?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n localOnly?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notificationPriority?: number; // TODO: Enum?\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n defaultSound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number; // TODO: Enum?\n\n /**\n * Sets the number of items this notification represents.\n */\n notificationCount?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\nfunction buildAdmNativeNotification(\n nativeNotification?: AdmNativeNotification\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n return {\n title: nativeNotification.title,\n body: nativeNotification.body,\n icon: nativeNotification.icon,\n color: nativeNotification.color,\n sound: nativeNotification.sound,\n tag: nativeNotification.tag,\n click_action: nativeNotification.clickAction,\n body_loc_key: nativeNotification.bodyLocKey,\n body_loc_args: nativeNotification.bodyLocArgs,\n title_loc_key: nativeNotification.titleLocKey,\n title_loc_args: nativeNotification.titleLocArgs,\n channel_id: nativeNotification.channelId,\n ticker: nativeNotification.ticker,\n sticky: nativeNotification.sticky,\n event_time: nativeNotification.eventTime,\n local_only: nativeNotification.localOnly,\n notification_priority: nativeNotification.notificationPriority,\n default_sound: nativeNotification.defaultSound,\n visibility: nativeNotification.visibility,\n notification_count: nativeNotification.notificationCount,\n image: nativeNotification.image,\n };\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function buildAdmNativeMessage(nativeMessage: AdmNativeMessage): AdmNotification {\n const jsonObj: Record<string, any> = {\n notification: buildAdmNativeNotification(nativeMessage.notification),\n data: nativeMessage.data || {},\n ...nativeMessage,\n };\n\n return createAdmNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notificationBuilderId?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notificationBasicStyle?: number;\n\n /**\n * Baidu Android open type.\n */\n openType?: number;\n\n /**\n * Baidu Android net support option.\n */\n netSupport?: number;\n\n /**\n * Baidu Android user confirm.\n */\n userConfirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkgContent?: string;\n\n /**\n * Baidu Android package version.\n */\n pkgVersion?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n customContent?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @param additionalProperties - Additional properties for Apple Baidu messages.\n * @returns The BaiduNotification to send to Notification Hubs.\n */\nexport function buildBaiduNativeMessage(\n nativeMessage: BaiduNativeMessage,\n additionalProperties?: Record<string, any>\n): BaiduNotification {\n const jsonObj: Record<string, any> = {\n title: nativeMessage.title,\n description: nativeMessage.description,\n notification_builder_id: nativeMessage.notificationBuilderId,\n notification_basic_style: nativeMessage.notificationBasicStyle,\n open_type: nativeMessage.openType,\n net_support: nativeMessage.netSupport,\n user_confirm: nativeMessage.userConfirm,\n url: nativeMessage.url,\n pkg_content: nativeMessage.pkgContent,\n pkg_version: nativeMessage.pkgVersion,\n custom_content: nativeMessage.customContent,\n aps: nativeMessage.aps,\n ...additionalProperties,\n };\n\n return createBaiduNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns A WindowsNotification created with the badge information.\n */\nexport function buildWindowsBadgeNativeMessage(\n nativeMessage: WindowsBadgeNativeMessage\n): WindowsNotification {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return createWindowsBadgeNotification({\n body: stringifyXML(badge, { rootName: \"badge\" }),\n });\n}\n"]}
1
+ {"version":3,"file":"notificationBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAML,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAA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AAE,aAAa,CAAC,aAAa,EAC3C,GAAG,EAAE,aAAa,CAAC,GAAG,IACnB,oBAAoB,CACxB,CAAC;IAEF,OAAO,uBAAuB,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AA8BD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,8BAA8B,CAAC;QACpC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmNotification,\n AppleNotification,\n BaiduNotification,\n FcmLegacyNotification,\n WindowsNotification,\n createAdmNotification,\n createAppleNotification,\n createBaiduNotification,\n createFcmLegacyNotification,\n createWindowsBadgeNotification,\n} from \"./notification.js\";\nimport { isDefined, isString } from \"../utils/utils.js\";\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n launchImage?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n titleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n titleLocArgs?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n subtitleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n subtitleLocArgs?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n locKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n locArgs?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n threadId?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n targetContentId?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n interruptionLevel?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n relevanceScore?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n filterCriteria?: string;\n}\n\nfunction createAppleNativeAlert(\n nativeAlert?: string | AppleAlert\n): Record<string, any> | string | undefined {\n if (!isDefined(nativeAlert)) {\n return undefined;\n }\n\n if (isString(nativeAlert)) {\n return nativeAlert;\n }\n\n const alert: Record<string, any> = {\n title: nativeAlert.title,\n subtitle: nativeAlert.subtitle,\n body: nativeAlert.body,\n \"launch-image\": nativeAlert.launchImage,\n \"title-loc-key\": nativeAlert.titleLocKey,\n \"title-loc-args\": nativeAlert.titleLocArgs,\n \"subtitle-loc-key\": nativeAlert.subtitleLocKey,\n \"subtitle-loc-args\": nativeAlert.subtitleLocArgs,\n \"loc-key\": nativeAlert.locKey,\n \"loc-args\": nativeAlert.locArgs,\n };\n\n return alert;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function buildAppleNativeMessage(\n nativeMessage: AppleNativeMessage,\n additionalProperties?: Record<string, any>\n): AppleNotification {\n const headers: Record<string, string> = {};\n\n const message: Record<string, any> = {\n aps: {\n alert: createAppleNativeAlert(nativeMessage.alert),\n sound: nativeMessage.sound,\n badge: nativeMessage.badge,\n \"thread-id\": nativeMessage.threadId,\n category: nativeMessage.category,\n \"content-available\": nativeMessage.contentAvailable,\n \"mutable-content\": nativeMessage.mutableContent,\n \"target-content-id\": nativeMessage.targetContentId,\n \"interruption-level\": nativeMessage.interruptionLevel,\n \"relevance-score\": nativeMessage.relevanceScore,\n \"filter-criteria\": nativeMessage.filterCriteria,\n },\n ...additionalProperties,\n };\n\n const apnsPriority = nativeMessage?.contentAvailable === 1 ? \"5\" : \"10\";\n headers[\"apns-priority\"] = apnsPriority;\n\n return createAppleNotification({\n body: JSON.stringify(message),\n headers: headers,\n });\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registrationIds?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapseKey?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n timeToLive?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restrictedPackageName?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dryRun?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n clickAction?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n androidChannelId?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n}\n\nfunction buildFcmLegacyNativePayload(\n nativeNotification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n const androidMessage = nativeNotification as FirebaseLegacyAndroidNativePayload;\n const appleMessage = nativeNotification as FirebaseLegacyAppleNativePayload;\n\n const notification: Record<string, any> = {\n title: nativeNotification.title,\n body: nativeNotification.body,\n click_action: nativeNotification.clickAction,\n\n // Apple/Android fields\n sound: appleMessage.sound,\n badge: appleMessage.badge,\n subtitle: appleMessage.subtitle,\n body_loc_key: appleMessage.bodyLocKey,\n body_loc_args: appleMessage.bodyLocArgs,\n title_loc_key: appleMessage.bodyLocKey,\n title_loc_args: appleMessage.bodyLocArgs,\n\n // Android/Web fields\n android_channel_id: androidMessage.androidChannelId,\n icon: androidMessage.icon,\n tag: androidMessage.tag,\n color: androidMessage.color,\n };\n\n return notification;\n}\n\n/**\n * Creates a FcmLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The FcmLegacyNotification to send to Notification Hubs.\n */\nexport function buildFirebaseLegacyNativeMessage(\n nativeMessage: FirebaseLegacyNativeMessage\n): FcmLegacyNotification {\n const jsonMessage: Record<string, any> = {\n to: nativeMessage.to,\n registration_ids: nativeMessage.registrationIds,\n condition: nativeMessage.condition,\n collapse_key: nativeMessage.collapseKey,\n priority: nativeMessage.priority,\n content_available: nativeMessage.contentAvailable,\n mutable_content: nativeMessage.mutableContent,\n time_to_live: nativeMessage.timeToLive,\n restricted_package_name: nativeMessage.restrictedPackageName,\n dry_run: nativeMessage.dryRun,\n data: nativeMessage.data,\n notification: buildFcmLegacyNativePayload(nativeMessage.notification),\n };\n\n return createFcmLegacyNotification({\n body: JSON.stringify(jsonMessage),\n });\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n\n /**\n * The notification's channel id.\n */\n channelId?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n eventTime?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n localOnly?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notificationPriority?: number; // TODO: Enum?\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n defaultSound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number; // TODO: Enum?\n\n /**\n * Sets the number of items this notification represents.\n */\n notificationCount?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\nfunction buildAdmNativeNotification(\n nativeNotification?: AdmNativeNotification\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n return {\n title: nativeNotification.title,\n body: nativeNotification.body,\n icon: nativeNotification.icon,\n color: nativeNotification.color,\n sound: nativeNotification.sound,\n tag: nativeNotification.tag,\n click_action: nativeNotification.clickAction,\n body_loc_key: nativeNotification.bodyLocKey,\n body_loc_args: nativeNotification.bodyLocArgs,\n title_loc_key: nativeNotification.titleLocKey,\n title_loc_args: nativeNotification.titleLocArgs,\n channel_id: nativeNotification.channelId,\n ticker: nativeNotification.ticker,\n sticky: nativeNotification.sticky,\n event_time: nativeNotification.eventTime,\n local_only: nativeNotification.localOnly,\n notification_priority: nativeNotification.notificationPriority,\n default_sound: nativeNotification.defaultSound,\n visibility: nativeNotification.visibility,\n notification_count: nativeNotification.notificationCount,\n image: nativeNotification.image,\n };\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function buildAdmNativeMessage(nativeMessage: AdmNativeMessage): AdmNotification {\n const jsonObj: Record<string, any> = {\n notification: buildAdmNativeNotification(nativeMessage.notification),\n data: nativeMessage.data || {},\n ...nativeMessage,\n };\n\n return createAdmNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notificationBuilderId?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notificationBasicStyle?: number;\n\n /**\n * Baidu Android open type.\n */\n openType?: number;\n\n /**\n * Baidu Android net support option.\n */\n netSupport?: number;\n\n /**\n * Baidu Android user confirm.\n */\n userConfirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkgContent?: string;\n\n /**\n * Baidu Android package version.\n */\n pkgVersion?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n customContent?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @param additionalProperties - Additional properties for Apple Baidu messages.\n * @returns The BaiduNotification to send to Notification Hubs.\n */\nexport function buildBaiduNativeMessage(\n nativeMessage: BaiduNativeMessage,\n additionalProperties?: Record<string, any>\n): BaiduNotification {\n const jsonObj: Record<string, any> = {\n title: nativeMessage.title,\n description: nativeMessage.description,\n notification_builder_id: nativeMessage.notificationBuilderId,\n notification_basic_style: nativeMessage.notificationBasicStyle,\n open_type: nativeMessage.openType,\n net_support: nativeMessage.netSupport,\n user_confirm: nativeMessage.userConfirm,\n url: nativeMessage.url,\n pkg_content: nativeMessage.pkgContent,\n pkg_version: nativeMessage.pkgVersion,\n custom_content: nativeMessage.customContent,\n aps: nativeMessage.aps,\n ...additionalProperties,\n };\n\n return createBaiduNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns A WindowsNotification created with the badge information.\n */\nexport function buildWindowsBadgeNativeMessage(\n nativeMessage: WindowsBadgeNativeMessage\n): WindowsNotification {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return createWindowsBadgeNotification({\n body: stringifyXML(badge, { rootName: \"badge\" }),\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"notificationDetails.js","sourceRoot":"","sources":["../../../src/models/notificationDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the notification outcome states.\n */\nexport type NotificationOutcomeState =\n | \"Enqueued\"\n | \"DetailedStateAvailable\"\n | \"Processing\"\n | \"Completed\"\n | \"Abandoned\"\n | \"Unknown\"\n | \"NoTargetFound\"\n | \"Cancelled\";\n\n/**\n * The per platform count per state.\n */\nexport interface NotificationOutcomeCollectionItem {\n /**\n * The state of the notification.\n */\n state: string;\n\n /**\n * The count of notifications per state.\n */\n count: number;\n}\n\n/**\n * Represents Notification details.\n */\nexport interface NotificationDetails {\n /**\n * The unique notification identifier.\n */\n notificationId?: string;\n\n /**\n * The notification location.\n */\n location?: string;\n\n /**\n * The notification state.\n */\n state?: NotificationOutcomeState;\n\n /**\n * The enqueue time of the notification.\n */\n enqueueTime?: Date;\n\n /**\n * The notification send start time.\n */\n startTime?: Date;\n\n /**\n * The notification send end time.\n */\n endTime?: Date;\n\n /**\n * The notification body.\n */\n notificationBody?: string;\n\n /**\n * The notification tags.\n */\n tags?: string;\n\n /**\n * The notification platforms targeted.\n */\n targetPlatforms?: string;\n\n /**\n * The URL for the platform notification services errors.\n */\n pnsErrorDetailsUrl?: string;\n\n /**\n * APNs outcomes counts per state.\n */\n apnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * WNS outcomes counts per state.\n */\n wnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * FCM outcome counts per state.\n */\n fcmOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * ADM outcome counts per state.\n */\n admOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Baidu outcome counts per state.\n */\n baiduOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Web Push outcome counts per state.\n */\n browserOutcomeCounts?: NotificationOutcomeCollectionItem[];\n}\n"]}
1
+ {"version":3,"file":"notificationDetails.js","sourceRoot":"","sources":["../../../src/models/notificationDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the notification outcome states.\n */\nexport type NotificationOutcomeState =\n | \"Enqueued\"\n | \"DetailedStateAvailable\"\n | \"Processing\"\n | \"Completed\"\n | \"Abandoned\"\n | \"Unknown\"\n | \"NoTargetFound\"\n | \"Cancelled\";\n\n/**\n * The per platform count per state.\n */\nexport interface NotificationOutcomeCollectionItem {\n /**\n * The state of the notification.\n */\n state: string;\n\n /**\n * The count of notifications per state.\n */\n count: number;\n}\n\n/**\n * Represents Notification details.\n */\nexport interface NotificationDetails {\n /**\n * The unique notification identifier.\n */\n notificationId?: string;\n\n /**\n * The notification location.\n */\n location?: string;\n\n /**\n * The notification state.\n */\n state?: NotificationOutcomeState;\n\n /**\n * The enqueue time of the notification.\n */\n enqueueTime?: Date;\n\n /**\n * The notification send start time.\n */\n startTime?: Date;\n\n /**\n * The notification send end time.\n */\n endTime?: Date;\n\n /**\n * The notification body.\n */\n notificationBody?: string;\n\n /**\n * The notification tags.\n */\n tags?: string;\n\n /**\n * The notification platforms targeted.\n */\n targetPlatforms?: string;\n\n /**\n * The URL for the platform notification services errors.\n */\n pnsErrorDetailsUrl?: string;\n\n /**\n * APNs outcomes counts per state.\n */\n apnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * WNS outcomes counts per state.\n */\n wnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * FCM outcome counts per state.\n */\n fcmOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * ADM outcome counts per state.\n */\n admOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Baidu outcome counts per state.\n */\n baiduOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Web Push outcome counts per state.\n */\n browserOutcomeCounts?: NotificationOutcomeCollectionItem[];\n}\n\n/**\n * Describes a response from the Notification Hubs which includes a tracking ID, correlation ID and location.\n */\nexport interface NotificationHubsResponse {\n /**\n * The Tracking ID of the operation.\n */\n trackingId?: string;\n\n /**\n * The correlation ID of the operation.\n */\n correlationId?: string;\n\n /**\n * The location of the operation.\n */\n location?: string;\n}\n\n/**\n * Represents the result of the registration.\n */\nexport interface RegistrationResult {\n /**\n * The application platform.\n */\n applicationPlatform: string;\n\n /**\n * The PNS handle.\n */\n pnsHandle: string;\n\n /**\n * The registration ID.\n */\n registrationId: string;\n\n /**\n * The outcome of the registration.\n */\n outcome: string;\n}\n\n/**\n * Describes a response from the Notification Hubs service for send operations.\n */\nexport interface NotificationHubsMessageResponse extends NotificationHubsResponse {\n /**\n * The notification ID from the operation. Note this is only available in Standard SKU and above.\n */\n notificationId?: string;\n\n /**\n * The number of devices that successfully received the notification.\n */\n success: number;\n\n /**\n * The number of devices that failed to receive a notification.\n */\n failure: number;\n\n /**\n * The list of notification outcome results for each device registered with the hub, to which this notification was sent.\n */\n results: RegistrationResult[];\n\n /**\n * The state of this notification outcome.\n */\n state: NotificationOutcomeState;\n}\n"]}
@@ -65,57 +65,21 @@ export function createBrowserTemplateRegistrationDescription(description) {
65
65
  return Object.assign(Object.assign({}, description), { type: "BrowserTemplate" });
66
66
  }
67
67
  /**
68
- * @deprecated Use createFcmRegistrationDescription instead.
69
- * Creates a GCM registration description.
68
+ * Creates a Firebase Legacy registration description.
70
69
  * @param description - A partial GCM registration description.
71
70
  * @returns A created GCM registration description.
72
71
  */
73
- export function createGcmRegistrationDescription(description) {
72
+ export function createFcmLegacyRegistrationDescription(description) {
74
73
  return Object.assign(Object.assign({}, description), { type: "Gcm" });
75
74
  }
76
75
  /**
77
- * @deprecated Use createFcmTemplateRegistrationDescription instead.
78
76
  * Creates a GCM template registration description.
79
77
  * @param description - A partial GCM template registration description.
80
78
  * @returns A created GCM template registration description.
81
79
  */
82
- export function createGcmTemplateRegistrationDescription(description) {
80
+ export function createFcmLegacyTemplateRegistrationDescription(description) {
83
81
  return Object.assign(Object.assign({}, description), { type: "GcmTemplate" });
84
82
  }
85
- /**
86
- * Creates an FCM registration description.
87
- * @param description - A partial FCM registration description.
88
- * @returns A created FCM registration description.
89
- */
90
- export function createFcmRegistrationDescription(description) {
91
- return Object.assign(Object.assign({}, description), { type: "Fcm" });
92
- }
93
- /**
94
- * Creates an FCM template registration description.
95
- * @param description - A partial FCM template registration description.
96
- * @returns A created FCM template registration description.
97
- */
98
- export function createFcmTemplateRegistrationDescription(description) {
99
- return Object.assign(Object.assign({}, description), { type: "FcmTemplate" });
100
- }
101
- /**
102
- * @deprecated Windows Phone is no longer supported.
103
- * Creates an MPNS registration description.
104
- * @param description - A partial MPNS registration description.
105
- * @returns A created MPNS registration description.
106
- */
107
- export function createMpnsRegistrationDescription(description) {
108
- return Object.assign(Object.assign({}, description), { type: "Mpns" });
109
- }
110
- /**
111
- * @deprecated Windows Phone is no longer supported.
112
- * Creates an MPNS template registration description.
113
- * @param description - A partial MPNS template registration description.
114
- * @returns A created MPNS template registration description.
115
- */
116
- export function createMpnsTemplateRegistrationDescription(description) {
117
- return Object.assign(Object.assign({}, description), { type: "MpnsTemplate" });
118
- }
119
83
  /**
120
84
  * Creates a Windows registration description.
121
85
  * @param description - A partial Windows registration description.
@@ -1 +1 @@
1
- {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwFlC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAAuD;IAEvD,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AAkCD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA+D;IAE/D,uCACK,WAAW,KACd,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAAuD;IAEvD,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA+D;IAE/D,uCACK,WAAW,KACd,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC;AA2BD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,uCACK,WAAW,KACd,IAAI,EAAE,SAAS,IACf;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAiE;IAEjE,uCACK,WAAW,KACd,IAAI,EAAE,iBAAiB,IACvB;AACJ,CAAC;AAkBD;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAgBD;;;;;GAKG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAkBD;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,WAAsD;IAEtD,uCACK,WAAW,KACd,IAAI,EAAE,MAAM,IACZ;AACJ,CAAC;AAoBD;;;;;GAKG;AACH,MAAM,UAAU,yCAAyC,CACvD,WAA8D;IAE9D,uCACK,WAAW,KACd,IAAI,EAAE,cAAc,IACpB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,uCACK,WAAW,KACd,IAAI,EAAE,SAAS,IACf;AACJ,CAAC;AAmBD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAiE;IAEjE,uCACK,WAAW,KACd,IAAI,EAAE,iBAAiB,IACvB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the types of registration descriptions.\n */\nexport type RegistrationType =\n | \"Adm\"\n | \"AdmTemplate\"\n | \"Apple\"\n | \"AppleTemplate\"\n | \"Baidu\"\n | \"BaiduTemplate\"\n | \"Browser\"\n | \"BrowserTemplate\"\n | \"Gcm\"\n | \"GcmTemplate\"\n | \"Fcm\"\n | \"FcmTemplate\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Windows\"\n | \"WindowsTemplate\";\n\n/**\n * Represents a registration description.\n */\nexport interface RegistrationDescriptionCommon {\n /**\n * The registration ID.\n */\n registrationId?: string;\n\n /**\n * The expiration time of the registration.\n */\n expirationTime?: Date;\n\n /**\n * The ETag associated with this description.\n */\n etag?: string;\n\n /**\n * The tags associated with the registration.\n */\n tags?: string[];\n\n /**\n * A dictionary of push variables associated with property bag.\n */\n pushVariables?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: RegistrationType;\n}\n\n/**\n * Represents the description of a template registration.\n */\nexport interface TemplateRegistrationDescription {\n /**\n * The body template.\n */\n bodyTemplate: string;\n\n /**\n * The name of the template.\n */\n templateName?: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Adm\";\n}\n\n/**\n * Creates an ADM registration description.\n * @param description - A partial ADM registration description.\n * @returns A created ADM registration description.\n */\nexport function createAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n): AdmRegistrationDescription {\n return {\n ...description,\n type: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends Omit<AdmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"AdmTemplate\";\n}\n\n/**\n * Creates an ADM template registration description.\n * @param description - A partial ADM template registration description.\n * @returns A created ADM template registration description.\n */\nexport function createAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n\n /**\n * The type of the registration.\n */\n type: \"Apple\";\n}\n\n/**\n * Creates an Apple registration description.\n * @param description - A partial Apple registration description.\n * @returns A created Apple registration description.\n */\nexport function createAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n): AppleRegistrationDescription {\n return {\n ...description,\n type: \"Apple\",\n };\n}\n\n/**\n * The priority of the Apple push notification.\n */\nexport type ApplePriority = \"10\" | \"5\";\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends Omit<AppleRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: ApplePriority;\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"AppleTemplate\";\n}\n\n/**\n * Creates an Apple template registration description.\n * @param description - A partial Apple template registration description.\n * @returns A created Apple template registration description.\n */\nexport function createAppleTemplateRegistrationDescription(\n description: Omit<AppleTemplateRegistrationDescription, \"type\">\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AppleTemplate\",\n };\n}\n\n/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Baidu user identifier.\n */\n baiduUserId: string;\n\n /**\n * The Baidu channel identifier.\n */\n baiduChannelId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Baidu\";\n}\n\n/**\n * Creates a Baidu registration description.\n * @param description - A partial Baidu registration description.\n * @returns A created Baidu registration description.\n */\nexport function createBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n): BaiduRegistrationDescription {\n return {\n ...description,\n type: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends Omit<BaiduRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BaiduTemplate\";\n}\n\n/**\n * Creates a Baidu template registration description.\n * @param description - A partial Baidu template registration description.\n * @returns A created Baidu template registration description.\n */\nexport function createBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Browser push endpoint.\n */\n endpoint: string;\n\n /**\n * The Browser push P256DH.\n */\n p256dh: string;\n\n /**\n * The Browser push auth secret.\n */\n auth: string;\n\n /**\n * The type of the registration.\n */\n type: \"Browser\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push registration description.\n * @returns A created Web Push registration description.\n */\nexport function createBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n): BrowserRegistrationDescription {\n return {\n ...description,\n type: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends Omit<BrowserRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BrowserTemplate\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push template registration description.\n * @returns A created Web Push template registration description.\n */\nexport function createBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n * @deprecated Use FcmRegistrationDescription instead.\n */\nexport interface GcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Gcm\";\n}\n\n/**\n * @deprecated Use createFcmRegistrationDescription instead.\n * Creates a GCM registration description.\n * @param description - A partial GCM registration description.\n * @returns A created GCM registration description.\n */\nexport function createGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n): GcmRegistrationDescription {\n return {\n ...description,\n type: \"Gcm\",\n };\n}\n\n/**\n * @deprecated Use createFcmTemplateRegistrationDescription instead.\n * Represents Notification Hub template registration description for Google Cloud Messaging.\n * @deprecated Use FcmTemplateRegistrationDescription instead\n */\nexport interface GcmTemplateRegistrationDescription\n extends Omit<GcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"GcmTemplate\";\n}\n\n/**\n * @deprecated Use createFcmTemplateRegistrationDescription instead.\n * Creates a GCM template registration description.\n * @param description - A partial GCM template registration description.\n * @returns A created GCM template registration description.\n */\nexport function createGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Firebase Legacy HTTP API.\n */\nexport interface FcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n fcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Fcm\";\n}\n\n/**\n * Creates an FCM registration description.\n * @param description - A partial FCM registration description.\n * @returns A created FCM registration description.\n */\nexport function createFcmRegistrationDescription(\n description: Omit<FcmRegistrationDescription, \"type\">\n): FcmRegistrationDescription {\n return {\n ...description,\n type: \"Fcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy HTTP API.\n */\nexport interface FcmTemplateRegistrationDescription\n extends Omit<FcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"FcmTemplate\";\n}\n\n/**\n * Creates an FCM template registration description.\n * @param description - A partial FCM template registration description.\n * @returns A created FCM template registration description.\n */\nexport function createFcmTemplateRegistrationDescription(\n description: Omit<FcmTemplateRegistrationDescription, \"type\">\n): FcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"FcmTemplate\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Mpns\";\n}\n\n/**\n * @deprecated Windows Phone is no longer supported.\n * Creates an MPNS registration description.\n * @param description - A partial MPNS registration description.\n * @returns A created MPNS registration description.\n */\nexport function createMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"type\">\n): MpnsRegistrationDescription {\n return {\n ...description,\n type: \"Mpns\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescription\n extends Omit<MpnsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"MpnsTemplate\";\n}\n\n/**\n * @deprecated Windows Phone is no longer supported.\n * Creates an MPNS template registration description.\n * @param description - A partial MPNS template registration description.\n * @returns A created MPNS template registration description.\n */\nexport function createMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"type\">\n): MpnsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"MpnsTemplate\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Windows\";\n}\n\n/**\n * Creates a Windows registration description.\n * @param description - A partial Windows registration description.\n * @returns A created Windows registration description.\n */\nexport function createWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n): WindowsRegistrationDescription {\n return {\n ...description,\n type: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends Omit<WindowsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"WindowsTemplate\";\n}\n\n/**\n * Creates a Windows template registration description.\n * @param description - A partial Windows template registration description.\n * @returns A created Windows template registration description.\n */\nexport function createWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"WindowsTemplate\",\n };\n}\n\n/**\n * Describes the types of registration descriptions.\n */\nexport type RegistrationDescription =\n | AdmRegistrationDescription\n | AdmTemplateRegistrationDescription\n | AppleRegistrationDescription\n | AppleTemplateRegistrationDescription\n | BaiduRegistrationDescription\n | BaiduTemplateRegistrationDescription\n | BrowserRegistrationDescription\n | BrowserTemplateRegistrationDescription\n | GcmRegistrationDescription\n | GcmTemplateRegistrationDescription\n | FcmRegistrationDescription\n | FcmTemplateRegistrationDescription\n | MpnsRegistrationDescription\n | MpnsTemplateRegistrationDescription\n | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n"]}
1
+ {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsFlC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D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) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the types of registration descriptions.\n */\nexport type RegistrationType =\n | \"Adm\"\n | \"AdmTemplate\"\n | \"Apple\"\n | \"AppleTemplate\"\n | \"Baidu\"\n | \"BaiduTemplate\"\n | \"Browser\"\n | \"BrowserTemplate\"\n | \"Gcm\"\n | \"GcmTemplate\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Windows\"\n | \"WindowsTemplate\";\n\n/**\n * Represents a registration description.\n */\nexport interface RegistrationDescriptionCommon {\n /**\n * The registration ID.\n */\n registrationId?: string;\n\n /**\n * The expiration time of the registration.\n */\n expirationTime?: Date;\n\n /**\n * The ETag associated with this description.\n */\n etag?: string;\n\n /**\n * The tags associated with the registration.\n */\n tags?: string[];\n\n /**\n * A dictionary of push variables associated with property bag.\n */\n pushVariables?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: RegistrationType;\n}\n\n/**\n * Represents the description of a template registration.\n */\nexport interface TemplateRegistrationDescription {\n /**\n * The body template.\n */\n bodyTemplate: string;\n\n /**\n * The name of the template.\n */\n templateName?: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Adm\";\n}\n\n/**\n * Creates an ADM registration description.\n * @param description - A partial ADM registration description.\n * @returns A created ADM registration description.\n */\nexport function createAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n): AdmRegistrationDescription {\n return {\n ...description,\n type: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends Omit<AdmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"AdmTemplate\";\n}\n\n/**\n * Creates an ADM template registration description.\n * @param description - A partial ADM template registration description.\n * @returns A created ADM template registration description.\n */\nexport function createAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n\n /**\n * The type of the registration.\n */\n type: \"Apple\";\n}\n\n/**\n * Creates an Apple registration description.\n * @param description - A partial Apple registration description.\n * @returns A created Apple registration description.\n */\nexport function createAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n): AppleRegistrationDescription {\n return {\n ...description,\n type: \"Apple\",\n };\n}\n\n/**\n * The priority of the Apple push notification.\n */\nexport type ApplePriority = \"10\" | \"5\";\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends Omit<AppleRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: ApplePriority;\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"AppleTemplate\";\n}\n\n/**\n * Creates an Apple template registration description.\n * @param description - A partial Apple template registration description.\n * @returns A created Apple template registration description.\n */\nexport function createAppleTemplateRegistrationDescription(\n description: Omit<AppleTemplateRegistrationDescription, \"type\">\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AppleTemplate\",\n };\n}\n\n/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Baidu user identifier.\n */\n baiduUserId: string;\n\n /**\n * The Baidu channel identifier.\n */\n baiduChannelId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Baidu\";\n}\n\n/**\n * Creates a Baidu registration description.\n * @param description - A partial Baidu registration description.\n * @returns A created Baidu registration description.\n */\nexport function createBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n): BaiduRegistrationDescription {\n return {\n ...description,\n type: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends Omit<BaiduRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BaiduTemplate\";\n}\n\n/**\n * Creates a Baidu template registration description.\n * @param description - A partial Baidu template registration description.\n * @returns A created Baidu template registration description.\n */\nexport function createBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Browser push endpoint.\n */\n endpoint: string;\n\n /**\n * The Browser push P256DH.\n */\n p256dh: string;\n\n /**\n * The Browser push auth secret.\n */\n auth: string;\n\n /**\n * The type of the registration.\n */\n type: \"Browser\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push registration description.\n * @returns A created Web Push registration description.\n */\nexport function createBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n): BrowserRegistrationDescription {\n return {\n ...description,\n type: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends Omit<BrowserRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BrowserTemplate\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push template registration description.\n * @returns A created Web Push template registration description.\n */\nexport function createBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Gcm\";\n}\n\n/**\n * Creates a Firebase Legacy registration description.\n * @param description - A partial GCM registration description.\n * @returns A created GCM registration description.\n */\nexport function createFcmLegacyRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n): GcmRegistrationDescription {\n return {\n ...description,\n type: \"Gcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescription\n extends Omit<GcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"GcmTemplate\";\n}\n\n/**\n * Creates a GCM template registration description.\n * @param description - A partial GCM template registration description.\n * @returns A created GCM template registration description.\n */\nexport function createFcmLegacyTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Mpns\";\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescription\n extends Omit<MpnsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Windows\";\n}\n\n/**\n * Creates a Windows registration description.\n * @param description - A partial Windows registration description.\n * @returns A created Windows registration description.\n */\nexport function createWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n): WindowsRegistrationDescription {\n return {\n ...description,\n type: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends Omit<WindowsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"WindowsTemplate\";\n}\n\n/**\n * Creates a Windows template registration description.\n * @param description - A partial Windows template registration description.\n * @returns A created Windows template registration description.\n */\nexport function createWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"WindowsTemplate\",\n };\n}\n\n/**\n * Describes the types of registration descriptions.\n */\nexport type RegistrationDescription =\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 | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/models/response.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription } from \"./registration.js\";\n\n/**\n * Describes a response from the Notification Hubs which includes a tracking ID, correlation ID and location.\n */\nexport interface NotificationHubsResponse {\n /**\n * The Tracking ID of the operation.\n */\n trackingId?: string;\n\n /**\n * The correlation ID of the operation.\n */\n correlationId?: string;\n\n /**\n * The location of the operation.\n */\n location?: string;\n}\n\n/**\n * Describes a response from the Notification Hubs service for send operations.\n */\nexport interface NotificationHubsMessageResponse extends NotificationHubsResponse {\n /**\n * The notification ID from the operation. Note this is only available in Standard SKU and above.\n */\n notificationId?: string;\n}\n\n/**\n * Describes a registration query response with registrations and a continuation token.\n */\nexport interface RegistrationQueryResponse {\n /**\n * The list of registrations.\n */\n registrations: RegistrationDescription[];\n /**\n * A continuation token to get more results.\n */\n continuationToken?: string;\n}\n"]}
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/models/response.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription } from \"./registration.js\";\n\n/**\n * Describes a registration query response with registrations and a continuation token.\n */\nexport interface RegistrationQueryResponse {\n /**\n * The list of registrations.\n */\n registrations: RegistrationDescription[];\n /**\n * A continuation token to get more results.\n */\n continuationToken?: string;\n}\n"]}
@@ -140,8 +140,7 @@ export class NotificationHubsServiceClient {
140
140
  * Sends a direct push notification to a device with the given push handle.
141
141
  * @param pushHandle - The push handle which is the unique identifier for the device.
142
142
  * @param notification - The notification to send to the device.
143
- * @param options - Configuration options for the direct send operation which can contain custom headers
144
- * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
143
+ * @param options - The options for sending a direct notification.
145
144
  * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
146
145
  */
147
146
  sendDirectNotification(pushHandle, notification, options = {}) {