@azure/web-pubsub 1.0.0-beta.4 → 1.0.1-alpha.20220128.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Release History
2
2
 
3
+ ## 1.0.1 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
13
+ ## 1.0.0 (2021-11-11)
14
+
15
+ No changes.
16
+
3
17
  ## 1.0.0-beta.4 (2021-11-09)
4
18
 
5
19
  ### Features Added
package/README.md CHANGED
@@ -58,7 +58,7 @@ Or authenticate the `WebPubSubServiceClient` using [Azure Active Directory][aad_
58
58
 
59
59
  1. Install the `@azure/identity` dependency
60
60
 
61
- ```batch
61
+ ```bash
62
62
  npm install @azure/identity
63
63
  ```
64
64
 
@@ -66,6 +66,7 @@ npm install @azure/identity
66
66
 
67
67
  ```js
68
68
  const { WebPubSubServiceClient, AzureKeyCredential } = require("@azure/web-pubsub");
69
+ const { DefaultAzureCredential } = require("@azure/identity");
69
70
 
70
71
  const key = new DefaultAzureCredential();
71
72
  const serviceClient = new WebPubSubServiceClient("<Endpoint>", key, "<hubName>");
@@ -192,7 +193,7 @@ const hasConnections = await serviceClient.groupExists("<groupName>");
192
193
  ```js
193
194
  const { WebPubSubServiceClient } = require("@azure/web-pubsub");
194
195
 
195
- function onResponse(rawResponse: FullOperationResponse): void {
196
+ function onResponse(rawResponse) {
196
197
  console.log(rawResponse);
197
198
  }
198
199
  const serviceClient = new WebPubSubServiceClient("<ConnectionString>", "<hubName>");
package/dist/index.js CHANGED
@@ -2,16 +2,37 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
5
  var coreAuth = require('@azure/core-auth');
8
6
  var coreRestPipeline = require('@azure/core-rest-pipeline');
9
7
  var coreClient = require('@azure/core-client');
10
8
  var coreTracing = require('@azure/core-tracing');
11
- var jwt = _interopDefault(require('jsonwebtoken'));
9
+ var jwt = require('jsonwebtoken');
12
10
  var logger$1 = require('@azure/logger');
13
11
  var url = require('url');
14
12
 
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n["default"] = e;
30
+ return Object.freeze(n);
31
+ }
32
+
33
+ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
34
+ var jwt__default = /*#__PURE__*/_interopDefaultLegacy(jwt);
35
+
15
36
  /*
16
37
  * Copyright (c) Microsoft Corporation.
17
38
  * Licensed under the MIT License.
@@ -682,14 +703,14 @@ class HealthApiImpl {
682
703
  }
683
704
  }
684
705
  // Operation Specifications
685
- const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
706
+ const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
686
707
  const getServiceStatusOperationSpec = {
687
708
  path: "/api/health",
688
709
  httpMethod: "HEAD",
689
710
  responses: { 200: {}, default: {} },
690
711
  queryParameters: [apiVersion],
691
712
  urlParameters: [endpoint],
692
- serializer
713
+ serializer: serializer$1
693
714
  };
694
715
 
695
716
  /*
@@ -1021,7 +1042,7 @@ class WebPubSubImpl {
1021
1042
  }
1022
1043
  }
1023
1044
  // Operation Specifications
1024
- const serializer$1 = coreClient.createSerializer(Mappers, /* isXml */ false);
1045
+ const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1025
1046
  const generateClientTokenOperationSpec = {
1026
1047
  path: "/api/hubs/{hub}/:generateToken",
1027
1048
  httpMethod: "POST",
@@ -1042,7 +1063,7 @@ const generateClientTokenOperationSpec = {
1042
1063
  ],
1043
1064
  urlParameters: [endpoint, hub],
1044
1065
  headerParameters: [accept],
1045
- serializer: serializer$1
1066
+ serializer
1046
1067
  };
1047
1068
  const closeAllConnectionsOperationSpec = {
1048
1069
  path: "/api/hubs/{hub}/:closeConnections",
@@ -1061,7 +1082,7 @@ const closeAllConnectionsOperationSpec = {
1061
1082
  ],
1062
1083
  urlParameters: [endpoint, hub],
1063
1084
  headerParameters: [accept],
1064
- serializer: serializer$1
1085
+ serializer
1065
1086
  };
1066
1087
  const sendToAll$binaryOperationSpec = {
1067
1088
  path: "/api/hubs/{hub}/:send",
@@ -1078,7 +1099,7 @@ const sendToAll$binaryOperationSpec = {
1078
1099
  urlParameters: [endpoint, hub],
1079
1100
  headerParameters: [contentType, accept1],
1080
1101
  mediaType: "binary",
1081
- serializer: serializer$1
1102
+ serializer
1082
1103
  };
1083
1104
  const sendToAll$textOperationSpec = {
1084
1105
  path: "/api/hubs/{hub}/:send",
@@ -1095,7 +1116,7 @@ const sendToAll$textOperationSpec = {
1095
1116
  urlParameters: [endpoint, hub],
1096
1117
  headerParameters: [contentType1, accept2],
1097
1118
  mediaType: "text",
1098
- serializer: serializer$1
1119
+ serializer
1099
1120
  };
1100
1121
  const connectionExistsOperationSpec = {
1101
1122
  path: "/api/hubs/{hub}/connections/{connectionId}",
@@ -1111,7 +1132,7 @@ const connectionExistsOperationSpec = {
1111
1132
  queryParameters: [apiVersion],
1112
1133
  urlParameters: [endpoint, hub, connectionId],
1113
1134
  headerParameters: [accept],
1114
- serializer: serializer$1
1135
+ serializer
1115
1136
  };
1116
1137
  const closeConnectionOperationSpec = {
1117
1138
  path: "/api/hubs/{hub}/connections/{connectionId}",
@@ -1126,7 +1147,7 @@ const closeConnectionOperationSpec = {
1126
1147
  queryParameters: [apiVersion, reason],
1127
1148
  urlParameters: [endpoint, hub, connectionId],
1128
1149
  headerParameters: [accept],
1129
- serializer: serializer$1
1150
+ serializer
1130
1151
  };
1131
1152
  const sendToConnection$binaryOperationSpec = {
1132
1153
  path: "/api/hubs/{hub}/connections/{connectionId}/:send",
@@ -1143,7 +1164,7 @@ const sendToConnection$binaryOperationSpec = {
1143
1164
  urlParameters: [endpoint, hub, connectionId],
1144
1165
  headerParameters: [contentType, accept1],
1145
1166
  mediaType: "binary",
1146
- serializer: serializer$1
1167
+ serializer
1147
1168
  };
1148
1169
  const sendToConnection$textOperationSpec = {
1149
1170
  path: "/api/hubs/{hub}/connections/{connectionId}/:send",
@@ -1160,7 +1181,7 @@ const sendToConnection$textOperationSpec = {
1160
1181
  urlParameters: [endpoint, hub, connectionId],
1161
1182
  headerParameters: [contentType1, accept2],
1162
1183
  mediaType: "text",
1163
- serializer: serializer$1
1184
+ serializer
1164
1185
  };
1165
1186
  const groupExistsOperationSpec = {
1166
1187
  path: "/api/hubs/{hub}/groups/{group}",
@@ -1176,7 +1197,7 @@ const groupExistsOperationSpec = {
1176
1197
  queryParameters: [apiVersion],
1177
1198
  urlParameters: [endpoint, hub, group],
1178
1199
  headerParameters: [accept],
1179
- serializer: serializer$1
1200
+ serializer
1180
1201
  };
1181
1202
  const closeGroupConnectionsOperationSpec = {
1182
1203
  path: "/api/hubs/{hub}/groups/{group}/:closeConnections",
@@ -1195,7 +1216,7 @@ const closeGroupConnectionsOperationSpec = {
1195
1216
  ],
1196
1217
  urlParameters: [endpoint, hub, group],
1197
1218
  headerParameters: [accept],
1198
- serializer: serializer$1
1219
+ serializer
1199
1220
  };
1200
1221
  const sendToGroup$binaryOperationSpec = {
1201
1222
  path: "/api/hubs/{hub}/groups/{group}/:send",
@@ -1212,7 +1233,7 @@ const sendToGroup$binaryOperationSpec = {
1212
1233
  urlParameters: [endpoint, hub, group],
1213
1234
  headerParameters: [contentType, accept1],
1214
1235
  mediaType: "binary",
1215
- serializer: serializer$1
1236
+ serializer
1216
1237
  };
1217
1238
  const sendToGroup$textOperationSpec = {
1218
1239
  path: "/api/hubs/{hub}/groups/{group}/:send",
@@ -1229,7 +1250,7 @@ const sendToGroup$textOperationSpec = {
1229
1250
  urlParameters: [endpoint, hub, group],
1230
1251
  headerParameters: [contentType1, accept2],
1231
1252
  mediaType: "text",
1232
- serializer: serializer$1
1253
+ serializer
1233
1254
  };
1234
1255
  const addConnectionToGroupOperationSpec = {
1235
1256
  path: "/api/hubs/{hub}/groups/{group}/connections/{connectionId}",
@@ -1250,7 +1271,7 @@ const addConnectionToGroupOperationSpec = {
1250
1271
  group
1251
1272
  ],
1252
1273
  headerParameters: [accept],
1253
- serializer: serializer$1
1274
+ serializer
1254
1275
  };
1255
1276
  const removeConnectionFromGroupOperationSpec = {
1256
1277
  path: "/api/hubs/{hub}/groups/{group}/connections/{connectionId}",
@@ -1270,7 +1291,7 @@ const removeConnectionFromGroupOperationSpec = {
1270
1291
  group
1271
1292
  ],
1272
1293
  headerParameters: [accept],
1273
- serializer: serializer$1
1294
+ serializer
1274
1295
  };
1275
1296
  const userExistsOperationSpec = {
1276
1297
  path: "/api/hubs/{hub}/users/{userId}",
@@ -1286,7 +1307,7 @@ const userExistsOperationSpec = {
1286
1307
  queryParameters: [apiVersion],
1287
1308
  urlParameters: [endpoint, hub, userId1],
1288
1309
  headerParameters: [accept],
1289
- serializer: serializer$1
1310
+ serializer
1290
1311
  };
1291
1312
  const closeUserConnectionsOperationSpec = {
1292
1313
  path: "/api/hubs/{hub}/users/{userId}/:closeConnections",
@@ -1305,7 +1326,7 @@ const closeUserConnectionsOperationSpec = {
1305
1326
  ],
1306
1327
  urlParameters: [endpoint, hub, userId1],
1307
1328
  headerParameters: [accept],
1308
- serializer: serializer$1
1329
+ serializer
1309
1330
  };
1310
1331
  const sendToUser$binaryOperationSpec = {
1311
1332
  path: "/api/hubs/{hub}/users/{userId}/:send",
@@ -1322,7 +1343,7 @@ const sendToUser$binaryOperationSpec = {
1322
1343
  urlParameters: [endpoint, hub, userId1],
1323
1344
  headerParameters: [contentType, accept1],
1324
1345
  mediaType: "binary",
1325
- serializer: serializer$1
1346
+ serializer
1326
1347
  };
1327
1348
  const sendToUser$textOperationSpec = {
1328
1349
  path: "/api/hubs/{hub}/users/{userId}/:send",
@@ -1339,7 +1360,7 @@ const sendToUser$textOperationSpec = {
1339
1360
  urlParameters: [endpoint, hub, userId1],
1340
1361
  headerParameters: [contentType1, accept2],
1341
1362
  mediaType: "text",
1342
- serializer: serializer$1
1363
+ serializer
1343
1364
  };
1344
1365
  const addUserToGroupOperationSpec = {
1345
1366
  path: "/api/hubs/{hub}/users/{userId}/groups/{group}",
@@ -1360,7 +1381,7 @@ const addUserToGroupOperationSpec = {
1360
1381
  userId1
1361
1382
  ],
1362
1383
  headerParameters: [accept],
1363
- serializer: serializer$1
1384
+ serializer
1364
1385
  };
1365
1386
  const removeUserFromGroupOperationSpec = {
1366
1387
  path: "/api/hubs/{hub}/users/{userId}/groups/{group}",
@@ -1380,7 +1401,7 @@ const removeUserFromGroupOperationSpec = {
1380
1401
  userId1
1381
1402
  ],
1382
1403
  headerParameters: [accept],
1383
- serializer: serializer$1
1404
+ serializer
1384
1405
  };
1385
1406
  const removeUserFromAllGroupsOperationSpec = {
1386
1407
  path: "/api/hubs/{hub}/users/{userId}/groups",
@@ -1395,7 +1416,7 @@ const removeUserFromAllGroupsOperationSpec = {
1395
1416
  queryParameters: [apiVersion],
1396
1417
  urlParameters: [endpoint, hub, userId1],
1397
1418
  headerParameters: [accept],
1398
- serializer: serializer$1
1419
+ serializer
1399
1420
  };
1400
1421
  const grantPermissionOperationSpec = {
1401
1422
  path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
@@ -1415,7 +1436,7 @@ const grantPermissionOperationSpec = {
1415
1436
  permission
1416
1437
  ],
1417
1438
  headerParameters: [accept],
1418
- serializer: serializer$1
1439
+ serializer
1419
1440
  };
1420
1441
  const revokePermissionOperationSpec = {
1421
1442
  path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
@@ -1435,7 +1456,7 @@ const revokePermissionOperationSpec = {
1435
1456
  permission
1436
1457
  ],
1437
1458
  headerParameters: [accept],
1438
- serializer: serializer$1
1459
+ serializer
1439
1460
  };
1440
1461
  const checkPermissionOperationSpec = {
1441
1462
  path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
@@ -1456,7 +1477,7 @@ const checkPermissionOperationSpec = {
1456
1477
  permission
1457
1478
  ],
1458
1479
  headerParameters: [accept],
1459
- serializer: serializer$1
1480
+ serializer
1460
1481
  };
1461
1482
 
1462
1483
  /*
@@ -1467,7 +1488,7 @@ const checkPermissionOperationSpec = {
1467
1488
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1468
1489
  */
1469
1490
  /** @internal */
1470
- class GeneratedClientContext extends coreClient.ServiceClient {
1491
+ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
1471
1492
  /**
1472
1493
  * Initializes a new instance of the GeneratedClientContext class.
1473
1494
  * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance.
@@ -1484,7 +1505,7 @@ class GeneratedClientContext extends coreClient.ServiceClient {
1484
1505
  const defaults = {
1485
1506
  requestContentType: "application/json; charset=utf-8"
1486
1507
  };
1487
- const packageDetails = `azsdk-js-web-pubsub/1.0.0-beta.4`;
1508
+ const packageDetails = `azsdk-js-web-pubsub/1.0.1`;
1488
1509
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1489
1510
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1490
1511
  : `${packageDetails}`;
@@ -1524,7 +1545,7 @@ class GeneratedClient extends GeneratedClientContext {
1524
1545
  /** @internal */
1525
1546
  const createSpan = coreTracing.createSpanFunction({
1526
1547
  namespace: "Microsoft.WebPubSub",
1527
- packagePrefix: "Azure.Messaging.WebPubSub"
1548
+ packagePrefix: "Azure.Messaging.WebPubSub",
1528
1549
  });
1529
1550
 
1530
1551
  // Copyright (c) Microsoft Corporation.
@@ -1590,7 +1611,7 @@ class WebPubSubGroupImpl {
1590
1611
  throw new coreRestPipeline.RestError(`Connection id '${connectionId}' doesn't exist`, {
1591
1612
  statusCode: response === null || response === void 0 ? void 0 : response.status,
1592
1613
  request: response === null || response === void 0 ? void 0 : response.request,
1593
- response: response
1614
+ response: response,
1594
1615
  });
