@azure/web-pubsub 1.0.0-beta.3 → 1.0.1-alpha.20220103.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +107 -33
  3. package/dist/index.js +1048 -233
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/samples-dev/directMessage.js +1 -1
  6. package/dist-esm/samples-dev/directMessage.js.map +1 -1
  7. package/dist-esm/src/generated/generatedClient.js +3 -3
  8. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  9. package/dist-esm/src/generated/generatedClientContext.js +8 -8
  10. package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
  11. package/dist-esm/src/generated/models/index.js +6 -1
  12. package/dist-esm/src/generated/models/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/mappers.js +368 -0
  14. package/dist-esm/src/generated/models/mappers.js.map +1 -0
  15. package/dist-esm/src/generated/models/parameters.js +105 -23
  16. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  17. package/dist-esm/src/generated/operations/healthApi.js +4 -3
  18. package/dist-esm/src/generated/operations/healthApi.js.map +1 -1
  19. package/dist-esm/src/generated/operations/webPubSub.js +315 -59
  20. package/dist-esm/src/generated/operations/webPubSub.js.map +1 -1
  21. package/dist-esm/src/generated/operationsInterfaces/webPubSub.js.map +1 -1
  22. package/dist-esm/src/groupClient.js +32 -21
  23. package/dist-esm/src/groupClient.js.map +1 -1
  24. package/dist-esm/src/hubClient.js +162 -107
  25. package/dist-esm/src/hubClient.js.map +1 -1
  26. package/dist-esm/src/index.js +1 -1
  27. package/dist-esm/src/index.js.map +1 -1
  28. package/dist-esm/src/logger.js +1 -1
  29. package/dist-esm/src/logger.js.map +1 -1
  30. package/dist-esm/src/parseConnectionString.js +3 -1
  31. package/dist-esm/src/parseConnectionString.js.map +1 -1
  32. package/dist-esm/src/reverseProxyPolicy.js +21 -0
  33. package/dist-esm/src/reverseProxyPolicy.js.map +1 -0
  34. package/dist-esm/src/tracing.js +1 -1
  35. package/dist-esm/src/tracing.js.map +1 -1
  36. package/dist-esm/src/utils.js +2 -0
  37. package/dist-esm/src/utils.js.map +1 -1
  38. package/dist-esm/src/webPubSubCredentialPolicy.js +2 -2
  39. package/dist-esm/src/webPubSubCredentialPolicy.js.map +1 -1
  40. package/dist-esm/test/conn.spec.js +2 -2
  41. package/dist-esm/test/conn.spec.js.map +1 -1
  42. package/dist-esm/test/groups.spec.js +14 -6
  43. package/dist-esm/test/groups.spec.js.map +1 -1
  44. package/dist-esm/test/hubs.spec.js +53 -10
  45. package/dist-esm/test/hubs.spec.js.map +1 -1
  46. package/dist-esm/test/integration.spec.js +128 -0
  47. package/dist-esm/test/integration.spec.js.map +1 -0
  48. package/dist-esm/test/testEnv.js +6 -2
  49. package/dist-esm/test/testEnv.js.map +1 -1
  50. package/package.json +32 -32
  51. package/types/web-pubsub.d.ts +165 -109
  52. package/dist-esm/src/normalizeOptions.js +0 -8
  53. package/dist-esm/src/normalizeOptions.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/web-pubsub",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.1-alpha.20220103.2",
4
4
  "description": "Azure client library for Azure Web PubSub",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -11,8 +11,8 @@
11
11
  "build:browser": "echo \"Browser is not supported.\" && exit 0",
12
12
  "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
13
13
  "build:samples": "echo Obsolete.",
14
- "build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1",
15
- "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local",
14
+ "build:test": "tsc -p . && rollup -c 2>&1",
15
+ "build": "npm run clean && tsc -p . && rollup -c 2>&1 && api-extractor run --local",
16
16
  "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
17
17
  "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
18
18
  "clean": "rimraf dist dist-esm test-dist temp types *.tgz *.log",
@@ -22,16 +22,14 @@
22
22
  "integration-test:node": "echo skipped",
23
23
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
24
24
  "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
