@azure/web-pubsub 1.1.4-alpha.20241119.1 → 1.1.4-alpha.20241121.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/dist/commonjs/generated/generatedClient.d.ts +19 -0
  2. package/dist/commonjs/generated/generatedClient.d.ts.map +1 -0
  3. package/dist/commonjs/generated/generatedClient.js +76 -0
  4. package/dist/commonjs/generated/generatedClient.js.map +1 -0
  5. package/dist/commonjs/generated/generatedClientContext.d.ts +14 -0
  6. package/dist/commonjs/generated/generatedClientContext.d.ts.map +1 -0
  7. package/dist/commonjs/generated/generatedClientContext.js +46 -0
  8. package/dist/commonjs/generated/generatedClientContext.js.map +1 -0
  9. package/dist/commonjs/generated/index.d.ts +4 -0
  10. package/dist/commonjs/generated/index.d.ts.map +1 -0
  11. package/dist/commonjs/generated/index.js +16 -0
  12. package/dist/commonjs/generated/index.js.map +1 -0
  13. package/dist/commonjs/generated/models/index.d.ts +323 -0
  14. package/dist/commonjs/generated/models/index.d.ts.map +1 -0
  15. package/dist/commonjs/generated/models/index.js +27 -0
  16. package/dist/commonjs/generated/models/index.js.map +1 -0
  17. package/dist/commonjs/generated/models/mappers.d.ts +30 -0
  18. package/dist/commonjs/generated/models/mappers.d.ts.map +1 -0
  19. package/dist/commonjs/generated/models/mappers.js +463 -0
  20. package/dist/commonjs/generated/models/mappers.js.map +1 -0
  21. package/dist/commonjs/generated/models/parameters.d.ts +31 -0
  22. package/dist/commonjs/generated/models/parameters.d.ts.map +1 -0
  23. package/dist/commonjs/generated/models/parameters.js +335 -0
  24. package/dist/commonjs/generated/models/parameters.js.map +1 -0
  25. package/dist/commonjs/generated/operations/healthApi.d.ts +18 -0
  26. package/dist/commonjs/generated/operations/healthApi.d.ts.map +1 -0
  27. package/dist/commonjs/generated/operations/healthApi.js +43 -0
  28. package/dist/commonjs/generated/operations/healthApi.js.map +1 -0
  29. package/dist/commonjs/generated/operations/index.d.ts +3 -0
  30. package/dist/commonjs/generated/operations/index.d.ts.map +1 -0
  31. package/dist/commonjs/generated/operations/index.js +13 -0
  32. package/dist/commonjs/generated/operations/index.js.map +1 -0
  33. package/dist/commonjs/generated/operations/webPubSub.d.ts +249 -0
  34. package/dist/commonjs/generated/operations/webPubSub.d.ts.map +1 -0
  35. package/dist/commonjs/generated/operations/webPubSub.js +874 -0
  36. package/dist/commonjs/generated/operations/webPubSub.js.map +1 -0
  37. package/dist/commonjs/generated/operationsInterfaces/healthApi.d.ts +10 -0
  38. package/dist/commonjs/generated/operationsInterfaces/healthApi.d.ts.map +1 -0
  39. package/dist/commonjs/generated/operationsInterfaces/healthApi.js +10 -0
  40. package/dist/commonjs/generated/operationsInterfaces/healthApi.js.map +1 -0
  41. package/dist/commonjs/generated/operationsInterfaces/index.d.ts +3 -0
  42. package/dist/commonjs/generated/operationsInterfaces/index.d.ts.map +1 -0
  43. package/dist/commonjs/generated/operationsInterfaces/index.js +13 -0
  44. package/dist/commonjs/generated/operationsInterfaces/index.js.map +1 -0
  45. package/dist/commonjs/generated/operationsInterfaces/webPubSub.d.ts +224 -0
  46. package/dist/commonjs/generated/operationsInterfaces/webPubSub.d.ts.map +1 -0
  47. package/dist/commonjs/generated/operationsInterfaces/webPubSub.js +10 -0
  48. package/dist/commonjs/generated/operationsInterfaces/webPubSub.js.map +1 -0
  49. package/dist/commonjs/groupClient.d.ts +232 -0
  50. package/dist/commonjs/groupClient.d.ts.map +1 -0
  51. package/dist/commonjs/groupClient.js +101 -0
  52. package/dist/commonjs/groupClient.js.map +1 -0
  53. package/dist/commonjs/hubClient.d.ts +478 -0
  54. package/dist/commonjs/hubClient.d.ts.map +1 -0
  55. package/dist/commonjs/hubClient.js +372 -0
  56. package/dist/commonjs/hubClient.js.map +1 -0
  57. package/dist/commonjs/index.d.ts +5 -0
  58. package/dist/commonjs/index.d.ts.map +1 -0
  59. package/dist/commonjs/index.js +12 -0
  60. package/dist/commonjs/index.js.map +1 -0
  61. package/dist/commonjs/logger.d.ts +5 -0
  62. package/dist/commonjs/logger.d.ts.map +1 -0
  63. package/dist/commonjs/logger.js +11 -0
  64. package/dist/commonjs/logger.js.map +1 -0
  65. package/dist/commonjs/package.json +3 -0
  66. package/dist/commonjs/parseConnectionString.d.ts +8 -0
  67. package/dist/commonjs/parseConnectionString.d.ts.map +1 -0
  68. package/dist/commonjs/parseConnectionString.js +34 -0
  69. package/dist/commonjs/parseConnectionString.js.map +1 -0
  70. package/dist/commonjs/reverseProxyPolicy.d.ts +9 -0
  71. package/dist/commonjs/reverseProxyPolicy.d.ts.map +1 -0
  72. package/dist/commonjs/reverseProxyPolicy.js +25 -0
  73. package/dist/commonjs/reverseProxyPolicy.js.map +1 -0
  74. package/dist/commonjs/tracing.d.ts +3 -0
  75. package/dist/commonjs/tracing.d.ts.map +1 -0
  76. package/dist/commonjs/tracing.js +12 -0
  77. package/dist/commonjs/tracing.js.map +1 -0
  78. package/dist/commonjs/tsdoc-metadata.json +11 -0
  79. package/dist/commonjs/utils.d.ts +29 -0
  80. package/dist/commonjs/utils.d.ts.map +1 -0
  81. package/dist/commonjs/utils.js +73 -0
  82. package/dist/commonjs/utils.js.map +1 -0
  83. package/dist/commonjs/webPubSubCredentialPolicy.d.ts +13 -0
  84. package/dist/commonjs/webPubSubCredentialPolicy.d.ts.map +1 -0
  85. package/dist/commonjs/webPubSubCredentialPolicy.js +32 -0
  86. package/dist/commonjs/webPubSubCredentialPolicy.js.map +1 -0
  87. package/dist/esm/generated/generatedClient.d.ts +19 -0
  88. package/dist/esm/generated/generatedClient.d.ts.map +1 -0
  89. package/{dist-esm/src → dist/esm}/generated/generatedClient.js +1 -1
  90. package/dist/esm/generated/generatedClient.js.map +1 -0
  91. package/dist/esm/generated/generatedClientContext.d.ts +14 -0
  92. package/dist/esm/generated/generatedClientContext.d.ts.map +1 -0
  93. package/dist/esm/generated/generatedClientContext.js.map +1 -0
  94. package/dist/esm/generated/index.d.ts +4 -0
  95. package/dist/esm/generated/index.d.ts.map +1 -0
  96. package/{dist-esm/src → dist/esm}/generated/index.js +3 -3
  97. package/dist/esm/generated/index.js.map +1 -0
  98. package/dist/esm/generated/models/index.d.ts +323 -0
  99. package/dist/esm/generated/models/index.d.ts.map +1 -0
  100. package/dist/esm/generated/models/mappers.d.ts +30 -0
  101. package/dist/esm/generated/models/mappers.d.ts.map +1 -0
  102. package/dist/esm/generated/models/parameters.d.ts +31 -0
  103. package/dist/esm/generated/models/parameters.d.ts.map +1 -0
  104. package/{dist-esm/src → dist/esm}/generated/models/parameters.js +1 -1
  105. package/dist/esm/generated/models/parameters.js.map +1 -0
  106. package/dist/esm/generated/operations/healthApi.d.ts +18 -0
  107. package/dist/esm/generated/operations/healthApi.d.ts.map +1 -0
  108. package/{dist-esm/src → dist/esm}/generated/operations/healthApi.js +2 -2
  109. package/dist/esm/generated/operations/healthApi.js.map +1 -0
  110. package/dist/esm/generated/operations/index.d.ts +3 -0
  111. package/dist/esm/generated/operations/index.d.ts.map +1 -0
  112. package/{dist-esm/src/generated/operationsInterfaces → dist/esm/generated/operations}/index.js +2 -2
  113. package/dist/esm/generated/operations/index.js.map +1 -0
  114. package/dist/esm/generated/operations/webPubSub.d.ts +249 -0
  115. package/dist/esm/generated/operations/webPubSub.d.ts.map +1 -0
  116. package/{dist-esm/src → dist/esm}/generated/operations/webPubSub.js +2 -2
  117. package/dist/esm/generated/operations/webPubSub.js.map +1 -0
  118. package/dist/esm/generated/operationsInterfaces/healthApi.d.ts +10 -0
  119. package/dist/esm/generated/operationsInterfaces/healthApi.d.ts.map +1 -0
  120. package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/healthApi.js.map +1 -1
  121. package/dist/esm/generated/operationsInterfaces/index.d.ts +3 -0
  122. package/dist/esm/generated/operationsInterfaces/index.d.ts.map +1 -0
  123. package/{dist-esm/src/generated/operations → dist/esm/generated/operationsInterfaces}/index.js +2 -2
  124. package/dist/esm/generated/operationsInterfaces/index.js.map +1 -0
  125. package/dist/esm/generated/operationsInterfaces/webPubSub.d.ts +224 -0
  126. package/dist/esm/generated/operationsInterfaces/webPubSub.d.ts.map +1 -0
  127. package/dist/esm/generated/operationsInterfaces/webPubSub.js.map +1 -0
  128. package/dist/esm/groupClient.d.ts +232 -0
  129. package/dist/esm/groupClient.d.ts.map +1 -0
  130. package/{dist-esm/src → dist/esm}/groupClient.js +2 -2
  131. package/dist/esm/groupClient.js.map +1 -0
  132. package/dist/esm/hubClient.d.ts +478 -0
  133. package/dist/esm/hubClient.d.ts.map +1 -0
  134. package/{dist-esm/src → dist/esm}/hubClient.js +9 -9
  135. package/dist/esm/hubClient.js.map +1 -0
  136. package/dist/esm/index.d.ts +5 -0
  137. package/dist/esm/index.d.ts.map +1 -0
  138. package/{dist-esm/src → dist/esm}/index.js +2 -2
  139. package/dist/esm/index.js.map +1 -0
  140. package/dist/esm/logger.d.ts +5 -0
  141. package/dist/esm/logger.d.ts.map +1 -0
  142. package/dist/esm/package.json +3 -0
  143. package/dist/esm/parseConnectionString.d.ts +8 -0
  144. package/dist/esm/parseConnectionString.d.ts.map +1 -0
  145. package/dist/esm/reverseProxyPolicy.d.ts +9 -0
  146. package/dist/esm/reverseProxyPolicy.d.ts.map +1 -0
  147. package/dist/esm/tracing.d.ts +3 -0
  148. package/dist/esm/tracing.d.ts.map +1 -0
  149. package/dist/esm/utils.d.ts +29 -0
  150. package/dist/esm/utils.d.ts.map +1 -0
  151. package/dist/esm/webPubSubCredentialPolicy.d.ts +13 -0
  152. package/dist/esm/webPubSubCredentialPolicy.d.ts.map +1 -0
  153. package/package.json +56 -52
  154. package/dist/index.js +0 -2441
  155. package/dist/index.js.map +0 -1
  156. package/dist-esm/samples-dev/broadcasting.js +0 -27
  157. package/dist-esm/samples-dev/broadcasting.js.map +0 -1
  158. package/dist-esm/samples-dev/directMessage.js +0 -20
  159. package/dist-esm/samples-dev/directMessage.js.map +0 -1
  160. package/dist-esm/samples-dev/managingGroups.js +0 -23
  161. package/dist-esm/samples-dev/managingGroups.js.map +0 -1
  162. package/dist-esm/src/generated/generatedClient.js.map +0 -1
  163. package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
  164. package/dist-esm/src/generated/index.js.map +0 -1
  165. package/dist-esm/src/generated/models/parameters.js.map +0 -1
  166. package/dist-esm/src/generated/operations/healthApi.js.map +0 -1
  167. package/dist-esm/src/generated/operations/index.js.map +0 -1
  168. package/dist-esm/src/generated/operations/webPubSub.js.map +0 -1
  169. package/dist-esm/src/generated/operationsInterfaces/index.js.map +0 -1
  170. package/dist-esm/src/generated/operationsInterfaces/webPubSub.js.map +0 -1
  171. package/dist-esm/src/groupClient.js.map +0 -1
  172. package/dist-esm/src/hubClient.js.map +0 -1
  173. package/dist-esm/src/index.js.map +0 -1
  174. package/dist-esm/test/conn.spec.js +0 -23
  175. package/dist-esm/test/conn.spec.js.map +0 -1
  176. package/dist-esm/test/groups.spec.js +0 -138
  177. package/dist-esm/test/groups.spec.js.map +0 -1
  178. package/dist-esm/test/hubs.spec.js +0 -270
  179. package/dist-esm/test/hubs.spec.js.map +0 -1
  180. package/dist-esm/test/integration.spec.js +0 -299
  181. package/dist-esm/test/integration.spec.js.map +0 -1
  182. package/dist-esm/test/odata.spec.js +0 -15
  183. package/dist-esm/test/odata.spec.js.map +0 -1
  184. package/dist-esm/test/testEnv.js +0 -23
  185. package/dist-esm/test/testEnv.js.map +0 -1
  186. /package/{dist-esm/src → dist/esm}/generated/generatedClientContext.js +0 -0
  187. /package/{dist-esm/src → dist/esm}/generated/models/index.js +0 -0
  188. /package/{dist-esm/src → dist/esm}/generated/models/index.js.map +0 -0
  189. /package/{dist-esm/src → dist/esm}/generated/models/mappers.js +0 -0
  190. /package/{dist-esm/src → dist/esm}/generated/models/mappers.js.map +0 -0
  191. /package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/healthApi.js +0 -0
  192. /package/{dist-esm/src → dist/esm}/generated/operationsInterfaces/webPubSub.js +0 -0
  193. /package/{dist-esm/src → dist/esm}/logger.js +0 -0
  194. /package/{dist-esm/src → dist/esm}/logger.js.map +0 -0
  195. /package/{dist-esm/src → dist/esm}/parseConnectionString.js +0 -0
  196. /package/{dist-esm/src → dist/esm}/parseConnectionString.js.map +0 -0
  197. /package/{dist-esm/src → dist/esm}/reverseProxyPolicy.js +0 -0
  198. /package/{dist-esm/src → dist/esm}/reverseProxyPolicy.js.map +0 -0
  199. /package/{dist-esm/src → dist/esm}/tracing.js +0 -0
  200. /package/{dist-esm/src → dist/esm}/tracing.js.map +0 -0
  201. /package/{dist-esm/src → dist/esm}/utils.js +0 -0
  202. /package/{dist-esm/src → dist/esm}/utils.js.map +0 -0
  203. /package/{dist-esm/src → dist/esm}/webPubSubCredentialPolicy.js +0 -0
  204. /package/{dist-esm/src → dist/esm}/webPubSubCredentialPolicy.js.map +0 -0
  205. /package/{types → dist}/web-pubsub.d.ts +0 -0
