@azure/notification-hubs 1.2.4-alpha.20240527.1 → 1.2.4-alpha.20240530.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/browser/api/internal/_client.d.ts.map +1 -1
  2. package/dist/browser/api/internal/_client.js +1 -6
  3. package/dist/browser/api/internal/_client.js.map +1 -1
  4. package/dist/browser/utils/xmlUtils.d.ts.map +1 -1
  5. package/dist/browser/utils/xmlUtils.js +12 -4
  6. package/dist/browser/utils/xmlUtils.js.map +1 -1
  7. package/dist/commonjs/api/internal/_client.d.ts.map +1 -1
  8. package/dist/commonjs/api/internal/_client.js +1 -6
  9. package/dist/commonjs/api/internal/_client.js.map +1 -1
  10. package/dist/commonjs/auth/hmacSha256.js +2 -2
  11. package/dist/commonjs/auth/hmacSha256.js.map +1 -1
  12. package/dist/commonjs/tsdoc-metadata.json +1 -1
  13. package/dist/commonjs/utils/xmlUtils.d.ts.map +1 -1
  14. package/dist/commonjs/utils/xmlUtils.js +12 -4
  15. package/dist/commonjs/utils/xmlUtils.js.map +1 -1
  16. package/dist/esm/api/internal/_client.d.ts.map +1 -1
  17. package/dist/esm/api/internal/_client.js +1 -6
  18. package/dist/esm/api/internal/_client.js.map +1 -1
  19. package/dist/esm/auth/hmacSha256.js +1 -1
  20. package/dist/esm/auth/hmacSha256.js.map +1 -1
  21. package/dist/esm/utils/xmlUtils.d.ts.map +1 -1
  22. package/dist/esm/utils/xmlUtils.js +12 -4
  23. package/dist/esm/utils/xmlUtils.js.map +1 -1
  24. package/dist/react-native/api/internal/_client.d.ts.map +1 -1
  25. package/dist/react-native/api/internal/_client.js +1 -6
  26. package/dist/react-native/api/internal/_client.js.map +1 -1
  27. package/dist/react-native/auth/hmacSha256.js +1 -1
  28. package/dist/react-native/auth/hmacSha256.js.map +1 -1
  29. package/dist/react-native/utils/xmlUtils.d.ts.map +1 -1
  30. package/dist/react-native/utils/xmlUtils.js +12 -4
  31. package/dist/react-native/utils/xmlUtils.js.map +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAgC3B"}
