@azure/web-pubsub-express 1.0.6-alpha.20250224.1 → 1.0.6
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/README.md +53 -46
- package/dist/browser/cloudEventsDispatcher.d.ts +15 -0
- package/dist/browser/cloudEventsDispatcher.d.ts.map +1 -0
- package/dist/browser/cloudEventsDispatcher.js +411 -0
- package/dist/browser/cloudEventsDispatcher.js.map +1 -0
- package/dist/browser/cloudEventsProtocols.d.ts +411 -0
- package/dist/browser/cloudEventsProtocols.d.ts.map +1 -0
- package/dist/browser/cloudEventsProtocols.js +4 -0
- package/dist/browser/cloudEventsProtocols.js.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttDisconnectReasonCode.d.ts +180 -0
- package/dist/browser/enum/MqttErrorCodes/mqttDisconnectReasonCode.d.ts.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttDisconnectReasonCode.js +183 -0
- package/dist/browser/enum/MqttErrorCodes/mqttDisconnectReasonCode.js.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV311ConnectReturnCode.d.ts +31 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV311ConnectReturnCode.d.ts.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV311ConnectReturnCode.js +34 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV311ConnectReturnCode.js.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV500ConnectReasonCode.d.ts +112 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV500ConnectReasonCode.d.ts.map +1 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV500ConnectReasonCode.js +115 -0
- package/dist/browser/enum/MqttErrorCodes/mqttV500ConnectReasonCode.js.map +1 -0
- package/dist/browser/index.d.ts +6 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +8 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +7 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +10 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/utils.d.ts +6 -0
- package/dist/browser/utils.d.ts.map +1 -0
- package/dist/browser/utils.js +53 -0
- package/dist/browser/utils.js.map +1 -0
- package/dist/browser/webPubSubEventHandler.d.ts +46 -0
- package/dist/browser/webPubSubEventHandler.d.ts.map +1 -0
- package/dist/browser/webPubSubEventHandler.js +73 -0
- package/dist/browser/webPubSubEventHandler.js.map +1 -0
- package/dist/commonjs/index.js +14 -880
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/webPubSubEventHandler.d.ts +7 -8
- package/dist/commonjs/webPubSubEventHandler.d.ts.map +1 -1
- package/dist/commonjs/webPubSubEventHandler.js +7 -8
- package/dist/commonjs/webPubSubEventHandler.js.map +1 -1
- package/dist/esm/webPubSubEventHandler.d.ts +7 -8
- package/dist/esm/webPubSubEventHandler.d.ts.map +1 -1
- package/dist/esm/webPubSubEventHandler.js +7 -8
- package/dist/esm/webPubSubEventHandler.js.map +1 -1
- package/dist/react-native/cloudEventsDispatcher.d.ts +15 -0
- package/dist/react-native/cloudEventsDispatcher.d.ts.map +1 -0
- package/dist/react-native/cloudEventsDispatcher.js +411 -0
- package/dist/react-native/cloudEventsDispatcher.js.map +1 -0
- package/dist/react-native/cloudEventsProtocols.d.ts +411 -0
- package/dist/react-native/cloudEventsProtocols.d.ts.map +1 -0
- package/dist/react-native/cloudEventsProtocols.js +4 -0
- package/dist/react-native/cloudEventsProtocols.js.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttDisconnectReasonCode.d.ts +180 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttDisconnectReasonCode.d.ts.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttDisconnectReasonCode.js +183 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttDisconnectReasonCode.js.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV311ConnectReturnCode.d.ts +31 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV311ConnectReturnCode.d.ts.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV311ConnectReturnCode.js +34 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV311ConnectReturnCode.js.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV500ConnectReasonCode.d.ts +112 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV500ConnectReasonCode.d.ts.map +1 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV500ConnectReasonCode.js +115 -0
- package/dist/react-native/enum/MqttErrorCodes/mqttV500ConnectReasonCode.js.map +1 -0
- package/dist/react-native/index.d.ts +6 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +8 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +7 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +10 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/utils.d.ts +6 -0
- package/dist/react-native/utils.d.ts.map +1 -0
- package/dist/react-native/utils.js +53 -0
- package/dist/react-native/utils.js.map +1 -0
- package/dist/react-native/webPubSubEventHandler.d.ts +46 -0
- package/dist/react-native/webPubSubEventHandler.d.ts.map +1 -0
- package/dist/react-native/webPubSubEventHandler.js +73 -0
- package/dist/react-native/webPubSubEventHandler.js.map +1 -0
- package/package.json +33 -17
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import type { MqttDisconnectReasonCode } from "./enum/MqttErrorCodes/mqttDisconnectReasonCode.js";
|
|
2
|
+
import type { MqttV311ConnectReturnCode } from "./enum/MqttErrorCodes/mqttV311ConnectReturnCode.js";
|
|
3
|
+
import type { MqttV500ConnectReasonCode } from "./enum/MqttErrorCodes/mqttV500ConnectReasonCode.js";
|
|
4
|
+
/**
|
|
5
|
+
* Response of the connect event.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConnectResponse {
|
|
8
|
+
/**
|
|
9
|
+
* Set the groups the connection would like to join.
|
|
10
|
+
*/
|
|
11
|
+
groups?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Set the roles the connection belongs to.
|
|
14
|
+
*/
|
|
15
|
+
roles?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Set the userId for the connection.
|
|
18
|
+
*/
|
|
19
|
+
userId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Set the subprotocol for the connection to complete WebSocket handshake.
|
|
22
|
+
*/
|
|
23
|
+
subprotocol?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Success respones of the connect event.
|
|
27
|
+
*/
|
|
28
|
+
export interface MqttConnectResponse extends ConnectResponse {
|
|
29
|
+
/**
|
|
30
|
+
* The MQTT specific properties in a successful MQTT connection event response.
|
|
31
|
+
*/
|
|
32
|
+
mqtt?: MqttConnectResponseProperties;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Response of a failed connect event.
|
|
36
|
+
*/
|
|
37
|
+
export interface ConnectErrorResponse {
|
|
38
|
+
/**
|
|
39
|
+
* The error code.
|
|
40
|
+
*/
|
|
41
|
+
code: 400 | 401 | 500;
|
|
42
|
+
/**
|
|
43
|
+
* The error detail.
|
|
44
|
+
*/
|
|
45
|
+
detail?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Response of an MQTT connection failure.
|
|
49
|
+
*/
|
|
50
|
+
export interface MqttConnectErrorResponse {
|
|
51
|
+
/**
|
|
52
|
+
* The properties of the MQTT connection failure response.
|
|
53
|
+
*/
|
|
54
|
+
mqtt: MqttConnectErrorResponseProperties;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The properties of an MQTT connection failure response.
|
|
58
|
+
*/
|
|
59
|
+
export interface MqttConnectErrorResponseProperties {
|
|
60
|
+
/**
|
|
61
|
+
* The MQTT connect return code.
|
|
62
|
+
*/
|
|
63
|
+
code: MqttV311ConnectReturnCode | MqttV500ConnectReasonCode;
|
|
64
|
+
/**
|
|
65
|
+
* The reason string for the connection failure.
|
|
66
|
+
*/
|
|
67
|
+
reason?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The user properties in the response.
|
|
70
|
+
*/
|
|
71
|
+
userProperties?: MqttUserProperty[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The protocol of Web PubSub Client.
|
|
75
|
+
*/
|
|
76
|
+
export type WebPubSubClientProtocol = "default" | "mqtt";
|
|
77
|
+
/**
|
|
78
|
+
* The connection context representing the client WebSocket connection.
|
|
79
|
+
*/
|
|
80
|
+
export interface ConnectionContext {
|
|
81
|
+
/**
|
|
82
|
+
* The unique identifier generated by the service of the network connection.
|
|
83
|
+
*/
|
|
84
|
+
signature: string;
|
|
85
|
+
/**
|
|
86
|
+
* The hub the connection belongs to.
|
|
87
|
+
*/
|
|
88
|
+
hub: string;
|
|
89
|
+
/**
|
|
90
|
+
* The Id of the connection.
|
|
91
|
+
*/
|
|
92
|
+
connectionId: string;
|
|
93
|
+
/**
|
|
94
|
+
* The event name of this CloudEvents request.
|
|
95
|
+
*/
|
|
96
|
+
eventName: string;
|
|
97
|
+
/**
|
|
98
|
+
* The origin this CloudEvents request comes from.
|
|
99
|
+
*/
|
|
100
|
+
origin: string;
|
|
101
|
+
/**
|
|
102
|
+
* The user id of the connection.
|
|
103
|
+
*/
|
|
104
|
+
userId?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The subprotocol of this connection.
|
|
107
|
+
*/
|
|
108
|
+
subprotocol?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Get the additional states for the connection, such states are perserved throughout the lifetime of the connection.
|
|
111
|
+
*/
|
|
112
|
+
states: Record<string, any>;
|
|
113
|
+
/**
|
|
114
|
+
* The type of client protocol.
|
|
115
|
+
*/
|
|
116
|
+
clientProtocol: WebPubSubClientProtocol;
|
|
117
|
+
/**
|
|
118
|
+
* The MQTT properties that the client WebSocket connection has when it connects (For MQTT connection only).
|
|
119
|
+
*/
|
|
120
|
+
mqtt?: MqttConnectionContextProperties;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The connection context properties representing the MQTT client WebSocket connection.
|
|
124
|
+
*/
|
|
125
|
+
export interface MqttConnectionContextProperties {
|
|
126
|
+
/**
|
|
127
|
+
* The unique identifier generated by the service of the network connection.
|
|
128
|
+
*/
|
|
129
|
+
physicalConnectionId: string;
|
|
130
|
+
/**
|
|
131
|
+
* The unique identifier generated by the service of the MQTT session.
|
|
132
|
+
*/
|
|
133
|
+
sessionId?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Request for the connect event.
|
|
137
|
+
*/
|
|
138
|
+
export interface ConnectRequest {
|
|
139
|
+
/**
|
|
140
|
+
* The context of current CloudEvents request.
|
|
141
|
+
*/
|
|
142
|
+
context: ConnectionContext;
|
|
143
|
+
/**
|
|
144
|
+
* The claims that the client WebSocket connection has when it connects.
|
|
145
|
+
*/
|
|
146
|
+
claims?: Record<string, string[]>;
|
|
147
|
+
/**
|
|
148
|
+
* The query that the client WebSocket connection has when it connects.
|
|
149
|
+
* @deprecated Please use queries instead.
|
|
150
|
+
*/
|
|
151
|
+
query?: Record<string, string[]>;
|
|
152
|
+
/**
|
|
153
|
+
* The queries that the client WebSocket connection has when it connects.
|
|
154
|
+
*/
|
|
155
|
+
queries?: Record<string, string[]>;
|
|
156
|
+
/**
|
|
157
|
+
* The headers that the client WebSocket connection has when it connects.
|
|
158
|
+
*/
|
|
159
|
+
headers?: Record<string, string[]>;
|
|
160
|
+
/**
|
|
161
|
+
* The subprotocols that the client WebSocket connection uses to do handshake.
|
|
162
|
+
*/
|
|
163
|
+
subprotocols?: string[];
|
|
164
|
+
/**
|
|
165
|
+
* The client certificate info that the client WebSocket connection uses to connect.
|
|
166
|
+
*/
|
|
167
|
+
clientCertificates?: Certificate[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Request for the MQTT connect event.
|
|
171
|
+
*/
|
|
172
|
+
export interface MqttConnectRequest extends ConnectRequest {
|
|
173
|
+
/**
|
|
174
|
+
* The MQTT specific properties in the MQTT connect event request.
|
|
175
|
+
*/
|
|
176
|
+
mqtt: MqttConnectProperties;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The properties of the MQTT CONNECT packet.
|
|
180
|
+
*/
|
|
181
|
+
export interface MqttConnectProperties {
|
|
182
|
+
/**
|
|
183
|
+
* MQTT protocol version.
|
|
184
|
+
*/
|
|
185
|
+
protocolVersion: number;
|
|
186
|
+
/**
|
|
187
|
+
* The username field in the MQTT CONNECT packet.
|
|
188
|
+
*/
|
|
189
|
+
username?: string;
|
|
190
|
+
/**
|
|
191
|
+
* The password field in the MQTT CONNECT packet.
|
|
192
|
+
*/
|
|
193
|
+
password?: string;
|
|
194
|
+
/**
|
|
195
|
+
* The user properties in the MQTT CONNECT packet.
|
|
196
|
+
*/
|
|
197
|
+
userProperties?: MqttUserProperty[];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The properties of a successful MQTT connection event response
|
|
201
|
+
*/
|
|
202
|
+
export interface MqttConnectResponseProperties {
|
|
203
|
+
/**
|
|
204
|
+
* Additional diagnostic or other information provided by upstream server
|
|
205
|
+
* Now only MQTT 5.0 supports user properties
|
|
206
|
+
*/
|
|
207
|
+
userProperties?: MqttUserProperty[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The properties of a user in MQTT.
|
|
211
|
+
*/
|
|
212
|
+
export interface MqttUserProperty {
|
|
213
|
+
/**
|
|
214
|
+
* The name of the property.
|
|
215
|
+
*/
|
|
216
|
+
name: string;
|
|
217
|
+
/**
|
|
218
|
+
* The value of the property.
|
|
219
|
+
*/
|
|
220
|
+
value: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The client certificate.
|
|
224
|
+
*/
|
|
225
|
+
export interface Certificate {
|
|
226
|
+
/**
|
|
227
|
+
* The thumbprint of the certificate.
|
|
228
|
+
*/
|
|
229
|
+
thumbprint: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Request for the connected event.
|
|
233
|
+
*/
|
|
234
|
+
export interface ConnectedRequest {
|
|
235
|
+
/**
|
|
236
|
+
* The context of current CloudEvents request.
|
|
237
|
+
*/
|
|
238
|
+
context: ConnectionContext;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Request for the user event.
|
|
242
|
+
*/
|
|
243
|
+
export type UserEventRequest = {
|
|
244
|
+
/**
|
|
245
|
+
* The context of current CloudEvents request.
|
|
246
|
+
*/
|
|
247
|
+
context: ConnectionContext;
|
|
248
|
+
/**
|
|
249
|
+
* The content data.
|
|
250
|
+
*/
|
|
251
|
+
data: string;
|
|
252
|
+
/**
|
|
253
|
+
* The type of the data.
|
|
254
|
+
*/
|
|
255
|
+
dataType: "text";
|
|
256
|
+
} | {
|
|
257
|
+
/**
|
|
258
|
+
* The context of current CloudEvents request.
|
|
259
|
+
*/
|
|
260
|
+
context: ConnectionContext;
|
|
261
|
+
/**
|
|
262
|
+
* The content data, when data type is `json`, the data is the result of JSON.parse, so the type of the data depends on user scenarios
|
|
263
|
+
*/
|
|
264
|
+
data: unknown;
|
|
265
|
+
/**
|
|
266
|
+
* The type of the data.
|
|
267
|
+
*/
|
|
268
|
+
dataType: "json";
|
|
269
|
+
} | {
|
|
270
|
+
/**
|
|
271
|
+
* The context of current CloudEvents request.
|
|
272
|
+
*/
|
|
273
|
+
context: ConnectionContext;
|
|
274
|
+
/**
|
|
275
|
+
* The content data.
|
|
276
|
+
*/
|
|
277
|
+
data: ArrayBuffer;
|
|
278
|
+
/**
|
|
279
|
+
* The type of the data.
|
|
280
|
+
*/
|
|
281
|
+
dataType: "binary";
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Request for the disconnected event.
|
|
285
|
+
*/
|
|
286
|
+
export interface DisconnectedRequest {
|
|
287
|
+
/**
|
|
288
|
+
* The context of current CloudEvents request.
|
|
289
|
+
*/
|
|
290
|
+
context: ConnectionContext;
|
|
291
|
+
/**
|
|
292
|
+
* The reason that the connection disconnects.
|
|
293
|
+
*/
|
|
294
|
+
reason?: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Request for the disconnected event.
|
|
298
|
+
*/
|
|
299
|
+
export interface MqttDisconnectedRequest extends DisconnectedRequest {
|
|
300
|
+
/**
|
|
301
|
+
* The MQTT specific properties in the MQTT disconnected event request.
|
|
302
|
+
*/
|
|
303
|
+
mqtt: MqttDisconnectedProperties;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* The properties of an MQTT disconnected event.
|
|
307
|
+
*/
|
|
308
|
+
export interface MqttDisconnectedProperties {
|
|
309
|
+
/**
|
|
310
|
+
* The MQTT disconnect packet.
|
|
311
|
+
*/
|
|
312
|
+
disconnectPacket: MqttDisconnectPacket;
|
|
313
|
+
/**
|
|
314
|
+
* Whether the disconnection is initiated by the client.
|
|
315
|
+
*/
|
|
316
|
+
initiatedByClient: boolean;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The properties of the MQTT DISCONNECT packet.
|
|
320
|
+
*/
|
|
321
|
+
export interface MqttDisconnectPacket {
|
|
322
|
+
/**
|
|
323
|
+
* The MQTT disconnect return code.
|
|
324
|
+
*/
|
|
325
|
+
code: MqttDisconnectReasonCode;
|
|
326
|
+
/**
|
|
327
|
+
* The user properties in the MQTT disconnect packet.
|
|
328
|
+
*/
|
|
329
|
+
userProperties?: MqttUserProperty[];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* The handler to set connect event response
|
|
333
|
+
*/
|
|
334
|
+
export interface ConnectResponseHandler {
|
|
335
|
+
/**
|
|
336
|
+
* Set the state of the connection
|
|
337
|
+
* @param name - The name of the state
|
|
338
|
+
* @param value - The value of the state
|
|
339
|
+
*/
|
|
340
|
+
setState(name: string, value: unknown): void;
|
|
341
|
+
/**
|
|
342
|
+
* Return success response to the service.
|
|
343
|
+
* @param response - The response for the connect event.
|
|
344
|
+
*/
|
|
345
|
+
success(response?: ConnectResponse | MqttConnectResponse): void;
|
|
346
|
+
/**
|
|
347
|
+
* Return failed response and the service will reject the client WebSocket connection.
|
|
348
|
+
* @param code - Code can be 400 user error, 401 unauthorized and 500 server error.
|
|
349
|
+
* @param detail - The detail of the error.
|
|
350
|
+
*/
|
|
351
|
+
fail(code: 400 | 401 | 500, detail?: string): void;
|
|
352
|
+
/**
|
|
353
|
+
* Return failed response with MQTT response properties and the service will reject the client WebSocket connection.
|
|
354
|
+
* @param response - The response for the connect event which contains either default WebPubSub or MQTT response properties.
|
|
355
|
+
*/
|
|
356
|
+
failWith(response: ConnectErrorResponse | MqttConnectErrorResponse): void;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The handler to set user event response
|
|
360
|
+
*/
|
|
361
|
+
export interface UserEventResponseHandler {
|
|
362
|
+
/**
|
|
363
|
+
* Set the state of the connection
|
|
364
|
+
* @param name - The name of the state
|
|
365
|
+
* @param value - The value of the state
|
|
366
|
+
*/
|
|
367
|
+
setState(name: string, value: unknown): void;
|
|
368
|
+
/**
|
|
369
|
+
* Return success response with data to be delivered to the client WebSocket connection.
|
|
370
|
+
* @param data - The payload data to be returned to the client. Stringify the message if it is a JSON object.
|
|
371
|
+
* @param dataType - The type of the payload data.
|
|
372
|
+
*/
|
|
373
|
+
success(data?: string | ArrayBuffer, dataType?: "binary" | "text" | "json"): void;
|
|
374
|
+
/**
|
|
375
|
+
* Return failed response and the service will close the client WebSocket connection.
|
|
376
|
+
* @param code - Code can be 400 user error, 401 unauthorized and 500 server error.
|
|
377
|
+
* @param detail - The detail of the error.
|
|
378
|
+
*/
|
|
379
|
+
fail(code: 400 | 401 | 500, detail?: string): void;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* The options for the CloudEvents handler.
|
|
383
|
+
*/
|
|
384
|
+
export interface WebPubSubEventHandlerOptions {
|
|
385
|
+
/**
|
|
386
|
+
* Custom serving path for the path of the CloudEvents handler.
|
|
387
|
+
*/
|
|
388
|
+
path?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Handle 'connect' event, the service waits for the response to proceed.
|
|
391
|
+
*/
|
|
392
|
+
handleConnect?: (connectRequest: ConnectRequest, connectResponse: ConnectResponseHandler) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Handle user events, the service waits for the response to proceed.
|
|
395
|
+
*/
|
|
396
|
+
handleUserEvent?: (userEventRequest: UserEventRequest, userEventResponse: UserEventResponseHandler) => void;
|
|
397
|
+
/**
|
|
398
|
+
* Event trigger for "connected" unblocking event. This is an unblocking event and the service does not wait for the response.
|
|
399
|
+
*/
|
|
400
|
+
onConnected?: (connectedRequest: ConnectedRequest) => void;
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
* Event triggers for "disconnected" unblocking event. This is an unblocking event and the service does not wait for the response.
|
|
404
|
+
*/
|
|
405
|
+
onDisconnected?: (disconnectedRequest: DisconnectedRequest) => void;
|
|
406
|
+
/**
|
|
407
|
+
* If not specified, by default allow all the endpoints, otherwise only allow specified endpoints
|
|
408
|
+
*/
|
|
409
|
+
allowedEndpoints?: string[];
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=cloudEventsProtocols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudEventsProtocols.d.ts","sourceRoot":"","sources":["../../src/cloudEventsProtocols.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,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IAE3D;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEpE;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudEventsProtocols.js","sourceRoot":"","sources":["../../src/cloudEventsProtocols.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { MqttDisconnectReasonCode } from \"./enum/MqttErrorCodes/mqttDisconnectReasonCode.js\";\nimport type { MqttV311ConnectReturnCode } from \"./enum/MqttErrorCodes/mqttV311ConnectReturnCode.js\";\nimport type { MqttV500ConnectReasonCode } from \"./enum/MqttErrorCodes/mqttV500ConnectReasonCode.js\";\n\n/**\n * Response of the connect event.\n */\nexport interface ConnectResponse {\n /**\n * Set the groups the connection would like to join.\n */\n groups?: string[];\n /**\n * Set the roles the connection belongs to.\n */\n roles?: string[];\n /**\n * Set the userId for the connection.\n */\n userId?: string;\n /**\n * Set the subprotocol for the connection to complete WebSocket handshake.\n */\n subprotocol?: string;\n}\n\n/**\n * Success respones of the connect event.\n */\nexport interface MqttConnectResponse extends ConnectResponse {\n /**\n * The MQTT specific properties in a successful MQTT connection event response.\n */\n mqtt?: MqttConnectResponseProperties;\n}\n\n/**\n * Response of a failed connect event.\n */\nexport interface ConnectErrorResponse {\n /**\n * The error code.\n */\n code: 400 | 401 | 500;\n /**\n * The error detail.\n */\n detail?: string;\n}\n\n/**\n * Response of an MQTT connection failure.\n */\nexport interface MqttConnectErrorResponse {\n /**\n * The properties of the MQTT connection failure response.\n */\n mqtt: MqttConnectErrorResponseProperties;\n}\n\n/**\n * The properties of an MQTT connection failure response.\n */\nexport interface MqttConnectErrorResponseProperties {\n /**\n * The MQTT connect return code.\n */\n code: MqttV311ConnectReturnCode | MqttV500ConnectReasonCode;\n /**\n * The reason string for the connection failure.\n */\n reason?: string;\n /**\n * The user properties in the response.\n */\n userProperties?: MqttUserProperty[];\n}\n\n/**\n * The protocol of Web PubSub Client.\n */\nexport type WebPubSubClientProtocol = \"default\" | \"mqtt\";\n\n/**\n * The connection context representing the client WebSocket connection.\n */\nexport interface ConnectionContext {\n /**\n * The unique identifier generated by the service of the network connection.\n */\n signature: string;\n /**\n * The hub the connection belongs to.\n */\n hub: string;\n /**\n * The Id of the connection.\n */\n connectionId: string;\n /**\n * The event name of this CloudEvents request.\n */\n eventName: string;\n /**\n * The origin this CloudEvents request comes from.\n */\n origin: string;\n /**\n * The user id of the connection.\n */\n userId?: string;\n /**\n * The subprotocol of this connection.\n */\n subprotocol?: string;\n /**\n * Get the additional states for the connection, such states are perserved throughout the lifetime of the connection.\n */\n states: Record<string, any>;\n /**\n * The type of client protocol.\n */\n clientProtocol: WebPubSubClientProtocol;\n /**\n * The MQTT properties that the client WebSocket connection has when it connects (For MQTT connection only).\n */\n mqtt?: MqttConnectionContextProperties;\n}\n\n/**\n * The connection context properties representing the MQTT client WebSocket connection.\n */\nexport interface MqttConnectionContextProperties {\n /**\n * The unique identifier generated by the service of the network connection.\n */\n physicalConnectionId: string;\n /**\n * The unique identifier generated by the service of the MQTT session.\n */\n sessionId?: string;\n}\n\n/**\n * Request for the connect event.\n */\nexport interface ConnectRequest {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n /**\n * The claims that the client WebSocket connection has when it connects.\n */\n claims?: Record<string, string[]>;\n /**\n * The query that the client WebSocket connection has when it connects.\n * @deprecated Please use queries instead.\n */\n query?: Record<string, string[]>;\n /**\n * The queries that the client WebSocket connection has when it connects.\n */\n queries?: Record<string, string[]>;\n /**\n * The headers that the client WebSocket connection has when it connects.\n */\n headers?: Record<string, string[]>;\n /**\n * The subprotocols that the client WebSocket connection uses to do handshake.\n */\n subprotocols?: string[];\n /**\n * The client certificate info that the client WebSocket connection uses to connect.\n */\n clientCertificates?: Certificate[];\n}\n\n/**\n * Request for the MQTT connect event.\n */\nexport interface MqttConnectRequest extends ConnectRequest {\n /**\n * The MQTT specific properties in the MQTT connect event request.\n */\n mqtt: MqttConnectProperties;\n}\n\n/**\n * The properties of the MQTT CONNECT packet.\n */\nexport interface MqttConnectProperties {\n /**\n * MQTT protocol version.\n */\n protocolVersion: number;\n /**\n * The username field in the MQTT CONNECT packet.\n */\n username?: string;\n /**\n * The password field in the MQTT CONNECT packet.\n */\n password?: string;\n /**\n * The user properties in the MQTT CONNECT packet.\n */\n userProperties?: MqttUserProperty[];\n}\n\n/**\n * The properties of a successful MQTT connection event response\n */\nexport interface MqttConnectResponseProperties {\n /**\n * Additional diagnostic or other information provided by upstream server\n * Now only MQTT 5.0 supports user properties\n */\n userProperties?: MqttUserProperty[];\n}\n\n/**\n * The properties of a user in MQTT.\n */\nexport interface MqttUserProperty {\n /**\n * The name of the property.\n */\n name: string;\n /**\n * The value of the property.\n */\n value: string;\n}\n\n/**\n * The client certificate.\n */\nexport interface Certificate {\n /**\n * The thumbprint of the certificate.\n */\n thumbprint: string;\n}\n\n/**\n * Request for the connected event.\n */\nexport interface ConnectedRequest {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n}\n\n/**\n * Request for the user event.\n */\nexport type UserEventRequest =\n | {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n\n /**\n * The content data.\n */\n data: string;\n /**\n * The type of the data.\n */\n dataType: \"text\";\n }\n | {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n\n /**\n * The content data, when data type is `json`, the data is the result of JSON.parse, so the type of the data depends on user scenarios\n */\n data: unknown;\n\n /**\n * The type of the data.\n */\n dataType: \"json\";\n }\n | {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n\n /**\n * The content data.\n */\n data: ArrayBuffer;\n /**\n * The type of the data.\n */\n dataType: \"binary\";\n };\n\n/**\n * Request for the disconnected event.\n */\nexport interface DisconnectedRequest {\n /**\n * The context of current CloudEvents request.\n */\n context: ConnectionContext;\n /**\n * The reason that the connection disconnects.\n */\n reason?: string;\n}\n\n/**\n * Request for the disconnected event.\n */\nexport interface MqttDisconnectedRequest extends DisconnectedRequest {\n /**\n * The MQTT specific properties in the MQTT disconnected event request.\n */\n mqtt: MqttDisconnectedProperties;\n}\n\n/**\n * The properties of an MQTT disconnected event.\n */\nexport interface MqttDisconnectedProperties {\n /**\n * The MQTT disconnect packet.\n */\n disconnectPacket: MqttDisconnectPacket;\n /**\n * Whether the disconnection is initiated by the client.\n */\n initiatedByClient: boolean;\n}\n\n/**\n * The properties of the MQTT DISCONNECT packet.\n */\nexport interface MqttDisconnectPacket {\n /**\n * The MQTT disconnect return code.\n */\n code: MqttDisconnectReasonCode;\n /**\n * The user properties in the MQTT disconnect packet.\n */\n userProperties?: MqttUserProperty[];\n}\n\n/**\n * The handler to set connect event response\n */\nexport interface ConnectResponseHandler {\n /**\n * Set the state of the connection\n * @param name - The name of the state\n * @param value - The value of the state\n */\n setState(name: string, value: unknown): void;\n /**\n * Return success response to the service.\n * @param response - The response for the connect event.\n */\n success(response?: ConnectResponse | MqttConnectResponse): void;\n /**\n * Return failed response and the service will reject the client WebSocket connection.\n * @param code - Code can be 400 user error, 401 unauthorized and 500 server error.\n * @param detail - The detail of the error.\n */\n fail(code: 400 | 401 | 500, detail?: string): void;\n /**\n * Return failed response with MQTT response properties and the service will reject the client WebSocket connection.\n * @param response - The response for the connect event which contains either default WebPubSub or MQTT response properties.\n */\n failWith(response: ConnectErrorResponse | MqttConnectErrorResponse): void;\n}\n\n/**\n * The handler to set user event response\n */\nexport interface UserEventResponseHandler {\n /**\n * Set the state of the connection\n * @param name - The name of the state\n * @param value - The value of the state\n */\n setState(name: string, value: unknown): void;\n /**\n * Return success response with data to be delivered to the client WebSocket connection.\n * @param data - The payload data to be returned to the client. Stringify the message if it is a JSON object.\n * @param dataType - The type of the payload data.\n */\n success(data?: string | ArrayBuffer, dataType?: \"binary\" | \"text\" | \"json\"): void;\n /**\n * Return failed response and the service will close the client WebSocket connection.\n * @param code - Code can be 400 user error, 401 unauthorized and 500 server error.\n * @param detail - The detail of the error.\n */\n fail(code: 400 | 401 | 500, detail?: string): void;\n}\n\n/**\n * The options for the CloudEvents handler.\n */\nexport interface WebPubSubEventHandlerOptions {\n /**\n * Custom serving path for the path of the CloudEvents handler.\n */\n path?: string;\n\n /**\n * Handle 'connect' event, the service waits for the response to proceed.\n */\n handleConnect?: (connectRequest: ConnectRequest, connectResponse: ConnectResponseHandler) => void;\n\n /**\n * Handle user events, the service waits for the response to proceed.\n */\n handleUserEvent?: (\n userEventRequest: UserEventRequest,\n userEventResponse: UserEventResponseHandler,\n ) => void;\n\n /**\n * Event trigger for \"connected\" unblocking event. This is an unblocking event and the service does not wait for the response.\n */\n onConnected?: (connectedRequest: ConnectedRequest) => void;\n\n /**\n *\n * Event triggers for \"disconnected\" unblocking event. This is an unblocking event and the service does not wait for the response.\n */\n onDisconnected?: (disconnectedRequest: DisconnectedRequest) => void;\n\n /**\n * If not specified, by default allow all the endpoints, otherwise only allow specified endpoints\n */\n allowedEndpoints?: string[];\n}\n"]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MQTT 5.0 Disconnect Reason Codes.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum MqttDisconnectReasonCode {
|
|
5
|
+
/**
|
|
6
|
+
* 0x00 - Normal disconnection
|
|
7
|
+
* Sent by: Client or Server
|
|
8
|
+
* Description: Close the connection normally. Do not send the Will Message.
|
|
9
|
+
*/
|
|
10
|
+
NormalDisconnection = 0,
|
|
11
|
+
/**
|
|
12
|
+
* 0x04 - Disconnect with Will Message
|
|
13
|
+
* Sent by: Client
|
|
14
|
+
* Description: The Client wishes to disconnect but requires that the Server also publishes its Will Message.
|
|
15
|
+
*/
|
|
16
|
+
DisconnectWithWillMessage = 4,
|
|
17
|
+
/**
|
|
18
|
+
* 0x80 - Unspecified error
|
|
19
|
+
* Sent by: Client or Server
|
|
20
|
+
* Description: The Connection is closed but the sender either does not wish to reveal the reason, or none of the other Reason Codes apply.
|
|
21
|
+
*/
|
|
22
|
+
UnspecifiedError = 128,
|
|
23
|
+
/**
|
|
24
|
+
* 0x81 - Malformed Packet
|
|
25
|
+
* Sent by: Client or Server
|
|
26
|
+
* Description: The received packet does not conform to this specification.
|
|
27
|
+
*/
|
|
28
|
+
MalformedPacket = 129,
|
|
29
|
+
/**
|
|
30
|
+
* 0x82 - Protocol Error
|
|
31
|
+
* Sent by: Client or Server
|
|
32
|
+
* Description: An unexpected or out of order packet was received.
|
|
33
|
+
*/
|
|
34
|
+
ProtocolError = 130,
|
|
35
|
+
/**
|
|
36
|
+
* 0x83 - Implementation specific error
|
|
37
|
+
* Sent by: Client or Server
|
|
38
|
+
* Description: The packet received is valid but cannot be processed by this implementation.
|
|
39
|
+
*/
|
|
40
|
+
ImplementationSpecificError = 131,
|
|
41
|
+
/**
|
|
42
|
+
* 0x87 - Not authorized
|
|
43
|
+
* Sent by: Server
|
|
44
|
+
* Description: The request is not authorized.
|
|
45
|
+
*/
|
|
46
|
+
NotAuthorized = 135,
|
|
47
|
+
/**
|
|
48
|
+
* 0x89 - Server busy
|
|
49
|
+
* Sent by: Server
|
|
50
|
+
* Description: The Server is busy and cannot continue processing requests from this Client.
|
|
51
|
+
*/
|
|
52
|
+
ServerBusy = 137,
|
|
53
|
+
/**
|
|
54
|
+
* 0x8B - Server shutting down
|
|
55
|
+
* Sent by: Server
|
|
56
|
+
* Description: The Server is shutting down.
|
|
57
|
+
*/
|
|
58
|
+
ServerShuttingDown = 139,
|
|
59
|
+
/**
|
|
60
|
+
* 0x8D - Keep Alive timeout
|
|
61
|
+
* Sent by: Server
|
|
62
|
+
* Description: The Connection is closed because no packet has been received for 1.5 times the Keepalive time.
|
|
63
|
+
*/
|
|
64
|
+
KeepAliveTimeout = 141,
|
|
65
|
+
/**
|
|
66
|
+
* 0x8E - Session taken over
|
|
67
|
+
* Sent by: Server
|
|
68
|
+
* Description: Another Connection using the same ClientID has connected causing this Connection to be closed.
|
|
69
|
+
*/
|
|
70
|
+
SessionTakenOver = 142,
|
|
71
|
+
/**
|
|
72
|
+
* 0x8F - Topic Filter invalid
|
|
73
|
+
* Sent by: Server
|
|
74
|
+
* Description: The Topic Filter is correctly formed, but is not accepted by this Server.
|
|
75
|
+
*/
|
|
76
|
+
TopicFilterInvalid = 143,
|
|
77
|
+
/**
|
|
78
|
+
* 0x90 - Topic Name invalid
|
|
79
|
+
* Sent by: Client or Server
|
|
80
|
+
* Description: The Topic Name is correctly formed, but is not accepted by this Client or Server.
|
|
81
|
+
*/
|
|
82
|
+
TopicNameInvalid = 144,
|
|
83
|
+
/**
|
|
84
|
+
* 0x93 - Receive Maximum exceeded
|
|
85
|
+
* Sent by: Client or Server
|
|
86
|
+
* Description: The Client or Server has received more than Receive Maximum publication for which it has not sent PUBACK or PUBCOMP.
|
|
87
|
+
*/
|
|
88
|
+
ReceiveMaximumExceeded = 147,
|
|
89
|
+
/**
|
|
90
|
+
* 0x94 - Topic Alias invalid
|
|
91
|
+
* Sent by: Client or Server
|
|
92
|
+
* Description: The Client or Server has received a PUBLISH packet containing a Topic Alias which is greater than the Maximum Topic Alias it sent in the CONNECT or CONNACK packet.
|
|
93
|
+
*/
|
|
94
|
+
TopicAliasInvalid = 148,
|
|
95
|
+
/**
|
|
96
|
+
* 0x95 - Packet too large
|
|
97
|
+
* Sent by: Client or Server
|
|
98
|
+
* Description: The packet size is greater than Maximum Packet Size for this Client or Server.
|
|
99
|
+
*/
|
|
100
|
+
PacketTooLarge = 149,
|
|
101
|
+
/**
|
|
102
|
+
* 0x96 - Message rate too high
|
|
103
|
+
* Sent by: Client or Server
|
|
104
|
+
* Description: The received data rate is too high.
|
|
105
|
+
*/
|
|
106
|
+
MessageRateTooHigh = 150,
|
|
107
|
+
/**
|
|
108
|
+
* 0x97 - Quota exceeded
|
|
109
|
+
* Sent by: Client or Server
|
|
110
|
+
* Description: An implementation or administrative imposed limit has been exceeded.
|
|
111
|
+
*/
|
|
112
|
+
QuotaExceeded = 151,
|
|
113
|
+
/**
|
|
114
|
+
* 0x98 - Administrative action
|
|
115
|
+
* Sent by: Client or Server
|
|
116
|
+
* Description: The Connection is closed due to an administrative action.
|
|
117
|
+
*/
|
|
118
|
+
AdministrativeAction = 152,
|
|
119
|
+
/**
|
|
120
|
+
* 0x99 - Payload format invalid
|
|
121
|
+
* Sent by: Client or Server
|
|
122
|
+
* Description: The payload format does not match the one specified by the Payload Format Indicator.
|
|
123
|
+
*/
|
|
124
|
+
PayloadFormatInvalid = 153,
|
|
125
|
+
/**
|
|
126
|
+
* 0x9A - Retain not supported
|
|
127
|
+
* Sent by: Server
|
|
128
|
+
* Description: The Server does not support retained messages.
|
|
129
|
+
*/
|
|
130
|
+
RetainNotSupported = 154,
|
|
131
|
+
/**
|
|
132
|
+
* 0x9B - QoS not supported
|
|
133
|
+
* Sent by: Server
|
|
134
|
+
* Description: The Client specified a QoS greater than the QoS specified in a Maximum QoS in the CONNACK.
|
|
135
|
+
*/
|
|
136
|
+
QosNotSupported = 155,
|
|
137
|
+
/**
|
|
138
|
+
* 0x9C - Use another server
|
|
139
|
+
* Sent by: Server
|
|
140
|
+
* Description: The Client should temporarily change its Server.
|
|
141
|
+
*/
|
|
142
|
+
UseAnotherServer = 156,
|
|
143
|
+
/**
|
|
144
|
+
* 0x9D - Server moved
|
|
145
|
+
* Sent by: Server
|
|
146
|
+
* Description: The Server is moved and the Client should permanently change its server location.
|
|
147
|
+
*/
|
|
148
|
+
ServerMoved = 157,
|
|
149
|
+
/**
|
|
150
|
+
* 0x9E - Shared Subscriptions not supported
|
|
151
|
+
* Sent by: Server
|
|
152
|
+
* Description: The Server does not support Shared Subscriptions.
|
|
153
|
+
*/
|
|
154
|
+
SharedSubscriptionsNotSupported = 158,
|
|
155
|
+
/**
|
|
156
|
+
* 0x9F - Connection rate exceeded
|
|
157
|
+
* Sent by: Server
|
|
158
|
+
* Description: This connection is closed because the connection rate is too high.
|
|
159
|
+
*/
|
|
160
|
+
ConnectionRateExceeded = 159,
|
|
161
|
+
/**
|
|
162
|
+
* 0xA0 - Maximum connect time
|
|
163
|
+
* Sent by: Server
|
|
164
|
+
* Description: The maximum connection time authorized for this connection has been exceeded.
|
|
165
|
+
*/
|
|
166
|
+
MaximumConnectTime = 160,
|
|
167
|
+
/**
|
|
168
|
+
* 0xA1 - Subscription Identifiers not supported
|
|
169
|
+
* Sent by: Server
|
|
170
|
+
* Description: The Server does not support Subscription Identifiers; the subscription is not accepted.
|
|
171
|
+
*/
|
|
172
|
+
SubscriptionIdentifiersNotSupported = 161,
|
|
173
|
+
/**
|
|
174
|
+
* 0xA2 - Wildcard Subscriptions not supported
|
|
175
|
+
* Sent by: Server
|
|
176
|
+
* Description: The Server does not support Wildcard Subscriptions; the subscription is not accepted.
|
|
177
|
+
*/
|
|
178
|
+
WildcardSubscriptionsNotSupported = 162
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=mqttDisconnectReasonCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mqttDisconnectReasonCode.d.ts","sourceRoot":"","sources":["../../../../src/enum/MqttErrorCodes/mqttDisconnectReasonCode.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,wBAAwB;IAClC;;;;OAIG;IACH,mBAAmB,IAAO;IAE1B;;;;OAIG;IACH,yBAAyB,IAAO;IAEhC;;;;OAIG;IACH,gBAAgB,MAAO;IAEvB;;;;OAIG;IACH,eAAe,MAAO;IAEtB;;;;OAIG;IACH,aAAa,MAAO;IAEpB;;;;OAIG;IACH,2BAA2B,MAAO;IAElC;;;;OAIG;IACH,aAAa,MAAO;IAEpB;;;;OAIG;IACH,UAAU,MAAO;IAEjB;;;;OAIG;IACH,kBAAkB,MAAO;IAEzB;;;;OAIG;IACH,gBAAgB,MAAO;IAEvB;;;;OAIG;IACH,gBAAgB,MAAO;IAEvB;;;;OAIG;IACH,kBAAkB,MAAO;IAEzB;;;;OAIG;IACH,gBAAgB,MAAO;IAEvB;;;;OAIG;IACH,sBAAsB,MAAO;IAE7B;;;;OAIG;IACH,iBAAiB,MAAO;IAExB;;;;OAIG;IACH,cAAc,MAAO;IAErB;;;;OAIG;IACH,kBAAkB,MAAO;IAEzB;;;;OAIG;IACH,aAAa,MAAO;IAEpB;;;;OAIG;IACH,oBAAoB,MAAO;IAE3B;;;;OAIG;IACH,oBAAoB,MAAO;IAE3B;;;;OAIG;IACH,kBAAkB,MAAO;IAEzB;;;;OAIG;IACH,eAAe,MAAO;IAEtB;;;;OAIG;IACH,gBAAgB,MAAO;IAEvB;;;;OAIG;IACH,WAAW,MAAO;IAElB;;;;OAIG;IACH,+BAA+B,MAAO;IAEtC;;;;OAIG;IACH,sBAAsB,MAAO;IAE7B;;;;OAIG;IACH,kBAAkB,MAAO;IAEzB;;;;OAIG;IACH,mCAAmC,MAAO;IAE1C;;;;OAIG;IACH,iCAAiC,MAAO;CACzC"}
|