@seamapi/http 0.9.2 → 0.10.0

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.
Files changed (41) hide show
  1. package/README.md +36 -0
  2. package/dist/connect.cjs +269 -2
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +70 -3
  5. package/lib/seam/connect/routes/acs-credential-pools.d.ts +19 -0
  6. package/lib/seam/connect/routes/acs-credential-pools.js +73 -0
  7. package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -0
  8. package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +19 -0
  9. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +73 -0
  10. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -0
  11. package/lib/seam/connect/routes/acs-credentials.d.ts +6 -2
  12. package/lib/seam/connect/routes/acs-credentials.js +12 -2
  13. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  14. package/lib/seam/connect/routes/acs-entrances.d.ts +23 -0
  15. package/lib/seam/connect/routes/acs-entrances.js +81 -0
  16. package/lib/seam/connect/routes/acs-entrances.js.map +1 -0
  17. package/lib/seam/connect/routes/acs.d.ts +6 -0
  18. package/lib/seam/connect/routes/acs.js +12 -0
  19. package/lib/seam/connect/routes/acs.js.map +1 -1
  20. package/lib/seam/connect/routes/index.d.ts +3 -0
  21. package/lib/seam/connect/routes/index.js +3 -0
  22. package/lib/seam/connect/routes/index.js.map +1 -1
  23. package/lib/seam/connect/routes/user-identities.d.ts +5 -1
  24. package/lib/seam/connect/routes/user-identities.js +8 -0
  25. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  26. package/lib/seam/connect/routes/workspaces.d.ts +4 -0
  27. package/lib/seam/connect/routes/workspaces.js +8 -0
  28. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  29. package/lib/version.d.ts +1 -1
  30. package/lib/version.js +1 -1
  31. package/lib/version.js.map +1 -1
  32. package/package.json +4 -4
  33. package/src/lib/seam/connect/routes/acs-credential-pools.ts +154 -0
  34. package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +162 -0
  35. package/src/lib/seam/connect/routes/acs-credentials.ts +33 -4
  36. package/src/lib/seam/connect/routes/acs-entrances.ts +173 -0
  37. package/src/lib/seam/connect/routes/acs.ts +18 -0
  38. package/src/lib/seam/connect/routes/index.ts +3 -0
  39. package/src/lib/seam/connect/routes/user-identities.ts +26 -1
  40. package/src/lib/seam/connect/routes/workspaces.ts +20 -0
  41. package/src/lib/version.ts +1 -1
package/README.md CHANGED
@@ -22,11 +22,17 @@ The underlying HTTP client is [Axios].
22
22
 
23
23
  [Seam]: https://www.seam.co/
24
24
  [Seam Docs]: https://docs.seam.co/latest/
25
+ [seamapi]: https://www.npmjs.com/package/seamapi
25
26
  [@seamapi/types]: https://github.com/seamapi/types/
26
27
  [Axios]: https://axios-http.com/
27
28
 
28
29
  ## Installation
29
30
 
31
+ _This is a low-level package meant for applications and libraries with particular dependency requirements.
32
+ Before using this package, ensure you understand the installation and updating instructions.
33
+ This SDK is entirely contained in the [seamapi] package. Seam recommends using that package instead
34
+ for simpler dependency management._
35
+
30
36
  Add this as a dependency to your project using [npm] with
31
37
 
32
38
  ```
@@ -35,6 +41,36 @@ $ npm install @seamapi/http
35
41
 
36
42
  [npm]: https://www.npmjs.com/
37
43
 
44
+ ### Optional Peer Dependencies for TypeScript
45
+
46
+ This package has optional peer dependencies for TypeScript users.
47
+ Recent versions of npm will automatically install peer dependencies by default.
48
+ For those users, no additional steps are necessary for full TypeScript support,
49
+ however users should still explicitly install the latest types (see the next section).
50
+
51
+ Other package managers require peer dependencies to be added manually.
52
+ Refer to any warnings generated by your package manager
53
+ about missing peer dependencies and install them as needed.
54
+ Refer to the next section for keeping the types updated.
55
+
56
+ #### Keeping up with the latest types
57
+
58
+ This package depends on [@seamapi/types] for the latest TypeScript types.
59
+ New versions of this SDK are generally not released when new types are published.
60
+ Unless your project frequently runs a blanket `npm update`,
61
+ the types will become outdated with the Seam API over time.
62
+ Thus, users of this package should explicitly install the types with
63
+
64
+ ```
65
+ $ npm install -D @seamapi/types
66
+ ```
67
+
68
+ and update them when consuming new API features with
69
+
70
+ ```
71
+ $ npm install -D @seamapi/http@latest
72
+ ```
73
+
38
74
  ## Usage
39
75
 
40
76
  ```ts
