@seamapi/http 0.11.0 → 0.12.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/dist/connect.cjs +26 -10
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +7 -1
- package/lib/seam/connect/auth.js +1 -10
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/index.d.ts +1 -0
- package/lib/seam/connect/index.js +1 -0
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/parse-options.js +6 -0
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/token.d.ts +13 -0
- package/lib/seam/connect/token.js +18 -0
- package/lib/seam/connect/token.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/seam/connect/auth.ts +12 -23
- package/src/lib/seam/connect/index.ts +7 -0
- package/src/lib/seam/connect/parse-options.ts +6 -0
- package/src/lib/seam/connect/token.ts +35 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.cjs
CHANGED
|
@@ -65,6 +65,12 @@ var getApiKeyFromEnv = (options) => {
|
|
|
65
65
|
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
|
+
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
if ("personalAccessToken" in options && options.personalAccessToken != null) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
68
74
|
return globalThis.process?.env?.SEAM_API_KEY;
|
|
69
75
|
};
|
|
70
76
|
var getEndpointFromEnv = () => {
|
|
@@ -223,6 +229,21 @@ var SeamHttpInvalidOptionsError = class extends Error {
|
|
|
223
229
|
var SeamHttpMultiWorkspaceInvalidOptionsError = class extends SeamHttpInvalidOptionsError {
|
|
224
230
|
};
|
|
225
231
|
|
|
232
|
+
// src/lib/seam/connect/token.ts
|
|
233
|
+
var tokenPrefix = "seam_";
|
|
234
|
+
var accessTokenPrefix = "seam_at";
|
|
235
|
+
var jwtPrefix = "ey";
|
|
236
|
+
var clientSessionTokenPrefix = "seam_cst";
|
|
237
|
+
var publishableKeyTokenPrefix = "seam_pk";
|
|
238
|
+
var isAccessToken = (token) => token.startsWith(accessTokenPrefix);
|
|
239
|
+
var isJwt = (token) => token.startsWith(jwtPrefix);
|
|
240
|
+
var isSeamToken = (token) => token.startsWith(tokenPrefix);
|
|
241
|
+
var isApiKey = (token) => !isClientSessionToken(token) && !isJwt(token) && !isAccessToken(token) && !isPublishableKey(token) && isSeamToken(token);
|
|
242
|
+
var isClientSessionToken = (token) => token.startsWith(clientSessionTokenPrefix);
|
|
243
|
+
var isPublishableKey = (token) => token.startsWith(publishableKeyTokenPrefix);
|
|
244
|
+
var isConsoleSessionToken = (token) => isJwt(token);
|
|
245
|
+
var isPersonalAccessToken = (token) => isAccessToken(token);
|
|
246
|
+
|
|
226
247
|
// src/lib/seam/connect/auth.ts
|
|
227
248
|
var getAuthHeaders = (options) => {
|
|
228
249
|
if ("publishableKey" in options) {
|
|
@@ -414,16 +435,6 @@ var warnOnInsecureuserIdentifierKey = (userIdentifierKey) => {
|
|
|
414
435
|
);
|
|
415
436
|
}
|
|
416
437
|
};
|
|
417
|
-
var tokenPrefix = "seam_";
|
|
418
|
-
var accessTokenPrefix = "seam_at";
|
|
419
|
-
var jwtPrefix = "ey";
|
|
420
|
-
var clientSessionTokenPrefix = "seam_cst";
|
|
421
|
-
var publishableKeyTokenPrefix = "seam_pk";
|
|
422
|
-
var isClientSessionToken = (token) => token.startsWith(clientSessionTokenPrefix);
|
|
423
|
-
var isAccessToken = (token) => token.startsWith(accessTokenPrefix);
|
|
424
|
-
var isJwt = (token) => token.startsWith(jwtPrefix);
|
|
425
|
-
var isSeamToken = (token) => token.startsWith(tokenPrefix);
|
|
426
|
-
var isPublishableKey = (token) => token.startsWith(publishableKeyTokenPrefix);
|
|
427
438
|
var isEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
428
439
|
|
|
429
440
|
// src/lib/seam/connect/seam-http-error.ts
|
|
@@ -3346,6 +3357,11 @@ exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
|
|
|
3346
3357
|
exports.UnserializableParamError = UnserializableParamError;
|
|
3347
3358
|
exports.errorInterceptor = errorInterceptor;
|
|
3348
3359
|
exports.getOpenapiSchema = getOpenapiSchema;
|
|
3360
|
+
exports.isApiKey = isApiKey;
|
|
3361
|
+
exports.isClientSessionToken = isClientSessionToken;
|
|
3362
|
+
exports.isConsoleSessionToken = isConsoleSessionToken;
|
|
3363
|
+
exports.isPersonalAccessToken = isPersonalAccessToken;
|
|
3364
|
+
exports.isPublishableKey = isPublishableKey;
|
|
3349
3365
|
exports.isSeamActionAttemptError = isSeamActionAttemptError;
|
|
3350
3366
|
exports.isSeamActionAttemptFailedError = isSeamActionAttemptFailedError;
|
|
3351
3367
|
exports.isSeamActionAttemptTimeoutError = isSeamActionAttemptTimeoutError;
|