@azure/notification-hubs 1.2.4-alpha.20240628.1 → 1.2.4-alpha.20240704.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.
- package/dist/api/notification-hubs.d.ts +0 -2
- package/dist/browser/api/clientContext.d.ts +0 -1
- package/dist/browser/api/clientContext.d.ts.map +1 -1
- package/dist/browser/api/internal/_client.d.ts +0 -1
- package/dist/browser/api/internal/_client.d.ts.map +1 -1
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js +1 -2
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist/commonjs/api/cancelScheduledNotification.js +1 -2
- package/dist/commonjs/api/cancelScheduledNotification.js.map +1 -1
- package/dist/commonjs/api/clientContext.d.ts +0 -1
- package/dist/commonjs/api/clientContext.d.ts.map +1 -1
- package/dist/commonjs/api/clientContext.js +1 -2
- package/dist/commonjs/api/clientContext.js.map +1 -1
- package/dist/commonjs/api/createOrUpdateInstallation.js +1 -2
- package/dist/commonjs/api/createOrUpdateInstallation.js.map +1 -1
- package/dist/commonjs/api/createOrUpdateRegistration.js +1 -2
- package/dist/commonjs/api/createOrUpdateRegistration.js.map +1 -1
- package/dist/commonjs/api/createRegistration.js +1 -2
- package/dist/commonjs/api/createRegistration.js.map +1 -1
- package/dist/commonjs/api/createRegistrationId.js +1 -2
- package/dist/commonjs/api/createRegistrationId.js.map +1 -1
- package/dist/commonjs/api/deleteInstallation.js +1 -2
- package/dist/commonjs/api/deleteInstallation.js.map +1 -1
- package/dist/commonjs/api/deleteRegistration.js +1 -2
- package/dist/commonjs/api/deleteRegistration.js.map +1 -1
- package/dist/commonjs/api/getFeedbackContainerUrl.js +1 -2
- package/dist/commonjs/api/getFeedbackContainerUrl.js.map +1 -1
- package/dist/commonjs/api/getInstallation.js +1 -2
- package/dist/commonjs/api/getInstallation.js.map +1 -1
- package/dist/commonjs/api/getNotificationHubJob.js +1 -2
- package/dist/commonjs/api/getNotificationHubJob.js.map +1 -1
- package/dist/commonjs/api/getNotificationOutcomeDetails.js +1 -2
- package/dist/commonjs/api/getNotificationOutcomeDetails.js.map +1 -1
- package/dist/commonjs/api/getRegistration.js +1 -2
- package/dist/commonjs/api/getRegistration.js.map +1 -1
- package/dist/commonjs/api/internal/_client.d.ts +0 -1
- package/dist/commonjs/api/internal/_client.d.ts.map +1 -1
- package/dist/commonjs/api/internal/_client.js +4 -5
- package/dist/commonjs/api/internal/_client.js.map +1 -1
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js +1 -2
- package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -1
- package/dist/commonjs/api/internal/_listRegistrations.js +2 -3
- package/dist/commonjs/api/internal/_listRegistrations.js.map +1 -1
- package/dist/commonjs/api/listNotificationHubJobs.js +1 -2
- package/dist/commonjs/api/listNotificationHubJobs.js.map +1 -1
- package/dist/commonjs/api/listRegistrations.js +1 -2
- package/dist/commonjs/api/listRegistrations.js.map +1 -1
- package/dist/commonjs/api/listRegistrationsByChannel.js +1 -2
- package/dist/commonjs/api/listRegistrationsByChannel.js.map +1 -1
- package/dist/commonjs/api/listRegistrationsByTag.js +1 -2
- package/dist/commonjs/api/listRegistrationsByTag.js.map +1 -1
- package/dist/commonjs/api/scheduleNotification.js +1 -2
- package/dist/commonjs/api/scheduleNotification.js.map +1 -1
- package/dist/commonjs/api/sendNotification.js +1 -2
- package/dist/commonjs/api/sendNotification.js.map +1 -1
- package/dist/commonjs/api/submitNotificationHubJob.js +1 -2
- package/dist/commonjs/api/submitNotificationHubJob.js.map +1 -1
- package/dist/commonjs/api/updateInstallation.js +1 -2
- package/dist/commonjs/api/updateInstallation.js.map +1 -1
- package/dist/commonjs/api/updateRegistration.js +1 -2
- package/dist/commonjs/api/updateRegistration.js.map +1 -1
- package/dist/commonjs/auth/connectionStringUtils.js +2 -3
- package/dist/commonjs/auth/connectionStringUtils.js.map +1 -1
- package/dist/commonjs/auth/hmacSha256.js +1 -2
- package/dist/commonjs/auth/hmacSha256.js.map +1 -1
- package/dist/commonjs/models/installation.js +8 -9
- package/dist/commonjs/models/installation.js.map +1 -1
- package/dist/commonjs/models/notification.js +13 -14
- package/dist/commonjs/models/notification.js.map +1 -1
- package/dist/commonjs/models/notificationBodyBuilder.js +6 -7
- package/dist/commonjs/models/notificationBodyBuilder.js.map +1 -1
- package/dist/commonjs/models/registration.js +16 -17
- package/dist/commonjs/models/registration.js.map +1 -1
- package/dist/commonjs/models/tagExpressionBuilder.js +1 -2
- package/dist/commonjs/models/tagExpressionBuilder.js.map +1 -1
- package/dist/commonjs/serializers/notificationDetailsSerializer.js +1 -2
- package/dist/commonjs/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist/commonjs/serializers/notificationHubJobSerializer.js +3 -4
- package/dist/commonjs/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist/commonjs/serializers/notificationOutcomeSerializer.js +1 -2
- package/dist/commonjs/serializers/notificationOutcomeSerializer.js.map +1 -1
- package/dist/commonjs/utils/notificationUtils.js +1 -2
- package/dist/commonjs/utils/notificationUtils.js.map +1 -1
- package/dist/commonjs/utils/optionUtils.js +2 -3
- package/dist/commonjs/utils/optionUtils.js.map +1 -1
- package/dist/commonjs/utils/registrationUtils.js +1 -2
- package/dist/commonjs/utils/registrationUtils.js.map +1 -1
- package/dist/commonjs/utils/utils.js +11 -12
- package/dist/commonjs/utils/utils.js.map +1 -1
- package/dist/commonjs/utils/xmlUtils.js +5 -5
- package/dist/commonjs/utils/xmlUtils.js.map +1 -1
- package/dist/esm/api/clientContext.d.ts +0 -1
- package/dist/esm/api/clientContext.d.ts.map +1 -1
- package/dist/esm/api/internal/_client.d.ts +0 -1
- package/dist/esm/api/internal/_client.d.ts.map +1 -1
- package/dist/react-native/api/clientContext.d.ts +0 -1
- package/dist/react-native/api/clientContext.d.ts.map +1 -1
- package/dist/react-native/api/internal/_client.d.ts +0 -1
- package/dist/react-native/api/internal/_client.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.createRequest = createRequest;
|
|
6
|
+
exports.parseNotificationResponse = parseNotificationResponse;
|
|
7
|
+
exports.parseNotificationSendResponse = parseNotificationSendResponse;
|
|
8
|
+
exports.sendRequest = sendRequest;
|
|
6
9
|
const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
|
7
10
|
const utils_js_1 = require("../../utils/utils.js");
|
|
8
11
|
const notificationOutcomeSerializer_js_1 = require("../../serializers/notificationOutcomeSerializer.js");
|
|
@@ -11,7 +14,6 @@ function createRequest(endpoint, method, headers, options) {
|
|
|
11
14
|
return (0, core_rest_pipeline_1.createPipelineRequest)(Object.assign(Object.assign(Object.assign({}, options.tracingOptions), options.requestOptions), { url: endpoint.toString(), abortSignal: options.abortSignal, method,
|
|
12
15
|
headers }));
|
|
13
16
|
}
|
|
14
|
-
exports.createRequest = createRequest;
|
|
15
17
|
/**
|
|
16
18
|
* Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.
|
|
17
19
|
* @param response - The HTTP response used to populate the result.
|
|
@@ -27,7 +29,6 @@ function parseNotificationResponse(response) {
|
|
|
27
29
|
location,
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
exports.parseNotificationResponse = parseNotificationResponse;
|
|
31
32
|
/**
|
|
32
33
|
* Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.
|
|
33
34
|
* @param response - The HTTP response used to populate the result.
|
|
@@ -53,7 +54,6 @@ async function parseNotificationSendResponse(response) {
|
|
|
53
54
|
return createDefaultResponse(result, notificationId);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
exports.parseNotificationSendResponse = parseNotificationSendResponse;
|
|
57
57
|
function createDefaultResponse(response, notificationId) {
|
|
58
58
|
return Object.assign(Object.assign({}, response), { notificationId, successCount: 0, failureCount: 0, results: [], state: "Enqueued" });
|
|
59
59
|
}
|
|
@@ -89,5 +89,4 @@ async function sendRequest(context, request, successStatusCode) {
|
|
|
89
89
|
}
|
|
90
90
|
return response;
|
|
91
91
|
}
|
|
92
|
-
exports.sendRequest = sendRequest;
|
|
93
92
|
//# sourceMappingURL=_client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,sCAcC;AAOD,8DAUC;AAOD,sEA0BC;AAuBD,kCAgCC;AAzID,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;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;A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AAoC;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,OAAO,GAAG,MAAM,IAAA,2BAAa,EAAC,YAAY,CAAC,CAAC;QAC9C,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","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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.createOrUpdateRegistrationDescription =
|
|
5
|
+
exports.createOrUpdateRegistrationDescription = createOrUpdateRegistrationDescription;
|
|
6
6
|
const _client_js_1 = require("./_client.js");
|
|
7
7
|
const registrationSerializer_js_1 = require("../../serializers/registrationSerializer.js");
|
|
8
8
|
const utils_js_1 = require("../../utils/utils.js");
|
|
@@ -31,5 +31,4 @@ async function createOrUpdateRegistrationDescription(context, registration, oper
|
|
|
31
31
|
const response = await (0, _client_js_1.sendRequest)(context, request, [200, 201]);
|
|
32
32
|
return registrationSerializer_js_1.registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText);
|
|
33
33
|
}
|
|
34
|
-
exports.createOrUpdateRegistrationDescription = createOrUpdateRegistrationDescription;
|
|
35
34
|
//# sourceMappingURL=_createOrUpdateRegistrationDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_createOrUpdateRegistrationDescription.js","sourceRoot":"","sources":["../../../../src/api/internal/_createOrUpdateRegistrationDescription.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"_createOrUpdateRegistrationDescription.js","sourceRoot":"","sources":["../../../../src/api/internal/_createOrUpdateRegistrationDescription.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgBlC,sFAiCC;AA/CD,6CAA0D;AAC1D,2FAGqD;AAKrD,mDAAiD;AAEjD;;GAEG;AACI,KAAK,UAAU,qCAAqC,CACzD,OAAsC,EACtC,YAAqC,EACrC,aAAqD,EACrD,OAAyB;IAEzB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IACtC,IAAI,UAAU,GAAgB,MAAM,CAAC;IAErC,IAAI,aAAa,KAAK,gBAAgB,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QACrE,QAAQ,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,cAAc,EAAE,CAAC;QACvD,UAAU,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAE/B,gCAAgC;IAChC,YAAY,CAAC,cAAc,GAAG,SAAS,CAAC;IACxC,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;IAE9B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,cAAc,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;IAE7E,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAA,oBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,0BAAa,EAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,GAAG,6DAAiC,CAAC,gCAAgC,CAAC,YAAY,CAAC,CAAC;IAChG,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAEjE,OAAO,yDAA6B,CAAC,sBAAsB,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;AACpF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./_client.js\";\nimport {\n registrationDescriptionParser,\n registrationDescriptionSerializer,\n} from \"../../serializers/registrationSerializer.js\";\nimport { HttpMethods } from \"@azure/core-rest-pipeline\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { RegistrationDescription } from \"../../models/registration.js\";\nimport { isDefined } from \"../../utils/utils.js\";\n\n/**\n * @internal\n */\nexport async function createOrUpdateRegistrationDescription(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n operationName: \"create\" | \"createOrUpdate\" | \"update\",\n options: OperationOptions,\n): Promise<RegistrationDescription> {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrations\";\n let httpMethod: HttpMethods = \"POST\";\n\n if (operationName === \"createOrUpdate\" || operationName === \"update\") {\n endpoint.pathname += `/${registration.registrationId}`;\n httpMethod = \"PUT\";\n }\n\n const etag = registration.etag;\n\n // Clear out readonly properties\n registration.registrationId = undefined;\n registration.etag = undefined;\n\n const headers = await context.createHeaders(`${operationName}Registration`);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n if (operationName === \"update\") {\n headers.set(\"If-Match\", isDefined(etag) ? `\"${etag}\"` : \"*\");\n }\n\n const request = createRequest(endpoint, httpMethod, headers, options);\n request.body = registrationDescriptionSerializer.serializeRegistrationDescription(registration);\n const response = await sendRequest(context, request, [200, 201]);\n\n return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText!);\n}\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.listRegistrationsAll = listRegistrationsAll;
|
|
6
|
+
exports.listRegistrationPagingPage = listRegistrationPagingPage;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const _client_js_1 = require("./_client.js");
|
|
8
9
|
const registrationSerializer_js_1 = require("../../serializers/registrationSerializer.js");
|
|
@@ -26,7 +27,6 @@ function listRegistrationsAll(context, options) {
|
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
exports.listRegistrationsAll = listRegistrationsAll;
|
|
30
30
|
function listRegistrationPagingPage(context, options) {
|
|
31
31
|
return tslib_1.__asyncGenerator(this, arguments, function* listRegistrationPagingPage_1() {
|
|
32
32
|
let result = yield tslib_1.__await(_listRegistrations(context, options));
|
|
@@ -39,7 +39,6 @@ function listRegistrationPagingPage(context, options) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
exports.listRegistrationPagingPage = listRegistrationPagingPage;
|
|
43
42
|
async function _listRegistrations(context, options, continuationToken) {
|
|
44
43
|
const endpoint = context.requestUrl();
|
|
45
44
|
endpoint.pathname += "/registrations";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_listRegistrations.js","sourceRoot":"","sources":["../../../../src/api/internal/_listRegistrations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"_listRegistrations.js","sourceRoot":"","sources":["../../../../src/api/internal/_listRegistrations.ts"],"names":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,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAA,0BAAa,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,MAAM,yDAA6B,CAAC,qBAAqB,CAC7E,QAAQ,CAAC,UAAW,CACrB,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACjE,OAAO;QACL,aAAa;QACb,iBAAiB,EAAE,SAAS;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./_client.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { RegistrationDescription } from \"../../models/registration.js\";\nimport { RegistrationQueryOptions } from \"../../models/options.js\";\nimport { RegistrationQueryResponse } from \"../../models/response.js\";\nimport { registrationDescriptionParser } from \"../../serializers/registrationSerializer.js\";\n\nexport async function* listRegistrationsAll(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions,\n): AsyncIterableIterator<RegistrationDescription> {\n for await (const page of listRegistrationPagingPage(context, options)) {\n yield* page;\n }\n}\n\nexport async function* listRegistrationPagingPage(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions,\n): AsyncIterableIterator<RegistrationDescription[]> {\n let result = await _listRegistrations(context, options);\n yield result.registrations || [];\n let continuationToken = result.continuationToken;\n while (continuationToken) {\n result = await _listRegistrations(context, options, continuationToken);\n continuationToken = result.continuationToken;\n yield result.registrations || [];\n }\n}\n\nasync function _listRegistrations(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions,\n continuationToken?: string,\n): Promise<RegistrationQueryResponse> {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrations\";\n if (options.top !== undefined) {\n endpoint.searchParams.set(\"$top\", `${options.top}`);\n }\n\n if (options.filter !== undefined) {\n endpoint.searchParams.set(\"$filter\", options.filter);\n }\n\n if (continuationToken !== undefined) {\n endpoint.searchParams.set(\"continuationtoken\", continuationToken);\n }\n\n const headers = await context.createHeaders(\"listRegistrations\");\n const request = createRequest(endpoint, \"GET\", headers, options);\n const response = await sendRequest(context, request, 200);\n\n const registrations = await registrationDescriptionParser.parseRegistrationFeed(\n response.bodyAsText!,\n );\n const nextToken = response.headers.get(\"x-ms-continuationtoken\");\n return {\n registrations,\n continuationToken: nextToken,\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.listNotificationHubJobs =
|
|
5
|
+
exports.listNotificationHubJobs = listNotificationHubJobs;
|
|
6
6
|
const _client_js_1 = require("./internal/_client.js");
|
|
7
7
|
const notificationHubJobSerializer_js_1 = require("../serializers/notificationHubJobSerializer.js");
|
|
8
8
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
@@ -24,5 +24,4 @@ function listNotificationHubJobs(context, options = {}) {
|
|
|
24
24
|
return (0, notificationHubJobSerializer_js_1.parseNotificationHubJobFeed)(response.bodyAsText);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
exports.listNotificationHubJobs = listNotificationHubJobs;
|
|
28
27
|
//# sourceMappingURL=listNotificationHubJobs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listNotificationHubJobs.js","sourceRoot":"","sources":["../../../src/api/listNotificationHubJobs.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"listNotificationHubJobs.js","sourceRoot":"","sources":["../../../src/api/listNotificationHubJobs.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,0DAoBC;AAnCD,sDAAmE;AAInE,oGAA6F;AAC7F,oDAAoD;AAEpD,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,0BAAa,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,OAAO,CAAC;QAE7B,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,IAAA,0BAAa,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAA,6DAA2B,EAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IAC3D,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-rest/core-client\";\nimport { parseNotificationHubJobFeed } from \"../serializers/notificationHubJobSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"listNotificationHubJobs\";\n\n/**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param context - The Notification Hubs client.xs\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\nexport function listNotificationHubJobs(\n context: NotificationHubsClientContext,\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\";\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 parseNotificationHubJobFeed(response.bodyAsText!);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.listRegistrations =
|
|
5
|
+
exports.listRegistrations = listRegistrations;
|
|
6
6
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
7
7
|
const _listRegistrations_js_1 = require("./internal/_listRegistrations.js");
|
|
8
8
|
/**
|
|
@@ -35,5 +35,4 @@ function listRegistrations(context, options = {}) {
|
|
|
35
35
|
span.end();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.listRegistrations = listRegistrations;
|
|
39
38
|
//# sourceMappingURL=listRegistrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listRegistrations.js","sourceRoot":"","sources":["../../../src/api/listRegistrations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"listRegistrations.js","sourceRoot":"","sources":["../../../src/api/listRegistrations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAelC,8CA2BC;AApCD,oDAAoD;AACpD,4EAAoG;AAEpG;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,OAAsC,EACtC,UAAyC,EAAE;IAE3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,0BAAa,CAAC,SAAS,CACtD,iDAAiD,EACjD,OAAO,CACR,CAAC;IACF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAA,4CAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3D,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,IAAA,kDAA0B,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAC7D,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\nimport { listRegistrationPagingPage, listRegistrationsAll } from \"./internal/_listRegistrations.js\";\n\n/**\n * Gets all registrations for the notification hub with the given query options.\n * @param context - The Notification Hubs client.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\nexport function listRegistrations(\n context: NotificationHubsClientContext,\n options: RegistrationQueryLimitOptions = {},\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"NotificationHubsClientContext.listRegistrations\",\n options,\n );\n try {\n const iter = listRegistrationsAll(context, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationPagingPage(context, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.listRegistrationsByChannel =
|
|
5
|
+
exports.listRegistrationsByChannel = listRegistrationsByChannel;
|
|
6
6
|
const _listRegistrations_js_1 = require("./internal/_listRegistrations.js");
|
|
7
7
|
const registrationUtils_js_1 = require("../utils/registrationUtils.js");
|
|
8
8
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
@@ -38,5 +38,4 @@ function listRegistrationsByChannel(context, channel, options = {}) {
|
|
|
38
38
|
span.end();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
exports.listRegistrationsByChannel = listRegistrationsByChannel;
|
|
42
41
|
//# sourceMappingURL=listRegistrationsByChannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listRegistrationsByChannel.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByChannel.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"listRegistrationsByChannel.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByChannel.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,gEAgCC;AA9CD,4EAAoG;AAIpG,wEAAmE;AACnE,oDAAoD;AAEpD;;;;;;GAMG;AACH,SAAgB,0BAA0B,CACxC,OAAsC,EACtC,OAA4B,EAC5B,UAAyC,EAAE;IAE3C,MAAM,UAAU,mCACX,OAAO,KACV,MAAM,EAAE,IAAA,yCAAkB,EAAC,OAAO,CAAC,GACpC,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,0BAAa,CAAC,SAAS,CACtD,yDAAyD,EACzD,UAAU,CACX,CAAC;IACF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAA,4CAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3D,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,IAAA,kDAA0B,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAC7D,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription, RegistrationChannel } from \"../models/registration.js\";\nimport { listRegistrationPagingPage, listRegistrationsAll } from \"./internal/_listRegistrations.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { getFilterByChannel } from \"../utils/registrationUtils.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Gets all registrations for the notification hub with the given device information and options.\n * @param context - The Notification Hubs client.\n * @param channel - The Registration channel information to query per PNS type.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\nexport function listRegistrationsByChannel(\n context: NotificationHubsClientContext,\n channel: RegistrationChannel,\n options: RegistrationQueryLimitOptions = {},\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const newOptions = {\n ...options,\n filter: getFilterByChannel(channel),\n };\n const { span, updatedOptions } = tracingClient.startSpan(\n \"NotificationHubsClientContext.listRegistrationsByDevice\",\n newOptions,\n );\n try {\n const iter = listRegistrationsAll(context, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationPagingPage(context, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.listRegistrationsByTag =
|
|
5
|
+
exports.listRegistrationsByTag = listRegistrationsByTag;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const _client_js_1 = require("./internal/_client.js");
|
|
8
8
|
const registrationSerializer_js_1 = require("../serializers/registrationSerializer.js");
|
|
@@ -39,7 +39,6 @@ function listRegistrationsByTag(context, tag, options = {}) {
|
|
|
39
39
|
span.end();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.listRegistrationsByTag = listRegistrationsByTag;
|
|
43
42
|
function listRegistrationsByTagAll(context, tag, options) {
|
|
44
43
|
return tslib_1.__asyncGenerator(this, arguments, function* listRegistrationsByTagAll_1() {
|
|
45
44
|
var _a, e_1, _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listRegistrationsByTag.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByTag.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"listRegistrationsByTag.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByTag.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,wDA4BC;;AA9CD,sDAAmE;AAMnE,wFAAyF;AACzF,oDAAoD;AAEpD,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEhD;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,OAAsC,EACtC,GAAW,EACX,UAAyC,EAAE;IAE3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,0BAAa,CAAC,SAAS,CACtD,iCAAiC,cAAc,EAAE,EACjD,OAAO,CACR,CAAC;IACF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QACrE,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,gCAAgC,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;YACjE,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CAA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,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAA,0BAAa,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,MAAM,yDAA6B,CAAC,qBAAqB,CAC7E,QAAQ,CAAC,UAAW,CACrB,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACjE,OAAO;QACL,aAAa;QACb,iBAAiB,EAAE,SAAS;KAC7B,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 { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { RegistrationQueryResponse } from \"../models/response.js\";\nimport { registrationDescriptionParser } from \"../serializers/registrationSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"listRegistrationsByTag\";\n\n/**\n * Lists all registrations with the matching tag.\n * @param context - The Notification Hubs client.\n * @param tag - The tag to query for matching registrations.\n * @param options - The query options such as $top.\n * @returns A paged async iterable containing the matching registrations for the notification hub.\n */\nexport function listRegistrationsByTag(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions = {},\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const { span, updatedOptions } = tracingClient.startSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n );\n try {\n const iter = listRegistrationsByTagAll(context, tag, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationsByTagPagingPage(context, tag, options);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n\nasync function* listRegistrationsByTagAll(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions,\n): AsyncIterableIterator<RegistrationDescription> {\n for await (const page of listRegistrationsByTagPagingPage(context, tag, options)) {\n yield* page;\n }\n}\n\nasync function* listRegistrationsByTagPagingPage(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions,\n): AsyncIterableIterator<RegistrationDescription[]> {\n let result = await _listRegistrationsByTag(context, tag, options);\n yield result.registrations || [];\n let continuationToken = result.continuationToken;\n while (continuationToken) {\n result = await _listRegistrationsByTag(context, tag, options, continuationToken);\n continuationToken = result.continuationToken;\n yield result.registrations || [];\n }\n}\n\nasync function _listRegistrationsByTag(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions,\n continuationToken?: string,\n): Promise<RegistrationQueryResponse> {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/tags/${tag}/registrations`;\n if (options.top !== undefined) {\n endpoint.searchParams.set(\"$top\", `${options.top}`);\n }\n\n if (continuationToken !== undefined) {\n endpoint.searchParams.set(\"continuationtoken\", continuationToken);\n }\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"GET\", headers, options);\n const response = await sendRequest(context, request, 200);\n\n const registrations = await registrationDescriptionParser.parseRegistrationFeed(\n response.bodyAsText!,\n );\n const nextToken = response.headers.get(\"x-ms-continuationtoken\");\n return {\n registrations,\n continuationToken: nextToken,\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.scheduleNotification =
|
|
5
|
+
exports.scheduleNotification = scheduleNotification;
|
|
6
6
|
const _client_js_1 = require("./internal/_client.js");
|
|
7
7
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
8
8
|
/**
|
|
@@ -31,5 +31,4 @@ function scheduleNotification(context, scheduledTime, notification, options = {}
|
|
|
31
31
|
return (0, _client_js_1.parseNotificationSendResponse)(response);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
exports.scheduleNotification = scheduleNotification;
|
|
35
34
|
//# sourceMappingURL=scheduleNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,oDAiCC;AAlDD,sDAAkG;AAMlG,oDAAoD;AAEpD;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,UAAuC,EAAE;IAEzC,OAAO,0BAAa,CAAC,QAAQ,CAC3B,oDAAoD,EACpD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,0BAA0B,CAAC;QAEhD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CACzC,sBAAsB,EACtB,YAAY,CAAC,OAA4B,CAC1C,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,OAAO,GAAG,IAAA,0BAAa,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAA,0CAA6B,EAAC,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 { NonNullableRecord } from \"../utils/utils.js\";\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { ScheduleNotificationOptions } from \"../models/options.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions = {},\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.scheduleNotification`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/schedulednotifications/\";\n\n const headers = await context.createHeaders(\n \"scheduleNotification\",\n notification.headers as NonNullableRecord,\n );\n headers.set(\"ServiceBusNotification-ScheduleTime\", scheduledTime.toISOString());\n headers.set(\"Content-Type\", notification.contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n if (options.tagExpression) {\n headers.set(\"ServiceBusNotification-Tags\", options.tagExpression);\n }\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = notification.body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.sendNotification =
|
|
5
|
+
exports.sendNotification = sendNotification;
|
|
6
6
|
const _client_js_1 = require("./internal/_client.js");
|
|
7
7
|
const optionUtils_js_1 = require("../utils/optionUtils.js");
|
|
8
8
|
const notificationUtils_js_1 = require("../utils/notificationUtils.js");
|
|
@@ -63,5 +63,4 @@ function sendNotification(context, notification, options = { enableTestSend: fal
|
|
|
63
63
|
return (0, _client_js_1.parseNotificationSendResponse)(response);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
exports.sendNotification = sendNotification;
|
|
67
66
|
//# sourceMappingURL=sendNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":";AAAA,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G,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,IAAA,0BAAa,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAEpB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAA,0CAA6B,EAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DirectSendNotificationOptions, SendNotificationOptions } from \"../models/options.js\";\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./internal/_client.js\";\nimport {\n isDirectSendNotificationOptions,\n isSendNotificationOptions,\n} from \"../utils/optionUtils.js\";\nimport { BrowserPushChannel } from \"../models/installation.js\";\nimport { NonNullableRecord } from \"../utils/utils.js\";\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { createMultipartDirectNotification } from \"../utils/notificationUtils.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param context - The Notification Hubs client.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendNotification(\n context: NotificationHubsClientContext,\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions = { enableTestSend: false },\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.sendNotification`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/messages/\";\n\n // Check if batch direct send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.pathname += \"$batch\";\n }\n\n // Check for test send\n if (isSendNotificationOptions(options) && options.enableTestSend) {\n endpoint.searchParams.append(\"test\", \"true\");\n }\n\n const headers = await context.createHeaders(\n \"sendNotification\",\n notification.headers as NonNullableRecord,\n );\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n let body = notification.body;\n let contentType: string = notification.contentType;\n\n // Check for direct batch send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n const boundary = `nh-boundary-${randomUUID()}`;\n contentType = `multipart/mixed; boundary = \"${boundary}\"`;\n body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);\n } else if (isDirectSendNotificationOptions(options)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n\n if (notification.platform === \"browser\") {\n const browserHandle = options.deviceHandle as BrowserPushChannel;\n headers.set(\"ServiceBusNotification-DeviceHandle\", browserHandle.endpoint);\n headers.set(\"Auth\", browserHandle.auth);\n headers.set(\"P256DH\", browserHandle.p256dh);\n } else {\n headers.set(\"ServiceBusNotification-DeviceHandle\", options.deviceHandle as string);\n }\n } else if (isSendNotificationOptions(options)) {\n if (options.tagExpression) {\n headers.set(\"ServiceBusNotification-Tags\", options.tagExpression);\n }\n }\n\n headers.set(\"Content-Type\", contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.submitNotificationHubJob =
|
|
5
|
+
exports.submitNotificationHubJob = submitNotificationHubJob;
|
|
6
6
|
const _client_js_1 = require("./internal/_client.js");
|
|
7
7
|
const notificationHubJobSerializer_js_1 = require("../serializers/notificationHubJobSerializer.js");
|
|
8
8
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
@@ -27,5 +27,4 @@ function submitNotificationHubJob(context, job, options = {}) {
|
|
|
27
27
|
return (0, notificationHubJobSerializer_js_1.parseNotificationHubJobEntry)(response.bodyAsText);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
exports.submitNotificationHubJob = submitNotificationHubJob;
|
|
31
30
|
//# sourceMappingURL=submitNotificationHubJob.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitNotificationHubJob.js","sourceRoot":"","sources":["../../../src/api/submitNotificationHubJob.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"submitNotificationHubJob.js","sourceRoot":"","sources":["../../../src/api/submitNotificationHubJob.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAsBlC,4DAsBC;AA1CD,sDAAmE;AACnE,oGAGwD;AAIxD,oDAAoD;AAEpD,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CACtC,OAAsC,EACtC,GAAuB,EACvB,UAA4B,EAAE;IAE9B,OAAO,0BAAa,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,OAAO,CAAC;QAE7B,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,IAAA,0BAAa,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,IAAA,kEAAgC,EAAC,GAAG,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAA,8DAA4B,EAAC,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 {\n parseNotificationHubJobEntry,\n serializeNotificationHubJobEntry,\n} from \"../serializers/notificationHubJobSerializer.js\";\nimport { NotificationHubJob } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"submitNotificationHubJob\";\n\n/**\n * Submits a Notification Hub Job.\n * Note: this is available to Standard SKU namespace and above.\n * @param context - The Notification Hubs client.\n * @param job - The notification hub job to submit.\n * @param options - The operation options.\n * @returns The notification hub job details including job ID and status.\n */\nexport function submitNotificationHubJob(\n context: NotificationHubsClientContext,\n job: NotificationHubJob,\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\";\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, \"POST\", headers, updatedOptions);\n request.body = serializeNotificationHubJobEntry(job);\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationHubJobEntry(response.bodyAsText!);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.updateInstallation =
|
|
5
|
+
exports.updateInstallation = updateInstallation;
|
|
6
6
|
const _client_js_1 = require("./internal/_client.js");
|
|
7
7
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
8
8
|
const OPERATION_NAME = "updateInstallation";
|
|
@@ -26,5 +26,4 @@ function updateInstallation(context, installationId, installationPatches, option
|
|
|
26
26
|
return (0, _client_js_1.parseNotificationResponse)(response);
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
exports.updateInstallation = updateInstallation;
|
|
30
29
|
//# sourceMappingURL=updateInstallation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateInstallation.js","sourceRoot":"","sources":["../../../src/api/updateInstallation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"updateInstallation.js","sourceRoot":"","sources":["../../../src/api/updateInstallation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,gDAuBC;AAxCD,sDAA8F;AAK9F,oDAAoD;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,mBAAgC,EAChC,UAA4B,EAAE;IAE9B,OAAO,0BAAa,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,IAAA,0BAAa,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAA,sCAAyB,EAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { JsonPatch } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"updateInstallation\";\n\n/**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param context - The Notification Hubs client.\n * @param installationId - The ID of the installation to update.\n * @param installationPatches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function updateInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n installationPatches: JsonPatch[],\n options: OperationOptions = {},\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"PATCH\", headers, updatedOptions);\n request.body = JSON.stringify(installationPatches);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.updateRegistration =
|
|
5
|
+
exports.updateRegistration = updateRegistration;
|
|
6
6
|
const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
|
7
7
|
const _createOrUpdateRegistrationDescription_js_1 = require("./internal/_createOrUpdateRegistrationDescription.js");
|
|
8
8
|
const tracing_js_1 = require("../utils/tracing.js");
|
|
@@ -22,5 +22,4 @@ function updateRegistration(context, registration, options = {}) {
|
|
|
22
22
|
return (0, _createOrUpdateRegistrationDescription_js_1.createOrUpdateRegistrationDescription)(context, registration, "update", updatedOptions);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
exports.updateRegistration = updateRegistration;
|
|
26
25
|
//# sourceMappingURL=updateRegistration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateRegistration.js","sourceRoot":"","sources":["../../../src/api/updateRegistration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"updateRegistration.js","sourceRoot":"","sources":["../../../src/api/updateRegistration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkBlC,gDAeC;AA5BD,kEAAsD;AACtD,oHAA6G;AAC7G,oDAAoD;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,0BAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,8BAAS,CAAC,0CAA0C,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,IAAA,iFAAqC,EAAC,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-rest/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"updateRegistration\";\n\n/**\n * Updates an existing registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\nexport function updateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {},\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n if (!registration.etag) {\n throw new RestError(\"ETag is required for registration update\", { statusCode: 400 });\n }\n return createOrUpdateRegistrationDescription(context, registration, \"update\", updatedOptions);\n },\n );\n}\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.createTokenCredentialFromConnection = createTokenCredentialFromConnection;
|
|
6
|
+
exports.parseNotificationHubsConnectionString = parseNotificationHubsConnectionString;
|
|
6
7
|
const sasTokenCredential_js_1 = require("./sasTokenCredential.js");
|
|
7
8
|
/**
|
|
8
9
|
* Parses the connection string and returns an object of type T.
|
|
@@ -49,7 +50,6 @@ function parseConnectionString(connectionString) {
|
|
|
49
50
|
function createTokenCredentialFromConnection(sharedAccessKey, sharedAccessKeyName) {
|
|
50
51
|
return new sasTokenCredential_js_1.SasTokenCredential({ sharedAccessKey, sharedAccessKeyName });
|
|
51
52
|
}
|
|
52
|
-
exports.createTokenCredentialFromConnection = createTokenCredentialFromConnection;
|
|
53
53
|
/**
|
|
54
54
|
* Parses given connection string into the different properties applicable to Azure Service Bus.
|
|
55
55
|
* The properties are useful to then construct a ServiceBusClient.
|
|
@@ -74,5 +74,4 @@ function parseNotificationHubsConnectionString(connectionString) {
|
|
|
74
74
|
};
|
|
75
75
|
return output;
|
|
76
76
|
}
|
|
77
|
-
exports.parseNotificationHubsConnectionString = parseNotificationHubsConnectionString;
|
|
78
77
|
//# sourceMappingURL=connectionStringUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/auth/connectionStringUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/auth/connectionStringUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmFlC,kFAKC;AAQD,sFA2BC;AAzHD,mEAA6D;AAO7D;;;;;;;;;;;;;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,CAAC;QACvB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEnB,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YAChB,qBAAqB;YACrB,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC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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 { SasTokenCredential } from \"./sasTokenCredential.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 SasTokenCredential 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 SasTokenCredential with the given shared access token information.\n */\nexport function createTokenCredentialFromConnection(\n sharedAccessKey: string,\n sharedAccessKeyName: string,\n): SasTokenCredential {\n return new SasTokenCredential({ 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"]}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.signString =
|
|
5
|
+
exports.signString = signString;
|
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
|
7
7
|
async function signString(key, toSign) {
|
|
8
8
|
const hmac = (0, node_crypto_1.createHmac)("sha256", key).update(toSign).digest("base64");
|
|
9
9
|
return encodeURIComponent(hmac);
|
|
10
10
|
}
|
|
11
|
-
exports.signString = signString;
|
|
12
11
|
//# sourceMappingURL=hmacSha256.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"hmacSha256.js","sourceRoot":"","sources":["../../../src/auth/hmacSha256.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,gCAGC;AALD,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","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"]}
|