File tree Expand file tree Collapse file tree 7 files changed +38
-2
lines changed Expand file tree Collapse file tree 7 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 11# Seam HTTP Client
22
33[ ![ npm] ( https://img.shields.io/npm/v/@seamapi/http.svg )] ( https://www.npmjs.com/package/@seamapi/http )
4+ [ ![ Seam LTS Version] ( https://img.shields.io/badge/Seam_LTS-1.0.0-blue )] ( https://docs.seam.co/lts )
45[ ![ GitHub Actions] ( https://github.com/seamapi/javascript-http/actions/workflows/check.yml/badge.svg )] ( https://github.com/seamapi/javascript-http/actions/workflows/check.yml )
56
67JavaScript HTTP client for the Seam API written in TypeScript.
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const injectVersion = async (path: string): Promise<string> => {
2929 const data = buff
3030 . toString ( )
3131 . replace (
32- ' const seamapiJavascriptHttpVersion = null' ,
32+ " const seamapiJavascriptHttpVersion = '0.0.0'" ,
3333 `const seamapiJavascriptHttpVersion = '${ version } '` ,
3434 )
3535
Original file line number Diff line number Diff line change 1+ export const seamApiLtsVersion = '1.0.0'
Original file line number Diff line number Diff line change 1+ import { seamApiLtsVersion } from 'lib/lts-version.js'
12import version from 'lib/version.js'
23
34import { getAuthHeaders } from './auth.js'
@@ -16,6 +17,7 @@ export const defaultEndpoint = 'https://connect.getseam.com'
1617export const sdkHeaders = {
1718 'seam-sdk-name' : 'seamapi/javascript-http' ,
1819 'seam-sdk-version' : version ,
20+ 'seam-lts-version' : seamApiLtsVersion ,
1921}
2022
2123export type Options =
Original file line number Diff line number Diff line change 1+ import { seamApiLtsVersion } from 'lib/lts-version.js'
2+
13import {
24 getAuthHeadersForClientSessionToken ,
35 warnOnInsecureuserIdentifierKey ,
@@ -42,6 +44,8 @@ import {
4244export class SeamHttp {
4345 client : Client
4446 readonly defaults : Required < SeamHttpRequestOptions >
47+ readonly ltsVersion = seamApiLtsVersion
48+ static ltsVersion = seamApiLtsVersion
4549
4650 constructor ( apiKeyOrOptions : string | SeamHttpOptions = { } ) {
4751 const options = parseOptions ( apiKeyOrOptions )
Original file line number Diff line number Diff line change 1- const seamapiJavascriptHttpVersion = null
1+ const seamapiJavascriptHttpVersion = '0.0.0'
22
33export default seamapiJavascriptHttpVersion
Original file line number Diff line number Diff line change 1+ import test from 'ava'
2+ import { randomUUID } from 'crypto'
3+ import { getTestServer } from 'fixtures/seam/connect/api.js'
4+ import nock from 'nock'
5+
6+ import { SeamHttp } from '@seamapi/http/connect'
7+
8+ import seamapiJavascriptHttpVersion from 'lib/version.js'
9+
10+ test ( 'SeamHttp: sends default headers' , async ( t ) => {
11+ const { seed, endpoint } = await getTestServer ( t )
12+ const deviceId = randomUUID ( )
13+ nock ( endpoint , {
14+ reqheaders : {
15+ 'seam-sdk-name' : 'seamapi/javascript-http' ,
16+ 'seam-lts-version' : SeamHttp . ltsVersion ,
17+ 'seam-sdk-version' : seamapiJavascriptHttpVersion ,
18+ } ,
19+ } )
20+ . post ( '/devices/get' , { device_id : deviceId } )
21+ . reply ( 200 , { device : { device_id : deviceId } } )
22+ const seam = new SeamHttp ( { apiKey : seed . seam_apikey1_token , endpoint } )
23+ const device = await seam . devices . get ( {
24+ device_id : deviceId ,
25+ } )
26+ t . is ( SeamHttp . ltsVersion , seam . ltsVersion )
27+ t . is ( device . device_id , deviceId )
28+ } )
You can’t perform that action at this time.
0 commit comments