@azure/eventgrid-namespaces 1.0.0-alpha.20240606.2 → 1.0.0-alpha.20240610.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Key links:
8
8
 
9
9
  - [Source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/eventgrid/eventgrid-namespaces/)
10
10
  - [Package (NPM)](https://www.npmjs.com/package/@azure/eventgrid-namespaces)
11
- - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/eventgrid/)
11
+ - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/eventgrid-namespaces/)
12
12
  - [Product documentation](https://docs.microsoft.com/azure/event-grid/)
13
13
  - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventgrid/eventgrid-namespaces/samples)
14
14
 
@@ -48,9 +48,9 @@ Install the Azure Event Grid Namespaces client library for JavaScript with `npm`
48
48
  npm install @azure/eventgrid-namespaces
49
49
  ```
50
50
 
51
- ### Create and authenticate a `EventGridNamespacesClient`
51
+ ### Create and authenticate Namespace clients
52
52
 
53
- To create a client object to access the Event Grid Namespaces API, you will need the `endpoint` of your Event Grid topic and a `credential`. The Event Grid client can use an Access Key.
53
+ To create a client object to access the Event Grid Namespaces API, you will need the `endpoint` of your Event Grid topic and a `credential`. The Event Grid Namespaces clients can use an Access Key.
54
54
 
55
55
  You can find the endpoint for your Event Grid topic either in the [Azure Portal][azure_portal] or by using the [Azure CLI][azure_cli] snippet below:
56
56
 
@@ -69,9 +69,14 @@ az eventgrid topic key list --resource-group <your-resource-group-name> --name <
69
69
  Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
70
70
 
71
71
  ```js