25
- "lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o signalr-lintReport.html || exit 0",
25
+ "lint": "eslint package.json api-extractor.json src test --ext .ts",
26
26
  "pack": "npm pack 2>&1",
27
- "prebuild": "npm run clean",
28
27
  "test:browser": "echo \"Browser is not supported.\" && exit 0",
29
28
  "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
30
29
  "test": "npm run build:test && npm run unit-test && npm run integration-test",
31
30
  "unit-test:browser": "echo \"Browser is not supported.\" && exit 0",
32
- "unit-test:node": "mocha --exit --reporter ../../../common/tools/mocha-multi-reporter.js dist-test/index.node.js",
33
- "unit-test": "npm run unit-test:node && npm run unit-test:browser",
34
- "docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src"
31
+ "unit-test:node": "mocha --exit -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace \"test/{,!(browser)/**/}*.spec.ts\"",
32
+ "unit-test": "npm run unit-test:node && npm run unit-test:browser"
35
33
  },
36
34
  "files": [
37
35
  "dist/",
@@ -41,12 +39,24 @@
41
39
  "README.md",
42
40
  "LICENSE"
43
41
  ],
42
+ "//metadata": {
43
+ "constantPaths": [
44
+ {
45
+ "path": "src/generated/generatedClientContext.ts",
46
+ "prefix": "packageDetails"
47
+ },
48
+ {
49
+ "path": "swagger/README.md",
50
+ "prefix": "package-version"
51
+ }
52
+ ]
53
+ },
44
54
  "browser": {
45
55
  "./dist-esm/src/util/url.js": "./dist-esm/src/util/url.browser.js"
46
56
  },
47
57
  "repository": "github:Azure/azure-sdk-for-js",
48
58
  "keywords": [
49
- "Azure",
59
+ "azure",
50
60
  "cloud"
51
61
  ],
52
62
  "author": "Microsoft Corporation",
@@ -57,34 +67,29 @@
57
67
  "engines": {
58
68
  "node": ">=12.0.0"
59
69
  },
60
- "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/search/search/",
70
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/web-pubsub/web-pubsub/README.md",
61
71
  "sideEffects": false,
62
72
  "dependencies": {
63
73
  "@azure/core-auth": "^1.3.0",
64
74
  "@azure/core-client": "^1.0.0",
65
75
  "@azure/core-rest-pipeline": "^1.1.0",
66
- "@azure/core-tracing": "1.0.0-preview.12",
76
+ "@azure/core-tracing": "1.0.0-preview.13",
67
77
  "@azure/logger": "^1.0.0",
68
78
  "tslib": "^2.2.0",
69
79
  "jsonwebtoken": "^8.5.1"
70
80
  },
71
81
  "devDependencies": {
72
- "@azure/dev-tool": "^1.0.0",
73
- "@azure/eslint-plugin-azure-sdk": "^3.0.0",
74
- "@azure/identity": "^1.1.0",
75
- "@azure/test-utils-recorder": "^1.0.0",
76
- "@microsoft/api-extractor": "7.7.11",
77
- "@rollup/plugin-commonjs": "11.0.2",
78
- "@rollup/plugin-json": "^4.0.0",
79
- "@rollup/plugin-multi-entry": "^3.0.0",
80
- "@rollup/plugin-node-resolve": "^8.0.0",
81
- "@rollup/plugin-replace": "^2.2.0",
82
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
83
+ "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
84
+ "@azure/identity": "^2.0.1",
85
+ "@azure-tools/test-recorder": "^1.0.0",
86
+ "@microsoft/api-extractor": "^7.18.11",
82
87
  "@types/chai": "^4.1.6",
83
88
  "@types/jsonwebtoken": "~8.5.0",
84
89
  "@types/mocha": "^7.0.2",
85
90
  "@types/node": "^12.0.0",
86
- "@types/query-string": "6.2.0",
87
91
  "@types/sinon": "^9.0.4",
92
+ "@types/ws": "^8.2.0",
88
93
  "chai": "^4.2.0",
89
94
  "cross-env": "^7.0.2",
90
95
  "dotenv": "^8.2.0",
@@ -104,21 +109,16 @@
104
109
  "karma-mocha-reporter": "^2.2.5",
105
110
  "karma-sourcemap-loader": "^0.3.8",
106
111
  "mocha": "^7.1.1",
107
- "mocha-junit-reporter": "^1.18.0",
108
- "nyc": "^14.0.0",
109
- "prettier": "^1.16.4",
110
- "puppeteer": "^3.3.0",
111
- "query-string": "^5.0.0",
112
+ "mocha-junit-reporter": "^2.0.0",
113
+ "nyc": "^15.0.0",
114
+ "prettier": "^2.5.1",
115
+ "puppeteer": "^10.2.0",
112
116
  "rimraf": "^3.0.0",
113
117
  "rollup": "^1.16.3",
114
- "rollup-plugin-shim": "^1.0.0",
115
- "rollup-plugin-sourcemaps": "^0.4.2",
116
- "rollup-plugin-terser": "^5.1.1",
117
- "rollup-plugin-visualizer": "^4.0.4",
118
118
  "sinon": "^9.0.2",
119
119
  "source-map-support": "^0.5.9",
120
120
  "typescript": "~4.2.0",
121
- "typedoc": "0.15.2"
121
+ "ws": "^8.2.0"
122
122
  },
