@seamapi/http 1.119.0 → 1.120.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 (34) hide show
  1. package/dist/connect.cjs +168 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +49 -4
  4. package/dist/index.cjs +170 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/routes/seam/console/v1/index.d.ts +1 -0
  8. package/lib/seam/connect/routes/seam/console/v1/index.js +1 -0
  9. package/lib/seam/connect/routes/seam/console/v1/index.js.map +1 -1
  10. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.d.ts +47 -0
  11. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.js +116 -0
  12. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.js.map +1 -0
  13. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.d.ts +1 -0
  14. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.js +6 -0
  15. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.js.map +1 -0
  16. package/lib/seam/connect/routes/seam/console/v1/workspace/index.d.ts +1 -0
  17. package/lib/seam/connect/routes/seam/console/v1/workspace/index.js +6 -0
  18. package/lib/seam/connect/routes/seam/console/v1/workspace/index.js.map +1 -0
  19. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.d.ts +3 -1
  20. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js +11 -0
  21. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js.map +1 -1
  22. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +5 -2
  23. package/lib/seam/connect/routes/seam-http-endpoints.js +21 -0
  24. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  25. package/lib/version.d.ts +1 -1
  26. package/lib/version.js +1 -1
  27. package/package.json +3 -3
  28. package/src/lib/seam/connect/routes/seam/console/v1/index.ts +1 -0
  29. package/src/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.ts +259 -0
  30. package/src/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.ts +6 -0
  31. package/src/lib/seam/connect/routes/seam/console/v1/workspace/index.ts +6 -0
  32. package/src/lib/seam/connect/routes/seam-http-endpoints-without-workspace.ts +28 -0
  33. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +53 -0
  34. package/src/lib/version.ts +1 -1