1595
1616
  }
1596
1617
  }
@@ -1683,14 +1704,14 @@ function webPubSubKeyCredentialPolicy(credential) {
1683
1704
  return {
1684
1705
  name: webPubSubKeyCredentialPolicyName,
1685
1706
  sendRequest(request, next) {
1686
- const bearerToken = jwt.sign({}, credential.key, {
1707
+ const bearerToken = jwt__default["default"].sign({}, credential.key, {
1687
1708
  audience: request.url,
1688
1709
  expiresIn: "1h",
1689
- algorithm: "HS256"
1710
+ algorithm: "HS256",
1690
1711
  });
1691
1712
  request.headers.set("Authorization", `Bearer ${bearerToken}`);
1692
1713
  return next(request);
1693
- }
1714
+ },
1694
1715
  };
1695
1716
  }
1696
1717
 
@@ -1746,7 +1767,7 @@ function webPubSubReverseProxyPolicy(endpoint) {
1746
1767
  parsedUrl.host = rpEndpointUrl.host;
1747
1768
  request.url = parsedUrl.toString();
1748
1769
  return next(request);
1749
- }
1770
+ },
1750
1771
  };
1751
1772
  }
1752
1773
 
@@ -1778,12 +1799,12 @@ class WebPubSubServiceClient {
1778
1799
  const internalPipelineOptions = Object.assign(Object.assign(Object.assign({}, this.clientOptions), {
1779
1800
  apiVersion: this.apiVersion,
1780
1801
  loggingOptions: {
1781
- logger: logger.info
1782
- }
1802
+ logger: logger.info,
1803
+ },
1783
1804
  }), (coreAuth.isTokenCredential(this.credential)
1784
1805
  ? {
1785
1806
  credential: this.credential,
1786
- credentialScopes: ["https://webpubsub.azure.com/.default"]
1807
+ credentialScopes: ["https://webpubsub.azure.com/.default"],
1787
1808
  }
1788
1809
  : {}));