package/dist/connect.cjs CHANGED
@@ -1097,6 +1097,153 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
1097
1097
  }
1098
1098
  };
1099
1099
 
1100
+ // src/lib/seam/connect/routes/acs-credential-pools.ts
1101
+ var SeamHttpAcsCredentialPools = class _SeamHttpAcsCredentialPools {
1102
+ constructor(apiKeyOrOptions = {}) {
1103
+ const options = parseOptions(apiKeyOrOptions);
1104
+ this.client = "client" in options ? options.client : createClient(options);
1105
+ this.defaults = limitToSeamHttpRequestOptions(options);
1106
+ }
1107
+ static fromClient(client, options = {}) {
1108
+ const constructorOptions = { ...options, client };
1109
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
1110
+ throw new SeamHttpInvalidOptionsError("Missing client");
1111
+ }
1112
+ return new _SeamHttpAcsCredentialPools(constructorOptions);
1113
+ }
1114
+ static fromApiKey(apiKey, options = {}) {
1115
+ const constructorOptions = { ...options, apiKey };
1116
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
1117
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1118
+ }
1119
+ return new _SeamHttpAcsCredentialPools(constructorOptions);
1120
+ }
1121
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1122
+ const constructorOptions = { ...options, clientSessionToken };
1123
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
1124
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1125
+ }
1126
+ return new _SeamHttpAcsCredentialPools(constructorOptions);
1127
+ }
1128
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1129
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
1130
+ const clientOptions = parseOptions({ ...options, publishableKey });
1131
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1132
+ throw new SeamHttpInvalidOptionsError(
1133
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1134
+ );
1135
+ }
1136
+ const client = createClient(clientOptions);
1137
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
1138
+ const { token } = await clientSessions.getOrCreate({
1139
+ user_identifier_key: userIdentifierKey
1140
+ });
1141
+ return _SeamHttpAcsCredentialPools.fromClientSessionToken(token, options);
1142
+ }
1143
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
1144
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
1145
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
1146
+ throw new SeamHttpInvalidOptionsError(
1147
+ "Missing consoleSessionToken or workspaceId"
1148
+ );
1149
+ }
1150
+ return new _SeamHttpAcsCredentialPools(constructorOptions);
1151
+ }
1152
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
1153
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
1154
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
1155
+ throw new SeamHttpInvalidOptionsError(
1156
+ "Missing personalAccessToken or workspaceId"
1157
+ );
1158
+ }
1159
+ return new _SeamHttpAcsCredentialPools(constructorOptions);
1160
+ }
1161
+ async list(body) {
1162
+ const { data } = await this.client.request({
1163
+ url: "/acs/credential_pools/list",
1164
+ method: "post",
1165
+ data: body
1166
+ });
1167
+ return data.acs_credential_pools;
1168
+ }
1169
+ };
1170
+
1171
+ // src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts
1172
+ var SeamHttpAcsCredentialProvisioningAutomations = class _SeamHttpAcsCredentialProvisioningAutomations {
1173
+ constructor(apiKeyOrOptions = {}) {
1174
+ const options = parseOptions(apiKeyOrOptions);
1175
+ this.client = "client" in options ? options.client : createClient(options);
1176
+ this.defaults = limitToSeamHttpRequestOptions(options);
1177
+ }
1178
+ static fromClient(client, options = {}) {
1179
+ const constructorOptions = { ...options, client };
1180
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
1181
+ throw new SeamHttpInvalidOptionsError("Missing client");
1182
+ }
1183
+ return new _SeamHttpAcsCredentialProvisioningAutomations(constructorOptions);
1184
+ }
1185
+ static fromApiKey(apiKey, options = {}) {
1186
+ const constructorOptions = { ...options, apiKey };
1187
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
1188
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1189
+ }
1190
+ return new _SeamHttpAcsCredentialProvisioningAutomations(constructorOptions);
1191
+ }
1192
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1193
+ const constructorOptions = { ...options, clientSessionToken };
1194
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
1195
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1196
+ }
1197
+ return new _SeamHttpAcsCredentialProvisioningAutomations(constructorOptions);
1198
+ }
1199
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1200
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
1201
+ const clientOptions = parseOptions({ ...options, publishableKey });
1202
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1203
+ throw new SeamHttpInvalidOptionsError(
1204
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1205
+ );
1206
+ }
1207
+ const client = createClient(clientOptions);
1208
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
1209
+ const { token } = await clientSessions.getOrCreate({
1210
+ user_identifier_key: userIdentifierKey
1211
+ });
1212
+ return _SeamHttpAcsCredentialProvisioningAutomations.fromClientSessionToken(
1213
+ token,
1214
+ options
1215
+ );
1216
+ }
1217
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
1218
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
1219
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
1220
+ throw new SeamHttpInvalidOptionsError(
1221
+ "Missing consoleSessionToken or workspaceId"
1222
+ );
1223
+ }
1224
+ return new _SeamHttpAcsCredentialProvisioningAutomations(constructorOptions);
1225
+ }
1226
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
1227
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
1228
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
1229
+ throw new SeamHttpInvalidOptionsError(
1230
+ "Missing personalAccessToken or workspaceId"
1231
+ );
1232
+ }
1233
+ return new _SeamHttpAcsCredentialProvisioningAutomations(constructorOptions);
1234
+ }
1235
+ async launch(body) {
1236
+ const { data } = await this.client.request(
1237
+ {
1238
+ url: "/acs/credential_provisioning_automations/launch",
1239
+ method: "post",
1240
+ data: body
1241
+ }
1242
+ );
1243
+ return data.acs_credential_provisioning_automation;
1244
+ }
1245
+ };
1246
+
1100
1247
  // src/lib/seam/connect/routes/acs-credentials.ts
