@azure/eventgrid-namespaces 1.0.1-alpha.20241029.1 → 1.0.1-alpha.20241030.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/index.js +14 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/cadl-generated/EventGridClient.js.map +1 -1
  4. package/dist-esm/src/cadl-generated/api/EventGridContext.js.map +1 -1
  5. package/dist-esm/src/cadl-generated/api/operations.js +2 -2
  6. package/dist-esm/src/cadl-generated/api/operations.js.map +1 -1
  7. package/dist-esm/src/cadl-generated/models/models.js.map +1 -1
  8. package/dist-esm/src/cadl-generated/models/options.js.map +1 -1
  9. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js.map +1 -1
  10. package/dist-esm/src/cadl-generated/rest/eventGridClient.js.map +1 -1
  11. package/dist-esm/src/cadl-generated/rest/isUnexpected.js.map +1 -1
  12. package/dist-esm/src/cadl-generated/rest/outputModels.js.map +1 -1
  13. package/dist-esm/src/cadl-generated/rest/parameters.js.map +1 -1
  14. package/dist-esm/src/cadl-generated/rest/responses.js.map +1 -1
  15. package/dist-esm/src/cloudEventDistrubtedTracingEnricherPolicy.js.map +1 -1
  16. package/dist-esm/src/consumer.js.map +1 -1
  17. package/dist-esm/src/eventGridNamespacesPublishBinaryMode.js +1 -1
  18. package/dist-esm/src/eventGridNamespacesPublishBinaryMode.js.map +1 -1
  19. package/dist-esm/src/eventGridReceiverClient.js.map +1 -1
  20. package/dist-esm/src/eventGridSenderClient.js +1 -1
  21. package/dist-esm/src/eventGridSenderClient.js.map +1 -1
  22. package/dist-esm/src/index.js +1 -0
  23. package/dist-esm/src/index.js.map +1 -1
  24. package/dist-esm/src/models.js +14 -0
  25. package/dist-esm/src/models.js.map +1 -1
  26. package/dist-esm/src/util.js.map +1 -1
  27. package/package.json +1 -1
  28. package/types/eventgrid-namespaces.d.ts +4 -4