@@ -0,0 +1,478 @@
1
+ import type { CommonClientOptions, OperationOptions } from "@azure/core-client";
2
+ import type { RequestBodyType } from "@azure/core-rest-pipeline";
3
+ import type { WebPubSubGroup, GroupAddConnectionOptions, GroupRemoveConnectionOptions } from "./groupClient.js";
4
+ import type { AzureKeyCredential, TokenCredential } from "@azure/core-auth";
5
+ /**
6
+ * Options for closing a connection to a hub.
7
+ */
8
+ export interface HubCloseConnectionOptions extends OperationOptions {
9
+ /**
10
+ * Reason the connection is being closed.
11
+ */
12
+ reason?: string;
13
+ }
14
+ /**
15
+ * Options for closing all connections to a hub.
16
+ */
17
+ export interface HubCloseAllConnectionsOptions extends OperationOptions {
18
+ /**
19
+ * Reason the connection is being closed.
20
+ */
21
+ reason?: string;
22
+ }
23
+ /**
24
+ * Options for closing all of a user's connections to a hub.
25
+ */
26
+ export interface HubCloseUserConnectionsOptions extends OperationOptions {
27
+ /**
28
+ * Reason the connection is being closed.
29
+ */
30
+ reason?: string;
31
+ }
32
+ /**
33
+ * Options for sending messages to hubs.
34
+ */
35
+ export interface HubSendToAllOptions extends OperationOptions {
36
+ /**
37
+ * Connection ids to exclude from receiving this message.
38
+ */
39
+ excludedConnections?: string[];
40
+ /**
41
+ * The filter syntax to filter out the connections to send the messages to following OData filter syntax.
42
+ * Examples:
43
+ * * Exclude connections from `user1` and `user2`: `userId ne 'user1' and userId ne 'user2'`
44
+ * * Exclude connections in `group1`: `not('group1' in groups)`
45
+ * Details about `filter` syntax please see [OData filter syntax for Azure Web PubSub](https://aka.ms/awps/filter-syntax).
46
+ */
47
+ filter?: string;
48
+ /**
49
+ * The time-to-live (TTL) value in seconds for messages sent to the service.
50
+ * 0 is the default value, which means the message never expires.
51
+ * 300 is the maximum value.
52
+ * If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service.
53
+ * This parameter can help when the client's bandwidth is limited.
54
+ */
55
+ messageTtlSeconds?: number;
56
+ }
57
+ /**
58
+ * Options for sending text messages to hubs.
59
+ */
60
+ export interface HubSendTextToAllOptions extends HubSendToAllOptions {
61
+ /**
62
+ * The content will be sent to the clients in plain text.
63
+ */
64
+ contentType: "text/plain";
65
+ }
66
+ /**
67
+ * Types which can be serialized and sent as JSON.
68
+ */
69
+ export type JSONTypes = string | number | boolean | object;
70
+ /**
71
+ * Options for constructing a HubAdmin client.
72
+ */
73
+ export interface WebPubSubServiceClientOptions extends CommonClientOptions {
74
+ /**
75
+ * Reverse proxy endpoint (for example, your Azure API management endpoint)
76
+ */
77
+ reverseProxyEndpoint?: string;
78
+ /**
79
+ * Options to configure the logging options.
80
+ */
81
+ loggingOptions?: WebPubSubServiceClientLogOptions;
82
+ }
83
+ /**
84
+ * Options to configure the logging options.
85
+ */
86
+ export declare interface WebPubSubServiceClientLogOptions {
87
+ /**
88
+ * Header names whose values will be logged when logging is enabled.
89
+ * Defaults include a list of well-known safe headers. Any headers
90
+ * specified in this field will be added to that list. Any other values will
91
+ * be written to logs as "REDACTED".
92
+ */
93
+ additionalAllowedHeaderNames?: string[];
94
+ /**
95
+ * Query string names whose values will be logged when logging is enabled. By default no
96
+ * query string values are logged.
97
+ */
98
+ additionalAllowedQueryParameters?: string[];
99
+ }
100
+ /**
101
+ * Options for checking if a connection exists.
102
+ */
103
+ export interface HasConnectionOptions extends OperationOptions {
104
+ }
105
+ /**
106
+ * Options for checking if a group exists.
107
+ */
108
+ export interface HubHasGroupOptions extends OperationOptions {
109
+ }
110
+ /**
111
+ * Options for checking if a user exists.
112
+ */
113
+ export interface HubHasUserOptions extends OperationOptions {
114
+ }
115
+ /**
116
+ * Options for removing a user from all groups.
117
+ */
118
+ export interface HubRemoveUserFromAllGroupsOptions extends HubCloseConnectionOptions {
119
+ }
120
+ /**
121
+ * Options for sending a message to a specific connection.
122
+ */
123
+ export interface HubSendToConnectionOptions extends OperationOptions {
124
+ /**
125
+ * The time-to-live (TTL) value in seconds for messages sent to the service.
126
+ * 0 is the default value, which means the message never expires.
127
+ * 300 is the maximum value.
128
+ * If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service.
129
+ * This parameter can help when the client's bandwidth is limited.
130
+ */
131
+ messageTtlSeconds?: number;
132
+ }
133
+ /**
134
+ * Options for sending a text message to a connection.
135
+ */
136
+ export interface HubSendTextToConnectionOptions extends HubSendToConnectionOptions {
137
+ contentType: "text/plain";
138
+ }
139
+ /**
140
+ * Options for sending a message to a user.
141
+ */
142
+ export interface HubSendToUserOptions extends OperationOptions {
143
+ /**
144
+ * The filter syntax to filter out the connections to send the messages to following OData filter syntax.
145
+ * Examples:
146
+ * * Exclude connections in `group1`: `not('group1' in groups)`
147
+ * * Send to connections in `group1` or `group2`: `'group1' in groups or `group2` in groups`
148
+ * Details about `filter` syntax please see [OData filter syntax for Azure Web PubSub](https://aka.ms/awps/filter-syntax).
149
+ */
150
+ filter?: string;
151
+ /**
152
+ * The time-to-live (TTL) value in seconds for messages sent to the service.
153
+ * 0 is the default value, which means the message never expires.
154
+ * 300 is the maximum value.
155
+ * If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service.
156
+ * This parameter can help when the client's bandwidth is limited.
157
+ */
158
+ messageTtlSeconds?: number;
159
+ }
160
+ /**
161
+ * Options for sending a text message to a user.
162
+ */
163
+ export interface HubSendTextToUserOptions extends HubSendToUserOptions {
164
+ /**
165
+ * The content will be sent to the clients in plain text.
166
+ */
167
+ contentType: "text/plain";
168
+ }
169
+ export type Permission = "joinLeaveGroup" | "sendToGroup";
170
+ /**
171
+ * Options for grant permissions to a connection
172
+ */
173
+ export interface HubGrantPermissionOptions extends OperationOptions {
174
+ /**
175
+ * The meaning of the target depends on the specific permission.
176
+ * For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
177
+ */
178
+ targetName?: string;
179
+ }
180
+ /**
181
+ * Options for revoke permissions from a connection
182
+ */
183
+ export interface HubRevokePermissionOptions extends OperationOptions {
184
+ /**
185
+ * The meaning of the target depends on the specific permission.
186
+ * For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
187
+ */
188
+ targetName?: string;
189
+ }
190
+ /**
191
+ * Options for checking if a connection has the specified permission
192
+ */
193
+ export interface HubHasPermissionOptions extends OperationOptions {
194
+ /**
195
+ * The meaning of the target depends on the specific permission.
196
+ * For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
197
+ */
198
+ targetName?: string;
199
+ }
200
+ /**
201
+ * The type of client endpoint that is being requested.
202
+ */
203
+ export type WebPubSubClientProtocol = "default" | "mqtt" | "socketio";
204
+ /**
205
+ * Options for generating a token to connect a client to the Azure Web Pubsub service.
206
+ */
207
+ export interface GenerateClientTokenOptions extends OperationOptions {
208
+ /**
209
+ * The userId for the client.
210
+ */
211
+ userId?: string;
212
+ /**
213
+ * The roles that the connection with the generated token will have.
214
+ * Roles give the client initial permissions to leave, join, or publish to groups when using PubSub subprotocol
215
+ * * `webpubsub.joinLeaveGroup`: the client can join or leave any group
216
+ * * `webpubsub.sendToGroup`: the client can send messages to any group
217
+ * * `webpubsub.joinLeaveGroup.<group>`: the client can join or leave group `<group>`
218
+ * * `webpubsub.sendToGroup.<group>`: the client can send messages to group `<group>`
219
+ *
220
+ * {@link https://azure.github.io/azure-webpubsub/references/pubsub-websocket-subprotocol#permissions}
221
+ */
222
+ roles?: string[];
223
+ /**
224
+ * Minutes until the token expires.
225
+ */
226
+ expirationTimeInMinutes?: number;
227
+ /**
228
+ * The groups to join when the client connects
229
+ */
230
+ groups?: string[];
231
+ /**
232
+ * The protocol type of the client
233
+ * * `default`: Default WebPubSub Client. Example Client Connection URL: _wss://exampleHost.com/client/hubs/exampleHub_
234
+ * * `mqtt`: MQTT Client. Example Client Connection URL: _wss://exampleHost.com/client/mqtt/hubs/exampleHub_
235
+ */
236
+ clientProtocol?: WebPubSubClientProtocol;
237
+ }
238
+ /**
239
+ * A response containing the client token.
240
+ */
241
+ export interface ClientTokenResponse {
242
+ /**
243
+ * The client token.
244
+ */
245
+ token: string;
246
+ /**
247
+ * The URL client connects to
248
+ */
249
+ baseUrl: string;
250
+ /**
251
+ * The URL client connects to with access_token query string
252
+ */
253
+ url: string;
254
+ }
255
+ /**
256
+ * Client for connecting to a Web PubSub hub
257
+ */
258
+ export declare class WebPubSubServiceClient {
259
+ private readonly client;
260
+ private credential;
261
+ private readonly clientOptions?;
262
+ /**
263
+ * The name of the hub this client is connected to
264
+ */
265
+ readonly hubName: string;
266
+ /**
267
+ * The Web PubSub API version being used by this client
268
+ */
269
+ readonly apiVersion: string;
270
+ /**
271
+ * The Web PubSub endpoint this client is connected to
272
+ */
273
+ endpoint: string;
274
+ /**
275
+ * Creates an instance of a WebPubSubServiceClient for sending messages and managing groups, connections, and users.
276
+ *
277
+ * Example usage:
278
+ * ```ts
279
+ * import { WebPubSubServiceClient } from "@azure/web-pubsub";
280
+ * const connectionString = process.env['WEB_PUBSUB_CONNECTION_STRING'];
281
+ * const client = new WebPubSubServiceClient(connectionString, 'chat');
282
+ * ```
283
+ *
284
+ * @param connectionString - The connection string
285
+ * @param hubName - The name of the hub to connect to. If omitted, '_default' is used.
286
+ * @param options - Options to configure the http pipeline
287
+ */
288
+ constructor(connectionString: string, hubName: string, options?: WebPubSubServiceClientOptions);
289
+ /**
290
+ * Creates an instance of a WebPubSubServiceClient for sending messages and managing groups, connections, and users.
291
+ *
292
+ * Example usage:
293
+ * ```ts
294
+ * import { WebPubSubServiceClient, AzureKeyCredential } from "@azure/web-pubsub";
295
+ * const cred = new AzureKeyCredential("<your web pubsub api key>");
296
+ * const endpoint = "https://xxxx.webpubsubdev.azure.com"
297
+ * const client = new WebPubSubServiceClient(endpoint, cred, 'chat');
298
+ * ```
299
+ *
300
+ * @param endpoint - The endpoint to connect to
301
+ * @param credential - An AzureKeyCredential holding your service key
302
+ * @param hubName - The name of the hub to connect to.
303
+ * @param options - Options to configure the http pipeline
304
+ */
305
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, hubName: string, options?: WebPubSubServiceClientOptions);
306
+ /**
307
+ * Get a client for a group
308
+ * @param groupName - The name of the group to connect to.
309
+ */
310
+ group(groupName: string): WebPubSubGroup;
311
+ /**
312
+ * Broadcast a text message to all connections on this hub.
313
+ *
314
+ * @param message - The text message to send
315
+ * @param options - Additional options
316
+ */
317
+ sendToAll(message: string, options: HubSendTextToAllOptions): Promise<void>;
318
+ /**
319
+ * Broadcast a JSON message to all connections on this hub.
320
+ *
321
+ * @param message - The JSON message to send
322
+ * @param options - Additional options
323
+ */
324
+ sendToAll(message: JSONTypes, options?: HubSendToAllOptions): Promise<void>;
325
+ /**
326
+ * Broadcast a binary message to all connections on this hub.
327
+ *
328
+ * @param message - The message to send
329
+ * @param options - Additional options
330
+ */
331
+ sendToAll(message: RequestBodyType, options?: HubSendToAllOptions): Promise<void>;
332
+ /**
333
+ * Send a text message to a specific user
334
+ *
335
+ * @param username - User name to send to
336
+ * @param message - The text message to send
337
+ * @param options - Additional options
338
+ */
339
+ sendToUser(username: string, message: string, options: HubSendTextToUserOptions): Promise<void>;
340
+ /**
341
+ * Send a JSON message to a specific user
342
+ *
343
+ * @param username - User name to send to
344
+ * @param message - The josn message to send
345
+ * @param options - Additional options
346
+ */
347
+ sendToUser(username: string, message: JSONTypes, options?: HubSendToUserOptions): Promise<void>;
348
+ /**
349
+ * Send a binary message to a specific user
350
+ *
351
+ * @param username - The user name to send to
352
+ * @param message - The binary message to send
353
+ * @param options - Additional options
354
+ */
355
+ sendToUser(username: string, message: RequestBodyType, options?: HubSendToUserOptions | HubSendTextToUserOptions): Promise<void>;
356
+ /**
357
+ * Send a text message to a specific connection
358
+ *
359
+ * @param connectionId - Connection id to send to
360
+ * @param message - The text message
361
+ * @param options - Additional options
362
+ */
363
+ sendToConnection(connectionId: string, message: string, options: HubSendTextToConnectionOptions): Promise<void>;
364
+ /**
365
+ * Send a binary message to a specific connection
366
+ *
367
+ * @param connectionId - Connection id to send to
368
+ * @param message - The JSON message
369
+ * @param options - Additional options
370
+ */
371
+ sendToConnection(connectionId: string, message: JSONTypes, options?: HubSendToConnectionOptions): Promise<void>;
372
+ /**
373
+ * Send a binary message to a specific connection
374
+ *
375
+ * @param connectionId - Connection id to send to
376
+ * @param message - The binary message
377
+ * @param options - Additional options
378
+ */
379
+ sendToConnection(connectionId: string, message: RequestBodyType, options?: HubSendToConnectionOptions | HubSendTextToConnectionOptions): Promise<void>;
380
+ /**
381
+ * Check if a specific connection is connected to this hub
382
+ *
383
+ * @param connectionId - Connection id to check
384
+ * @param options - Additional options
385
+ */
386
+ connectionExists(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
387
+ /**
388
+ * Close a specific connection to this hub
389
+ *
390
+ * @param connectionId - Connection id to close
391
+ * @param options - Additional options
392
+ */
393
+ closeConnection(connectionId: string, options?: HubCloseConnectionOptions): Promise<void>;
394
+ /**
395
+ * Close all connections to this hub
396
+ *
397
+ * @param options - Additional options
398
+ */
399
+ closeAllConnections(options?: HubCloseAllConnectionsOptions): Promise<void>;
400
+ /**
401
+ * Close all connections with the given user id
402
+ *
403
+ * @param user - User id to close
404
+ * @param options - Additional options
405
+ */
406
+ closeUserConnections(userId: string, options?: HubCloseUserConnectionsOptions): Promise<void>;
407
+ /**
408
+ * Remove a specific user from all groups they are joined to
409
+ * @param userId - The user id to remove from all groups
410
+ * @param options - Additional options
411
+ */
412
+ removeUserFromAllGroups(userId: string, options?: HubCloseConnectionOptions): Promise<void>;
413
+ /**
414
+ * Remove a specific connection from all groups they are joined to
415
+ * @param connectionId - The connection id to remove from all groups
416
+ * @param options - Additional options
417
+ */
418
+ removeConnectionFromAllGroups(connectionId: string, options?: HubCloseConnectionOptions): Promise<void>;
419
+ /**
420
+ * Add filtered connections to multiple groups
421
+ * @param groups - A list of groups which target connections will be added into
422
+ * @param filter - An OData filter which target connections satisfy
423
+ * @param options - Additional options
424
+ */
425
+ addConnectionsToGroups(groups: string[], filter: string, options?: GroupAddConnectionOptions): Promise<void>;
426
+ /**
427
+ * Remove filtered connections from multiple groups
428
+ * @param groups - A list of groups which target connections will be removed from
429
+ * @param filter - An OData filter which target connections satisfy
430
+ * @param options - Additional options
431
+ */
432
+ removeConnectionsFromGroups(groups: string[], filter: string, options?: GroupRemoveConnectionOptions): Promise<void>;
433
+ /**
434
+ * Check if a particular group exists (i.e. has active connections).
435
+ *
436
+ * @param groupName - The group name to check for
437
+ * @param options - Additional options
438
+ */
439
+ groupExists(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
440
+ /**
441
+ * Check if a particular user is connected to this hub.
442
+ *
443
+ * @param username - The user name to check for
444
+ * @param options - Additional options
445
+ */
446
+ userExists(username: string, options?: HubHasUserOptions): Promise<boolean>;
447
+ /**
448
+ * Grant permissions to a connection
449
+ *
450
+ * @param connectionId - The connection id to grant permissions to
451
+ * @param Permission - The permission to grant
452
+ * @param options - Additional options
453
+ */
454
+ grantPermission(connectionId: string, permission: Permission, options?: HubGrantPermissionOptions): Promise<void>;
455
+ /**
456
+ * Revoke permissions from a connection
457
+ *
458
+ * @param connectionId - The connection id to revoke permissions from
459
+ * @param Permission - The permission to revoke
460
+ * @param options - Additional options
461
+ */
462
+ revokePermission(connectionId: string, permission: Permission, options?: HubRevokePermissionOptions): Promise<void>;
463
+ /**
464
+ * Check if the connection has the specified permission
465
+ *
466
+ * @param connectionId - The connection id to check permission
467
+ * @param Permission - The permission to check
468
+ * @param options - Additional options
469
+ */
470
+ hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<boolean>;
471
+ /**
472
+ * Generate a token for a client to connect to the Azure Web PubSub service.
473
+ *
474
+ * @param options - Additional options
475
+ */
476
+ getClientAccessToken(options?: GenerateClientTokenOptions): Promise<ClientTokenResponse>;
477
+ }
478
+ //# sourceMappingURL=hubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubClient.d.ts","sourceRoot":"","sources":["../../src/hubClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EAEnB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,KAAK,EACV,cAAc,EACd,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAe5E;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,gBAAgB;IACrE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,gBAAgB;IACtE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;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