@azure/eventgrid 4.13.0-beta.1 → 4.13.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.
- package/dist/index.js +76 -430
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +65 -0
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/index.js +0 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/predicates.js.map +1 -1
- package/dist-esm/src/tracing.js +1 -1
- package/dist-esm/src/tracing.js.map +1 -1
- package/package.json +2 -3
- package/types/eventgrid.d.ts +37 -216
- package/dist-esm/src/cadl-generated/EventGridClient.js +0 -28
- package/dist-esm/src/cadl-generated/EventGridClient.js.map +0 -1
- package/dist-esm/src/cadl-generated/api/EventGridContext.js +0 -11
- package/dist-esm/src/cadl-generated/api/EventGridContext.js.map +0 -1
- package/dist-esm/src/cadl-generated/api/index.js +0 -5
- package/dist-esm/src/cadl-generated/api/index.js.map +0 -1
- package/dist-esm/src/cadl-generated/api/models.js +0 -2
- package/dist-esm/src/cadl-generated/api/models.js.map +0 -1
- package/dist-esm/src/cadl-generated/api/operations.js +0 -162
- package/dist-esm/src/cadl-generated/api/operations.js.map +0 -1
- package/dist-esm/src/cadl-generated/common/interfaces.js +0 -4
- package/dist-esm/src/cadl-generated/common/interfaces.js.map +0 -1
- package/dist-esm/src/cadl-generated/index.js +0 -4
- package/dist-esm/src/cadl-generated/index.js.map +0 -1
- package/dist-esm/src/cadl-generated/logger.js +0 -5
- package/dist-esm/src/cadl-generated/logger.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/clientDefinitions.js +0 -4
- package/dist-esm/src/cadl-generated/rest/clientDefinitions.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/eventGridClient.js +0 -30
- package/dist-esm/src/cadl-generated/rest/eventGridClient.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/index.js +0 -12
- package/dist-esm/src/cadl-generated/rest/index.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/isUnexpected.js +0 -74
- package/dist-esm/src/cadl-generated/rest/isUnexpected.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/models.js +0 -4
- package/dist-esm/src/cadl-generated/rest/models.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/outputModels.js +0 -4
- package/dist-esm/src/cadl-generated/rest/outputModels.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/parameters.js +0 -4
- package/dist-esm/src/cadl-generated/rest/parameters.js.map +0 -1
- package/dist-esm/src/cadl-generated/rest/responses.js +0 -4
- package/dist-esm/src/cadl-generated/rest/responses.js.map +0 -1
- package/dist-esm/src/eventGridClientV2.js +0 -128
- package/dist-esm/src/eventGridClientV2.js.map +0 -1
package/types/eventgrid.d.ts
CHANGED
@@ -1,33 +1,11 @@
|
|
1
1
|
import { AzureKeyCredential } from '@azure/core-auth';
|
2
2
|
import { AzureSASCredential } from '@azure/core-auth';
|
3
|
-
import { ClientOptions as ClientOptions_2 } from '@azure-rest/core-client';
|
4
3
|
import { CommonClientOptions } from '@azure/core-client';
|
5
|
-
import { HttpResponse } from '@azure-rest/core-client';
|
6
4
|
import { KeyCredential } from '@azure/core-auth';
|
7
5
|
import { OperationOptions } from '@azure/core-client';
|
8
|
-
import { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
|
9
6
|
import { SASCredential } from '@azure/core-auth';
|
10
7
|
import { TokenCredential } from '@azure/core-auth';
|
11
8
|
|
12
|
-
export declare interface AcknowledgeCloudEventsOptions extends RequestOptions {
|
13
|
-
/** content type */
|
14
|
-
contentType?: string;
|
15
|
-
}
|
16
|
-
|
17
|
-
/** Array of lock token strings for the corresponding received Cloud Events to be acknowledged. */
|
18
|
-
export declare interface AcknowledgeOptions {
|
19
|
-
/** String array of lock tokens. */
|
20
|
-
lockTokens: string[];
|
21
|
-
}
|
22
|
-
|
23
|
-
/** The result of the Acknowledge operation. */
|
24
|
-
export declare interface AcknowledgeResult {
|
25
|
-
/** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */
|
26
|
-
failedLockTokens: FailedLockToken[];
|
27
|
-
/** Array of lock tokens values for the successfully acknowledged cloud events. */
|
28
|
-
succeededLockTokens: string[];
|
29
|
-
}
|
30
|
-
|
31
9
|
/** Schema of common properties of all chat events */
|
32
10
|
export declare interface AcsChatEventBase {
|
33
11
|
/** The communication identifier of the target user */
|
@@ -640,17 +618,6 @@ export { AzureKeyCredential }
|
|
640
618
|
|
641
619
|
export { AzureSASCredential }
|
642
620
|
|
643
|
-
/** Properties of the Event Broker operation. */
|
644
|
-
export declare interface BrokerProperties {
|
645
|
-
/** The token used to lock the event. */
|
646
|
-
lockToken: string;
|
647
|
-
/** The attempt count for delivering the event. */
|
648
|
-
deliveryCount: number;
|
649
|
-
}
|
650
|
-
|
651
|
-
export declare interface ClientOptions extends ClientOptions_2 {
|
652
|
-
}
|
653
|
-
|
654
621
|
/**
|
655
622
|
* An event in the Cloud Event 1.0 schema.
|
656
623
|
*/
|
@@ -691,10 +658,6 @@ export declare interface CloudEvent<T> {
|
|
691
658
|
* Additional context attributes for the event. The Cloud Event specification refers to these as "extension attributes".
|
692
659
|
*/
|
693
660
|
extensionAttributes?: Record<string, unknown>;
|
694
|
-
/**
|
695
|
-
* The version of the CloudEvents specification which the event uses.
|
696
|
-
*/
|
697
|
-
specversion?: string | "1.0";
|
698
661
|
}
|
699
662
|
|
700
663
|
/**
|
@@ -856,6 +819,18 @@ export declare type ContainerRegistryImageDeletedEventData = ContainerRegistryEv
|
|
856
819
|
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImagePushed event. */
|
857
820
|
export declare type ContainerRegistryImagePushedEventData = ContainerRegistryEventData & {};
|
858
821
|
|
822
|
+
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.ClusterSupportEnded event */
|
823
|
+
export declare type ContainerServiceClusterSupportEndedEventData = ContainerServiceClusterSupportEventData & {};
|
824
|
+
|
825
|
+
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.ClusterSupportEnding event */
|
826
|
+
export declare type ContainerServiceClusterSupportEndingEventData = ContainerServiceClusterSupportEventData & {};
|
827
|
+
|
828
|
+
/** Schema of common properties of cluster support events */
|
829
|
+
export declare interface ContainerServiceClusterSupportEventData {
|
830
|
+
/** The Kubernetes version of the ManagedCluster resource */
|
831
|
+
kubernetesVersion: string;
|
832
|
+
}
|
833
|
+
|
859
834
|
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NewKubernetesVersionAvailable event */
|
860
835
|
export declare interface ContainerServiceNewKubernetesVersionAvailableEventData {
|
861
836
|
/** The highest PATCH Kubernetes version for the highest MINOR version supported by ManagedCluster resource */
|
@@ -868,6 +843,21 @@ export declare interface ContainerServiceNewKubernetesVersionAvailableEventData
|
|
868
843
|
latestPreviewKubernetesVersion: string;
|
869
844
|
}
|
870
845
|
|
846
|
+
/** Schema of common properties of node pool rolling events */
|
847
|
+
export declare interface ContainerServiceNodePoolRollingEventData {
|
848
|
+
/** The name of the node pool in the ManagedCluster resource */
|
849
|
+
nodePoolName: string;
|
850
|
+
}
|
851
|
+
|
852
|
+
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingFailed event */
|
853
|
+
export declare type ContainerServiceNodePoolRollingFailedEventData = ContainerServiceNodePoolRollingEventData & {};
|
854
|
+
|
855
|
+
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingStarted event */
|
856
|
+
export declare type ContainerServiceNodePoolRollingStartedEventData = ContainerServiceNodePoolRollingEventData & {};
|
857
|
+
|
858
|
+
/** Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingSucceeded event */
|
859
|
+
export declare type ContainerServiceNodePoolRollingSucceededEventData = ContainerServiceNodePoolRollingEventData & {};
|
860
|
+
|
871
861
|
/** Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.CopyCompleted event. */
|
872
862
|
export declare interface DataBoxCopyCompletedEventData {
|
873
863
|
/** Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. */
|
@@ -1007,85 +997,6 @@ export declare interface DeviceTwinMetadata {
|
|
1007
997
|
lastUpdated: string;
|
1008
998
|
}
|
1009
999
|
|
1010
|
-
/**
|
1011
|
-
* Event Grid Client
|
1012
|
-
*/
|
1013
|
-
export declare class EventGridClient {
|
1014
|
-
private _client;
|
1015
|
-
/** Azure Messaging EventGrid Client */
|
1016
|
-
constructor(endpoint: string, credential: AzureKeyCredential, options?: ClientOptions);
|
1017
|
-
/**
|
1018
|
-
* Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200
|
1019
|
-
* status code with an empty JSON object in response. Otherwise, the server can return various error codes.
|
1020
|
-
* For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message
|
1021
|
-
* is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for
|
1022
|
-
* internal server error.
|
1023
|
-
*
|
1024
|
-
* @param event - Event to publish
|
1025
|
-
* @param topicName - Topic to publish the event
|
1026
|
-
* @param options - Options to publish
|
1027
|
-
*
|
1028
|
-
*/
|
1029
|
-
publishCloudEvent<T>(event: CloudEvent<T>, topicName: string, options?: PublishCloudEventOptions): Promise<PublishResultOutput>;
|
1030
|
-
/**
|
1031
|
-
* Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200
|
1032
|
-
* status code with an empty JSON object in response. Otherwise, the server can return various error codes.
|
1033
|
-
* For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message
|
1034
|
-
* is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for
|
1035
|
-
* internal server error.
|
1036
|
-
*
|
1037
|
-
* @param events - Events to publish
|
1038
|
-
* @param topicName - Topic to publish the event
|
1039
|
-
* @param options - Options to publish
|
1040
|
-
*
|
1041
|
-
*/
|
1042
|
-
publishCloudEvents<T>(events: CloudEvent<T>[], topicName: string, options?: PublishCloudEventsOptions): Promise<PublishResultOutput>;
|
1043
|
-
/**
|
1044
|
-
* Receive Batch of Cloud Events from the Event Subscription.
|
1045
|
-
*
|
1046
|
-
* @param topicName - Topic to receive
|
1047
|
-
* @param eventSubscriptionName - Name of the Event Subscription
|
1048
|
-
* @param options - Options to receive
|
1049
|
-
*
|
1050
|
-
*/
|
1051
|
-
receiveCloudEvents<T>(topicName: string, eventSubscriptionName: string, options?: ReceiveCloudEventsOptions): Promise<ReceiveResult<T>>;
|
1052
|
-
/**
|
1053
|
-
* Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one
|
1054
|
-
* event is successfully acknowledged. The response body will include the set of successfully acknowledged
|
1055
|
-
* lockTokens, along with other failed lockTokens with their corresponding error information. Successfully
|
1056
|
-
* acknowledged events will no longer be available to any consumer.
|
1057
|
-
*
|
1058
|
-
* @param lockTokens - Lock Tokens
|
1059
|
-
* @param topicName - Topic Name
|
1060
|
-
* @param eventSubscriptionName - Name of the Event Subscription
|
1061
|
-
* @param options - Options to Acknowledge
|
1062
|
-
*
|
1063
|
-
*/
|
1064
|
-
acknowledgeCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: AcknowledgeCloudEventsOptions): Promise<AcknowledgeResult>;
|
1065
|
-
/**
|
1066
|
-
* Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is
|
1067
|
-
* successfully released. The response body will include the set of successfully released lockTokens, along
|
1068
|
-
* with other failed lockTokens with their corresponding error information.
|
1069
|
-
*
|
1070
|
-
* @param lockTokens - Lock Tokens
|
1071
|
-
* @param topicName - Topic Name
|
1072
|
-
* @param eventSubscriptionName - Name of the Event Subscription
|
1073
|
-
* @param options - Options to release
|
1074
|
-
*
|
1075
|
-
*/
|
1076
|
-
releaseCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: ReleaseCloudEventsOptions): Promise<ReleaseResult>;
|
1077
|
-
/**
|
1078
|
-
* Reject batch of Cloud Events.
|
1079
|
-
*
|
1080
|
-
* @param lockTokens - Lock Tokens
|
1081
|
-
* @param topicName - Topic Name
|
1082
|
-
* @param eventSubscriptionName - Name of the Event Subscription
|
1083
|
-
* @param options - Options to reject
|
1084
|
-
*
|
1085
|
-
*/
|
1086
|
-
rejectCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: RejectCloudEventsOptions): Promise<RejectResult>;
|
1087
|
-
}
|
1088
|
-
|
1089
1000
|
/**
|
1090
1001
|
* EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload
|
1091
1002
|
* of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an
|
@@ -1236,16 +1147,6 @@ export declare interface EventHubCaptureFileCreatedEventData {
|
|
1236
1147
|
lastEnqueueTime: string;
|
1237
1148
|
}
|
1238
1149
|
|
1239
|
-
/** Failed LockToken information. */
|
1240
|
-
export declare interface FailedLockToken {
|
1241
|
-
/** LockToken value */
|
1242
|
-
lockToken: string;
|
1243
|
-
/** Error code related to the token. Example of such error codes are BadToken: which indicates the Token is not formatted correctly, TokenLost: which indicates that token is not found, and InternalServerError: For any internal server errors. */
|
1244
|
-
errorCode: string;
|
1245
|
-
/** Description of the token error. */
|
1246
|
-
errorDescription: string;
|
1247
|
-
}
|
1248
|
-
|
1249
1150
|
/**
|
1250
1151
|
* Generate a shared access signature, which allows a client to send events to an Event Grid Topic or Domain for a limited period of time. This
|
1251
1152
|
* function may only be called when the EventGridPublisherClient was constructed with a KeyCredential instance.
|
@@ -2543,41 +2444,6 @@ export declare interface PolicyInsightsPolicyStateDeletedEventData {
|
|
2543
2444
|
complianceReasonCode: string;
|
2544
2445
|
}
|
2545
2446
|
|
2546
|
-
export declare interface PublishCloudEventOptions extends RequestOptions {
|
2547
|
-
/** content type */
|
2548
|
-
contentType?: string;
|
2549
|
-
}
|
2550
|
-
|
2551
|
-
export declare interface PublishCloudEventsOptions extends RequestOptions {
|
2552
|
-
/** content type */
|
2553
|
-
contentType?: string;
|
2554
|
-
}
|
2555
|
-
|
2556
|
-
/** The result of the Publish operation. */
|
2557
|
-
export declare interface PublishResultOutput {
|
2558
|
-
}
|
2559
|
-
|
2560
|
-
export declare interface ReceiveCloudEventsOptions extends RequestOptions {
|
2561
|
-
/** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */
|
2562
|
-
maxEvents?: number;
|
2563
|
-
/** 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. */
|
2564
|
-
maxWaitTime?: number;
|
2565
|
-
}
|
2566
|
-
|
2567
|
-
/** Receive operation details per Cloud Event. */
|
2568
|
-
export declare interface ReceiveDetails<T> {
|
2569
|
-
/** The Event Broker details. */
|
2570
|
-
brokerProperties: BrokerProperties;
|
2571
|
-
/** Cloud Event details. */
|
2572
|
-
event: CloudEvent<T>;
|
2573
|
-
}
|
2574
|
-
|
2575
|
-
/** Details of the Receive operation response. */
|
2576
|
-
export declare interface ReceiveResult<T> {
|
2577
|
-
/** Array of receive responses, one per cloud event. */
|
2578
|
-
value: ReceiveDetails<T>[];
|
2579
|
-
}
|
2580
|
-
|
2581
2447
|
/**
|
2582
2448
|
* Defines values for RecordingChannelType. \
|
2583
2449
|
* {@link KnownRecordingChannelType} can be used interchangeably with RecordingChannelType,
|
@@ -2609,61 +2475,6 @@ export declare type RecordingContentType = string;
|
|
2609
2475
|
*/
|
2610
2476
|
export declare type RecordingFormatType = string;
|
2611
2477
|
|
2612
|
-
export declare interface RejectCloudEventsOptions extends RequestOptions {
|
2613
|
-
/** content type */
|
2614
|
-
contentType?: string;
|
2615
|
-
}
|
2616
|
-
|
2617
|
-
/** Array of lock token strings for the corresponding received Cloud Events to be rejected. */
|
2618
|
-
export declare interface RejectOptions {
|
2619
|
-
/** String array of lock tokens. */
|
2620
|
-
lockTokens: string[];
|
2621
|
-
}
|
2622
|
-
|
2623
|
-
/** The result of the Reject operation. */
|
2624
|
-
export declare interface RejectResult {
|
2625
|
-
/** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */
|
2626
|
-
failedLockTokens: FailedLockToken[];
|
2627
|
-
/** Array of lock tokens values for the successfully rejected cloud events. */
|
2628
|
-
succeededLockTokens: string[];
|
2629
|
-
}
|
2630
|
-
|
2631
|
-
export declare interface ReleaseCloudEventsOptions extends RequestOptions {
|
2632
|
-
/** content type */
|
2633
|
-
contentType?: string;
|
2634
|
-
}
|
2635
|
-
|
2636
|
-
/** Array of lock token strings for the corresponding received Cloud Events to be released. */
|
2637
|
-
export declare interface ReleaseOptions {
|
2638
|
-
/** String array of lock tokens. */
|
2639
|
-
lockTokens: string[];
|
2640
|
-
}
|
2641
|
-
|
2642
|
-
/** The result of the Release operation. */
|
2643
|
-
export declare interface ReleaseResult {
|
2644
|
-
/** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */
|
2645
|
-
failedLockTokens: FailedLockToken[];
|
2646
|
-
/** Array of lock tokens values for the successfully released cloud events. */
|
2647
|
-
succeededLockTokens: string[];
|
2648
|
-
}
|
2649
|
-
|
2650
|
-
export declare interface RequestOptions {
|
2651
|
-
requestOptions?: {
|
2652
|
-
/**
|
2653
|
-
* Headers to send along with the request
|
2654
|
-
*/
|
2655
|
-
headers?: RawHttpHeadersInput;
|
2656
|
-
/** Set to true if the request is sent over HTTP instead of HTTPS */
|
2657
|
-
allowInsecureConnection?: boolean;
|
2658
|
-
/** Set to true if you want to skip encoding the path parameters */
|
2659
|
-
skipUrlEncoding?: boolean;
|
2660
|
-
/**
|
2661
|
-
* Callback to access the raw response object when the response is received
|
2662
|
-
*/
|
2663
|
-
onResponse?: (response: HttpResponse) => void;
|
2664
|
-
};
|
2665
|
-
}
|
2666
|
-
|
2667
2478
|
/** Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionCancel event. This is raised when a resource action operation is canceled. */
|
2668
2479
|
export declare interface ResourceActionCancelEventData {
|
2669
2480
|
/** The tenant ID of the resource. */
|
@@ -3647,6 +3458,16 @@ export declare interface SystemEventNameToEventData {
|
|
3647
3458
|
"Microsoft.ApiManagement.GatewayAPIRemoved": ApiManagementGatewayApiRemovedEventData;
|
3648
3459
|
/** An interface for the event data of a "Microsoft.HealthcareApis.DicomImageUpdated" event. */
|
3649
3460
|
"Microsoft.HealthcareApis.DicomImageUpdated": HealthcareDicomImageUpdatedEventData;
|
3461
|
+
/** An interface for the event data of a "Microsoft.ContainerService.ClusterSupportEnded" event. */
|
3462
|
+
"Microsoft.ContainerService.ClusterSupportEnded": ContainerServiceClusterSupportEndedEventData;
|
3463
|
+
/** An interface for the event data of a "Microsoft.ContainerService.ClusterSupportEnding" event. */
|
3464
|
+
"Microsoft.ContainerService.ClusterSupportEnding": ContainerServiceClusterSupportEndingEventData;
|
3465
|
+
/** An interface for the event data of a "Microsoft.ContainerService.NodePoolRollingStarted" event. */
|
3466
|
+
"Microsoft.ContainerService.NodePoolRollingStarted": ContainerServiceNodePoolRollingStartedEventData;
|
3467
|
+
/** An interface for the event data of a "Microsoft.ContainerService.NodePoolRollingSucceeded" event. */
|
3468
|
+
"Microsoft.ContainerService.NodePoolRollingSucceeded": ContainerServiceNodePoolRollingSucceededEventData;
|
3469
|
+
/** An interface for the event data of a "Microsoft.ContainerService.NodePoolRollingFailed" event. */
|
3470
|
+
"Microsoft.ContainerService.NodePoolRollingFailed": ContainerServiceNodePoolRollingFailedEventData;
|
3650
3471
|
}
|
3651
3472
|
|
3652
3473
|
/** Schema of the Data property of an EventGridEvent for a Microsoft.Web.AppServicePlanUpdated event. */
|
@@ -1,28 +0,0 @@
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
2
|
-
// Licensed under the MIT license.
|
3
|
-
import { createEventGrid, publishCloudEvent, publishCloudEvents, receiveCloudEvents, acknowledgeCloudEvents, releaseCloudEvents, rejectCloudEvents, } from "./api/index";
|
4
|
-
export class EventGridClient {
|
5
|
-
/** Azure Messaging EventGrid Client */
|
6
|
-
constructor(endpoint, credential, options = {}) {
|
7
|
-
this._client = createEventGrid(endpoint, credential, options);
|
8
|
-
}
|
9
|
-
publishCloudEvent(event, topicName, options = { requestOptions: {} }) {
|
10
|
-
return publishCloudEvent(this._client, event, topicName, options);
|
11
|
-
}
|
12
|
-
publishCloudEvents(events, topicName, options = { requestOptions: {} }) {
|
13
|
-
return publishCloudEvents(this._client, events, topicName, options);
|
14
|
-
}
|
15
|
-
receiveCloudEvents(topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
16
|
-
return receiveCloudEvents(this._client, topicName, eventSubscriptionName, options);
|
17
|
-
}
|
18
|
-
acknowledgeCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
19
|
-
return acknowledgeCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
|
20
|
-
}
|
21
|
-
releaseCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
22
|
-
return releaseCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
|
23
|
-
}
|
24
|
-
rejectCloudEvents(lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
25
|
-
return rejectCloudEvents(this._client, lockTokens, topicName, eventSubscriptionName, options);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
//# 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;AAIlC,OAAO,EACL,eAAe,EAMf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EA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;IAED,iBAAiB,CACf,UAAoB,EACpB,SAAiB,EACjB,qBAA6B,EAC7B,UAAoC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE1D,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAChG,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport { ClientOptions } from \"./common/interfaces\";\nimport {\n createEventGrid,\n EventGridContext,\n ReceiveResult,\n AcknowledgeResult,\n ReleaseResult,\n RejectResult,\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n} from \"./api/index\";\nimport { CloudEvent } from \"./rest/models\";\n\nexport class EventGridClient {\n private _client: EventGridContext;\n\n /** Azure Messaging EventGrid Client */\n constructor(endpoint: string, credential: AzureKeyCredential, options: ClientOptions = {}) {\n this._client = createEventGrid(endpoint, credential, options);\n }\n\n publishCloudEvent(\n event: CloudEvent,\n topicName: string,\n options: PublishCloudEventOptions = { requestOptions: {} }\n ): Promise<Record<string, any>> {\n return publishCloudEvent(this._client, event, topicName, options);\n }\n\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 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 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 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 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"]}
|
@@ -1,11 +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
|
-
options.credentials = Object.assign(Object.assign({}, options.credentials), { apiKeyHeaderName: "Authorization" });
|
8
|
-
const clientContext = getClient(baseUrl, credential, options);
|
9
|
-
return clientContext;
|
10
|
-
}
|
11
|
-
//# 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;AAIlC,OAAO,SAAS,MAAM,eAAe,CAAC;AAKtC,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,UAA8B,EAC9B,UAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,QAAQ,CAAC;IACzB,OAAO,CAAC,WAAW,mCACd,OAAO,CAAC,WAAW,KACtB,gBAAgB,EAAE,eAAe,GAClC,CAAC;IACF,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 { EventGridContext } from \"../rest/index\";\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport getClient from \"../rest/index\";\nimport { ClientOptions } from \"../common/interfaces\";\n\nexport { EventGridContext } from \"../rest/index\";\n\n/** Azure Messaging EventGrid Client */\nexport function createEventGrid(\n endpoint: string,\n credential: AzureKeyCredential,\n options: ClientOptions = {}\n): EventGridContext {\n const baseUrl = endpoint;\n options.credentials = {\n ...options.credentials,\n apiKeyHeaderName: \"Authorization\",\n };\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, } 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,EAAoB,MAAM,oBAAoB,CAAC;AAgBvE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,GAOlB,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { createEventGrid, EventGridContext } from \"./EventGridContext\";\nexport {\n PublishCloudEventRequest,\n CloudEvent,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeOptions,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseOptions,\n ReleaseResult,\n RejectOptions,\n RejectResult,\n PublishResultOutput,\n} from \"./models\";\nexport {\n publishCloudEvent,\n publishCloudEvents,\n receiveCloudEvents,\n acknowledgeCloudEvents,\n releaseCloudEvents,\n rejectCloudEvents,\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n} from \"./operations\";\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/cadl-generated/api/models.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { CloudEvent as CloudEventV1 } from \"../../models\";\n\n/** */\nexport interface PublishCloudEventRequest<T> {\n /** */\n event: CloudEventV1<T>;\n}\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?: 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;\n /** The version of the CloudEvents specification which the event uses. */\n specversion: string;\n /** Identifies the schema that data adheres to. */\n dataschema?: string;\n /** Content type of data value. */\n datacontenttype?: string;\n /** This describes the subject of the event in the context of the event producer (identified by source). */\n subject?: string;\n}\n\n/** The result of the Publish operation. */\nexport interface PublishResultOutput {}\n\n/** Details of the Receive operation response. */\nexport interface 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 used to lock the event. */\n lockToken: string;\n /** The attempt count for delivering the event. */\n deliveryCount: number;\n}\n\n/** Array of lock token strings for the corresponding received Cloud Events to be acknowledged. */\nexport interface AcknowledgeOptions {\n /** String array of lock tokens. */\n lockTokens: string[];\n}\n\n/** The result of the Acknowledge operation. */\nexport interface AcknowledgeResult {\n /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens values for the successfully acknowledged cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Failed LockToken information. */\nexport interface FailedLockToken {\n /** LockToken value */\n lockToken: string;\n /** Error code related to the token. Example of such error codes are BadToken: which indicates the Token is not formatted correctly, TokenLost: which indicates that token is not found, and InternalServerError: For any internal server errors. */\n errorCode: string;\n /** Description of the token error. */\n errorDescription: string;\n}\n\n/** Array of lock token strings for the corresponding received Cloud Events to be released. */\nexport interface ReleaseOptions {\n /** String array of lock tokens. */\n lockTokens: string[];\n}\n\n/** The result of the Release operation. */\nexport interface ReleaseResult {\n /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens values for the successfully released cloud events. */\n succeededLockTokens: string[];\n}\n\n/** Array of lock token strings for the corresponding received Cloud Events to be rejected. */\nexport interface RejectOptions {\n /** String array of lock tokens. */\n lockTokens: string[];\n}\n\n/** The result of the Reject operation. */\nexport interface RejectResult {\n /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */\n failedLockTokens: FailedLockToken[];\n /** Array of lock tokens values for the successfully rejected cloud events. */\n succeededLockTokens: string[];\n}\n"]}
|
@@ -1,162 +0,0 @@
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
2
|
-
// Licensed under the MIT license.
|
3
|
-
import { isUnexpected } from "../rest/index";
|
4
|
-
/** 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. */
|
5
|
-
export async function publishCloudEvent(context, event, topicName, options = { requestOptions: {} }) {
|
6
|
-
var _a, _b, _c, _d, _e;
|
7
|
-
const result = await context.path("/topics/{topicName}:publish", topicName).post({
|
8
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
9
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
10
|
-
contentType: (_c = options.contentType) !== null && _c !== void 0 ? _c : "application/cloudevents+json; charset=utf-8",
|
11
|
-
headers: Object.assign({}, (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.headers),
|
12
|
-
body: Object.assign({}, event),
|
13
|
-
});
|
14
|
-
if (typeof ((_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onResponse) === "function") {
|
15
|
-
options.requestOptions.onResponse(result);
|
16
|
-
}
|
17
|
-
if (isUnexpected(result)) {
|
18
|
-
throw result.body;
|
19
|
-
}
|
20
|
-
return result.body;
|
21
|
-
}
|
22
|
-
/** 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. */
|
23
|
-
export async function publishCloudEvents(context, events, topicName, options = { requestOptions: {} }) {
|
24
|
-
var _a, _b, _c, _d, _e;
|
25
|
-
const result = await context.path("/topics/{topicName}:publish", topicName).post({
|
26
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
27
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
28
|
-
contentType: (_c = options.contentType) !== null && _c !== void 0 ? _c : "application/cloudevents-batch+json; charset=utf-8",
|
29
|
-
headers: Object.assign({}, (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.headers),
|
30
|
-
body: events,
|
31
|
-
});
|
32
|
-
if (typeof ((_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onResponse) === "function") {
|
33
|
-
options.requestOptions.onResponse(result);
|
34
|
-
}
|
35
|
-
if (isUnexpected(result)) {
|
36
|
-
throw result.body;
|
37
|
-
}
|
38
|
-
return result.body;
|
39
|
-
}
|
40
|
-
/** Receive Batch of Cloud Events from the Event Subscription. */
|
41
|
-
export async function receiveCloudEvents(context, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
42
|
-
var _a, _b, _c, _d, _e;
|
43
|
-
const result = await context
|
44
|
-
.path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive", topicName, eventSubscriptionName)
|
45
|
-
.post({
|
46
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
47
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
48
|
-
headers: Object.assign({}, (_c = options.requestOptions) === null || _c === void 0 ? void 0 : _c.headers),
|
49
|
-
queryParameters: Object.assign(Object.assign({}, (options.maxEvents && { maxEvents: options.maxEvents })), (options.maxWaitTime && { maxWaitTime: options.maxWaitTime })),
|
50
|
-
});
|
51
|
-
if (typeof ((_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.onResponse) === "function") {
|
52
|
-
options.requestOptions.onResponse(result);
|
53
|
-
}
|
54
|
-
if (isUnexpected(result)) {
|
55
|
-
throw result.body;
|
56
|
-
}
|
57
|
-
return {
|
58
|
-
value: ((_e = result.body["value"]) !== null && _e !== void 0 ? _e : []).map((p) => {
|
59
|
-
var _a;
|
60
|
-
return ({
|
61
|
-
brokerProperties: {
|
62
|
-
lockToken: p.brokerProperties["lockToken"],
|
63
|
-
deliveryCount: p.brokerProperties["deliveryCount"],
|
64
|
-
},
|
65
|
-
event: {
|
66
|
-
id: p.event["id"],
|
67
|
-
source: p.event["source"],
|
68
|
-
data: p.event["data"],
|
69
|
-
dataBase64: p.event["data_base64"],
|
70
|
-
type: p.event["type"],
|
71
|
-
time: new Date((_a = p.event["time"]) !== null && _a !== void 0 ? _a : ""),
|
72
|
-
specversion: p.event["specversion"],
|
73
|
-
dataschema: p.event["dataschema"],
|
74
|
-
datacontenttype: p.event["datacontenttype"],
|
75
|
-
subject: p.event["subject"],
|
76
|
-
},
|
77
|
-
});
|
78
|
-
}),
|
79
|
-
};
|
80
|
-
}
|
81
|
-
/** Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully acknowledged. 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. */
|
82
|
-
export async function acknowledgeCloudEvents(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
83
|
-
var _a, _b, _c, _d, _e, _f;
|
84
|
-
const result = await context
|
85
|
-
.path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge", topicName, eventSubscriptionName)
|
86
|
-
.post({
|
87
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
88
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
89
|
-
contentType: (_c = options.contentType) !== null && _c !== void 0 ? _c : "application/json; charset=utf-8",
|
90
|
-
headers: Object.assign({}, (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.headers),
|
91
|
-
body: { lockTokens: lockTokens },
|
92
|
-
});
|
93
|
-
if (typeof ((_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onResponse) === "function") {
|
94
|
-
options.requestOptions.onResponse(result);
|
95
|
-
}
|
96
|
-
if (isUnexpected(result)) {
|
97
|
-
throw result.body;
|
98
|
-
}
|
99
|
-
return {
|
100
|
-
failedLockTokens: ((_f = result.body["failedLockTokens"]) !== null && _f !== void 0 ? _f : []).map((p) => ({
|
101
|
-
lockToken: p["lockToken"],
|
102
|
-
errorCode: p["errorCode"],
|
103
|
-
errorDescription: p["errorDescription"],
|
104
|
-
})),
|
105
|
-
succeededLockTokens: result.body["succeededLockTokens"],
|
106
|
-
};
|
107
|
-
}
|
108
|
-
/** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. */
|
109
|
-
export async function releaseCloudEvents(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
110
|
-
var _a, _b, _c, _d, _e, _f;
|
111
|
-
const result = await context
|
112
|
-
.path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release", topicName, eventSubscriptionName)
|
113
|
-
.post({
|
114
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
115
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
116
|
-
contentType: (_c = options.contentType) !== null && _c !== void 0 ? _c : "application/json; charset=utf-8",
|
117
|
-
headers: Object.assign({}, (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.headers),
|
118
|
-
body: { lockTokens: lockTokens },
|
119
|
-
});
|
120
|
-
if (typeof ((_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onResponse) === "function") {
|
121
|
-
options.requestOptions.onResponse(result);
|
122
|
-
}
|
123
|
-
if (isUnexpected(result)) {
|
124
|
-
throw result.body;
|
125
|
-
}
|
126
|
-
return {
|
127
|
-
failedLockTokens: ((_f = result.body["failedLockTokens"]) !== null && _f !== void 0 ? _f : []).map((p) => ({
|
128
|
-
lockToken: p["lockToken"],
|
129
|
-
errorCode: p["errorCode"],
|
130
|
-
errorDescription: p["errorDescription"],
|
131
|
-
})),
|
132
|
-
succeededLockTokens: result.body["succeededLockTokens"],
|
133
|
-
};
|
134
|
-
}
|
135
|
-
/** Reject batch of Cloud Events. */
|
136
|
-
export async function rejectCloudEvents(context, lockTokens, topicName, eventSubscriptionName, options = { requestOptions: {} }) {
|
137
|
-
var _a, _b, _c, _d, _e, _f;
|
138
|
-
const result = await context
|
139
|
-
.path("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject", topicName, eventSubscriptionName)
|
140
|
-
.post({
|
141
|
-
allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
|
142
|
-
skipUrlEncoding: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.skipUrlEncoding,
|
143
|
-
contentType: (_c = options.contentType) !== null && _c !== void 0 ? _c : "application/json; charset=utf-8",
|
144
|
-
headers: Object.assign({}, (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.headers),
|
145
|
-
body: { lockTokens: lockTokens },
|
146
|
-
});
|
147
|
-
if (typeof ((_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onResponse) === "function") {
|
148
|
-
options.requestOptions.onResponse(result);
|
149
|
-
}
|
150
|
-
if (isUnexpected(result)) {
|
151
|
-
throw result.body;
|
152
|
-
}
|
153
|
-
return {
|
154
|
-
failedLockTokens: ((_f = result.body["failedLockTokens"]) !== null && _f !== void 0 ? _f : []).map((p) => ({
|
155
|
-
lockToken: p["lockToken"],
|
156
|
-
errorCode: p["errorCode"],
|
157
|
-
errorDescription: p["errorDescription"],
|
158
|
-
})),
|
159
|
-
succeededLockTokens: result.body["succeededLockTokens"],
|
160
|
-
};
|
161
|
-
}
|
162
|
-
//# sourceMappingURL=operations.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"operations.js","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O;SACzB,IAAI,CACH,uEAAuE,EACvE,SAAS,EACT,qBAAqB,CACtB;SACA,IAAI,CAAC;QACJ,uBAAuB,EAAE,MAAA,OAAO,CAAC,cAAc,0CAAE,uBAAuB;QACxE,eAAe,EAAE,MAAA,OAAO,CAAC,cAAc,0CAAE,eAAe;QACxD,WAAW,EAAE,MAAC,OAAO,CAAC,WAAmB,mCAAI,iCAAiC;QAC9E,OAAO,oBAAO,MAAA,OAAO,CAAC,cAAc,0CAAE,OAAO,CAAE;QAC/C,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;KACjC,CAAC,CAAC;IAEL,IAAI,OAAO,CAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,UAAU,CAAA,KAAK,UAAU,EAAE;QAC5D,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;KAC3C;IAED,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,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC;YACzB,gBAAgB,EAAE,CAAC,CAAC,kBAAkB,CAAC;SACxC,CAAC,CAAC;QACH,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;KACxD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RequestOptions } from \"../common/interfaces\";\nimport { CloudEvent, EventGridContext as Client, isUnexpected } from \"../rest/index\";\nimport { ReceiveResult, AcknowledgeResult, ReleaseResult, RejectResult } from \"./models\";\n\nexport interface PublishCloudEventOptions extends RequestOptions {\n /** content type */\n contentType?: string;\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 event: CloudEvent,\n topicName: string,\n options: PublishCloudEventOptions = { requestOptions: {} }\n): Promise<Record<string, any>> {\n const result = await context.path(\"/topics/{topicName}:publish\", topicName).post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n contentType: (options.contentType as any) ?? \"application/cloudevents+json; charset=utf-8\",\n headers: { ...options.requestOptions?.headers },\n body: { ...event },\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return result.body;\n}\n\nexport interface PublishCloudEventsOptions extends RequestOptions {\n /** content type */\n contentType?: string;\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 context.path(\"/topics/{topicName}:publish\", topicName).post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n contentType:\n (options.contentType as any) ?? \"application/cloudevents-batch+json; charset=utf-8\",\n headers: { ...options.requestOptions?.headers },\n body: events,\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return result.body;\n}\n\nexport interface ReceiveCloudEventsOptions extends RequestOptions {\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\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 context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive\",\n topicName,\n eventSubscriptionName\n )\n .post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n headers: { ...options.requestOptions?.headers },\n queryParameters: {\n ...(options.maxEvents && { maxEvents: options.maxEvents }),\n ...(options.maxWaitTime && { maxWaitTime: options.maxWaitTime }),\n },\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\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: p.event[\"data_base64\"],\n type: p.event[\"type\"],\n time: new Date(p.event[\"time\"] ?? \"\"),\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\nexport interface AcknowledgeCloudEventsOptions extends RequestOptions {\n /** content type */\n contentType?: string;\n}\n\n/** Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully acknowledged. 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 context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge\",\n topicName,\n eventSubscriptionName\n )\n .post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n contentType: (options.contentType as any) ?? \"application/json; charset=utf-8\",\n headers: { ...options.requestOptions?.headers },\n body: { lockTokens: lockTokens },\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return {\n failedLockTokens: (result.body[\"failedLockTokens\"] ?? []).map((p) => ({\n lockToken: p[\"lockToken\"],\n errorCode: p[\"errorCode\"],\n errorDescription: p[\"errorDescription\"],\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\nexport interface ReleaseCloudEventsOptions extends RequestOptions {\n /** content type */\n contentType?: string;\n}\n\n/** Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. 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 context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release\",\n topicName,\n eventSubscriptionName\n )\n .post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n contentType: (options.contentType as any) ?? \"application/json; charset=utf-8\",\n headers: { ...options.requestOptions?.headers },\n body: { lockTokens: lockTokens },\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return {\n failedLockTokens: (result.body[\"failedLockTokens\"] ?? []).map((p) => ({\n lockToken: p[\"lockToken\"],\n errorCode: p[\"errorCode\"],\n errorDescription: p[\"errorDescription\"],\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n\nexport interface RejectCloudEventsOptions extends RequestOptions {\n /** content type */\n contentType?: string;\n}\n\n/** Reject batch of Cloud Events. */\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 context\n .path(\n \"/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject\",\n topicName,\n eventSubscriptionName\n )\n .post({\n allowInsecureConnection: options.requestOptions?.allowInsecureConnection,\n skipUrlEncoding: options.requestOptions?.skipUrlEncoding,\n contentType: (options.contentType as any) ?? \"application/json; charset=utf-8\",\n headers: { ...options.requestOptions?.headers },\n body: { lockTokens: lockTokens },\n });\n\n if (typeof options.requestOptions?.onResponse === \"function\") {\n options.requestOptions.onResponse(result);\n }\n\n if (isUnexpected(result)) {\n throw result.body;\n }\n\n return {\n failedLockTokens: (result.body[\"failedLockTokens\"] ?? []).map((p) => ({\n lockToken: p[\"lockToken\"],\n errorCode: p[\"errorCode\"],\n errorDescription: p[\"errorDescription\"],\n })),\n succeededLockTokens: result.body[\"succeededLockTokens\"],\n };\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/cadl-generated/common/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ClientOptions as RestClientOptions } from \"@azure-rest/core-client\";\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse } from \"@azure-rest/core-client\";\n\nexport interface ClientOptions extends RestClientOptions {}\nexport interface RequestOptions {\n requestOptions?: {\n /**\n * Headers to send along with the request\n */\n headers?: RawHttpHeadersInput;\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n /** Set to true if you want to skip encoding the path parameters */\n skipUrlEncoding?: boolean;\n /**\n * Callback to access the raw response object when the response is received\n */\n onResponse?: (response: HttpResponse) => void;\n };\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cadl-generated/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwBlC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n PublishCloudEventRequest,\n CloudEvent,\n ReceiveResult,\n ReceiveDetails,\n BrokerProperties,\n AcknowledgeOptions,\n AcknowledgeResult,\n FailedLockToken,\n ReleaseOptions,\n ReleaseResult,\n RejectOptions,\n RejectResult,\n} from \"./api/models\";\nexport {\n PublishCloudEventOptions,\n PublishCloudEventsOptions,\n ReceiveCloudEventsOptions,\n AcknowledgeCloudEventsOptions,\n ReleaseCloudEventsOptions,\n RejectCloudEventsOptions,\n} from \"./api/operations\";\nexport { EventGridClient } from \"./EventGridClient\";\nexport { ClientOptions, RequestOptions } from \"./common/interfaces\";\n"]}
|