@azure/eventgrid-namespaces 1.0.1-alpha.20250131.1 → 1.0.1-alpha.20250203.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.
- package/LICENSE +3 -3
- package/README.md +28 -20
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +9 -7
package/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
Copyright (c) Microsoft Corporation.
|
2
2
|
|
3
|
-
|
3
|
+
MIT License
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -12,7 +12,7 @@ furnished to do so, subject to the following conditions:
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
13
13
|
copies or substantial portions of the Software.
|
14
14
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
package/README.md
CHANGED
@@ -68,21 +68,24 @@ az eventgrid topic key list --resource-group <your-resource-group-name> --name <
|
|
68
68
|
|
69
69
|
Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
|
70
70
|
|
71
|
-
```
|
72
|
-
|
71
|
+
```ts snippet:ReadmeSampleCreateClient_KeyCredential
|
72
|
+
import {
|
73
73
|
EventGridSenderClient,
|
74
|
-
EventGridReceiverClient,
|
75
74
|
AzureKeyCredential,
|
76
|
-
|
75
|
+
EventGridReceiverClient,
|
76
|
+
} from "@azure/eventgrid-namespaces";
|
77
77
|
|
78
78
|
const eventGridSenderClient = new EventGridSenderClient(
|
79
79
|
"<endpoint>",
|
80
80
|
new AzureKeyCredential("<Access Key>"),
|
81
|
+
"<topic-name>",
|
81
82
|
);
|
82
83
|
|
83
84
|
const eventGridReceiverClient = new EventGridReceiverClient(
|
84
85
|
"<endpoint>",
|
85
86
|
new AzureKeyCredential("<Access Key>"),
|
87
|
+
"<topic-name>",
|
88
|
+
"<subscription-name>",
|
86
89
|
);
|
87
90
|
```
|
88
91
|
|
@@ -94,21 +97,21 @@ With the `@azure/identity` package, you can seamlessly authorize requests in bot
|
|
94
97
|
|
95
98
|
For example, use can use `DefaultAzureCredential` to construct a client which will authenticate using Azure Active Directory:
|
96
99
|
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
+
```ts snippet:ReadmeSampleCreateClient_TokenCredential
|
101
|
+
import { EventGridSenderClient, EventGridReceiverClient } from "@azure/eventgrid-namespaces";
|
102
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
100
103
|
|
101
104
|
const eventGridSenderClient = new EventGridSenderClient(
|
102
105
|
"<endpoint>",
|
103
106
|
new DefaultAzureCredential(),
|
104
|
-
"<
|
107
|
+
"<topic-name>",
|
105
108
|
);
|
106
109
|
|
107
110
|
const eventGridReceiverClient = new EventGridReceiverClient(
|
108
111
|
"<endpoint>",
|
109
112
|
new DefaultAzureCredential(),
|
110
|
-
"<
|
111
|
-
"<
|
113
|
+
"<topic-name>",
|
114
|
+
"<subscription-name>",
|
112
115
|
);
|
113
116
|
```
|
114
117
|
|
@@ -118,22 +121,26 @@ const eventGridReceiverClient = new EventGridReceiverClient(
|
|
118
121
|
|
119
122
|
`EventGridSenderClient` can be used for sending events to an Event Grid. You can initialize it as:
|
120
123
|
|
121
|
-
```
|
124
|
+
```ts snippet:ReadmeSample_SenderClient
|
125
|
+
import { EventGridSenderClient, AzureKeyCredential } from "@azure/eventgrid-namespaces";
|
126
|
+
|
122
127
|
const eventGridSenderClient = new EventGridSenderClient(
|
123
128
|
"<endpoint>",
|
124
129
|
new AzureKeyCredential("<API Key>"),
|
125
|
-
"<
|
130
|
+
"<topic-name>",
|
126
131
|
);
|
127
132
|
```
|
128
133
|
|
129
134
|
`EventGridReceiverClient` can be used for receiving events from an Event Grid. You can initialize it as:
|
130
135
|
|
131
|
-
```
|
136
|
+
```ts snippet:ReadmeSample_ReceiverClient
|
137
|
+
import { EventGridReceiverClient, AzureKeyCredential } from "@azure/eventgrid-namespaces";
|
138
|
+
|
132
139
|
const eventGridReceiverClient = new EventGridReceiverClient(
|
133
140
|
"<endpoint>",
|
134
141
|
new AzureKeyCredential("<API Key>"),
|
135
142
|
"<topicName>",
|
136
|
-
"<
|
143
|
+
"<subscription-name>",
|
137
144
|
);
|
138
145
|
```
|
139
146
|
|
@@ -149,16 +156,16 @@ This library has been tested and validated on [Kubernetes using Azure Arc][event
|
|
149
156
|
|
150
157
|
### Publish an Event to an Event Grid Topic
|
151
158
|
|
152
|
-
```
|
153
|
-
|
159
|
+
```ts snippet:ReadmeSamplePublishEvent
|
160
|
+
import { EventGridSenderClient, AzureKeyCredential } from "@azure/eventgrid-namespaces";
|
154
161
|
|
155
162
|
const client = new EventGridSenderClient(
|
156
163
|
"<endpoint>",
|
157
164
|
new AzureKeyCredential("<API key>"),
|
158
|
-
"<
|
165
|
+
"<subscription-name>",
|
159
166
|
);
|
160
167
|
|
161
|
-
const cloudEvent
|
168
|
+
const cloudEvent = {
|
162
169
|
type: "example",
|
163
170
|
source: "https://example.com",
|
164
171
|
id: `singleEventIdV210001`,
|
@@ -168,6 +175,7 @@ const cloudEvent: CloudEvent = {
|
|
168
175
|
},
|
169
176
|
specversion: "1.0",
|
170
177
|
};
|
178
|
+
|
171
179
|
// Publish the Cloud Event
|
172
180
|
await client.sendEvents(cloudEvent);
|
173
181
|
```
|
@@ -178,8 +186,8 @@ await client.sendEvents(cloudEvent);
|
|
178
186
|
|
179
187
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
180
188
|
|
181
|
-
```
|
182
|
-
|
189
|
+
```ts snippet:SetLogLevel
|
190
|
+
import { setLogLevel } from "@azure/logger";
|
183
191
|
|
184
192
|
setLogLevel("info");
|
185
193
|
```
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"sdk-type": "client",
|
4
4
|
"author": "Microsoft Corporation",
|
5
5
|
"description": "An isomorphic client library for the Azure Event Grid service.",
|
6
|
-
"version": "1.0.1-alpha.
|
6
|
+
"version": "1.0.1-alpha.20250203.1",
|
7
7
|
"keywords": [
|
8
8
|
"node",
|
9
9
|
"azure",
|
@@ -64,7 +64,7 @@
|
|
64
64
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
65
65
|
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
66
66
|
"unit-test:node": "dev-tool run test:vitest",
|
67
|
-
"update-snippets": "
|
67
|
+
"update-snippets": "dev-tool run update-snippets"
|
68
68
|
},
|
69
69
|
"sideEffects": false,
|
70
70
|
"autoPublish": false,
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"@azure-rest/core-client": "^2.3.1",
|
73
73
|
"@azure/core-auth": "^1.9.0",
|
74
74
|
"@azure/core-client": "^1.9.2",
|
75
|
-
"@azure/core-rest-pipeline": "^1.18.
|
75
|
+
"@azure/core-rest-pipeline": "^1.18.2",
|
76
76
|
"@azure/core-util": "^1.11.0",
|
77
77
|
"@azure/eventgrid": "^5.8.0",
|
78
78
|
"@azure/logger": "^1.1.4",
|
@@ -85,17 +85,19 @@
|
|
85
85
|
"@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
|
86
86
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
87
87
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
88
|
+
"@azure/identity": "^4.6.0",
|
88
89
|
"@types/node": "^18.0.0",
|
89
90
|
"@vitest/browser": "^3.0.3",
|
90
91
|
"@vitest/coverage-istanbul": "^3.0.3",
|
91
92
|
"dotenv": "^16.0.0",
|
92
93
|
"eslint": "^9.9.0",
|
93
|
-
"playwright": "^1.
|
94
|
+
"playwright": "^1.50.1",
|
94
95
|
"typescript": "~5.7.2",
|
95
96
|
"vitest": "^3.0.3"
|
96
97
|
},
|
97
98
|
"type": "module",
|
98
99
|
"tshy": {
|
100
|
+
"project": "./tsconfig.src.json",
|
99
101
|
"exports": {
|
100
102
|
"./package.json": "./package.json",
|
101
103
|
".": "./src/index.ts"
|
@@ -108,8 +110,7 @@
|
|
108
110
|
"browser",
|
109
111
|
"react-native"
|
110
112
|
],
|
111
|
-
"selfLink": false
|
112
|
-
"project": "./tsconfig.src.json"
|
113
|
+
"selfLink": false
|
113
114
|
},
|
114
115
|
"browser": "./dist/browser/index.js",
|
115
116
|
"exports": {
|
@@ -132,5 +133,6 @@
|
|
132
133
|
"default": "./dist/commonjs/index.js"
|
133
134
|
}
|
134
135
|
}
|
135
|
-
}
|
136
|
+
},
|
137
|
+
"react-native": "./dist/react-native/index.js"
|
136
138
|
}
|