@@ -0,0 +1,259 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ import type {
7
+ RouteRequestBody,
8
+ RouteRequestParams,
9
+ RouteResponse,
10
+ } from '@seamapi/types/connect'
11
+
12
+ import { seamApiLtsVersion } from 'lib/lts-version.js'
13
+ import {
14
+ getAuthHeadersForClientSessionToken,
15
+ warnOnInsecureuserIdentifierKey,
16
+ } from 'lib/seam/connect/auth.js'
17
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
18
+ import {
19
+ isSeamHttpOptionsWithApiKey,
20
+ isSeamHttpOptionsWithClient,
21
+ isSeamHttpOptionsWithClientSessionToken,
22
+ isSeamHttpOptionsWithConsoleSessionToken,
23
+ isSeamHttpOptionsWithPersonalAccessToken,
24
+ type SeamHttpFromPublishableKeyOptions,
25
+ SeamHttpInvalidOptionsError,
26
+ type SeamHttpOptions,
27
+ type SeamHttpOptionsWithApiKey,
28
+ type SeamHttpOptionsWithClient,
29
+ type SeamHttpOptionsWithClientSessionToken,
30
+ type SeamHttpOptionsWithConsoleSessionToken,
31
+ type SeamHttpOptionsWithPersonalAccessToken,
32
+ type SeamHttpRequestOptions,
33
+ } from 'lib/seam/connect/options.js'
34
+ import {
35
+ limitToSeamHttpRequestOptions,
36
+ parseOptions,
37
+ } from 'lib/seam/connect/parse-options.js'
38
+ import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
39
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
40
+ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
41
+ import type { SetNonNullable } from 'lib/types.js'
42
+
43
+ export class SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
44
+ client: Client
45
+ readonly defaults: Required<SeamHttpRequestOptions>
46
+ readonly ltsVersion = seamApiLtsVersion
47
+ static ltsVersion = seamApiLtsVersion
48
+
49
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
50
+ const options = parseOptions(apiKeyOrOptions)
51
+ if (!options.isUndocumentedApiEnabled) {
52
+ throw new Error(
53
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
54
+ )
55
+ }
56
+ this.client = 'client' in options ? options.client : createClient(options)
57
+ this.defaults = limitToSeamHttpRequestOptions(options)
58
+ }
59
+
60
+ static fromClient(
61
+ client: SeamHttpOptionsWithClient['client'],
62
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
63
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
64
+ const constructorOptions = { ...options, client }
65
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
66
+ throw new SeamHttpInvalidOptionsError('Missing client')
67
+ }
68
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
69
+ }
70
+
71
+ static fromApiKey(
72
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
73
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
74
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
75
+ const constructorOptions = { ...options, apiKey }
76
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
77
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
78
+ }
79
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
80
+ }
81
+
82
+ static fromClientSessionToken(
83
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
84
+ options: Omit<
85
+ SeamHttpOptionsWithClientSessionToken,
86
+ 'clientSessionToken'
87
+ > = {},
88
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
89
+ const constructorOptions = { ...options, clientSessionToken }
90
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
91
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
92
+ }
93
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
94
+ }
95
+
96
+ static async fromPublishableKey(
97
+ publishableKey: string,
98
+ userIdentifierKey: string,
99
+ options: SeamHttpFromPublishableKeyOptions = {},
100
+ ): Promise<SeamHttpSeamConsoleV1WorkspaceFeatureFlags> {
101
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
102
+ const clientOptions = parseOptions({ ...options, publishableKey })
103
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
104
+ throw new SeamHttpInvalidOptionsError(
105
+ 'The client option cannot be used with SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromPublishableKey',
106
+ )
107
+ }
108
+ const client = createClient(clientOptions)
109
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
110
+ const { token } = await clientSessions.getOrCreate({
111
+ user_identifier_key: userIdentifierKey,
112
+ })
113
+ return SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClientSessionToken(
114
+ token,
115
+ options,
116
+ )
117
+ }
118
+
119
+ static fromConsoleSessionToken(
120
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
121
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
122
+ options: Omit<
123
+ SeamHttpOptionsWithConsoleSessionToken,
124
+ 'consoleSessionToken' | 'workspaceId'
125
+ > = {},
126
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
127
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
128
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
129
+ throw new SeamHttpInvalidOptionsError(
130
+ 'Missing consoleSessionToken or workspaceId',
131
+ )
132
+ }
133
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
134
+ }
135
+
136
+ static fromPersonalAccessToken(
137
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
138
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
139
+ options: Omit<
140
+ SeamHttpOptionsWithPersonalAccessToken,
141
+ 'personalAccessToken' | 'workspaceId'
142
+ > = {},
143
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
144
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
145
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
146
+ throw new SeamHttpInvalidOptionsError(
147
+ 'Missing personalAccessToken or workspaceId',
148
+ )
149
+ }
150
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
151
+ }
152
+
153
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
154
+ request: SeamHttpRequest<TResponse, TResponseKey>,
155
+ ): SeamPaginator<TResponse, TResponseKey> {
156
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
157
+ }
158
+
159
+ async updateClientSessionToken(
160
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
161
+ ): Promise<void> {
162
+ const { headers } = this.client.defaults
163
+ const authHeaders = getAuthHeadersForClientSessionToken({
164
+ clientSessionToken,
165
+ })
166
+ for (const key of Object.keys(authHeaders)) {
167
+ if (headers[key] == null) {
168
+ throw new Error(
169
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
170
+ )
171
+ }
172
+ }
173
+ this.client.defaults.headers = { ...headers, ...authHeaders }
174
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
175
+ await clientSessions.get()
176
+ }
177
+
178
+ list(
179
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsListParameters,
180
+ options: SeamConsoleV1WorkspaceFeatureFlagsListOptions = {},
181
+ ): SeamConsoleV1WorkspaceFeatureFlagsListRequest {
182
+ if (!this.defaults.isUndocumentedApiEnabled) {
183
+ throw new Error(
184
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
185
+ )
186
+ }
187
+ return new SeamHttpRequest(this, {
188
+ pathname: '/seam/console/v1/workspace/feature_flags/list',
189
+ method: 'GET',
190
+ params: parameters,
191
+ responseKey: 'feature_flags',
192
+ options,
193
+ })
194
+ }
195
+
196
+ update(
197
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters,
198
+ options: SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions = {},
199
+ ): SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest {
200
+ if (!this.defaults.isUndocumentedApiEnabled) {
201
+ throw new Error(
202
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
203
+ )
204
+ }
205
+ return new SeamHttpRequest(this, {
206
+ pathname: '/seam/console/v1/workspace/feature_flags/update',
207
+ method: 'POST',
208
+ body: parameters,
209
+ responseKey: 'feature_flag',
210
+ options,
211
+ })
212
+ }
213
+ }
214
+
215
+ export type SeamConsoleV1WorkspaceFeatureFlagsListParameters =
216
+ RouteRequestParams<'/seam/console/v1/workspace/feature_flags/list'>
217
+
218
+ /**
219
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsListParameters instead.
220
+ */
221
+ export type SeamConsoleV1WorkspaceFeatureFlagsListParams =
222
+ SeamConsoleV1WorkspaceFeatureFlagsListParameters
223
+
224
+ /**
225
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsListRequest instead.
226
+ */
227
+ export type SeamConsoleV1WorkspaceFeatureFlagsListResponse = SetNonNullable<
228
+ Required<RouteResponse<'/seam/console/v1/workspace/feature_flags/list'>>
229
+ >
230
+
231
+ export type SeamConsoleV1WorkspaceFeatureFlagsListRequest = SeamHttpRequest<
232
+ SeamConsoleV1WorkspaceFeatureFlagsListResponse,
233
+ 'feature_flags'
234
+ >
235
+
236
+ export interface SeamConsoleV1WorkspaceFeatureFlagsListOptions {}
237
+
238
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters =
239
+ RouteRequestBody<'/seam/console/v1/workspace/feature_flags/update'>
240
+
241
+ /**
242
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters instead.
243
+ */
244
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateBody =
245
+ SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters
246
+
247
+ /**
248
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest instead.
249
+ */
250
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateResponse = SetNonNullable<
251
+ Required<RouteResponse<'/seam/console/v1/workspace/feature_flags/update'>>
252
+ >
253
+
254
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest = SeamHttpRequest<
255
+ SeamConsoleV1WorkspaceFeatureFlagsUpdateResponse,
256
+ 'feature_flag'
257
+ >
258
+
259
+ export interface SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions {}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './feature-flags.js'
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './feature-flags/index.js'
@@ -21,6 +21,12 @@ import {
21
21
  parseOptions,
22
22
  } from 'lib/seam/connect/parse-options.js'
