@azure/eventgrid 5.1.0-beta.1 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/index.js +1730 -942
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/consumer.js.map +1 -1
  4. package/dist-esm/src/cryptoHelpers.browser.js.map +1 -1
  5. package/dist-esm/src/eventGridAuthenticationPolicy.js.map +1 -1
  6. package/dist-esm/src/eventGridClient.js.map +1 -1
  7. package/dist-esm/src/generateSharedAccessSignature.js.map +1 -1
  8. package/dist-esm/src/generated/generatedClientContext.js +1 -1
  9. package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
  10. package/dist-esm/src/generated/models/index.js.map +1 -1
  11. package/dist-esm/src/generated/models/mappers.js +1742 -441
  12. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  13. package/dist-esm/src/index.js +0 -1
  14. package/dist-esm/src/index.js.map +1 -1
  15. package/dist-esm/src/models.js.map +1 -1
  16. package/dist-esm/src/predicates.js.map +1 -1
  17. package/dist-esm/src/tracing.js +1 -1
  18. package/dist-esm/src/tracing.js.map +1 -1
  19. package/dist-esm/src/util.js.map +1 -1
  20. package/package.json +11 -15
  21. package/types/eventgrid.d.ts +705 -203
  22. package/dist-esm/src/cadl-generated/EventGridClient.js +0 -41
  23. package/dist-esm/src/cadl-generated/EventGridClient.js.map +0 -1
  24. package/dist-esm/src/cadl-generated/api/EventGridContext.js +0 -10
  25. package/dist-esm/src/cadl-generated/api/EventGridContext.js.map +0 -1
  26. package/dist-esm/src/cadl-generated/api/index.js +0 -5
  27. package/dist-esm/src/cadl-generated/api/index.js.map +0 -1
  28. package/dist-esm/src/cadl-generated/api/operations.js +0 -198
  29. package/dist-esm/src/cadl-generated/api/operations.js.map +0 -1
  30. package/dist-esm/src/cadl-generated/index.js +0 -4
  31. package/dist-esm/src/cadl-generated/index.js.map +0 -1
  32. package/dist-esm/src/cadl-generated/logger.js +0 -5
  33. package/dist-esm/src/cadl-generated/logger.js.map +0 -1
  34. package/dist-esm/src/cadl-generated/models/index.js +0 -4
  35. package/dist-esm/src/cadl-generated/models/index.js.map +0 -1
  36. package/dist-esm/src/cadl-generated/models/models.js +0 -4
  37. package/dist-esm/src/cadl-generated/models/models.js.map +0 -1
  38. package/dist-esm/src/cadl-generated/models/options.js +0 -4
  39. package/dist-esm/src/cadl-generated/models/options.js.map +0 -1
  40. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js +0 -4
  41. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js.map +0 -1
  42. package/dist-esm/src/cadl-generated/rest/eventGridClient.js +0 -38
  43. package/dist-esm/src/cadl-generated/rest/eventGridClient.js.map +0 -1
  44. package/dist-esm/src/cadl-generated/rest/index.js +0 -12
  45. package/dist-esm/src/cadl-generated/rest/index.js.map +0 -1
  46. package/dist-esm/src/cadl-generated/rest/isUnexpected.js +0 -75
  47. package/dist-esm/src/cadl-generated/rest/isUnexpected.js.map +0 -1
  48. package/dist-esm/src/cadl-generated/rest/models.js +0 -4
  49. package/dist-esm/src/cadl-generated/rest/models.js.map +0 -1
  50. package/dist-esm/src/cadl-generated/rest/outputModels.js +0 -4
  51. package/dist-esm/src/cadl-generated/rest/outputModels.js.map +0 -1
  52. package/dist-esm/src/cadl-generated/rest/parameters.js +0 -4
  53. package/dist-esm/src/cadl-generated/rest/parameters.js.map +0 -1
  54. package/dist-esm/src/cadl-generated/rest/responses.js +0 -4
  55. package/dist-esm/src/cadl-generated/rest/responses.js.map +0 -1
  56. package/dist-esm/src/eventGridClientV2.js +0 -147
  57. package/dist-esm/src/eventGridClientV2.js.map +0 -1
  58. package/dist-esm/src/eventGridV2PublishBinaryMode.js +0 -63
  59. package/dist-esm/src/eventGridV2PublishBinaryMode.js.map +0 -1