1
+ {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4B3B"}
@@ -67,12 +67,7 @@ export async function sendRequest(context, request, successStatusCode) {
67
67
  const responseBody = response.bodyAsText;
68
68
  let details;
69
69
  if (isDefined(responseBody)) {
70
- try {
71
- details = await parseXMLError(responseBody);
72
- }
73
- catch (err) {
74
- // eslint-disable no-empty
75
- }
70
+ details = await parseXMLError(responseBody);
76
71
  }
77
72
  let errorMessage;
78
73
  if (isDefined(details)) {
@@ -1 +1 @@
1
- {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,UAAU,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,qBAAqB,+CACvB,OAAO,CAAC,cAAc,GAC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BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n try {\n details = await parseXMLError(responseBody);\n } catch (err) {\n // eslint-disable no-empty\n }\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
1
+ {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[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,EAAE,CAAC;QACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n details = await parseXMLError(responseBody);\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASjF"}
1
+ {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmBjF"}
@@ -90,11 +90,19 @@ export function serializeToAtomXmlRequest(resourceName, resource) {
90
90
  * @returns The notification details if any from the XML.
91
91
  */
92
92
  export async function parseXMLError(bodyText) {
93
+ if (!bodyText) {
94
+ return;
95
+ }
93
96
  let result;
94
- const xmlError = await parseXML(bodyText, { includeRoot: true });
95
- const detail = xmlError["Error"]["Detail"];
96
- if (isDefined(detail)) {
97
- return detail;
97
+ try {
98
+ const xmlError = await parseXML(bodyText, { includeRoot: true });
99
+ if (Object.hasOwnProperty.call(xmlError, "Error") &&
100
+ Object.hasOwnProperty.call(xmlError["Error"], "Detail")) {
101
+ return xmlError["Error"]["Detail"];
102
+ }
103
+ }
104
+ catch (err) {
105
+ // nothing to do
98
106
  }
99
107
  return result;
100
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,EAAE,CAAC,WAAW,CAAC;AAErD;;;GAGG;AACH,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CA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,WAAW,EAAE;QACjC,OAAO,EAAE,OAAO;KACjB,CAAC;IACF,cAAc,CAAC,mBAAmB,CAAC,GAAG;QACpC,KAAK,EAAE,6BAA6B;KACrC,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,IAAI,MAA0B,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n let result: string | undefined;\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n const detail = xmlError[\"Error\"][\"Detail\"];\n if (isDefined(detail)) {\n return detail;\n }\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M,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n if (!bodyText) {\n return;\n }\n\n let result: string | undefined;\n try {\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n if (\n Object.hasOwnProperty.call(xmlError, \"Error\") &&\n Object.hasOwnProperty.call(xmlError[\"Error\"], \"Detail\")\n ) {\n return xmlError[\"Error\"][\"Detail\"];\n }\n } catch (err) {\n // nothing to do\n }\n\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GA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,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4B3B"}
@@ -73,12 +73,7 @@ async function sendRequest(context, request, successStatusCode) {
73
73
  const responseBody = response.bodyAsText;
74
74
  let details;
75
75
  if ((0, utils_js_1.isDefined)(responseBody)) {
76
- try {
77
- details = await (0, xmlUtils_js_1.parseXMLError)(responseBody);
78
- }
79
- catch (err) {
80
- // eslint-disable no-empty
81
- }
76
+ details = await (0, xmlUtils_js_1.parseXMLError)(responseBody);
82
77
  }
83
78
  let errorMessage;
84
79
  if ((0, utils_js_1.isDefined)(details)) {
@@ -1 +1 @@
1
- {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,kEAOmC;AAOnC,mDAAiD;AACjD,yGAA8F;AAC9F,yDAAwD;AAExD,SAAgB,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,IAAA,0CAAqB,gDACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAdD,sCAcC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO;QACL,aAAa;QACb,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAVD,8DAUC;AAED;;;;GAI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B,iBAAoC;IAEpC,MAAM,QAAQ,GAAa,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACzD,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,IAAA,oBAAS,EAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC;gBACH,OAAO,GAAG,MAAM,IAAA,2BAAa,EAAC,YAAY,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,0BAA0B;YAC5B,CAAC;QACH,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,IAAA,oBAAS,EAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,8BAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AApCD,kCAoCC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n try {\n details = await parseXMLError(responseBody);\n } catch (err) {\n // eslint-disable no-empty\n }\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
1
+ {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,kEAOmC;AAOnC,mDAAiD;AACjD,yGAA8F;AAC9F,yDAAwD;AAExD,SAAgB,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,IAAA,0CAAqB,gDACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAdD,sCAcC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAA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cesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n details = await parseXMLError(responseBody);\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
@@ -3,9 +3,9 @@
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.signString = void 0;
6
- const crypto_1 = require("crypto");
6
+ const node_crypto_1 = require("node:crypto");
7
7
  async function signString(key, toSign) {
8
- const hmac = (0, crypto_1.createHmac)("sha256", key).update(toSign).digest("base64");
8
+ const hmac = (0, node_crypto_1.createHmac)("sha256", key).update(toSign).digest("base64");
9
9
  return encodeURIComponent(hmac);
10
10
  }
11
11
  exports.signString = signString;
@@ -1 +1 @@
1
- {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mCAAoC;AAE7B,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAHD,gCAGC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
1
+ {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,6CAAyC;AAElC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAHD,gCAGC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"node:crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.43.7"
8
+ "packageVersion": "7.45.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASjF"}
1
+ {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmBjF"}
@@ -96,11 +96,19 @@ exports.serializeToAtomXmlRequest = serializeToAtomXmlRequest;
96
96
  * @returns The notification details if any from the XML.
97
97
  */
98
98
  async function parseXMLError(bodyText) {
99
+ if (!bodyText) {
100
+ return;
101
+ }
99
102
  let result;
100
- const xmlError = await (0, core_xml_1.parseXML)(bodyText, { includeRoot: true });
101
- const detail = xmlError["Error"]["Detail"];
102
- if ((0, utils_js_1.isDefined)(detail)) {
103
- return detail;
103
+ try {
104
+ const xmlError = await (0, core_xml_1.parseXML)(bodyText, { includeRoot: true });
105
+ if (Object.hasOwnProperty.call(xmlError, "Error") &&
106
+ Object.hasOwnProperty.call(xmlError["Error"], "Detail")) {
107
+ return xmlError["Error"]["Detail"];
108
+ }
109
+ }
110
+ catch (err) {
111
+ // nothing to do
104
112
  }
105
113
  return result;
106
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,yCAAuC;AACvC,8CAA2C;AAE3C;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,EAAE,CAAC,WAAW,CAAC;AAErD;;;GAGG;AACH,6EAA6E;AAC7E,SAAgB,gBAAgB,CAAC,KAAU;IACzC,6EAA6E;IAC7E,uFAAuF;IAEvF,kFAAkF;IAClF,kFAAkF;IAClF,kFAAkF;IAClF,qDAAqD;IACrD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,kFAAkF;IAClF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,KAAK,6BAA6B,CAAC;AA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,IAAI,MAA0B,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,IAAA,oBAAS,EAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,sCASC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n let result: string | undefined;\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n const detail = xmlError[\"Error\"][\"Detail\"];\n if (isDefined(detail)) {\n return detail;\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,yCAAuC;AACvC,8CAA2C;AAE3C;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,GAA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AK,EAAE,qEAAqE;QAC5E,SAAS,EAAE,2CAA2C;KACvD,CAAC;IAEF,OAAO,CAAC,2BAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC3D,MAAM,cAAc,GAA4B;QAC9C,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACjC,OAAO,EAAE,OAAO;KACjB,CAAC;IACF,cAAc,CAAC,2BAAmB,CAAC,GAAG;QACpC,KAAK,EAAE,6BAA6B;KACrC,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC;AAvBD,8DAuBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,IAAI,MAA0B,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,IACE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC7C,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EACvD,CAAC;YACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAgB;IAClB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAnBD,sCAmBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n if (!bodyText) {\n return;\n }\n\n let result: string | undefined;\n try {\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n if (\n Object.hasOwnProperty.call(xmlError, \"Error\") &&\n Object.hasOwnProperty.call(xmlError[\"Error\"], \"Detail\")\n ) {\n return xmlError[\"Error\"][\"Detail\"];\n }\n } catch (err) {\n // nothing to do\n }\n\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAgC3B"}
1
+ {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4B3B"}
@@ -67,12 +67,7 @@ export async function sendRequest(context, request, successStatusCode) {
67
67
  const responseBody = response.bodyAsText;
68
68
  let details;
69
69
  if (isDefined(responseBody)) {
70
- try {
71
- details = await parseXMLError(responseBody);
72
- }
73
- catch (err) {
74
- // eslint-disable no-empty
75
- }
70
+ details = await parseXMLError(responseBody);
76
71
  }
77
72
  let errorMessage;
78
73
  if (isDefined(details)) {
@@ -1 +1 @@
1
- {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,UAAU,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,qBAAqB,+CACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO;QACL,aAAa;QACb,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,QAA0B;IAE1B,MAAM,MAAM,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,cAAkC,CAAC;IACvC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAA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,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC;gBACH,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,0BAA0B;YAC5B,CAAC;QACH,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n try {\n details = await parseXMLError(responseBody);\n } catch (err) {\n // eslint-disable no-empty\n }\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
1
+ {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,UAAU,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,qBAAqB,+CACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC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,cAAc,EACd,YAAY,EAAE,CAAC,EACf,YAAY,EAAE,CAAC,EACf,OAAO,EAAE,EAAE,EACX,KAAK,EAAE,UAAU,IACjB;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAsC,EACtC,OAAwB,EACxB,iBAAoC;IAEpC,MAAM,QAAQ,GAAa,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACzD,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n details = await parseXMLError(responseBody);\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { createHmac } from "crypto";
3
+ import { createHmac } from "node:crypto";
4
4
  export async function signString(key, toSign) {
5
5
  const hmac = createHmac("sha256", key).update(toSign).digest("base64");
6
6
  return encodeURIComponent(hmac);
@@ -1 +1 @@
1
- {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
1
+ {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"node:crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASjF"}
1
+ {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmBjF"}
@@ -90,11 +90,19 @@ export function serializeToAtomXmlRequest(resourceName, resource) {
90
90
  * @returns The notification details if any from the XML.
91
91
  */
92
92
  export async function parseXMLError(bodyText) {
93
+ if (!bodyText) {
94
+ return;
95
+ }
93
96
  let result;
94
- const xmlError = await parseXML(bodyText, { includeRoot: true });
95
- const detail = xmlError["Error"]["Detail"];
96
- if (isDefined(detail)) {
97
- return detail;
97
+ try {
98
+ const xmlError = await parseXML(bodyText, { includeRoot: true });
99
+ if (Object.hasOwnProperty.call(xmlError, "Error") &&
100
+ Object.hasOwnProperty.call(xmlError["Error"], "Detail")) {
101
+ return xmlError["Error"]["Detail"];
102
+ }
103
+ }
104
+ catch (err) {
105
+ // nothing to do
98
106
  }
99
107
  return result;
100
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,EAAE,CAAC,WAAW,CAAC;AAErD;;;GAGG;AACH,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,6EAA6E;IAC7E,uFAAuF;IAEvF,kFAAkF;IAClF,kFAAkF;IAClF,kFAAkF;IAClF,qDAAqD;IACrD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,kFAAkF;IAClF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,KAAK,6BAA6B,CAAC;AAC1F,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAgC;IACzE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,QAAQ;QAC9C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACnC,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,gBA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cesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n let result: string | undefined;\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n const detail = xmlError[\"Error\"][\"Detail\"];\n if (isDefined(detail)) {\n return detail;\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,EAAE,CAAC,WAAW,CAAC;AAErD;;;GAGG;AACH,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,6EAA6E;IAC7E,uFAAuF;IAEvF,kFAAkF;IAClF,kFAA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mBAAmB,CAAC,GAAG;QACpC,KAAK,EAAE,6BAA6B;KACrC,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,IAAI,MAA0B,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,IACE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC7C,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EACvD,CAAC;YACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAgB;IAClB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n if (!bodyText) {\n return;\n }\n\n let result: string | undefined;\n try {\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n if (\n Object.hasOwnProperty.call(xmlError, \"Error\") &&\n Object.hasOwnProperty.call(xmlError[\"Error\"], \"Detail\")\n ) {\n return xmlError[\"Error\"][\"Detail\"];\n }\n } catch (err) {\n // nothing to do\n }\n\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAgC3B"}
1
+ {"version":3,"file":"_client.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,eAAe,CASjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAwB1C;AAgBD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,6BAA6B,EACtC,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4B3B"}
@@ -67,12 +67,7 @@ export async function sendRequest(context, request, successStatusCode) {
67
67
  const responseBody = response.bodyAsText;
68
68
  let details;
69
69
  if (isDefined(responseBody)) {
70
- try {
71
- details = await parseXMLError(responseBody);
72
- }
73
- catch (err) {
74
- // eslint-disable no-empty
75
- }
70
+ details = await parseXMLError(responseBody);
76
71
  }
77
72
  let errorMessage;
78
73
  if (isDefined(details)) {
@@ -1 +1 @@
1
- {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,C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,CAAC;gBACH,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,0BAA0B;YAC5B,CAAC;QACH,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n try {\n details = await parseXMLError(responseBody);\n } catch (err) {\n // eslint-disable no-empty\n }\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
1
+ {"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,UAAU,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,qBAAqB,+CACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO;QACL,aAAa;QACb,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,QAA0B;IAE1B,MAAM,MAAM,GAAG,yBAAyB,CAAC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AAiB;QACnB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions,\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse,\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string,\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[],\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n details = await parseXMLError(responseBody);\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { createHmac } from "crypto";
3
+ import { createHmac } from "node:crypto";
4
4
  export async function signString(key, toSign) {
5
5
  const hmac = createHmac("sha256", key).update(toSign).digest("base64");
6
6
  return encodeURIComponent(hmac);
@@ -1 +1 @@
1
- {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
1
+ {"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createHmac } from \"node:crypto\";\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const hmac = createHmac(\"sha256\", key).update(toSign).digest(\"base64\");\n return encodeURIComponent(hmac);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASjF"}
1
+ {"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAQpC;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAcpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmBjF"}
@@ -90,11 +90,19 @@ export function serializeToAtomXmlRequest(resourceName, resource) {
90
90
  * @returns The notification details if any from the XML.
91
91
  */
92
92
  export async function parseXMLError(bodyText) {
93
+ if (!bodyText) {
94
+ return;
95
+ }
93
96
  let result;
94
- const xmlError = await parseXML(bodyText, { includeRoot: true });
95
- const detail = xmlError["Error"]["Detail"];
96
- if (isDefined(detail)) {
97
- return detail;
97
+ try {
98
+ const xmlError = await parseXML(bodyText, { includeRoot: true });
99
+ if (Object.hasOwnProperty.call(xmlError, "Error") &&
100
+ Object.hasOwnProperty.call(xmlError["Error"], "Detail")) {
101
+ return xmlError["Error"]["Detail"];
102
+ }
103
+ }
104
+ catch (err) {
105
+ // nothing to do
98
106
  }
99
107
  return result;
100
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"m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,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACpD,0BAA0B,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;IAElD,OAAO,CAAC,YAAY,CAAC,CAAC,mBAAmB,CAAC,GAAG;QAC3C,KAAK,EAAE,qEAAqE;QAC5E,SAAS,EAAE,2CAA2C;KACvD,CAAC;IAEF,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC3D,MAAM,cAAc,GAA4B;QAC9C,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACjC,OAAO,EAAE,OAAO;KACjB,CAAC;IACF,cAAc,CAAC,mBAAmB,CAAC,GAAG;QACpC,KAAK,EAAE,6BAA6B;KACrC,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,IAAI,MAA0B,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n let result: string | undefined;\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n const detail = xmlError[\"Error\"][\"Detail\"];\n if (isDefined(detail)) {\n return detail;\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../../src/utils/xmlUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,EAAE,CAAC,WAAW,CAAC;AAErD;;;GAGG;AACH,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,6EAA6E;IAC7E,uFAAuF;IAEvF,kFAAkF;IAClF,kFAAkF;IAClF,kFAAkF;IAClF,qDAAqD;IACrD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,kFAAkF;IAClF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,KAAK,6BAA6B,CAAC;AAC1F,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAAgC;IACzE,MAAM,CAAC,IAAI,CAAC,QAAQ,C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,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,IACE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC7C,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EACvD,CAAC;YACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAgB;IAClB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isDefined } from \"./utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @returns An object to be serialized into a string.\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Parses the XML message from a Notification Hubs response\n * @param bodyText - The HTTP response body.\n * @returns The notification details if any from the XML.\n */\nexport async function parseXMLError(bodyText: string): Promise<string | undefined> {\n if (!bodyText) {\n return;\n }\n\n let result: string | undefined;\n try {\n const xmlError = await parseXML(bodyText, { includeRoot: true });\n if (\n Object.hasOwnProperty.call(xmlError, \"Error\") &&\n Object.hasOwnProperty.call(xmlError[\"Error\"], \"Detail\")\n ) {\n return xmlError[\"Error\"][\"Detail\"];\n }\n } catch (err) {\n // nothing to do\n }\n\n return result;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/notification-hubs",
3
- "version": "1.2.4-alpha.20240527.1",
3
+ "version": "1.2.4-alpha.20240530.1",
4
4
  "description": "Azure Notification Hubs SDK for JavaScript",
5
5
  "sdk-type": "client",
6
6
  "main": "./dist/commonjs/index.js",