@seamapi/http 0.9.2 → 0.10.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 (41) hide show
  1. package/README.md +36 -0
  2. package/dist/connect.cjs +269 -2
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +70 -3
  5. package/lib/seam/connect/routes/acs-credential-pools.d.ts +19 -0
  6. package/lib/seam/connect/routes/acs-credential-pools.js +73 -0
  7. package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -0
  8. package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +19 -0
  9. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +73 -0
  10. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -0
  11. package/lib/seam/connect/routes/acs-credentials.d.ts +6 -2
  12. package/lib/seam/connect/routes/acs-credentials.js +12 -2
  13. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  14. package/lib/seam/connect/routes/acs-entrances.d.ts +23 -0
  15. package/lib/seam/connect/routes/acs-entrances.js +81 -0
  16. package/lib/seam/connect/routes/acs-entrances.js.map +1 -0
  17. package/lib/seam/connect/routes/acs.d.ts +6 -0
  18. package/lib/seam/connect/routes/acs.js +12 -0
  19. package/lib/seam/connect/routes/acs.js.map +1 -1
  20. package/lib/seam/connect/routes/index.d.ts +3 -0
  21. package/lib/seam/connect/routes/index.js +3 -0
  22. package/lib/seam/connect/routes/index.js.map +1 -1
  23. package/lib/seam/connect/routes/user-identities.d.ts +5 -1
  24. package/lib/seam/connect/routes/user-identities.js +8 -0
  25. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  26. package/lib/seam/connect/routes/workspaces.d.ts +4 -0
  27. package/lib/seam/connect/routes/workspaces.js +8 -0
  28. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  29. package/lib/version.d.ts +1 -1
  30. package/lib/version.js +1 -1
  31. package/lib/version.js.map +1 -1
  32. package/package.json +4 -4
  33. package/src/lib/seam/connect/routes/acs-credential-pools.ts +154 -0
  34. package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +162 -0
  35. package/src/lib/seam/connect/routes/acs-credentials.ts +33 -4
  36. package/src/lib/seam/connect/routes/acs-entrances.ts +173 -0
  37. package/src/lib/seam/connect/routes/acs.ts +18 -0
  38. package/src/lib/seam/connect/routes/index.ts +3 -0
  39. package/src/lib/seam/connect/routes/user-identities.ts +26 -1
  40. package/src/lib/seam/connect/routes/workspaces.ts +20 -0
  41. package/src/lib/version.ts +1 -1
