@azure/eventgrid-namespaces 1.0.0-beta.1 → 1.0.0

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 (40) hide show
  1. package/README.md +45 -19
  2. package/dist/index.js +403 -196
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/cadl-generated/EventGridClient.js +20 -28
  5. package/dist-esm/src/cadl-generated/EventGridClient.js.map +1 -1
  6. package/dist-esm/src/cadl-generated/api/EventGridContext.js +2 -2
  7. package/dist-esm/src/cadl-generated/api/EventGridContext.js.map +1 -1
  8. package/dist-esm/src/cadl-generated/api/operations.js +25 -29
  9. package/dist-esm/src/cadl-generated/api/operations.js.map +1 -1
  10. package/dist-esm/src/cadl-generated/index.js.map +1 -1
  11. package/dist-esm/src/cadl-generated/models/index.js.map +1 -1
  12. package/dist-esm/src/cadl-generated/models/models.js.map +1 -1
  13. package/dist-esm/src/cadl-generated/models/options.js.map +1 -1
  14. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js.map +1 -1
  15. package/dist-esm/src/cadl-generated/rest/eventGridClient.js +9 -9
  16. package/dist-esm/src/cadl-generated/rest/eventGridClient.js.map +1 -1
  17. package/dist-esm/src/cadl-generated/rest/isUnexpected.js.map +1 -1
  18. package/dist-esm/src/cadl-generated/rest/models.js.map +1 -1
  19. package/dist-esm/src/cadl-generated/rest/parameters.js.map +1 -1
  20. package/dist-esm/src/cloudEventDistrubtedTracingEnricherPolicy.js +53 -0
  21. package/dist-esm/src/cloudEventDistrubtedTracingEnricherPolicy.js.map +1 -0
  22. package/dist-esm/src/consumer.js +73 -0
  23. package/dist-esm/src/consumer.js.map +1 -0
  24. package/dist-esm/src/eventGridNamespacesPublishBinaryMode.js.map +1 -1
  25. package/dist-esm/src/eventGridReceiverClient.js +98 -0
  26. package/dist-esm/src/eventGridReceiverClient.js.map +1 -0
  27. package/dist-esm/src/eventGridSenderClient.js +72 -0
  28. package/dist-esm/src/eventGridSenderClient.js.map +1 -0
  29. package/dist-esm/src/index.js +3 -1
  30. package/dist-esm/src/index.js.map +1 -1
  31. package/dist-esm/src/models.js +3 -3
  32. package/dist-esm/src/models.js.map +1 -1
  33. package/dist-esm/src/util.js +155 -0
  34. package/dist-esm/src/util.js.map +1 -0
  35. package/package.json +10 -10
  36. package/types/eventgrid-namespaces.d.ts +127 -97
  37. package/dist-esm/src/constants.js +0 -5
  38. package/dist-esm/src/constants.js.map +0 -1
  39. package/dist-esm/src/eventGridNamespacesClient.js +0 -147
  40. package/dist-esm/src/eventGridNamespacesClient.js.map +0 -1
@@ -26,7 +26,7 @@ export async function _publishCloudEventDeserialize(result) {
26
26
  }
27
27
  return result.body;
28
28
  }
29
- /** Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */
29
+ /** Publish a single Cloud Event to a namespace topic. */
30
30
  export async function publishCloudEvent(context, topicName, event, options = { requestOptions: {} }) {
31
31
  const result = await _publishCloudEventSend(context, topicName, event, options);
32
32
  return _publishCloudEventDeserialize(result);
@@ -55,7 +55,7 @@ export async function _publishCloudEventsDeserialize(result) {
55
55
  }
56
56
  return result.body;
57
57
  }