package/dist/index.js CHANGED
@@ -366,6 +366,20 @@ class EventGridClient {
366
366
 
367
367
  // Copyright (c) Microsoft Corporation.
368
368
  // Licensed under the MIT License.
369
+ /** Known values of {@link ReleaseDelay} that the service accepts. */
370
+ exports.KnownReleaseDelay = void 0;
371
+ (function (KnownReleaseDelay) {
372
+ /** Ten Minutes */
373
+ KnownReleaseDelay["TenMinutes"] = "600";
374
+ /** One Minute */
375
+ KnownReleaseDelay["OneMinute"] = "60";
376
+ /** Ten Seconds */
377
+ KnownReleaseDelay["TenSeconds"] = "10";
378
+ /** One Hour */
379
+ KnownReleaseDelay["OneHour"] = "3600";
380
+ /** No Delay */
381
+ KnownReleaseDelay["NoDelay"] = "0";
382
+ })(exports.KnownReleaseDelay || (exports.KnownReleaseDelay = {}));
369
383
  const cloudEventReservedPropertyNames = [
370
384
  "specVersion",
371
385
  "id",
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\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;IAC7E,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY;IACvD,MAAM,aAAa,GAAG,CAAA,wCAAA,CAA0C;IAChE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO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AAG3C,YAAA,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE;AACnC,gBAAA,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI;;AAGrC,YAAA,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE;AACnC,gBAAA,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI;;;AAIrC,YAAA,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;AACzC,gBAAA,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE;AACnC,oBAAA,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC;;gBAGzE,IAAI,EAAE,YAAY,CAAC,UAAU,YAAY,UAAU,CAAC,EAAE;AACpD,oBAAA,MAAM,IAAI,SAAS,CAAC,6DAA6D,CAAC;;AAGpF,gBAAA,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,UAAU;;;AAI3C,YAAA,MAAM,mBAAmB,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,YAAY,CAAE;AAC/C,YAAA,KAAK,MAAM,QAAQ,IAAI,+BAA+B,EAAE;AACtD,gBAAA,OAAO,mBAAmB,CAAC,QAAQ,CAAC;;YAEtC,OAAO,mBAAmB,CAAC,UAAU;;YAGrC,IAAI,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/C,gBAAA,UAAU,CAAC,mBAAmB,GAAG,mBAAmB;;AAGtD,YAAA,MAAM,CAAC,IAAI,CAAC,UAAiC,CAAC;;AAGhD,QAAA,OAAO,MAAM;;AAEhB;;;;;;;;;;"}
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 type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"../logger\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { isKeyCredential } from \"@azure/core-auth\";\nimport type { 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 type {\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 type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { 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 type {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"../models/models\";\nimport type {\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 { isUnexpected } from \"../rest/index\";\nimport type { StreamableMethod } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters, createRestError } from \"@azure-rest/core-client\";\nimport { uint8ArrayToString, stringToUint8Array } from \"@azure/core-util\";\nimport type {\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 type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport type {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./models/models\";\nimport type {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./models/options\";\nimport type { EventGridClientOptions, EventGridContext } from \"./api/index\";\nimport {\n createEventGrid,\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 type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\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 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 type {\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 type { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport type { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport type { SendEventsOptions, CloudEvent, EventGridSenderClientOptions } from \"./models\";\nimport { cloudEventReservedPropertyNames } 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 type { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport type {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport type {\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 type { KeyCredential } from \"@azure/core-auth\";\nimport type { 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 type { CloudEvent } from \"./models\";\nimport { 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","KnownReleaseDelay","EventGridClientGenerated","tracingPolicyName","randomUUID","createSerializer","CloudEventMapper"],"mappings":";;;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA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AC9R,iBAAiB,CACf,SAAiB,EACjB,qBAA6B,EAC7B,UAAoB,EACpB,UAA2C,EAAE,cAAc,EAAE,EAAE,EAAE;QAEjE,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAChG,CAAC;IAED,sUAAsU;IACtU,oBAAoB,CAClB,SAAiB,EACjB,qBAA6B,EAC7B,UAAoB,EACpB,UAA8C,EAAE,cAAc,EAAE,EAAE,EAAE;QAEpE,OAAO,oBAAoB,CACzB,IAAI,CAAC,OAAO,EACZ,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"EventGridClient.js","sourceRoot":"","sources":["../../../src/cadl-generated/EventGridClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuBlC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAIrB,MAAM,OAAO,eAAe;IAG1B,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAID,uCAAuC;IACvC,YACE,aAAqB,EACrB,UAA2C,EAC3C,UAAkC,EAAE;QAEpC,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,aAAa,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACxC,CAAC;IAED,yDAAyD;IACzD,iBAAiB,CACf,SAAiB,EACjB,KAAiB,EACjB,UAA2C,EAAE,cAAc,EAAE,EAAE,EAAE;QAEjE,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,C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E,OAAO,oBAAoB,CACzB,IAAI,CAAC,OAAO,EACZ,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport type {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./models/models\";\nimport type {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./models/options\";\nimport type { EventGridClientOptions, EventGridContext } from \"./api/index\";\nimport {\n createEventGrid,\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EventGridContext.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/EventGridContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,SAAS,MAAM,eAAe,CAAC;AAStC,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAC7B,aAAqB,EACrB,UAA2C,EAC3C,UAAkC,EAAE;IAEpC,MAAM,aAAa,GAAG,SAAS,CAAC,aAAa,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACpE,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"EventGridContext.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/EventGridContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,SAAS,MAAM,eAAe,CAAC;AAStC,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAC7B,aAAqB,EACrB,UAA2C,EAC3C,UAAkC,EAAE;IAEpC,MAAM,aAAa,GAAG,SAAS,CAAC,aAAa,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACpE,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { 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"]}
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { isUnexpected, } from "../rest/index";
4
- import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client";
3
+ import { isUnexpected } from "../rest/index";
4
+ import { operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client";
5
5
  import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util";
6
6
  export function _publishCloudEventSend(context, topicName, event, options = { requestOptions: {} }) {
7
7
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,OAAO,EACL,YAAY,GAgBb,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,mCAAmC,EACnC,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAW1E,MAAM,UAAU,sBAAsB,CACpC,OAAe,EACf,SAAiB,EACjB,KAAiB,EACjB,UAA2C,EAAE,cAAc,EAAE,EAAE,EAAE;;IAEjE,OAAO,OAAO,CAAC,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CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5D,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC;YACzB,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC,CAAC;QACH,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,sUAAsU;AACtU,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAe,EACf,SAAiB,EACjB,qBAA6B,EAC7B,UAAoB,EACpB,UAA8C,EAAE,cAAc,EAAE,EAAE,EAAE;IAEpE,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,OAAO,CACR,CAAC;IACF,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4BlC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,mCAAmC,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAW1E,MAAM,UAAU,sBAAsB,CACpC,OAAe,EACf,SAAiB,EACjB,KAAiB,EACjB,UAA2C,EAAE,cAAc,EAAE,EAAE,EAAE;;IAEjE,OAAO,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC,IAAI,iCAC7D,mCAAmC,CAAC,OAAO,CAAC,KAC/C,WAAW,EAAE,MAAC,OAAO,CAAC,WAAmB,mCAAI,6CAA6C,EAC1F,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC;YACf,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;YACvB,IAAI,EAAE,KAAK,CAAC,MAAM,CAA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,UAAU,oBAAoB,CACxC,OAAe,EACf,SAAiB,EACjB,qBAA6B,EAC7B,UAAoB,EACpB,UAA8C,EAAE,cAAc,EAAE,EAAE,EAAE;IAEpE,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,OAAO,CACR,CAAC;IACF,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"../models/models\";\nimport type {\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 { isUnexpected } from \"../rest/index\";\nimport type { StreamableMethod } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters, createRestError } from \"@azure-rest/core-client\";\nimport { uint8ArrayToString, stringToUint8Array } from \"@azure/core-util\";\nimport type {\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ErrorModel } from \"@azure-rest/core-client\";\n\n/** Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema. */\nexport interface CloudEvent {\n /** An identifier for the event. The combination of id and source must be unique for each distinct event. */\n id: string;\n /** Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. */\n source: string;\n /** Event data specific to the event type. */\n data?: unknown;\n /** Event data specific to the event type, encoded as a base64 string. */\n dataBase64?: Uint8Array;\n /** Type of event related to the originating occurrence. */\n type: string;\n /** The time (in UTC) the event was generated, in RFC3339 format. */\n time?: Date;\n /** The version of the CloudEvents specification which the event uses. */\n specversion: string;\n /** Identifies the schema that data adheres to. */\n dataschema?: string;\n /** Content type of data value. */\n datacontenttype?: string;\n /** This describes the subject of the event in the context of the event producer (identified by source). */\n subject?: string;\n}\n\n/** The result of the Publish operation. */\nexport interface PublishResult {}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails[];\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent;\n}\n\n/** Properties of the Event Broker operation. */\nexport interface BrokerProperties {\n /** The token of the lock on the event. */\n lockToken: string;\n /** The attempt count for delivering the event. */\n deliveryCount: number;\n}\n\n/** The result of the Acknowledge operation. */\nexport interface AcknowledgeResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully acknowledged cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Failed LockToken information. */\nexport interface FailedLockToken {\n /** The lock token of an entry in the request. */\n lockToken: string;\n /** Error information of the failed operation result for the lock token in the request. */\n error: ErrorModel;\n}\n\n/** Supported delays for release operation. */\n/** \"0\", \"10\", \"60\", \"600\", \"3600\" */\nexport type ReleaseDelay = string;\n\n/** The result of the Release operation. */\nexport interface ReleaseResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully released cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the Reject operation. */\nexport interface RejectResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully rejected cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the RenewLock operation. */\nexport interface RenewLocksResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully renewed locks. */\n succeededLockTokens: string[];\n}\n\n/** */\nexport type ServiceApiVersions =\n | \"2023-06-01-preview\"\n | \"2023-10-01-preview\"\n | \"2023-11-01\"\n | \"2024-06-01\";\n\nexport interface ErrorResponse {\n /** The error object. */\n error: ErrorModel;\n}\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ErrorModel } from \"@azure-rest/core-client\";\n\n/** Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema. */\nexport interface CloudEvent {\n /** An identifier for the event. The combination of id and source must be unique for each distinct event. */\n id: string;\n /** Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. */\n source: string;\n /** Event data specific to the event type. */\n data?: unknown;\n /** Event data specific to the event type, encoded as a base64 string. */\n dataBase64?: Uint8Array;\n /** Type of event related to the originating occurrence. */\n type: string;\n /** The time (in UTC) the event was generated, in RFC3339 format. */\n time?: Date;\n /** The version of the CloudEvents specification which the event uses. */\n specversion: string;\n /** Identifies the schema that data adheres to. */\n dataschema?: string;\n /** Content type of data value. */\n datacontenttype?: string;\n /** This describes the subject of the event in the context of the event producer (identified by source). */\n subject?: string;\n}\n\n/** The result of the Publish operation. */\nexport interface PublishResult {}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResult {\n /** Array of receive responses, one per cloud event. */\n details: ReceiveDetails[];\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEvent;\n}\n\n/** Properties of the Event Broker operation. */\nexport interface BrokerProperties {\n /** The token of the lock on the event. */\n lockToken: string;\n /** The attempt count for delivering the event. */\n deliveryCount: number;\n}\n\n/** The result of the Acknowledge operation. */\nexport interface AcknowledgeResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully acknowledged cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Failed LockToken information. */\nexport interface FailedLockToken {\n /** The lock token of an entry in the request. */\n lockToken: string;\n /** Error information of the failed operation result for the lock token in the request. */\n error: ErrorModel;\n}\n\n/** Supported delays for release operation. */\n/** \"0\", \"10\", \"60\", \"600\", \"3600\" */\nexport type ReleaseDelay = string;\n\n/** The result of the Release operation. */\nexport interface ReleaseResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully released cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the Reject operation. */\nexport interface RejectResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully rejected cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the RenewLock operation. */\nexport interface RenewLocksResult {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens for the successfully renewed locks. */\n succeededLockTokens: string[];\n}\n\n/** */\nexport type ServiceApiVersions =\n | \"2023-06-01-preview\"\n | \"2023-10-01-preview\"\n | \"2023-11-01\"\n | \"2024-06-01\";\n\nexport interface ErrorResponse {\n /** The error object. */\n error: ErrorModel;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { ReleaseDelay } from \"./models\";\n\nexport interface PublishCloudEventOptionalParams extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface PublishCloudEventsOptionalParams extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface ReceiveCloudEventsOptionalParams extends OperationOptions {\n /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */\n maxEvents?: number;\n /** Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. */\n maxWaitTime?: number;\n}\n\nexport interface AcknowledgeCloudEventsOptionalParams extends OperationOptions {}\n\nexport interface ReleaseCloudEventsOptionalParams extends OperationOptions {\n /** Release cloud events with the specified delay in seconds. */\n releaseDelayInSeconds?: ReleaseDelay;\n}\n\nexport interface RejectCloudEventsOptionalParams extends OperationOptions {}\n\nexport interface RenewCloudEventLocksOptionalParams extends OperationOptions {}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { ReleaseDelay } from \"./models\";\n\nexport interface PublishCloudEventOptionalParams extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface PublishCloudEventsOptionalParams extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface ReceiveCloudEventsOptionalParams extends OperationOptions {\n /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */\n maxEvents?: number;\n /** Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. */\n maxWaitTime?: number;\n}\n\nexport interface AcknowledgeCloudEventsOptionalParams extends OperationOptions {}\n\nexport interface ReleaseCloudEventsOptionalParams extends OperationOptions {\n /** Release cloud events with the specified delay in seconds. */\n releaseDelayInSeconds?: ReleaseDelay;\n}\n\nexport interface RejectCloudEventsOptionalParams extends OperationOptions {}\n\nexport interface RenewCloudEventLocksOptionalParams extends OperationOptions {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n PublishCloudEventParameters,\n PublishCloudEventsParameters,\n ReceiveCloudEventsParameters,\n AcknowledgeCloudEventsParameters,\n ReleaseCloudEventsParameters,\n RejectCloudEventsParameters,\n RenewCloudEventLocksParameters,\n} from \"./parameters\";\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\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface PublishCloudEvent {\n /** Publish a single Cloud Event to a namespace topic. */\n post(\n options: PublishCloudEventParameters,\n ): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse>;\n /** Publish a batch of Cloud Events to a namespace topic. */\n post(\n options: PublishCloudEventsParameters,\n ): StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse>;\n}\n\nexport interface ReceiveCloudEvents {\n /** Receive a batch of Cloud Events from a subscription. */\n post(\n options?: ReceiveCloudEventsParameters,\n ): StreamableMethod<ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse>;\n}\n\nexport interface AcknowledgeCloudEvents {\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 post(\n options?: AcknowledgeCloudEventsParameters,\n ): StreamableMethod<AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse>;\n}\n\nexport interface ReleaseCloudEvents {\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 post(\n options?: ReleaseCloudEventsParameters,\n ): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse>;\n}\n\nexport interface RejectCloudEvents {\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 post(\n options?: RejectCloudEventsParameters,\n ): StreamableMethod<RejectCloudEvents200Response | RejectCloudEventsDefaultResponse>;\n}\n\nexport interface RenewCloudEventLocks {\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 post(\n options?: RenewCloudEventLocksParameters,\n ): StreamableMethod<RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/topics/\\{topicName\\}:publish' has methods for the following verbs: post */\n (path: \"/topics/{topicName}:publish\", topicName: string): PublishCloudEvent;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:receive' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\",\n topicName: string,\n eventSubscriptionName: string,\n ): ReceiveCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:acknowledge' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\",\n topicName: string,\n eventSubscriptionName: string,\n ): AcknowledgeCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:release' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\",\n topicName: string,\n eventSubscriptionName: string,\n ): ReleaseCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:reject' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\",\n topicName: string,\n eventSubscriptionName: string,\n ): RejectCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:renewLock' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\",\n topicName: string,\n eventSubscriptionName: string,\n ): RenewCloudEventLocks;\n}\n\nexport type EventGridContext = Client & {\n path: Routes;\n};\n"]}
1
+ {"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PublishCloudEventParameters,\n PublishCloudEventsParameters,\n ReceiveCloudEventsParameters,\n AcknowledgeCloudEventsParameters,\n ReleaseCloudEventsParameters,\n RejectCloudEventsParameters,\n RenewCloudEventLocksParameters,\n} from \"./parameters\";\nimport type {\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\";\nimport type { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface PublishCloudEvent {\n /** Publish a single Cloud Event to a namespace topic. */\n post(\n options: PublishCloudEventParameters,\n ): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse>;\n /** Publish a batch of Cloud Events to a namespace topic. */\n post(\n options: PublishCloudEventsParameters,\n ): StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse>;\n}\n\nexport interface ReceiveCloudEvents {\n /** Receive a batch of Cloud Events from a subscription. */\n post(\n options?: ReceiveCloudEventsParameters,\n ): StreamableMethod<ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse>;\n}\n\nexport interface AcknowledgeCloudEvents {\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 post(\n options?: AcknowledgeCloudEventsParameters,\n ): StreamableMethod<AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse>;\n}\n\nexport interface ReleaseCloudEvents {\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 post(\n options?: ReleaseCloudEventsParameters,\n ): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse>;\n}\n\nexport interface RejectCloudEvents {\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 post(\n options?: RejectCloudEventsParameters,\n ): StreamableMethod<RejectCloudEvents200Response | RejectCloudEventsDefaultResponse>;\n}\n\nexport interface RenewCloudEventLocks {\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 post(\n options?: RenewCloudEventLocksParameters,\n ): StreamableMethod<RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/topics/\\{topicName\\}:publish' has methods for the following verbs: post */\n (path: \"/topics/{topicName}:publish\", topicName: string): PublishCloudEvent;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:receive' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\",\n topicName: string,\n eventSubscriptionName: string,\n ): ReceiveCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:acknowledge' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\",\n topicName: string,\n eventSubscriptionName: string,\n ): AcknowledgeCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:release' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\",\n topicName: string,\n eventSubscriptionName: string,\n ): ReleaseCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:reject' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\",\n topicName: string,\n eventSubscriptionName: string,\n ): RejectCloudEvents;\n /** Resource for '/topics/\\{topicName\\}/eventsubscriptions/\\{eventSubscriptionName\\}:renewLock' has methods for the following verbs: post */\n (\n path: \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock\",\n topicName: string,\n eventSubscriptionName: string,\n ): RenewCloudEventLocks;\n}\n\nexport type EventGridContext = Client & {\n path: Routes;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridClient.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/eventGridClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAkC,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,U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AC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"eventGridClient.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/eventGridClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD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eAAe,EAAE,kBAAkB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;gBAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"../logger\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { isKeyCredential } from \"@azure/core-auth\";\nimport type { 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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AE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAmBlC,MAAM,WAAW,GAA6B;IAC5C,kCAAkC,EAAE,CAAC,KAAK,CAAC;IAC3C,6EAA6E,EAAE,CAAC,KAAK,CAAC;IACtF,iFAAiF,EAAE,CAAC,KAAK,CAAC;IAC1F,6EAA6E,EAAE,CAAC,KAAK,CAAC;IACtF,4EAA4E,EAAE,CAAC,KAAK,CAAC;IACrF,+EAA+E,EAAE,CAAC,KAAK,CAAC;CACzF,CAAC;AAuBF,MAAM,UAAU,YAAY,CAC1B,QAcuC;IASvC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,IAAI,WAAW,GAAG,WAAW,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,0BAA0B,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAc,EAAE,IAAY;;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,+CAA+C;IAC/C,2CAA2C;IAC3C,8CAA8C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AAE,CAAC,CAAC,IAAI,CAC1E,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ErrorModel } from \"@azure-rest/core-client\";\n\n/** Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema. */\nexport interface CloudEventOutput {\n /** An identifier for the event. The combination of id and source must be unique for each distinct event. */\n id: string;\n /** Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. */\n source: string;\n /** Event data specific to the event type. */\n data?: any;\n /** Event data specific to the event type, encoded as a base64 string. */\n data_base64?: string;\n /** Type of event related to the originating occurrence. */\n type: string;\n /** The time (in UTC) the event was generated, in RFC3339 format. */\n time?: string;\n /** The version of the CloudEvents specification which the event uses. */\n specversion: string;\n /** Identifies the schema that data adheres to. */\n dataschema?: string;\n /** Content type of data value. */\n datacontenttype?: string;\n /** This describes the subject of the event in the context of the event producer (identified by source). */\n subject?: string;\n}\n\n/** The result of the Publish operation. */\nexport interface PublishResultOutput {}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResultOutput {\n /** Array of receive responses, one per cloud event. */\n value: Array<ReceiveDetailsOutput>;\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetailsOutput {\n /** The Event Broker details. */\n brokerProperties: BrokerPropertiesOutput;\n /** Cloud Event details. */\n event: CloudEventOutput;\n}\n\n/** Properties of the Event Broker operation. */\nexport interface BrokerPropertiesOutput {\n /** The token of the lock on the event. */\n lockToken: string;\n /** The attempt count for delivering the event. */\n deliveryCount: number;\n}\n\n/** The result of the Acknowledge operation. */\nexport interface AcknowledgeResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully acknowledged cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Failed LockToken information. */\nexport interface FailedLockTokenOutput {\n /** The lock token of an entry in the request. */\n lockToken: string;\n /** Error information of the failed operation result for the lock token in the request. */\n error: ErrorModel;\n}\n\n/** The result of the Release operation. */\nexport interface ReleaseResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully released cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the Reject operation. */\nexport interface RejectResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully rejected cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the RenewLock operation. */\nexport interface RenewCloudEventLocksResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully renewed locks. */\n succeededLockTokens: string[];\n}\n"]}
1
+ {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ErrorModel } from \"@azure-rest/core-client\";\n\n/** Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema. */\nexport interface CloudEventOutput {\n /** An identifier for the event. The combination of id and source must be unique for each distinct event. */\n id: string;\n /** Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. */\n source: string;\n /** Event data specific to the event type. */\n data?: any;\n /** Event data specific to the event type, encoded as a base64 string. */\n data_base64?: string;\n /** Type of event related to the originating occurrence. */\n type: string;\n /** The time (in UTC) the event was generated, in RFC3339 format. */\n time?: string;\n /** The version of the CloudEvents specification which the event uses. */\n specversion: string;\n /** Identifies the schema that data adheres to. */\n dataschema?: string;\n /** Content type of data value. */\n datacontenttype?: string;\n /** This describes the subject of the event in the context of the event producer (identified by source). */\n subject?: string;\n}\n\n/** The result of the Publish operation. */\nexport interface PublishResultOutput {}\n\n/** Details of the Receive operation response. */\nexport interface ReceiveResultOutput {\n /** Array of receive responses, one per cloud event. */\n value: Array<ReceiveDetailsOutput>;\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetailsOutput {\n /** The Event Broker details. */\n brokerProperties: BrokerPropertiesOutput;\n /** Cloud Event details. */\n event: CloudEventOutput;\n}\n\n/** Properties of the Event Broker operation. */\nexport interface BrokerPropertiesOutput {\n /** The token of the lock on the event. */\n lockToken: string;\n /** The attempt count for delivering the event. */\n deliveryCount: number;\n}\n\n/** The result of the Acknowledge operation. */\nexport interface AcknowledgeResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully acknowledged cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Failed LockToken information. */\nexport interface FailedLockTokenOutput {\n /** The lock token of an entry in the request. */\n lockToken: string;\n /** Error information of the failed operation result for the lock token in the request. */\n error: ErrorModel;\n}\n\n/** The result of the Release operation. */\nexport interface ReleaseResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully released cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the Reject operation. */\nexport interface RejectResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully rejected cloud events. */\n succeededLockTokens: string[];\n}\n\n/** The result of the RenewLock operation. */\nexport interface RenewCloudEventLocksResultOutput {\n /** Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the related error information (namely, the error code and description). */\n failedLockTokens: Array<FailedLockTokenOutput>;\n /** Array of lock tokens for the successfully renewed locks. */\n succeededLockTokens: string[];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { CloudEvent, ReleaseDelay } from \"./models\";\n\nexport interface PublishCloudEventBodyParam {\n /** Single Cloud Event being published. */\n body: CloudEvent;\n}\n\nexport interface PublishCloudEventMediaTypesParam {\n /** content type */\n contentType: \"application/cloudevents+json; charset=utf-8\";\n}\n\nexport type PublishCloudEventParameters = PublishCloudEventMediaTypesParam &\n PublishCloudEventBodyParam &\n RequestParameters;\n\nexport interface PublishCloudEventsBodyParam {\n /** Array of Cloud Events being published. */\n body: Array<CloudEvent>;\n}\n\nexport interface PublishCloudEventsMediaTypesParam {\n /** content type */\n contentType: \"application/cloudevents-batch+json; charset=utf-8\";\n}\n\nexport type PublishCloudEventsParameters = PublishCloudEventsMediaTypesParam &\n PublishCloudEventsBodyParam &\n RequestParameters;\n\nexport interface ReceiveCloudEventsQueryParamProperties {\n /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */\n maxEvents?: number;\n /** Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. */\n maxWaitTime?: number;\n}\n\nexport interface ReceiveCloudEventsQueryParam {\n queryParameters?: ReceiveCloudEventsQueryParamProperties;\n}\n\nexport type ReceiveCloudEventsParameters = ReceiveCloudEventsQueryParam & RequestParameters;\n\nexport interface AcknowledgeCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type AcknowledgeCloudEventsParameters = AcknowledgeCloudEventsBodyParam & RequestParameters;\n\nexport interface ReleaseCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport interface ReleaseCloudEventsQueryParamProperties {\n /** Release cloud events with the specified delay in seconds. */\n releaseDelayInSeconds?: ReleaseDelay;\n}\n\nexport interface ReleaseCloudEventsQueryParam {\n queryParameters?: ReleaseCloudEventsQueryParamProperties;\n}\n\nexport type ReleaseCloudEventsParameters = ReleaseCloudEventsQueryParam &\n ReleaseCloudEventsBodyParam &\n RequestParameters;\n\nexport interface RejectCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type RejectCloudEventsParameters = RejectCloudEventsBodyParam & RequestParameters;\n\nexport interface RenewCloudEventLocksBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type RenewCloudEventLocksParameters = RenewCloudEventLocksBodyParam & RequestParameters;\n"]}
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { CloudEvent, ReleaseDelay } from \"./models\";\n\nexport interface PublishCloudEventBodyParam {\n /** Single Cloud Event being published. */\n body: CloudEvent;\n}\n\nexport interface PublishCloudEventMediaTypesParam {\n /** content type */\n contentType: \"application/cloudevents+json; charset=utf-8\";\n}\n\nexport type PublishCloudEventParameters = PublishCloudEventMediaTypesParam &\n PublishCloudEventBodyParam &\n RequestParameters;\n\nexport interface PublishCloudEventsBodyParam {\n /** Array of Cloud Events being published. */\n body: Array<CloudEvent>;\n}\n\nexport interface PublishCloudEventsMediaTypesParam {\n /** content type */\n contentType: \"application/cloudevents-batch+json; charset=utf-8\";\n}\n\nexport type PublishCloudEventsParameters = PublishCloudEventsMediaTypesParam &\n PublishCloudEventsBodyParam &\n RequestParameters;\n\nexport interface ReceiveCloudEventsQueryParamProperties {\n /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */\n maxEvents?: number;\n /** Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. */\n maxWaitTime?: number;\n}\n\nexport interface ReceiveCloudEventsQueryParam {\n queryParameters?: ReceiveCloudEventsQueryParamProperties;\n}\n\nexport type ReceiveCloudEventsParameters = ReceiveCloudEventsQueryParam & RequestParameters;\n\nexport interface AcknowledgeCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type AcknowledgeCloudEventsParameters = AcknowledgeCloudEventsBodyParam & RequestParameters;\n\nexport interface ReleaseCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport interface ReleaseCloudEventsQueryParamProperties {\n /** Release cloud events with the specified delay in seconds. */\n releaseDelayInSeconds?: ReleaseDelay;\n}\n\nexport interface ReleaseCloudEventsQueryParam {\n queryParameters?: ReleaseCloudEventsQueryParamProperties;\n}\n\nexport type ReleaseCloudEventsParameters = ReleaseCloudEventsQueryParam &\n ReleaseCloudEventsBodyParam &\n RequestParameters;\n\nexport interface RejectCloudEventsBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type RejectCloudEventsParameters = RejectCloudEventsBodyParam & RequestParameters;\n\nexport interface RenewCloudEventLocksBodyParam {\n body?: { lockTokens: string[] };\n}\n\nexport type RenewCloudEventLocksParameters = RenewCloudEventLocksBodyParam & RequestParameters;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport {\n PublishResultOutput,\n ReceiveResultOutput,\n AcknowledgeResultOutput,\n ReleaseResultOutput,\n RejectResultOutput,\n RenewCloudEventLocksResultOutput,\n} from \"./outputModels\";\n\n/** The request has succeeded. */\nexport interface PublishCloudEvent200Response extends HttpResponse {\n status: \"200\";\n body: PublishResultOutput;\n}\n\nexport interface PublishCloudEventDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface PublishCloudEventDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & PublishCloudEventDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface PublishCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: PublishResultOutput;\n}\n\nexport interface PublishCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface PublishCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & PublishCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ReceiveCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: ReceiveResultOutput;\n}\n\nexport interface ReceiveCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ReceiveCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ReceiveCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface AcknowledgeCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: AcknowledgeResultOutput;\n}\n\nexport interface AcknowledgeCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface AcknowledgeCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & AcknowledgeCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ReleaseCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: ReleaseResultOutput;\n}\n\nexport interface ReleaseCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ReleaseCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ReleaseCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface RejectCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: RejectResultOutput;\n}\n\nexport interface RejectCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface RejectCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & RejectCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface RenewCloudEventLocks200Response extends HttpResponse {\n status: \"200\";\n body: RenewCloudEventLocksResultOutput;\n}\n\nexport interface RenewCloudEventLocksDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface RenewCloudEventLocksDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & RenewCloudEventLocksDefaultHeaders;\n}\n"]}
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport type { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport type {\n PublishResultOutput,\n ReceiveResultOutput,\n AcknowledgeResultOutput,\n ReleaseResultOutput,\n RejectResultOutput,\n RenewCloudEventLocksResultOutput,\n} from \"./outputModels\";\n\n/** The request has succeeded. */\nexport interface PublishCloudEvent200Response extends HttpResponse {\n status: \"200\";\n body: PublishResultOutput;\n}\n\nexport interface PublishCloudEventDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface PublishCloudEventDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & PublishCloudEventDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface PublishCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: PublishResultOutput;\n}\n\nexport interface PublishCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface PublishCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & PublishCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ReceiveCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: ReceiveResultOutput;\n}\n\nexport interface ReceiveCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ReceiveCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ReceiveCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface AcknowledgeCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: AcknowledgeResultOutput;\n}\n\nexport interface AcknowledgeCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface AcknowledgeCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & AcknowledgeCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface ReleaseCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: ReleaseResultOutput;\n}\n\nexport interface ReleaseCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface ReleaseCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & ReleaseCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface RejectCloudEvents200Response extends HttpResponse {\n status: \"200\";\n body: RejectResultOutput;\n}\n\nexport interface RejectCloudEventsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface RejectCloudEventsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & RejectCloudEventsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface RenewCloudEventLocks200Response extends HttpResponse {\n status: \"200\";\n body: RenewCloudEventLocksResultOutput;\n}\n\nexport interface RenewCloudEventLocksDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface RenewCloudEventLocksDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & RenewCloudEventLocksDefaultHeaders;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cloudEventDistrubtedTracingEnricherPolicy.js","sourceRoot":"","sources":["../../src/cloudEventDistrubtedTracingEnricherPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,MAAM,CAAC,MAAM,0BAA0B,GAAG,mDAAmD,CAAC;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,8CAA8C,GACzD,4CAA4C,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0CAA0C;IACxD,OAAO;QACL,IAAI,EAAE,8CAA8C;QACpD,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAE7D,IACE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,0BAA0B;gBACzE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAChC,WAAW,EACX,CAAC;gBACD,yFAAyF;gBACzF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAU,CAAC;gBAErD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;oBAC9B,yFAAyF;oBACzF,2FAA2F;oBAC3F,uFAAuF;oBACvF,6EAA6E;oBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;wBACjD,SAAS;oBACX,CAAC;oBAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;oBAC/B,IAAI,UAAU,EAAE,CAAC;wBACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;oBAC/B,CAAC;gBACH,CAAC;gBAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"cloudEventDistrubtedTracingEnricherPolicy.js","sourceRoot":"","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AC/B,CAAC;gBACH,CAAC;gBAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../src/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAc,+BAA+B,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAE/F,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAqB;IAiBzB,KAAK,CAAC,sBAAsB,CACjC,aAA+C;QAE/C,MAAM,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,MAAM,GAA0B,EAAE,CAAC;QAEzC,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;YAC7B,uBAAuB,CAAC,CAAC,CAAC,CAAC;YAE3B,yGAAyG;YACzG,0BAA0B;YAE1B,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACrE,MAAM,UAAU,GAAwB;gBACtC,WAAW,EAAE,YAAY,CAAC,WAAW;gBACrC,EAAE,EAAE,YAAY,CAAC,EAAE;gBACnB,MAAM,EAAE,YAAY,CAAC,MAAM;gBAC3B,IAAI,EAAE,YAAY,CAAC,IAAI;aACxB,CAAC;YAEF,IAAI,YAAY,CAAC,eA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CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;YACvD,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,UAAiC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// 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"]}
1
+ {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../src/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;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,CAAC;YAED,0IAA0I;YAC1I,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC1C,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBACpC,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;gBAC1E,CAAC;gBAED,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,YAAY,UAAU,CAAC,EAAE,CAAC;oBACrD,MAAM,IAAI,SAAS,CAAC,6DAA6D,CAAC,CAAC;gBACrF,CAAC;gBAED,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,UAAU,CAAC;YAC5C,CAAC;YAED,4FAA4F;YAC5F,MAAM,mBAAmB,qBAAQ,YAAY,CAAE,CAAC;YAChD,KAAK,MAAM,QAAQ,IAAI,+BAA+B,EAAE,CAAC;gBACvD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,mBAAmB,CAAC,UAAU,CAAC;YAEtC,oDAAoD;YACpD,IAAI,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;YACvD,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,UAAiC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport type { CloudEvent } from \"./models\";\nimport { 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"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { isUnexpected, } from "./cadl-generated/rest/index";
3
+ import { isUnexpected } from "./cadl-generated/rest/index";
4
4
  import { operationOptionsToRequestParameters } from "@azure-rest/core-client";
5
5
  // eslint-disable-next-line @typescript-eslint/no-redeclare
6
6
  import { Buffer } from "buffer";
@@ -1 +1 @@
1
- {"version":3,"file":"eventGridNamespacesPublishBinaryMode.js","sourceRoot":"","sources":["../../src/eventGridNamespacesPublishBinaryMode.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,YAAY,GAIb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAoB,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAGhG,2DAA2D;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAe,EACf,SAAiB,EACjB,KAAiB,EACjB,UAA2C,EAAE,cAAc,EAAE,EAAE,EAAE;IAEjE,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CA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H,CAAC;SAAM,CAAC;QACN,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC,IAAI,iCAC7D,mCAAmC,CAAC,OAAO,CAAC,KAC/C,WAAW,EAAE,MAAC,OAAO,CAAC,WAAmB,mCAAI,6CAA6C,EAC1F,OAAO,EACP,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI;YACJ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,0CAAE,WAAW,EAAE;YAC/B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,IACD,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n isUnexpected,\n EventGridContext as Client,\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n} from \"./cadl-generated/rest/index\";\nimport { StreamableMethod, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport { PublishCloudEventOptionalParams } from \"./cadl-generated/models/options\";\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nimport { Buffer } from \"buffer\";\nimport { CloudEvent } from \"./cadl-generated\";\n\nexport async function publishCloudEventInBinaryMode(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): Promise<Record<string, any>> {\n const result = await _publishCloudEventSendBinaryMode(context, topicName, event, options);\n return _publishCloudEventDeserialize(result);\n}\n\nexport async function _publishCloudEventDeserialize(\n result: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): Promise<Record<string, any>> {\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return result.body;\n}\n\nexport function _publishCloudEventSendBinaryMode(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse> {\n const headers: RawHttpHeadersInput = {\n \"ce-id\": event.id,\n \"ce-source\": event.source,\n \"ce-type\": event.type,\n \"ce-specversion\": event.specversion,\n };\n\n if (event.time) {\n headers[\"ce-time\"] = event.time.toISOString();\n }\n\n if (event.dataschema) {\n headers[\"ce-dataschema\"] = event.dataschema;\n }\n\n if (event.datacontenttype) {\n headers[\"ce-datacontenttype\"] = event.datacontenttype;\n }\n\n if (event.subject) {\n headers[\"ce-subject\"] = event.subject;\n }\n\n let data: any;\n if (event.data) {\n // If data is already encoded\n if (Buffer.isBuffer(event.data)) {\n data = event.data;\n } else {\n throw new Error(`CloudEvent data must be binary when in binary mode.`);\n }\n } else {\n if (event.dataBase64) {\n data = event.dataBase64;\n }\n }\n\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 headers,\n body: {\n id: event.id,\n source: event.source,\n data,\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 });\n}\n"]}
1
+ {"version":3,"file":"eventGridNamespacesPublishBinaryMode.js","sourceRoot":"","sources":["../../src/eventGridNamespacesPublishBinaryMode.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAG9E,2DAA2D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O,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IACxC,CAAC;IAED,IAAI,IAAS,CAAC;IACd,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,6BAA6B;QAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC,IAAI,iCAC7D,mCAAmC,CAAC,OAAO,CAAC,KAC/C,WAAW,EAAE,MAAC,OAAO,CAAC,WAAmB,mCAAI,6CAA6C,EAC1F,OAAO,EACP,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI;YACJ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,0CAAE,WAAW,EAAE;YAC/B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,IACD,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n EventGridContext as Client,\n PublishCloudEvent200Response,\n PublishCloudEventDefaultResponse,\n} from \"./cadl-generated/rest/index\";\nimport { isUnexpected } from \"./cadl-generated/rest/index\";\nimport type { StreamableMethod } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type { PublishCloudEventOptionalParams } from \"./cadl-generated/models/options\";\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nimport { Buffer } from \"buffer\";\nimport type { CloudEvent } from \"./cadl-generated\";\n\nexport async function publishCloudEventInBinaryMode(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): Promise<Record<string, any>> {\n const result = await _publishCloudEventSendBinaryMode(context, topicName, event, options);\n return _publishCloudEventDeserialize(result);\n}\n\nexport async function _publishCloudEventDeserialize(\n result: PublishCloudEvent200Response | PublishCloudEventDefaultResponse,\n): Promise<Record<string, any>> {\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return result.body;\n}\n\nexport function _publishCloudEventSendBinaryMode(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptionalParams = { requestOptions: {} },\n): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse> {\n const headers: RawHttpHeadersInput = {\n \"ce-id\": event.id,\n \"ce-source\": event.source,\n \"ce-type\": event.type,\n \"ce-specversion\": event.specversion,\n };\n\n if (event.time) {\n headers[\"ce-time\"] = event.time.toISOString();\n }\n\n if (event.dataschema) {\n headers[\"ce-dataschema\"] = event.dataschema;\n }\n\n if (event.datacontenttype) {\n headers[\"ce-datacontenttype\"] = event.datacontenttype;\n }\n\n if (event.subject) {\n headers[\"ce-subject\"] = event.subject;\n }\n\n let data: any;\n if (event.data) {\n // If data is already encoded\n if (Buffer.isBuffer(event.data)) {\n data = event.data;\n } else {\n throw new Error(`CloudEvent data must be binary when in binary mode.`);\n }\n } else {\n if (event.dataBase64) {\n data = event.dataBase64;\n }\n }\n\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 headers,\n body: {\n id: event.id,\n source: event.source,\n data,\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 });\n}\n"]}
@@ -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,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,gBAAgB,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,0CAA0C,EAAE,EAAE;YAC5E,aAAa,EAAE,CAAC,iBAAiB,CAAC;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACjB,UAAgC,EAAE,cAAc,EAAE,EAAE,EAAE;QAEtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAClD,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,iBAAiB,EACtB,OAAO,CACR,CAAC;QAEF,MAAM,cAAc,GAAqB;YACvC,OAAO,EAAE,MAAM,C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AAO,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"]}
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,U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ACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport type {\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n} from \"./cadl-generated/models\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport type {\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"]}
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
  import { randomUUID } from "@azure/core-util";
4
4
  import { EventGridClient as EventGridClientGenerated } from "./cadl-generated/EventGridClient";
5
- import { cloudEventReservedPropertyNames, } from "./models";
5
+ import { cloudEventReservedPropertyNames } from "./models";
6
6
  import { cloudEventDistributedTracingEnricherPolicy } from "./cloudEventDistrubtedTracingEnricherPolicy";
7
7
  import { tracingPolicyName } from "@azure/core-rest-pipeline";
8
8
  /**
@@ -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,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAIhC,uCAAuC;IACvC,YACE,QAAgB,EAChB,UAAgD,EAChD,SAAiB,EACjB,UAAwC,EAAE;QAE1C,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,0CAA0C,EAAE,EAAE;YAC5E,aAAa,EAAE,CAAC,iBAAiB,CAAC;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M,EACpB,EAAE,EAAE,MAAA,KAAK,CAAC,EAAE,mCAAI,UAAU,EAAE,EAC5B,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,mCAAI,IAAI,IAAI,EAAE,EAC9B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,eAAe,EAAE,KAAK,CAAC,eAAe,IACnC,CAAC,MAAA,KAAK,CAAC,mBAAmB,mCAAI,EAAE,CAAC,CACrC,CAAC;IAEF,IAAI,KAAK,CAAC,IAAI,YAAY,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;QACJ,CAAC;QAED,SAAS,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAClD,SAAS,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;\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
+ {"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;AAE/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAIhC,uCAAuC;IACvC,YACE,QAAgB,EAChB,UAAgD,EAChD,SAAiB,EACjB,UAAwC,EAAE;QAE1C,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,0CAA0C,EAAE,EAAE;YAC5E,aAAa,EAAE,CAAC,iBAAiB,CAAC;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,UAAU,CACd,MAAuC,EACvC,UAA6B,EAAE,cAAc,EAAE,EAAE,EAAE;QAEnD,IAAI,KAAK,CAAC,O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K,CAAC,OAAO,EACtB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,eAAe,EAAE,KAAK,CAAC,eAAe,IACnC,CAAC,MAAA,KAAK,CAAC,mBAAmB,mCAAI,EAAE,CAAC,CACrC,CAAC;IAEF,IAAI,KAAK,CAAC,IAAI,YAAY,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;QACJ,CAAC;QAED,SAAS,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAClD,SAAS,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 type { AzureKeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport type { CloudEvent as CloudEventWireModel } from \"./cadl-generated/models\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { EventGridClient as EventGridClientGenerated } from \"./cadl-generated/EventGridClient\";\nimport type { SendEventsOptions, CloudEvent, EventGridSenderClientOptions } from \"./models\";\nimport { cloudEventReservedPropertyNames } 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"]}
@@ -3,5 +3,6 @@
3
3
  export { AzureKeyCredential } from "@azure/core-auth";
4
4
  export { EventGridSenderClient } from "./eventGridSenderClient";
5
5
  export { EventGridReceiverClient } from "./eventGridReceiverClient";
6
+ export { KnownReleaseDelay, } from "./models";
6
7
  export { EventGridDeserializer } from "./consumer";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAkBtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAqBpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { AzureKeyCredential } from \"@azure/core-auth\";\n\nexport {\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseResult,\n RejectResult,\n ReleaseDelay,\n RenewLocksResult,\n AcknowledgeCloudEventsOptionalParams as AcknowledgeEventsOptionalParams,\n ReceiveCloudEventsOptionalParams as ReceiveEventsOptionalParams,\n RejectCloudEventsOptionalParams as RejectEventsOptionalParams,\n RenewCloudEventLocksOptionalParams as RenewEventLocksOptionalParams,\n PublishCloudEventsOptionalParams as SendEventsOptionalParams,\n PublishCloudEventOptionalParams as SendEventOptionalParams,\n} from \"./cadl-generated/models\";\n\nexport { EventGridSenderClient } from \"./eventGridSenderClient\";\n\nexport { EventGridReceiverClient } from \"./eventGridReceiverClient\";\n\nexport { EventGridClientOptions } from \"./cadl-generated\";\n\nexport { OperationOptions } from \"@azure-rest/core-client\";\n\nexport {\n CloudEvent,\n SendEventsOptions,\n ReceiveResult,\n ReceiveDetails,\n ReceiveEventsOptions,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridSenderClientOptions,\n EventGridReceiverClientOptions,\n KnownReleaseDelay,\n} from \"./models\";\n\nexport { EventGridDeserializer } from \"./consumer\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAkBtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,OAAO,EAYL,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { AzureKeyCredential } from \"@azure/core-auth\";\n\nexport {\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseResult,\n RejectResult,\n ReleaseDelay,\n RenewLocksResult,\n AcknowledgeCloudEventsOptionalParams as AcknowledgeEventsOptionalParams,\n ReceiveCloudEventsOptionalParams as ReceiveEventsOptionalParams,\n RejectCloudEventsOptionalParams as RejectEventsOptionalParams,\n RenewCloudEventLocksOptionalParams as RenewEventLocksOptionalParams,\n PublishCloudEventsOptionalParams as SendEventsOptionalParams,\n PublishCloudEventOptionalParams as SendEventOptionalParams,\n} from \"./cadl-generated/models\";\n\nexport { EventGridSenderClient } from \"./eventGridSenderClient\";\n\nexport { EventGridReceiverClient } from \"./eventGridReceiverClient\";\n\nexport { EventGridClientOptions } from \"./cadl-generated\";\n\nexport { OperationOptions } from \"@azure-rest/core-client\";\n\nexport {\n CloudEvent,\n SendEventsOptions,\n ReceiveResult,\n ReceiveDetails,\n ReceiveEventsOptions,\n AcknowledgeEventsOptions,\n ReleaseEventsOptions,\n RejectEventsOptions,\n RenewEventLocksOptions,\n EventGridSenderClientOptions,\n EventGridReceiverClientOptions,\n KnownReleaseDelay,\n} from \"./models\";\n\nexport { EventGridDeserializer } from \"./consumer\";\n"]}
@@ -1,5 +1,19 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ /** Known values of {@link ReleaseDelay} that the service accepts. */
4
+ export var KnownReleaseDelay;
5
+ (function (KnownReleaseDelay) {
6
+ /** Ten Minutes */
7
+ KnownReleaseDelay["TenMinutes"] = "600";
8
+ /** One Minute */
9
+ KnownReleaseDelay["OneMinute"] = "60";
10
+ /** Ten Seconds */
11
+ KnownReleaseDelay["TenSeconds"] = "10";
12
+ /** One Hour */
13
+ KnownReleaseDelay["OneHour"] = "3600";
14
+ /** No Delay */
15
+ KnownReleaseDelay["NoDelay"] = "0";
16
+ })(KnownReleaseDelay || (KnownReleaseDelay = {}));
3
17
  export const cloudEventReservedPropertyNames = [
4
18
  "specVersion",
5
19
  "id",
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkDlC,qEAAqE;AACrE,MAAM,CAAN,IAAY,iBAeX;AAfD,WAAY,iBAAiB;IAC3B,kBAAkB;IAClB,uCAAkB,CAAA;IAElB,iBAAiB;IACjB,qCAAgB,CAAA;IAEhB,kBAAkB;IAClB,sCAAiB,CAAA;IAEjB,eAAe;IACf,qCAAgB,CAAA;IAEhB,eAAe;IACf,kCAAa,CAAA;AACf,CAAC,EAfW,iBAAiB,KAAjB,iBAAiB,QAe5B;AA8DD,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 type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\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 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 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAO;IAC7C,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;IACxE,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,gEAAgE;IAC1J,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IA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{ 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"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAO;IAC7C,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;IACxE,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,gEAAgE;IAC1J,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/C,OAAO,GAAG,KAAK,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAU;IAC5C,MAAM,KAAK,GAAG,CAEb,CAAC;IACF,OAAO,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC;AACjC,CAAC;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iBAClB;aACF;YACD,IAAI,EAAE;gBACJ,cAAc,EAAE,MAAM;gBACtB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,IAAI,EAAE;gBACJ,cAAc,EAAE,MAAM;gBACtB,IAAI,EAAE;oBACJ,IAAI,EAAE,UAAU;iBACjB;aACF;YACD,WAAW,EAAE;gBACX,cAAc,EAAE,aAAa;gBAC7B,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,UAAU,EAAE;gBACV,cAAc,EAAE,YAAY;gBAC5B,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,eAAe,EAAE;gBACf,cAAc,EAAE,iBAAiB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,cAAc,EAAE,SAAS;gBACzB,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport type { 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"]}
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.1-alpha.20241029.1",
6
+ "version": "1.0.1-alpha.20241030.1",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -1,8 +1,8 @@
1
1
  import { AzureKeyCredential } from '@azure/core-auth';
2
- import { ClientOptions } from '@azure-rest/core-client';
3
- import { ErrorModel } from '@azure-rest/core-client';
2
+ import type { ClientOptions } from '@azure-rest/core-client';
3
+ import type { ErrorModel } from '@azure-rest/core-client';
4
4
  import { OperationOptions } from '@azure-rest/core-client';
5
- import { TokenCredential } from '@azure/core-auth';
5
+ import type { TokenCredential } from '@azure/core-auth';
6
6
 
7
7
  export declare interface AcknowledgeEventsOptionalParams extends OperationOptions {
8
8
  }
@@ -200,7 +200,7 @@ export declare interface FailedLockToken {
200
200
  }
201
201
 
202
202
  /** Known values of {@link ReleaseDelay} that the service accepts. */
203
- export declare const enum KnownReleaseDelay {
203
+ export declare enum KnownReleaseDelay {
204
204
  /** Ten Minutes */
205
205
  TenMinutes = "600",
206
206
  /** One Minute */