@seamapi/http
Advanced tools
Comparing version 0.11.1 to 0.12.0
import { isSeamHttpMultiWorkspaceOptionsWithConsoleSessionToken, isSeamHttpMultiWorkspaceOptionsWithPersonalAccessToken, isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from './options.js'; | ||
import { accessTokenPrefix, clientSessionTokenPrefix, isAccessToken, isClientSessionToken, isJwt, isPublishableKey, isSeamToken, jwtPrefix, publishableKeyTokenPrefix, tokenPrefix, } from './token.js'; | ||
export const getAuthHeaders = (options) => { | ||
@@ -141,14 +142,4 @@ if ('publishableKey' in options) { | ||
}; | ||
const tokenPrefix = 'seam_'; | ||
const accessTokenPrefix = 'seam_at'; | ||
const jwtPrefix = 'ey'; | ||
const clientSessionTokenPrefix = 'seam_cst'; | ||
const publishableKeyTokenPrefix = 'seam_pk'; | ||
const isClientSessionToken = (token) => token.startsWith(clientSessionTokenPrefix); | ||
const isAccessToken = (token) => token.startsWith(accessTokenPrefix); | ||
const isJwt = (token) => token.startsWith(jwtPrefix); | ||
const isSeamToken = (token) => token.startsWith(tokenPrefix); | ||
const isPublishableKey = (token) => token.startsWith(publishableKeyTokenPrefix); | ||
// SOURCE: https://stackoverflow.com/a/46181 | ||
const isEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value); | ||
//# sourceMappingURL=auth.js.map |
@@ -10,2 +10,3 @@ export { SeamHttpInvalidTokenError } from './auth.js'; | ||
export * from './seam-http-multi-workspace.js'; | ||
export { isApiKey, isClientSessionToken, isConsoleSessionToken, isPersonalAccessToken, isPublishableKey, } from './token.js'; | ||
export * from '../../../lib/params-serializer.js'; |
@@ -10,3 +10,4 @@ export { SeamHttpInvalidTokenError } from './auth.js'; | ||
export * from './seam-http-multi-workspace.js'; | ||
export { isApiKey, isClientSessionToken, isConsoleSessionToken, isPersonalAccessToken, isPublishableKey, } from './token.js'; | ||
export * from '../../../lib/params-serializer.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
declare const seamapiJavascriptHttpVersion = "0.11.1"; | ||
declare const seamapiJavascriptHttpVersion = "0.12.0"; | ||
export default seamapiJavascriptHttpVersion; |
@@ -1,3 +0,3 @@ | ||
const seamapiJavascriptHttpVersion = '0.11.1'; | ||
const seamapiJavascriptHttpVersion = '0.12.0'; | ||
export default seamapiJavascriptHttpVersion; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@seamapi/http", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "JavaScript HTTP client for the Seam API written in TypeScript.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -17,2 +17,14 @@ import { | ||
import type { Options } from './parse-options.js' | ||
import { | ||
accessTokenPrefix, | ||
clientSessionTokenPrefix, | ||
isAccessToken, | ||
isClientSessionToken, | ||
isJwt, | ||
isPublishableKey, | ||
isSeamToken, | ||
jwtPrefix, | ||
publishableKeyTokenPrefix, | ||
tokenPrefix, | ||
} from './token.js' | ||
@@ -260,27 +272,4 @@ type Headers = Record<string, string> | ||
const tokenPrefix = 'seam_' | ||
const accessTokenPrefix = 'seam_at' | ||
const jwtPrefix = 'ey' | ||
const clientSessionTokenPrefix = 'seam_cst' | ||
const publishableKeyTokenPrefix = 'seam_pk' | ||
const isClientSessionToken = (token: string): boolean => | ||
token.startsWith(clientSessionTokenPrefix) | ||
const isAccessToken = (token: string): boolean => | ||
token.startsWith(accessTokenPrefix) | ||
const isJwt = (token: string): boolean => token.startsWith(jwtPrefix) | ||
const isSeamToken = (token: string): boolean => token.startsWith(tokenPrefix) | ||
const isPublishableKey = (token: string): boolean => | ||
token.startsWith(publishableKeyTokenPrefix) | ||
// SOURCE: https://stackoverflow.com/a/46181 | ||
const isEmail = (value: string): boolean => | ||
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) |
@@ -17,2 +17,9 @@ export { SeamHttpInvalidTokenError } from './auth.js' | ||
export * from './seam-http-multi-workspace.js' | ||
export { | ||
isApiKey, | ||
isClientSessionToken, | ||
isConsoleSessionToken, | ||
isPersonalAccessToken, | ||
isPublishableKey, | ||
} from './token.js' | ||
export * from 'lib/params-serializer.js' |
@@ -1,3 +0,3 @@ | ||
const seamapiJavascriptHttpVersion = '0.11.1' | ||
const seamapiJavascriptHttpVersion = '0.12.0' | ||
export default seamapiJavascriptHttpVersion |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1151063
186
13744