@azure/eventgrid-namespaces 1.0.0-alpha.20240412.4

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -0
  3. package/dist/index.js +600 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist-esm/src/cadl-generated/EventGridClient.js +50 -0
  6. package/dist-esm/src/cadl-generated/EventGridClient.js.map +1 -0
  7. package/dist-esm/src/cadl-generated/api/EventGridContext.js +9 -0
  8. package/dist-esm/src/cadl-generated/api/EventGridContext.js.map +1 -0
  9. package/dist-esm/src/cadl-generated/api/index.js +5 -0
  10. package/dist-esm/src/cadl-generated/api/index.js.map +1 -0
  11. package/dist-esm/src/cadl-generated/api/operations.js +197 -0
  12. package/dist-esm/src/cadl-generated/api/operations.js.map +1 -0
  13. package/dist-esm/src/cadl-generated/index.js +4 -0
  14. package/dist-esm/src/cadl-generated/index.js.map +1 -0
  15. package/dist-esm/src/cadl-generated/logger.js +5 -0
  16. package/dist-esm/src/cadl-generated/logger.js.map +1 -0
  17. package/dist-esm/src/cadl-generated/models/index.js +4 -0
  18. package/dist-esm/src/cadl-generated/models/index.js.map +1 -0
  19. package/dist-esm/src/cadl-generated/models/models.js +4 -0
  20. package/dist-esm/src/cadl-generated/models/models.js.map +1 -0
  21. package/dist-esm/src/cadl-generated/models/options.js +4 -0
  22. package/dist-esm/src/cadl-generated/models/options.js.map +1 -0
  23. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js +4 -0
  24. package/dist-esm/src/cadl-generated/rest/clientDefinitions.js.map +1 -0
  25. package/dist-esm/src/cadl-generated/rest/eventGridClient.js +40 -0
  26. package/dist-esm/src/cadl-generated/rest/eventGridClient.js.map +1 -0
  27. package/dist-esm/src/cadl-generated/rest/index.js +12 -0
  28. package/dist-esm/src/cadl-generated/rest/index.js.map +1 -0
  29. package/dist-esm/src/cadl-generated/rest/isUnexpected.js +75 -0
  30. package/dist-esm/src/cadl-generated/rest/isUnexpected.js.map +1 -0
  31. package/dist-esm/src/cadl-generated/rest/models.js +4 -0
  32. package/dist-esm/src/cadl-generated/rest/models.js.map +1 -0
  33. package/dist-esm/src/cadl-generated/rest/outputModels.js +4 -0
  34. package/dist-esm/src/cadl-generated/rest/outputModels.js.map +1 -0
  35. package/dist-esm/src/cadl-generated/rest/parameters.js +4 -0
  36. package/dist-esm/src/cadl-generated/rest/parameters.js.map +1 -0
  37. package/dist-esm/src/cadl-generated/rest/responses.js +4 -0
  38. package/dist-esm/src/cadl-generated/rest/responses.js.map +1 -0
  39. package/dist-esm/src/constants.js +5 -0
  40. package/dist-esm/src/constants.js.map +1 -0
  41. package/dist-esm/src/eventGridNamespacesClient.js +147 -0
  42. package/dist-esm/src/eventGridNamespacesClient.js.map +1 -0
  43. package/dist-esm/src/eventGridNamespacesPublishBinaryMode.js +63 -0
  44. package/dist-esm/src/eventGridNamespacesPublishBinaryMode.js.map +1 -0
  45. package/dist-esm/src/index.js +5 -0
  46. package/dist-esm/src/index.js.map +1 -0
  47. package/dist-esm/src/models.js +14 -0
  48. package/dist-esm/src/models.js.map +1 -0
  49. package/package.json +120 -0
  50. package/types/eventgrid-namespaces.d.ts +275 -0