1789
1810
  this.client = new GeneratedClient(this.endpoint, internalPipelineOptions);
@@ -1859,7 +1880,7 @@ class WebPubSubServiceClient {
1859
1880
  throw new coreRestPipeline.RestError(response.bodyAsText, {
1860
1881
  statusCode: response === null || response === void 0 ? void 0 : response.status,
1861
1882
  request: response === null || response === void 0 ? void 0 : response.request,
1862
- response: response
1883
+ response: response,
1863
1884
  });
1864
1885
  }
1865
1886
  }
@@ -1952,7 +1973,7 @@ class WebPubSubServiceClient {
1952
1973
  throw new coreRestPipeline.RestError(response.bodyAsText, {
1953
1974
  statusCode: response === null || response === void 0 ? void 0 : response.status,
1954
1975
  request: response === null || response === void 0 ? void 0 : response.request,
1955
- response: response
1976
+ response: response,
1956
1977
  });
1957
1978
  }
1958
1979
  }
@@ -1988,7 +2009,7 @@ class WebPubSubServiceClient {
1988
2009
  throw new coreRestPipeline.RestError(response.bodyAsText, {
1989
2010
  statusCode: response === null || response === void 0 ? void 0 : response.status,
1990
2011
  request: response === null || response === void 0 ? void 0 : response.request,
1991
- response: response
2012
+ response: response,
1992
2013
  });
1993
2014
  }
