@atlasauth/backend 0.5.0 → 0.6.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 +187 -0
- package/dist/client/activity.d.ts +104 -0
- package/dist/client/activity.js +29 -0
- package/dist/client/activity.js.map +1 -0
- package/dist/client/audit-events.d.ts +103 -0
- package/dist/client/audit-events.js +43 -0
- package/dist/client/audit-events.js.map +1 -0
- package/dist/client/billing-plans.d.ts +43 -0
- package/dist/client/billing-plans.js +26 -0
- package/dist/client/billing-plans.js.map +1 -1
- package/dist/client/connectors.d.ts +174 -0
- package/dist/client/connectors.js +54 -0
- package/dist/client/connectors.js.map +1 -0
- package/dist/client/data-subject-requests.d.ts +21 -0
- package/dist/client/data-subject-requests.js +15 -0
- package/dist/client/data-subject-requests.js.map +1 -1
- package/dist/client/design.d.ts +295 -0
- package/dist/client/design.js +76 -0
- package/dist/client/design.js.map +1 -0
- package/dist/client/diagnostics.d.ts +53 -0
- package/dist/client/diagnostics.js +24 -0
- package/dist/client/diagnostics.js.map +1 -0
- package/dist/client/email-addresses.d.ts +22 -0
- package/dist/client/email-addresses.js +17 -0
- package/dist/client/email-addresses.js.map +1 -0
- package/dist/client/entitlement-overrides.d.ts +50 -0
- package/dist/client/entitlement-overrides.js +20 -0
- package/dist/client/entitlement-overrides.js.map +1 -0
- package/dist/client/error.d.ts +28 -0
- package/dist/client/error.js +27 -1
- package/dist/client/error.js.map +1 -1
- package/dist/client/index.d.ts +458 -16
- package/dist/client/index.js +76 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/instance.d.ts +54 -0
- package/dist/client/instance.js +18 -0
- package/dist/client/instance.js.map +1 -1
- package/dist/client/invitations.d.ts +14 -0
- package/dist/client/invitations.js +9 -0
- package/dist/client/invitations.js.map +1 -1
- package/dist/client/legacy-auth.d.ts +45 -0
- package/dist/client/legacy-auth.js +18 -0
- package/dist/client/legacy-auth.js.map +1 -0
- package/dist/client/mcp.d.ts +86 -0
- package/dist/client/mcp.js +47 -0
- package/dist/client/mcp.js.map +1 -0
- package/dist/client/notifications.d.ts +92 -0
- package/dist/client/notifications.js +55 -0
- package/dist/client/notifications.js.map +1 -0
- package/dist/client/oauth-clients.d.ts +46 -2
- package/dist/client/oauth-clients.js +4 -0
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/oauth-providers.d.ts +67 -7
- package/dist/client/oauth-providers.js +7 -2
- package/dist/client/oauth-providers.js.map +1 -1
- package/dist/client/openfga.d.ts +137 -0
- package/dist/client/openfga.js +72 -0
- package/dist/client/openfga.js.map +1 -0
- package/dist/client/org-ldap-connections.d.ts +75 -0
- package/dist/client/org-ldap-connections.js +36 -0
- package/dist/client/org-ldap-connections.js.map +1 -0
- package/dist/client/organization-settings-schema.d.ts +24 -0
- package/dist/client/organization-settings-schema.js +30 -0
- package/dist/client/organization-settings-schema.js.map +1 -0
- package/dist/client/organizations.d.ts +205 -4
- package/dist/client/organizations.js +109 -0
- package/dist/client/organizations.js.map +1 -1
- package/dist/client/pca.d.ts +59 -0
- package/dist/client/pca.js +40 -0
- package/dist/client/pca.js.map +1 -0
- package/dist/client/platform.d.ts +328 -0
- package/dist/client/platform.js +187 -0
- package/dist/client/platform.js.map +1 -0
- package/dist/client/redirect-urls.d.ts +23 -0
- package/dist/client/redirect-urls.js +22 -0
- package/dist/client/redirect-urls.js.map +1 -0
- package/dist/client/request.d.ts +45 -0
- package/dist/client/request.js +35 -2
- package/dist/client/request.js.map +1 -1
- package/dist/client/session-exchange-apps.d.ts +43 -0
- package/dist/client/session-exchange-apps.js +25 -0
- package/dist/client/session-exchange-apps.js.map +1 -0
- package/dist/client/sessions.d.ts +12 -0
- package/dist/client/sessions.js +10 -0
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/sign-in-tokens.d.ts +13 -1
- package/dist/client/sign-in-tokens.js +11 -0
- package/dist/client/sign-in-tokens.js.map +1 -1
- package/dist/client/test-mode.d.ts +44 -0
- package/dist/client/test-mode.js +26 -0
- package/dist/client/test-mode.js.map +1 -0
- package/dist/client/tickets.d.ts +49 -0
- package/dist/client/tickets.js +19 -0
- package/dist/client/tickets.js.map +1 -0
- package/dist/client/users.d.ts +346 -0
- package/dist/client/users.js +228 -0
- package/dist/client/users.js.map +1 -1
- package/dist/client/waitlist.d.ts +21 -0
- package/dist/client/waitlist.js +16 -0
- package/dist/client/waitlist.js.map +1 -1
- package/dist/client/webhooks.d.ts +60 -6
- package/dist/client/webhooks.js +36 -2
- package/dist/client/webhooks.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/logout-token.d.ts +97 -0
- package/dist/logout-token.js +182 -0
- package/dist/logout-token.js.map +1 -0
- package/dist/verify.d.ts +7 -0
- package/dist/verify.js +13 -0
- package/dist/verify.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { type AtlasRequestSettings, type RequestFn, type UnknownFieldsEvent } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
import type { AtlasDesign, AtlasDesignPatch, DeletedDesignAsset, DesignAsset, DesignAssetData, DesignPreview, ResolvedAtlasDesign, UploadDesignAssetOptions } from './design';
|
|
4
|
+
/**
|
|
5
|
+
* The platform client: the platform-key (`psk_...`) surface for provisioning and
|
|
6
|
+
* managing apps you own, and for registering Sign in with Atlas apps.
|
|
7
|
+
*
|
|
8
|
+
* A separate client from `createAtlasClient`, because the key is different: a
|
|
9
|
+
* platform key manages many apps, a secret key manages exactly one instance.
|
|
10
|
+
*/
|
|
11
|
+
export interface AtlasPlatformClientConfig {
|
|
12
|
+
/** The platform key (`psk_...`). Sent as `Authorization: Bearer <key>`; never logged. */
|
|
13
|
+
platformKey: string;
|
|
14
|
+
/** Base URL of the API, e.g. `https://api.atlasauth.net`. */
|
|
15
|
+
apiUrl?: string;
|
|
16
|
+
/** Injectable `fetch`, for tests and non-global-fetch runtimes. */
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
/** `true` sends `Atlas-Strict: true` on every write (unknown body fields → 422). */
|
|
19
|
+
strict?: boolean;
|
|
20
|
+
/** Called with the body fields Atlas ignored on a successful write. */
|
|
21
|
+
onUnknownFields?: (event: UnknownFieldsEvent) => void;
|
|
22
|
+
}
|
|
23
|
+
/** An app (instance) a platform owns. Never carries a secret. */
|
|
24
|
+
export interface PlatformApp {
|
|
25
|
+
object: 'app';
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
environment: 'production' | 'development';
|
|
29
|
+
publishable_key: string;
|
|
30
|
+
allowed_origins: string[];
|
|
31
|
+
/** Housekeeping labels (up to 20, each up to 40 chars). */
|
|
32
|
+
tags: string[];
|
|
33
|
+
/** Hidden from the default listing. A visibility flag only: the app still serves auth. */
|
|
34
|
+
archived: boolean;
|
|
35
|
+
/** Epoch ms the app was archived, or null. */
|
|
36
|
+
archived_at: number | null;
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
created_at: number;
|
|
39
|
+
updated_at: number;
|
|
40
|
+
}
|
|
41
|
+
/** An app plus its secret key (`sk_...`), revealed exactly once. */
|
|
42
|
+
export interface PlatformAppWithSecret extends PlatformApp {
|
|
43
|
+
secret: string;
|
|
44
|
+
note?: string;
|
|
45
|
+
}
|
|
46
|
+
/** The create response: the app, its secret and (by default) its test-mode sibling. */
|
|
47
|
+
export interface CreatedPlatformApp extends PlatformAppWithSecret {
|
|
48
|
+
/**
|
|
49
|
+
* The sibling instance in the opposite environment (development for a
|
|
50
|
+
* production app) with its own publishable key and reveal-once secret.
|
|
51
|
+
* Absent when `create_development_sibling: false`.
|
|
52
|
+
*/
|
|
53
|
+
sibling_instance?: PlatformAppWithSecret;
|
|
54
|
+
}
|
|
55
|
+
export interface CreatePlatformAppBody {
|
|
56
|
+
name?: string;
|
|
57
|
+
environment?: 'production' | 'development';
|
|
58
|
+
allowed_origins?: string[];
|
|
59
|
+
/** Default true: also provision a test-mode sibling instance. */
|
|
60
|
+
create_development_sibling?: boolean;
|
|
61
|
+
tags?: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface UpdatePlatformAppBody {
|
|
64
|
+
name?: string;
|
|
65
|
+
allowed_origins?: string[];
|
|
66
|
+
tags?: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface ListPlatformAppsParams {
|
|
69
|
+
/** Only apps carrying this tag. */
|
|
70
|
+
tag?: string;
|
|
71
|
+
/** `true`: only archived apps. */
|
|
72
|
+
archived?: boolean;
|
|
73
|
+
/** `true`: include archived apps alongside active ones. */
|
|
74
|
+
include_archived?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface CreatePlatformInstanceBody {
|
|
77
|
+
environment?: 'production' | 'development';
|
|
78
|
+
allowed_origins?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface PlatformAppSecretRotation {
|
|
81
|
+
object: 'app_secret';
|
|
82
|
+
app_id: string;
|
|
83
|
+
/** The new secret key, revealed exactly once. */
|
|
84
|
+
secret: string;
|
|
85
|
+
overlap_seconds: number;
|
|
86
|
+
/** When the prior keys stop working (epoch ms); null on a hard cut. */
|
|
87
|
+
previous_keys_expire_at?: number | null;
|
|
88
|
+
note: string;
|
|
89
|
+
}
|
|
90
|
+
export interface PlatformInstanceSecretRotation {
|
|
91
|
+
object: 'app_secret';
|
|
92
|
+
id: string;
|
|
93
|
+
secret: string;
|
|
94
|
+
note: string;
|
|
95
|
+
}
|
|
96
|
+
/** Metadata of a currently-valid secret key. Never the secret itself. */
|
|
97
|
+
export interface PlatformSecretKey {
|
|
98
|
+
object: 'secret_key';
|
|
99
|
+
id: string;
|
|
100
|
+
prefix: string;
|
|
101
|
+
created_at: number;
|
|
102
|
+
expires_at?: number | null;
|
|
103
|
+
}
|
|
104
|
+
export interface PlatformAppTransfer {
|
|
105
|
+
object: 'app_transfer';
|
|
106
|
+
id: string;
|
|
107
|
+
/** One-time token for the receiving platform's `apps.acceptTransfer`. */
|
|
108
|
+
transfer_token: string;
|
|
109
|
+
expires_at: number;
|
|
110
|
+
note: string;
|
|
111
|
+
}
|
|
112
|
+
export interface PlatformAppBulkDeleteResult {
|
|
113
|
+
object: 'bulk_delete_result';
|
|
114
|
+
results: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
deleted: boolean;
|
|
117
|
+
reason?: string;
|
|
118
|
+
}>;
|
|
119
|
+
}
|
|
120
|
+
export interface AccountlessApp {
|
|
121
|
+
object: 'accountless_app';
|
|
122
|
+
id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
environment: string;
|
|
125
|
+
publishable_key: string;
|
|
126
|
+
/** One-time token the new owner passes to `apps.claim`. */
|
|
127
|
+
claim_token: string;
|
|
128
|
+
expires_at: number;
|
|
129
|
+
note: string;
|
|
130
|
+
}
|
|
131
|
+
export interface CreateAccountlessAppBody {
|
|
132
|
+
name?: string;
|
|
133
|
+
environment?: 'production' | 'development';
|
|
134
|
+
allowed_origins?: string[];
|
|
135
|
+
}
|
|
136
|
+
/** Page text on the Sign in with Atlas page. Plain text; null or empty uses the default. */
|
|
137
|
+
export interface AtlasIdAppCopy {
|
|
138
|
+
/** Default "Sign in to continue to {app}". */
|
|
139
|
+
sign_in_title?: string | null;
|
|
140
|
+
sign_in_subtitle?: string | null;
|
|
141
|
+
/** Default "Create your account to continue to {app}". */
|
|
142
|
+
sign_up_title?: string | null;
|
|
143
|
+
sign_up_subtitle?: string | null;
|
|
144
|
+
/** Shown on the consent screen above the list of permissions. */
|
|
145
|
+
consent_message?: string | null;
|
|
146
|
+
/** https URL, linked in the page footer. */
|
|
147
|
+
support_url?: string | null;
|
|
148
|
+
/** Text of the support link. Default "Help". */
|
|
149
|
+
support_label?: string | null;
|
|
150
|
+
}
|
|
151
|
+
/** How the Sign in with Atlas page and consent screen look for an app. */
|
|
152
|
+
export interface AtlasIdAppBranding {
|
|
153
|
+
theme: 'auto' | 'light' | 'dark';
|
|
154
|
+
accent_color: string | null;
|
|
155
|
+
background_color: string | null;
|
|
156
|
+
privacy_policy_url: string | null;
|
|
157
|
+
terms_of_service_url: string | null;
|
|
158
|
+
/** The stored design overrides (null = none). */
|
|
159
|
+
design?: AtlasDesign | null;
|
|
160
|
+
resolved_design?: ResolvedAtlasDesign;
|
|
161
|
+
copy: AtlasIdAppCopy;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Branding input. On update each field merges with what is stored; `null`
|
|
165
|
+
* clears a field, and `branding: null` clears all of it.
|
|
166
|
+
*/
|
|
167
|
+
export interface AtlasIdAppBrandingInput {
|
|
168
|
+
/** Default `auto` (follows the visitor's system setting). */
|
|
169
|
+
theme?: 'auto' | 'light' | 'dark' | null;
|
|
170
|
+
/** Button colour, `#RRGGBB`. */
|
|
171
|
+
accent_color?: string | null;
|
|
172
|
+
/** Page background behind the card, `#RRGGBB`. */
|
|
173
|
+
background_color?: string | null;
|
|
174
|
+
/** https URL, linked in the page footer. */
|
|
175
|
+
privacy_policy_url?: string | null;
|
|
176
|
+
terms_of_service_url?: string | null;
|
|
177
|
+
/** Merged like a design patch over what is stored; `null` removes the design. */
|
|
178
|
+
design?: AtlasDesignPatch | null;
|
|
179
|
+
copy?: AtlasIdAppCopy;
|
|
180
|
+
}
|
|
181
|
+
/** A Sign in with Atlas app: an OpenID Connect client on the Atlas issuer. */
|
|
182
|
+
export interface AtlasIdApp {
|
|
183
|
+
object: 'atlas_id_app';
|
|
184
|
+
id: string;
|
|
185
|
+
client_id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
logo_url?: string | null;
|
|
188
|
+
homepage_url?: string | null;
|
|
189
|
+
branding?: AtlasIdAppBranding;
|
|
190
|
+
redirect_uris: string[];
|
|
191
|
+
post_logout_redirect_uris: string[];
|
|
192
|
+
backchannel_logout_uri: string | null;
|
|
193
|
+
backchannel_logout_session_required: boolean;
|
|
194
|
+
frontchannel_logout_uri: string | null;
|
|
195
|
+
frontchannel_logout_session_required: boolean;
|
|
196
|
+
allowed_scopes: string[];
|
|
197
|
+
type: 'confidential' | 'public';
|
|
198
|
+
secret_prefix?: string | null;
|
|
199
|
+
managed_by_instance_id?: string | null;
|
|
200
|
+
created_at: number;
|
|
201
|
+
updated_at: number;
|
|
202
|
+
/** On `get` only: people who have approved the app. */
|
|
203
|
+
user_count?: number;
|
|
204
|
+
}
|
|
205
|
+
/** Create / rotate response: confidential apps carry the client secret exactly once. */
|
|
206
|
+
export interface AtlasIdAppWithSecret extends AtlasIdApp {
|
|
207
|
+
client_secret?: string;
|
|
208
|
+
note?: string;
|
|
209
|
+
}
|
|
210
|
+
export interface AtlasIdAppList {
|
|
211
|
+
object: 'list';
|
|
212
|
+
data: AtlasIdApp[];
|
|
213
|
+
/** The issuer every app's tokens carry. */
|
|
214
|
+
issuer: string;
|
|
215
|
+
discovery_url: string;
|
|
216
|
+
/** How many apps the account may register. */
|
|
217
|
+
limit: number;
|
|
218
|
+
}
|
|
219
|
+
interface AtlasIdAppFields {
|
|
220
|
+
/** Where `/oauth2/logout` may send the user after sign-out (exact match). */
|
|
221
|
+
post_logout_redirect_uris?: string[];
|
|
222
|
+
/** Back-Channel Logout: a signed `logout_token` is POSTed here when the user signs out. */
|
|
223
|
+
backchannel_logout_uri?: string | null;
|
|
224
|
+
/** Whether the app needs `sid` in the logout_token (Atlas always includes it). */
|
|
225
|
+
backchannel_logout_session_required?: boolean;
|
|
226
|
+
/** Front-Channel Logout: loaded in a hidden iframe on the Atlas sign-out page. */
|
|
227
|
+
frontchannel_logout_uri?: string | null;
|
|
228
|
+
/** Add `sid` to the front-channel logout URL. */
|
|
229
|
+
frontchannel_logout_session_required?: boolean;
|
|
230
|
+
logo_url?: string | null;
|
|
231
|
+
homepage_url?: string | null;
|
|
232
|
+
allowed_scopes?: string[];
|
|
233
|
+
branding?: AtlasIdAppBrandingInput | null;
|
|
234
|
+
}
|
|
235
|
+
export interface CreateAtlasIdAppBody extends AtlasIdAppFields {
|
|
236
|
+
name: string;
|
|
237
|
+
redirect_uris: string[];
|
|
238
|
+
/** Default `confidential`. */
|
|
239
|
+
type?: 'confidential' | 'public';
|
|
240
|
+
}
|
|
241
|
+
export interface UpdateAtlasIdAppBody extends AtlasIdAppFields {
|
|
242
|
+
name?: string;
|
|
243
|
+
redirect_uris?: string[];
|
|
244
|
+
}
|
|
245
|
+
declare function platformNamespaces(request: RequestFn): {
|
|
246
|
+
apps: {
|
|
247
|
+
/** Archived apps are hidden unless `include_archived` or `archived` is set. */
|
|
248
|
+
list(params?: ListPlatformAppsParams): Promise<ListPage<PlatformApp>>;
|
|
249
|
+
/** Provision an app; its secret key is revealed exactly once. */
|
|
250
|
+
create(body?: CreatePlatformAppBody, idempotencyKey?: string): Promise<CreatedPlatformApp>;
|
|
251
|
+
get(id: string): Promise<PlatformApp>;
|
|
252
|
+
update(id: string, body: UpdatePlatformAppBody): Promise<PlatformApp>;
|
|
253
|
+
/** Disable the app (sign-ins and sign-ups refused). Soft and reversible. */
|
|
254
|
+
delete(id: string): Promise<{
|
|
255
|
+
object: "app";
|
|
256
|
+
id: string;
|
|
257
|
+
disabled: true;
|
|
258
|
+
note: string;
|
|
259
|
+
}>;
|
|
260
|
+
/** Disable up to 100 apps; ids you do not own are skipped as `not_found`. */
|
|
261
|
+
bulkDelete(ids: string[]): Promise<PlatformAppBulkDeleteResult>;
|
|
262
|
+
/** Hide from the default listing. Does not disable the app. */
|
|
263
|
+
archive(id: string): Promise<PlatformApp>;
|
|
264
|
+
unarchive(id: string): Promise<PlatformApp>;
|
|
265
|
+
/**
|
|
266
|
+
* Mint a new secret key while the prior keys stay valid for
|
|
267
|
+
* `overlap_seconds` (default 72h, max 7 days; 0 = immediate cut).
|
|
268
|
+
*/
|
|
269
|
+
rotateSecret(id: string, body?: {
|
|
270
|
+
overlap_seconds?: number;
|
|
271
|
+
}, idempotencyKey?: string): Promise<PlatformAppSecretRotation>;
|
|
272
|
+
/** Currently-valid secret keys (metadata only). */
|
|
273
|
+
secretKeys(id: string): Promise<ListPage<PlatformSecretKey>>;
|
|
274
|
+
instances: {
|
|
275
|
+
list(appId: string): Promise<ListPage<PlatformApp>>;
|
|
276
|
+
/** Add an instance (e.g. development beside production); secret revealed once. */
|
|
277
|
+
create(appId: string, body?: CreatePlatformInstanceBody, idempotencyKey?: string): Promise<PlatformAppWithSecret>;
|
|
278
|
+
/** Revoke the instance's prior keys and mint a new one, revealed once. */
|
|
279
|
+
rotateSecret(appId: string, instanceId: string, idempotencyKey?: string): Promise<PlatformInstanceSecretRotation>;
|
|
280
|
+
};
|
|
281
|
+
/** Start a transfer: a one-time token the receiving platform accepts. */
|
|
282
|
+
transfer(id: string, idempotencyKey?: string): Promise<PlatformAppTransfer>;
|
|
283
|
+
/** Take ownership of an app by its transfer token. */
|
|
284
|
+
acceptTransfer(transferToken: string, idempotencyKey?: string): Promise<PlatformApp & {
|
|
285
|
+
note: string;
|
|
286
|
+
}>;
|
|
287
|
+
/** Claim an accountless app by its claim token; mints its first secret key. */
|
|
288
|
+
claim(claimToken: string, idempotencyKey?: string): Promise<PlatformAppWithSecret>;
|
|
289
|
+
};
|
|
290
|
+
accountlessApps: {
|
|
291
|
+
/** Mint an app owned by no platform, with a one-time claim token. No secret until claimed. */
|
|
292
|
+
create(body?: CreateAccountlessAppBody, idempotencyKey?: string): Promise<AccountlessApp>;
|
|
293
|
+
};
|
|
294
|
+
/** Sign in with Atlas apps registered to the platform's account. */
|
|
295
|
+
atlasIdApps: {
|
|
296
|
+
list(): Promise<AtlasIdAppList>;
|
|
297
|
+
/** Register an app. A confidential app's `client_secret` is returned exactly once. */
|
|
298
|
+
create(body: CreateAtlasIdAppBody, idempotencyKey?: string): Promise<AtlasIdAppWithSecret>;
|
|
299
|
+
get(id: string): Promise<AtlasIdApp>;
|
|
300
|
+
/** `[]` clears a URI list; `null` clears a logout URI. */
|
|
301
|
+
update(id: string, body: UpdateAtlasIdAppBody): Promise<AtlasIdApp>;
|
|
302
|
+
/** The client_id stops working immediately. */
|
|
303
|
+
delete(id: string): Promise<{
|
|
304
|
+
object: "atlas_id_app";
|
|
305
|
+
id: string;
|
|
306
|
+
deleted: true;
|
|
307
|
+
}>;
|
|
308
|
+
/** New client secret, returned exactly once. Public apps have none (409). */
|
|
309
|
+
rotateSecret(id: string): Promise<AtlasIdAppWithSecret>;
|
|
310
|
+
/** Preview a design on the Sign in with Atlas page without saving it. */
|
|
311
|
+
previewDesign(design: AtlasDesign): Promise<DesignPreview>;
|
|
312
|
+
};
|
|
313
|
+
/** Design images owned by the platform's account, for Sign in with Atlas app designs. */
|
|
314
|
+
designAssets: {
|
|
315
|
+
upload(data: DesignAssetData, options?: UploadDesignAssetOptions): Promise<DesignAsset>;
|
|
316
|
+
list(): Promise<ListPage<DesignAsset>>;
|
|
317
|
+
/** Refused with 409 while a saved app design still uses it. */
|
|
318
|
+
delete(assetId: string): Promise<DeletedDesignAsset>;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
/** Every namespace of the platform client. */
|
|
322
|
+
export type AtlasPlatformNamespaces = ReturnType<typeof platformNamespaces>;
|
|
323
|
+
export interface AtlasPlatformClient extends AtlasPlatformNamespaces {
|
|
324
|
+
/** A copy of this client with some settings changed, e.g. `{ strict: true }`. */
|
|
325
|
+
withOptions(overrides: AtlasRequestSettings): AtlasPlatformClient;
|
|
326
|
+
}
|
|
327
|
+
export declare function createAtlasPlatformClient(config: AtlasPlatformClientConfig): AtlasPlatformClient;
|
|
328
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAtlasPlatformClient = createAtlasPlatformClient;
|
|
4
|
+
const request_1 = require("./request");
|
|
5
|
+
// ---- the client ----------------------------------------------------------------
|
|
6
|
+
function platformNamespaces(request) {
|
|
7
|
+
return {
|
|
8
|
+
apps: {
|
|
9
|
+
/** Archived apps are hidden unless `include_archived` or `archived` is set. */
|
|
10
|
+
list(params = {}) {
|
|
11
|
+
return request({ method: 'GET', path: '/v1/platform/apps', query: { ...params } });
|
|
12
|
+
},
|
|
13
|
+
/** Provision an app; its secret key is revealed exactly once. */
|
|
14
|
+
create(body = {}, idempotencyKey) {
|
|
15
|
+
return request({ method: 'POST', path: '/v1/platform/apps', body, idempotencyKey });
|
|
16
|
+
},
|
|
17
|
+
get(id) {
|
|
18
|
+
return request({ method: 'GET', path: `/v1/platform/apps/${(0, request_1.enc)(id)}` });
|
|
19
|
+
},
|
|
20
|
+
update(id, body) {
|
|
21
|
+
return request({ method: 'PATCH', path: `/v1/platform/apps/${(0, request_1.enc)(id)}`, body });
|
|
22
|
+
},
|
|
23
|
+
/** Disable the app (sign-ins and sign-ups refused). Soft and reversible. */
|
|
24
|
+
delete(id) {
|
|
25
|
+
return request({ method: 'DELETE', path: `/v1/platform/apps/${(0, request_1.enc)(id)}` });
|
|
26
|
+
},
|
|
27
|
+
/** Disable up to 100 apps; ids you do not own are skipped as `not_found`. */
|
|
28
|
+
bulkDelete(ids) {
|
|
29
|
+
return request({ method: 'POST', path: '/v1/platform/apps/bulk_delete', body: { ids } });
|
|
30
|
+
},
|
|
31
|
+
/** Hide from the default listing. Does not disable the app. */
|
|
32
|
+
archive(id) {
|
|
33
|
+
return request({ method: 'POST', path: `/v1/platform/apps/${(0, request_1.enc)(id)}/archive` });
|
|
34
|
+
},
|
|
35
|
+
unarchive(id) {
|
|
36
|
+
return request({ method: 'POST', path: `/v1/platform/apps/${(0, request_1.enc)(id)}/unarchive` });
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Mint a new secret key while the prior keys stay valid for
|
|
40
|
+
* `overlap_seconds` (default 72h, max 7 days; 0 = immediate cut).
|
|
41
|
+
*/
|
|
42
|
+
rotateSecret(id, body = {}, idempotencyKey) {
|
|
43
|
+
return request({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
path: `/v1/platform/apps/${(0, request_1.enc)(id)}/rotate_secret`,
|
|
46
|
+
body,
|
|
47
|
+
idempotencyKey,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
/** Currently-valid secret keys (metadata only). */
|
|
51
|
+
secretKeys(id) {
|
|
52
|
+
return request({ method: 'GET', path: `/v1/platform/apps/${(0, request_1.enc)(id)}/secret_keys` });
|
|
53
|
+
},
|
|
54
|
+
instances: {
|
|
55
|
+
list(appId) {
|
|
56
|
+
return request({ method: 'GET', path: `/v1/platform/apps/${(0, request_1.enc)(appId)}/instances` });
|
|
57
|
+
},
|
|
58
|
+
/** Add an instance (e.g. development beside production); secret revealed once. */
|
|
59
|
+
create(appId, body = {}, idempotencyKey) {
|
|
60
|
+
return request({
|
|
61
|
+
method: 'POST',
|
|
62
|
+
path: `/v1/platform/apps/${(0, request_1.enc)(appId)}/instances`,
|
|
63
|
+
body,
|
|
64
|
+
idempotencyKey,
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
/** Revoke the instance's prior keys and mint a new one, revealed once. */
|
|
68
|
+
rotateSecret(appId, instanceId, idempotencyKey) {
|
|
69
|
+
return request({
|
|
70
|
+
method: 'POST',
|
|
71
|
+
path: `/v1/platform/apps/${(0, request_1.enc)(appId)}/instances/${(0, request_1.enc)(instanceId)}/rotate_secret`,
|
|
72
|
+
idempotencyKey,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
/** Start a transfer: a one-time token the receiving platform accepts. */
|
|
77
|
+
transfer(id, idempotencyKey) {
|
|
78
|
+
return request({
|
|
79
|
+
method: 'POST',
|
|
80
|
+
path: `/v1/platform/apps/${(0, request_1.enc)(id)}/transfer`,
|
|
81
|
+
idempotencyKey,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
/** Take ownership of an app by its transfer token. */
|
|
85
|
+
acceptTransfer(transferToken, idempotencyKey) {
|
|
86
|
+
return request({
|
|
87
|
+
method: 'POST',
|
|
88
|
+
path: '/v1/platform/apps/accept_transfer',
|
|
89
|
+
body: { transfer_token: transferToken },
|
|
90
|
+
idempotencyKey,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
/** Claim an accountless app by its claim token; mints its first secret key. */
|
|
94
|
+
claim(claimToken, idempotencyKey) {
|
|
95
|
+
return request({
|
|
96
|
+
method: 'POST',
|
|
97
|
+
path: '/v1/platform/apps/claim',
|
|
98
|
+
body: { claim_token: claimToken },
|
|
99
|
+
idempotencyKey,
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
accountlessApps: {
|
|
104
|
+
/** Mint an app owned by no platform, with a one-time claim token. No secret until claimed. */
|
|
105
|
+
create(body = {}, idempotencyKey) {
|
|
106
|
+
return request({
|
|
107
|
+
method: 'POST',
|
|
108
|
+
path: '/v1/platform/accountless_apps',
|
|
109
|
+
body,
|
|
110
|
+
idempotencyKey,
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
/** Sign in with Atlas apps registered to the platform's account. */
|
|
115
|
+
atlasIdApps: {
|
|
116
|
+
list() {
|
|
117
|
+
return request({ method: 'GET', path: '/v1/platform/atlas_id_apps' });
|
|
118
|
+
},
|
|
119
|
+
/** Register an app. A confidential app's `client_secret` is returned exactly once. */
|
|
120
|
+
create(body, idempotencyKey) {
|
|
121
|
+
return request({
|
|
122
|
+
method: 'POST',
|
|
123
|
+
path: '/v1/platform/atlas_id_apps',
|
|
124
|
+
body,
|
|
125
|
+
idempotencyKey,
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
get(id) {
|
|
129
|
+
return request({ method: 'GET', path: `/v1/platform/atlas_id_apps/${(0, request_1.enc)(id)}` });
|
|
130
|
+
},
|
|
131
|
+
/** `[]` clears a URI list; `null` clears a logout URI. */
|
|
132
|
+
update(id, body) {
|
|
133
|
+
return request({ method: 'PATCH', path: `/v1/platform/atlas_id_apps/${(0, request_1.enc)(id)}`, body });
|
|
134
|
+
},
|
|
135
|
+
/** The client_id stops working immediately. */
|
|
136
|
+
delete(id) {
|
|
137
|
+
return request({ method: 'DELETE', path: `/v1/platform/atlas_id_apps/${(0, request_1.enc)(id)}` });
|
|
138
|
+
},
|
|
139
|
+
/** New client secret, returned exactly once. Public apps have none (409). */
|
|
140
|
+
rotateSecret(id) {
|
|
141
|
+
return request({
|
|
142
|
+
method: 'POST',
|
|
143
|
+
path: `/v1/platform/atlas_id_apps/${(0, request_1.enc)(id)}/rotate_secret`,
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
/** Preview a design on the Sign in with Atlas page without saving it. */
|
|
147
|
+
previewDesign(design) {
|
|
148
|
+
return request({
|
|
149
|
+
method: 'POST',
|
|
150
|
+
path: '/v1/platform/atlas_id_apps/design/preview',
|
|
151
|
+
body: { design },
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
/** Design images owned by the platform's account, for Sign in with Atlas app designs. */
|
|
156
|
+
designAssets: {
|
|
157
|
+
upload(data, options = {}) {
|
|
158
|
+
return request({
|
|
159
|
+
method: 'POST',
|
|
160
|
+
path: '/v1/platform/design/assets',
|
|
161
|
+
query: { kind: options.kind },
|
|
162
|
+
rawBody: { data, contentType: options.contentType },
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
list() {
|
|
166
|
+
return request({ method: 'GET', path: '/v1/platform/design/assets' });
|
|
167
|
+
},
|
|
168
|
+
/** Refused with 409 while a saved app design still uses it. */
|
|
169
|
+
delete(assetId) {
|
|
170
|
+
return request({ method: 'DELETE', path: `/v1/platform/design/assets/${(0, request_1.enc)(assetId)}` });
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function createAtlasPlatformClient(config) {
|
|
176
|
+
if (!config.platformKey) {
|
|
177
|
+
throw new Error('createAtlasPlatformClient requires a platformKey.');
|
|
178
|
+
}
|
|
179
|
+
const request = (0, request_1.createKeyedRequest)(config.platformKey, config);
|
|
180
|
+
return {
|
|
181
|
+
...platformNamespaces(request),
|
|
182
|
+
withOptions(overrides) {
|
|
183
|
+
return createAtlasPlatformClient({ ...config, ...overrides });
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/client/platform.ts"],"names":[],"mappings":";;AAieA,8DAWC;AA5eD,uCAMmB;AAsRnB,mFAAmF;AAEnF,SAAS,kBAAkB,CAAC,OAAkB;IAC5C,OAAO;QACL,IAAI,EAAE;YACJ,+EAA+E;YAC/E,IAAI,CAAC,SAAiC,EAAE;gBACtC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;YACrF,CAAC;YACD,iEAAiE;YACjE,MAAM,CAAC,OAA8B,EAAE,EAAE,cAAuB;gBAC9D,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;YACtF,CAAC;YACD,GAAG,CAAC,EAAU;gBACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1E,CAAC;YACD,MAAM,CAAC,EAAU,EAAE,IAA2B;gBAC5C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAClF,CAAC;YACD,4EAA4E;YAC5E,MAAM,CACJ,EAAU;gBAEV,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7E,CAAC;YACD,6EAA6E;YAC7E,UAAU,CAAC,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AAC,CAAC;YACL,CAAC;SACF;QACD,yFAAyF;QACzF,YAAY,EAAE;YACZ,MAAM,CAAC,IAAqB,EAAE,UAAoC,EAAE;gBAClE,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,4BAA4B;oBAClC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;oBAC7B,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;iBACpD,CAAC,CAAC;YACL,CAAC;YACD,IAAI;gBACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,4BAA4B,EAAE,CAAC,CAAC;YACxE,CAAC;YACD,+DAA+D;YAC/D,MAAM,CAAC,OAAe;gBACpB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,8BAA8B,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3F,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAUD,SAAgB,yBAAyB,CAAC,MAAiC;IACzE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,OAAO,GAAG,IAAA,4BAAkB,EAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/D,OAAO;QACL,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAC9B,WAAW,CAAC,SAA+B;YACzC,OAAO,yBAAyB,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
/** An allowlisted OAuth/SSO redirect URL. */
|
|
4
|
+
export interface RedirectUrl {
|
|
5
|
+
object: 'redirect_url';
|
|
6
|
+
id: string;
|
|
7
|
+
url: string;
|
|
8
|
+
/** Epoch ms. */
|
|
9
|
+
created_at: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function redirectUrlsResource(request: RequestFn): {
|
|
12
|
+
list(): Promise<ListPage<RedirectUrl> & {
|
|
13
|
+
next_cursor?: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
/** Add an absolute http(s) URL. Idempotent on the URL. */
|
|
16
|
+
create(url: string, idempotencyKey?: string): Promise<RedirectUrl>;
|
|
17
|
+
get(id: string): Promise<RedirectUrl>;
|
|
18
|
+
delete(id: string): Promise<{
|
|
19
|
+
object: "redirect_url";
|
|
20
|
+
id: string;
|
|
21
|
+
deleted: true;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redirectUrlsResource = redirectUrlsResource;
|
|
4
|
+
const request_1 = require("./request");
|
|
5
|
+
function redirectUrlsResource(request) {
|
|
6
|
+
return {
|
|
7
|
+
list() {
|
|
8
|
+
return request({ method: 'GET', path: '/v1/redirect_urls' });
|
|
9
|
+
},
|
|
10
|
+
/** Add an absolute http(s) URL. Idempotent on the URL. */
|
|
11
|
+
create(url, idempotencyKey) {
|
|
12
|
+
return request({ method: 'POST', path: '/v1/redirect_urls', body: { url }, idempotencyKey });
|
|
13
|
+
},
|
|
14
|
+
get(id) {
|
|
15
|
+
return request({ method: 'GET', path: `/v1/redirect_urls/${(0, request_1.enc)(id)}` });
|
|
16
|
+
},
|
|
17
|
+
delete(id) {
|
|
18
|
+
return request({ method: 'DELETE', path: `/v1/redirect_urls/${(0, request_1.enc)(id)}` });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=redirect-urls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect-urls.js","sourceRoot":"","sources":["../../src/client/redirect-urls.ts"],"names":[],"mappings":";;AAYA,oDAgBC;AA5BD,uCAAgD;AAYhD,SAAgB,oBAAoB,CAAC,OAAkB;IACrD,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,0DAA0D;QAC1D,MAAM,CAAC,GAAW,EAAE,cAAuB;YACzC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QAC/F,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/client/request.d.ts
CHANGED
|
@@ -23,6 +23,37 @@ export interface AtlasClientConfig {
|
|
|
23
23
|
apiUrl?: string;
|
|
24
24
|
/** Injectable `fetch`, for tests and non-global-fetch runtimes. */
|
|
25
25
|
fetch?: typeof fetch;
|
|
26
|
+
/**
|
|
27
|
+
* Strict request bodies. `true` sends `Atlas-Strict: true` on every write, so
|
|
28
|
+
* a body field the endpoint does not accept is refused with
|
|
29
|
+
* `422 UNKNOWN_FIELD` (before anything changes) instead of being ignored.
|
|
30
|
+
* `false` sends `Atlas-Strict: false`, opting out of an instance-wide strict
|
|
31
|
+
* default. Unset sends nothing and the instance setting applies. Override it
|
|
32
|
+
* for a single call with `client.withOptions({ strict })`.
|
|
33
|
+
*/
|
|
34
|
+
strict?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Called when a write succeeded but Atlas ignored some body fields (the
|
|
37
|
+
* `Atlas-Unknown-Fields` response header) — usually a typo or a field from a
|
|
38
|
+
* newer API version. Not called in strict mode, where the write fails instead.
|
|
39
|
+
*/
|
|
40
|
+
onUnknownFields?: (event: UnknownFieldsEvent) => void;
|
|
41
|
+
}
|
|
42
|
+
/** What {@link AtlasClientConfig.onUnknownFields} receives. */
|
|
43
|
+
export interface UnknownFieldsEvent {
|
|
44
|
+
method: RequestOptions['method'];
|
|
45
|
+
/** The request path, e.g. `/v1/users/user_123`. */
|
|
46
|
+
path: string;
|
|
47
|
+
/** Every ignored field; nested fields as `parent.child`. */
|
|
48
|
+
fields: string[];
|
|
49
|
+
}
|
|
50
|
+
/** Per-client settings `withOptions` can override. */
|
|
51
|
+
export type AtlasRequestSettings = Pick<AtlasClientConfig, 'strict' | 'onUnknownFields'>;
|
|
52
|
+
/** A raw (non-JSON) request body, e.g. image bytes for a design-asset upload. */
|
|
53
|
+
export interface RawBody {
|
|
54
|
+
data: Blob | ArrayBuffer | ArrayBufferView;
|
|
55
|
+
/** The body's media type, e.g. `image/png`. Defaults to a Blob's own `type`. */
|
|
56
|
+
contentType?: string;
|
|
26
57
|
}
|
|
27
58
|
/** The default BAPI origin, overridable per instance via `apiUrl`. */
|
|
28
59
|
export declare const DEFAULT_API_URL = "https://api.atlasauth.net";
|
|
@@ -35,10 +66,14 @@ export interface RequestOptions {
|
|
|
35
66
|
query?: QueryParams;
|
|
36
67
|
/** JSON body; omitted entirely when undefined. */
|
|
37
68
|
body?: unknown;
|
|
69
|
+
/** A raw body sent as-is with its own content type (instead of `body`). */
|
|
70
|
+
rawBody?: RawBody;
|
|
38
71
|
/** Idempotency-Key header (§9.1), when a caller supplies one. */
|
|
39
72
|
idempotencyKey?: string;
|
|
40
73
|
/** When true, the raw text body is returned instead of parsed JSON (SAML XML). */
|
|
41
74
|
raw?: boolean;
|
|
75
|
+
/** Per-request override of {@link AtlasClientConfig.strict}. */
|
|
76
|
+
strict?: boolean;
|
|
42
77
|
}
|
|
43
78
|
/** Serialize a query object to a string, dropping null/undefined, spreading arrays. */
|
|
44
79
|
export declare function serializeQuery(query: QueryParams | undefined): string;
|
|
@@ -50,3 +85,13 @@ export declare function enc(segment: string): string;
|
|
|
50
85
|
*/
|
|
51
86
|
export type RequestFn = <T>(options: RequestOptions) => Promise<T>;
|
|
52
87
|
export declare function createRequest(config: AtlasClientConfig): RequestFn;
|
|
88
|
+
/** Settings shared by every keyed client (secret key or platform key). */
|
|
89
|
+
export interface KeyedRequestConfig extends AtlasRequestSettings {
|
|
90
|
+
apiUrl?: string;
|
|
91
|
+
fetch?: typeof fetch;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The request core for any bearer key: the secret key (`sk_...`) of the
|
|
95
|
+
* management client or the platform key (`psk_...`) of the platform client.
|
|
96
|
+
*/
|
|
97
|
+
export declare function createKeyedRequest(key: string, config: KeyedRequestConfig): RequestFn;
|