@seamapi/http 1.26.1 → 1.28.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 +6 -1
- package/dist/connect.cjs +24 -1
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +18 -16
- package/lib/seam/connect/options.d.ts +3 -1
- package/lib/seam/connect/options.js.map +1 -1
- package/lib/seam/connect/parse-options.js +29 -1
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/resolve-action-attempt.d.ts +16 -16
- package/lib/seam/connect/seam-http-multi-workspace.d.ts +1 -1
- package/lib/seam/connect/seam-http-multi-workspace.js +1 -1
- package/lib/seam/connect/seam-http-multi-workspace.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/connect/options.ts +4 -0
- package/src/lib/seam/connect/parse-options.ts +42 -0
- package/src/lib/seam/connect/seam-http-multi-workspace.ts +1 -1
- package/src/lib/version.ts +1 -1
package/README.md
CHANGED
|
@@ -174,8 +174,10 @@ A workspace ID must be provided when using this method
|
|
|
174
174
|
and all requests will be scoped to that workspace.
|
|
175
175
|
|
|
176
176
|
```ts
|
|
177
|
-
//
|
|
177
|
+
// Set the `SEAM_PERSONAL_ACCESS_TOKEN` and `SEAM_WORKSPACE_ID` environment variables
|
|
178
|
+
const seam = new SeamHttp()
|
|
178
179
|
|
|
180
|
+
// Pass as an option to the constructor
|
|
179
181
|
const seam = new SeamHttp({
|
|
180
182
|
personalAccessToken: 'your-personal-access-token',
|
|
181
183
|
workspaceId: 'your-workspace-id',
|
|
@@ -407,6 +409,9 @@ A Personal Access Token is scoped to a Seam Console user.
|
|
|
407
409
|
Obtain one from the Seam Console.
|
|
408
410
|
|
|
409
411
|
```ts
|
|
412
|
+
// Set the `SEAM_PERSONAL_ACCESS_TOKEN` environment variable
|
|
413
|
+
const seam = new SeamHttpMultiWorkspace()
|
|
414
|
+
|
|
410
415
|
// Pass as an option to the constructor
|
|
411
416
|
const seam = new SeamHttpMultiWorkspace({
|
|
412
417
|
personalAccessToken: 'your-personal-access-token',
|
package/dist/connect.cjs
CHANGED
|
@@ -67,9 +67,17 @@ var getNormalizedOptions = (apiKeyOrOptions) => {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
const apiKey = "apiKey" in options ? options.apiKey : getApiKeyFromEnv(options);
|
|
70
|
+
const personalAccessToken = "personalAccessToken" in options ? options.personalAccessToken : getPersonalAccessTokenFromEnv(options);
|
|
71
|
+
const workspaceId = "workspaceId" in options ? options.workspaceId : getWorkspaceIdFromEnv();
|
|
72
|
+
if (apiKey != null && personalAccessToken != null && !("apiKey" in options) && !("personalAccessToken" in options)) {
|
|
73
|
+
throw new SeamHttpInvalidOptionsError(
|
|
74
|
+
"Both SEAM_API_KEY and SEAM_PERSONAL_ACCESS_TOKEN environment variables are defined. Please use only one authentication method."
|
|
75
|
+
);
|
|
76
|
+
}
|
|
70
77
|
return {
|
|
71
78
|
...options,
|
|
72
79
|
...apiKey != null ? { apiKey } : {},
|
|
80
|
+
...personalAccessToken != null && workspaceId != null ? { personalAccessToken, workspaceId } : {},
|
|
73
81
|
...requestOptions
|
|
74
82
|
};
|
|
75
83
|
};
|
|
@@ -85,6 +93,21 @@ var getApiKeyFromEnv = (options) => {
|
|
|
85
93
|
}
|
|
86
94
|
return globalThis.process?.env?.SEAM_API_KEY;
|
|
87
95
|
};
|
|
96
|
+
var getPersonalAccessTokenFromEnv = (options) => {
|
|
97
|
+
if ("apiKey" in options && options.apiKey != null) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return globalThis.process?.env?.["SEAM_PERSONAL_ACCESS_TOKEN"];
|
|
107
|
+
};
|
|
108
|
+
var getWorkspaceIdFromEnv = () => {
|
|
109
|
+
return globalThis.process?.env?.["SEAM_WORKSPACE_ID"];
|
|
110
|
+
};
|
|
88
111
|
var getEndpointFromEnv = () => {
|
|
89
112
|
if (globalThis.process?.env?.SEAM_API_URL != null) {
|
|
90
113
|
console.warn(
|
|
@@ -4997,7 +5020,7 @@ var SeamHttp = _SeamHttp;
|
|
|
4997
5020
|
|
|
4998
5021
|
// src/lib/seam/connect/seam-http-multi-workspace.ts
|
|
4999
5022
|
var SeamHttpMultiWorkspace = class _SeamHttpMultiWorkspace {
|
|
5000
|
-
constructor(options) {
|
|
5023
|
+
constructor(options = {}) {
|
|
5001
5024
|
const opts = parseOptions(options);
|
|
5002
5025
|
this.client = "client" in opts ? opts.client : createClient(opts);
|
|
5003
5026
|
this.defaults = limitToSeamHttpRequestOptions(opts);
|