@@ -0,0 +1,173 @@
1
+ /*
2
+ * Automatically generated by generate-routes.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
+ import type { SetNonNullable } from 'type-fest'
8
+
9
+ import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
10
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
11
+ import {
12
+ isSeamHttpOptionsWithApiKey,
13
+ isSeamHttpOptionsWithClient,
14
+ isSeamHttpOptionsWithClientSessionToken,
15
+ isSeamHttpOptionsWithConsoleSessionToken,
16
+ isSeamHttpOptionsWithPersonalAccessToken,
17
+ type SeamHttpFromPublishableKeyOptions,
18
+ SeamHttpInvalidOptionsError,
19
+ type SeamHttpOptions,
20
+ type SeamHttpOptionsWithApiKey,
21
+ type SeamHttpOptionsWithClient,
22
+ type SeamHttpOptionsWithClientSessionToken,
23
+ type SeamHttpOptionsWithConsoleSessionToken,
24
+ type SeamHttpOptionsWithPersonalAccessToken,
25
+ type SeamHttpRequestOptions,
26
+ } from 'lib/seam/connect/options.js'
27
+ import {
28
+ limitToSeamHttpRequestOptions,
29
+ parseOptions,
30
+ } from 'lib/seam/connect/parse-options.js'
31
+
32
+ import { SeamHttpClientSessions } from './client-sessions.js'
33
+
34
+ export class SeamHttpAcsEntrances {
35
+ client: Client
36
+ readonly defaults: Required<SeamHttpRequestOptions>
37
+
38
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
39
+ const options = parseOptions(apiKeyOrOptions)
40
+ this.client = 'client' in options ? options.client : createClient(options)
41
+ this.defaults = limitToSeamHttpRequestOptions(options)
42
+ }
43
+
44
+ static fromClient(
45
+ client: SeamHttpOptionsWithClient['client'],
46
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
47
+ ): SeamHttpAcsEntrances {
48
+ const constructorOptions = { ...options, client }
49
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
50
+ throw new SeamHttpInvalidOptionsError('Missing client')
51
+ }
52
+ return new SeamHttpAcsEntrances(constructorOptions)
53
+ }
54
+
55
+ static fromApiKey(
56
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
57
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
58
+ ): SeamHttpAcsEntrances {
59
+ const constructorOptions = { ...options, apiKey }
60
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
61
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
62
+ }
63
+ return new SeamHttpAcsEntrances(constructorOptions)
64
+ }
65
+
66
+ static fromClientSessionToken(
67
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
68
+ options: Omit<
69
+ SeamHttpOptionsWithClientSessionToken,
70
+ 'clientSessionToken'
71
+ > = {},
72
+ ): SeamHttpAcsEntrances {
73
+ const constructorOptions = { ...options, clientSessionToken }
74
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
75
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
76
+ }
77
+ return new SeamHttpAcsEntrances(constructorOptions)
78
+ }
79
+
80
+ static async fromPublishableKey(
81
+ publishableKey: string,
82
+ userIdentifierKey: string,
83
+ options: SeamHttpFromPublishableKeyOptions = {},
84
+ ): Promise<SeamHttpAcsEntrances> {
85
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
86
+ const clientOptions = parseOptions({ ...options, publishableKey })
87
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
88
+ throw new SeamHttpInvalidOptionsError(
89
+ 'The client option cannot be used with SeamHttp.fromPublishableKey',
90
+ )
91
+ }
92
+ const client = createClient(clientOptions)
93
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
94
+ const { token } = await clientSessions.getOrCreate({
95
+ user_identifier_key: userIdentifierKey,
96
+ })
97
+ return SeamHttpAcsEntrances.fromClientSessionToken(token, options)
98
+ }
99
+
100
+ static fromConsoleSessionToken(
101
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
102
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
103
+ options: Omit<
104
+ SeamHttpOptionsWithConsoleSessionToken,
105
+ 'consoleSessionToken' | 'workspaceId'
106
+ > = {},
107
+ ): SeamHttpAcsEntrances {
108
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
109
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
110
+ throw new SeamHttpInvalidOptionsError(
111
+ 'Missing consoleSessionToken or workspaceId',
112
+ )
113
+ }
114
+ return new SeamHttpAcsEntrances(constructorOptions)
115
+ }
116
+
117
+ static fromPersonalAccessToken(
118
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
119
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
120
+ options: Omit<
121
+ SeamHttpOptionsWithPersonalAccessToken,
122
+ 'personalAccessToken' | 'workspaceId'
123
+ > = {},
124
+ ): SeamHttpAcsEntrances {
125
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
126
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
127
+ throw new SeamHttpInvalidOptionsError(
128
+ 'Missing personalAccessToken or workspaceId',
129
+ )
130
+ }
131
+ return new SeamHttpAcsEntrances(constructorOptions)
132
+ }
133
+
134
+ async get(
135
+ body?: AcsEntrancesGetParams,
136
+ ): Promise<AcsEntrancesGetResponse['acs_entrance']> {
137
+ const { data } = await this.client.request<AcsEntrancesGetResponse>({
138
+ url: '/acs/entrances/get',
139
+ method: 'post',
140
+ data: body,
141
+ })
142
+
143
+ return data.acs_entrance
144
+ }
145
+
146
+ async list(
147
+ body?: AcsEntrancesListParams,
148
+ ): Promise<AcsEntrancesListResponse['acs_entrances']> {
149
+ const { data } = await this.client.request<AcsEntrancesListResponse>({
150
+ url: '/acs/entrances/list',
151
+ method: 'post',
152
+ data: body,
153
+ })
154
+
155
+ return data.acs_entrances
156
+ }
157
+ }
158
+
159
+ export type AcsEntrancesGetParams = RouteRequestBody<'/acs/entrances/get'>
160
+
161
+ export type AcsEntrancesGetResponse = SetNonNullable<
162
+ Required<RouteResponse<'/acs/entrances/get'>>
163
+ >
164
+
165
+ export type AcsEntrancesGetOptions = never
166
+
167
+ export type AcsEntrancesListParams = RouteRequestBody<'/acs/entrances/list'>
168
+
169
+ export type AcsEntrancesListResponse = SetNonNullable<
170
+ Required<RouteResponse<'/acs/entrances/list'>>
171
+ >
172
+
173
+ export type AcsEntrancesListOptions = never
@@ -27,7 +27,10 @@ import {
27
27
  } from 'lib/seam/connect/parse-options.js'
28
28
 
29
29
  import { SeamHttpAcsAccessGroups } from './acs-access-groups.js'
30
+ import { SeamHttpAcsCredentialPools } from './acs-credential-pools.js'
31
+ import { SeamHttpAcsCredentialProvisioningAutomations } from './acs-credential-provisioning-automations.js'
30
32
  import { SeamHttpAcsCredentials } from './acs-credentials.js'
33
+ import { SeamHttpAcsEntrances } from './acs-entrances.js'
31
34
  import { SeamHttpAcsSystems } from './acs-systems.js'
32
35
  import { SeamHttpAcsUsers } from './acs-users.js'
33
36
  import { SeamHttpClientSessions } from './client-sessions.js'
@@ -136,10 +139,25 @@ export class SeamHttpAcs {
136
139
  return SeamHttpAcsAccessGroups.fromClient(this.client, this.defaults)
137
140
  }
138
141
 
142
+ get credentialPools(): SeamHttpAcsCredentialPools {
143
+ return SeamHttpAcsCredentialPools.fromClient(this.client, this.defaults)
144
+ }
145
+
146
+ get credentialProvisioningAutomations(): SeamHttpAcsCredentialProvisioningAutomations {
147
+ return SeamHttpAcsCredentialProvisioningAutomations.fromClient(
148
+ this.client,
149
+ this.defaults,
150
+ )
151
+ }
152
+
139
153
  get credentials(): SeamHttpAcsCredentials {
140
154
  return SeamHttpAcsCredentials.fromClient(this.client, this.defaults)
141
155
  }
142
156
 
157
+ get entrances(): SeamHttpAcsEntrances {
158
+ return SeamHttpAcsEntrances.fromClient(this.client, this.defaults)
159
+ }
160
+
143
161
  get systems(): SeamHttpAcsSystems {
144
162
  return SeamHttpAcsSystems.fromClient(this.client, this.defaults)
145
163
  }
@@ -2,7 +2,10 @@ export * from './access-codes.js'
2
2
  export * from './access-codes-unmanaged.js'
3
3
  export * from './acs.js'
4
4
  export * from './acs-access-groups.js'
5
+ export * from './acs-credential-pools.js'
6
+ export * from './acs-credential-provisioning-automations.js'
5
7
  export * from './acs-credentials.js'
8
+ export * from './acs-entrances.js'
6
9
  export * from './acs-systems.js'
7
10
  export * from './acs-users.js'
8
11
  export * from './action-attempts.js'
@@ -3,7 +3,11 @@
3
3
  * Do not edit this file or add other files to this directory.
4
4
  */