23
23
 
24
+ import {
25
+ type SeamConsoleV1WorkspaceFeatureFlagsListOptions,
26
+ type SeamConsoleV1WorkspaceFeatureFlagsListParameters,
27
+ type SeamConsoleV1WorkspaceFeatureFlagsListRequest,
28
+ SeamHttpSeamConsoleV1WorkspaceFeatureFlags,
29
+ } from './seam/console/v1/workspace/feature-flags/index.js'
24
30
  import {
25
31
  type SeamCustomerV1ConnectorsAuthorizeOptions,
26
32
  type SeamCustomerV1ConnectorsAuthorizeParameters,
@@ -100,6 +106,27 @@ export class SeamHttpEndpointsWithoutWorkspace {
100
106
  return new SeamHttpEndpointsWithoutWorkspace(constructorOptions)
101
107
  }
102
108
 
109
+ get '/seam/console/v1/workspace/feature_flags/list'(): (
110
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsListParameters,
111
+ options?: SeamConsoleV1WorkspaceFeatureFlagsListOptions,
112
+ ) => SeamConsoleV1WorkspaceFeatureFlagsListRequest {
113
+ const { client, defaults } = this
114
+ if (!this.defaults.isUndocumentedApiEnabled) {
115
+ throw new Error(
116
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
117
+ )
118
+ }
119
+ return function seamConsoleV1WorkspaceFeatureFlagsList(
120
+ ...args: Parameters<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']>
121
+ ): ReturnType<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']> {
122
+ const seam = SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClient(
123
+ client,
124
+ defaults,
125
+ )
126
+ return seam.list(...args)
127
+ }
128
+ }
129
+
103
130
  get '/seam/customer/v1/connectors/authorize'(): (
104
131
  parameters?: SeamCustomerV1ConnectorsAuthorizeParameters,
105
132
  options?: SeamCustomerV1ConnectorsAuthorizeOptions,
@@ -146,6 +173,7 @@ export class SeamHttpEndpointsWithoutWorkspace {
146
173
  }
147
174
 
148
175
  export type SeamHttpEndpointWithoutWorkspaceQueryPaths =
176
+ | '/seam/console/v1/workspace/feature_flags/list'
149
177
  | '/seam/customer/v1/connectors/authorize'
150
178
  | '/workspaces/list'
151
179
 
@@ -647,6 +647,15 @@ import {
647
647
  type SeamConsoleV1TimelinesGetRequest,
648
648
  SeamHttpSeamConsoleV1Timelines,
649
649
  } from './seam/console/v1/timelines/index.js'
650
+ import {
651
+ type SeamConsoleV1WorkspaceFeatureFlagsListOptions,
652
+ type SeamConsoleV1WorkspaceFeatureFlagsListParameters,
653
+ type SeamConsoleV1WorkspaceFeatureFlagsListRequest,
654
+ type SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions,
655
+ type SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters,
656
+ type SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest,
657
+ SeamHttpSeamConsoleV1WorkspaceFeatureFlags,
658
+ } from './seam/console/v1/workspace/feature-flags/index.js'
650
659
  import {
651
660
  type SeamCustomerV1AccessGrantsListOptions,
652
661
  type SeamCustomerV1AccessGrantsListParameters,
@@ -3510,6 +3519,48 @@ export class SeamHttpEndpoints {
3510
3519
  }
3511
3520
  }
3512
3521
 
3522
+ get '/seam/console/v1/workspace/feature_flags/list'(): (
3523
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsListParameters,
3524
+ options?: SeamConsoleV1WorkspaceFeatureFlagsListOptions,
3525
+ ) => SeamConsoleV1WorkspaceFeatureFlagsListRequest {
3526
+ const { client, defaults } = this
3527
+ if (!this.defaults.isUndocumentedApiEnabled) {
3528
+ throw new Error(
3529
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3530
+ )
3531
+ }
3532
+ return function seamConsoleV1WorkspaceFeatureFlagsList(
3533
+ ...args: Parameters<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']>
3534
+ ): ReturnType<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']> {
3535
+ const seam = SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClient(
3536
+ client,
3537
+ defaults,
3538
+ )
3539
+ return seam.list(...args)
3540
+ }
3541
+ }
3542
+
3543
+ get '/seam/console/v1/workspace/feature_flags/update'(): (
3544
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters,
3545
+ options?: SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions,
3546
+ ) => SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest {
3547
+ const { client, defaults } = this
3548
+ if (!this.defaults.isUndocumentedApiEnabled) {
3549
+ throw new Error(
3550
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3551
+ )
3552
+ }
3553
+ return function seamConsoleV1WorkspaceFeatureFlagsUpdate(
3554
+ ...args: Parameters<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['update']>
3555
+ ): ReturnType<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['update']> {
3556
+ const seam = SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClient(
3557
+ client,
3558
+ defaults,
3559
+ )
3560
+ return seam.update(...args)
3561
+ }
3562
+ }
3563
+
3513
3564
  get '/seam/customer/v1/access_grants/list'(): (
3514
3565
  parameters?: SeamCustomerV1AccessGrantsListParameters,
3515
3566
  options?: SeamCustomerV1AccessGrantsListOptions,
@@ -5491,6 +5542,7 @@ export type SeamHttpEndpointQueryPaths =
5491
5542
  | '/seam/console/v1/lynx_migration/list_property_reservations'
5492
5543
  | '/seam/console/v1/sites/list'
5493
5544
  | '/seam/console/v1/timelines/get'
5545
+ | '/seam/console/v1/workspace/feature_flags/list'
5494
5546
  | '/seam/customer/v1/access_grants/list'
5495
5547
  | '/seam/customer/v1/automation_runs/list'
5496
5548
  | '/seam/customer/v1/automations/get'
@@ -5653,6 +5705,7 @@ export type SeamHttpEndpointMutationPaths =
5653
5705
  | '/seam/console/v1/sites/create'
5654
5706
  | '/seam/console/v1/sites/delete'
5655
5707
  | '/seam/console/v1/sites/update'
5708
+ | '/seam/console/v1/workspace/feature_flags/update'
5656
5709
  | '/seam/customer/v1/access_grants/update'
5657
5710
  | '/seam/customer/v1/access_methods/encode'
5658
5711
  | '/seam/customer/v1/automations/delete'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.119.0'
1
+ const seamapiJavascriptHttpVersion = '1.120.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion