@seamapi/http 0.1.0 → 0.2.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.
Files changed (122) hide show
  1. package/dist/connect.cjs +752 -366
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +186 -142
  4. package/lib/params-serializer.d.ts +5 -0
  5. package/lib/params-serializer.js +42 -0
  6. package/lib/params-serializer.js.map +1 -0
  7. package/lib/seam/connect/auth.d.ts +3 -2
  8. package/lib/seam/connect/auth.js +55 -4
  9. package/lib/seam/connect/auth.js.map +1 -1
  10. package/lib/seam/connect/client.d.ts +10 -22
  11. package/lib/seam/connect/client.js +17 -77
  12. package/lib/seam/connect/client.js.map +1 -1
  13. package/lib/seam/connect/index.d.ts +2 -1
  14. package/lib/seam/connect/index.js +2 -1
  15. package/lib/seam/connect/index.js.map +1 -1
  16. package/lib/seam/connect/{client-options.d.ts → options.d.ts} +7 -7
  17. package/lib/seam/connect/{client-options.js → options.js} +5 -10
  18. package/lib/seam/connect/options.js.map +1 -0
  19. package/lib/seam/connect/parse-options.d.ts +6 -2
  20. package/lib/seam/connect/parse-options.js +34 -16
  21. package/lib/seam/connect/parse-options.js.map +1 -1
  22. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +10 -9
  23. package/lib/seam/connect/routes/access-codes-unmanaged.js +26 -14
  24. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
  25. package/lib/seam/connect/routes/access-codes.d.ts +15 -14
  26. package/lib/seam/connect/routes/access-codes.js +29 -17
  27. package/lib/seam/connect/routes/access-codes.js.map +1 -1
  28. package/lib/seam/connect/routes/acs-access-groups.d.ts +13 -12
  29. package/lib/seam/connect/routes/acs-access-groups.js +26 -14
  30. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
  31. package/lib/seam/connect/routes/acs-credentials.d.ts +9 -8
  32. package/lib/seam/connect/routes/acs-credentials.js +26 -14
  33. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  34. package/lib/seam/connect/routes/acs-systems.d.ts +9 -8
  35. package/lib/seam/connect/routes/acs-systems.js +29 -17
  36. package/lib/seam/connect/routes/acs-systems.js.map +1 -1
  37. package/lib/seam/connect/routes/acs-users.d.ts +18 -11
  38. package/lib/seam/connect/routes/acs-users.js +40 -14
  39. package/lib/seam/connect/routes/acs-users.js.map +1 -1
  40. package/lib/seam/connect/routes/acs.d.ts +5 -4
  41. package/lib/seam/connect/routes/acs.js +26 -14
  42. package/lib/seam/connect/routes/acs.js.map +1 -1
  43. package/lib/seam/connect/routes/action-attempts.d.ts +7 -6
  44. package/lib/seam/connect/routes/action-attempts.js +26 -14
  45. package/lib/seam/connect/routes/action-attempts.js.map +1 -1
  46. package/lib/seam/connect/routes/client-sessions.d.ts +13 -9
  47. package/lib/seam/connect/routes/client-sessions.js +33 -14
  48. package/lib/seam/connect/routes/client-sessions.js.map +1 -1
  49. package/lib/seam/connect/routes/connect-webviews.d.ts +11 -10
  50. package/lib/seam/connect/routes/connect-webviews.js +29 -17
  51. package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
  52. package/lib/seam/connect/routes/connected-accounts.d.ts +8 -7
  53. package/lib/seam/connect/routes/connected-accounts.js +26 -14
  54. package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
  55. package/lib/seam/connect/routes/devices-unmanaged.d.ts +8 -7
  56. package/lib/seam/connect/routes/devices-unmanaged.js +26 -14
  57. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
  58. package/lib/seam/connect/routes/devices.d.ts +10 -9
  59. package/lib/seam/connect/routes/devices.js +26 -14
  60. package/lib/seam/connect/routes/devices.js.map +1 -1
  61. package/lib/seam/connect/routes/events.d.ts +7 -6
  62. package/lib/seam/connect/routes/events.js +26 -14
  63. package/lib/seam/connect/routes/events.js.map +1 -1
  64. package/lib/seam/connect/routes/locks.d.ts +9 -8
  65. package/lib/seam/connect/routes/locks.js +26 -14
  66. package/lib/seam/connect/routes/locks.js.map +1 -1
  67. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +10 -9
  68. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +26 -14
  69. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
  70. package/lib/seam/connect/routes/noise-sensors.d.ts +5 -4
  71. package/lib/seam/connect/routes/noise-sensors.js +26 -14
  72. package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
  73. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +10 -9
  74. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +26 -14
  75. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
  76. package/lib/seam/connect/routes/thermostats.d.ts +13 -12
  77. package/lib/seam/connect/routes/thermostats.js +26 -14
  78. package/lib/seam/connect/routes/thermostats.js.map +1 -1
  79. package/lib/seam/connect/routes/webhooks.d.ts +9 -8
  80. package/lib/seam/connect/routes/webhooks.js +26 -14
  81. package/lib/seam/connect/routes/webhooks.js.map +1 -1
  82. package/lib/seam/connect/routes/workspaces.d.ts +8 -7
  83. package/lib/seam/connect/routes/workspaces.js +26 -14
  84. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  85. package/lib/seam/connect/seam-http.d.ts +24 -0
  86. package/lib/seam/connect/seam-http.js +82 -0
  87. package/lib/seam/connect/seam-http.js.map +1 -0
  88. package/package.json +7 -4
  89. package/src/lib/params-serializer.ts +55 -0
  90. package/src/lib/seam/connect/auth.ts +94 -6
  91. package/src/lib/seam/connect/client.ts +22 -127
  92. package/src/lib/seam/connect/env.d.ts +11 -0
  93. package/src/lib/seam/connect/index.ts +2 -1
  94. package/src/lib/seam/connect/{client-options.ts → options.ts} +13 -19
  95. package/src/lib/seam/connect/parse-options.ts +50 -23
  96. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +44 -31
  97. package/src/lib/seam/connect/routes/access-codes.ts +48 -48
  98. package/src/lib/seam/connect/routes/acs-access-groups.ts +49 -40
  99. package/src/lib/seam/connect/routes/acs-credentials.ts +40 -28
  100. package/src/lib/seam/connect/routes/acs-systems.ts +40 -30
  101. package/src/lib/seam/connect/routes/acs-users.ts +70 -36
  102. package/src/lib/seam/connect/routes/acs.ts +33 -17
  103. package/src/lib/seam/connect/routes/action-attempts.ts +36 -22
  104. package/src/lib/seam/connect/routes/client-sessions.ts +58 -30
  105. package/src/lib/seam/connect/routes/connect-webviews.ts +45 -34
  106. package/src/lib/seam/connect/routes/connected-accounts.ts +40 -25
  107. package/src/lib/seam/connect/routes/devices-unmanaged.ts +39 -25
  108. package/src/lib/seam/connect/routes/devices.ts +39 -31
  109. package/src/lib/seam/connect/routes/events.ts +36 -22
  110. package/src/lib/seam/connect/routes/locks.ts +38 -28
  111. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +47 -31
  112. package/src/lib/seam/connect/routes/noise-sensors.ts +33 -17
  113. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +47 -31
  114. package/src/lib/seam/connect/routes/thermostats.ts +42 -40
  115. package/src/lib/seam/connect/routes/webhooks.ts +38 -28
  116. package/src/lib/seam/connect/routes/workspaces.ts +38 -25
  117. package/src/lib/seam/connect/seam-http.ts +141 -0
  118. package/lib/seam/connect/axios.d.ts +0 -3
  119. package/lib/seam/connect/axios.js +0 -19
  120. package/lib/seam/connect/axios.js.map +0 -1
  121. package/lib/seam/connect/client-options.js.map +0 -1
  122. package/src/lib/seam/connect/axios.ts +0 -25