1101
1248
  var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1102
1249
  constructor(apiKeyOrOptions = {}) {
@@ -1159,11 +1306,12 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1159
1306
  return new _SeamHttpAcsCredentials(constructorOptions);
1160
1307
  }
1161
1308
  async assign(body) {
1162
- await this.client.request({
1309
+ const { data } = await this.client.request({
1163
1310
  url: "/acs/credentials/assign",
1164
1311
  method: "post",
1165
1312
  data: body
1166
1313
  });
1314
+ return data.acs_credential;
1167
1315
  }
1168
1316
  async create(body) {
1169
1317
  const { data } = await this.client.request({
@@ -1197,11 +1345,99 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1197
1345
  return data.acs_credentials;
1198
1346
  }
1199
1347
  async unassign(body) {
1200
- await this.client.request({
1348
+ const { data } = await this.client.request({
1201
1349
  url: "/acs/credentials/unassign",
1202
1350
  method: "post",
1203
1351
  data: body
1204
1352
  });
1353
+ return data.acs_credential;
1354
+ }
1355
+ async update(body) {
1356
+ const { data } = await this.client.request({
1357
+ url: "/acs/credentials/update",
1358
+ method: "post",
1359
+ data: body
1360
+ });
1361
+ return data.acs_credential;
1362
+ }
1363
+ };
1364
+
1365
+ // src/lib/seam/connect/routes/acs-entrances.ts
1366
+ var SeamHttpAcsEntrances = class _SeamHttpAcsEntrances {
1367
+ constructor(apiKeyOrOptions = {}) {
1368
+ const options = parseOptions(apiKeyOrOptions);
1369
+ this.client = "client" in options ? options.client : createClient(options);
1370
+ this.defaults = limitToSeamHttpRequestOptions(options);
1371
+ }
1372
+ static fromClient(client, options = {}) {
1373
+ const constructorOptions = { ...options, client };
1374
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
1375
+ throw new SeamHttpInvalidOptionsError("Missing client");
1376
+ }
1377
+ return new _SeamHttpAcsEntrances(constructorOptions);
1378
+ }
1379
+ static fromApiKey(apiKey, options = {}) {
1380
+ const constructorOptions = { ...options, apiKey };
1381
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
1382
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1383
+ }
1384
+ return new _SeamHttpAcsEntrances(constructorOptions);
1385
+ }
1386
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1387
+ const constructorOptions = { ...options, clientSessionToken };
1388
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
1389
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1390
+ }
1391
+ return new _SeamHttpAcsEntrances(constructorOptions);
1392
+ }
1393
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1394
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
1395
+ const clientOptions = parseOptions({ ...options, publishableKey });
1396
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1397
+ throw new SeamHttpInvalidOptionsError(
1398
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1399
+ );
1400
+ }
1401
+ const client = createClient(clientOptions);
1402
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
1403
+ const { token } = await clientSessions.getOrCreate({
1404
+ user_identifier_key: userIdentifierKey
1405
+ });
1406
+ return _SeamHttpAcsEntrances.fromClientSessionToken(token, options);
1407
+ }
1408
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
1409
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
1410
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
1411
+ throw new SeamHttpInvalidOptionsError(
1412
+ "Missing consoleSessionToken or workspaceId"
1413
+ );
1414
+ }
1415
+ return new _SeamHttpAcsEntrances(constructorOptions);
1416
+ }
1417
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
1418
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
1419
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
1420
+ throw new SeamHttpInvalidOptionsError(
1421
+ "Missing personalAccessToken or workspaceId"
1422
+ );
1423
+ }
1424
+ return new _SeamHttpAcsEntrances(constructorOptions);
1425
+ }
1426
+ async get(body) {
1427
+ const { data } = await this.client.request({
1428
+ url: "/acs/entrances/get",
1429
+ method: "post",
1430
+ data: body
1431
+ });
1432
+ return data.acs_entrance;
1433
+ }
1434
+ async list(body) {
1435
+ const { data } = await this.client.request({
1436
+ url: "/acs/entrances/list",
1437
+ method: "post",
1438
+ data: body
1439
+ });
1440
+ return data.acs_entrances;
1205
1441
  }