1994
2015
  }
@@ -2057,7 +2078,7 @@ class WebPubSubServiceClient {
2057
2078
  throw new coreRestPipeline.RestError(response.bodyAsText, {
2058
2079
  statusCode: response === null || response === void 0 ? void 0 : response.status,
2059
2080
  request: response === null || response === void 0 ? void 0 : response.request,
2060
- response: response
2081
+ response: response,
2061
2082
  });
2062
2083
  }
2063
2084
  }
@@ -2090,17 +2111,17 @@ class WebPubSubServiceClient {
2090
2111
  expiresIn: (options === null || options === void 0 ? void 0 : options.expirationTimeInMinutes) === undefined
2091
2112
  ? "1h"
2092
2113
  : `${options.expirationTimeInMinutes}m`,
2093
- algorithm: "HS256"
2114
+ algorithm: "HS256",
2094
2115
  };
2095
2116
  if (options === null || options === void 0 ? void 0 : options.userId) {
2096
2117
  signOptions.subject = options === null || options === void 0 ? void 0 : options.userId;
2097
2118
  }
2098
- token = jwt.sign(payload, key, signOptions);
2119
+ token = jwt__default["default"].sign(payload, key, signOptions);
2099
2120
  }
2100
2121
  return {
2101
2122
  token,
2102
2123
  baseUrl,
2103
- url: `${baseUrl}?access_token=${token}`
2124
+ url: `${baseUrl}?access_token=${token}`,
2104
2125
  };
2105
2126
  }
2106
2127
  finally {
@@ -2111,9 +2132,7 @@ class WebPubSubServiceClient {
2111
2132
 
2112
2133
  Object.defineProperty(exports, 'AzureKeyCredential', {
2113
2134
  enumerable: true,
2114
- get: function () {
2115
- return coreAuth.AzureKeyCredential;
2116
- }
2135
+ get: function () { return coreAuth.AzureKeyCredential; }
2117
2136
  });
2118
2137
  exports.WebPubSubServiceClient = WebPubSubServiceClient;
2119
2138
  //# sourceMappingURL=index.js.map