@@ -8,50 +8,53 @@ import type {
8
8
  RouteRequestParams,
9
9
  RouteResponse,
10
10
  } from '@seamapi/types/connect'
11
- import type { Axios } from 'axios'
12
11
  import type { SetNonNullable } from 'type-fest'
13
12
 
14
- import { createAxiosClient } from 'lib/seam/connect/axios.js'
13
+ import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
14
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
15
15
  import {
16
16
  isSeamHttpOptionsWithApiKey,
17
17
  isSeamHttpOptionsWithClient,
18
18
  isSeamHttpOptionsWithClientSessionToken,
19
+ type SeamHttpFromPublishableKeyOptions,
19
20
  SeamHttpInvalidOptionsError,
20
21
  type SeamHttpOptions,
21
22
  type SeamHttpOptionsWithApiKey,
22
23
  type SeamHttpOptionsWithClient,
23
24
  type SeamHttpOptionsWithClientSessionToken,
24
- } from 'lib/seam/connect/client-options.js'
25
+ } from 'lib/seam/connect/options.js'
25
26
  import { parseOptions } from 'lib/seam/connect/parse-options.js'
26
27
 
28
+ import { SeamHttpClientSessions } from './client-sessions.js'
29
+
27
30
  export class SeamHttpWorkspaces {
28
- client: Axios
31
+ client: Client
29
32
 
30
- constructor(apiKeyOrOptions: string | SeamHttpOptions) {
31
- const options = parseOptions(apiKeyOrOptions)
32
- this.client = createAxiosClient(options)
33
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
34
+ const clientOptions = parseOptions(apiKeyOrOptions)
35
+ this.client = createClient(clientOptions)
33
36
  }
34
37
 
35
38
  static fromClient(
36
39
  client: SeamHttpOptionsWithClient['client'],
37
40
  options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
38
41
  ): SeamHttpWorkspaces {
39
- const opts = { ...options, client }
40
- if (!isSeamHttpOptionsWithClient(opts)) {
42
+ const constructorOptions = { ...options, client }
43
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
41
44
  throw new SeamHttpInvalidOptionsError('Missing client')
42
45
  }
43
- return new SeamHttpWorkspaces(opts)
46
+ return new SeamHttpWorkspaces(constructorOptions)
44
47
  }
45
48
 
46
49
  static fromApiKey(
47
50
  apiKey: SeamHttpOptionsWithApiKey['apiKey'],
48
51
  options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
49
52
  ): SeamHttpWorkspaces {
50
- const opts = { ...options, apiKey }
51
- if (!isSeamHttpOptionsWithApiKey(opts)) {
53
+ const constructorOptions = { ...options, apiKey }
54
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
52
55
  throw new SeamHttpInvalidOptionsError('Missing apiKey')
53
56
  }
54
- return new SeamHttpWorkspaces(opts)
57
+ return new SeamHttpWorkspaces(constructorOptions)
55
58
  }
56
59
 
57
60
  static fromClientSessionToken(
@@ -61,11 +64,26 @@ export class SeamHttpWorkspaces {
61
64
  'clientSessionToken'
62
65
  > = {},
63
66
  ): SeamHttpWorkspaces {
64
- const opts = { ...options, clientSessionToken }
65
- if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
67
+ const constructorOptions = { ...options, clientSessionToken }
68
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
66
69
  throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
67
70
  }
68
- return new SeamHttpWorkspaces(opts)
71
+ return new SeamHttpWorkspaces(constructorOptions)
72
+ }
73
+
74
+ static async fromPublishableKey(
75
+ publishableKey: string,
76
+ userIdentifierKey: string,
77
+ options: SeamHttpFromPublishableKeyOptions = {},
78
+ ): Promise<SeamHttpWorkspaces> {
79
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
80
+ const clientOptions = parseOptions({ ...options, publishableKey })
81
+ const client = createClient(clientOptions)
82
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
83
+ const { token } = await clientSessions.getOrCreate({
84
+ user_identifier_key: userIdentifierKey,
85
+ })
86
+ return SeamHttpWorkspaces.fromClientSessionToken(token, options)
69
87
  }
70
88
 
71
89
  async get(
@@ -99,25 +117,20 @@ export class SeamHttpWorkspaces {
99
117
  }
100
118
  }
101
119
 
102
- export type WorkspacesGetParams = SetNonNullable<
103
- Required<RouteRequestParams<'/workspaces/get'>>
104
- >
120
+ export type WorkspacesGetParams = RouteRequestParams<'/workspaces/get'>
105
121
 
106
122
  export type WorkspacesGetResponse = SetNonNullable<
107
123
  Required<RouteResponse<'/workspaces/get'>>
108
124
  >
109
125
 
110
- export type WorkspacesListParams = SetNonNullable<
111
- Required<RouteRequestParams<'/workspaces/list'>>
112
- >
126
+ export type WorkspacesListParams = RouteRequestParams<'/workspaces/list'>
113
127
 
114
128
  export type WorkspacesListResponse = SetNonNullable<
115
129
  Required<RouteResponse<'/workspaces/list'>>
116
130
  >
117
131
 
118
- export type WorkspacesResetSandboxBody = SetNonNullable<
119
- Required<RouteRequestBody<'/workspaces/reset_sandbox'>>
120
- >
132
+ export type WorkspacesResetSandboxBody =
133
+ RouteRequestBody<'/workspaces/reset_sandbox'>
121
134
 
122
135
  export type WorkspacesResetSandboxResponse = SetNonNullable<
123
136
  Required<RouteResponse<'/workspaces/reset_sandbox'>>
@@ -0,0 +1,141 @@
1
+ import { warnOnInsecureuserIdentifierKey } from './auth.js'
2
+ import { type Client, createClient } from './client.js'
3
+ import {
4
+ isSeamHttpOptionsWithApiKey,
5
+ isSeamHttpOptionsWithClient,
6
+ isSeamHttpOptionsWithClientSessionToken,
7
+ type SeamHttpFromPublishableKeyOptions,
8
+ SeamHttpInvalidOptionsError,
9
+ type SeamHttpOptions,
10
+ type SeamHttpOptionsWithApiKey,
11
+ type SeamHttpOptionsWithClient,
12
+ type SeamHttpOptionsWithClientSessionToken,
13
+ } from './options.js'
14
+ import { parseOptions } from './parse-options.js'
15
+ import {
16
+ SeamHttpAccessCodes,
17
+ SeamHttpAcs,
18
+ SeamHttpActionAttempts,
19
+ SeamHttpClientSessions,
20
+ SeamHttpConnectedAccounts,
21
+ SeamHttpConnectWebviews,
22
+ SeamHttpDevices,
23
+ SeamHttpEvents,
24
+ SeamHttpLocks,
25
+ SeamHttpNoiseSensors,
26
+ SeamHttpThermostats,
27
+ SeamHttpWebhooks,
28
+ SeamHttpWorkspaces,
29
+ } from './routes/index.js'
30
+
31
+ export class SeamHttp {
32
+ client: Client
33
+
34
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
35
+ const clientOptions = parseOptions(apiKeyOrOptions)
36
+ this.client = createClient(clientOptions)
37
+ }
38
+
39
+ static fromClient(
40
+ client: SeamHttpOptionsWithClient['client'],
41
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
42
+ ): SeamHttp {
43
+ const constructorOptions = { ...options, client }
44
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
45
+ throw new SeamHttpInvalidOptionsError('Missing client')
46
+ }
47
+ return new SeamHttp(constructorOptions)
48
+ }
49
+
50
+ static fromApiKey(
51
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
52
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
53
+ ): SeamHttp {
54
+ const constructorOptions = { ...options, apiKey }
55
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
56
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
57
+ }
58
+ return new SeamHttp(constructorOptions)
59
+ }
60
+
61
+ static fromClientSessionToken(
62
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
63
+ options: Omit<
64
+ SeamHttpOptionsWithClientSessionToken,
65
+ 'clientSessionToken'
66
+ > = {},
67
+ ): SeamHttp {
68
+ const constructorOptions = { ...options, clientSessionToken }
69
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
70
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
71
+ }
72
+ return new SeamHttp(constructorOptions)
73
+ }
74
+
75
+ static async fromPublishableKey(
76
+ publishableKey: string,
77
+ userIdentifierKey: string,
78
+ options: SeamHttpFromPublishableKeyOptions = {},
79
+ ): Promise<SeamHttp> {
80
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
81
+ const clientOptions = parseOptions({ ...options, publishableKey })
82
+ const client = createClient(clientOptions)
83
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
84
+ const { token } = await clientSessions.getOrCreate({
85
+ user_identifier_key: userIdentifierKey,
86
+ })
87
+ return SeamHttp.fromClientSessionToken(token, options)
88
+ }
89
+
90
+ get accessCodes(): SeamHttpAccessCodes {
91
+ return SeamHttpAccessCodes.fromClient(this.client)
92
+ }
93
+
94
+ get acs(): SeamHttpAcs {
95
+ return SeamHttpAcs.fromClient(this.client)
96
+ }
97
+
98
+ get actionAttempts(): SeamHttpActionAttempts {
99
+ return SeamHttpActionAttempts.fromClient(this.client)
100
+ }
101
+
102
+ get clientSessions(): SeamHttpClientSessions {
103
+ return SeamHttpClientSessions.fromClient(this.client)
104
+ }
105
+
106
+ get connectedAccounts(): SeamHttpConnectedAccounts {
107
+ return SeamHttpConnectedAccounts.fromClient(this.client)
108
+ }
109
+
110
+ get connectWebviews(): SeamHttpConnectWebviews {
111
+ return SeamHttpConnectWebviews.fromClient(this.client)
112
+ }
113
+
114
+ get devices(): SeamHttpDevices {
115
+ return SeamHttpDevices.fromClient(this.client)
116
+ }
117
+
118
+ get events(): SeamHttpEvents {
119
+ return SeamHttpEvents.fromClient(this.client)
120
+ }
121
+
122
+ get locks(): SeamHttpLocks {
123
+ return SeamHttpLocks.fromClient(this.client)
124
+ }
125
+
126
+ get noiseSensors(): SeamHttpNoiseSensors {
127
+ return SeamHttpNoiseSensors.fromClient(this.client)
128
+ }
129
+
130
+ get thermostats(): SeamHttpThermostats {
131
+ return SeamHttpThermostats.fromClient(this.client)
132
+ }
133
+
134
+ get webhooks(): SeamHttpWebhooks {
135
+ return SeamHttpWebhooks.fromClient(this.client)
136
+ }
137
+
138
+ get workspaces(): SeamHttpWorkspaces {
139
+ return SeamHttpWorkspaces.fromClient(this.client)
140
+ }
141
+ }
@@ -1,3 +0,0 @@
1
- import { type Axios } from 'axios';
2
- import { type SeamHttpOptions } from './client-options.js';
3
- export declare const createAxiosClient: (options: Required<SeamHttpOptions>) => Axios;
@@ -1,19 +0,0 @@
1
- import axios, {} from 'axios';
2
- import { getAuthHeaders } from './auth.js';
3
- import { isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, } from './client-options.js';
4
- export const createAxiosClient = (options) => {
5
- if (isSeamHttpOptionsWithClient(options))
6
- return options.client;
7
- // TODO: axiosRetry? Allow options to configure this if so
8
- return axios.create({
9
- baseURL: options.endpoint,
10
- withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
11
- ...options.axiosOptions,
12
- headers: {
13
- ...getAuthHeaders(options),
14
- ...options.axiosOptions.headers,
15
- // TODO: User-Agent
16
- },
17
- });
18
- };
19
- //# sourceMappingURL=axios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/axios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GAExC,MAAM,qBAAqB,CAAA;AAE5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAkC,EAC3B,EAAE;IACT,IAAI,2BAA2B,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC,MAAM,CAAA;IAC/D,0DAA0D;IAC1D,OAAO,KAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC,QAAQ;QACzB,eAAe,EAAE,uCAAuC,CAAC,OAAO,CAAC;QACjE,GAAG,OAAO,CAAC,YAAY;QACvB,OAAO,EAAE;YACP,GAAG,cAAc,CAAC,OAAO,CAAC;YAC1B,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO;YAC/B,mBAAmB;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-options.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/client-options.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,OAAwB,EACc,EAAE;IACxC,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACxC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAExC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC7D,CAAA;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,2BAA2B,CACnC,2GAA2G,IAAI,CAAC,IAAI,CAClH,IAAI,CACL,EAAE,CACJ,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAMD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,OAAwB,EACc,EAAE;IACxC,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACxC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAExC,IAAI,oBAAoB,IAAI,OAAO,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAI,EAAE;QACzE,MAAM,IAAI,2BAA2B,CACnC,sEAAsE,CACvE,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAOD,MAAM,CAAC,MAAM,uCAAuC,GAAG,CACrD,OAAwB,EAC0B,EAAE;IACpD,IAAI,CAAC,CAAC,oBAAoB,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACpD,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAEpD,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;QACjD,MAAM,IAAI,2BAA2B,CACnC,sEAAsE,CACvE,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAA;QACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACjD,CAAC;CACF;AAED,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,mBAAmB;AACnB,IAAI"}
@@ -1,25 +0,0 @@
1
- import axios, { type Axios } from 'axios'
2
-
3
- import { getAuthHeaders } from './auth.js'
4
- import {
5
- isSeamHttpOptionsWithClient,
6
- isSeamHttpOptionsWithClientSessionToken,
7
- type SeamHttpOptions,
8
- } from './client-options.js'
9
-
10
- export const createAxiosClient = (
11
- options: Required<SeamHttpOptions>,
12
- ): Axios => {
13
- if (isSeamHttpOptionsWithClient(options)) return options.client
14
- // TODO: axiosRetry? Allow options to configure this if so
15
- return axios.create({
16
- baseURL: options.endpoint,
17
- withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
18
- ...options.axiosOptions,
19
- headers: {
20
- ...getAuthHeaders(options),
21
- ...options.axiosOptions.headers,
22
- // TODO: User-Agent
23
- },
24
- })
25
- }