1206
1442
  };
1207
1443
 
@@ -1477,9 +1713,21 @@ var SeamHttpAcs = class _SeamHttpAcs {
1477
1713
  get accessGroups() {
1478
1714
  return SeamHttpAcsAccessGroups.fromClient(this.client, this.defaults);
1479
1715
  }
1716
+ get credentialPools() {
1717
+ return SeamHttpAcsCredentialPools.fromClient(this.client, this.defaults);
1718
+ }
1719
+ get credentialProvisioningAutomations() {
1720
+ return SeamHttpAcsCredentialProvisioningAutomations.fromClient(
1721
+ this.client,
1722
+ this.defaults
1723
+ );
1724
+ }
1480
1725
  get credentials() {
1481
1726
  return SeamHttpAcsCredentials.fromClient(this.client, this.defaults);
1482
1727
  }
1728
+ get entrances() {
1729
+ return SeamHttpAcsEntrances.fromClient(this.client, this.defaults);
1730
+ }
1483
1731
  get systems() {
1484
1732
  return SeamHttpAcsSystems.fromClient(this.client, this.defaults);
1485
1733
  }
@@ -2653,6 +2901,14 @@ var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2653
2901
  data: body
2654
2902
  });
2655
2903
  }
2904
+ async list(params) {
2905
+ const { data } = await this.client.request({
2906
+ url: "/user_identities/list",
2907
+ method: "get",
2908
+ params
2909
+ });
2910
+ return data.user_identities;
2911
+ }
2656
2912
  async listAccessibleDevices(body) {
2657
2913
  const { data } = await this.client.request({
2658
2914
  url: "/user_identities/list_accessible_devices",
@@ -2840,6 +3096,14 @@ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
2840
3096
  }
2841
3097
  return new _SeamHttpWorkspaces(constructorOptions);
2842
3098
  }
3099
+ async create(body) {
3100
+ const { data } = await this.client.request({
3101
+ url: "/workspaces/create",
3102
+ method: "post",
3103
+ data: body
3104
+ });
3105
+ return data.workspace;
3106
+ }
2843
3107
  async get(params) {
2844
3108
  const { data } = await this.client.request({
2845
3109
  url: "/workspaces/get",
@@ -3019,7 +3283,10 @@ exports.SeamHttpAccessCodes = SeamHttpAccessCodes;
3019
3283
  exports.SeamHttpAccessCodesUnmanaged = SeamHttpAccessCodesUnmanaged;
3020
3284
  exports.SeamHttpAcs = SeamHttpAcs;
3021
3285
  exports.SeamHttpAcsAccessGroups = SeamHttpAcsAccessGroups;
3286
+ exports.SeamHttpAcsCredentialPools = SeamHttpAcsCredentialPools;
3287
+ exports.SeamHttpAcsCredentialProvisioningAutomations = SeamHttpAcsCredentialProvisioningAutomations;
3022
3288
  exports.SeamHttpAcsCredentials = SeamHttpAcsCredentials;
3289
+ exports.SeamHttpAcsEntrances = SeamHttpAcsEntrances;
3023
3290
  exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
3024
3291
  exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
3025
3292
  exports.SeamHttpActionAttempts = SeamHttpActionAttempts;