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 1
1
# Seam HTTP Client
2
2
3
3
[ ![ 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 )
4
5
[ ![ GitHub Actions] ( https://github.com/seamapi/javascript-http/actions/workflows/check.yml/badge.svg )] ( https://github.com/seamapi/javascript-http/actions/workflows/check.yml )
5
6
6
7
JavaScript 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> => {
29
29
const data = buff
30
30
. toString ( )
31
31
. replace (
32
- ' const seamapiJavascriptHttpVersion = null' ,
32
+ " const seamapiJavascriptHttpVersion = '0.0.0'" ,
33
33
`const seamapiJavascriptHttpVersion = '${ version } '` ,
34
34
)
35
35
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'
1
2
import version from 'lib/version.js'
2
3
3
4
import { getAuthHeaders } from './auth.js'
@@ -16,6 +17,7 @@ export const defaultEndpoint = 'https://connect.getseam.com'
16
17
export const sdkHeaders = {
17
18
'seam-sdk-name' : 'seamapi/javascript-http' ,
18
19
'seam-sdk-version' : version ,
20
+ 'seam-lts-version' : seamApiLtsVersion ,
19
21
}
20
22
21
23
export type Options =
Original file line number Diff line number Diff line change
1
+ import { seamApiLtsVersion } from 'lib/lts-version.js'
2
+
1
3
import {
2
4
getAuthHeadersForClientSessionToken ,
3
5
warnOnInsecureuserIdentifierKey ,
@@ -42,6 +44,8 @@ import {
42
44
export class SeamHttp {
43
45
client : Client
44
46
readonly defaults : Required < SeamHttpRequestOptions >
47
+ readonly ltsVersion = seamApiLtsVersion
48
+ static ltsVersion = seamApiLtsVersion
45
49
46
50
constructor ( apiKeyOrOptions : string | SeamHttpOptions = { } ) {
47
51
const options = parseOptions ( apiKeyOrOptions )
Original file line number Diff line number Diff line change 1
- const seamapiJavascriptHttpVersion = null
1
+ const seamapiJavascriptHttpVersion = '0.0.0'
2
2
3
3
export 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