@azure/notification-hubs 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.js → index.cjs} +193 -52
- package/dist/index.cjs.map +1 -0
- package/dist-esm/src/{utils → auth}/connectionStringUtils.js +37 -1
- package/dist-esm/src/auth/connectionStringUtils.js.map +1 -0
- package/dist-esm/src/auth/hmacSha256.browser.js +11 -0
- package/dist-esm/src/auth/hmacSha256.browser.js.map +1 -0
- package/dist-esm/src/auth/hmacSha256.js +8 -0
- package/dist-esm/src/auth/hmacSha256.js.map +1 -0
- package/dist-esm/src/auth/sasTokenProvider.js +79 -0
- package/dist-esm/src/auth/sasTokenProvider.js.map +1 -0
- package/dist-esm/src/client/cancelScheduledNotification.js +3 -2
- package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -1
- package/dist-esm/src/client/createOrUpdateInstallation.js +3 -2
- package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -1
- package/dist-esm/src/client/createOrUpdateRegistration.js +2 -1
- package/dist-esm/src/client/createOrUpdateRegistration.js.map +1 -1
- package/dist-esm/src/client/createRegistration.js +2 -1
- package/dist-esm/src/client/createRegistration.js.map +1 -1
- package/dist-esm/src/client/createRegistrationId.js +3 -2
- package/dist-esm/src/client/createRegistrationId.js.map +1 -1
- package/dist-esm/src/client/deleteInstallation.js +3 -2
- package/dist-esm/src/client/deleteInstallation.js.map +1 -1
- package/dist-esm/src/client/deleteRegistration.js +3 -2
- package/dist-esm/src/client/deleteRegistration.js.map +1 -1
- package/dist-esm/src/client/getFeedbackContainerUrl.js +3 -2
- package/dist-esm/src/client/getFeedbackContainerUrl.js.map +1 -1
- package/dist-esm/src/client/getInstallation.js +3 -2
- package/dist-esm/src/client/getInstallation.js.map +1 -1
- package/dist-esm/src/client/getNotificationHubJob.js +3 -2
- package/dist-esm/src/client/getNotificationHubJob.js.map +1 -1
- package/dist-esm/src/client/getNotificationOutcomeDetails.js +3 -2
- package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +1 -1
- package/dist-esm/src/client/getRegistration.js +3 -2
- package/dist-esm/src/client/getRegistration.js.map +1 -1
- package/dist-esm/src/client/index.js +7 -3
- package/dist-esm/src/client/index.js.map +1 -1
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js +1 -1
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +1 -1
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js +3 -2
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -1
- package/dist-esm/src/client/internal/_sendNotificationPayload.js +1 -1
- package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -1
- package/dist-esm/src/client/listNotificationHubJobs.js +3 -2
- package/dist-esm/src/client/listNotificationHubJobs.js.map +1 -1
- package/dist-esm/src/client/listRegistrations.js +3 -2
- package/dist-esm/src/client/listRegistrations.js.map +1 -1
- package/dist-esm/src/client/listRegistrationsByTag.js +3 -2
- package/dist-esm/src/client/listRegistrationsByTag.js.map +1 -1
- package/dist-esm/src/client/submitNotificationHubJob.js +3 -2
- package/dist-esm/src/client/submitNotificationHubJob.js.map +1 -1
- package/dist-esm/src/client/updateInstallation.js +3 -2
- package/dist-esm/src/client/updateInstallation.js.map +1 -1
- package/dist-esm/src/client/updateRegistration.js +2 -1
- package/dist-esm/src/client/updateRegistration.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -0
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/dist-esm/src/utils/retryPolicy.js +2 -2
- package/dist-esm/src/utils/retryPolicy.js.map +1 -1
- package/dist-esm/src/utils/tracing.js +2 -1
- package/dist-esm/src/utils/tracing.js.map +1 -1
- package/package.json +15 -10
- package/types/src/{utils → auth}/connectionStringUtils.d.ts +7 -1
- package/types/src/auth/connectionStringUtils.d.ts.map +1 -0
- package/types/src/auth/hmacSha256.browser.d.ts +2 -0
- package/types/src/auth/hmacSha256.browser.d.ts.map +1 -0
- package/types/src/auth/hmacSha256.d.ts +2 -0
- package/types/src/auth/hmacSha256.d.ts.map +1 -0
- package/types/src/auth/sasTokenProvider.d.ts +57 -0
- package/types/src/auth/sasTokenProvider.d.ts.map +1 -0
- package/types/src/client/cancelScheduledNotification.d.ts.map +1 -1
- package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -1
- package/types/src/client/createOrUpdateRegistration.d.ts.map +1 -1
- package/types/src/client/createRegistration.d.ts.map +1 -1
- package/types/src/client/createRegistrationId.d.ts.map +1 -1
- package/types/src/client/deleteInstallation.d.ts.map +1 -1
- package/types/src/client/deleteRegistration.d.ts.map +1 -1
- package/types/src/client/getFeedbackContainerUrl.d.ts.map +1 -1
- package/types/src/client/getInstallation.d.ts.map +1 -1
- package/types/src/client/getNotificationHubJob.d.ts.map +1 -1
- package/types/src/client/getNotificationOutcomeDetails.d.ts.map +1 -1
- package/types/src/client/getRegistration.d.ts.map +1 -1
- package/types/src/client/index.d.ts +2 -2
- package/types/src/client/index.d.ts.map +1 -1
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -1
- package/types/src/client/listNotificationHubJobs.d.ts.map +1 -1
- package/types/src/client/listRegistrations.d.ts.map +1 -1
- package/types/src/client/listRegistrationsByTag.d.ts.map +1 -1
- package/types/src/client/submitNotificationHubJob.d.ts.map +1 -1
- package/types/src/client/updateInstallation.d.ts.map +1 -1
- package/types/src/client/updateRegistration.d.ts.map +1 -1
- package/types/src/utils/constants.d.ts +1 -0
- package/types/src/utils/constants.d.ts.map +1 -1
- package/types/src/utils/tracing.d.ts.map +1 -1
- package/dist/index.js.map +0 -1
- package/dist-esm/src/utils/connectionStringUtils.js.map +0 -1
- package/types/src/utils/connectionStringUtils.d.ts.map +0 -1
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { createSasTokenProvider
|
|
3
|
+
import { createSasTokenProvider } from "./sasTokenProvider.js";
|
|
4
|
+
/**
|
|
5
|
+
* Parses the connection string and returns an object of type T.
|
|
6
|
+
*
|
|
7
|
+
* Connection strings have the following syntax:
|
|
8
|
+
*
|
|
9
|
+
* ConnectionString ::= `Part { ";" Part } [ ";" ] [ WhiteSpace ]`
|
|
10
|
+
* Part ::= [ PartLiteral [ "=" PartLiteral ] ]
|
|
11
|
+
* PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ]
|
|
12
|
+
* Literal ::= ? any sequence of characters except ; or = or WhiteSpace ?
|
|
13
|
+
* WhiteSpace ::= ? all whitespace characters including `\r` and `\n` ?
|
|
14
|
+
*
|
|
15
|
+
* @param connectionString - The connection string to be parsed.
|
|
16
|
+
* @returns ParsedOutput<T>.
|
|
17
|
+
*/
|
|
18
|
+
function parseConnectionString(connectionString) {
|
|
19
|
+
const output = {};
|
|
20
|
+
const parts = connectionString.trim().split(";");
|
|
21
|
+
for (let part of parts) {
|
|
22
|
+
part = part.trim();
|
|
23
|
+
if (part === "") {
|
|
24
|
+
// parts can be empty
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const splitIndex = part.indexOf("=");
|
|
28
|
+
if (splitIndex === -1) {
|
|
29
|
+
throw new Error("Connection string malformed: each part of the connection string must have an `=` assignment.");
|
|
30
|
+
}
|
|
31
|
+
const key = part.substring(0, splitIndex).trim();
|
|
32
|
+
if (key === "") {
|
|
33
|
+
throw new Error("Connection string malformed: missing key for assignment");
|
|
34
|
+
}
|
|
35
|
+
const value = part.substring(splitIndex + 1).trim();
|
|
36
|
+
output[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return output;
|
|
39
|
+
}
|
|
4
40
|
/**
|
|
5
41
|
* Creates a SasTokenProvider from a shared access key and shared access key name.
|
|
6
42
|
* @param sharedAccessKey - The shared access key value.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/auth/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAOjF;;;;;;;;;;;;;GAaG;AACH,SAAS,qBAAqB,CAAI,gBAAwB;IACxD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjD,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEnB,IAAI,IAAI,KAAK,EAAE,EAAE;YACf,qBAAqB;YACrB,SAAS;SACV;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;SACH;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;QACjD,IAAI,GAAG,KAAK,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC5E;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEpD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACrB;IAED,OAAO,MAAa,CAAC;AACvB,CAAC;AAwBD;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,eAAuB,EACvB,mBAA2B;IAE3B,OAAO,sBAAsB,CAAC,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qCAAqC,CACnD,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAIvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;KACnE;IAED,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE;QACrE,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;KAC5F;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE;QAC5E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;KACH;IAED,MAAM,MAAM,GAA+C;QACzD,QAAQ,EAAE,YAAY,CAAC,QAAQ;QAC/B,eAAe,EAAE,YAAY,CAAC,eAAgB;QAC9C,mBAAmB,EAAE,YAAY,CAAC,mBAAoB;KACvD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { SasTokenProvider, createSasTokenProvider } from \"./sasTokenProvider.js\";\n\n/**\n * Defines an object with possible properties defined in T.\n */\nexport type ParsedOutput<T> = { [P in keyof T]: T[P] };\n\n/**\n * Parses the connection string and returns an object of type T.\n *\n * Connection strings have the following syntax:\n *\n * ConnectionString ::= `Part { \";\" Part } [ \";\" ] [ WhiteSpace ]`\n * Part ::= [ PartLiteral [ \"=\" PartLiteral ] ]\n * PartLiteral ::= [ WhiteSpace ] Literal [ WhiteSpace ]\n * Literal ::= ? any sequence of characters except ; or = or WhiteSpace ?\n * WhiteSpace ::= ? all whitespace characters including `\\r` and `\\n` ?\n *\n * @param connectionString - The connection string to be parsed.\n * @returns ParsedOutput<T>.\n */\nfunction parseConnectionString<T>(connectionString: string): ParsedOutput<T> {\n const output: { [k: string]: string } = {};\n const parts = connectionString.trim().split(\";\");\n\n for (let part of parts) {\n part = part.trim();\n\n if (part === \"\") {\n // parts can be empty\n continue;\n }\n\n const splitIndex = part.indexOf(\"=\");\n if (splitIndex === -1) {\n throw new Error(\n \"Connection string malformed: each part of the connection string must have an `=` assignment.\"\n );\n }\n\n const key = part.substring(0, splitIndex).trim();\n if (key === \"\") {\n throw new Error(\"Connection string malformed: missing key for assignment\");\n }\n\n const value = part.substring(splitIndex + 1).trim();\n\n output[key] = value;\n }\n\n return output as any;\n}\n\n/**\n * The set of properties that comprise a Notification Hubs connection string.\n */\nexport interface NotificationHubsConnectionStringProperties {\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName: string;\n}\n\n/**\n * Creates a SasTokenProvider from a shared access key and shared access key name.\n * @param sharedAccessKey - The shared access key value.\n * @param sharedAccessKeyName - The shared access key name.\n * @returns A SasTokenProvider with the given shared access token information.\n */\nexport function createTokenProviderFromConnection(\n sharedAccessKey: string,\n sharedAccessKeyName: string\n): SasTokenProvider {\n return createSasTokenProvider({ sharedAccessKey, sharedAccessKeyName });\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseNotificationHubsConnectionString(\n connectionString: string\n): NotificationHubsConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\"\n );\n }\n\n const output: NotificationHubsConnectionStringProperties = {\n endpoint: parsedResult.Endpoint,\n sharedAccessKey: parsedResult.SharedAccessKey!,\n sharedAccessKeyName: parsedResult.SharedAccessKeyName!,\n };\n\n return output;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
export async function signString(key, toSign) {
|
|
4
|
+
const enc = new TextEncoder();
|
|
5
|
+
const algorithm = { name: "HMAC", hash: { name: "SHA-256" } };
|
|
6
|
+
const extractedKey = await self.crypto.subtle.importKey("raw", enc.encode(key), algorithm, false, ["sign", "verify"]);
|
|
7
|
+
const signature = await self.crypto.subtle.sign(algorithm, extractedKey, enc.encode(toSign));
|
|
8
|
+
const digest = btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
9
|
+
return digest;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=hmacSha256.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmacSha256.browser.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiElC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,MAAc;IAC1D,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAqB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAEhF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CACrD,KAAK,EACL,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EACf,SAAS,EACT,KAAK,EACL,CAAC,MAAM,EAAE,QAAQ,CAAC,CACnB,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAEvE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// stubs for browser self.crypto\ninterface JsonWebKey {}\n\ninterface CryptoKey {}\n\ntype KeyUsage =\n | \"decrypt\"\n | \"deriveBits\"\n | \"deriveKey\"\n | \"encrypt\"\n | \"sign\"\n | \"unwrapKey\"\n | \"verify\"\n | \"wrapKey\";\n\ninterface Algorithm {\n name: string;\n}\n\ninterface SubtleCrypto {\n importKey(\n format: string,\n keyData: JsonWebKey,\n algorithm: HmacImportParams,\n extractable: boolean,\n usage: KeyUsage[]\n ): Promise<CryptoKey>;\n sign(\n algorithm: HmacImportParams,\n key: CryptoKey,\n data: ArrayBufferView | ArrayBuffer\n ): Promise<ArrayBuffer>;\n digest(algorithm: Algorithm, data: ArrayBufferView | ArrayBuffer): Promise<ArrayBuffer>;\n}\n\ninterface Crypto {\n readonly subtle: SubtleCrypto;\n getRandomValues<T extends ArrayBufferView | null>(array: T): T;\n}\n\ndeclare const self: {\n crypto: Crypto;\n};\n\ninterface HmacImportParams {\n name: string;\n hash: Algorithm;\n length?: number;\n}\n\n// stubs for browser TextEncoder\ninterface TextEncoder {\n encode(input?: string): Uint8Array;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\ndeclare const TextEncoder: {\n prototype: TextEncoder;\n new (): TextEncoder;\n};\n\ndeclare function btoa(str: string | Buffer): string;\n\nexport async function signString(key: string, toSign: string): Promise<string> {\n const enc = new TextEncoder();\n const algorithm: HmacImportParams = { name: \"HMAC\", hash: { name: \"SHA-256\" } };\n\n const extractedKey = await self.crypto.subtle.importKey(\n \"raw\",\n enc.encode(key),\n algorithm,\n false,\n [\"sign\", \"verify\"]\n );\n const signature = await self.crypto.subtle.sign(algorithm, extractedKey, enc.encode(toSign));\n const digest = btoa(String.fromCharCode(...new Uint8Array(signature)));\n\n return digest;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createHmac } from "crypto";
|
|
4
|
+
export async function signString(key, toSign) {
|
|
5
|
+
const hmac = createHmac("sha256", key).update(toSign).digest("base64");
|
|
6
|
+
return encodeURIComponent(hmac);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hmacSha256.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { isNamedKeyCredential, isSASCredential, } from "@azure/core-auth";
|
|
4
|
+
import { isObjectWithProperties } from "@azure/core-util";
|
|
5
|
+
import { signString } from "./hmacSha256.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a token provider from the provided shared access data.
|
|
8
|
+
* @param data - The sharedAccessKeyName/sharedAccessKey pair or the sharedAccessSignature.
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export function createSasTokenProvider(data) {
|
|
12
|
+
if (isNamedKeyCredential(data) || isSASCredential(data)) {
|
|
13
|
+
return new SasTokenProviderImpl(data);
|
|
14
|
+
}
|
|
15
|
+
else if (isObjectWithProperties(data, ["sharedAccessKeyName", "sharedAccessKey"])) {
|
|
16
|
+
return new SasTokenProviderImpl({
|
|
17
|
+
name: data.sharedAccessKeyName,
|
|
18
|
+
key: data.sharedAccessKey,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return new SasTokenProviderImpl({ signature: data.sharedAccessSignature });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A TokenProvider that generates a Sas token:
|
|
27
|
+
* `SharedAccessSignature sr=<resource>&sig=<signature>&se=<expiry>&skn=<keyname>`
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export class SasTokenProviderImpl {
|
|
32
|
+
/**
|
|
33
|
+
* Initializes a new instance of SasTokenProvider
|
|
34
|
+
* @param credential - The source `NamedKeyCredential` or `SASCredential`.
|
|
35
|
+
*/
|
|
36
|
+
constructor(credential) {
|
|
37
|
+
this._credential = credential;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Property used to distinguish TokenProvider from TokenCredential.
|
|
41
|
+
*/
|
|
42
|
+
get isSasTokenProvider() {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the sas token for the specified audience
|
|
47
|
+
* @param audience - The audience for which the token is desired.
|
|
48
|
+
*/
|
|
49
|
+
async getToken(audience) {
|
|
50
|
+
if (isNamedKeyCredential(this._credential)) {
|
|
51
|
+
return createToken(this._credential.name, this._credential.key, Math.floor(Date.now() / 1000) + 3600, audience);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return {
|
|
55
|
+
token: this._credential.signature,
|
|
56
|
+
expiresOnTimestamp: 0,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates the sas token based on the provided information.
|
|
63
|
+
* @param keyName - The shared access key name.
|
|
64
|
+
* @param key - The shared access key.
|
|
65
|
+
* @param expiry - The time period in unix time after which the token will expire.
|
|
66
|
+
* @param audience - The audience for which the token is desired.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
async function createToken(keyName, key, expiry, audience) {
|
|
70
|
+
audience = encodeURIComponent(audience.toLowerCase());
|
|
71
|
+
keyName = encodeURIComponent(keyName);
|
|
72
|
+
const stringToSign = audience + "\n" + expiry;
|
|
73
|
+
const sig = await signString(key, stringToSign);
|
|
74
|
+
return {
|
|
75
|
+
token: `SharedAccessSignature sr=${audience}&sig=${sig}&se=${expiry}&skn=${keyName}`,
|
|
76
|
+
expiresOnTimestamp: expiry,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=sasTokenProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sasTokenProvider.js","sourceRoot":"","sources":["../../../src/auth/sasTokenProvider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAIL,oBAAoB,EACpB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqB7C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAIiB;IAEjB,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;QACvD,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;KACvC;SAAM,IAAI,sBAAsB,CAAC,IAAI,EAAE,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC,EAAE;QACnF,OAAO,IAAI,oBAAoB,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC,mBAAmB;YAC9B,GAAG,EAAE,IAAI,CAAC,eAAe;SACJ,CAAC,CAAC;KAC1B;SAAM;QACL,OAAO,IAAI,oBAAoB,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;KAC5E;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAa/B;;;OAGG;IACH,YAAY,UAA8C;QACxD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAlBD;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAeD;;;OAGG;IACH,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,IAAI,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC1C,OAAO,WAAW,CAChB,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,IAAI,CAAC,WAAW,CAAC,GAAG,EACpB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,EACpC,QAAQ,CACT,CAAC;SACH;aAAM;YACL,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS;gBACjC,kBAAkB,EAAE,CAAC;aACtB,CAAC;SACH;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,WAAW,CACxB,OAAe,EACf,GAAW,EACX,MAAc,EACd,QAAgB;IAEhB,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;IAC9C,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEhD,OAAO;QACL,KAAK,EAAE,4BAA4B,QAAQ,QAAQ,GAAG,OAAO,MAAM,QAAQ,OAAO,EAAE;QACpF,kBAAkB,EAAE,MAAM;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AccessToken,\n NamedKeyCredential,\n SASCredential,\n isNamedKeyCredential,\n isSASCredential,\n} from \"@azure/core-auth\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\nimport { signString } from \"./hmacSha256.js\";\n\n/**\n * A SasTokenProvider provides an alternative to TokenCredential for providing an `AccessToken`.\n * @hidden\n */\nexport interface SasTokenProvider {\n /**\n * Property used to distinguish SasTokenProvider from TokenCredential.\n */\n isSasTokenProvider: true;\n /**\n * Gets the token provided by this provider.\n *\n * This method is called automatically by Azure SDK client libraries.\n *\n * @param audience - The audience for which the token is desired.\n */\n getToken(audience: string): Promise<AccessToken>;\n}\n\n/**\n * Creates a token provider from the provided shared access data.\n * @param data - The sharedAccessKeyName/sharedAccessKey pair or the sharedAccessSignature.\n * @hidden\n */\nexport function createSasTokenProvider(\n data:\n | { sharedAccessKeyName: string; sharedAccessKey: string }\n | { sharedAccessSignature: string }\n | NamedKeyCredential\n | SASCredential\n): SasTokenProvider {\n if (isNamedKeyCredential(data) || isSASCredential(data)) {\n return new SasTokenProviderImpl(data);\n } else if (isObjectWithProperties(data, [\"sharedAccessKeyName\", \"sharedAccessKey\"])) {\n return new SasTokenProviderImpl({\n name: data.sharedAccessKeyName,\n key: data.sharedAccessKey,\n } as NamedKeyCredential);\n } else {\n return new SasTokenProviderImpl({ signature: data.sharedAccessSignature });\n }\n}\n\n/**\n * A TokenProvider that generates a Sas token:\n * `SharedAccessSignature sr=<resource>&sig=<signature>&se=<expiry>&skn=<keyname>`\n *\n * @internal\n */\nexport class SasTokenProviderImpl implements SasTokenProvider {\n /**\n * Property used to distinguish TokenProvider from TokenCredential.\n */\n get isSasTokenProvider(): true {\n return true;\n }\n\n /**\n * The SASCredential containing the key name and secret key value.\n */\n private _credential: SASCredential | NamedKeyCredential;\n\n /**\n * Initializes a new instance of SasTokenProvider\n * @param credential - The source `NamedKeyCredential` or `SASCredential`.\n */\n constructor(credential: SASCredential | NamedKeyCredential) {\n this._credential = credential;\n }\n\n /**\n * Gets the sas token for the specified audience\n * @param audience - The audience for which the token is desired.\n */\n async getToken(audience: string): Promise<AccessToken> {\n if (isNamedKeyCredential(this._credential)) {\n return createToken(\n this._credential.name,\n this._credential.key,\n Math.floor(Date.now() / 1000) + 3600,\n audience\n );\n } else {\n return {\n token: this._credential.signature,\n expiresOnTimestamp: 0,\n };\n }\n }\n}\n\n/**\n * Creates the sas token based on the provided information.\n * @param keyName - The shared access key name.\n * @param key - The shared access key.\n * @param expiry - The time period in unix time after which the token will expire.\n * @param audience - The audience for which the token is desired.\n * @internal\n */\nasync function createToken(\n keyName: string,\n key: string,\n expiry: number,\n audience: string\n): Promise<AccessToken> {\n audience = encodeURIComponent(audience.toLowerCase());\n keyName = encodeURIComponent(keyName);\n const stringToSign = audience + \"\\n\" + expiry;\n const sig = await signString(key, stringToSign);\n\n return {\n token: `SharedAccessSignature sr=${audience}&sig=${sig}&se=${expiry}&skn=${keyName}`,\n expiresOnTimestamp: expiry,\n };\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, parseNotificationSendResponse, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "cancelScheduledNotification";
|
|
5
6
|
/**
|
|
6
7
|
* Cancels the scheduled notification with the given notification ID.
|
|
7
8
|
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
@@ -11,10 +12,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
11
12
|
* @returns A notification hub response with correlation ID and tracking ID.
|
|
12
13
|
*/
|
|
13
14
|
export function cancelScheduledNotification(context, notificationId, options = {}) {
|
|
14
|
-
return tracingClient.withSpan(
|
|
15
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
15
16
|
const endpoint = context.requestUrl();
|
|
16
17
|
endpoint.pathname += `/schedulednotifications/${notificationId}`;
|
|
17
|
-
const headers = context.createHeaders();
|
|
18
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
18
19
|
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
19
20
|
const response = await sendRequest(context, request, 200);
|
|
20
21
|
return parseNotificationSendResponse(response);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancelScheduledNotification.js","sourceRoot":"","sources":["../../../src/client/cancelScheduledNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIlG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"cancelScheduledNotification.js","sourceRoot":"","sources":["../../../src/client/cancelScheduledNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIlG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,2BAA2B,cAAc,EAAE,CAAC;QAEjE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"cancelScheduledNotification\";\n\n/**\n * Cancels the scheduled notification with the given notification ID.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param notificationId - The notification ID from the scheduled notification.\n * @param options - The operation options.\n * @returns A notification hub response with correlation ID and tracking ID.\n */\nexport function cancelScheduledNotification(\n context: NotificationHubsClientContext,\n notificationId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/schedulednotifications/${notificationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"DELETE\", headers, updatedOptions);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationSendResponse(response);\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "createOrUpdateInstallation";
|
|
5
6
|
/**
|
|
6
7
|
* Creates or overwrites an installation to a Notification Hub.
|
|
7
8
|
* @param context - The Notification Hubs client.
|
|
@@ -10,10 +11,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
10
11
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
12
|
*/
|
|
12
13
|
export function createOrUpdateInstallation(context, installation, options = {}) {
|
|
13
|
-
return tracingClient.withSpan(
|
|
14
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
14
15
|
const endpoint = context.requestUrl();
|
|
15
16
|
endpoint.pathname += `/installations/${installation.installationId}`;
|
|
16
|
-
const headers = context.createHeaders();
|
|
17
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
17
18
|
headers.set("Content-Type", "application/json");
|
|
18
19
|
const request = createRequest(endpoint, "PUT", headers, updatedOptions);
|
|
19
20
|
request.body = JSON.stringify(installation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOrUpdateInstallation.js","sourceRoot":"","sources":["../../../src/client/createOrUpdateInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"createOrUpdateInstallation.js","sourceRoot":"","sources":["../../../src/client/createOrUpdateInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,YAAY,CAAC,cAAc,EAAE,CAAC;QAErE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { Installation } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createOrUpdateInstallation\";\n\n/**\n * Creates or overwrites an installation to a Notification Hub.\n * @param context - The Notification Hubs client.\n * @param installation - The installation to create or overwrite.\n * @param options - Configuration options for the create or update installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function createOrUpdateInstallation(\n context: NotificationHubsClientContext,\n installation: Installation,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installation.installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"PUT\", headers, updatedOptions);\n request.body = JSON.stringify(installation);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createOrUpdateRegistrationDescription } from "./internal/_createOrUpdateRegistrationDescription.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "createOrUpdateRegistration";
|
|
5
6
|
/**
|
|
6
7
|
* Creates or updates a registration.
|
|
7
8
|
* @param context - The Notification Hubs client.
|
|
@@ -10,7 +11,7 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
10
11
|
* @returns The created or updated registration description.
|
|
11
12
|
*/
|
|
12
13
|
export function createOrUpdateRegistration(context, registration, options = {}) {
|
|
13
|
-
return tracingClient.withSpan(
|
|
14
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
14
15
|
return createOrUpdateRegistrationDescription(context, registration, "createOrUpdate", updatedOptions);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOrUpdateRegistration.js","sourceRoot":"","sources":["../../../src/client/createOrUpdateRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"createOrUpdateRegistration.js","sourceRoot":"","sources":["../../../src/client/createOrUpdateRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,OAAO,qCAAqC,CAC1C,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,CACf,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createOrUpdateRegistration\";\n\n/**\n * Creates or updates a registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\nexport function createOrUpdateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n return createOrUpdateRegistrationDescription(\n context,\n registration,\n \"createOrUpdate\",\n updatedOptions\n );\n }\n );\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
4
4
|
import { createOrUpdateRegistrationDescription } from "./internal/_createOrUpdateRegistrationDescription.js";
|
|
5
5
|
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
const OPERATION_NAME = "createRegistration";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a new registration. This method generates a registration ID,
|
|
8
9
|
* which you can subsequently use to retrieve, update, and delete this registration.
|
|
@@ -12,7 +13,7 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
12
13
|
* @returns The newly created registration description.
|
|
13
14
|
*/
|
|
14
15
|
export function createRegistration(context, registration, options = {}) {
|
|
15
|
-
return tracingClient.withSpan(
|
|
16
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
16
17
|
if (registration.registrationId) {
|
|
17
18
|
throw new RestError("registrationId must not be set during a create operation", {
|
|
18
19
|
statusCode: 400,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRegistration.js","sourceRoot":"","sources":["../../../src/client/createRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"createRegistration.js","sourceRoot":"","sources":["../../../src/client/createRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,IAAI,YAAY,CAAC,cAAc,EAAE;YAC/B,MAAM,IAAI,SAAS,CAAC,0DAA0D,EAAE;gBAC9E,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;SACJ;QAED,OAAO,qCAAqC,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChG,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createRegistration\";\n\n/**\n * Creates a new registration. This method generates a registration ID,\n * which you can subsequently use to retrieve, update, and delete this registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\nexport function createRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n if (registration.registrationId) {\n throw new RestError(\"registrationId must not be set during a create operation\", {\n statusCode: 400,\n });\n }\n\n return createOrUpdateRegistrationDescription(context, registration, \"create\", updatedOptions);\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "createRegistrationId";
|
|
5
6
|
/**
|
|
6
7
|
* Creates a new registration ID.
|
|
7
8
|
* @param context - The Notification Hubs client.
|
|
@@ -9,10 +10,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
9
10
|
* @returns The newly created registration ID.
|
|
10
11
|
*/
|
|
11
12
|
export function createRegistrationId(context, options = {}) {
|
|
12
|
-
return tracingClient.withSpan(
|
|
13
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
13
14
|
const endpoint = context.requestUrl();
|
|
14
15
|
endpoint.pathname += "/registrationIDs";
|
|
15
|
-
const headers = context.createHeaders();
|
|
16
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
16
17
|
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
17
18
|
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
18
19
|
const response = await sendRequest(context, request, 201);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRegistrationId.js","sourceRoot":"","sources":["../../../src/client/createRegistrationId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"createRegistrationId.js","sourceRoot":"","sources":["../../../src/client/createRegistrationId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,CAAC;QAExC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,2GAA2G;QAC3G,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,cAAe,CAAC,CAAC;QAC7C,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1D,OAAO,cAAc,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createRegistrationId\";\n\n/**\n * Creates a new registration ID.\n * @param context - The Notification Hubs client.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\nexport function createRegistrationId(\n context: NotificationHubsClientContext,\n options: OperationOptions = {}\n): Promise<string> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrationIDs\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n const response = await sendRequest(context, request, 201);\n\n // In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>\n const locationHeader = response.headers.get(\"Location\");\n const locationUrl = new URL(locationHeader!);\n const registrationId = locationUrl.pathname.split(\"/\")[3];\n\n return registrationId;\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "deleteInstallation";
|
|
5
6
|
/**
|
|
6
7
|
* Deletes an installation from a Notification Hub.
|
|
7
8
|
* @param context - The Notification Hubs client.
|
|
@@ -10,10 +11,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
10
11
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
12
|
*/
|
|
12
13
|
export function deleteInstallation(context, installationId, options = {}) {
|
|
13
|
-
return tracingClient.withSpan(
|
|
14
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
14
15
|
const endpoint = context.requestUrl();
|
|
15
16
|
endpoint.pathname += `/installations/${installationId}`;
|
|
16
|
-
const headers = context.createHeaders();
|
|
17
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
17
18
|
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
18
19
|
const response = await sendRequest(context, request, 204);
|
|
19
20
|
return parseNotificationResponse(response);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteInstallation.js","sourceRoot":"","sources":["../../../src/client/deleteInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"deleteInstallation.js","sourceRoot":"","sources":["../../../src/client/deleteInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"deleteInstallation\";\n\n/**\n * Deletes an installation from a Notification Hub.\n * @param context - The Notification Hubs client.\n * @param installationId - The installation ID of the installation to delete.\n * @param options - Configuration options for the installation delete operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function deleteInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"DELETE\", headers, updatedOptions);\n const response = await sendRequest(context, request, 204);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { isDefined } from "../utils/utils.js";
|
|
5
5
|
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
const OPERATION_NAME = "deleteRegistration";
|
|
6
7
|
/**
|
|
7
8
|
* Deletes a registration with the given registration ID.
|
|
8
9
|
* @param context - The Notification Hubs client.
|
|
@@ -11,10 +12,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
11
12
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
12
13
|
*/
|
|
13
14
|
export function deleteRegistration(context, registrationId, options = {}) {
|
|
14
|
-
return tracingClient.withSpan(
|
|
15
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
15
16
|
const endpoint = context.requestUrl();
|
|
16
17
|
endpoint.pathname += `/registrations/${registrationId}`;
|
|
17
|
-
const headers = context.createHeaders();
|
|
18
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
18
19
|
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
19
20
|
headers.set("If-Match", isDefined(options.etag) ? `"${options.etag}"` : "*");
|
|
20
21
|
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRegistration.js","sourceRoot":"","sources":["../../../src/client/deleteRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAAkC,EAAE;IAEpC,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"deleteRegistration.js","sourceRoot":"","sources":["../../../src/client/deleteRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAAkC,EAAE;IAEpC,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { EntityOperationOptions } from \"../models/options.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/response.js\";\nimport { isDefined } from \"../utils/utils.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"deleteRegistration\";\n\n/**\n * Deletes a registration with the given registration ID.\n * @param context - The Notification Hubs client.\n * @param registrationId - The registration ID of the registration to delete.\n * @param options - The options for delete operations including the ETag\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function deleteRegistration(\n context: NotificationHubsClientContext,\n registrationId: string,\n options: EntityOperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/registrations/${registrationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n headers.set(\"If-Match\", isDefined(options.etag) ? `\"${options.etag}\"` : \"*\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "getFeedbackContainerUrl";
|
|
5
6
|
/**
|
|
6
7
|
* Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.
|
|
7
8
|
* The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.
|
|
@@ -10,10 +11,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
10
11
|
* @returns The URL of the Azure Storage Container containing the feedback data.
|
|
11
12
|
*/
|
|
12
13
|
export function getFeedbackContainerUrl(context, options = {}) {
|
|
13
|
-
return tracingClient.withSpan(
|
|
14
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
14
15
|
const endpoint = context.requestUrl();
|
|
15
16
|
endpoint.pathname += "/feedbackcontainer";
|
|
16
|
-
const headers = context.createHeaders();
|
|
17
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
17
18
|
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
18
19
|
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
19
20
|
const response = await sendRequest(context, request, 200);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFeedbackContainerUrl.js","sourceRoot":"","sources":["../../../src/client/getFeedbackContainerUrl.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"getFeedbackContainerUrl.js","sourceRoot":"","sources":["../../../src/client/getFeedbackContainerUrl.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,oBAAoB,CAAC;QAE1C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,QAAQ,CAAC,UAAW,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getFeedbackContainerUrl\";\n\n/**\n * Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.\n * The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.\n * @param context - The Notification Hubs client.\n * @param options - The options for getting the push notification feedback container URL.\n * @returns The URL of the Azure Storage Container containing the feedback data.\n */\nexport function getFeedbackContainerUrl(\n context: NotificationHubsClientContext,\n options: OperationOptions = {}\n): Promise<string> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/feedbackcontainer\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return response.bodyAsText!;\n }\n );\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
const OPERATION_NAME = "getInstallation";
|
|
5
6
|
/**
|
|
6
7
|
* Gets an Azure Notification Hub installation by the installation ID.
|
|
7
8
|
* @param context - The Notification Hubs client.
|
|
@@ -10,10 +11,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
10
11
|
* @returns The installation that matches the installation ID.
|
|
11
12
|
*/
|
|
12
13
|
export function getInstallation(context, installationId, options = {}) {
|
|
13
|
-
return tracingClient.withSpan(
|
|
14
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
14
15
|
const endpoint = context.requestUrl();
|
|
15
16
|
endpoint.pathname += `/installations/${installationId}`;
|
|
16
|
-
const headers = context.createHeaders();
|
|
17
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
17
18
|
headers.set("Content-Type", "application/json");
|
|
18
19
|
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
19
20
|
const response = await sendRequest(context, request, 200);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInstallation.js","sourceRoot":"","sources":["../../../src/client/getInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B
|
|
1
|
+
{"version":3,"file":"getInstallation.js","sourceRoot":"","sources":["../../../src/client/getInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAW,CAAiB,CAAC;IAC1D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { Installation } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getInstallation\";\n\n/**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param context - The Notification Hubs client.\n * @param installationId - The ID of the installation to get.\n * @param options - Configuration options for the get installation operation.\n * @returns The installation that matches the installation ID.\n */\nexport function getInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n options: OperationOptions = {}\n): Promise<Installation> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return JSON.parse(response.bodyAsText!) as Installation;\n }\n );\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { parseNotificationHubJobEntry } from "../serializers/notificationHubJobSerializer.js";
|
|
5
5
|
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
const OPERATION_NAME = "getNotificationHubJob";
|
|
6
7
|
/**
|
|
7
8
|
* Gets a Notification Hub Job by the ID.
|
|
8
9
|
* @param context - The Notification Hubs client.
|
|
@@ -11,10 +12,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
11
12
|
* @returns The Notification Hub Job with the matching ID.
|
|
12
13
|
*/
|
|
13
14
|
export function getNotificationHubJob(context, jobId, options = {}) {
|
|
14
|
-
return tracingClient.withSpan(
|
|
15
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
15
16
|
const endpoint = context.requestUrl();
|
|
16
17
|
endpoint.pathname += `/jobs/${jobId}`;
|
|
17
|
-
const headers = context.createHeaders();
|
|
18
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
18
19
|
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
19
20
|
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
20
21
|
const response = await sendRequest(context, request, 200);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNotificationHubJob.js","sourceRoot":"","sources":["../../../src/client/getNotificationHubJob.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,KAAa,EACb,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"getNotificationHubJob.js","sourceRoot":"","sources":["../../../src/client/getNotificationHubJob.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,KAAa,EACb,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,SAAS,KAAK,EAAE,CAAC;QAEtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,4BAA4B,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubJob } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { parseNotificationHubJobEntry } from \"../serializers/notificationHubJobSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getNotificationHubJob\";\n\n/**\n * Gets a Notification Hub Job by the ID.\n * @param context - The Notification Hubs client.\n * @param jobId - The Notification Hub Job ID.\n * @param options - The operation options.\n * @returns The Notification Hub Job with the matching ID.\n */\nexport function getNotificationHubJob(\n context: NotificationHubsClientContext,\n jobId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubJob> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/jobs/${jobId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationHubJobEntry(response.bodyAsText!);\n }\n );\n}\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
4
|
import { parseNotificationDetails } from "../serializers/notificationDetailsSerializer.js";
|
|
5
5
|
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
const OPERATION_NAME = "getNotificationOutcomeDetails";
|
|
6
7
|
/**
|
|
7
8
|
* Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed
|
|
8
9
|
* or final results if the Send* has completed. This API can only be called for Standard SKU and above.
|
|
@@ -12,10 +13,10 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
12
13
|
* @returns The results of the send operation.
|
|
13
14
|
*/
|
|
14
15
|
export function getNotificationOutcomeDetails(context, notificationId, options = {}) {
|
|
15
|
-
return tracingClient.withSpan(
|
|
16
|
+
return tracingClient.withSpan(`NotificationHubsClientContext-${OPERATION_NAME}`, options, async (updatedOptions) => {
|
|
16
17
|
const endpoint = context.requestUrl();
|
|
17
18
|
endpoint.pathname += `/messages/${notificationId}`;
|
|
18
|
-
const headers = context.createHeaders();
|
|
19
|
+
const headers = await context.createHeaders(OPERATION_NAME);
|
|
19
20
|
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
20
21
|
const response = await sendRequest(context, request, 200);
|
|
21
22
|
return parseNotificationDetails(response.bodyAsText);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNotificationOutcomeDetails.js","sourceRoot":"","sources":["../../../src/client/getNotificationOutcomeDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,
|
|
1
|
+
{"version":3,"file":"getNotificationOutcomeDetails.js","sourceRoot":"","sources":["../../../src/client/getNotificationOutcomeDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,aAAa,cAAc,EAAE,CAAC;QAEnD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,wBAAwB,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationDetails } from \"../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { parseNotificationDetails } from \"../serializers/notificationDetailsSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getNotificationOutcomeDetails\";\n\n/**\n * Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed\n * or final results if the Send* has completed. This API can only be called for Standard SKU and above.\n * @param context - The Notification Hubs client.\n * @param notificationId - The notification ID returned from the send operation.\n * @param options - The operation options.\n * @returns The results of the send operation.\n */\nexport function getNotificationOutcomeDetails(\n context: NotificationHubsClientContext,\n notificationId: string,\n options: OperationOptions = {}\n): Promise<NotificationDetails> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/messages/${notificationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationDetails(response.bodyAsText!);\n }\n );\n}\n"]}
|