123
123
  "//sampleConfiguration": {
124
124
  "productName": "Azure Web PubSub",
@@ -2,28 +2,38 @@ import { AzureKeyCredential } from '@azure/core-auth';
2
2
  import { CommonClientOptions } from '@azure/core-client';
3
3
  import { OperationOptions } from '@azure/core-client';
4
4
  import { RequestBodyType } from '@azure/core-rest-pipeline';
5
+ import { TokenCredential } from '@azure/core-auth';
6
+
5
7
  export { AzureKeyCredential }
6
8
 
7
9
  /**
8
- * Options for closing a connection to a hub.
10
+ * A response containing the client token.
9
11
  */
10
- export declare interface CloseConnectionOptions extends OperationOptions {
12
+ export declare interface ClientTokenResponse {
11
13
  /**
12
- * Reason the connection is being closed.
14
+ * The client token.
13
15
  */
14
- reason?: string;
16
+ token: string;
17
+ /**
18
+ * The URL client connects to
19
+ */
20
+ baseUrl: string;
21
+ /**
22
+ * The URL client connects to with access_token query string
23
+ */
24
+ url: string;
15
25
  }
16
26
 
17
27
  /**
18
- * Options for auth a client
28
+ * Options for generating a token to connect a client to the Azure Web Pubsub service.
19
29
  */
20
- export declare interface GetAuthenticationTokenOptions {
30
+ export declare interface GenerateClientTokenOptions extends OperationOptions {
21
31
  /**
22
- * The userId for the client
32
+ * The userId for the client.
23
33
  */
24
34
  userId?: string;
25
35
  /**
26
- * The roles the client have.
36
+ * The roles that the connection with the generated token will have.
27
37
  * Roles give the client initial permissions to leave, join, or publish to groups when using PubSub subprotocol
28
38
  * * `webpubsub.joinLeaveGroup`: the client can join or leave any group
29
39
  * * `webpubsub.sendToGroup`: the client can send messages to any group
@@ -34,27 +44,9 @@ export declare interface GetAuthenticationTokenOptions {
34
44
  */
35
45
  roles?: string[];
36
46
  /**
37
- * The time-to-live minutes for the access token. If not set, the default value is 60 minutes.
38
- */
39
- ttl?: number;
40
- }
41
-
42
- /**
43
- * Response for the authed client, including the url and the jwt token
44
- */
45
- export declare interface GetAuthenticationTokenResponse {
46
- /**
47
- * The URL client connects to
48
- */
49
- baseUrl: string;
50
- /**
51
- * The JWT token the client uses to connect
52
- */
53
- token: string;
54
- /**
55
- * The URL client connects to with access_token query string
47
+ * Minutes until the token expires.
56
48
  */
57
- url: string;
49
+ expirationTimeInMinutes?: number;
58
50
  }
59
51
 
60
52
  /**
@@ -75,6 +67,16 @@ export declare interface GroupAddUserOptions extends OperationOptions {
75
67
  export declare interface GroupAdminClientOptions extends CommonClientOptions {
76
68
  }
77
69
 
70
+ /**
71
+ * Options for closing all connections to a group.
72
+ */
73
+ export declare interface GroupCloseAllConnectionsOptions extends OperationOptions {
74
+ /**
75
+ * Reason the connection is being closed.
76
+ */
77
+ reason?: string;
78
+ }
79
+
78
80
  /**
79
81
  * Options for checking if a user is in a group
80
82
  */
@@ -121,9 +123,33 @@ export declare interface HasConnectionOptions extends OperationOptions {
121
123
  }
122
124
 
123
125
  /**
124
- * Options for constructing a HubAdmin client.
126
+ * Options for closing all connections to a hub.
125
127
  */
126
- export declare interface HubAdminClientOptions extends CommonClientOptions {
128
+ export declare interface HubCloseAllConnectionsOptions extends OperationOptions {
129
+ /**
130
+ * Reason the connection is being closed.
131
+ */
132
+ reason?: string;
133
+ }
134
+
135
+ /**
136
+ * Options for closing a connection to a hub.
137
+ */
138
+ export declare interface HubCloseConnectionOptions extends OperationOptions {
139
+ /**
140
+ * Reason the connection is being closed.
141
+ */
142
+ reason?: string;
143
+ }
144
+
145
+ /**
146
+ * Options for closing all of a user's connections to a hub.
147
+ */
148
+ export declare interface HubCloseUserConnectionsOptions extends OperationOptions {
149
+ /**
150
+ * Reason the connection is being closed.
151
+ */
152
+ reason?: string;
127
153
  }
128
154
 
129
155
  /**
@@ -144,7 +170,7 @@ export declare interface HubHasGroupOptions extends OperationOptions {
144
170
  }
145
171
 
146
172
  /**
147
- * Options for check if a connection has the specified permission
173
+ * Options for checking if a connection has the specified permission
148
174
  */
149
175
  export declare interface HubHasPermissionOptions extends OperationOptions {
150
176
  /**
@@ -163,7 +189,7 @@ export declare interface HubHasUserOptions extends OperationOptions {
163
189
  /**
164
190
  * Options for removing a user from all groups.
165
191
  */
166
- export declare interface HubRemoveUserFromAllGroupsOptions extends CloseConnectionOptions {
192
+ export declare interface HubRemoveUserFromAllGroupsOptions extends HubCloseConnectionOptions {
167
193
  }
168
194
 
169
195
  /**
@@ -247,50 +273,56 @@ export declare interface WebPubSubGroup {
247
273
  /**
248
274
  * Add a specific connection to this group
249
275
  *
250
- * @param connectionId The connection id to add to this group
251
- * @param options Additional options
276
+ * @param connectionId - The connection id to add to this group
277
+ * @param options - Additional options
252
278
  */
253
279
  addConnection(connectionId: string, options?: GroupAddConnectionOptions): Promise<void>;
254
280
  /**
255
281
  * Remove a specific connection from this group
256
282
  *
257
- * @param connectionId The connection id to remove from this group
258
- * @param options Additional options
283
+ * @param connectionId - The connection id to remove from this group
284
+ * @param options - Additional options
259
285
  */
260
286
  removeConnection(connectionId: string, options?: GroupRemoveConnectionOptions): Promise<void>;
287
+ /**
288
+ * Close all connections to the group
289
+ *
290
+ * @param options - Additional options
291
+ */
292
+ closeAllConnections(options?: GroupCloseAllConnectionsOptions): Promise<void>;
261
293
  /**
262
294
  * Add a user to this group
263
295
  *
264
- * @param username The user name to add
265
- * @param options Additional options
296
+ * @param username - The user name to add
297
+ * @param options - Additional options
266
298
  */
267
299
  addUser(username: string, options?: GroupAddUserOptions): Promise<void>;
268
300
  /**
269
301
  * Remove a user from this group
270
302
  *
271
- * @param username The user name to remove
272
- * @param options Additional options
303
+ * @param username - The user name to remove
304
+ * @param options - Additional options
273
305
  */
274
306
  removeUser(username: string, options?: GroupRemoveUserOptions): Promise<void>;
275
307
  /**
276
308
  * Send a text message to every connection in this group
277
309
  *
278
- * @param message The message to send
279
- * @param options Additional options
310
+ * @param message - The message to send
311
+ * @param options - Additional options
280
312
  */
281
313
  sendToAll(message: string, options: GroupSendTextToAllOptions): Promise<void>;
282
314
  /**
283
315
  * Send a json message to every connection in this group
284
316
  *
285
- * @param message The message to send
286
- * @param options Additional options
317
+ * @param message - The message to send
318
+ * @param options - Additional options
287
319
  */
288
320
  sendToAll(message: JSONTypes, options?: GroupSendToAllOptions): Promise<void>;
289
321
  /**
290
322
  * Send a binary message to every connection in this group
291
323
  *
292
- * @param message The binary message to send
293
- * @param options Additional options
324
+ * @param message - The binary message to send
325
+ * @param options - Additional options
294
326
  */
295
327
  sendToAll(message: RequestBodyType, options?: GroupSendToAllOptions): Promise<void>;
296
328
  }
@@ -324,11 +356,11 @@ export declare class WebPubSubServiceClient {
324
356
  * const client = new WebPubSubServiceClient(connectionString, 'chat');
325
357
  * ```
326
358
  *
327
- * @param connectionString The connection string
328
- * @param hubName The name of the hub to connect to. If omitted, '_default' is used.
329
- * @param options Options to configure the http pipeline
359
+ * @param connectionString - The connection string
360
+ * @param hubName - The name of the hub to connect to. If omitted, '_default' is used.
361
+ * @param options - Options to configure the http pipeline
330
362
  */
331
- constructor(connectionString: string, hubName: string, options?: HubAdminClientOptions);
363
+ constructor(connectionString: string, hubName: string, options?: WebPubSubServiceClientOptions);
332
364
  /**
333
365
  * Creates an instance of a WebPubSubServiceClient for sending messages and managing groups, connections, and users.
334
366
  *
@@ -340,149 +372,173 @@ export declare class WebPubSubServiceClient {
340
372
  * const client = new WebPubSubServiceClient(endpoint, cred, 'chat');
341
373
  * ```
342
374
  *
343
- * @param endpoint The endpoint to connect to
344
- * @param credential An AzureKeyCredential holding your service key
345
- * @param hubName The name of the hub to connect to.
346
- * @param options Options to configure the http pipeline
347
- */
348
- constructor(endpoint: string, credential: AzureKeyCredential, hubName: string, options?: HubAdminClientOptions);
349
- /**
350
- * Auth the client connection with userId and custom claims if any
351
- * @param options The options that the client has
375
+ * @param endpoint - The endpoint to connect to
376
+ * @param credential - An AzureKeyCredential holding your service key
377
+ * @param hubName - The name of the hub to connect to.
378
+ * @param options - Options to configure the http pipeline
352
379
  */
353
- getAuthenticationToken(options?: GetAuthenticationTokenOptions): Promise<GetAuthenticationTokenResponse>;
380
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, hubName: string, options?: WebPubSubServiceClientOptions);
354
381
  /**
355
382
  * Get a client for a group
356
- * @param groupName The name of the group to connect to.
383
+ * @param groupName - The name of the group to connect to.
357
384
  */
358
385
  group(groupName: string): WebPubSubGroup;
359
386
  /**
360
387
  * Broadcast a text message to all connections on this hub.
361
388
  *
362
- * @param message The text message to send
363
- * @param options Additional options
389
+ * @param message - The text message to send
390
+ * @param options - Additional options
364
391
  */
365
392
  sendToAll(message: string, options: HubSendTextToAllOptions): Promise<void>;
366
393
  /**
367
394
  * Broadcast a JSON message to all connections on this hub.
368
395
  *
369
- * @param message The JSON message to send
370
- * @param options Additional options
396
+ * @param message - The JSON message to send
397
+ * @param options - Additional options
371
398
  */
372
399
  sendToAll(message: JSONTypes, options?: HubSendToAllOptions): Promise<void>;
373
400
  /**
374
401
  * Broadcast a binary message to all connections on this hub.
375
402
  *
376
- * @param message The message to send
377
- * @param options Additional options
403
+ * @param message - The message to send
404
+ * @param options - Additional options
378
405
  */
379
406
  sendToAll(message: RequestBodyType, options?: HubSendToAllOptions): Promise<void>;
380
407
  /**
381
408
  * Send a text message to a specific user
382
409
  *
383
- * @param username User name to send to
384
- * @param message The text message to send
385
- * @param options Additional options
410
+ * @param username - User name to send to
411
+ * @param message - The text message to send
412
+ * @param options - Additional options
386
413
  */
387
414
  sendToUser(username: string, message: string, options: HubSendTextToUserOptions): Promise<void>;
388
415
  /**
389
416
  * Send a JSON message to a specific user
390
417
  *
391
- * @param username User name to send to
392
- * @param message The josn message to send
393
- * @param options Additional options
418
+ * @param username - User name to send to
419
+ * @param message - The josn message to send
420
+ * @param options - Additional options
394
421
  */
395
422
  sendToUser(username: string, message: JSONTypes, options?: HubSendToUserOptions): Promise<void>;
396
423
  /**
397
424
  * Send a binary message to a specific user
398
425
  *
399
- * @param username The user name to send to
400
- * @param message The binary message to send
401
- * @param options Additional options
426
+ * @param username - The user name to send to
427
+ * @param message - The binary message to send
428
+ * @param options - Additional options
402
429
  */
403
430
  sendToUser(username: string, message: RequestBodyType, options?: HubSendToUserOptions | HubSendTextToUserOptions): Promise<void>;
404
431
  /**
405
432
  * Send a text message to a specific connection
406
433
  *
407
- * @param connectionId Connection id to send to
408
- * @param message The text message
409
- * @param options Additional options
434
+ * @param connectionId - Connection id to send to
435
+ * @param message - The text message
436
+ * @param options - Additional options
410
437
  */
411
438
  sendToConnection(connectionId: string, message: string, options: HubSendTextToConnectionOptions): Promise<void>;
412
439
  /**
413
440
  * Send a binary message to a specific connection
414
441
  *
415
- * @param connectionId Connection id to send to
416
- * @param message The JSON message
417
- * @param options Additional options
442
+ * @param connectionId - Connection id to send to
443
+ * @param message - The JSON message
444
+ * @param options - Additional options
418
445
  */
419
446
  sendToConnection(connectionId: string, message: JSONTypes, options?: HubSendToConnectionOptions): Promise<void>;
420
447
  /**
421
448
  * Send a binary message to a specific connection
422
449
  *
423
- * @param connectionId Connection id to send to
424
- * @param message The binary message
425
- * @param options Additional options
450
+ * @param connectionId - Connection id to send to
451
+ * @param message - The binary message
452
+ * @param options - Additional options
426
453
  */
427
454
  sendToConnection(connectionId: string, message: RequestBodyType, options?: HubSendToConnectionOptions | HubSendTextToConnectionOptions): Promise<void>;
428
455
  /**
429
456
  * Check if a specific connection is connected to this hub
430
457
  *
431
- * @param connectionId Connection id to check
432
- * @param options Additional options
458
+ * @param connectionId - Connection id to check
459
+ * @param options - Additional options
433
460
  */
434
- hasConnection(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
461
+ connectionExists(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
435
462
  /**
436
463
  * Close a specific connection to this hub
437
464
  *
438
- * @param connectionId Connection id to close
439
- * @param options Additional options
465
+ * @param connectionId - Connection id to close
466
+ * @param options - Additional options
467
+ */
468
+ closeConnection(connectionId: string, options?: HubCloseConnectionOptions): Promise<void>;
469
+ /**
470
+ * Close all connections to this hub
471
+ *
472
+ * @param options - Additional options
440
473
  */
441
- closeConnection(connectionId: string, options?: CloseConnectionOptions): Promise<void>;
474
+ closeAllConnections(options?: HubCloseAllConnectionsOptions): Promise<void>;
475
+ /**
476
+ * Close all connections with the given user id
477
+ *
478
+ * @param user - User id to close
479
+ * @param options - Additional options
480
+ */
481
+ closeUserConnections(userId: string, options?: HubCloseUserConnectionsOptions): Promise<void>;
442
482
  /**
443
483
  * Remove a specific user from all groups they are joined to
444
- * @param userId The user id to remove from all groups
445
- * @param options Additional options
484
+ * @param userId - The user id to remove from all groups
485
+ * @param options - Additional options
446
486
  */
447
- removeUserFromAllGroups(userId: string, options?: CloseConnectionOptions): Promise<void>;
487
+ removeUserFromAllGroups(userId: string, options?: HubCloseConnectionOptions): Promise<void>;
448
488
  /**
449
489
  * Check if a particular group exists (i.e. has active connections).
450
490
  *
451
- * @param groupName The group name to check for
452
- * @param options Additional options
491
+ * @param groupName - The group name to check for
492
+ * @param options - Additional options
453
493
  */
454
- hasGroup(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
494
+ groupExists(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
455
495
  /**
456
496
  * Check if a particular user is connected to this hub.
457
497
  *
458
- * @param username The user name to check for
459
- * @param options Additional options
498
+ * @param username - The user name to check for
499
+ * @param options - Additional options
460
500
  */
461
- hasUser(username: string, options?: HubHasUserOptions): Promise<boolean>;
501
+ userExists(username: string, options?: HubHasUserOptions): Promise<boolean>;
462
502
  /**
463
503
  * Grant permissions to a connection
464
504
  *
465
- * @param connectionId The connection id to grant permissions to
466
- * @param Permission The permission to grant
467
- * @param options Additional options
505
+ * @param connectionId - The connection id to grant permissions to
506
+ * @param Permission - The permission to grant
507
+ * @param options - Additional options
468
508
  */
469
509
  grantPermission(connectionId: string, permission: Permission, options?: HubGrantPermissionOptions): Promise<void>;
470
510
  /**
471
511
  * Revoke permissions from a connection
472
512
  *
473
- * @param connectionId The connection id to revoke permissions from
474
- * @param Permission The permission to revoke
475
- * @param options Additional options
513
+ * @param connectionId - The connection id to revoke permissions from
514
+ * @param Permission - The permission to revoke
515
+ * @param options - Additional options
476
516
  */
477
517
  revokePermission(connectionId: string, permission: Permission, options?: HubRevokePermissionOptions): Promise<void>;
478
518
  /**
479
519
  * Check if the connection has the specified permission
480
520
  *
481
- * @param connectionId The connection id to check permission
482
- * @param Permission The permission to check
483
- * @param options Additional options
521
+ * @param connectionId - The connection id to check permission
522
+ * @param Permission - The permission to check
523
+ * @param options - Additional options
484
524
  */
485
525
  hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<boolean>;
526
+ /**
527
+ * Generate a token for a client to connect to the Azure Web PubSub service.
528
+ *
529
+ * @param options - Additional options
530
+ */
531
+ getClientAccessToken(options?: GenerateClientTokenOptions): Promise<ClientTokenResponse>;
532
+ }
533
+
534
+ /**
535
+ * Options for constructing a HubAdmin client.
536
+ */
537
+ export declare interface WebPubSubServiceClientOptions extends CommonClientOptions {
538
+ /**
539
+ * Reverse proxy endpoint (for example, your Azure API management endpoint)
540
+ */
541
+ reverseProxyEndpoint?: string;
486
542
  }
487
543
 
488
544
  export { }
@@ -1,8 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { __rest } from "tslib";
4
- export default function normalizeSendToAllOptions(options) {
5
- const { excludedConnections } = options, otherOptions = __rest(options, ["excludedConnections"]);
6
- return Object.assign(Object.assign({}, otherOptions), { excluded: excludedConnections });
7
- }
8
- //# sourceMappingURL=normalizeOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeOptions.js","sourceRoot":"","sources":["../../src/normalizeOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAU;IAEV,MAAM,EAAE,mBAAmB,KAAsB,OAAO,EAAxB,YAAY,UAAK,OAAO,EAAlD,uBAAwC,CAAU,CAAC;IACzD,uCACK,YAAY,KACf,QAAQ,EAAE,mBAAmB,IAC7B;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport default function normalizeSendToAllOptions<T extends { excludedConnections?: string[] }>(\n options: T\n) {\n const { excludedConnections, ...otherOptions } = options;\n return {\n ...otherOptions,\n excluded: excludedConnections\n };\n}\n"]}