58
- /** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */
58
+ /** Publish a batch of Cloud Events to a namespace topic. */
59
59
  export async function publishCloudEvents(context, topicName, events, options = { requestOptions: {} }) {
60
60
  const result = await _publishCloudEventsSend(context, topicName, events, options);
61
61
  return _publishCloudEventsDeserialize(result);
@@ -73,7 +73,7 @@ export async function _receiveCloudEventsDeserialize(result) {
73
73
  throw createRestError(result);
74
74
  }
75
75
  return {
76
- value: result.body["value"].map((p) => ({
76
+ details: result.body["value"].map((p) => ({
77
77
  brokerProperties: {
78
78
  lockToken: p.brokerProperties["lockToken"],
79
79
  deliveryCount: p.brokerProperties["deliveryCount"],
@@ -95,15 +95,15 @@ export async function _receiveCloudEventsDeserialize(result) {
95
95
  })),
96
96
  };
97
97
  }
98
- /** Receive Batch of Cloud Events from the Event Subscription. */
98
+ /** Receive a batch of Cloud Events from a subscription. */
99
99
  export async function receiveCloudEvents(context, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
100
100
  const result = await _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options);
101
101
  return _receiveCloudEventsDeserialize(result);
102
102
  }
103
- export function _acknowledgeCloudEventsSend(context, topicName, eventSubscriptionName, acknowledgeOptions, options = { requestOptions: {} }) {
103
+ export function _acknowledgeCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
104
104
  return context
105
105
  .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge", topicName, eventSubscriptionName)
106
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: acknowledgeOptions["lockTokens"] } }));
106
+ .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
107
107
  }
108
108
  export async function _acknowledgeCloudEventsDeserialize(result) {
109
109
  if (isUnexpected(result)) {
@@ -117,21 +117,17 @@ export async function _acknowledgeCloudEventsDeserialize(result) {
117
117
  succeededLockTokens: result.body["succeededLockTokens"],
118
118
  };
119
119
  }
120
- /** Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events will no longer be available to any consumer. */
121
- export async function acknowledgeCloudEvents(context, topicName, eventSubscriptionName, acknowledgeOptions, options = { requestOptions: {} }) {
122
- const result = await _acknowledgeCloudEventsSend(context, topicName, eventSubscriptionName, acknowledgeOptions, options);
120
+ /** 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. */
121
+ export async function acknowledgeCloudEvents(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
122
+ const result = await _acknowledgeCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options);
123
123
  return _acknowledgeCloudEventsDeserialize(result);
124
124
  }
125
- export function _releaseCloudEventsSend(context, topicName, eventSubscriptionName, releaseOptions, options = { requestOptions: {} }) {
126
- let releaseDelayInSeconds = undefined;
127
- if (options === null || options === void 0 ? void 0 : options.releaseDelayInSeconds) {
128
- releaseDelayInSeconds = parseInt(options.releaseDelayInSeconds);
129
- }
125
+ export function _releaseCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
130
126
  return context
131
127
  .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release", topicName, eventSubscriptionName)
132
128
  .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { queryParameters: {
133
- releaseDelayInSeconds,
134
- }, body: { lockTokens: releaseOptions["lockTokens"] } }));
129
+ releaseDelayInSeconds: options === null || options === void 0 ? void 0 : options.releaseDelayInSeconds,
130
+ }, body: { lockTokens: lockTokens } }));
135
131
  }
136
132
  export async function _releaseCloudEventsDeserialize(result) {
137
133
  if (isUnexpected(result)) {
@@ -145,15 +141,15 @@ export async function _releaseCloudEventsDeserialize(result) {
145
141
  succeededLockTokens: result.body["succeededLockTokens"],
146
142
  };
147
143
  }
148
- /** Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */
149
- export async function releaseCloudEvents(context, topicName, eventSubscriptionName, releaseOptions, options = { requestOptions: {} }) {
150
- const result = await _releaseCloudEventsSend(context, topicName, eventSubscriptionName, releaseOptions, options);
144
+ /** 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. */
145
+ export async function releaseCloudEvents(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
146
+ const result = await _releaseCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options);
151
147
  return _releaseCloudEventsDeserialize(result);
152
148
  }
153
- export function _rejectCloudEventsSend(context, topicName, eventSubscriptionName, rejectOptions, options = { requestOptions: {} }) {
149
+ export function _rejectCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
154
150
  return context
155
151
  .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject", topicName, eventSubscriptionName)
156
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: rejectOptions["lockTokens"] } }));
152
+ .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
157
153
  }
158
154
  export async function _rejectCloudEventsDeserialize(result) {
159
155
  if (isUnexpected(result)) {
@@ -167,15 +163,15 @@ export async function _rejectCloudEventsDeserialize(result) {
167
163
  succeededLockTokens: result.body["succeededLockTokens"],
168
164
  };
169
165
  }
170
- /** Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. */
171
- export async function rejectCloudEvents(context, topicName, eventSubscriptionName, rejectOptions, options = { requestOptions: {} }) {
172
- const result = await _rejectCloudEventsSend(context, topicName, eventSubscriptionName, rejectOptions, options);
166
+ /** 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. */
167
+ export async function rejectCloudEvents(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
168
+ const result = await _rejectCloudEventsSend(context, topicName, eventSubscriptionName, lockTokens, options);
173
169
  return _rejectCloudEventsDeserialize(result);
174
170
  }
175
- export function _renewCloudEventLocksSend(context, topicName, eventSubscriptionName, renewLockOptions, options = { requestOptions: {} }) {
171
+ export function _renewCloudEventLocksSend(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
176
172
  return context
177
173
  .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock", topicName, eventSubscriptionName)
178
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: renewLockOptions["lockTokens"] } }));
174
+ .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
179
175
  }
180
176
  export async function _renewCloudEventLocksDeserialize(result) {
181
177
  if (isUnexpected(result)) {
@@ -189,9 +185,9 @@ export async function _renewCloudEventLocksDeserialize(result) {
189
185
  succeededLockTokens: result.body["succeededLockTokens"],
190
186
  };
191
187
  }
192
- /** Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error information. */
193
- export async function renewCloudEventLocks(context, topicName, eventSubscriptionName, renewLockOptions, options = { requestOptions: {} }) {
194
- const result = await _renewCloudEventLocksSend(context, topicName, eventSubscriptionName, renewLockOptions, options);
188
+ /** 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. */
189
+ export async function renewCloudEventLocks(context, topicName, eventSubscriptionName, lockTokens, options = { requestOptions: {} }) {
190
+ const result = await _renewCloudEventLocksSend(context, topicName, eventSubscriptionName, lockTokens, options);
195
191
  return _renewCloudEventLocksDeserialize(result);
196
192
  }
197
193
  //# sourceMappingURL=operations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAelC,OAAO,EACL,YAAY,GAgBb,MAAM,eAAe,CA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e,EACf,SAAiB,EACjB,qBAA6B,EAC7B,gBAAkC,EAClC,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,OAAO,OAAO;SACX,IAAI,CACH,0EAA0E,EAC1E,SAAS,EACT,qBAAqB,CACtB;SACA,IAAI,iCACA,mCAAmC,CAAC,OAAO,CAAC,KAC/C,IAAI,EAAE,EAAE,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,IACpD,CAAC;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,MAA6E;IAE7E,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,OAAO;QACL,gBAAgB,EAAE,MAAM,CAAC,IAAI,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,gSAAgS;AAChS,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAe,EACf,SAAiB,EACjB,qBAA6B,EAC7B,gBAAkC,EAClC,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,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 AcknowledgeOptions,\n AcknowledgeResult,\n ReleaseOptions,\n ReleaseResult,\n RejectOptions,\n RejectResult,\n RenewLockOptions,\n RenewCloudEventLocksResult,\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 PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n RenewCloudEventLocksOptions,\n} from \"../models/options\";\n\nexport function _publishCloudEventSend(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptions = { 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 Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */\nexport async function publishCloudEvent(\n context: Client,\n topicName: string,\n event: CloudEvent,\n options: PublishCloudEventOptions = { 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: PublishCloudEventsOptions = { 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 Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */\nexport async function publishCloudEvents(\n context: Client,\n topicName: string,\n events: CloudEvent[],\n options: PublishCloudEventsOptions = { 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: ReceiveCloudEventsOptions = { 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 value: 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 Batch of Cloud Events from the Event Subscription. */\nexport async function receiveCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptions = { 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 acknowledgeOptions: AcknowledgeOptions,\n options: AcknowledgeCloudEventsOptions = { 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: acknowledgeOptions[\"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 batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events will no longer be available to any consumer. */\nexport async function acknowledgeCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n acknowledgeOptions: AcknowledgeOptions,\n options: AcknowledgeCloudEventsOptions = { requestOptions: {} },\n): Promise<AcknowledgeResult> {\n const result = await _acknowledgeCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n acknowledgeOptions,\n options,\n );\n return _acknowledgeCloudEventsDeserialize(result);\n}\n\nexport function _releaseCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n releaseOptions: ReleaseOptions,\n options: ReleaseCloudEventsOptions = { requestOptions: {} },\n): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse> {\n let releaseDelayInSeconds: number | undefined = undefined;\n if (options?.releaseDelayInSeconds) {\n releaseDelayInSeconds = parseInt(options.releaseDelayInSeconds);\n }\n\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,\n },\n body: { lockTokens: releaseOptions[\"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 batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */\nexport async function releaseCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n releaseOptions: ReleaseOptions,\n options: ReleaseCloudEventsOptions = { requestOptions: {} },\n): Promise<ReleaseResult> {\n const result = await _releaseCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n releaseOptions,\n options,\n );\n return _releaseCloudEventsDeserialize(result);\n}\n\nexport function _rejectCloudEventsSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n rejectOptions: RejectOptions,\n options: RejectCloudEventsOptions = { 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: rejectOptions[\"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 batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. */\nexport async function rejectCloudEvents(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n rejectOptions: RejectOptions,\n options: RejectCloudEventsOptions = { requestOptions: {} },\n): Promise<RejectResult> {\n const result = await _rejectCloudEventsSend(\n context,\n topicName,\n eventSubscriptionName,\n rejectOptions,\n options,\n );\n return _rejectCloudEventsDeserialize(result);\n}\n\nexport function _renewCloudEventLocksSend(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n renewLockOptions: RenewLockOptions,\n options: RenewCloudEventLocksOptions = { 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: renewLockOptions[\"lockTokens\"] },\n });\n}\n\nexport async function _renewCloudEventLocksDeserialize(\n result: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse,\n): Promise<RenewCloudEventLocksResult> {\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 lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error information. */\nexport async function renewCloudEventLocks(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n renewLockOptions: RenewLockOptions,\n options: RenewCloudEventLocksOptions = { requestOptions: {} },\n): Promise<RenewCloudEventLocksResult> {\n const result = await _renewCloudEventLocksSend(\n context,\n topicName,\n eventSubscriptionName,\n renewLockOptions,\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;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,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,CAAC;YACnB,WAAW,EACT,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS;gBAC/B,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;gBACnD,CAAC,CAAC,SAAS;YACf,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;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,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 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cadl-generated/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { EventGridClient, EventGridClientOptions } from \"./EventGridClient\";\nexport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeOptions,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseOptions,\n ReleaseResult,\n RejectOptions,\n RejectResult,\n RenewLockOptions,\n RenewCloudEventLocksResult,\n ReleaseDelay,\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n RenewCloudEventLocksOptions,\n} from \"./models/index\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cadl-generated/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { EventGridClient, EventGridClientOptions } from \"./EventGridClient\";\nexport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseDelay,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n ServiceApiVersions,\n ErrorResponse,\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./models/index\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeOptions,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseOptions,\n ReleaseResult,\n RejectOptions,\n RejectResult,\n RenewLockOptions,\n RenewCloudEventLocksResult,\n ReleaseDelay,\n} from \"./models\";\nexport {\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n RenewCloudEventLocksOptions,\n} from \"./options\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cadl-generated/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n CloudEvent,\n PublishResult,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseDelay,\n ReleaseResult,\n RejectResult,\n RenewLocksResult,\n ServiceApiVersions,\n ErrorResponse,\n} from \"./models\";\nexport {\n PublishCloudEventOptionalParams,\n PublishCloudEventsOptionalParams,\n ReceiveCloudEventsOptionalParams,\n AcknowledgeCloudEventsOptionalParams,\n ReleaseCloudEventsOptionalParams,\n RejectCloudEventsOptionalParams,\n RenewCloudEventLocksOptionalParams,\n} from \"./options\";\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 value: 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/** Array of lock tokens for the corresponding received Cloud Events to be acknowledged. */\nexport interface AcknowledgeOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\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/** Array of lock tokens for the corresponding received Cloud Events to be released. */\nexport interface ReleaseOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\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/** Array of lock tokens for the corresponding received Cloud Events to be rejected. */\nexport interface RejectOptions {\n /** Array of lock tokens. */\n lockTokens: 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/** Array of lock tokens for the corresponding received Cloud Events to be renewed. */\nexport interface RenewLockOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\n\n/** The result of the RenewLock operation. */\nexport interface RenewCloudEventLocksResult {\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/** Supported delays for release operation. */\n/** \"0\", \"10\", \"60\", \"600\", \"3600\" */\nexport type ReleaseDelay = string;\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 { 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 PublishCloudEventOptions extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface PublishCloudEventsOptions extends OperationOptions {\n /** content type */\n contentType?: string;\n}\n\nexport interface ReceiveCloudEventsOptions 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 AcknowledgeCloudEventsOptions extends OperationOptions {}\n\nexport interface ReleaseCloudEventsOptions extends OperationOptions {\n /** Release cloud events with the specified delay in seconds. */\n releaseDelayInSeconds?: ReleaseDelay;\n}\n\nexport interface RejectCloudEventsOptions extends OperationOptions {}\n\nexport interface RenewCloudEventLocksOptions 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 { 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 +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 Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */\n post(\n options: PublishCloudEventParameters,\n ): StreamableMethod<PublishCloudEvent200Response | PublishCloudEventDefaultResponse>;\n /** Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. */\n post(\n options: PublishCloudEventsParameters,\n ): StreamableMethod<PublishCloudEvents200Response | PublishCloudEventsDefaultResponse>;\n}\n\nexport interface ReceiveCloudEvents {\n /** Receive Batch of Cloud Events from the Event Subscription. */\n post(\n options?: ReceiveCloudEventsParameters,\n ): StreamableMethod<ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse>;\n}\n\nexport interface AcknowledgeCloudEvents {\n /** Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events will no longer be available to any consumer. */\n post(\n options: AcknowledgeCloudEventsParameters,\n ): StreamableMethod<AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse>;\n}\n\nexport interface ReleaseCloudEvents {\n /** Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */\n post(\n options: ReleaseCloudEventsParameters,\n ): StreamableMethod<ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse>;\n}\n\nexport interface RejectCloudEvents {\n /** Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. */\n post(\n options: RejectCloudEventsParameters,\n ): StreamableMethod<RejectCloudEvents200Response | RejectCloudEventsDefaultResponse>;\n}\n\nexport interface RenewCloudEventLocks {\n /** Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error information. */\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 {\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"]}
@@ -5,27 +5,27 @@ import { logger } from "../logger";
5
5
  import { isKeyCredential } from "@azure/core-auth";
6
6
  /**
7
7
  * Initialize a new instance of `EventGridContext`
8
- * @param endpoint - The host name of the namespace, e.g. namespaceName1.westus-1.eventgrid.azure.net
8
+ * @param endpointParam - The host name of the namespace, e.g. namespaceName1.westus-1.eventgrid.azure.net
9
9
  * @param credentials - uniquely identify client credential
10
10
  * @param options - the parameter for all optional parameters
11
11
  */
12
- export default function createClient(endpoint, credentials, options = {}) {
13
- var _a, _b, _c, _d, _e, _f;
14
- const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}`;
15
- options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-10-01-preview";
16
- const userAgentInfo = `azsdk-js-eventgrid-namespaces-rest/1.0.0-beta.1`;
12
+ export default function createClient(endpointParam, credentials, options = {}) {
13
+ var _a, _b, _c, _d, _e, _f, _g;
14
+ const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : `${endpointParam}`;
15
+ options.apiVersion = (_c = options.apiVersion) !== null && _c !== void 0 ? _c : "2024-06-01";
16
+ const userAgentInfo = `azsdk-js-eventgrid-namespaces-rest/1.0.0`;
17
17
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
18
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
19
  : `${userAgentInfo}`;
20
20
  options = Object.assign(Object.assign({}, options), { userAgentOptions: {
21
21
  userAgentPrefix,
22
22
  }, loggingOptions: {
23
- logger: (_d = (_c = options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
23
+ logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
24
24
  }, credentials: {
25
- scopes: (_f = (_e = options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : ["https://eventgrid.azure.net/.default"],
25
+ scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://eventgrid.azure.net/.default"],
26
26
  apiKeyHeaderName: "Authorization",
27
27
  } });
28
- const client = getClient(baseUrl, credentials, options);
28
+ const client = getClient(endpointUrl, credentials, options);
29
29
  if (isKeyCredential(credentials)) {
30
30
  client.pipeline.addPolicy({
31
31
  name: "customKeyCredentialPolicy",
@@ -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,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA4C,EAC5C,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,EAAE,CAAC;IACjD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,MAAM,aAAa,GAAG,iDAAiD,CAAC;IACxE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,sCAAsC,CAAC;YAC/E,gBAAgB,EAAE,eAAe;SAClC,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAqB,CAAC;IAE5E,IAAI,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,2BAA2B;YACjC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,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 { 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 endpoint - 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 endpoint: string,\n credentials: TokenCredential | KeyCredential,\n options: ClientOptions = {},\n): EventGridContext {\n const baseUrl = options.baseUrl ?? `${endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2023-10-01-preview\";\n const userAgentInfo = `azsdk-js-eventgrid-namespaces-rest/1.0.0-beta.1`;\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(baseUrl, 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;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,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,UAAyB,EAAE;;IAE3B,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,EAAE,CAAC;IAC9E,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,YAAY,CAAC;IACxD,MAAM,aAAa,GAAG,0CAA0C,CAAC;IACjE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,sCAAsC,CAAC;YAC/E,gBAAgB,EAAE,eAAe;SAClC,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAqB,CAAC;IAEhF,IAAI,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,2BAA2B;YACjC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,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 { 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 +1 @@
1
- {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkBlC,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,QAauC;IAQvC,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,OA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MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC;gBAClC,4DAA4D;gBAC5D,qDAAqD;gBACrD,eAAe;gBACf,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,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 {\n PublishCloudEvent200Response,\n PublishCloudEvents200Response,\n PublishCloudEventDefaultResponse,\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:\n | PublishCloudEvent200Response\n | PublishCloudEvents200Response\n | PublishCloudEventDefaultResponse,\n): response is PublishCloudEventDefaultResponse;\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 | PublishCloudEvents200Response\n | PublishCloudEventDefaultResponse\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 | 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,CAA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;gBAC5D,qDAAqD;gBACrD,eAAe;gBACf,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,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 {\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":"models.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\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 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?: Date | 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/** Array of lock tokens for the corresponding received Cloud Events to be acknowledged. */\nexport interface AcknowledgeOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\n\n/** Array of lock tokens for the corresponding received Cloud Events to be released. */\nexport interface ReleaseOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\n\n/** Array of lock tokens for the corresponding received Cloud Events to be rejected. */\nexport interface RejectOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\n\n/** Array of lock tokens for the corresponding received Cloud Events to be renewed. */\nexport interface RenewLockOptions {\n /** Array of lock tokens. */\n lockTokens: string[];\n}\n\n/** Alias for ReleaseDelay */\nexport type ReleaseDelay = number | 0 | 10 | 60 | 600 | 3600;\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\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 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?: Date | 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/** Alias for ReleaseDelay */\nexport type ReleaseDelay = string | \"0\" | \"10\" | \"60\" | \"600\" | \"3600\";\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 {\n CloudEvent,\n AcknowledgeOptions,\n ReleaseDelay,\n ReleaseOptions,\n RejectOptions,\n RenewLockOptions,\n} 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 /** AcknowledgeOptions. */\n body: AcknowledgeOptions;\n}\n\nexport type AcknowledgeCloudEventsParameters = AcknowledgeCloudEventsBodyParam & RequestParameters;\n\nexport interface ReleaseCloudEventsBodyParam {\n /** ReleaseOptions */\n body: ReleaseOptions;\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 /** RejectOptions */\n body: RejectOptions;\n}\n\nexport type RejectCloudEventsParameters = RejectCloudEventsBodyParam & RequestParameters;\n\nexport interface RenewCloudEventLocksBodyParam {\n /** RenewLockOptions */\n body: RenewLockOptions;\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 { 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"]}
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export const CloudEventBatchContentType = "application/cloudevents-batch+json; charset=utf-8";
4
+ export const TraceParentHeaderName = "traceparent";
5
+ export const TraceStateHeaderName = "tracestate";
6
+ export const ContentTypeHeaderName = "Content-Type";
7
+ /**
8
+ * The programmatic identifier of the cloudEventDistributedTracingEnricherPolicy.
9
+ */
10
+ export const cloudEventDistributedTracingEnricherPolicyName = "cloudEventDistributedTracingEnricherPolicy";
11
+ /**
12
+ * cloudEventDistributedTracingEnricherPolicy is a policy which adds distributed tracing information
13
+ * to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties
14
+ * from the HTTP request into the individual events as extension properties.
15
+ *
16
+ * This will only happen in the case where an event does not have a `traceparent` defined already. This
17
+ * allows events to explicitly set a traceparent and tracestate which would be respected during "multi-hop
18
+ * transmition".
19
+ *
20
+ * See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md
21
+ * for more information on distributed tracing and cloud events.
22
+ */
23
+ export function cloudEventDistributedTracingEnricherPolicy() {
24
+ return {
25
+ name: cloudEventDistributedTracingEnricherPolicyName,
26
+ async sendRequest(request, next) {
27
+ const traceparent = request.headers.get(TraceParentHeaderName);
28
+ const tracestate = request.headers.get(TraceStateHeaderName);
29
+ if (request.headers.get(ContentTypeHeaderName) === CloudEventBatchContentType &&
30
+ typeof request.body === "string" &&
31
+ traceparent) {
32
+ // per the cloud event batched content type we know the body is an array encoded in JSON.
33
+ const parsedBody = JSON.parse(request.body);
34
+ for (const item of parsedBody) {
35
+ // When using the distributed tracing extension, the "traceparent" is a required property
36
+ // and "tracestate" is optional. This means if an item already has a "traceparent" property
37
+ // we should not stomp over it. Well formed events will not have a "tracestate" without
38
+ // also having a "traceparent" so there's no need to guard against that case.
39
+ if (typeof item !== "object" || item.traceparent) {
40
+ continue;
41
+ }
42
+ item.traceparent = traceparent;
43
+ if (tracestate) {
44
+ item.tracestate = tracestate;
45
+ }
46
+ }
47
+ request.body = JSON.stringify(parsedBody);
48
+ }
49
+ return next(request);
50
+ },
51
+ };
52
+ }
53
+ //# sourceMappingURL=cloudEventDistrubtedTracingEnricherPolicy.js.map
@@ -0,0 +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"]}