@@ -1,41 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { createEventGrid, publishCloudEvent, publishCloudEvents, receiveCloudEvents, acknowledgeCloudEvents, releaseCloudEvents, rejectCloudEvents, renewCloudEventLocks, } from "./api/index";
4
- export class EventGridClient {
5
- getClient() {
6
- return this._client;
7
- }
8
- /** Azure Messaging EventGrid Client */
9
- constructor(endpoint, credential, options = {}) {
10
- this._client = createEventGrid(endpoint, credential, options);
11
- }
12
- /** 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. */
13
- publishCloudEvent(id, source, type, specversion, topicName, options = { requestOptions: {} }) {
14
- return publishCloudEvent(this._client, id, source, type, specversion, topicName, options);
15
- }
16
- /** 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. */
17
- publishCloudEvents(events, topicName, options = { requestOptions: {} }) {
18
- return publishCloudEvents(this._client, events, topicName, options);
19
- }
20
- /** Receive Batch of Cloud Events from the Event Subscription. */
21
- receiveCloudEvents(topicName, eventSubscriptionName, options = { requestOptions: {} }) {
22
- return receiveCloudEvents(this._client, topicName, eventSubscriptionName, options);
23
- }
24
- /** 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. */
25
- acknowledgeCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
26
- return acknowledgeCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
27
- }
28
- /** 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. */
29
- releaseCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
30
- return releaseCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
31
- }
32
- /** 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. */
33
- rejectCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
34
- return rejectCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
35
- }
36
- /** 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. */
37
- renewCloudEventLocks(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
38
- return renewCloudEventLocks(this._client, lockTokens, topicName, eventSubscriptionName, options);
39
- }
40
- }
41
- //# sourceMappingURL=EventGridClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventGridClient.js","sourceRoot":"","sources":["../../../src/cadl-generated/EventGridClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAoBlC,OAAO,EACL,eAAe,EAGf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAIrB,MAAM,OAAO,eAAe;IAG1B,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,uCAAuC;IACvC,YACE,QAAgB,EAChB,UAAiC,EACjC,UAAkC,EAAE;QAEpC,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8bAA8b;IAC9b,iBAAiB,CACf,EAAU,EACV,MAAc,EACd,IAAY,EACZ,WAAmB,EACnB,SAAiB,EACjB,UAAoC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE1D,OAAO,iBAA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AC;IAED,gSAAgS;IAChS,oBAAoB,CAClB,UAAoB,EACpB,SAAiB,EACjB,qBAA6B,EAC7B,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE7D,OAAO,oBAAoB,CACzB,IAAI,CAAC,OAAO,EACZ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport {\n CloudEvent,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n RenewCloudEventLocksResult,\n} from \"./models/models\";\nimport {\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n RenewCloudEventLocksOptions,\n} from \"./models/options\";\nimport {\n createEventGrid,\n EventGridClientOptions,\n EventGridContext,\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n renewCloudEventLocks,\n} from \"./api/index\";\n\nexport { EventGridClientOptions } from \"./api/EventGridContext\";\n\nexport class EventGridClient {\n private _client: EventGridContext;\n\n getClient(): EventGridContext {\n return this._client;\n }\n\n /** Azure Messaging EventGrid Client */\n constructor(\n endpoint: string,\n credential: any | TokenCredential,\n options: EventGridClientOptions = {}\n ) {\n this._client = createEventGrid(endpoint, credential, options);\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. */\n publishCloudEvent(\n id: string,\n source: string,\n type: string,\n specversion: string,\n topicName: string,\n options: PublishCloudEventOptions = { requestOptions: {} }\n ): Promise<Record<string, any>> {\n return publishCloudEvent(this._client, id, source, type, specversion, topicName, options);\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. */\n publishCloudEvents(\n events: CloudEvent[],\n topicName: string,\n options: PublishCloudEventsOptions = { requestOptions: {} }\n ): Promise<Record<string, any>> {\n return publishCloudEvents(this._client, events, topicName, options);\n }\n\n /** Receive Batch of Cloud Events from the Event Subscription. */\n receiveCloudEvents<T>(\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptions = { requestOptions: {} }\n ): Promise<ReceiveResult<T>> {\n return receiveCloudEvents(this._client, topicName, eventSubscriptionName, options);\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. */\n acknowledgeCloudEvents(\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: AcknowledgeCloudEventsOptions = { requestOptions: {} }\n ): Promise<AcknowledgeResult> {\n return acknowledgeCloudEvents(\n this._client,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\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. */\n releaseCloudEvents(\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: ReleaseCloudEventsOptions = { requestOptions: {} }\n ): Promise<ReleaseResult> {\n return releaseCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);\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. */\n rejectCloudEvents(\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: RejectCloudEventsOptions = { requestOptions: {} }\n ): Promise<RejectResult> {\n return rejectCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);\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. */\n renewCloudEventLocks(\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: RenewCloudEventLocksOptions = { requestOptions: {} }\n ): Promise<RenewCloudEventLocksResult> {\n return renewCloudEventLocks(\n this._client,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\n );\n }\n}\n"]}
@@ -1,10 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import getClient from "../rest/index";
4
- /** Azure Messaging EventGrid Client */
5
- export function createEventGrid(endpoint, credential, options = {}) {
6
- const baseUrl = endpoint;
7
- const clientContext = getClient(baseUrl, credential, options);
8
- return clientContext;
9
- }
10
- //# sourceMappingURL=EventGridContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventGridContext.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/EventGridContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,SAAS,MAAM,eAAe,CAAC;AAMtC,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,UAAiC,EACjC,UAAkC,EAAE;IAEpC,MAAM,OAAO,GAAG,QAAQ,CAAC;IACzB,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC9D,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { EventGridContext } from \"../rest/index\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport getClient from \"../rest/index\";\n\nexport interface EventGridClientOptions extends ClientOptions {}\n\nexport { EventGridContext } from \"../rest/index\";\n\n/** Azure Messaging EventGrid Client */\nexport function createEventGrid(\n endpoint: string,\n credential: any | TokenCredential,\n options: EventGridClientOptions = {}\n): EventGridContext {\n const baseUrl = endpoint;\n const clientContext = getClient(baseUrl, credential, options);\n return clientContext;\n}\n"]}
@@ -1,5 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export { createEventGrid } from "./EventGridContext";
4
- export { publishCloudEvent, publishCloudEvents, receiveCloudEvents, acknowledgeCloudEvents, releaseCloudEvents, rejectCloudEvents, renewCloudEventLocks, } from "./operations";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAA4C,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { createEventGrid, EventGridClientOptions, EventGridContext } from \"./EventGridContext\";\nexport {\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n renewCloudEventLocks,\n} from \"./operations\";\n"]}
@@ -1,198 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { isUnexpected, } from "../rest/index";
4
- import { operationOptionsToRequestParameters } from "@azure-rest/core-client";
5
- import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util";
6
- export function _publishCloudEventSend(context, id, source, type, specversion, topicName, options = { requestOptions: {} }) {
7
- var _a, _b;
8
- return context.path("/topics/{topicName}:publish", topicName).post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { contentType: (_a = options.contentType) !== null && _a !== void 0 ? _a : "application/cloudevents+json; charset=utf-8", body: {
9
- id: id,
10
- source: source,
11
- data: options === null || options === void 0 ? void 0 : options.data,
12
- data_base64: (options === null || options === void 0 ? void 0 : options.dataBase64) !== undefined
13
- ? uint8ArrayToString(options === null || options === void 0 ? void 0 : options.dataBase64, "base64")
14
- : undefined,
15
- type: type,
16
- time: (_b = options === null || options === void 0 ? void 0 : options.time) === null || _b === void 0 ? void 0 : _b.toISOString(),
17
- specversion: specversion,
18
- dataschema: options === null || options === void 0 ? void 0 : options.dataschema,
19
- datacontenttype: options === null || options === void 0 ? void 0 : options.datacontenttype,
20
- subject: options === null || options === void 0 ? void 0 : options.subject,
21
- } }));
22
- }
23
- export async function _publishCloudEventDeserialize(result) {
24
- if (isUnexpected(result)) {
25
- throw result.body;
26
- }
27
- return result.body;
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. */
30
- export async function publishCloudEvent(context, id, source, type, specversion, topicName, options = { requestOptions: {} }) {
31
- const result = await _publishCloudEventSend(context, id, source, type, specversion, topicName, options);
32
- return _publishCloudEventDeserialize(result);
33
- }
34
- export function _publishCloudEventsSend(context, events, topicName, options = { requestOptions: {} }) {
35
- var _a;
36
- return context.path("/topics/{topicName}:publish", topicName).post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { contentType: (_a = options.contentType) !== null && _a !== void 0 ? _a : "application/cloudevents-batch+json; charset=utf-8", body: (events !== null && events !== void 0 ? events : []).map((p) => {
37
- var _a;
38
- return {
39
- id: p["id"],
40
- source: p["source"],
41
- data: p["data"],
42
- data_base64: p["dataBase64"] !== undefined ? uint8ArrayToString(p["dataBase64"], "base64") : undefined,
43
- type: p["type"],
44
- time: (_a = p["time"]) === null || _a === void 0 ? void 0 : _a.toISOString(),
45
- specversion: p["specversion"],
46
- dataschema: p["dataschema"],
47
- datacontenttype: p["datacontenttype"],
48
- subject: p["subject"],
49
- };
50
- }) }));
51
- }
52
- export async function _publishCloudEventsDeserialize(result) {
53
- if (isUnexpected(result)) {
54
- throw result.body;
55
- }
56
- return result.body;
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. */
59
- export async function publishCloudEvents(context, events, topicName, options = { requestOptions: {} }) {
60
- const result = await _publishCloudEventsSend(context, events, topicName, options);
61
- return _publishCloudEventsDeserialize(result);
62
- }
63
- export function _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
64
- return context
65
- .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive", topicName, eventSubscriptionName)
66
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { queryParameters: {
67
- maxEvents: options === null || options === void 0 ? void 0 : options.maxEvents,
68
- maxWaitTime: options === null || options === void 0 ? void 0 : options.maxWaitTime,
69
- } }));
70
- }
71
- export async function _receiveCloudEventsDeserialize(result) {
72
- var _a;
73
- if (isUnexpected(result)) {
74
- throw result.body;
75
- }
76
- return {
77
- value: ((_a = result.body["value"]) !== null && _a !== void 0 ? _a : []).map((p) => ({
78
- brokerProperties: {
79
- lockToken: p.brokerProperties["lockToken"],
80
- deliveryCount: p.brokerProperties["deliveryCount"],
81
- },
82
- event: {
83
- id: p.event["id"],
84
- source: p.event["source"],
85
- data: p.event["data"],
86
- dataBase64: typeof p.event["data_base64"] === "string"
87
- ? stringToUint8Array(p.event["data_base64"], "base64")
88
- : p.event["data_base64"],
89
- type: p.event["type"],
90
- time: p.event["time"] !== undefined ? new Date(p.event["time"]) : undefined,
91
- specversion: p.event["specversion"],
92
- dataschema: p.event["dataschema"],
93
- datacontenttype: p.event["datacontenttype"],
94
- subject: p.event["subject"],
95
- },
96
- })),
97
- };
98
- }
99
- /** Receive Batch of Cloud Events from the Event Subscription. */
100
- export async function receiveCloudEvents(context, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
101
- const result = await _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options);
102
- return _receiveCloudEventsDeserialize(result);
103
- }
104
- export function _acknowledgeCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
105
- return context
106
- .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge", topicName, eventSubscriptionName)
107
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
108
- }
109
- export async function _acknowledgeCloudEventsDeserialize(result) {
110
- var _a;
111
- if (isUnexpected(result)) {
112
- throw result.body;
113
- }
114
- return {
115
- failedLockTokens: ((_a = result.body["failedLockTokens"]) !== null && _a !== void 0 ? _a : []).map((p) => ({
116
- lockToken: p["lockToken"],
117
- error: p.error,
118
- })),
119
- succeededLockTokens: result.body["succeededLockTokens"],
120
- };
121
- }
122
- /** 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. */
123
- export async function acknowledgeCloudEvents(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
124
- const result = await _acknowledgeCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options);
125
- return _acknowledgeCloudEventsDeserialize(result);
126
- }
127
- export function _releaseCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
128
- return context
129
- .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release", topicName, eventSubscriptionName)
130
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { queryParameters: {
131
- releaseDelayInSeconds: options === null || options === void 0 ? void 0 : options.releaseDelayInSeconds,
132
- }, body: { lockTokens: lockTokens } }));
133
- }
134
- export async function _releaseCloudEventsDeserialize(result) {
135
- var _a;
136
- if (isUnexpected(result)) {
137
- throw result.body;
138
- }
139
- return {
140
- failedLockTokens: ((_a = result.body["failedLockTokens"]) !== null && _a !== void 0 ? _a : []).map((p) => ({
141
- lockToken: p["lockToken"],
142
- error: p.error,
143
- })),
144
- succeededLockTokens: result.body["succeededLockTokens"],
145
- };
146
- }
147
- /** 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. */
148
- export async function releaseCloudEvents(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
149
- const result = await _releaseCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options);
150
- return _releaseCloudEventsDeserialize(result);
151
- }
152
- export function _rejectCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
153
- return context
154
- .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject", topicName, eventSubscriptionName)
155
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
156
- }
157
- export async function _rejectCloudEventsDeserialize(result) {
158
- var _a;
159
- if (isUnexpected(result)) {
160
- throw result.body;
161
- }
162
- return {
163
- failedLockTokens: ((_a = result.body["failedLockTokens"]) !== null && _a !== void 0 ? _a : []).map((p) => ({
164
- lockToken: p["lockToken"],
165
- error: p.error,
166
- })),
167
- succeededLockTokens: result.body["succeededLockTokens"],
168
- };
169
- }
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, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
172
- const result = await _rejectCloudEventsSend(context, lockTokens, topicName, eventSubscriptionName, options);
173
- return _rejectCloudEventsDeserialize(result);
174
- }
175
- export function _renewCloudEventLocksSend(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
176
- return context
177
- .path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock", topicName, eventSubscriptionName)
178
- .post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: { lockTokens: lockTokens } }));
179
- }
180
- export async function _renewCloudEventLocksDeserialize(result) {
181
- var _a;
182
- if (isUnexpected(result)) {
183
- throw result.body;
184
- }
185
- return {
186
- failedLockTokens: ((_a = result.body["failedLockTokens"]) !== null && _a !== void 0 ? _a : []).map((p) => ({
187
- lockToken: p["lockToken"],
188
- error: p.error,
189
- })),
190
- succeededLockTokens: result.body["succeededLockTokens"],
191
- };
192
- }
193
- /** 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. */
194
- export async function renewCloudEventLocks(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
195
- const result = await _renewCloudEventLocksSend(context, lockTokens, topicName, eventSubscriptionName, options);
196
- return _renewCloudEventLocksDeserialize(result);
197
- }
198
- //# sourceMappingURL=operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EACL,YAAY,GAgBb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAoB,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAW1E,MAAM,UAAU,sBAAsB,CACpC,OAAe,EACf,EAAU,EACV,MAAc,EACd,IAAY,EACZ,WAAmB,EACnB,SAAiB,E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P,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,MAA6E;;IAE7E,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;QACxB,MAAM,MAAM,CAAC,IAAI,CAAC;KACnB;IAED,OAAO;QACL,gBAAgB,EAAE,CAAC,MAAA,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpE,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,UAAoB,EACpB,SAAiB,EACjB,qBAA6B,EAC7B,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,OAAO,EACP,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,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 ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\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 { StreamableMethod, operationOptionsToRequestParameters } 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 id: string,\n source: string,\n type: string,\n specversion: string,\n topicName: string,\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: id,\n source: source,\n data: options?.data,\n data_base64:\n options?.dataBase64 !== undefined\n ? uint8ArrayToString(options?.dataBase64, \"base64\")\n : undefined,\n type: type,\n time: options?.time?.toISOString(),\n specversion: specversion,\n dataschema: options?.dataschema,\n datacontenttype: options?.datacontenttype,\n subject: options?.subject,\n },\n });\n}\n\nexport async function _publishCloudEventDeserialize(\n result: PublishCloudEvent200Response | PublishCloudEventDefaultResponse\n): Promise<Record<string, any>> {\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return result.body;\n}\n\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 id: string,\n source: string,\n type: string,\n specversion: string,\n topicName: string,\n options: PublishCloudEventOptions = { requestOptions: {} }\n): Promise<Record<string, any>> {\n const result = await _publishCloudEventSend(\n context,\n id,\n source,\n type,\n specversion,\n topicName,\n options\n );\n return _publishCloudEventDeserialize(result);\n}\n\nexport function _publishCloudEventsSend(\n context: Client,\n events: CloudEvent[],\n topicName: string,\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 });\n}\n\nexport async function _publishCloudEventsDeserialize(\n result: PublishCloudEvents200Response | PublishCloudEventsDefaultResponse\n): Promise<Record<string, any>> {\n if (isUnexpected(result)) {\n throw result.body;\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 events: CloudEvent[],\n topicName: string,\n options: PublishCloudEventsOptions = { requestOptions: {} }\n): Promise<Record<string, any>> {\n const result = await _publishCloudEventsSend(context, events, topicName, 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<T>(\n result: ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse\n): Promise<ReceiveResult<T>> {\n if (isUnexpected(result)) {\n throw result.body;\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<T>(\n context: Client,\n topicName: string,\n eventSubscriptionName: string,\n options: ReceiveCloudEventsOptions = { requestOptions: {} }\n): Promise<ReceiveResult<T>> {\n const result = await _receiveCloudEventsSend(context, topicName, eventSubscriptionName, options);\n return _receiveCloudEventsDeserialize(result);\n}\n\nexport function _acknowledgeCloudEventsSend(\n context: Client,\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\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: lockTokens },\n });\n}\n\nexport async function _acknowledgeCloudEventsDeserialize(\n result: AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse\n): Promise<AcknowledgeResult> {\n if (isUnexpected(result)) {\n throw result.body;\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 lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: AcknowledgeCloudEventsOptions = { requestOptions: {} }\n): Promise<AcknowledgeResult> {\n const result = await _acknowledgeCloudEventsSend(\n context,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\n );\n return _acknowledgeCloudEventsDeserialize(result);\n}\n\nexport function _releaseCloudEventsSend(\n context: Client,\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: ReleaseCloudEventsOptions = { 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 result.body;\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 lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: ReleaseCloudEventsOptions = { requestOptions: {} }\n): Promise<ReleaseResult> {\n const result = await _releaseCloudEventsSend(\n context,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\n );\n return _releaseCloudEventsDeserialize(result);\n}\n\nexport function _rejectCloudEventsSend(\n context: Client,\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\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: lockTokens },\n });\n}\n\nexport async function _rejectCloudEventsDeserialize(\n result: RejectCloudEvents200Response | RejectCloudEventsDefaultResponse\n): Promise<RejectResult> {\n if (isUnexpected(result)) {\n throw result.body;\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 lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: RejectCloudEventsOptions = { requestOptions: {} }\n): Promise<RejectResult> {\n const result = await _rejectCloudEventsSend(\n context,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\n );\n return _rejectCloudEventsDeserialize(result);\n}\n\nexport function _renewCloudEventLocksSend(\n context: Client,\n lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\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: lockTokens },\n });\n}\n\nexport async function _renewCloudEventLocksDeserialize(\n result: RenewCloudEventLocks200Response | RenewCloudEventLocksDefaultResponse\n): Promise<RenewCloudEventLocksResult> {\n if (isUnexpected(result)) {\n throw result.body;\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 lockTokens: string[],\n topicName: string,\n eventSubscriptionName: string,\n options: RenewCloudEventLocksOptions = { requestOptions: {} }\n): Promise<RenewCloudEventLocksResult> {\n const result = await _renewCloudEventLocksSend(\n context,\n lockTokens,\n topicName,\n eventSubscriptionName,\n options\n );\n return _renewCloudEventLocksDeserialize(result);\n}\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export { EventGridClient } from "./EventGridClient";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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 ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseResult,\n RejectResult,\n RenewCloudEventLocksResult,\n ReleaseDelay,\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n RenewCloudEventLocksOptions,\n} from \"./models/index\";\n"]}
@@ -1,5 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { createClientLogger } from "@azure/logger";
4
- export const logger = createClientLogger("eventgrid");
5
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/cadl-generated/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"eventgrid\");\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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 ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseResult,\n RejectResult,\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,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=models.js.map
@@ -1 +0,0 @@
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 { CloudEvent as CloudEventV1 } from \"../../models\";\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?: any;\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/** Details of the Receive operation response. */\nexport interface ReceiveResult<T> {\n /** Array of receive responses, one per cloud event. */\n value: ReceiveDetails<T>[];\n}\n\n/** Receive operation details per Cloud Event. */\nexport interface ReceiveDetails<T> {\n /** The Event Broker details. */\n brokerProperties: BrokerProperties;\n /** Cloud Event details. */\n event: CloudEventV1<T>;\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/** 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 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,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
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 /** Event data specific to the event type. */\n data?: any;\n /** Event data specific to the event type, encoded as a base64 string. */\n dataBase64?: Uint8Array;\n /** The time (in UTC) the event was generated, in RFC3339 format. */\n time?: Date;\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 /** 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,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=clientDefinitions.js.map
@@ -1 +0,0 @@
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,38 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { getClient } from "@azure-rest/core-client";
4
- import { logger } from "../logger";
5
- /**
6
- * Initialize a new instance of `EventGridContext`
7
- * @param endpoint - The host name of the namespace, e.g. namespaceName1.westus-1.eventgrid.azure.net
8
- * @param credentials - uniquely identify client credential
9
- * @param options - the parameter for all optional parameters
10
- */
11
- export default function createClient(endpoint, credentials, options = {}) {
12
- var _a, _b, _c, _d, _e, _f;
13
- const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}`;
14
- options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-10-01-preview";
15
- options = Object.assign(Object.assign({}, options), { credentials: {
16
- scopes: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.scopes) !== null && _d !== void 0 ? _d : ["https://eventgrid.azure.net/.default"],
17
- apiKeyHeaderName: "Authorization",
18
- } });
19
- const userAgentInfo = `azsdk-js-eventgrid-rest/5.1.0-beta.1`;
20
- const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
21
- ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
22
- : `${userAgentInfo}`;
23
- options = Object.assign(Object.assign({}, options), { userAgentOptions: {
24
- userAgentPrefix,
25
- }, loggingOptions: {
26
- logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info,
27
- } });
28
- const client = getClient(baseUrl, credentials, options);
29
- client.pipeline.addPolicy({
30
- name: "customKeyCredentialPolicy",
31
- async sendRequest(request, next) {
32
- request.headers.set("Authorization", "SharedAccessKey " + credentials.key);
33
- return next(request);
34
- },
35
- });
36
- return client;
37
- }
38
- //# sourceMappingURL=eventGridClient.js.map
@@ -1 +0,0 @@
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;AAInC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA0B,EAC1B,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,OAAO,mCACF,OAAO,KACV,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,aAAa,GAAG,sCAAsC,CAAC;IAC7D,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,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAqB,CAAC;IAE5E,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,2BAA2B;QACjC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;YAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,kBAAkB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC,CAAC;IACH,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 { KeyCredential } 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: KeyCredential,\n options: ClientOptions = {}\n): EventGridContext {\n const baseUrl = options.baseUrl ?? `${endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2023-10-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://eventgrid.azure.net/.default\"],\n apiKeyHeaderName: \"Authorization\",\n },\n };\n\n const userAgentInfo = `azsdk-js-eventgrid-rest/5.1.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 };\n\n const client = getClient(baseUrl, credentials, options) as EventGridContext;\n\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 return client;\n}\n"]}
@@ -1,12 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import EventGridClient from "./eventGridClient";
4
- export * from "./eventGridClient";
5
- export * from "./parameters";
6
- export * from "./responses";
7
- export * from "./clientDefinitions";
8
- export * from "./isUnexpected";
9
- export * from "./models";
10
- export * from "./outputModels";
11
- export default EventGridClient;
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport EventGridClient from \"./eventGridClient\";\n\nexport * from \"./eventGridClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\n\nexport default EventGridClient;\n"]}
@@ -1,75 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- const responseMap = {
4
- "POST /topics/{topicName}:publish": ["200"],
5
- "POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive": ["200"],
6
- "POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge": ["200"],
7
- "POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release": ["200"],
8
- "POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject": ["200"],
9
- "POST /topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock": ["200"],
10
- };
11
- export function isUnexpected(response) {
12
- const lroOriginal = response.headers["x-ms-original-url"];
13
- const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
14
- const method = response.request.method;
15
- let pathDetails = responseMap[`${method} ${url.pathname}`];
16
- if (!pathDetails) {
17
- pathDetails = getParametrizedPathSuccess(method, url.pathname);
18
- }
19
- return !pathDetails.includes(response.status);
20
- }
21
- function getParametrizedPathSuccess(method, path) {
22
- var _a, _b, _c, _d;
23
- const pathParts = path.split("/");
24
- // Traverse list to match the longest candidate
25
- // matchedLen: the length of candidate path
26
- // matchedValue: the matched status code array
27
- let matchedLen = -1, matchedValue = [];
28
- // Iterate the responseMap to find a match
29
- for (const [key, value] of Object.entries(responseMap)) {
30
- // Extracting the path from the map key which is in format
31
- // GET /path/foo
32
- if (!key.startsWith(method)) {
33
- continue;
34
- }
35
- const candidatePath = getPathFromMapKey(key);
36
- // Get each part of the url path
37
- const candidateParts = candidatePath.split("/");
38
- // track if we have found a match to return the values found.
39
- let found = true;
40
- for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
41
- if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
42
- const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
43
- // If the current part of the candidate is a "template" part
44
- // Try to use the suffix of pattern to match the path
45
- // {guid} ==> $
46
- // {guid}:export ==> :export$
47
- const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
48
- if (!isMatched) {
49
- found = false;
50
- break;
51
- }
52
- continue;
53
- }
54
- // If the candidate part is not a template and
55
- // the parts don't match mark the candidate as not found
56
- // to move on with the next candidate path.
57
- if (candidateParts[i] !== pathParts[j]) {
58
- found = false;
59
- break;
60
- }
61
- }
62
- // We finished evaluating the current candidate parts
63
- // Update the matched value if and only if we found the longer pattern
64
- if (found && candidatePath.length > matchedLen) {
65
- matchedLen = candidatePath.length;
66
- matchedValue = value;
67
- }
68
- }
69
- return matchedValue;
70
- }
71
- function getPathFromMapKey(mapKey) {
72
- const pathStart = mapKey.indexOf("/");
73
- return mapKey.slice(pathStart);
74
- }
75
- //# sourceMappingURL=isUnexpected.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/cadl-generated/rest/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,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;AAoBF,MAAM,UAAU,YAAY,CAC1B,QAYuC;IAQvC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,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AAC,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 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: 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 | 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,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=models.js.map