72
- const { EventGridClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
72
+ const { EventGridSenderClient, EventGridReceiverClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
73
73
 
74
- const client = new EventGridClient(
74
+ const eventGridSenderClient = new EventGridSenderClient(
75
+ "<endpoint>",
76
+ new AzureKeyCredential("<Access Key>")
77
+ );
78
+
79
+ const eventGridReceiverClient = new EventGridReceiverClient(
75
80
  "<endpoint>",
76
81
  new AzureKeyCredential("<Access Key>")
77
82
  );
@@ -86,25 +91,45 @@ With the `@azure/identity` package, you can seamlessly authorize requests in bot
86
91
  For example, use can use `DefaultAzureCredential` to construct a client which will authenticate using Azure Active Directory:
87
92
 
88
93
  ```js
89
- const { EventGridClient } = require("@azure/eventgrid-namespaces");
94
+ const { EventGridSenderClient, EventGridReceiverClient } = require("@azure/eventgrid-namespaces");
90
95
  const { DefaultAzureCredential } = require("@azure/identity");
91
96
 
92
- const client = new EventGridClient(
97
+ const eventGridSenderClient = new EventGridSenderClient(
98
+ "<endpoint>",
99
+ new DefaultAzureCredential(),
100
+ "<topicName>"
101
+ );
102
+
103
+ const eventGridReceiverClient = new EventGridReceiverClient(
93
104
  "<endpoint>",
94
- new DefaultAzureCredential()
105
+ new DefaultAzureCredential(),
106
+ "<topicName>",
107
+ "<subscriptionName>"
95
108
  );
96
109
  ```
97
110
 
98
111
  ## Key concepts
99
112
 
100
- ### EventGridNamespacesClient
113
+ ### Sending and Receiving Events
114
+
115
+ `EventGridSenderClient` can be used for sending events to an Event Grid. You can initialize it as:
116
+
117
+ ```js
118
+ const eventGridSenderClient = new EventGridSenderClient(
119
+ "<endpoint>",
120
+ new AzureKeyCredential("<API Key>"),
121
+ "<topicName>"
122
+ );
123
+ ```
101
124
 
102
- `EventGridNamespacesClient` is used sending events to an Event Grid. You can initialize it as:
125
+ `EventGridReceiverClient` can be used for receiving events from an Event Grid. You can initialize it as:
103
126
 
104
127
  ```js
105
- const client = new EventGridClient(
128
+ const eventGridReceiverClient = new EventGridReceiverClient(
106
129
  "<endpoint>",
107
- new AzureKeyCredential("<API Key>")
130
+ new AzureKeyCredential("<API Key>"),
131
+ "<topicName>",
132
+ "<subscriptionName>"
108
133
  );
109
134
  ```
110
135
 
@@ -121,11 +146,12 @@ This library has been tested and validated on [Kubernetes using Azure Arc][event
121
146
  ### Publish an Event to an Event Grid Topic
122
147
 
123
148
  ```js
124
- const { EventGridClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
149
+ const { EventGridSenderClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
125
150
 
126
- const client = new EventGridClient(
151
+ const client = new EventGridSenderClient(
127
152
  "<endpoint>",
128
- new AzureKeyCredential("<API key>")
153
+ new AzureKeyCredential("<API key>"),
154
+ "<topicName>"
129
155
  );
130
156
 
131
157
  const cloudEvent: CloudEvent = {
@@ -139,7 +165,7 @@ const cloudEvent: CloudEvent = {
139
165
  specversion: "1.0",
140
166
  };
141
167
  // Publish the Cloud Event
142
- await client.publishCloudEvent(cloudEvent, topicName);
168
+ await client.sendEvents(cloudEvent);
143
169
  ```
144
170
 
145
171
  ## Troubleshooting
package/dist/index.js CHANGED
@@ -438,10 +438,9 @@ function cloudEventDistributedTracingEnricherPolicy() {
438
438
  */
439
439
  class EventGridSenderClient {
440
440
  /** Azure Messaging EventGrid Client */
441
- constructor(endpoint, credential, options = {}) {
442
- var _a;
441
+ constructor(endpoint, credential, topicName, options = {}) {
443
442
  this._client = new EventGridClient(endpoint, credential, options);
444
- this._topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : undefined;
443
+ this._topicName = topicName;
445
444
  this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
446
445
  afterPolicies: [coreRestPipeline.tracingPolicyName],
447
446
  });
@@ -458,21 +457,16 @@ class EventGridSenderClient {
458
457
  *
459
458
  */
460
459
  async sendEvents(events, options = { requestOptions: {} }) {
461
- var _a;
462
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
463
- if (!topicName) {
464
- throw new Error("Topic name is required");
465
- }
466
460
  if (Array.isArray(events)) {
467
461
  const eventsWireModel = [];
468
462
  for (const individualevent of events) {
469
463
  eventsWireModel.push(convertCloudEventToModelType(individualevent));
470
464
  }
471
- await this._client.publishCloudEvents(topicName, eventsWireModel, options);
465
+ await this._client.publishCloudEvents(this._topicName, eventsWireModel, options);
472
466
  }
473
467
  else {
474
468
  const cloudEventWireModel = convertCloudEventToModelType(events);
475
- await this._client.publishCloudEvent(topicName, cloudEventWireModel, options);
469
+ await this._client.publishCloudEvent(this._topicName, cloudEventWireModel, options);
476
470
  }
477
471
  }
478
472
  }
@@ -511,11 +505,10 @@ function convertCloudEventToModelType(event) {
511
505
  */
512
506
  class EventGridReceiverClient {
513
507
  /** Azure Messaging EventGrid Client */
514
- constructor(endpoint, credential, options = {}) {
515
- var _a, _b;
508
+ constructor(endpoint, credential, topicName, subscriptionName, options = {}) {
516
509
  this._client = new EventGridClient(endpoint, credential, options);
517
- this._topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : undefined;
518
- this._eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : undefined;
510
+ this._topicName = topicName;
511
+ this._subscriptionName = subscriptionName;
519
512
  this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
520
513
  afterPolicies: [coreRestPipeline.tracingPolicyName],
521
514
  });
@@ -527,16 +520,7 @@ class EventGridReceiverClient {
527
520
  *
528
521
  */
529
522
  async receiveEvents(options = { requestOptions: {} }) {
530
- var _a, _b;
531
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
532
- if (!topicName) {
533
- throw new Error("Topic name is required");
534
- }
535
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
536
- if (!eventSubscriptionName) {
537
- throw new Error("Event Subscription name is required");
538
- }
539
- const result = await this._client.receiveCloudEvents(topicName, eventSubscriptionName, options);
523
+ const result = await this._client.receiveCloudEvents(this._topicName, this._subscriptionName, options);
540
524
  const modifiedResult = {
541
525
  details: result.details.map((receiveDetails) => {
542
526
  const cloudEvent = {
@@ -573,16 +557,7 @@ class EventGridReceiverClient {
573
557
  *
574
558
  */
575
559
  acknowledgeEvents(lockTokens, options = { requestOptions: {} }) {
576
- var _a, _b;
577
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
578
- if (!topicName) {
579
- throw new Error("Topic name is required");
580
- }
581
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
582
- if (!eventSubscriptionName) {
583
- throw new Error("Event Subscription name is required");
584
- }
585
- return this._client.acknowledgeCloudEvents(topicName, eventSubscriptionName, lockTokens, options);
560
+ return this._client.acknowledgeCloudEvents(this._topicName, this._subscriptionName, lockTokens, options);
586
561
  }
587
562
  /**
588
563
  * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is
@@ -594,16 +569,7 @@ class EventGridReceiverClient {
594
569
  *
595
570
  */
596
571
  releaseEvents(lockTokens, options = { requestOptions: {} }) {
597
- var _a, _b;
598
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
599
- if (!topicName) {
600
- throw new Error("Topic name is required");
601
- }
602
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
603
- if (!eventSubscriptionName) {
604
- throw new Error("Event Subscription name is required");
605
- }
606
- return this._client.releaseCloudEvents(topicName, eventSubscriptionName, lockTokens, Object.assign(Object.assign({}, options), { releaseDelayInSeconds: options.releaseDelay }));
572
+ return this._client.releaseCloudEvents(this._topicName, this._subscriptionName, lockTokens, Object.assign(Object.assign({}, options), { releaseDelayInSeconds: options.releaseDelay }));
607
573
  }
608
574
  /**
609
575
  * Reject batch of Cloud Events.
@@ -613,16 +579,7 @@ class EventGridReceiverClient {
613
579
  *
614
580
  */
615
581
  rejectEvents(lockTokens, options = { requestOptions: {} }) {
616
- var _a, _b;
617
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
618
- if (!topicName) {
619
- throw new Error("Topic name is required");
620
- }
621
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
622
- if (!eventSubscriptionName) {
623
- throw new Error("Event Subscription name is required");
624
- }
625
- return this._client.rejectCloudEvents(topicName, eventSubscriptionName, lockTokens, options);
582
+ return this._client.rejectCloudEvents(this._topicName, this._subscriptionName, lockTokens, options);
626
583
  }
627
584
  /**
628
585
  * Renew lock for batch of Cloud Events.
@@ -631,16 +588,7 @@ class EventGridReceiverClient {
631
588
  * @param options - Options to renew
632
589
  */
633
590
  renewEventLocks(lockTokens, options = { requestOptions: {} }) {
634
- var _a, _b;
635
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
636
- if (!topicName) {
637
- throw new Error("Topic name is required");
638
- }
639
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
640
- if (!eventSubscriptionName) {
641
- throw new Error("Event Subscription name is required");
642
- }
643
- return this._client.renewCloudEventLocks(topicName, eventSubscriptionName, lockTokens, options);
591
+ return this._client.renewCloudEventLocks(this._topicName, this._subscriptionName, lockTokens, options);
644
592
  }
645
593
  }
646
594
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/cadl-generated/logger.ts","../src/cadl-generated/rest/eventGridClient.ts","../src/cadl-generated/rest/isUnexpected.ts","../src/cadl-generated/api/EventGridContext.ts","../src/cadl-generated/api/operations.ts","../src/cadl-generated/EventGridClient.ts","../src/models.ts","../src/cloudEventDistrubtedTracingEnricherPolicy.ts","../src/eventGridSenderClient.ts","../src/eventGridReceiverClient.ts","../src/util.ts","../src/consumer.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"eventgrid-namespaces\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"../logger\";\nimport { TokenCredential, KeyCredential, isKeyCredential } from \"@azure/core-auth\";\nimport { EventGridContext } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `EventGridContext`\n * @param endpointParam - The host name of the namespace, e.g. namespaceName1.westus-1.eventgrid.azure.net\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): EventGridContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n options.apiVersion = options.apiVersion ?? \"2024-06-01\";\n const userAgentInfo = `azsdk-js-eventgrid-namespaces-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://eventgrid.azure.net/.default\"],\n apiKeyHeaderName: \"Authorization\",\n },\n };\n\n const client = getClient(endpointUrl, credentials, options) as EventGridContext;\n\n if (isKeyCredential(credentials)) {\n client.pipeline.addPolicy({\n name: \"customKeyCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", \"SharedAccessKey \" + credentials.key);\n return next(request);\n },\n });\n }\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n PublishCloudEvents200Response,\n PublishCloudEventsDefaultResponse,\n ReceiveCloudEvents200Response,\n ReceiveCloudEventsDefaultResponse,\n AcknowledgeCloudEvents200Response,\n AcknowledgeCloudEventsDefaultResponse,\n ReleaseCloudEvents200Response,\n ReleaseCloudEventsDefaultResponse,\n RejectCloudEvents200Response,\n RejectCloudEventsDefaultResponse,\n RenewCloudEventLocks200Response,\n RenewCloudEventLocksDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /topics/{topicName}:publish\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): response is PublishCloudEventDefaultResponse;\nexport function isUnexpected(\n response: PublishCloudEvents200Response | PublishCloudEventsDefaultResponse,\n): response is PublishCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse,\n): response is ReceiveCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse,\n): response is AcknowledgeCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse,\n): response is ReleaseCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: RejectCloudEvents200Response | RejectCloudEventsDefaultResponse,\n): response is RejectCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse,\n): response is RenewCloudEventLocksDefaultResponse;\nexport function isUnexpected(\n response:\n | PublishCloudEvent200Response\n | PublishCloudEventDefaultResponse\n | PublishCloudEvents200Response\n | PublishCloudEventsDefaultResponse\n | ReceiveCloudEvents200Response\n | ReceiveCloudEventsDefaultResponse\n | AcknowledgeCloudEvents200Response\n | AcknowledgeCloudEventsDefaultResponse\n | ReleaseCloudEvents200Response\n | ReleaseCloudEventsDefaultResponse\n | RejectCloudEvents200Response\n | RejectCloudEventsDefaultResponse\n | RenewCloudEventLocks200Response\n | RenewCloudEventLocksDefaultResponse,\n): response is\n | PublishCloudEventDefaultResponse\n | PublishCloudEventsDefaultResponse\n | ReceiveCloudEventsDefaultResponse\n | AcknowledgeCloudEventsDefaultResponse\n | ReleaseCloudEventsDefaultResponse\n | RejectCloudEventsDefaultResponse\n | RenewCloudEventLocksDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { EventGridContext } from \"../rest/index\";\nimport getClient from \"../rest/index\";\n\nexport interface EventGridClientOptions extends ClientOptions {\n /** The API version to use for this operation. */\n apiVersion?: string;\n}\n\nexport { EventGridContext } from \"../rest/index\";\n\n/** Azure Messaging EventGrid Client */\nexport function createEventGrid(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: EventGridClientOptions = {},\n): EventGridContext {\n const clientContext = getClient(endpointParam, credential, options);\n return clientContext;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"../models/models\";\nimport {\n isUnexpected,\n EventGridContext as Client,\n AcknowledgeCloudEvents200Response,\n AcknowledgeCloudEventsDefaultResponse,\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n PublishCloudEvents200Response,\n PublishCloudEventsDefaultResponse,\n ReceiveCloudEvents200Response,\n ReceiveCloudEventsDefaultResponse,\n RejectCloudEvents200Response,\n RejectCloudEventsDefaultResponse,\n ReleaseCloudEvents200Response,\n ReleaseCloudEventsDefaultResponse,\n RenewCloudEventLocks200Response,\n RenewCloudEventLocksDefaultResponse,\n} from \"../rest/index\";\nimport {\n StreamableMethod,\n operationOptionsToRequestParameters,\n createRestError,\n} from \"@azure-rest/core-client\";\nimport { uint8ArrayToString, stringToUint8Array } from \"@azure/core-util\";\nimport {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"../models/options\";\n\nexport function _publishCloudEventSend(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse> {\n return context.path(\"/topics/{topicName}:publish\", topicName).post({\n ...operationOptionsToRequestParameters(options),\n contentType: (options.contentType as any) ?? \"application/cloudevents+json; charset=utf-8\",\n body: {\n id: event[\"id\"],\n source: event[\"source\"],\n data: event[\"data\"],\n data_base64:\n event[\"dataBase64\"] !== undefined\n ? uint8ArrayToString(event[\"dataBase64\"], \"base64\")\n : undefined,\n type: event[\"type\"],\n time: event[\"time\"]?.toISOString(),\n specversion: event[\"specversion\"],\n dataschema: event[\"dataschema\"],\n datacontenttype: event[\"datacontenttype\"],\n subject: event[\"subject\"],\n },\n }) as StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse>;\n}\n\nexport async function _publishCloudEventDeserialize(\n result: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): Promise<PublishResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return result.body;\n}\n\n/** Publish a single Cloud Event to a namespace topic. */\nexport async function publishCloudEvent(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): Promise<PublishResult> {\n const result = await _publishCloudEventSend(context, topicName, event, options);\n return _publishCloudEventDeserialize(result);\n}\n\nexport function _publishCloudEventsSend(\n context: Client,\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse> {\n return context.path(\"/topics/{topicName}:publish\", topicName).post({\n ...operationOptionsToRequestParameters(options),\n contentType:\n (options.contentType as any) ?? \"application/cloudevents-batch+json; charset=utf-8\",\n body: (events ?? []).map((p) => {\n return {\n id: p[\"id\"],\n source: p[\"source\"],\n data: p[\"data\"],\n data_base64:\n p[\"dataBase64\"] !== undefined ? uint8ArrayToString(p[\"dataBase64\"], \"base64\") : undefined,\n type: p[\"type\"],\n time: p[\"time\"]?.toISOString(),\n specversion: p[\"specversion\"],\n dataschema: p[\"dataschema\"],\n datacontenttype: p[\"datacontenttype\"],\n subject: p[\"subject\"],\n };\n }),\n }) as StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse>;\n}\n\nexport async function _publishCloudEventsDeserialize(\n result: PublishCloudEvents200Response | PublishCloudEventsDefaultResponse,\n): Promise<PublishResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return result.body;\n}\n\n/** Publish a batch of Cloud Events to a namespace topic. */\nexport async function publishCloudEvents(\n context: Client,\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<PublishResult> {\n const result = await _publishCloudEventsSend(context, topicName, events, options);\n return _publishCloudEventsDeserialize(result);\n}\n\nexport function _receiveCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n queryParameters: {\n maxEvents: options?.maxEvents,\n maxWaitTime: options?.maxWaitTime,\n },\n });\n}\n\nexport async function _receiveCloudEventsDeserialize(\n result: ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse,\n): Promise<ReceiveResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n details: result.body[\"value\"].map((p) => ({\n brokerProperties: {\n lockToken: p.brokerProperties[\"lockToken\"],\n deliveryCount: p.brokerProperties[\"deliveryCount\"],\n },\n event: {\n id: p.event[\"id\"],\n source: p.event[\"source\"],\n data: p.event[\"data\"],\n dataBase64:\n typeof p.event[\"data_base64\"] === \"string\"\n ? stringToUint8Array(p.event[\"data_base64\"], \"base64\")\n : p.event[\"data_base64\"],\n type: p.event[\"type\"],\n time: p.event[\"time\"] !== undefined ? new Date(p.event[\"time\"]) : undefined,\n specversion: p.event[\"specversion\"],\n dataschema: p.event[\"dataschema\"],\n datacontenttype: p.event[\"datacontenttype\"],\n subject: p.event[\"subject\"],\n },\n })),\n };\n}\n\n/** Receive a batch of Cloud Events from a subscription. */\nexport async function receiveCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<ReceiveResult> {\n const result = await _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options);\n return _receiveCloudEventsDeserialize(result);\n}\n\nexport function _acknowledgeCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _acknowledgeCloudEventsDeserialize(\n result: AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse,\n): Promise<AcknowledgeResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Acknowledge a batch of Cloud Events. The response will include the set of successfully acknowledged lock tokens, along with other failed lock tokens with their corresponding error information. Successfully acknowledged events will no longer be available to be received by any consumer. */\nexport async function acknowledgeCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<AcknowledgeResult> {\n const result = await _acknowledgeCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _acknowledgeCloudEventsDeserialize(result);\n}\n\nexport function _releaseCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n queryParameters: {\n releaseDelayInSeconds: options?.releaseDelayInSeconds,\n },\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _releaseCloudEventsDeserialize(\n result: ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse,\n): Promise<ReleaseResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Release a batch of Cloud Events. The response will include the set of successfully released lock tokens, along with other failed lock tokens with their corresponding error information. Successfully released events can be received by consumers. */\nexport async function releaseCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<ReleaseResult> {\n const result = await _releaseCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _releaseCloudEventsDeserialize(result);\n}\n\nexport function _rejectCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<RejectCloudEvents200Response | RejectCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _rejectCloudEventsDeserialize(\n result: RejectCloudEvents200Response | RejectCloudEventsDefaultResponse,\n): Promise<RejectResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Reject a batch of Cloud Events. The response will include the set of successfully rejected lock tokens, along with other failed lock tokens with their corresponding error information. Successfully rejected events will be dead-lettered and can no longer be received by a consumer. */\nexport async function rejectCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<RejectResult> {\n const result = await _rejectCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _rejectCloudEventsDeserialize(result);\n}\n\nexport function _renewCloudEventLocksSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n): StreamableMethod<RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _renewCloudEventLocksDeserialize(\n result: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse,\n): Promise<RenewLocksResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Renew locks for a batch of Cloud Events. The response will include the set of successfully renewed lock tokens, along with other failed lock tokens with their corresponding error information. Successfully renewed locks will ensure that the associated event is only available to the consumer that holds the renewed lock. */\nexport async function renewCloudEventLocks(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n): Promise<RenewLocksResult> {\n const result = await _renewCloudEventLocksSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _renewCloudEventLocksDeserialize(result);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./models/models\";\nimport {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./models/options\";\nimport {\n createEventGrid,\n EventGridClientOptions,\n EventGridContext,\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n renewCloudEventLocks,\n} from \"./api/index\";\n\nexport { EventGridClientOptions } from \"./api/EventGridContext\";\n\nexport class EventGridClient {\n private _client: EventGridContext;\n\n getClient(): EventGridContext {\n return this._client;\n }\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: EventGridClientOptions = {},\n ) {\n this._client = createEventGrid(endpointParam, credential, options);\n this.pipeline = this._client.pipeline;\n }\n\n /** Publish a single Cloud Event to a namespace topic. */\n publishCloudEvent(\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n ): Promise<PublishResult> {\n return publishCloudEvent(this._client, topicName, event, options);\n }\n\n /** Publish a batch of Cloud Events to a namespace topic. */\n publishCloudEvents(\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<PublishResult> {\n return publishCloudEvents(this._client, topicName, events, options);\n }\n\n /** Receive a batch of Cloud Events from a subscription. */\n receiveCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<ReceiveResult> {\n return receiveCloudEvents(this._client, topicName, eventSubscriptionName, options);\n }\n\n /** Acknowledge a batch of Cloud Events. The response will include the set of successfully acknowledged lock tokens, along with other failed lock tokens with their corresponding error information. Successfully acknowledged events will no longer be available to be received by any consumer. */\n acknowledgeCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n return acknowledgeCloudEvents(\n this._client,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n\n /** Release a batch of Cloud Events. The response will include the set of successfully released lock tokens, along with other failed lock tokens with their corresponding error information. Successfully released events can be received by consumers. */\n releaseCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n return releaseCloudEvents(this._client, topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /** Reject a batch of Cloud Events. The response will include the set of successfully rejected lock tokens, along with other failed lock tokens with their corresponding error information. Successfully rejected events will be dead-lettered and can no longer be received by a consumer. */\n rejectCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<RejectResult> {\n return rejectCloudEvents(this._client, topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /** Renew locks for a batch of Cloud Events. The response will include the set of successfully renewed lock tokens, along with other failed lock tokens with their corresponding error information. Successfully renewed locks will ensure that the associated event is only available to the consumer that holds the renewed lock. */\n renewCloudEventLocks(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n return renewCloudEventLocks(\n this._client,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport {\n BrokerProperties,\n PublishCloudEventOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n EventGridClientOptions as EventGridOptions,\n ReleaseDelay,\n} from \"./cadl-generated\";\n\n/** Send Event Options */\nexport interface SendEventOptions extends OperationOptions {\n /** Content type */\n contentType?: string;\n\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Sender Client Options */\nexport interface EventGridSenderClientOptions extends EventGridOptions {\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Receiver Client Options */\nexport interface EventGridReceiverClientOptions extends EventGridOptions {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Send Events Options */\nexport interface SendEventsOptions extends PublishCloudEventOptionalParams {\n /** Topic name */\n topicName?: string;\n}\n\n/** Receive Events Options */\nexport interface ReceiveEventsOptions extends ReceiveCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Acknowledge Events Options */\nexport interface AcknowledgeEventsOptions extends AcknowledgeCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Release Events Options */\nexport interface ReleaseEventsOptions extends OperationOptions {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n\n /** Release events with the specified delay in seconds. */\n releaseDelay?: ReleaseDelay;\n}\n\n/** Reject Events Options */\nexport interface RejectEventsOptions extends RejectCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Renew Event Locks Options */\nexport interface RenewEventLocksOptions extends RenewCloudEventLocksOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Known values of {@link ReleaseDelay} that the service accepts. */\nexport const enum KnownReleaseDelay {\n /** Ten Minutes */\n TenMinutes = \"600\",\n\n /** One Minute */\n OneMinute = \"60\",\n\n /** Ten Seconds */\n TenSeconds = \"10\",\n\n /** One Hour */\n OneHour = \"3600\",\n\n /** No Delay */\n NoDelay = \"0\",\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails<T> {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent<T>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataSchema?: string;\n /**\n * Content type of data value.\n */\n dataContentType?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n /**\n * The version of the CloudEvents specification which the event uses.\n */\n specVersion?: string | \"1.0\";\n}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult<T> {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails<T>[];\n}\n\nexport const cloudEventReservedPropertyNames = [\n \"specVersion\",\n \"id\",\n \"source\",\n \"type\",\n \"dataContentType\",\n \"dataSchema\",\n \"subject\",\n \"time\",\n \"data\",\n];\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\nexport const CloudEventBatchContentType = \"application/cloudevents-batch+json; charset=utf-8\";\nexport const TraceParentHeaderName = \"traceparent\";\nexport const TraceStateHeaderName = \"tracestate\";\nexport const ContentTypeHeaderName = \"Content-Type\";\n\n/**\n * The programmatic identifier of the cloudEventDistributedTracingEnricherPolicy.\n */\nexport const cloudEventDistributedTracingEnricherPolicyName =\n \"cloudEventDistributedTracingEnricherPolicy\";\n\n/**\n * cloudEventDistributedTracingEnricherPolicy is a policy which adds distributed tracing information\n * to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties\n * from the HTTP request into the individual events as extension properties.\n *\n * This will only happen in the case where an event does not have a `traceparent` defined already. This\n * allows events to explicitly set a traceparent and tracestate which would be respected during \"multi-hop\n * transmition\".\n *\n * See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md\n * for more information on distributed tracing and cloud events.\n */\nexport function cloudEventDistributedTracingEnricherPolicy(): PipelinePolicy {\n return {\n name: cloudEventDistributedTracingEnricherPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const traceparent = request.headers.get(TraceParentHeaderName);\n const tracestate = request.headers.get(TraceStateHeaderName);\n\n if (\n request.headers.get(ContentTypeHeaderName) === CloudEventBatchContentType &&\n typeof request.body === \"string\" &&\n traceparent\n ) {\n // per the cloud event batched content type we know the body is an array encoded in JSON.\n const parsedBody = JSON.parse(request.body) as any[];\n\n for (const item of parsedBody) {\n // When using the distributed tracing extension, the \"traceparent\" is a required property\n // and \"tracestate\" is optional. This means if an item already has a \"traceparent\" property\n // we should not stomp over it. Well formed events will not have a \"tracestate\" without\n // also having a \"traceparent\" so there's no need to guard against that case.\n if (typeof item !== \"object\" || item.traceparent) {\n continue;\n }\n\n item.traceparent = traceparent;\n if (tracestate) {\n item.tracestate = tracestate;\n }\n }\n\n request.body = JSON.stringify(parsedBody);\n }\n\n return next(request);\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n SendEventsOptions,\n CloudEvent,\n cloudEventReservedPropertyNames,\n EventGridSenderClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridSenderClient {\n private _client: EventGridClientGenerated;\n private _topicName: string | undefined;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n options: EventGridSenderClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = options?.topicName ?? undefined;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Publish Cloud Events to namespace topic. In case of success, the server responds with an HTTP 200\n * status code with an empty JSON object in response. Otherwise, the server can return various error codes.\n * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message\n * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for\n * internal server error.\n *\n * @param events - Events to publish\n * @param options - Options to publish\n *\n */\n async sendEvents<T>(\n events: CloudEvent<T>[] | CloudEvent<T>,\n options: SendEventsOptions = { requestOptions: {} },\n ): Promise<void> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n if (Array.isArray(events)) {\n const eventsWireModel: Array<CloudEventWireModel> = [];\n for (const individualevent of events) {\n eventsWireModel.push(convertCloudEventToModelType(individualevent));\n }\n await this._client.publishCloudEvents(topicName, eventsWireModel, options);\n } else {\n const cloudEventWireModel: CloudEventWireModel = convertCloudEventToModelType(events);\n await this._client.publishCloudEvent(topicName, cloudEventWireModel, options);\n }\n }\n}\n\nexport function convertCloudEventToModelType<T>(event: CloudEvent<T>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: event.specVersion ?? \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? randomUUID(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataSchema,\n datacontenttype: event.dataContentType,\n ...(event.extensionAttributes ?? []),\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.dataContentType) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\",\n );\n }\n\n converted.datacontenttype = event.dataContentType;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype =\n event.dataContentType ?? \"application/cloudevents+json; charset=utf-8\";\n converted.data = event.data;\n }\n\n return converted;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n CloudEvent,\n ReceiveResult,\n ReceiveEventsOptions,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridReceiverClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridReceiverClient {\n private _client: EventGridClientGenerated;\n private _topicName: string | undefined;\n private _eventSubscriptionName: string | undefined;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n options: EventGridReceiverClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = options?.topicName ?? undefined;\n this._eventSubscriptionName = options?.eventSubscriptionName ?? undefined;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Receive Batch of Cloud Events from the Event Subscription.\n *\n * @param options - Options to receive\n *\n */\n async receiveEvents<T>(\n options: ReceiveEventsOptions = { requestOptions: {} },\n ): Promise<ReceiveResult<T>> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n const result = await this._client.receiveCloudEvents(topicName, eventSubscriptionName, options);\n\n const modifiedResult: ReceiveResult<T> = {\n details: result.details.map((receiveDetails) => {\n const cloudEvent: CloudEvent<T> = {\n type: receiveDetails.event.type,\n source: receiveDetails.event.source,\n id: receiveDetails.event.id,\n time: receiveDetails.event.time,\n dataSchema: receiveDetails.event.dataschema,\n dataContentType: receiveDetails.event.datacontenttype,\n subject: receiveDetails.event.subject,\n specVersion: receiveDetails.event.specversion,\n data: receiveDetails.event.data\n ? (receiveDetails.event.data as T)\n : receiveDetails.event.dataBase64\n ? (uint8ArrayToString(receiveDetails.event.dataBase64, \"base64\") as T)\n : undefined,\n };\n return {\n brokerProperties: receiveDetails.brokerProperties,\n event: cloudEvent,\n };\n }),\n };\n\n return modifiedResult;\n }\n\n /**\n * Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one\n * event is successfully acknowledged. The response body will include the set of successfully acknowledged\n * lockTokens, along with other failed lockTokens with their corresponding error information. Successfully\n * acknowledged events will no longer be available to any consumer.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to Acknowledge\n *\n */\n acknowledgeEvents(\n lockTokens: string[],\n options: AcknowledgeEventsOptions = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.acknowledgeCloudEvents(\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is\n * successfully released. The response body will include the set of successfully released lockTokens, along\n * with other failed lockTokens with their corresponding error information.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to release\n *\n */\n releaseEvents(\n lockTokens: string[],\n options: ReleaseEventsOptions = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.releaseCloudEvents(topicName, eventSubscriptionName, lockTokens, {\n ...options,\n releaseDelayInSeconds: options.releaseDelay,\n });\n }\n\n /**\n * Reject batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to reject\n *\n */\n rejectEvents(\n lockTokens: string[],\n options: RejectEventsOptions = { requestOptions: {} },\n ): Promise<RejectResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.rejectCloudEvents(topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /**\n * Renew lock for batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to renew\n */\n renewEventLocks(\n lockTokens: string[],\n options: RenewEventLocksOptions = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.renewCloudEventLocks(topicName, eventSubscriptionName, lockTokens, options);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { CompositeMapper } from \"@azure/core-client\";\n\n/**\n * Stringifies a Date object in the format expected by the Event Grid service, for use in a Shared Access Signiture.\n *\n * The service expects this time string to be in the same format as what is returned by the .NET DateTime.ToString\n * method, using the \"en-US\" culture.\n *\n * This corresponds to the .NET format string: \"M/d/yyyy h:mm:ss tt\". For example, the date \"June 5th, 2020, 12:09:03 PM\"\n * is represented as the string \"6/5/2020 12:09:03 PM\"\n *\n * The service expects a UTC time, so this method returns a string based on the UTC time of the provided Date.\n *\n * @param d - The Date object to convert to a string.\n */\nexport function dateToServiceTimeString(d: Date): string {\n const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12.\n const day = d.getUTCDate();\n const year = d.getUTCFullYear();\n\n const hour = d.getUTCHours() === 0 || d.getUTCHours() === 12 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.\n const minute = d.getUTCMinutes().toString().padStart(2, \"0\");\n const second = d.getUTCSeconds().toString().padStart(2, \"0\");\n const am = d.getUTCHours() >= 12 ? \"PM\" : \"AM\";\n\n return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;\n}\n\n/**\n * Returns `true` if the credential object is like the KeyCredential interface (i.e. it has a\n * key property).\n *\n * @param credential - The object to test\n */\nexport function isKeyCredentialLike(o: unknown): o is KeyCredential {\n const castO = o as {\n key: unknown;\n };\n return castO.key !== undefined;\n}\n\nexport function parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any[] {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n return o;\n } else {\n return [o];\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n return jsonStringOrObject;\n } else {\n return [jsonStringOrObject];\n }\n}\n\nconst CLOUD_EVENT_1_0_SPEC_VERSION = \"1.0\";\n\nexport function validateCloudEventEvent(o: unknown): void {\n validateRequiredStringProperties(o, [\"type\", \"source\", \"id\", \"specVersion\"]);\n validateOptionalStringProperties(o, [\"time\", \"dataSchema\", \"dataContentType\", \"subject\"]);\n\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n specVersion: unknown;\n };\n\n if (castO.specVersion !== CLOUD_EVENT_1_0_SPEC_VERSION) {\n throw new Error(\"event is not in the Cloud Event 1.0 schema\");\n }\n}\n\nfunction validateRequiredStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n\n if (typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName} should be a 'string', but is '${typeof o[propertyName]}'`,\n );\n }\n }\n}\n\nfunction validateOptionalStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] !== \"undefined\" && typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName}' should be a 'string' but it is a '${typeof o[\n propertyName\n ]}'`,\n );\n }\n }\n}\n\nexport const CloudEvent: CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CloudEvent\",\n additionalProperties: { type: { name: \"Object\" } },\n modelProperties: {\n id: {\n serializedName: \"id\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n source: {\n serializedName: \"source\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n data: {\n serializedName: \"data\",\n type: {\n name: \"any\",\n },\n },\n dataBase64: {\n serializedName: \"data_base64\",\n type: {\n name: \"ByteArray\",\n },\n },\n type: {\n serializedName: \"type\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n time: {\n serializedName: \"time\",\n type: {\n name: \"DateTime\",\n },\n },\n specversion: {\n serializedName: \"specversion\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n dataschema: {\n serializedName: \"dataschema\",\n type: {\n name: \"String\",\n },\n },\n datacontenttype: {\n serializedName: \"datacontenttype\",\n type: {\n name: \"String\",\n },\n },\n subject: {\n serializedName: \"subject\",\n type: {\n name: \"String\",\n },\n },\n },\n },\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { CloudEvent, cloudEventReservedPropertyNames } from \"./models\";\nimport { CloudEvent as CloudEventMapper, parseAndWrap, validateCloudEventEvent } from \"./util\";\n\nconst serializer = createSerializer();\n\n/**\n * EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload\n * of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an\n * `EventGridEvent` or `CloudEvent` like object.\n *\n * Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:\n *\n * - The consumer parses the event time property into a `Date` object, for ease of use.\n * - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded\n * and returned as an instance of the `Uint8Array` type.\n */\nexport class EventGridDeserializer {\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Cloud Events 1.0 Schema.\n */\n public async deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Cloud Events 1.0 schema.\n */\n public async deserializeCloudEvents(\n encodedEvents: Record<string, unknown>,\n ): Promise<CloudEvent<unknown>[]>;\n public async deserializeCloudEvents(\n encodedEvents: string | Record<string, unknown>,\n ): Promise<CloudEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: CloudEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateCloudEventEvent(o);\n\n // Check that the required fields are present and of the correct type and the optional fields are missing\n // or of the correct type.\n\n const deserialized = serializer.deserialize(CloudEventMapper, o, \"\");\n const modelEvent: Record<string, any> = {\n specversion: deserialized.specversion,\n id: deserialized.id,\n source: deserialized.source,\n type: deserialized.type,\n };\n\n if (deserialized.datacontenttype !== undefined) {\n modelEvent.datacontenttype = deserialized.datacontenttype;\n }\n\n if (deserialized.dataschema !== undefined) {\n modelEvent.dataschema = deserialized.dataschema;\n }\n\n if (deserialized.subject !== undefined) {\n modelEvent.subject = deserialized.subject;\n }\n\n if (deserialized.time !== undefined) {\n modelEvent.time = deserialized.time;\n }\n\n if (deserialized.data !== undefined) {\n modelEvent.data = deserialized.data;\n }\n\n // If the data the event represents binary, it is encoded as base64 text in a different property on the event and we need to transform it.\n if (deserialized.dataBase64 !== undefined) {\n if (deserialized.data !== undefined) {\n throw new TypeError(\"event contains both a data and data_base64 field\");\n }\n\n if (!(deserialized.dataBase64 instanceof Uint8Array)) {\n throw new TypeError(\"event data_base64 property is not an instance of Uint8Array\");\n }\n\n modelEvent.data = deserialized.dataBase64;\n }\n\n // Build the \"extensionsAttributes\" property bag by removing all known top level properties.\n const extensionAttributes = { ...deserialized };\n for (const propName of cloudEventReservedPropertyNames) {\n delete extensionAttributes[propName];\n }\n delete extensionAttributes.dataBase64;\n\n // If any properties remain, copy them to the model.\n if (Object.keys(extensionAttributes).length > 0) {\n modelEvent.extensionAttributes = extensionAttributes;\n }\n\n events.push(modelEvent as CloudEvent<unknown>);\n }\n\n return events;\n }\n}\n"],"names":["createClientLogger","getClient","isKeyCredential","operationOptionsToRequestParameters","uint8ArrayToString","createRestError","stringToUint8Array","EventGridClientGenerated","tracingPolicyName","randomUUID","createSerializer","CloudEventMapper"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,sBAAsB,CAAC;;ACJhE;AACA;AAOA;;;;;AAKG;AAC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pF;AAED,gBAAA,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,UAAU,CAAC;aAC3C;;AAGD,YAAA,MAAM,mBAAmB,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,YAAY,CAAE,CAAC;AAChD,YAAA,KAAK,MAAM,QAAQ,IAAI,+BAA+B,EAAE;AACtD,gBAAA,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;aACtC;YACD,OAAO,mBAAmB,CAAC,UAAU,CAAC;;YAGtC,IAAI,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/C,gBAAA,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;aACtD;AAED,YAAA,MAAM,CAAC,IAAI,CAAC,UAAiC,CAAC,CAAC;SAChD;AAED,QAAA,OAAO,MAAM,CAAC;KACf;AACF;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/cadl-generated/logger.ts","../src/cadl-generated/rest/eventGridClient.ts","../src/cadl-generated/rest/isUnexpected.ts","../src/cadl-generated/api/EventGridContext.ts","../src/cadl-generated/api/operations.ts","../src/cadl-generated/EventGridClient.ts","../src/models.ts","../src/cloudEventDistrubtedTracingEnricherPolicy.ts","../src/eventGridSenderClient.ts","../src/eventGridReceiverClient.ts","../src/util.ts","../src/consumer.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"eventgrid-namespaces\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"../logger\";\nimport { TokenCredential, KeyCredential, isKeyCredential } from \"@azure/core-auth\";\nimport { EventGridContext } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `EventGridContext`\n * @param endpointParam - The host name of the namespace, e.g. namespaceName1.westus-1.eventgrid.azure.net\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): EventGridContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n options.apiVersion = options.apiVersion ?? \"2024-06-01\";\n const userAgentInfo = `azsdk-js-eventgrid-namespaces-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://eventgrid.azure.net/.default\"],\n apiKeyHeaderName: \"Authorization\",\n },\n };\n\n const client = getClient(endpointUrl, credentials, options) as EventGridContext;\n\n if (isKeyCredential(credentials)) {\n client.pipeline.addPolicy({\n name: \"customKeyCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", \"SharedAccessKey \" + credentials.key);\n return next(request);\n },\n });\n }\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n PublishCloudEvents200Response,\n PublishCloudEventsDefaultResponse,\n ReceiveCloudEvents200Response,\n ReceiveCloudEventsDefaultResponse,\n AcknowledgeCloudEvents200Response,\n AcknowledgeCloudEventsDefaultResponse,\n ReleaseCloudEvents200Response,\n ReleaseCloudEventsDefaultResponse,\n RejectCloudEvents200Response,\n RejectCloudEventsDefaultResponse,\n RenewCloudEventLocks200Response,\n RenewCloudEventLocksDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /topics/{topicName}:publish\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\": [\"200\"],\n \"POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): response is PublishCloudEventDefaultResponse;\nexport function isUnexpected(\n response: PublishCloudEvents200Response | PublishCloudEventsDefaultResponse,\n): response is PublishCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse,\n): response is ReceiveCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse,\n): response is AcknowledgeCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse,\n): response is ReleaseCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: RejectCloudEvents200Response | RejectCloudEventsDefaultResponse,\n): response is RejectCloudEventsDefaultResponse;\nexport function isUnexpected(\n response: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse,\n): response is RenewCloudEventLocksDefaultResponse;\nexport function isUnexpected(\n response:\n | PublishCloudEvent200Response\n | PublishCloudEventDefaultResponse\n | PublishCloudEvents200Response\n | PublishCloudEventsDefaultResponse\n | ReceiveCloudEvents200Response\n | ReceiveCloudEventsDefaultResponse\n | AcknowledgeCloudEvents200Response\n | AcknowledgeCloudEventsDefaultResponse\n | ReleaseCloudEvents200Response\n | ReleaseCloudEventsDefaultResponse\n | RejectCloudEvents200Response\n | RejectCloudEventsDefaultResponse\n | RenewCloudEventLocks200Response\n | RenewCloudEventLocksDefaultResponse,\n): response is\n | PublishCloudEventDefaultResponse\n | PublishCloudEventsDefaultResponse\n | ReceiveCloudEventsDefaultResponse\n | AcknowledgeCloudEventsDefaultResponse\n | ReleaseCloudEventsDefaultResponse\n | RejectCloudEventsDefaultResponse\n | RenewCloudEventLocksDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { EventGridContext } from \"../rest/index\";\nimport getClient from \"../rest/index\";\n\nexport interface EventGridClientOptions extends ClientOptions {\n /** The API version to use for this operation. */\n apiVersion?: string;\n}\n\nexport { EventGridContext } from \"../rest/index\";\n\n/** Azure Messaging EventGrid Client */\nexport function createEventGrid(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: EventGridClientOptions = {},\n): EventGridContext {\n const clientContext = getClient(endpointParam, credential, options);\n return clientContext;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"../models/models\";\nimport {\n isUnexpected,\n EventGridContext as Client,\n AcknowledgeCloudEvents200Response,\n AcknowledgeCloudEventsDefaultResponse,\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n PublishCloudEvents200Response,\n PublishCloudEventsDefaultResponse,\n ReceiveCloudEvents200Response,\n ReceiveCloudEventsDefaultResponse,\n RejectCloudEvents200Response,\n RejectCloudEventsDefaultResponse,\n ReleaseCloudEvents200Response,\n ReleaseCloudEventsDefaultResponse,\n RenewCloudEventLocks200Response,\n RenewCloudEventLocksDefaultResponse,\n} from \"../rest/index\";\nimport {\n StreamableMethod,\n operationOptionsToRequestParameters,\n createRestError,\n} from \"@azure-rest/core-client\";\nimport { uint8ArrayToString, stringToUint8Array } from \"@azure/core-util\";\nimport {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"../models/options\";\n\nexport function _publishCloudEventSend(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse> {\n return context.path(\"/topics/{topicName}:publish\", topicName).post({\n ...operationOptionsToRequestParameters(options),\n contentType: (options.contentType as any) ?? \"application/cloudevents+json; charset=utf-8\",\n body: {\n id: event[\"id\"],\n source: event[\"source\"],\n data: event[\"data\"],\n data_base64:\n event[\"dataBase64\"] !== undefined\n ? uint8ArrayToString(event[\"dataBase64\"], \"base64\")\n : undefined,\n type: event[\"type\"],\n time: event[\"time\"]?.toISOString(),\n specversion: event[\"specversion\"],\n dataschema: event[\"dataschema\"],\n datacontenttype: event[\"datacontenttype\"],\n subject: event[\"subject\"],\n },\n }) as StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse>;\n}\n\nexport async function _publishCloudEventDeserialize(\n result: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): Promise<PublishResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return result.body;\n}\n\n/** Publish a single Cloud Event to a namespace topic. */\nexport async function publishCloudEvent(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): Promise<PublishResult> {\n const result = await _publishCloudEventSend(context, topicName, event, options);\n return _publishCloudEventDeserialize(result);\n}\n\nexport function _publishCloudEventsSend(\n context: Client,\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse> {\n return context.path(\"/topics/{topicName}:publish\", topicName).post({\n ...operationOptionsToRequestParameters(options),\n contentType:\n (options.contentType as any) ?? \"application/cloudevents-batch+json; charset=utf-8\",\n body: (events ?? []).map((p) => {\n return {\n id: p[\"id\"],\n source: p[\"source\"],\n data: p[\"data\"],\n data_base64:\n p[\"dataBase64\"] !== undefined ? uint8ArrayToString(p[\"dataBase64\"], \"base64\") : undefined,\n type: p[\"type\"],\n time: p[\"time\"]?.toISOString(),\n specversion: p[\"specversion\"],\n dataschema: p[\"dataschema\"],\n datacontenttype: p[\"datacontenttype\"],\n subject: p[\"subject\"],\n };\n }),\n }) as StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse>;\n}\n\nexport async function _publishCloudEventsDeserialize(\n result: PublishCloudEvents200Response | PublishCloudEventsDefaultResponse,\n): Promise<PublishResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return result.body;\n}\n\n/** Publish a batch of Cloud Events to a namespace topic. */\nexport async function publishCloudEvents(\n context: Client,\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<PublishResult> {\n const result = await _publishCloudEventsSend(context, topicName, events, options);\n return _publishCloudEventsDeserialize(result);\n}\n\nexport function _receiveCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n queryParameters: {\n maxEvents: options?.maxEvents,\n maxWaitTime: options?.maxWaitTime,\n },\n });\n}\n\nexport async function _receiveCloudEventsDeserialize(\n result: ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse,\n): Promise<ReceiveResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n details: result.body[\"value\"].map((p) => ({\n brokerProperties: {\n lockToken: p.brokerProperties[\"lockToken\"],\n deliveryCount: p.brokerProperties[\"deliveryCount\"],\n },\n event: {\n id: p.event[\"id\"],\n source: p.event[\"source\"],\n data: p.event[\"data\"],\n dataBase64:\n typeof p.event[\"data_base64\"] === \"string\"\n ? stringToUint8Array(p.event[\"data_base64\"], \"base64\")\n : p.event[\"data_base64\"],\n type: p.event[\"type\"],\n time: p.event[\"time\"] !== undefined ? new Date(p.event[\"time\"]) : undefined,\n specversion: p.event[\"specversion\"],\n dataschema: p.event[\"dataschema\"],\n datacontenttype: p.event[\"datacontenttype\"],\n subject: p.event[\"subject\"],\n },\n })),\n };\n}\n\n/** Receive a batch of Cloud Events from a subscription. */\nexport async function receiveCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<ReceiveResult> {\n const result = await _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options);\n return _receiveCloudEventsDeserialize(result);\n}\n\nexport function _acknowledgeCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _acknowledgeCloudEventsDeserialize(\n result: AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse,\n): Promise<AcknowledgeResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Acknowledge a batch of Cloud Events. The response will include the set of successfully acknowledged lock tokens, along with other failed lock tokens with their corresponding error information. Successfully acknowledged events will no longer be available to be received by any consumer. */\nexport async function acknowledgeCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<AcknowledgeResult> {\n const result = await _acknowledgeCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _acknowledgeCloudEventsDeserialize(result);\n}\n\nexport function _releaseCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n queryParameters: {\n releaseDelayInSeconds: options?.releaseDelayInSeconds,\n },\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _releaseCloudEventsDeserialize(\n result: ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse,\n): Promise<ReleaseResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Release a batch of Cloud Events. The response will include the set of successfully released lock tokens, along with other failed lock tokens with their corresponding error information. Successfully released events can be received by consumers. */\nexport async function releaseCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<ReleaseResult> {\n const result = await _releaseCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _releaseCloudEventsDeserialize(result);\n}\n\nexport function _rejectCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n): StreamableMethod<RejectCloudEvents200Response | RejectCloudEventsDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _rejectCloudEventsDeserialize(\n result: RejectCloudEvents200Response | RejectCloudEventsDefaultResponse,\n): Promise<RejectResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Reject a batch of Cloud Events. The response will include the set of successfully rejected lock tokens, along with other failed lock tokens with their corresponding error information. Successfully rejected events will be dead-lettered and can no longer be received by a consumer. */\nexport async function rejectCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n): Promise<RejectResult> {\n const result = await _rejectCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _rejectCloudEventsDeserialize(result);\n}\n\nexport function _renewCloudEventLocksSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n): StreamableMethod<RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse> {\n return context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\",\n topicName,\n eventSubscriptionName,\n )\n .post({\n ...operationOptionsToRequestParameters(options),\n body: { lockTokens: lockTokens },\n });\n}\n\nexport async function _renewCloudEventLocksDeserialize(\n result: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse,\n): Promise<RenewLocksResult> {\n if (isUnexpected(result)) {\n throw createRestError(result);\n }\n\n return {\n failedLockTokens: result.body[\"failedLockTokens\"].map((p) => ({\n lockToken: p[\"lockToken\"],\n error: p.error,\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\n/** Renew locks for a batch of Cloud Events. The response will include the set of successfully renewed lock tokens, along with other failed lock tokens with their corresponding error information. Successfully renewed locks will ensure that the associated event is only available to the consumer that holds the renewed lock. */\nexport async function renewCloudEventLocks(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n): Promise<RenewLocksResult> {\n const result = await _renewCloudEventLocksSend(\n context,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n return _renewCloudEventLocksDeserialize(result);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./models/models\";\nimport {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./models/options\";\nimport {\n createEventGrid,\n EventGridClientOptions,\n EventGridContext,\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n renewCloudEventLocks,\n} from \"./api/index\";\n\nexport { EventGridClientOptions } from \"./api/EventGridContext\";\n\nexport class EventGridClient {\n private _client: EventGridContext;\n\n getClient(): EventGridContext {\n return this._client;\n }\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: EventGridClientOptions = {},\n ) {\n this._client = createEventGrid(endpointParam, credential, options);\n this.pipeline = this._client.pipeline;\n }\n\n /** Publish a single Cloud Event to a namespace topic. */\n publishCloudEvent(\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n ): Promise<PublishResult> {\n return publishCloudEvent(this._client, topicName, event, options);\n }\n\n /** Publish a batch of Cloud Events to a namespace topic. */\n publishCloudEvents(\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<PublishResult> {\n return publishCloudEvents(this._client, topicName, events, options);\n }\n\n /** Receive a batch of Cloud Events from a subscription. */\n receiveCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<ReceiveResult> {\n return receiveCloudEvents(this._client, topicName, eventSubscriptionName, options);\n }\n\n /** Acknowledge a batch of Cloud Events. The response will include the set of successfully acknowledged lock tokens, along with other failed lock tokens with their corresponding error information. Successfully acknowledged events will no longer be available to be received by any consumer. */\n acknowledgeCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n return acknowledgeCloudEvents(\n this._client,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n\n /** Release a batch of Cloud Events. The response will include the set of successfully released lock tokens, along with other failed lock tokens with their corresponding error information. Successfully released events can be received by consumers. */\n releaseCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: ReleaseCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n return releaseCloudEvents(this._client, topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /** Reject a batch of Cloud Events. The response will include the set of successfully rejected lock tokens, along with other failed lock tokens with their corresponding error information. Successfully rejected events will be dead-lettered and can no longer be received by a consumer. */\n rejectCloudEvents(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RejectCloudEventsOptionalParams = { requestOptions: {} },\n ): Promise<RejectResult> {\n return rejectCloudEvents(this._client, topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /** Renew locks for a batch of Cloud Events. The response will include the set of successfully renewed lock tokens, along with other failed lock tokens with their corresponding error information. Successfully renewed locks will ensure that the associated event is only available to the consumer that holds the renewed lock. */\n renewCloudEventLocks(\n topicName: string,\n eventSubscriptionName: string,\n lockTokens: string[],\n options: RenewCloudEventLocksOptionalParams = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n return renewCloudEventLocks(\n this._client,\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport {\n BrokerProperties,\n PublishCloudEventOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n EventGridClientOptions as EventGridOptions,\n ReleaseDelay,\n} from \"./cadl-generated\";\n\n/** Send Event Options */\nexport interface SendEventOptions extends OperationOptions {\n /** Content type */\n contentType?: string;\n\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Sender Client Options */\nexport interface EventGridSenderClientOptions extends EventGridOptions {}\n\n/** Event Grid Receiver Client Options */\nexport interface EventGridReceiverClientOptions extends EventGridOptions {}\n\n/** Send Events Options */\nexport interface SendEventsOptions extends PublishCloudEventOptionalParams {}\n\n/** Receive Events Options */\nexport interface ReceiveEventsOptions extends ReceiveCloudEventsOptionalParams {}\n\n/** Acknowledge Events Options */\nexport interface AcknowledgeEventsOptions extends AcknowledgeCloudEventsOptionalParams {}\n\n/** Release Events Options */\nexport interface ReleaseEventsOptions extends OperationOptions {\n /** Release events with the specified delay in seconds. */\n releaseDelay?: ReleaseDelay;\n}\n\n/** Reject Events Options */\nexport interface RejectEventsOptions extends RejectCloudEventsOptionalParams {}\n\n/** Renew Event Locks Options */\nexport interface RenewEventLocksOptions extends RenewCloudEventLocksOptionalParams {}\n\n/** Known values of {@link ReleaseDelay} that the service accepts. */\nexport const enum KnownReleaseDelay {\n /** Ten Minutes */\n TenMinutes = \"600\",\n\n /** One Minute */\n OneMinute = \"60\",\n\n /** Ten Seconds */\n TenSeconds = \"10\",\n\n /** One Hour */\n OneHour = \"3600\",\n\n /** No Delay */\n NoDelay = \"0\",\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails<T> {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent<T>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataSchema?: string;\n /**\n * Content type of data value.\n */\n dataContentType?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n /**\n * The version of the CloudEvents specification which the event uses.\n */\n specVersion?: string | \"1.0\";\n}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult<T> {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails<T>[];\n}\n\nexport const cloudEventReservedPropertyNames = [\n \"specVersion\",\n \"id\",\n \"source\",\n \"type\",\n \"dataContentType\",\n \"dataSchema\",\n \"subject\",\n \"time\",\n \"data\",\n];\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelineResponse,\n PipelineRequest,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\nexport const CloudEventBatchContentType = \"application/cloudevents-batch+json; charset=utf-8\";\nexport const TraceParentHeaderName = \"traceparent\";\nexport const TraceStateHeaderName = \"tracestate\";\nexport const ContentTypeHeaderName = \"Content-Type\";\n\n/**\n * The programmatic identifier of the cloudEventDistributedTracingEnricherPolicy.\n */\nexport const cloudEventDistributedTracingEnricherPolicyName =\n \"cloudEventDistributedTracingEnricherPolicy\";\n\n/**\n * cloudEventDistributedTracingEnricherPolicy is a policy which adds distributed tracing information\n * to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties\n * from the HTTP request into the individual events as extension properties.\n *\n * This will only happen in the case where an event does not have a `traceparent` defined already. This\n * allows events to explicitly set a traceparent and tracestate which would be respected during \"multi-hop\n * transmition\".\n *\n * See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md\n * for more information on distributed tracing and cloud events.\n */\nexport function cloudEventDistributedTracingEnricherPolicy(): PipelinePolicy {\n return {\n name: cloudEventDistributedTracingEnricherPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const traceparent = request.headers.get(TraceParentHeaderName);\n const tracestate = request.headers.get(TraceStateHeaderName);\n\n if (\n request.headers.get(ContentTypeHeaderName) === CloudEventBatchContentType &&\n typeof request.body === \"string\" &&\n traceparent\n ) {\n // per the cloud event batched content type we know the body is an array encoded in JSON.\n const parsedBody = JSON.parse(request.body) as any[];\n\n for (const item of parsedBody) {\n // When using the distributed tracing extension, the \"traceparent\" is a required property\n // and \"tracestate\" is optional. This means if an item already has a \"traceparent\" property\n // we should not stomp over it. Well formed events will not have a \"tracestate\" without\n // also having a \"traceparent\" so there's no need to guard against that case.\n if (typeof item !== \"object\" || item.traceparent) {\n continue;\n }\n\n item.traceparent = traceparent;\n if (tracestate) {\n item.tracestate = tracestate;\n }\n }\n\n request.body = JSON.stringify(parsedBody);\n }\n\n return next(request);\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n SendEventsOptions,\n CloudEvent,\n cloudEventReservedPropertyNames,\n EventGridSenderClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridSenderClient {\n private _client: EventGridClientGenerated;\n private _topicName: string;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n topicName: string,\n options: EventGridSenderClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = topicName;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Publish Cloud Events to namespace topic. In case of success, the server responds with an HTTP 200\n * status code with an empty JSON object in response. Otherwise, the server can return various error codes.\n * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message\n * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for\n * internal server error.\n *\n * @param events - Events to publish\n * @param options - Options to publish\n *\n */\n async sendEvents<T>(\n events: CloudEvent<T>[] | CloudEvent<T>,\n options: SendEventsOptions = { requestOptions: {} },\n ): Promise<void> {\n if (Array.isArray(events)) {\n const eventsWireModel: Array<CloudEventWireModel> = [];\n for (const individualevent of events) {\n eventsWireModel.push(convertCloudEventToModelType(individualevent));\n }\n await this._client.publishCloudEvents(this._topicName, eventsWireModel, options);\n } else {\n const cloudEventWireModel: CloudEventWireModel = convertCloudEventToModelType(events);\n await this._client.publishCloudEvent(this._topicName, cloudEventWireModel, options);\n }\n }\n}\n\nexport function convertCloudEventToModelType<T>(event: CloudEvent<T>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: event.specVersion ?? \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? randomUUID(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataSchema,\n datacontenttype: event.dataContentType,\n ...(event.extensionAttributes ?? []),\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.dataContentType) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\",\n );\n }\n\n converted.datacontenttype = event.dataContentType;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype =\n event.dataContentType ?? \"application/cloudevents+json; charset=utf-8\";\n converted.data = event.data;\n }\n\n return converted;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n CloudEvent,\n ReceiveResult,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridReceiverClientOptions,\n ReceiveEventsOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridReceiverClient {\n private _client: EventGridClientGenerated;\n private _topicName: string;\n private _subscriptionName: string;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n topicName: string,\n subscriptionName: string,\n options: EventGridReceiverClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = topicName;\n this._subscriptionName = subscriptionName;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Receive Batch of Cloud Events from the Event Subscription.\n *\n * @param options - Options to receive\n *\n */\n async receiveEvents<T>(\n options: ReceiveEventsOptions = { requestOptions: {} },\n ): Promise<ReceiveResult<T>> {\n const result = await this._client.receiveCloudEvents(\n this._topicName,\n this._subscriptionName,\n options,\n );\n\n const modifiedResult: ReceiveResult<T> = {\n details: result.details.map((receiveDetails) => {\n const cloudEvent: CloudEvent<T> = {\n type: receiveDetails.event.type,\n source: receiveDetails.event.source,\n id: receiveDetails.event.id,\n time: receiveDetails.event.time,\n dataSchema: receiveDetails.event.dataschema,\n dataContentType: receiveDetails.event.datacontenttype,\n subject: receiveDetails.event.subject,\n specVersion: receiveDetails.event.specversion,\n data: receiveDetails.event.data\n ? (receiveDetails.event.data as T)\n : receiveDetails.event.dataBase64\n ? (uint8ArrayToString(receiveDetails.event.dataBase64, \"base64\") as T)\n : undefined,\n };\n return {\n brokerProperties: receiveDetails.brokerProperties,\n event: cloudEvent,\n };\n }),\n };\n\n return modifiedResult;\n }\n\n /**\n * Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one\n * event is successfully acknowledged. The response body will include the set of successfully acknowledged\n * lockTokens, along with other failed lockTokens with their corresponding error information. Successfully\n * acknowledged events will no longer be available to any consumer.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to Acknowledge\n *\n */\n acknowledgeEvents(\n lockTokens: string[],\n options: AcknowledgeEventsOptions = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n return this._client.acknowledgeCloudEvents(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is\n * successfully released. The response body will include the set of successfully released lockTokens, along\n * with other failed lockTokens with their corresponding error information.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to release\n *\n */\n releaseEvents(\n lockTokens: string[],\n options: ReleaseEventsOptions = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n return this._client.releaseCloudEvents(this._topicName, this._subscriptionName, lockTokens, {\n ...options,\n releaseDelayInSeconds: options.releaseDelay,\n });\n }\n\n /**\n * Reject batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to reject\n *\n */\n rejectEvents(\n lockTokens: string[],\n options: RejectEventsOptions = { requestOptions: {} },\n ): Promise<RejectResult> {\n return this._client.rejectCloudEvents(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Renew lock for batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to renew\n */\n renewEventLocks(\n lockTokens: string[],\n options: RenewEventLocksOptions = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n return this._client.renewCloudEventLocks(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { CompositeMapper } from \"@azure/core-client\";\n\n/**\n * Stringifies a Date object in the format expected by the Event Grid service, for use in a Shared Access Signiture.\n *\n * The service expects this time string to be in the same format as what is returned by the .NET DateTime.ToString\n * method, using the \"en-US\" culture.\n *\n * This corresponds to the .NET format string: \"M/d/yyyy h:mm:ss tt\". For example, the date \"June 5th, 2020, 12:09:03 PM\"\n * is represented as the string \"6/5/2020 12:09:03 PM\"\n *\n * The service expects a UTC time, so this method returns a string based on the UTC time of the provided Date.\n *\n * @param d - The Date object to convert to a string.\n */\nexport function dateToServiceTimeString(d: Date): string {\n const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12.\n const day = d.getUTCDate();\n const year = d.getUTCFullYear();\n\n const hour = d.getUTCHours() === 0 || d.getUTCHours() === 12 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format.\n const minute = d.getUTCMinutes().toString().padStart(2, \"0\");\n const second = d.getUTCSeconds().toString().padStart(2, \"0\");\n const am = d.getUTCHours() >= 12 ? \"PM\" : \"AM\";\n\n return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`;\n}\n\n/**\n * Returns `true` if the credential object is like the KeyCredential interface (i.e. it has a\n * key property).\n *\n * @param credential - The object to test\n */\nexport function isKeyCredentialLike(o: unknown): o is KeyCredential {\n const castO = o as {\n key: unknown;\n };\n return castO.key !== undefined;\n}\n\nexport function parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any[] {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n return o;\n } else {\n return [o];\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n return jsonStringOrObject;\n } else {\n return [jsonStringOrObject];\n }\n}\n\nconst CLOUD_EVENT_1_0_SPEC_VERSION = \"1.0\";\n\nexport function validateCloudEventEvent(o: unknown): void {\n validateRequiredStringProperties(o, [\"type\", \"source\", \"id\", \"specVersion\"]);\n validateOptionalStringProperties(o, [\"time\", \"dataSchema\", \"dataContentType\", \"subject\"]);\n\n if (typeof o !== \"object\") {\n throw new TypeError(\"event is not an object\");\n }\n\n const castO = o as {\n specVersion: unknown;\n };\n\n if (castO.specVersion !== CLOUD_EVENT_1_0_SPEC_VERSION) {\n throw new Error(\"event is not in the Cloud Event 1.0 schema\");\n }\n}\n\nfunction validateRequiredStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] === \"undefined\") {\n throw new Error(`event is missing required property '${propertyName}'`);\n }\n\n if (typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName} should be a 'string', but is '${typeof o[propertyName]}'`,\n );\n }\n }\n}\n\nfunction validateOptionalStringProperties(o: any, propertyNames: string[]): void {\n for (const propertyName of propertyNames) {\n if (typeof o[propertyName] !== \"undefined\" && typeof o[propertyName] !== \"string\") {\n throw new TypeError(\n `event property '${propertyName}' should be a 'string' but it is a '${typeof o[\n propertyName\n ]}'`,\n );\n }\n }\n}\n\nexport const CloudEvent: CompositeMapper = {\n type: {\n name: \"Composite\",\n className: \"CloudEvent\",\n additionalProperties: { type: { name: \"Object\" } },\n modelProperties: {\n id: {\n serializedName: \"id\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n source: {\n serializedName: \"source\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n data: {\n serializedName: \"data\",\n type: {\n name: \"any\",\n },\n },\n dataBase64: {\n serializedName: \"data_base64\",\n type: {\n name: \"ByteArray\",\n },\n },\n type: {\n serializedName: \"type\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n time: {\n serializedName: \"time\",\n type: {\n name: \"DateTime\",\n },\n },\n specversion: {\n serializedName: \"specversion\",\n required: true,\n type: {\n name: \"String\",\n },\n },\n dataschema: {\n serializedName: \"dataschema\",\n type: {\n name: \"String\",\n },\n },\n datacontenttype: {\n serializedName: \"datacontenttype\",\n type: {\n name: \"String\",\n },\n },\n subject: {\n serializedName: \"subject\",\n type: {\n name: \"String\",\n },\n },\n },\n },\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { CloudEvent, cloudEventReservedPropertyNames } from \"./models\";\nimport { CloudEvent as CloudEventMapper, parseAndWrap, validateCloudEventEvent } from \"./util\";\n\nconst serializer = createSerializer();\n\n/**\n * EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload\n * of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an\n * `EventGridEvent` or `CloudEvent` like object.\n *\n * Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:\n *\n * - The consumer parses the event time property into a `Date` object, for ease of use.\n * - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded\n * and returned as an instance of the `Uint8Array` type.\n */\nexport class EventGridDeserializer {\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - the JSON encoded representation of either a single event or an array of\n * events, encoded in the Cloud Events 1.0 Schema.\n */\n public async deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>;\n\n /**\n * Deserializes events encoded in the Cloud Events 1.0 schema.\n *\n * @param encodedEvents - an object representing a single event, encoded in the Cloud Events 1.0 schema.\n */\n public async deserializeCloudEvents(\n encodedEvents: Record<string, unknown>,\n ): Promise<CloudEvent<unknown>[]>;\n public async deserializeCloudEvents(\n encodedEvents: string | Record<string, unknown>,\n ): Promise<CloudEvent<unknown>[]> {\n const decodedArray = parseAndWrap(encodedEvents);\n\n const events: CloudEvent<unknown>[] = [];\n\n for (const o of decodedArray) {\n validateCloudEventEvent(o);\n\n // Check that the required fields are present and of the correct type and the optional fields are missing\n // or of the correct type.\n\n const deserialized = serializer.deserialize(CloudEventMapper, o, \"\");\n const modelEvent: Record<string, any> = {\n specversion: deserialized.specversion,\n id: deserialized.id,\n source: deserialized.source,\n type: deserialized.type,\n };\n\n if (deserialized.datacontenttype !== undefined) {\n modelEvent.datacontenttype = deserialized.datacontenttype;\n }\n\n if (deserialized.dataschema !== undefined) {\n modelEvent.dataschema = deserialized.dataschema;\n }\n\n if (deserialized.subject !== undefined) {\n modelEvent.subject = deserialized.subject;\n }\n\n if (deserialized.time !== undefined) {\n modelEvent.time = deserialized.time;\n }\n\n if (deserialized.data !== undefined) {\n modelEvent.data = deserialized.data;\n }\n\n // If the data the event represents binary, it is encoded as base64 text in a different property on the event and we need to transform it.\n if (deserialized.dataBase64 !== undefined) {\n if (deserialized.data !== undefined) {\n throw new TypeError(\"event contains both a data and data_base64 field\");\n }\n\n if (!(deserialized.dataBase64 instanceof Uint8Array)) {\n throw new TypeError(\"event data_base64 property is not an instance of Uint8Array\");\n }\n\n modelEvent.data = deserialized.dataBase64;\n }\n\n // Build the \"extensionsAttributes\" property bag by removing all known top level properties.\n const extensionAttributes = { ...deserialized };\n for (const propName of cloudEventReservedPropertyNames) {\n delete extensionAttributes[propName];\n }\n delete extensionAttributes.dataBase64;\n\n // If any properties remain, copy them to the model.\n if (Object.keys(extensionAttributes).length > 0) {\n modelEvent.extensionAttributes = extensionAttributes;\n }\n\n events.push(modelEvent as CloudEvent<unknown>);\n }\n\n return events;\n }\n}\n"],"names":["createClientLogger","getClient","isKeyCredential","operationOptionsToRequestParameters","uint8ArrayToString","createRestError","stringToUint8Array","EventGridClientGenerated","tracingPolicyName","randomUUID","createSerializer","CloudEventMapper"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,sBAAsB,CAAC;;ACJhE;AACA;AAOA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,OAAA,GAAyB,EAAE,EAAA;;AAE3B,IAAA,MAAM,WAAW,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,CAAC,QAAQ,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAG,EAAA,aAAa,EAAE,CAAC;IAC9E,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY,CAAC;IACxD,MAAM,aAAa,GAAG,CAAA,wCAAA,CAA0C,CAAC;IACjE,MAAM,eA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;KACf;AACF;;;;;;;;;;"}
@@ -9,11 +9,10 @@ import { uint8ArrayToString } from "@azure/core-util";
9
9
  */
10
10
  export class EventGridReceiverClient {
11
11
  /** Azure Messaging EventGrid Client */
12
- constructor(endpoint, credential, options = {}) {
13
- var _a, _b;
12
+ constructor(endpoint, credential, topicName, subscriptionName, options = {}) {
14
13
  this._client = new EventGridClientGenerated(endpoint, credential, options);
15
- this._topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : undefined;
16
- this._eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : undefined;
14
+ this._topicName = topicName;
15
+ this._subscriptionName = subscriptionName;
17
16
  this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
18
17
  afterPolicies: [tracingPolicyName],
19
18
  });
@@ -25,16 +24,7 @@ export class EventGridReceiverClient {
25
24
  *
26
25
  */
27
26
  async receiveEvents(options = { requestOptions: {} }) {
28
- var _a, _b;
29
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
30
- if (!topicName) {
31
- throw new Error("Topic name is required");
32
- }
33
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
34
- if (!eventSubscriptionName) {
35
- throw new Error("Event Subscription name is required");
36
- }
37
- const result = await this._client.receiveCloudEvents(topicName, eventSubscriptionName, options);
27
+ const result = await this._client.receiveCloudEvents(this._topicName, this._subscriptionName, options);
38
28
  const modifiedResult = {
39
29
  details: result.details.map((receiveDetails) => {
40
30
  const cloudEvent = {
@@ -71,16 +61,7 @@ export class EventGridReceiverClient {
71
61
  *
72
62
  */
73
63
  acknowledgeEvents(lockTokens, options = { requestOptions: {} }) {
74
- var _a, _b;
75
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
76
- if (!topicName) {
77
- throw new Error("Topic name is required");
78
- }
79
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
80
- if (!eventSubscriptionName) {
81
- throw new Error("Event Subscription name is required");
82
- }
83
- return this._client.acknowledgeCloudEvents(topicName, eventSubscriptionName, lockTokens, options);
64
+ return this._client.acknowledgeCloudEvents(this._topicName, this._subscriptionName, lockTokens, options);
84
65
  }
85
66
  /**
86
67
  * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is
@@ -92,16 +73,7 @@ export class EventGridReceiverClient {
92
73
  *
93
74
  */
94
75
  releaseEvents(lockTokens, options = { requestOptions: {} }) {
95
- var _a, _b;
96
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
97
- if (!topicName) {
98
- throw new Error("Topic name is required");
99
- }
100
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
101
- if (!eventSubscriptionName) {
102
- throw new Error("Event Subscription name is required");
103
- }
104
- return this._client.releaseCloudEvents(topicName, eventSubscriptionName, lockTokens, Object.assign(Object.assign({}, options), { releaseDelayInSeconds: options.releaseDelay }));
76
+ return this._client.releaseCloudEvents(this._topicName, this._subscriptionName, lockTokens, Object.assign(Object.assign({}, options), { releaseDelayInSeconds: options.releaseDelay }));
105
77
  }
106
78
  /**
107
79
  * Reject batch of Cloud Events.
@@ -111,16 +83,7 @@ export class EventGridReceiverClient {
111
83
  *
112
84
  */
113
85
  rejectEvents(lockTokens, options = { requestOptions: {} }) {
114
- var _a, _b;
115
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
116
- if (!topicName) {
117
- throw new Error("Topic name is required");
118
- }
119
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
120
- if (!eventSubscriptionName) {
121
- throw new Error("Event Subscription name is required");
122
- }
123
- return this._client.rejectCloudEvents(topicName, eventSubscriptionName, lockTokens, options);
86
+ return this._client.rejectCloudEvents(this._topicName, this._subscriptionName, lockTokens, options);
124
87
  }
125
88
  /**
126
89
  * Renew lock for batch of Cloud Events.
@@ -129,16 +92,7 @@ export class EventGridReceiverClient {
129
92
  * @param options - Options to renew
130
93
  */
131
94
  renewEventLocks(lockTokens, options = { requestOptions: {} }) {
132
- var _a, _b;
133
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
134
- if (!topicName) {
135
- throw new Error("Topic name is required");
136
- }
137
- const eventSubscriptionName = (_b = options === null || options === void 0 ? void 0 : options.eventSubscriptionName) !== null && _b !== void 0 ? _b : this._eventSubscriptionName;
138
- if (!eventSubscriptionName) {
139
- throw new Error("Event Subscription name is required");
140
- }
141
- return this._client.renewCloudEventLocks(topicName, eventSubscriptionName, lockTokens, options);
95
+ return this._client.renewCloudEventLocks(this._topicName, this._subscriptionName, lockTokens, options);
142
96
  }
143
97
  }
144
98
  //# sourceMappingURL=eventGridReceiverClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridReceiverClient.js","sourceRoot":"","sources":["../../src/eventGridReceiverClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,eAAe,IAAI,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAW/F,OAAO,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAKlC,uCAAuC;IACvC,YACE,QAAgB,EAChB,UAAgD,EAChD,UAA0C,EAAE;;QAE5C,IAA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F,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;OAKG;IACH,eAAe,CACb,UAAoB,EACpB,UAAkC,EAAE,cAAc,EAAE,EAAE,EAAE;;QAExD,MAAM,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,IAAI,CAAC,UAAU,CAAC;QAExD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,qBAAqB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,mCAAI,IAAI,CAAC,sBAAsB,CAAC;QAE5F,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAClG,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n CloudEvent,\n ReceiveResult,\n ReceiveEventsOptions,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridReceiverClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridReceiverClient {\n private _client: EventGridClientGenerated;\n private _topicName: string | undefined;\n private _eventSubscriptionName: string | undefined;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n options: EventGridReceiverClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = options?.topicName ?? undefined;\n this._eventSubscriptionName = options?.eventSubscriptionName ?? undefined;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Receive Batch of Cloud Events from the Event Subscription.\n *\n * @param options - Options to receive\n *\n */\n async receiveEvents<T>(\n options: ReceiveEventsOptions = { requestOptions: {} },\n ): Promise<ReceiveResult<T>> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n const result = await this._client.receiveCloudEvents(topicName, eventSubscriptionName, options);\n\n const modifiedResult: ReceiveResult<T> = {\n details: result.details.map((receiveDetails) => {\n const cloudEvent: CloudEvent<T> = {\n type: receiveDetails.event.type,\n source: receiveDetails.event.source,\n id: receiveDetails.event.id,\n time: receiveDetails.event.time,\n dataSchema: receiveDetails.event.dataschema,\n dataContentType: receiveDetails.event.datacontenttype,\n subject: receiveDetails.event.subject,\n specVersion: receiveDetails.event.specversion,\n data: receiveDetails.event.data\n ? (receiveDetails.event.data as T)\n : receiveDetails.event.dataBase64\n ? (uint8ArrayToString(receiveDetails.event.dataBase64, \"base64\") as T)\n : undefined,\n };\n return {\n brokerProperties: receiveDetails.brokerProperties,\n event: cloudEvent,\n };\n }),\n };\n\n return modifiedResult;\n }\n\n /**\n * Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one\n * event is successfully acknowledged. The response body will include the set of successfully acknowledged\n * lockTokens, along with other failed lockTokens with their corresponding error information. Successfully\n * acknowledged events will no longer be available to any consumer.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to Acknowledge\n *\n */\n acknowledgeEvents(\n lockTokens: string[],\n options: AcknowledgeEventsOptions = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.acknowledgeCloudEvents(\n topicName,\n eventSubscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is\n * successfully released. The response body will include the set of successfully released lockTokens, along\n * with other failed lockTokens with their corresponding error information.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to release\n *\n */\n releaseEvents(\n lockTokens: string[],\n options: ReleaseEventsOptions = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.releaseCloudEvents(topicName, eventSubscriptionName, lockTokens, {\n ...options,\n releaseDelayInSeconds: options.releaseDelay,\n });\n }\n\n /**\n * Reject batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to reject\n *\n */\n rejectEvents(\n lockTokens: string[],\n options: RejectEventsOptions = { requestOptions: {} },\n ): Promise<RejectResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.rejectCloudEvents(topicName, eventSubscriptionName, lockTokens, options);\n }\n\n /**\n * Renew lock for batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to renew\n */\n renewEventLocks(\n lockTokens: string[],\n options: RenewEventLocksOptions = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n const eventSubscriptionName = options?.eventSubscriptionName ?? this._eventSubscriptionName;\n\n if (!eventSubscriptionName) {\n throw new Error(\"Event Subscription name is required\");\n }\n\n return this._client.renewCloudEventLocks(topicName, eventSubscriptionName, lockTokens, options);\n }\n}\n"]}
1
+ {"version":3,"file":"eventGridReceiverClient.js","sourceRoot":"","sources":["../../src/eventGridReceiverClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,eAAe,IAAI,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAW/F,OAAO,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAKlC,uCAAuC;IACvC,YACE,QAAgB,EAChB,UAAgD,EAChD,SAAiB,EACjB,gBAAwB,EACxB,UAA0C,EAAE;QAE5C,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,gBAAg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jD,KAAK,EAAE,UAAU;iBAClB,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;QAEF,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;;;;;;OASG;IACH,iBAAiB,CACf,UAAoB,EACpB,UAAoC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE1D,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CACxC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,iBAAiB,EACtB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CACX,UAAoB,EACpB,UAAgC,EAAE,cAAc,EAAE,EAAE,EAAE;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,kCACrF,OAAO,KACV,qBAAqB,EAAE,OAAO,CAAC,YAAY,IAC3C,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CACV,UAAoB,EACpB,UAA+B,EAAE,cAAc,EAAE,EAAE,EAAE;QAErD,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CACnC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,iBAAiB,EACtB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,eAAe,CACb,UAAoB,EACpB,UAAkC,EAAE,cAAc,EAAE,EAAE,EAAE;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CACtC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,iBAAiB,EACtB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n CloudEvent,\n ReceiveResult,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridReceiverClientOptions,\n ReceiveEventsOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridReceiverClient {\n private _client: EventGridClientGenerated;\n private _topicName: string;\n private _subscriptionName: string;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n topicName: string,\n subscriptionName: string,\n options: EventGridReceiverClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = topicName;\n this._subscriptionName = subscriptionName;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Receive Batch of Cloud Events from the Event Subscription.\n *\n * @param options - Options to receive\n *\n */\n async receiveEvents<T>(\n options: ReceiveEventsOptions = { requestOptions: {} },\n ): Promise<ReceiveResult<T>> {\n const result = await this._client.receiveCloudEvents(\n this._topicName,\n this._subscriptionName,\n options,\n );\n\n const modifiedResult: ReceiveResult<T> = {\n details: result.details.map((receiveDetails) => {\n const cloudEvent: CloudEvent<T> = {\n type: receiveDetails.event.type,\n source: receiveDetails.event.source,\n id: receiveDetails.event.id,\n time: receiveDetails.event.time,\n dataSchema: receiveDetails.event.dataschema,\n dataContentType: receiveDetails.event.datacontenttype,\n subject: receiveDetails.event.subject,\n specVersion: receiveDetails.event.specversion,\n data: receiveDetails.event.data\n ? (receiveDetails.event.data as T)\n : receiveDetails.event.dataBase64\n ? (uint8ArrayToString(receiveDetails.event.dataBase64, \"base64\") as T)\n : undefined,\n };\n return {\n brokerProperties: receiveDetails.brokerProperties,\n event: cloudEvent,\n };\n }),\n };\n\n return modifiedResult;\n }\n\n /**\n * Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one\n * event is successfully acknowledged. The response body will include the set of successfully acknowledged\n * lockTokens, along with other failed lockTokens with their corresponding error information. Successfully\n * acknowledged events will no longer be available to any consumer.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to Acknowledge\n *\n */\n acknowledgeEvents(\n lockTokens: string[],\n options: AcknowledgeEventsOptions = { requestOptions: {} },\n ): Promise<AcknowledgeResult> {\n return this._client.acknowledgeCloudEvents(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is\n * successfully released. The response body will include the set of successfully released lockTokens, along\n * with other failed lockTokens with their corresponding error information.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to release\n *\n */\n releaseEvents(\n lockTokens: string[],\n options: ReleaseEventsOptions = { requestOptions: {} },\n ): Promise<ReleaseResult> {\n return this._client.releaseCloudEvents(this._topicName, this._subscriptionName, lockTokens, {\n ...options,\n releaseDelayInSeconds: options.releaseDelay,\n });\n }\n\n /**\n * Reject batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to reject\n *\n */\n rejectEvents(\n lockTokens: string[],\n options: RejectEventsOptions = { requestOptions: {} },\n ): Promise<RejectResult> {\n return this._client.rejectCloudEvents(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n\n /**\n * Renew lock for batch of Cloud Events.\n *\n * @param lockTokens - Lock Tokens\n * @param options - Options to renew\n */\n renewEventLocks(\n lockTokens: string[],\n options: RenewEventLocksOptions = { requestOptions: {} },\n ): Promise<RenewLocksResult> {\n return this._client.renewCloudEventLocks(\n this._topicName,\n this._subscriptionName,\n lockTokens,\n options,\n );\n }\n}\n"]}
@@ -10,10 +10,9 @@ import { tracingPolicyName } from "@azure/core-rest-pipeline";
10
10
  */
11
11
  export class EventGridSenderClient {
12
12
  /** Azure Messaging EventGrid Client */
13
- constructor(endpoint, credential, options = {}) {
14
- var _a;
13
+ constructor(endpoint, credential, topicName, options = {}) {
15
14
  this._client = new EventGridClientGenerated(endpoint, credential, options);
16
- this._topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : undefined;
15
+ this._topicName = topicName;
17
16
  this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {
18
17
  afterPolicies: [tracingPolicyName],
19
18
  });
@@ -30,21 +29,16 @@ export class EventGridSenderClient {
30
29
  *
31
30
  */
32
31
  async sendEvents(events, options = { requestOptions: {} }) {
33
- var _a;
34
- const topicName = (_a = options === null || options === void 0 ? void 0 : options.topicName) !== null && _a !== void 0 ? _a : this._topicName;
35
- if (!topicName) {
36
- throw new Error("Topic name is required");
37
- }
38
32
  if (Array.isArray(events)) {
39
33
  const eventsWireModel = [];
40
34
  for (const individualevent of events) {
41
35
  eventsWireModel.push(convertCloudEventToModelType(individualevent));
42
36
  }
43
- await this._client.publishCloudEvents(topicName, eventsWireModel, options);
37
+ await this._client.publishCloudEvents(this._topicName, eventsWireModel, options);
44
38
  }
45
39
  else {
46
40
  const cloudEventWireModel = convertCloudEventToModelType(events);
47
- await this._client.publishCloudEvent(topicName, cloudEventWireModel, options);
41
+ await this._client.publishCloudEvent(this._topicName, cloudEventWireModel, options);
48
42
  }
49
43
  }
50
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridSenderClient.js","sourceRoot":"","sources":["../../src/eventGridSenderClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,IAAI,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAGL,+BAA+B,GAEhC,MAAM,UAAU,CAAC;AAClB,OAAO,EA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,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,eAAe;YACvB,MAAA,KAAK,CAAC,eAAe,mCAAI,6CAA6C,CAAC;QACzE,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n SendEventsOptions,\n CloudEvent,\n cloudEventReservedPropertyNames,\n EventGridSenderClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridSenderClient {\n private _client: EventGridClientGenerated;\n private _topicName: string | undefined;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n options: EventGridSenderClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = options?.topicName ?? undefined;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Publish Cloud Events to namespace topic. In case of success, the server responds with an HTTP 200\n * status code with an empty JSON object in response. Otherwise, the server can return various error codes.\n * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message\n * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for\n * internal server error.\n *\n * @param events - Events to publish\n * @param options - Options to publish\n *\n */\n async sendEvents<T>(\n events: CloudEvent<T>[] | CloudEvent<T>,\n options: SendEventsOptions = { requestOptions: {} },\n ): Promise<void> {\n const topicName = options?.topicName ?? this._topicName;\n\n if (!topicName) {\n throw new Error(\"Topic name is required\");\n }\n\n if (Array.isArray(events)) {\n const eventsWireModel: Array<CloudEventWireModel> = [];\n for (const individualevent of events) {\n eventsWireModel.push(convertCloudEventToModelType(individualevent));\n }\n await this._client.publishCloudEvents(topicName, eventsWireModel, options);\n } else {\n const cloudEventWireModel: CloudEventWireModel = convertCloudEventToModelType(events);\n await this._client.publishCloudEvent(topicName, cloudEventWireModel, options);\n }\n }\n}\n\nexport function convertCloudEventToModelType<T>(event: CloudEvent<T>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: event.specVersion ?? \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? randomUUID(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataSchema,\n datacontenttype: event.dataContentType,\n ...(event.extensionAttributes ?? []),\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.dataContentType) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\",\n );\n }\n\n converted.datacontenttype = event.dataContentType;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype =\n event.dataContentType ?? \"application/cloudevents+json; charset=utf-8\";\n converted.data = event.data;\n }\n\n return converted;\n}\n"]}
1
+ {"version":3,"file":"eventGridSenderClient.js","sourceRoot":"","sources":["../../src/eventGridSenderClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,C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AAe;YACvB,MAAA,KAAK,CAAC,eAAe,mCAAI,6CAA6C,CAAC;QACzE,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport {\n SendEventsOptions,\n CloudEvent,\n cloudEventReservedPropertyNames,\n EventGridSenderClientOptions,\n} from \"./models\";\nimport { cloudEventDistributedTracingEnricherPolicy } from \"./cloudEventDistrubtedTracingEnricherPolicy\";\nimport { tracingPolicyName } from \"@azure/core-rest-pipeline\";\n\n/**\n * Event Grid Namespaces Client\n */\nexport class EventGridSenderClient {\n private _client: EventGridClientGenerated;\n private _topicName: string;\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: AzureKeyCredential | TokenCredential,\n topicName: string,\n options: EventGridSenderClientOptions = {},\n ) {\n this._client = new EventGridClientGenerated(endpoint, credential, options);\n this._topicName = topicName;\n this._client.pipeline.addPolicy(cloudEventDistributedTracingEnricherPolicy(), {\n afterPolicies: [tracingPolicyName],\n });\n }\n\n /**\n * Publish Cloud Events to namespace topic. In case of success, the server responds with an HTTP 200\n * status code with an empty JSON object in response. Otherwise, the server can return various error codes.\n * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message\n * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for\n * internal server error.\n *\n * @param events - Events to publish\n * @param options - Options to publish\n *\n */\n async sendEvents<T>(\n events: CloudEvent<T>[] | CloudEvent<T>,\n options: SendEventsOptions = { requestOptions: {} },\n ): Promise<void> {\n if (Array.isArray(events)) {\n const eventsWireModel: Array<CloudEventWireModel> = [];\n for (const individualevent of events) {\n eventsWireModel.push(convertCloudEventToModelType(individualevent));\n }\n await this._client.publishCloudEvents(this._topicName, eventsWireModel, options);\n } else {\n const cloudEventWireModel: CloudEventWireModel = convertCloudEventToModelType(events);\n await this._client.publishCloudEvent(this._topicName, cloudEventWireModel, options);\n }\n }\n}\n\nexport function convertCloudEventToModelType<T>(event: CloudEvent<T>): CloudEventWireModel {\n if (event.extensionAttributes) {\n for (const propName in event.extensionAttributes) {\n // Per the cloud events spec: \"CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set\"\n // they also can not match an existing defined property name.\n\n if (\n !/^[a-z0-9]*$/.test(propName) ||\n cloudEventReservedPropertyNames.indexOf(propName) !== -1\n ) {\n throw new Error(`invalid extension attribute name: ${propName}`);\n }\n }\n }\n\n const converted: CloudEventWireModel = {\n specversion: event.specVersion ?? \"1.0\",\n type: event.type,\n source: event.source,\n id: event.id ?? randomUUID(),\n time: event.time ?? new Date(),\n subject: event.subject,\n dataschema: event.dataSchema,\n datacontenttype: event.dataContentType,\n ...(event.extensionAttributes ?? []),\n };\n\n if (event.data instanceof Uint8Array) {\n if (!event.dataContentType) {\n throw new Error(\n \"a data content type must be provided when sending an event with binary data\",\n );\n }\n\n converted.datacontenttype = event.dataContentType;\n converted.dataBase64 = event.data;\n } else {\n converted.datacontenttype =\n event.dataContentType ?? \"application/cloudevents+json; charset=utf-8\";\n converted.data = event.data;\n }\n\n return converted;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA0KlC,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,aAAa;IACb,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,iBAAiB;IACjB,YAAY;IACZ,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport {\n BrokerProperties,\n PublishCloudEventOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n EventGridClientOptions as EventGridOptions,\n ReleaseDelay,\n} from \"./cadl-generated\";\n\n/** Send Event Options */\nexport interface SendEventOptions extends OperationOptions {\n /** Content type */\n contentType?: string;\n\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Sender Client Options */\nexport interface EventGridSenderClientOptions extends EventGridOptions {\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Receiver Client Options */\nexport interface EventGridReceiverClientOptions extends EventGridOptions {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Send Events Options */\nexport interface SendEventsOptions extends PublishCloudEventOptionalParams {\n /** Topic name */\n topicName?: string;\n}\n\n/** Receive Events Options */\nexport interface ReceiveEventsOptions extends ReceiveCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Acknowledge Events Options */\nexport interface AcknowledgeEventsOptions extends AcknowledgeCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Release Events Options */\nexport interface ReleaseEventsOptions extends OperationOptions {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n\n /** Release events with the specified delay in seconds. */\n releaseDelay?: ReleaseDelay;\n}\n\n/** Reject Events Options */\nexport interface RejectEventsOptions extends RejectCloudEventsOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Renew Event Locks Options */\nexport interface RenewEventLocksOptions extends RenewCloudEventLocksOptionalParams {\n /** Topic name */\n topicName?: string;\n\n /** Event Subscription name */\n eventSubscriptionName?: string;\n}\n\n/** Known values of {@link ReleaseDelay} that the service accepts. */\nexport const enum KnownReleaseDelay {\n /** Ten Minutes */\n TenMinutes = \"600\",\n\n /** One Minute */\n OneMinute = \"60\",\n\n /** Ten Seconds */\n TenSeconds = \"10\",\n\n /** One Hour */\n OneHour = \"3600\",\n\n /** No Delay */\n NoDelay = \"0\",\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails<T> {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent<T>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataSchema?: string;\n /**\n * Content type of data value.\n */\n dataContentType?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n /**\n * The version of the CloudEvents specification which the event uses.\n */\n specVersion?: string | \"1.0\";\n}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult<T> {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails<T>[];\n}\n\nexport const cloudEventReservedPropertyNames = [\n \"specVersion\",\n \"id\",\n \"source\",\n \"type\",\n \"dataContentType\",\n \"dataSchema\",\n \"subject\",\n \"time\",\n \"data\",\n];\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgIlC,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,aAAa;IACb,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,iBAAiB;IACjB,YAAY;IACZ,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport {\n BrokerProperties,\n PublishCloudEventOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n EventGridClientOptions as EventGridOptions,\n ReleaseDelay,\n} from \"./cadl-generated\";\n\n/** Send Event Options */\nexport interface SendEventOptions extends OperationOptions {\n /** Content type */\n contentType?: string;\n\n /** Topic name */\n topicName?: string;\n}\n\n/** Event Grid Sender Client Options */\nexport interface EventGridSenderClientOptions extends EventGridOptions {}\n\n/** Event Grid Receiver Client Options */\nexport interface EventGridReceiverClientOptions extends EventGridOptions {}\n\n/** Send Events Options */\nexport interface SendEventsOptions extends PublishCloudEventOptionalParams {}\n\n/** Receive Events Options */\nexport interface ReceiveEventsOptions extends ReceiveCloudEventsOptionalParams {}\n\n/** Acknowledge Events Options */\nexport interface AcknowledgeEventsOptions extends AcknowledgeCloudEventsOptionalParams {}\n\n/** Release Events Options */\nexport interface ReleaseEventsOptions extends OperationOptions {\n /** Release events with the specified delay in seconds. */\n releaseDelay?: ReleaseDelay;\n}\n\n/** Reject Events Options */\nexport interface RejectEventsOptions extends RejectCloudEventsOptionalParams {}\n\n/** Renew Event Locks Options */\nexport interface RenewEventLocksOptions extends RenewCloudEventLocksOptionalParams {}\n\n/** Known values of {@link ReleaseDelay} that the service accepts. */\nexport const enum KnownReleaseDelay {\n /** Ten Minutes */\n TenMinutes = \"600\",\n\n /** One Minute */\n OneMinute = \"60\",\n\n /** Ten Seconds */\n TenSeconds = \"10\",\n\n /** One Hour */\n OneHour = \"3600\",\n\n /** No Delay */\n NoDelay = \"0\",\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails<T> {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent<T>;\n}\n\n/**\n * An event in the Cloud Event 1.0 schema.\n */\nexport interface CloudEvent<T> {\n /**\n * Type of event related to the originating occurrence.\n */\n type: string;\n /**\n * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.\n */\n source: string;\n /**\n * An identifier for the event. The combination of id and source must be unique for each distinct event.\n */\n id: string;\n /**\n * The time the event was generated.\n */\n time?: Date;\n /**\n * Identifies the schema that data adheres to.\n */\n dataSchema?: string;\n /**\n * Content type of data value.\n */\n dataContentType?: string;\n /**\n * Event data specific to the event type.\n */\n data?: T;\n /**\n * This describes the subject of the event in the context of the event producer (identified by source).\n */\n subject?: string;\n /**\n * Additional context attributes for the event. The Cloud Event specification refers to these as \"extension attributes\".\n */\n extensionAttributes?: Record<string, unknown>;\n /**\n * The version of the CloudEvents specification which the event uses.\n */\n specVersion?: string | \"1.0\";\n}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult<T> {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails<T>[];\n}\n\nexport const cloudEventReservedPropertyNames = [\n \"specVersion\",\n \"id\",\n \"source\",\n \"type\",\n \"dataContentType\",\n \"dataSchema\",\n \"subject\",\n \"time\",\n \"data\",\n];\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the Azure Event Grid service.",
6
- "version": "1.0.0-alpha.20240606.2",
6
+ "version": "1.0.0-alpha.20240610.6",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -47,7 +47,7 @@
47
47
  "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
48
48
  "build:browser": "tsc -p . && dev-tool run bundle",
49
49
  "build:node": "tsc -p . && dev-tool run bundle",
50
- "build:samples": "echo Obsolete",
50
+ "build:samples": "dev-tool samples publish -f",
51
51
  "build:test": "tsc -p . && dev-tool run bundle",
52
52
  "build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
53
53
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
@@ -9,10 +9,6 @@ export declare interface AcknowledgeEventsOptionalParams extends OperationOption
9
9
 
10
10
  /** Acknowledge Events Options */
11
11
  export declare interface AcknowledgeEventsOptions extends AcknowledgeEventsOptionalParams {
12
- /** Topic name */
13
- topicName?: string;
14
- /** Event Subscription name */
15
- eventSubscriptionName?: string;
16
12
  }
17
13
 
18
14
  /** The result of the Acknowledge operation. */
@@ -117,9 +113,9 @@ export declare class EventGridDeserializer {
117
113
  export declare class EventGridReceiverClient {
118
114
  private _client;
119
115
  private _topicName;
120
- private _eventSubscriptionName;
116
+ private _subscriptionName;
121
117
  /** Azure Messaging EventGrid Client */
122
- constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, options?: EventGridReceiverClientOptions);
118
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, topicName: string, subscriptionName: string, options?: EventGridReceiverClientOptions);
123
119
  /**
124
120
  * Receive Batch of Cloud Events from the Event Subscription.
125
121
  *
@@ -167,10 +163,6 @@ export declare class EventGridReceiverClient {
167
163
 
168
164
  /** Event Grid Receiver Client Options */
169
165
  export declare interface EventGridReceiverClientOptions extends EventGridClientOptions {
170
- /** Topic name */
171
- topicName?: string;
172
- /** Event Subscription name */
173
- eventSubscriptionName?: string;
174
166
  }
175
167
 
176
168
  /**
@@ -180,7 +172,7 @@ export declare class EventGridSenderClient {
180
172
  private _client;
181
173
  private _topicName;
182
174
  /** Azure Messaging EventGrid Client */
183
- constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, options?: EventGridSenderClientOptions);
175
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, topicName: string, options?: EventGridSenderClientOptions);
184
176
  /**
185
177
  * Publish Cloud Events to namespace topic. In case of success, the server responds with an HTTP 200
186
178
  * status code with an empty JSON object in response. Otherwise, the server can return various error codes.
@@ -197,8 +189,6 @@ export declare class EventGridSenderClient {
197
189
 
198
190
  /** Event Grid Sender Client Options */
199
191
  export declare interface EventGridSenderClientOptions extends EventGridClientOptions {
200
- /** Topic name */
201
- topicName?: string;
202
192
  }
203
193
 
204
194
  /** Failed LockToken information. */
@@ -242,10 +232,6 @@ export declare interface ReceiveEventsOptionalParams extends OperationOptions {
242
232
 
243
233
  /** Receive Events Options */
244
234
  export declare interface ReceiveEventsOptions extends ReceiveEventsOptionalParams {
245
- /** Topic name */
246
- topicName?: string;
247
- /** Event Subscription name */
248
- eventSubscriptionName?: string;
249
235
  }
250
236
 
251
237
  /** Details of the Receive operation response. */
@@ -259,10 +245,6 @@ export declare interface RejectEventsOptionalParams extends OperationOptions {
259
245
 
260
246
  /** Reject Events Options */
261
247
  export declare interface RejectEventsOptions extends RejectEventsOptionalParams {
262
- /** Topic name */
263
- topicName?: string;
264
- /** Event Subscription name */
265
- eventSubscriptionName?: string;
266
248
  }
267
249
 
268
250
  /** The result of the Reject operation. */
@@ -279,10 +261,6 @@ export declare type ReleaseDelay = string;
279
261
 
280
262
  /** Release Events Options */
281
263
  export declare interface ReleaseEventsOptions extends OperationOptions {
282
- /** Topic name */
283
- topicName?: string;
284
- /** Event Subscription name */
285
- eventSubscriptionName?: string;
286
264
  /** Release events with the specified delay in seconds. */
287
265
  releaseDelay?: ReleaseDelay;
288
266
  }
@@ -300,10 +278,6 @@ export declare interface RenewEventLocksOptionalParams extends OperationOptions
300
278
 
301
279
  /** Renew Event Locks Options */
302
280
  export declare interface RenewEventLocksOptions extends RenewEventLocksOptionalParams {
303
- /** Topic name */
304
- topicName?: string;
305
- /** Event Subscription name */
306
- eventSubscriptionName?: string;
307
281
  }
308
282
 
309
283
  /** The result of the RenewLock operation. */
@@ -326,8 +300,6 @@ export declare interface SendEventsOptionalParams extends OperationOptions {
326
300
 
327
301
  /** Send Events Options */
328
302
  export declare interface SendEventsOptions extends SendEventOptionalParams {
329
- /** Topic name */
330
- topicName?: string;
331
303
  }
332
304
 
333
305
  export { }