5
5
 
6
- import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
6
+ import type {
7
+ RouteRequestBody,
8
+ RouteRequestParams,
9
+ RouteResponse,
10
+ } from '@seamapi/types/connect'
7
11
  import type { SetNonNullable } from 'type-fest'
8
12
 
9
13
  import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
@@ -173,6 +177,18 @@ export class SeamHttpUserIdentities {
173
177
  })
174
178
  }
175
179
 
180
+ async list(
181
+ params?: UserIdentitiesListParams,
182
+ ): Promise<UserIdentitiesListResponse['user_identities']> {
183
+ const { data } = await this.client.request<UserIdentitiesListResponse>({
184
+ url: '/user_identities/list',
185
+ method: 'get',
186
+ params,
187
+ })
188
+
189
+ return data.user_identities
190
+ }
191
+
176
192
  async listAccessibleDevices(
177
193
  body?: UserIdentitiesListAccessibleDevicesParams,
178
194
  ): Promise<
@@ -255,6 +271,15 @@ export type UserIdentitiesGrantAccessToDeviceResponse = SetNonNullable<
255
271
 
256
272
  export type UserIdentitiesGrantAccessToDeviceOptions = never
257
273
 
274
+ export type UserIdentitiesListParams =
275
+ RouteRequestParams<'/user_identities/list'>
276
+
277
+ export type UserIdentitiesListResponse = SetNonNullable<
278
+ Required<RouteResponse<'/user_identities/list'>>
279
+ >
280
+
281
+ export type UserIdentitiesListOptions = never
282
+
258
283
  export type UserIdentitiesListAccessibleDevicesParams =
259
284
  RouteRequestBody<'/user_identities/list_accessible_devices'>
260
285
 
@@ -135,6 +135,18 @@ export class SeamHttpWorkspaces {
135
135
  return new SeamHttpWorkspaces(constructorOptions)
136
136
  }
137
137
 
138
+ async create(
139
+ body?: WorkspacesCreateBody,
140
+ ): Promise<WorkspacesCreateResponse['workspace']> {
141
+ const { data } = await this.client.request<WorkspacesCreateResponse>({
142
+ url: '/workspaces/create',
143
+ method: 'post',
144
+ data: body,
145
+ })
146
+
147
+ return data.workspace
148
+ }
149
+
138
150
  async get(
139
151
  params?: WorkspacesGetParams,
140
152
  ): Promise<WorkspacesGetResponse['workspace']> {
@@ -168,6 +180,14 @@ export class SeamHttpWorkspaces {
168
180
  }
169
181
  }
170
182
 
183
+ export type WorkspacesCreateBody = RouteRequestBody<'/workspaces/create'>
184
+
185
+ export type WorkspacesCreateResponse = SetNonNullable<
186
+ Required<RouteResponse<'/workspaces/create'>>
187
+ >
188
+
189
+ export type WorkspacesCreateOptions = never
190
+
171
191
  export type WorkspacesGetParams = RouteRequestParams<'/workspaces/get'>
172
192
 
173
193
  export type WorkspacesGetResponse = SetNonNullable<
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '0.9.2'
1
+ const seamapiJavascriptHttpVersion = '0.10.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion