@seamapi/http 0.9.3 → 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.
- package/README.md +5 -5
- package/dist/connect.cjs +241 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +56 -1
- package/lib/seam/connect/routes/acs-credential-pools.d.ts +19 -0
- package/lib/seam/connect/routes/acs-credential-pools.js +73 -0
- package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -0
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +19 -0
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +73 -0
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -0
- package/lib/seam/connect/routes/acs-entrances.d.ts +23 -0
- package/lib/seam/connect/routes/acs-entrances.js +81 -0
- package/lib/seam/connect/routes/acs-entrances.js.map +1 -0
- package/lib/seam/connect/routes/acs.d.ts +6 -0
- package/lib/seam/connect/routes/acs.js +12 -0
- package/lib/seam/connect/routes/acs.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +3 -0
- package/lib/seam/connect/routes/index.js +3 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/seam/connect/routes/acs-credential-pools.ts +154 -0
- package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +162 -0
- package/src/lib/seam/connect/routes/acs-entrances.ts +173 -0
- package/src/lib/seam/connect/routes/acs.ts +18 -0
- package/src/lib/seam/connect/routes/index.ts +3 -0
- package/src/lib/version.ts +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
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 SeamHttpAcsCredentialPools {
|
|
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
|
+
): SeamHttpAcsCredentialPools {
|
|
48
|
+
const constructorOptions = { ...options, client }
|
|
49
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
50
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
51
|
+
}
|
|
52
|
+
return new SeamHttpAcsCredentialPools(constructorOptions)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static fromApiKey(
|
|
56
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
57
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
58
|
+
): SeamHttpAcsCredentialPools {
|
|
59
|
+
const constructorOptions = { ...options, apiKey }
|
|
60
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
61
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
62
|
+
}
|
|
63
|
+
return new SeamHttpAcsCredentialPools(constructorOptions)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static fromClientSessionToken(
|
|
67
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
68
|
+
options: Omit<
|
|
69
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
70
|
+
'clientSessionToken'
|
|
71
|
+
> = {},
|
|
72
|
+
): SeamHttpAcsCredentialPools {
|
|
73
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
74
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
75
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
76
|
+
}
|
|
77
|
+
return new SeamHttpAcsCredentialPools(constructorOptions)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static async fromPublishableKey(
|
|
81
|
+
publishableKey: string,
|
|
82
|
+
userIdentifierKey: string,
|
|
83
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
84
|
+
): Promise<SeamHttpAcsCredentialPools> {
|
|
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 SeamHttpAcsCredentialPools.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
|
+
): SeamHttpAcsCredentialPools {
|
|
108
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
109
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
110
|
+
throw new SeamHttpInvalidOptionsError(
|
|
111
|
+
'Missing consoleSessionToken or workspaceId',
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
return new SeamHttpAcsCredentialPools(constructorOptions)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static fromPersonalAccessToken(
|
|
118
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
119
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
120
|
+
options: Omit<
|
|
121
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
122
|
+
'personalAccessToken' | 'workspaceId'
|
|
123
|
+
> = {},
|
|
124
|
+
): SeamHttpAcsCredentialPools {
|
|
125
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
126
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
127
|
+
throw new SeamHttpInvalidOptionsError(
|
|
128
|
+
'Missing personalAccessToken or workspaceId',
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
return new SeamHttpAcsCredentialPools(constructorOptions)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async list(
|
|
135
|
+
body?: AcsCredentialPoolsListParams,
|
|
136
|
+
): Promise<AcsCredentialPoolsListResponse['acs_credential_pools']> {
|
|
137
|
+
const { data } = await this.client.request<AcsCredentialPoolsListResponse>({
|
|
138
|
+
url: '/acs/credential_pools/list',
|
|
139
|
+
method: 'post',
|
|
140
|
+
data: body,
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
return data.acs_credential_pools
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type AcsCredentialPoolsListParams =
|
|
148
|
+
RouteRequestBody<'/acs/credential_pools/list'>
|
|
149
|
+
|
|
150
|
+
export type AcsCredentialPoolsListResponse = SetNonNullable<
|
|
151
|
+
Required<RouteResponse<'/acs/credential_pools/list'>>
|
|
152
|
+
>
|
|
153
|
+
|
|
154
|
+
export type AcsCredentialPoolsListOptions = never
|
|
@@ -0,0 +1,162 @@
|
|
|
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 SeamHttpAcsCredentialProvisioningAutomations {
|
|
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
|
+
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
48
|
+
const constructorOptions = { ...options, client }
|
|
49
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
50
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
51
|
+
}
|
|
52
|
+
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static fromApiKey(
|
|
56
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
57
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
58
|
+
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
59
|
+
const constructorOptions = { ...options, apiKey }
|
|
60
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
61
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
62
|
+
}
|
|
63
|
+
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static fromClientSessionToken(
|
|
67
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
68
|
+
options: Omit<
|
|
69
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
70
|
+
'clientSessionToken'
|
|
71
|
+
> = {},
|
|
72
|
+
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
73
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
74
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
75
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
76
|
+
}
|
|
77
|
+
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static async fromPublishableKey(
|
|
81
|
+
publishableKey: string,
|
|
82
|
+
userIdentifierKey: string,
|
|
83
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
84
|
+
): Promise<SeamHttpAcsCredentialProvisioningAutomations> {
|
|
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 SeamHttpAcsCredentialProvisioningAutomations.fromClientSessionToken(
|
|
98
|
+
token,
|
|
99
|
+
options,
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static fromConsoleSessionToken(
|
|
104
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
105
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
106
|
+
options: Omit<
|
|
107
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
108
|
+
'consoleSessionToken' | 'workspaceId'
|
|
109
|
+
> = {},
|
|
110
|
+
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
111
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
112
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
113
|
+
throw new SeamHttpInvalidOptionsError(
|
|
114
|
+
'Missing consoleSessionToken or workspaceId',
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static fromPersonalAccessToken(
|
|
121
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
122
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
123
|
+
options: Omit<
|
|
124
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
125
|
+
'personalAccessToken' | 'workspaceId'
|
|
126
|
+
> = {},
|
|
127
|
+
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
128
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
129
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
130
|
+
throw new SeamHttpInvalidOptionsError(
|
|
131
|
+
'Missing personalAccessToken or workspaceId',
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async launch(
|
|
138
|
+
body?: AcsCredentialProvisioningAutomationsLaunchBody,
|
|
139
|
+
): Promise<
|
|
140
|
+
AcsCredentialProvisioningAutomationsLaunchResponse['acs_credential_provisioning_automation']
|
|
141
|
+
> {
|
|
142
|
+
const { data } =
|
|
143
|
+
await this.client.request<AcsCredentialProvisioningAutomationsLaunchResponse>(
|
|
144
|
+
{
|
|
145
|
+
url: '/acs/credential_provisioning_automations/launch',
|
|
146
|
+
method: 'post',
|
|
147
|
+
data: body,
|
|
148
|
+
},
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
return data.acs_credential_provisioning_automation
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type AcsCredentialProvisioningAutomationsLaunchBody =
|
|
156
|
+
RouteRequestBody<'/acs/credential_provisioning_automations/launch'>
|
|
157
|
+
|
|
158
|
+
export type AcsCredentialProvisioningAutomationsLaunchResponse = SetNonNullable<
|
|
159
|
+
Required<RouteResponse<'/acs/credential_provisioning_automations/launch'>>
|
|
160
|
+
>
|
|
161
|
+
|
|
162
|
+
export type AcsCredentialProvisioningAutomationsLaunchOptions = never
|
|
@@ -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'
|
package/src/lib/version.ts
CHANGED