@seamapi/http 1.39.1 → 1.40.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.
- package/README.md +8 -8
- package/dist/connect.cjs +86 -25
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +41 -20
- package/lib/seam/connect/auth.js +3 -3
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/index.d.ts +0 -1
- package/lib/seam/connect/index.js +0 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/options.d.ts +9 -9
- package/lib/seam/connect/options.js +7 -7
- package/lib/seam/connect/options.js.map +1 -1
- package/lib/seam/connect/parse-options.d.ts +2 -2
- package/lib/seam/connect/parse-options.js +2 -2
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +2 -0
- package/lib/seam/connect/routes/index.js +2 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.d.ts +17 -0
- package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js +54 -0
- package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js.map +1 -0
- package/lib/seam/connect/routes/seam-http-without-workspace.d.ts +18 -0
- package/lib/seam/connect/routes/seam-http-without-workspace.js +47 -0
- package/lib/seam/connect/routes/seam-http-without-workspace.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/connect/auth.ts +8 -8
- package/src/lib/seam/connect/index.ts +0 -1
- package/src/lib/seam/connect/options.ts +19 -19
- package/src/lib/seam/connect/parse-options.ts +4 -4
- package/src/lib/seam/connect/routes/index.ts +2 -0
- package/src/lib/seam/connect/routes/seam-http-endpoints-without-workspace.ts +126 -0
- package/src/lib/seam/connect/routes/seam-http-without-workspace.ts +96 -0
- package/src/lib/version.ts +1 -1
- package/lib/seam/connect/seam-http-multi-workspace.d.ts +0 -12
- package/lib/seam/connect/seam-http-multi-workspace.js +0 -36
- package/lib/seam/connect/seam-http-multi-workspace.js.map +0 -1
- package/src/lib/seam/connect/seam-http-multi-workspace.ts +0 -80
package/README.md
CHANGED
|
@@ -397,10 +397,10 @@ const pages = seam.createPaginator(
|
|
|
397
397
|
const devices = await pages.flattenToArray()
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
-
###
|
|
400
|
+
### Requests without a Workspace in scope
|
|
401
401
|
|
|
402
|
-
Some Seam API endpoints
|
|
403
|
-
The `
|
|
402
|
+
Some Seam API endpoints do not require a workspace in scope.
|
|
403
|
+
The `SeamHttpWithoutWorkspace` client is not bound to a specific workspace
|
|
404
404
|
and may use those endpoints with an appropriate authentication method.
|
|
405
405
|
|
|
406
406
|
#### Personal Access Token
|
|
@@ -410,15 +410,15 @@ Obtain one from the Seam Console.
|
|
|
410
410
|
|
|
411
411
|
```ts
|
|
412
412
|
// Set the `SEAM_PERSONAL_ACCESS_TOKEN` environment variable
|
|
413
|
-
const seam = new
|
|
413
|
+
const seam = new SeamHttpWithoutWorkspace()
|
|
414
414
|
|
|
415
415
|
// Pass as an option to the constructor
|
|
416
|
-
const seam = new
|
|
416
|
+
const seam = new SeamHttpWithoutWorkspace({
|
|
417
417
|
personalAccessToken: 'your-personal-access-token',
|
|
418
418
|
})
|
|
419
419
|
|
|
420
420
|
// Use the factory method
|
|
421
|
-
const seam =
|
|
421
|
+
const seam = SeamHttpWithoutWorkspace.fromPersonalAccessToken(
|
|
422
422
|
'some-console-session-token',
|
|
423
423
|
)
|
|
424
424
|
|
|
@@ -433,12 +433,12 @@ This authentication method is only used by internal Seam applications.
|
|
|
433
433
|
|
|
434
434
|
```ts
|
|
435
435
|
// Pass as an option to the constructor
|
|
436
|
-
const seam = new
|
|
436
|
+
const seam = new SeamHttpWithoutWorkspace({
|
|
437
437
|
consoleSessionToken: 'some-console-session-token',
|
|
438
438
|
})
|
|
439
439
|
|
|
440
440
|
// Use the factory method
|
|
441
|
-
const seam =
|
|
441
|
+
const seam = SeamHttpWithoutWorkspace.fromConsoleSessionToken(
|
|
442
442
|
'some-console-session-token',
|
|
443
443
|
)
|
|
444
444
|
|
package/dist/connect.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var sdkHeaders = {
|
|
|
35
35
|
var parseOptions = (apiKeyOrOptions) => {
|
|
36
36
|
const options = getNormalizedOptions(apiKeyOrOptions);
|
|
37
37
|
if (isSeamHttpOptionsWithClient(options)) return options;
|
|
38
|
-
if (
|
|
38
|
+
if (isSeamHttpWithoutWorkspaceOptionsWithClient(options)) return options;
|
|
39
39
|
return {
|
|
40
40
|
...options,
|
|
41
41
|
axiosOptions: {
|
|
@@ -139,7 +139,7 @@ var isSeamHttpRequestOption = (key) => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// src/lib/seam/connect/options.ts
|
|
142
|
-
var
|
|
142
|
+
var isSeamHttpWithoutWorkspaceOptionsWithClient = (options) => isSeamHttpOptionsWithClient(options);
|
|
143
143
|
var isSeamHttpOptionsWithClient = (options) => {
|
|
144
144
|
if (!("client" in options)) return false;
|
|
145
145
|
if (options.client == null) return false;
|
|
@@ -193,7 +193,7 @@ var isSeamHttpOptionsWithClientSessionToken = (options) => {
|
|
|
193
193
|
}
|
|
194
194
|
return true;
|
|
195
195
|
};
|
|
196
|
-
var
|
|
196
|
+
var isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken = (options) => {
|
|
197
197
|
if (!("consoleSessionToken" in options)) return false;
|
|
198
198
|
if (options.consoleSessionToken == null) return false;
|
|
199
199
|
if ("apiKey" in options && options.apiKey != null) {
|
|
@@ -214,7 +214,7 @@ var isSeamHttpMultiWorkspaceOptionsWithConsoleSessionToken = (options) => {
|
|
|
214
214
|
return true;
|
|
215
215
|
};
|
|
216
216
|
var isSeamHttpOptionsWithConsoleSessionToken = (options) => {
|
|
217
|
-
if (!
|
|
217
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken(options)) {
|
|
218
218
|
return false;
|
|
219
219
|
}
|
|
220
220
|
if (!("workspaceId" in options) || options.workspaceId == null) {
|
|
@@ -224,7 +224,7 @@ var isSeamHttpOptionsWithConsoleSessionToken = (options) => {
|
|
|
224
224
|
}
|
|
225
225
|
return true;
|
|
226
226
|
};
|
|
227
|
-
var
|
|
227
|
+
var isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken = (options) => {
|
|
228
228
|
if (!("personalAccessToken" in options)) return false;
|
|
229
229
|
if (options.personalAccessToken == null) return false;
|
|
230
230
|
if ("apiKey" in options && options.apiKey != null) {
|
|
@@ -245,7 +245,7 @@ var isSeamHttpMultiWorkspaceOptionsWithPersonalAccessToken = (options) => {
|
|
|
245
245
|
return true;
|
|
246
246
|
};
|
|
247
247
|
var isSeamHttpOptionsWithPersonalAccessToken = (options) => {
|
|
248
|
-
if (!
|
|
248
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken(options)) {
|
|
249
249
|
return false;
|
|
250
250
|
}
|
|
251
251
|
if (!("workspaceId" in options) || options.workspaceId == null) {
|
|
@@ -261,9 +261,9 @@ var SeamHttpInvalidOptionsError = class extends Error {
|
|
|
261
261
|
this.name = this.constructor.name;
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
|
-
var
|
|
264
|
+
var SeamHttpWithoutWorkspaceInvalidOptionsError = class extends Error {
|
|
265
265
|
constructor(message) {
|
|
266
|
-
super(`
|
|
266
|
+
super(`SeamHttpWithoutWorkspace received invalid options: ${message}`);
|
|
267
267
|
this.name = this.constructor.name;
|
|
268
268
|
}
|
|
269
269
|
};
|
|
@@ -294,10 +294,10 @@ var getAuthHeaders = (options) => {
|
|
|
294
294
|
if (isSeamHttpOptionsWithClientSessionToken(options)) {
|
|
295
295
|
return getAuthHeadersForClientSessionToken(options);
|
|
296
296
|
}
|
|
297
|
-
if (
|
|
297
|
+
if (isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken(options) || isSeamHttpOptionsWithConsoleSessionToken(options)) {
|
|
298
298
|
return getAuthHeadersForConsoleSessionToken(options);
|
|
299
299
|
}
|
|
300
|
-
if (
|
|
300
|
+
if (isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken(options) || isSeamHttpOptionsWithPersonalAccessToken(options)) {
|
|
301
301
|
return getAuthHeadersForPersonalAccessToken(options);
|
|
302
302
|
}
|
|
303
303
|
throw new SeamHttpInvalidOptionsError(
|
|
@@ -9720,46 +9720,105 @@ var _SeamHttpEndpoints = class _SeamHttpEndpoints {
|
|
|
9720
9720
|
_SeamHttpEndpoints.ltsVersion = seamApiLtsVersion;
|
|
9721
9721
|
var SeamHttpEndpoints = _SeamHttpEndpoints;
|
|
9722
9722
|
|
|
9723
|
-
// src/lib/seam/connect/seam-http-
|
|
9724
|
-
var
|
|
9723
|
+
// src/lib/seam/connect/routes/seam-http-endpoints-without-workspace.ts
|
|
9724
|
+
var _SeamHttpEndpointsWithoutWorkspace = class _SeamHttpEndpointsWithoutWorkspace {
|
|
9725
9725
|
constructor(options = {}) {
|
|
9726
|
+
this.ltsVersion = seamApiLtsVersion;
|
|
9727
|
+
const opts = parseOptions(options);
|
|
9728
|
+
this.client = "client" in opts ? opts.client : createClient(opts);
|
|
9729
|
+
this.defaults = limitToSeamHttpRequestOptions(opts);
|
|
9730
|
+
}
|
|
9731
|
+
static fromClient(client, options = {}) {
|
|
9732
|
+
const constructorOptions = { ...options, client };
|
|
9733
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithClient(constructorOptions)) {
|
|
9734
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError("Missing client");
|
|
9735
|
+
}
|
|
9736
|
+
return new _SeamHttpEndpointsWithoutWorkspace(constructorOptions);
|
|
9737
|
+
}
|
|
9738
|
+
static fromConsoleSessionToken(consoleSessionToken, options = {}) {
|
|
9739
|
+
const constructorOptions = { ...options, consoleSessionToken };
|
|
9740
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken(
|
|
9741
|
+
constructorOptions
|
|
9742
|
+
)) {
|
|
9743
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError(
|
|
9744
|
+
"Missing consoleSessionToken"
|
|
9745
|
+
);
|
|
9746
|
+
}
|
|
9747
|
+
return new _SeamHttpEndpointsWithoutWorkspace(constructorOptions);
|
|
9748
|
+
}
|
|
9749
|
+
static fromPersonalAccessToken(personalAccessToken, options = {}) {
|
|
9750
|
+
const constructorOptions = { ...options, personalAccessToken };
|
|
9751
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken(
|
|
9752
|
+
constructorOptions
|
|
9753
|
+
)) {
|
|
9754
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError(
|
|
9755
|
+
"Missing personalAccessToken"
|
|
9756
|
+
);
|
|
9757
|
+
}
|
|
9758
|
+
return new _SeamHttpEndpointsWithoutWorkspace(constructorOptions);
|
|
9759
|
+
}
|
|
9760
|
+
get ["/workspaces/create"]() {
|
|
9761
|
+
const { client, defaults } = this;
|
|
9762
|
+
return function workspacesCreate(...args) {
|
|
9763
|
+
const seam = SeamHttpWorkspaces.fromClient(client, defaults);
|
|
9764
|
+
return seam.create(...args);
|
|
9765
|
+
};
|
|
9766
|
+
}
|
|
9767
|
+
get ["/workspaces/list"]() {
|
|
9768
|
+
const { client, defaults } = this;
|
|
9769
|
+
return function workspacesList(...args) {
|
|
9770
|
+
const seam = SeamHttpWorkspaces.fromClient(client, defaults);
|
|
9771
|
+
return seam.list(...args);
|
|
9772
|
+
};
|
|
9773
|
+
}
|
|
9774
|
+
};
|
|
9775
|
+
_SeamHttpEndpointsWithoutWorkspace.ltsVersion = seamApiLtsVersion;
|
|
9776
|
+
var SeamHttpEndpointsWithoutWorkspace = _SeamHttpEndpointsWithoutWorkspace;
|
|
9777
|
+
|
|
9778
|
+
// src/lib/seam/connect/routes/seam-http-without-workspace.ts
|
|
9779
|
+
var _SeamHttpWithoutWorkspace = class _SeamHttpWithoutWorkspace {
|
|
9780
|
+
constructor(options = {}) {
|
|
9781
|
+
this.ltsVersion = seamApiLtsVersion;
|
|
9726
9782
|
const opts = parseOptions(options);
|
|
9727
9783
|
this.client = "client" in opts ? opts.client : createClient(opts);
|
|
9728
9784
|
this.defaults = limitToSeamHttpRequestOptions(opts);
|
|
9729
9785
|
}
|
|
9730
9786
|
static fromClient(client, options = {}) {
|
|
9731
9787
|
const constructorOptions = { ...options, client };
|
|
9732
|
-
if (!
|
|
9733
|
-
throw new
|
|
9788
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithClient(constructorOptions)) {
|
|
9789
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError("Missing client");
|
|
9734
9790
|
}
|
|
9735
|
-
return new
|
|
9791
|
+
return new _SeamHttpWithoutWorkspace(constructorOptions);
|
|
9736
9792
|
}
|
|
9737
9793
|
static fromConsoleSessionToken(consoleSessionToken, options = {}) {
|
|
9738
9794
|
const constructorOptions = { ...options, consoleSessionToken };
|
|
9739
|
-
if (!
|
|
9795
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken(
|
|
9740
9796
|
constructorOptions
|
|
9741
9797
|
)) {
|
|
9742
|
-
throw new
|
|
9798
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError(
|
|
9743
9799
|
"Missing consoleSessionToken"
|
|
9744
9800
|
);
|
|
9745
9801
|
}
|
|
9746
|
-
return new
|
|
9802
|
+
return new _SeamHttpWithoutWorkspace(constructorOptions);
|
|
9747
9803
|
}
|
|
9748
9804
|
static fromPersonalAccessToken(personalAccessToken, options = {}) {
|
|
9749
9805
|
const constructorOptions = { ...options, personalAccessToken };
|
|
9750
|
-
if (!
|
|
9806
|
+
if (!isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken(
|
|
9751
9807
|
constructorOptions
|
|
9752
9808
|
)) {
|
|
9753
|
-
throw new
|
|
9809
|
+
throw new SeamHttpWithoutWorkspaceInvalidOptionsError(
|
|
9754
9810
|
"Missing personalAccessToken"
|
|
9755
9811
|
);
|
|
9756
9812
|
}
|
|
9757
|
-
return new
|
|
9813
|
+
return new _SeamHttpWithoutWorkspace(constructorOptions);
|
|
9758
9814
|
}
|
|
9759
9815
|
get workspaces() {
|
|
9760
9816
|
return SeamHttpWorkspaces.fromClient(this.client, this.defaults);
|
|
9761
9817
|
}
|
|
9762
9818
|
};
|
|
9819
|
+
_SeamHttpWithoutWorkspace.ltsVersion = seamApiLtsVersion;
|
|
9820
|
+
var SeamHttpWithoutWorkspace = _SeamHttpWithoutWorkspace;
|
|
9821
|
+
var SeamHttpMultiWorkspace = SeamHttpWithoutWorkspace;
|
|
9763
9822
|
|
|
9764
9823
|
exports.SeamActionAttemptError = SeamActionAttemptError;
|
|
9765
9824
|
exports.SeamActionAttemptFailedError = SeamActionAttemptFailedError;
|
|
@@ -9793,6 +9852,7 @@ exports.SeamHttpDevices = SeamHttpDevices;
|
|
|
9793
9852
|
exports.SeamHttpDevicesSimulate = SeamHttpDevicesSimulate;
|
|
9794
9853
|
exports.SeamHttpDevicesUnmanaged = SeamHttpDevicesUnmanaged;
|
|
9795
9854
|
exports.SeamHttpEndpoints = SeamHttpEndpoints;
|
|
9855
|
+
exports.SeamHttpEndpointsWithoutWorkspace = SeamHttpEndpointsWithoutWorkspace;
|
|
9796
9856
|
exports.SeamHttpEvents = SeamHttpEvents;
|
|
9797
9857
|
exports.SeamHttpInvalidInputError = SeamHttpInvalidInputError;
|
|
9798
9858
|
exports.SeamHttpInvalidOptionsError = SeamHttpInvalidOptionsError;
|
|
@@ -9800,7 +9860,6 @@ exports.SeamHttpInvalidTokenError = SeamHttpInvalidTokenError;
|
|
|
9800
9860
|
exports.SeamHttpLocks = SeamHttpLocks;
|
|
9801
9861
|
exports.SeamHttpLocksSimulate = SeamHttpLocksSimulate;
|
|
9802
9862
|
exports.SeamHttpMultiWorkspace = SeamHttpMultiWorkspace;
|
|
9803
|
-
exports.SeamHttpMultiWorkspaceInvalidOptionsError = SeamHttpMultiWorkspaceInvalidOptionsError;
|
|
9804
9863
|
exports.SeamHttpNetworks = SeamHttpNetworks;
|
|
9805
9864
|
exports.SeamHttpNoiseSensors = SeamHttpNoiseSensors;
|
|
9806
9865
|
exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThresholds;
|
|
@@ -9827,6 +9886,8 @@ exports.SeamHttpUnstablePartnerResources = SeamHttpUnstablePartnerResources;
|
|
|
9827
9886
|
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
9828
9887
|
exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
|
|
9829
9888
|
exports.SeamHttpWebhooks = SeamHttpWebhooks;
|
|
9889
|
+
exports.SeamHttpWithoutWorkspace = SeamHttpWithoutWorkspace;
|
|
9890
|
+
exports.SeamHttpWithoutWorkspaceInvalidOptionsError = SeamHttpWithoutWorkspaceInvalidOptionsError;
|
|
9830
9891
|
exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
|
|
9831
9892
|
exports.SeamPaginator = SeamPaginator;
|
|
9832
9893
|
exports.errorInterceptor = errorInterceptor;
|
|
@@ -9841,15 +9902,15 @@ exports.isSeamActionAttemptFailedError = isSeamActionAttemptFailedError;
|
|
|
9841
9902
|
exports.isSeamActionAttemptTimeoutError = isSeamActionAttemptTimeoutError;
|
|
9842
9903
|
exports.isSeamHttpApiError = isSeamHttpApiError;
|
|
9843
9904
|
exports.isSeamHttpInvalidInputError = isSeamHttpInvalidInputError;
|
|
9844
|
-
exports.isSeamHttpMultiWorkspaceOptionsWithClient = isSeamHttpMultiWorkspaceOptionsWithClient;
|
|
9845
|
-
exports.isSeamHttpMultiWorkspaceOptionsWithConsoleSessionToken = isSeamHttpMultiWorkspaceOptionsWithConsoleSessionToken;
|
|
9846
|
-
exports.isSeamHttpMultiWorkspaceOptionsWithPersonalAccessToken = isSeamHttpMultiWorkspaceOptionsWithPersonalAccessToken;
|
|
9847
9905
|
exports.isSeamHttpOptionsWithApiKey = isSeamHttpOptionsWithApiKey;
|
|
9848
9906
|
exports.isSeamHttpOptionsWithClient = isSeamHttpOptionsWithClient;
|
|
9849
9907
|
exports.isSeamHttpOptionsWithClientSessionToken = isSeamHttpOptionsWithClientSessionToken;
|
|
9850
9908
|
exports.isSeamHttpOptionsWithConsoleSessionToken = isSeamHttpOptionsWithConsoleSessionToken;
|
|
9851
9909
|
exports.isSeamHttpOptionsWithPersonalAccessToken = isSeamHttpOptionsWithPersonalAccessToken;
|
|
9852
9910
|
exports.isSeamHttpUnauthorizedError = isSeamHttpUnauthorizedError;
|
|
9911
|
+
exports.isSeamHttpWithoutWorkspaceOptionsWithClient = isSeamHttpWithoutWorkspaceOptionsWithClient;
|
|
9912
|
+
exports.isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken = isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken;
|
|
9913
|
+
exports.isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken = isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken;
|
|
9853
9914
|
Object.keys(urlSearchParamsSerializer).forEach(function (k) {
|
|
9854
9915
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9855
9916
|
enumerable: true,
|