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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,7 +53,7 @@ This SDK for JavaScript offers two ways of interacting with Azure Notification H
53
53
 
54
54
  ```typescript
55
55
  import {
56
- NotificationHubsServiceClient
56
+ NotificationHubsClient,
57
57
  createAppleInstallation
58
58
  } from "@azure/notification-hubs";
59
59
 
@@ -81,6 +81,7 @@ The above code snippet then becomes the following:
81
81
 
82
82
  ```typescript
83
83
  import { createClientContext, createOrUpdateInstallation } from "@azure/notification-hubs/api";
84
+ import { createAppleInstallation } from "@azure/notification-hubs/models";
84
85
 
85
86
  const context = createClientContext("<connection string>", "<hub name>");
86
87
 
@@ -193,7 +194,7 @@ Using the modular approach, the code would be as follows:
193
194
 
194
195
  ```typescript
195
196
  import { createClientContext, updateInstallation } from "@azure/notification-hubs/api";
196
- import { JsonPatch, createAppleInstallation } from "@azure/notification-hubs/models";
197
+ import { JsonPatch } from "@azure/notification-hubs/models";
197
198
 
198
199
  const context = createClientContext("<connection string>", "<hub name>");
199
200
 
package/dist/index.cjs CHANGED
@@ -14,7 +14,7 @@ var uuid = require('uuid');
14
14
 
15
15
  // Copyright (c) Microsoft Corporation.
16
16
  // Licensed under the MIT license.
17
- const SDK_VERSION = "1.0.0-beta.7";
17
+ const SDK_VERSION = "1.0.0-beta.8";
18
18
  const JSON_CONTENT_TYPE = "application/json;charset=utf-8";
19
19
  const XML_CONTENT_TYPE = "application/xml";
20
20
  const STREAM_CONTENT_TYPE = "application/octet-stream";
@@ -771,6 +771,7 @@ const registrationDescriptionParser = {
771
771
  */
772
772
  async parseRegistrationEntry(bodyText) {
773
773
  const xml = await coreXml.parseXML(bodyText, { includeRoot: true });
774
+ delete xml.entry.content["$"];
774
775
  const keyName = Object.keys(xml.entry.content)[0];
775
776
  const content = xml.entry.content[keyName];
776
777
  const methodName = `create${keyName}`;
@@ -1190,6 +1191,13 @@ function createRegistrationId(context, options = {}) {
1190
1191
  const response = await sendRequest(context, request, 201);
1191
1192
  // In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>
1192
1193
  const locationHeader = response.headers.get("Location");
1194
+ if (!locationHeader || !locationHeader.startsWith("https://")) {
1195
+ throw new coreRestPipeline.RestError(`Location header ${locationHeader} is an invalid URL`, {
1196
+ statusCode: 500,
1197
+ request,
1198
+ response,
1199
+ });
1200
+ }
1193
1201
  const locationUrl = new URL(locationHeader);
1194
1202
  const registrationId = locationUrl.pathname.split("/")[3];
1195
1203
  return registrationId;
@@ -1320,6 +1328,7 @@ async function parseNotificationDetails(bodyText) {
1320
1328
  endTime: getDateOrUndefined(notificationDetails["EndTime"]),
1321
1329
  pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails["PnsErrorDetailsUri"]),
1322
1330
  targetPlatforms: getStringOrUndefined(notificationDetails["TargetPlatforms"]),
1331
+ notificationBody: getStringOrUndefined(notificationDetails["NotificationBody"]),
1323
1332
  apnsOutcomeCounts,
1324
1333
  admOutcomeCounts,
1325
1334
  baiduOutcomeCounts,