package/package.json ADDED
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "@azure/eventgrid-namespaces",
3
+ "sdk-type": "client",
4
+ "author": "Microsoft Corporation",
5
+ "description": "An isomorphic client library for the Azure Event Grid service.",
6
+ "version": "1.0.0-alpha.20240412.4",
7
+ "keywords": [
8
+ "node",
9
+ "azure",
10
+ "typescript",
11
+ "browser",
12
+ "isomorphic",
13
+ "cloud"
14
+ ],
15
+ "license": "MIT",
16
+ "main": "./dist/index.js",
17
+ "module": "./dist-esm/src/index.js",
18
+ "types": "./types/eventgrid-namespaces.d.ts",
19
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventgrid/eventgrid-namespaces/README.md",
20
+ "repository": "github:Azure/azure-sdk-for-js",
21
+ "bugs": {
22
+ "url": "https://github.com/Azure/azure-sdk-for-js/issues"
23
+ },
24
+ "engines": {
25
+ "node": ">=18.0.0"
26
+ },
27
+ "files": [
28
+ "dist/",
29
+ "dist-esm/src/",
30
+ "types/eventgrid-namespaces.d.ts",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "//sampleConfiguration": {
35
+ "productName": "Azure Event Grid",
36
+ "productSlugs": [
37
+ "azure",
38
+ "azure-event-grid"
39
+ ],
40
+ "requiredResources": {
41
+ "Azure Event Grid Custom Topic, configured to use the Event Grid Schema": "https://docs.microsoft.com/azure/event-grid/scripts/event-grid-cli-create-custom-topic",
42
+ "Azure Event Grid Custom Topic, configured to use the Cloud Event 1.0 Schema": "https://docs.microsoft.com/azure/event-grid/scripts/event-grid-cli-create-custom-topic",
43
+ "Azure Service Bus Queue": "https://docs.microsoft.com/azure/service-bus-messaging/service-bus-quickstart-portal"
44
+ }
45
+ },
46
+ "scripts": {
47
+ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
48
+ "build:browser": "tsc -p . && dev-tool run bundle",
49
+ "build:node": "tsc -p . && dev-tool run bundle",
50
+ "build:samples": "echo Obsolete",
51
+ "build:test": "tsc -p . && dev-tool run bundle",
52
+ "build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local",
53
+ "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
54
+ "clean": "rimraf --glob dist dist-browser dist-esm dist-test temp types *.tgz *.log",
55
+ "execute:samples": "dev-tool samples run samples-dev",
56
+ "extract-api": "tsc -p . && api-extractor run --local",
57
+ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
58
+ "integration-test:browser": "dev-tool run test:browser",
59
+ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
60
+ "integration-test": "npm run integration-test:node && npm run integration-test:browser",
61
+ "lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]",
62
+ "lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js",
63
+ "pack": "npm pack 2>&1",
64
+ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
65
+ "test:node": "npm run clean && npm run build:test && npm run unit-test:node",
66
+ "test": "npm run clean && npm run build:test && npm run unit-test",
67
+ "unit-test:browser": "dev-tool run test:browser",
68
+ "unit-test:node": "dev-tool run test:node-tsx-ts -- --timeout 1200000 'test/**/*.spec.ts'",
69
+ "unit-test": "npm run unit-test:node && npm run unit-test:browser"
70
+ },
71
+ "sideEffects": false,
72
+ "autoPublish": false,
73
+ "dependencies": {
74
+ "@azure/core-auth": "^1.7.0",
75
+ "@azure/core-rest-pipeline": "^1.1.3",
76
+ "@azure-rest/core-client": "^1.3.1",
77
+ "@azure/logger": "^1.0.0",
78
+ "@azure/core-util": "^1.6.1",
79
+ "buffer": "^6.0.0",
80
+ "tslib": "^2.2.0"
81
+ },
82
+ "devDependencies": {
83
+ "@azure/identity": "^4.1.0",
84
+ "@azure/core-client": "^1.5.0",
85
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
86
+ "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
87
+ "@azure/service-bus": "^7.0.0",
88
+ "@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
89
+ "@azure-tools/test-recorder": "^3.0.0",
90
+ "@microsoft/api-extractor": "^7.31.1",
91
+ "@types/chai": "^4.1.6",
92
+ "@types/chai-as-promised": "^7.1.0",
93
+ "@types/mocha": "^10.0.0",
94
+ "@types/node": "^18.0.0",
95
+ "@types/sinon": "^17.0.0",
96
+ "@types/uuid": "^8.0.0",
97
+ "chai": "^4.2.0",
98
+ "chai-as-promised": "^7.1.1",
99
+ "cross-env": "^7.0.2",
100
+ "dotenv": "^16.0.0",
101
+ "eslint": "^8.0.0",
102
+ "karma": "^6.2.0",
103
+ "karma-chrome-launcher": "^3.0.0",
104
+ "karma-coverage": "^2.0.0",
105
+ "karma-env-preprocessor": "^0.1.1",
106
+ "karma-firefox-launcher": "^1.1.0",
107
+ "karma-junit-reporter": "^2.0.1",
108
+ "karma-mocha": "^2.0.1",
109
+ "karma-mocha-reporter": "^2.2.5",
110
+ "karma-sourcemap-loader": "^0.3.8",
111
+ "mocha": "^10.0.0",
112
+ "c8": "^9.1.0",
113
+ "prettier": "^2.5.1",
114
+ "rimraf": "^5.0.5",
115
+ "sinon": "^17.0.0",
116
+ "source-map-support": "^0.5.9",
117
+ "ts-node": "^10.0.0",
118
+ "typescript": "~5.3.3"
119
+ }
120
+ }
@@ -0,0 +1,275 @@
1
+ import { AzureKeyCredential } from '@azure/core-auth';
2
+ import { ClientOptions } from '@azure-rest/core-client';
3
+ import { ErrorModel } from '@azure-rest/core-client';
4
+ import { OperationOptions } from '@azure-rest/core-client';
5
+ import { TokenCredential } from '@azure/core-auth';
6
+
7
+ export declare interface AcknowledgeCloudEventsOptions extends OperationOptions {
8
+ }
9
+
10
+ /** The result of the Acknowledge operation. */
11
+ export declare interface AcknowledgeResult {
12
+ /** 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). */
13
+ failedLockTokens: FailedLockToken[];
14
+ /** Array of lock tokens for the successfully acknowledged cloud events. */
15
+ succeededLockTokens: string[];
16
+ }
17
+
18
+ export { AzureKeyCredential }
19
+
20
+ /** Properties of the Event Broker operation. */
21
+ export declare interface BrokerProperties {
22
+ /** The token of the lock on the event. */
23
+ lockToken: string;
24
+ /** The attempt count for delivering the event. */
25
+ deliveryCount: number;
26
+ }
27
+
28
+ /**
29
+ * An event in the Cloud Event 1.0 schema.
30
+ */
31
+ export declare interface CloudEvent<T> {
32
+ /**
33
+ * Type of event related to the originating occurrence.
34
+ */
35
+ type: string;
36
+ /**
37
+ * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.
38
+ */
39
+ source: string;
40
+ /**
41
+ * An identifier for the event. The combination of id and source must be unique for each distinct event.
42
+ */
43
+ id: string;
44
+ /**
45
+ * The time the event was generated.
46
+ */
47
+ time?: Date;
48
+ /**
49
+ * Identifies the schema that data adheres to.
50
+ */
51
+ dataschema?: string;
52
+ /**
53
+ * Content type of data value.
54
+ */
55
+ datacontenttype?: string;
56
+ /**
57
+ * Event data specific to the event type.
58
+ */
59
+ data?: T;
60
+ /**
61
+ * This describes the subject of the event in the context of the event producer (identified by source).
62
+ */
63
+ subject?: string;
64
+ /**
65
+ * Additional context attributes for the event. The Cloud Event specification refers to these as "extension attributes".
66
+ */
67
+ extensionAttributes?: Record<string, unknown>;
68
+ /**
69
+ * The version of the CloudEvents specification which the event uses.
70
+ */
71
+ specversion?: string | "1.0";
72
+ }
73
+
74
+ /** Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema. */
75
+ declare interface CloudEvent_2 {
76
+ /** An identifier for the event. The combination of id and source must be unique for each distinct event. */
77
+ id: string;
78
+ /** Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. */
79
+ source: string;
80
+ /** Event data specific to the event type. */
81
+ data?: unknown;
82
+ /** Event data specific to the event type, encoded as a base64 string. */
83
+ dataBase64?: Uint8Array;
84
+ /** Type of event related to the originating occurrence. */
85
+ type: string;
86
+ /** The time (in UTC) the event was generated, in RFC3339 format. */
87
+ time?: Date;
88
+ /** The version of the CloudEvents specification which the event uses. */
89
+ specversion: string;
90
+ /** Identifies the schema that data adheres to. */
91
+ dataschema?: string;
92
+ /** Content type of data value. */
93
+ datacontenttype?: string;
94
+ /** This describes the subject of the event in the context of the event producer (identified by source). */
95
+ subject?: string;
96
+ }
97
+
98
+ /**
99
+ * Event Grid Namespaces Client
100
+ */
101
+ export declare class EventGridClient {
102
+ private _client;
103
+ /** Azure Messaging EventGrid Client */
104
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, options?: EventGridClientOptions);
105
+ /**
106
+ * Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200
107
+ * status code with an empty JSON object in response. Otherwise, the server can return various error codes.
108
+ * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message
109
+ * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for
110
+ * internal server error.
111
+ *
112
+ * @param event - Event to publish
113
+ * @param topicName - Topic to publish the event
114
+ * @param options - Options to publish
115
+ *
116
+ */
117
+ publishCloudEvent<T>(event: CloudEvent<T>, topicName: string, options?: PublishCloudEventOptions): Promise<void>;
118
+ /**
119
+ * Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200
120
+ * status code with an empty JSON object in response. Otherwise, the server can return various error codes.
121
+ * For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message
122
+ * is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for
123
+ * internal server error.
124
+ *
125
+ * @param events - Events to publish
126
+ * @param topicName - Topic to publish the event
127
+ * @param options - Options to publish
128
+ *
129
+ */
130
+ publishCloudEvents<T>(events: CloudEvent<T>[], topicName: string, options?: PublishCloudEventsOptions): Promise<void>;
131
+ /**
132
+ * Receive Batch of Cloud Events from the Event Subscription.
133
+ *
134
+ * @param topicName - Topic to receive
135
+ * @param eventSubscriptionName - Name of the Event Subscription
136
+ * @param options - Options to receive
137
+ *
138
+ */
139
+ receiveCloudEvents(topicName: string, eventSubscriptionName: string, options?: ReceiveCloudEventsOptions): Promise<ReceiveResult>;
140
+ /**
141
+ * Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one
142
+ * event is successfully acknowledged. The response body will include the set of successfully acknowledged
143
+ * lockTokens, along with other failed lockTokens with their corresponding error information. Successfully
144
+ * acknowledged events will no longer be available to any consumer.
145
+ *
146
+ * @param lockTokens - Lock Tokens
147
+ * @param topicName - Topic Name
148
+ * @param eventSubscriptionName - Name of the Event Subscription
149
+ * @param options - Options to Acknowledge
150
+ *
151
+ */
152
+ acknowledgeCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: AcknowledgeCloudEventsOptions): Promise<AcknowledgeResult>;
153
+ /**
154
+ * Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is
155
+ * successfully released. The response body will include the set of successfully released lockTokens, along
156
+ * with other failed lockTokens with their corresponding error information.
157
+ *
158
+ * @param lockTokens - Lock Tokens
159
+ * @param topicName - Topic Name
160
+ * @param eventSubscriptionName - Name of the Event Subscription
161
+ * @param options - Options to release
162
+ *
163
+ */
164
+ releaseCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: ReleaseCloudEventsOptions): Promise<ReleaseResult>;
165
+ /**
166
+ * Reject batch of Cloud Events.
167
+ *
168
+ * @param lockTokens - Lock Tokens
169
+ * @param topicName - Topic Name
170
+ * @param eventSubscriptionName - Name of the Event Subscription
171
+ * @param options - Options to reject
172
+ *
173
+ */
174
+ rejectCloudEvents(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: RejectCloudEventsOptions): Promise<RejectResult>;
175
+ /**
176
+ * Renew lock for batch of Cloud Events.
177
+ *
178
+ * @param lockTokens - Lock Tokens
179
+ * @param topicName - Topic Name
180
+ * @param eventSubscriptionName - Name of the Event Subscription
181
+ * @param options - Options to renew
182
+ */
183
+ renewCloudEventLocks(lockTokens: string[], topicName: string, eventSubscriptionName: string, options?: RenewCloudEventLocksOptions): Promise<RenewCloudEventLocksResult>;
184
+ }
185
+
186
+ export declare interface EventGridClientOptions extends ClientOptions {
187
+ }
188
+
189
+ /** Failed LockToken information. */
190
+ export declare interface FailedLockToken {
191
+ /** The lock token of an entry in the request. */
192
+ lockToken: string;
193
+ /** Error information of the failed operation result for the lock token in the request. */
194
+ error: ErrorModel;
195
+ }
196
+
197
+ export { OperationOptions }
198
+
199
+ export declare interface PublishCloudEventOptions extends OperationOptions {
200
+ /** binary mode */
201
+ binaryMode?: boolean;
202
+ /** content type */
203
+ contentType?: string;
204
+ }
205
+
206
+ export declare interface PublishCloudEventsOptions extends OperationOptions {
207
+ /** content type */
208
+ contentType?: string;
209
+ }
210
+
211
+ /** The result of the Publish operation. */
212
+ export declare interface PublishResultOutput {
213
+ }
214
+
215
+ export declare interface ReceiveCloudEventsOptions extends OperationOptions {
216
+ /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */
217
+ maxEvents?: number;
218
+ /** 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. */
219
+ maxWaitTime?: number;
220
+ }
221
+
222
+ /** Receive operation details per Cloud Event. */
223
+ export declare interface ReceiveDetails {
224
+ /** The Event Broker details. */
225
+ brokerProperties: BrokerProperties;
226
+ /** Cloud Event details. */
227
+ event: CloudEvent_2;
228
+ }
229
+
230
+ /** Details of the Receive operation response. */
231
+ export declare interface ReceiveResult {
232
+ /** Array of receive responses, one per cloud event. */
233
+ value: ReceiveDetails[];
234
+ }
235
+
236
+ export declare interface RejectCloudEventsOptions extends OperationOptions {
237
+ }
238
+
239
+ /** The result of the Reject operation. */
240
+ export declare interface RejectResult {
241
+ /** 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). */
242
+ failedLockTokens: FailedLockToken[];
243
+ /** Array of lock tokens for the successfully rejected cloud events. */
244
+ succeededLockTokens: string[];
245
+ }
246
+
247
+ export declare interface ReleaseCloudEventsOptions extends OperationOptions {
248
+ /** Release cloud events with the specified delay in seconds. */
249
+ releaseDelayInSeconds?: ReleaseDelay;
250
+ }
251
+
252
+ /** Supported delays for release operation. */
253
+ /** "0", "10", "60", "600", "3600" */
254
+ export declare type ReleaseDelay = string;
255
+
256
+ /** The result of the Release operation. */
257
+ export declare interface ReleaseResult {
258
+ /** 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). */
259
+ failedLockTokens: FailedLockToken[];
260
+ /** Array of lock tokens for the successfully released cloud events. */
261
+ succeededLockTokens: string[];
262
+ }
263
+
264
+ export declare interface RenewCloudEventLocksOptions extends OperationOptions {
265
+ }
266
+
267
+ /** The result of the RenewLock operation. */
268
+ export declare interface RenewCloudEventLocksResult {
269
+ /** 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). */
270
+ failedLockTokens: FailedLockToken[];
271
+ /** Array of lock tokens for the successfully renewed locks. */
272
+ succeededLockTokens: string[];
273
+ }
274
+
275
+ export { }