@atlasauth/backend 0.15.0 → 0.16.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/CHANGELOG.md +19 -0
- package/dist/botid.d.ts +70 -0
- package/dist/botid.js +88 -0
- package/dist/botid.js.map +1 -0
- package/dist/client/action-gallery.d.ts +215 -0
- package/dist/client/action-gallery.js +66 -0
- package/dist/client/action-gallery.js.map +1 -0
- package/dist/client/actions.d.ts +21 -0
- package/dist/client/actions.js.map +1 -1
- package/dist/client/attack-protection.d.ts +33 -1
- package/dist/client/attack-protection.js.map +1 -1
- package/dist/client/billing-plans.d.ts +93 -0
- package/dist/client/billing-plans.js +31 -0
- package/dist/client/billing-plans.js.map +1 -1
- package/dist/client/custom-oauth-providers.d.ts +243 -0
- package/dist/client/custom-oauth-providers.js +60 -0
- package/dist/client/custom-oauth-providers.js.map +1 -0
- package/dist/client/email-templates.d.ts +1 -1
- package/dist/client/email-templates.js.map +1 -1
- package/dist/client/index.d.ts +108 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/instance-security.d.ts +70 -0
- package/dist/client/instance-security.js +20 -0
- package/dist/client/instance-security.js.map +1 -1
- package/dist/client/oauth-clients.d.ts +29 -2
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/resource-servers.d.ts +22 -2
- package/dist/client/resource-servers.js.map +1 -1
- package/dist/client/risk-based-mfa.d.ts +3 -0
- package/dist/client/risk-based-mfa.js.map +1 -1
- package/dist/client/sessions.d.ts +16 -0
- package/dist/client/sessions.js +15 -0
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/sso-connections.d.ts +83 -0
- package/dist/client/sso-connections.js +29 -0
- package/dist/client/sso-connections.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth-resource.d.ts +81 -1
- package/dist/oauth-resource.js +204 -29
- package/dist/oauth-resource.js.map +1 -1
- package/package.json +3 -3
|
@@ -15,11 +15,22 @@ export interface BillingPlan {
|
|
|
15
15
|
amount: string | null;
|
|
16
16
|
currency: string;
|
|
17
17
|
features: string[];
|
|
18
|
+
/** Numeric limits the plan grants (the `ent.limits` claim); `-1` = unlimited. */
|
|
19
|
+
limits?: Record<string, unknown>;
|
|
18
20
|
audience: string;
|
|
19
21
|
active: boolean;
|
|
22
|
+
/** stripe | polar | dodo | creem | chargebee | autumn | commet */
|
|
23
|
+
provider?: BillingProviderName;
|
|
24
|
+
/** The plan's price reference on its provider. */
|
|
25
|
+
provider_price_id?: string | null;
|
|
26
|
+
/** `base`: the subject's main plan. `addon`: bought alongside it; several may be live. */
|
|
27
|
+
kind?: 'base' | 'addon';
|
|
28
|
+
/** Autumn plans: the feature whose usage tracks the org's member count. */
|
|
29
|
+
seat_feature_id?: string | null;
|
|
20
30
|
created_at: number;
|
|
21
31
|
updated_at: number;
|
|
22
32
|
}
|
|
33
|
+
export type BillingProviderName = 'stripe' | 'polar' | 'dodo' | 'creem' | 'chargebee' | 'autumn' | 'commet';
|
|
23
34
|
/**
|
|
24
35
|
* A read view of who is subscribed. `status` is written ONLY by the verified
|
|
25
36
|
* Stripe webhook, never through this SDK.
|
|
@@ -34,9 +45,55 @@ export interface BillingSubscription {
|
|
|
34
45
|
stripe_subscription_id: string | null;
|
|
35
46
|
stripe_customer_id: string | null;
|
|
36
47
|
current_period_end: number | null;
|
|
48
|
+
provider?: BillingProviderName;
|
|
49
|
+
provider_subscription_id?: string | null;
|
|
50
|
+
provider_customer_id?: string | null;
|
|
51
|
+
quantity?: number;
|
|
52
|
+
cancel_at_period_end?: boolean;
|
|
53
|
+
/** What an entitlement provider (Autumn, Commet) reports this subscription grants. */
|
|
54
|
+
entitlements?: {
|
|
55
|
+
features: string[];
|
|
56
|
+
limits: Record<string, number>;
|
|
57
|
+
} | null;
|
|
37
58
|
created_at: number;
|
|
38
59
|
updated_at: number;
|
|
39
60
|
}
|
|
61
|
+
/** How numeric limits merge when a subject holds several entitling subscriptions. */
|
|
62
|
+
export interface BillingSettings {
|
|
63
|
+
object: 'billing_settings';
|
|
64
|
+
default_limit_merge: 'max' | 'sum';
|
|
65
|
+
limit_merge: Record<string, 'max' | 'sum'>;
|
|
66
|
+
}
|
|
67
|
+
export interface UpdateBillingSettingsBody {
|
|
68
|
+
default_limit_merge?: 'max' | 'sum';
|
|
69
|
+
/** Limit key → `max` | `sum`; replaces the stored map. */
|
|
70
|
+
limit_merge?: Record<string, 'max' | 'sum'>;
|
|
71
|
+
}
|
|
72
|
+
/** May a subject use a feature? */
|
|
73
|
+
export interface CheckBillingFeatureBody {
|
|
74
|
+
subject_type: 'user' | 'org';
|
|
75
|
+
subject_id: string;
|
|
76
|
+
feature: string;
|
|
77
|
+
/** Units about to be used (default 1). */
|
|
78
|
+
required?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface BillingFeatureCheck {
|
|
81
|
+
object: 'billing_feature_check';
|
|
82
|
+
feature: string;
|
|
83
|
+
allowed: boolean;
|
|
84
|
+
/** `provider`: asked live of Autumn/Commet; `atlas`: from the resolved entitlement. */
|
|
85
|
+
source: 'provider' | 'atlas';
|
|
86
|
+
provider: string | null;
|
|
87
|
+
remaining: number | null;
|
|
88
|
+
granted: number | null;
|
|
89
|
+
usage: number | null;
|
|
90
|
+
unlimited: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface ChangeBillingSubscriptionBody {
|
|
93
|
+
plan_id: string;
|
|
94
|
+
interval?: 'month' | 'year';
|
|
95
|
+
schedule_at_period_end?: boolean;
|
|
96
|
+
}
|
|
40
97
|
export interface CreateBillingPlanBody {
|
|
41
98
|
name: string;
|
|
42
99
|
slug: string;
|
|
@@ -49,6 +106,13 @@ export interface CreateBillingPlanBody {
|
|
|
49
106
|
/** One of `user`, `org`. Defaults to `user`. */
|
|
50
107
|
audience?: string;
|
|
51
108
|
active?: boolean;
|
|
109
|
+
limits?: Record<string, unknown>;
|
|
110
|
+
provider?: BillingProviderName;
|
|
111
|
+
provider_price_id?: string;
|
|
112
|
+
/** `base` (default) or `addon`. */
|
|
113
|
+
kind?: 'base' | 'addon';
|
|
114
|
+
/** Autumn: one of the plan's features; its usage follows the org's member count. */
|
|
115
|
+
seat_feature_id?: string | null;
|
|
52
116
|
}
|
|
53
117
|
export interface UpdateBillingPlanBody {
|
|
54
118
|
name?: string;
|
|
@@ -60,6 +124,12 @@ export interface UpdateBillingPlanBody {
|
|
|
60
124
|
features?: string[];
|
|
61
125
|
audience?: string;
|
|
62
126
|
active?: boolean;
|
|
127
|
+
limits?: Record<string, unknown>;
|
|
128
|
+
provider?: BillingProviderName;
|
|
129
|
+
provider_price_id?: string;
|
|
130
|
+
kind?: 'base' | 'addon';
|
|
131
|
+
/** `null` clears it. */
|
|
132
|
+
seat_feature_id?: string | null;
|
|
63
133
|
}
|
|
64
134
|
/** Filter the subscription read view to one subject. */
|
|
65
135
|
export interface ListSubscriptionsParams {
|
|
@@ -83,6 +153,10 @@ export interface ReportBillingUsageBody {
|
|
|
83
153
|
/** Non-negative. */
|
|
84
154
|
quantity: number;
|
|
85
155
|
idempotency_key: string;
|
|
156
|
+
/** Count against this provider feature (an Autumn feature id / Commet feature code). */
|
|
157
|
+
feature?: string;
|
|
158
|
+
/** Attribute to this subscription when the subject holds several. */
|
|
159
|
+
subscription_id?: string;
|
|
86
160
|
}
|
|
87
161
|
export interface BillingUsageReport {
|
|
88
162
|
object: 'billing_usage';
|
|
@@ -109,6 +183,25 @@ export declare function billingResource(request: RequestFn): {
|
|
|
109
183
|
deleted: true;
|
|
110
184
|
}>;
|
|
111
185
|
listSubscriptions(params?: ListSubscriptionsParams): Promise<ListPage<BillingSubscription>>;
|
|
186
|
+
/** One subscription by id (a subject may hold several: a base plan + add-ons). */
|
|
187
|
+
getSubscription(id: string): Promise<BillingSubscription>;
|
|
188
|
+
/** Move one subscription to another plan or interval (now, or at the period end). */
|
|
189
|
+
changeSubscription(id: string, body: ChangeBillingSubscriptionBody): Promise<BillingSubscription & {
|
|
190
|
+
scheduled: boolean;
|
|
191
|
+
}>;
|
|
192
|
+
/** Cancel one subscription at the period end (default) or now. */
|
|
193
|
+
cancelSubscription(id: string, body?: {
|
|
194
|
+
immediately?: boolean;
|
|
195
|
+
}): Promise<BillingSubscription>;
|
|
196
|
+
/** Undo a cancellation scheduled for the period end. */
|
|
197
|
+
restoreSubscription(id: string): Promise<BillingSubscription>;
|
|
198
|
+
/** Mirror a plan's features/limits from its provider (Autumn, Commet). */
|
|
199
|
+
syncPlanEntitlements(id: string): Promise<BillingPlan>;
|
|
200
|
+
/** How limits merge across a subject's several subscriptions. */
|
|
201
|
+
getSettings(): Promise<BillingSettings>;
|
|
202
|
+
updateSettings(body: UpdateBillingSettingsBody): Promise<BillingSettings>;
|
|
203
|
+
/** May a subject use a feature? Live from Autumn/Commet when the subject is on one. */
|
|
204
|
+
checkFeature(body: CheckBillingFeatureBody): Promise<BillingFeatureCheck>;
|
|
112
205
|
/**
|
|
113
206
|
* Adopt an EXISTING Stripe subscription onto a user/org + plan, for
|
|
114
207
|
* migrating billing into Atlas without re-charging. Read-only on Stripe.
|
|
@@ -22,6 +22,37 @@ function billingResource(request) {
|
|
|
22
22
|
listSubscriptions(params) {
|
|
23
23
|
return request({ method: 'GET', path: '/v1/billing/subscriptions', query: { ...params } });
|
|
24
24
|
},
|
|
25
|
+
/** One subscription by id (a subject may hold several: a base plan + add-ons). */
|
|
26
|
+
getSubscription(id) {
|
|
27
|
+
return request({ method: 'GET', path: `/v1/billing/subscriptions/${(0, request_1.enc)(id)}` });
|
|
28
|
+
},
|
|
29
|
+
/** Move one subscription to another plan or interval (now, or at the period end). */
|
|
30
|
+
changeSubscription(id, body) {
|
|
31
|
+
return request({ method: 'POST', path: `/v1/billing/subscriptions/${(0, request_1.enc)(id)}/change`, body });
|
|
32
|
+
},
|
|
33
|
+
/** Cancel one subscription at the period end (default) or now. */
|
|
34
|
+
cancelSubscription(id, body = {}) {
|
|
35
|
+
return request({ method: 'POST', path: `/v1/billing/subscriptions/${(0, request_1.enc)(id)}/cancel`, body });
|
|
36
|
+
},
|
|
37
|
+
/** Undo a cancellation scheduled for the period end. */
|
|
38
|
+
restoreSubscription(id) {
|
|
39
|
+
return request({ method: 'POST', path: `/v1/billing/subscriptions/${(0, request_1.enc)(id)}/restore` });
|
|
40
|
+
},
|
|
41
|
+
/** Mirror a plan's features/limits from its provider (Autumn, Commet). */
|
|
42
|
+
syncPlanEntitlements(id) {
|
|
43
|
+
return request({ method: 'POST', path: `/v1/billing/plans/${(0, request_1.enc)(id)}/sync_entitlements` });
|
|
44
|
+
},
|
|
45
|
+
/** How limits merge across a subject's several subscriptions. */
|
|
46
|
+
getSettings() {
|
|
47
|
+
return request({ method: 'GET', path: '/v1/billing/settings' });
|
|
48
|
+
},
|
|
49
|
+
updateSettings(body) {
|
|
50
|
+
return request({ method: 'PUT', path: '/v1/billing/settings', body });
|
|
51
|
+
},
|
|
52
|
+
/** May a subject use a feature? Live from Autumn/Commet when the subject is on one. */
|
|
53
|
+
checkFeature(body) {
|
|
54
|
+
return request({ method: 'POST', path: '/v1/billing/check', body });
|
|
55
|
+
},
|
|
25
56
|
/**
|
|
26
57
|
* Adopt an EXISTING Stripe subscription onto a user/org + plan, for
|
|
27
58
|
* migrating billing into Atlas without re-charging. Read-only on Stripe.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-plans.js","sourceRoot":"","sources":["../../src/client/billing-plans.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"billing-plans.js","sourceRoot":"","sources":["../../src/client/billing-plans.ts"],"names":[],"mappings":";;AA2LA,0CAiFC;AA5QD,uCAAgD;AA2LhD,SAAgB,eAAe,CAAC,OAAkB;IAChD,OAAO;QACL,SAAS;YACP,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,UAAU,CAAC,IAA2B,EAAE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AAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD;;;WAGG;QACH,SAAS,CAAC,WAA2B,EAAE,SAAiB;YACtD,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,wBAAwB,IAAA,aAAG,EAAC,WAAW,CAAC,IAAI,IAAA,aAAG,EAAC,SAAS,CAAC,aAAa;aAC9E,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Custom (generic) OAuth 2.0 / OpenID Connect login providers — your own
|
|
5
|
+
* upstream identity provider, with Atlas as the relying party. Configure the
|
|
6
|
+
* endpoints (or just an OIDC issuer), the token-endpoint client authentication
|
|
7
|
+
* (incl. private_key_jwt with an Atlas-held key), a declarative profile
|
|
8
|
+
* mapping, upstream logout and third-party initiated login. The provider then
|
|
9
|
+
* signs users in like any built-in one: `provider: <provider_key>`.
|
|
10
|
+
*/
|
|
11
|
+
/** A claim path, a `{{template}}`, or a rule. */
|
|
12
|
+
export type ProfileMappingExpr = string | {
|
|
13
|
+
/** A path, or paths tried in order (the first non-empty wins). */
|
|
14
|
+
from?: string | string[];
|
|
15
|
+
template?: string;
|
|
16
|
+
/** A constant. */
|
|
17
|
+
value?: string | number | boolean | null;
|
|
18
|
+
transforms?: Array<'lowercase' | 'uppercase' | 'trim' | 'first' | 'last' | 'compact' | 'unique' | 'to_string' | 'to_number' | 'to_boolean' | {
|
|
19
|
+
split: string;
|
|
20
|
+
} | {
|
|
21
|
+
join: string;
|
|
22
|
+
} | {
|
|
23
|
+
index: number;
|
|
24
|
+
} | {
|
|
25
|
+
replace: {
|
|
26
|
+
find: string;
|
|
27
|
+
with: string;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
prefix: string;
|
|
31
|
+
} | {
|
|
32
|
+
suffix: string;
|
|
33
|
+
} | {
|
|
34
|
+
default: string | number | boolean | null;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
export interface ProfileMapping {
|
|
38
|
+
fields?: Partial<Record<'id' | 'email' | 'email_verified' | 'first_name' | 'last_name' | 'full_name' | 'username' | 'image_url' | 'phone_number' | 'external_id', ProfileMappingExpr>>;
|
|
39
|
+
public_metadata?: Record<string, ProfileMappingExpr>;
|
|
40
|
+
private_metadata?: Record<string, ProfileMappingExpr>;
|
|
41
|
+
/** Re-apply names, image and metadata on every sign-in (default: at account creation). */
|
|
42
|
+
update_on_sign_in?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type TokenEndpointAuthMethod = 'client_secret_basic' | 'client_secret_post' | 'client_secret_jwt' | 'private_key_jwt' | 'none';
|
|
45
|
+
export interface UpstreamLogoutSettings {
|
|
46
|
+
/** On Atlas sign-out, hand back the provider end-session URL to send the browser to. */
|
|
47
|
+
rp_initiated?: boolean;
|
|
48
|
+
post_logout_redirect_url?: string | null;
|
|
49
|
+
/** Accept OIDC Back-Channel Logout tokens and end the matching Atlas sessions. */
|
|
50
|
+
backchannel?: boolean;
|
|
51
|
+
/** Accept OIDC Front-Channel Logout (the provider frames frontchannel_logout_uri). */
|
|
52
|
+
frontchannel?: boolean;
|
|
53
|
+
/** Front-channel: require iss + sid (default true). */
|
|
54
|
+
frontchannel_session_required?: boolean;
|
|
55
|
+
end_session_endpoint?: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface IdpInitiatedLoginSettings {
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
/** Exact URLs or bare origins a third-party initiated login may land on. */
|
|
60
|
+
allowed_targets?: string[];
|
|
61
|
+
default_target?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface UpstreamSigningKey {
|
|
64
|
+
object: 'upstream_signing_key';
|
|
65
|
+
kid: string;
|
|
66
|
+
alg: 'RS256' | 'PS256' | 'ES256';
|
|
67
|
+
status: 'active' | 'retiring' | 'retired';
|
|
68
|
+
public_jwk: Record<string, unknown>;
|
|
69
|
+
created_at: number;
|
|
70
|
+
retired_at: number | null;
|
|
71
|
+
}
|
|
72
|
+
export interface UpstreamUrls {
|
|
73
|
+
/** Register at the provider as the client JWKS URL (private_key_jwt). */
|
|
74
|
+
client_jwks_uri: string;
|
|
75
|
+
backchannel_logout_uri: string;
|
|
76
|
+
frontchannel_logout_uri: string;
|
|
77
|
+
post_logout_redirect_uri: string;
|
|
78
|
+
initiate_login_uri: string;
|
|
79
|
+
}
|
|
80
|
+
export interface CustomOAuthProviderSettings {
|
|
81
|
+
display_name?: string;
|
|
82
|
+
icon_url?: string | null;
|
|
83
|
+
protocol?: 'oidc' | 'oauth2';
|
|
84
|
+
issuer?: string | null;
|
|
85
|
+
discovery_url?: string | null;
|
|
86
|
+
authorization_endpoint?: string | null;
|
|
87
|
+
token_endpoint?: string | null;
|
|
88
|
+
userinfo_endpoint?: string | null;
|
|
89
|
+
jwks_uri?: string | null;
|
|
90
|
+
end_session_endpoint?: string | null;
|
|
91
|
+
scopes?: string[];
|
|
92
|
+
scope_separator?: ' ' | ',' | '+';
|
|
93
|
+
pkce?: boolean;
|
|
94
|
+
authorization_params?: Record<string, string> | null;
|
|
95
|
+
token_params?: Record<string, string> | null;
|
|
96
|
+
userinfo_auth?: 'header' | 'query';
|
|
97
|
+
token_endpoint_auth_method?: TokenEndpointAuthMethod;
|
|
98
|
+
client_assertion_audience?: string | null;
|
|
99
|
+
profile_source?: 'merged' | 'userinfo' | 'id_token';
|
|
100
|
+
profile_mapping?: ProfileMapping | null;
|
|
101
|
+
logout?: UpstreamLogoutSettings | null;
|
|
102
|
+
idp_initiated_login?: IdpInitiatedLoginSettings | null;
|
|
103
|
+
client_id?: string;
|
|
104
|
+
/** Write-only; never returned. */
|
|
105
|
+
client_secret?: string;
|
|
106
|
+
enabled?: boolean;
|
|
107
|
+
allow_sign_in?: boolean;
|
|
108
|
+
allow_sign_up?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface CreateCustomOAuthProviderBody extends CustomOAuthProviderSettings {
|
|
111
|
+
provider_key: string;
|
|
112
|
+
display_name: string;
|
|
113
|
+
}
|
|
114
|
+
export interface CustomOAuthProvider extends UpstreamUrls {
|
|
115
|
+
object: 'custom_oauth_provider';
|
|
116
|
+
id: string;
|
|
117
|
+
provider_key: string;
|
|
118
|
+
display_name: string;
|
|
119
|
+
icon_url: string | null;
|
|
120
|
+
protocol: 'oidc' | 'oauth2';
|
|
121
|
+
issuer: string | null;
|
|
122
|
+
discovery_url: string | null;
|
|
123
|
+
authorization_endpoint: string | null;
|
|
124
|
+
token_endpoint: string | null;
|
|
125
|
+
userinfo_endpoint: string | null;
|
|
126
|
+
jwks_uri: string | null;
|
|
127
|
+
end_session_endpoint: string | null;
|
|
128
|
+
scopes: string[];
|
|
129
|
+
scope_separator: ' ' | ',' | '+';
|
|
130
|
+
pkce: boolean;
|
|
131
|
+
authorization_params: Record<string, string>;
|
|
132
|
+
token_params: Record<string, string>;
|
|
133
|
+
userinfo_auth: 'header' | 'query';
|
|
134
|
+
token_endpoint_auth_method: TokenEndpointAuthMethod;
|
|
135
|
+
client_assertion_audience: string | null;
|
|
136
|
+
profile_source: 'merged' | 'userinfo' | 'id_token';
|
|
137
|
+
profile_mapping: Required<ProfileMapping> | null;
|
|
138
|
+
logout: Required<UpstreamLogoutSettings>;
|
|
139
|
+
idp_initiated_login: Required<IdpInitiatedLoginSettings>;
|
|
140
|
+
client_id: string | null;
|
|
141
|
+
has_secret: boolean;
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
allow_sign_in: boolean;
|
|
144
|
+
allow_sign_up: boolean;
|
|
145
|
+
/** Register at the provider as the redirect / callback URI. */
|
|
146
|
+
redirect_uri: string;
|
|
147
|
+
signing_keys: UpstreamSigningKey[];
|
|
148
|
+
created_at: number;
|
|
149
|
+
updated_at: number;
|
|
150
|
+
}
|
|
151
|
+
export interface ProfileMappingPreviewBody {
|
|
152
|
+
profile_mapping?: ProfileMapping;
|
|
153
|
+
userinfo?: Record<string, unknown>;
|
|
154
|
+
id_token_claims?: Record<string, unknown>;
|
|
155
|
+
/** A sample id_token — decoded, not verified. */
|
|
156
|
+
id_token?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface ProfileMappingPreview {
|
|
159
|
+
object: 'profile_mapping_preview';
|
|
160
|
+
profile: {
|
|
161
|
+
id: string | null;
|
|
162
|
+
email: string | null;
|
|
163
|
+
email_verified: boolean;
|
|
164
|
+
first_name: string | null;
|
|
165
|
+
last_name: string | null;
|
|
166
|
+
username: string | null;
|
|
167
|
+
image_url: string | null;
|
|
168
|
+
phone_number: string | null;
|
|
169
|
+
external_id: string | null;
|
|
170
|
+
public_metadata: Record<string, unknown>;
|
|
171
|
+
private_metadata: Record<string, unknown>;
|
|
172
|
+
};
|
|
173
|
+
trace: Record<string, {
|
|
174
|
+
value: unknown;
|
|
175
|
+
source: string | null;
|
|
176
|
+
}>;
|
|
177
|
+
warnings: string[];
|
|
178
|
+
}
|
|
179
|
+
export interface OidcDiscoveryResult {
|
|
180
|
+
object: 'oidc_discovery';
|
|
181
|
+
issuer: string;
|
|
182
|
+
authorization_endpoint: string;
|
|
183
|
+
token_endpoint: string;
|
|
184
|
+
userinfo_endpoint: string | null;
|
|
185
|
+
jwks_uri: string;
|
|
186
|
+
end_session_endpoint: string | null;
|
|
187
|
+
scopes_supported: string[];
|
|
188
|
+
claims_supported: string[];
|
|
189
|
+
token_endpoint_auth_methods_supported: string[];
|
|
190
|
+
token_endpoint_auth_signing_alg_values_supported: string[];
|
|
191
|
+
code_challenge_methods_supported: string[];
|
|
192
|
+
backchannel_logout_supported: boolean;
|
|
193
|
+
backchannel_logout_session_supported: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** The signing-key operations shared by custom providers and OIDC connections. */
|
|
196
|
+
export declare function upstreamSigningKeys(request: RequestFn, base: string): {
|
|
197
|
+
list(): Promise<ListPage<UpstreamSigningKey>>;
|
|
198
|
+
/** Generate a new active key; the previous one turns `retiring` (still published). */
|
|
199
|
+
rotate(body?: {
|
|
200
|
+
alg?: "RS256" | "PS256" | "ES256";
|
|
201
|
+
}, idempotencyKey?: string): Promise<UpstreamSigningKey>;
|
|
202
|
+
/** Retire a non-active key (it leaves the JWKS). */
|
|
203
|
+
retire(kid: string): Promise<{
|
|
204
|
+
object: "upstream_signing_key";
|
|
205
|
+
kid: string;
|
|
206
|
+
status: "retired";
|
|
207
|
+
}>;
|
|
208
|
+
};
|
|
209
|
+
export declare function customOAuthProvidersResource(request: RequestFn): {
|
|
210
|
+
list(): Promise<ListPage<CustomOAuthProvider>>;
|
|
211
|
+
get(id: string): Promise<CustomOAuthProvider>;
|
|
212
|
+
create(body: CreateCustomOAuthProviderBody, idempotencyKey?: string): Promise<CustomOAuthProvider>;
|
|
213
|
+
update(id: string, body: CustomOAuthProviderSettings, idempotencyKey?: string): Promise<CustomOAuthProvider>;
|
|
214
|
+
delete(id: string): Promise<{
|
|
215
|
+
object: "custom_oauth_provider";
|
|
216
|
+
id: string;
|
|
217
|
+
provider_key: string;
|
|
218
|
+
deleted: true;
|
|
219
|
+
}>;
|
|
220
|
+
/** Fetch + validate an issuer's OpenID configuration (for autofill). */
|
|
221
|
+
discover(body: {
|
|
222
|
+
issuer: string;
|
|
223
|
+
discovery_url?: string;
|
|
224
|
+
}): Promise<OidcDiscoveryResult>;
|
|
225
|
+
/**
|
|
226
|
+
* Run a mapping against a pasted sample. With `id`, the provider's stored
|
|
227
|
+
* mapping is used unless the body carries one.
|
|
228
|
+
*/
|
|
229
|
+
previewProfileMapping(body: ProfileMappingPreviewBody, id?: string): Promise<ProfileMappingPreview>;
|
|
230
|
+
signingKeys(id: string): {
|
|
231
|
+
list(): Promise<ListPage<UpstreamSigningKey>>;
|
|
232
|
+
/** Generate a new active key; the previous one turns `retiring` (still published). */
|
|
233
|
+
rotate(body?: {
|
|
234
|
+
alg?: "RS256" | "PS256" | "ES256";
|
|
235
|
+
}, idempotencyKey?: string): Promise<UpstreamSigningKey>;
|
|
236
|
+
/** Retire a non-active key (it leaves the JWKS). */
|
|
237
|
+
retire(kid: string): Promise<{
|
|
238
|
+
object: "upstream_signing_key";
|
|
239
|
+
kid: string;
|
|
240
|
+
status: "retired";
|
|
241
|
+
}>;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upstreamSigningKeys = upstreamSigningKeys;
|
|
4
|
+
exports.customOAuthProvidersResource = customOAuthProvidersResource;
|
|
5
|
+
const request_1 = require("./request");
|
|
6
|
+
/** The signing-key operations shared by custom providers and OIDC connections. */
|
|
7
|
+
function upstreamSigningKeys(request, base) {
|
|
8
|
+
return {
|
|
9
|
+
list() {
|
|
10
|
+
return request({ method: 'GET', path: `${base}/signing_keys` });
|
|
11
|
+
},
|
|
12
|
+
/** Generate a new active key; the previous one turns `retiring` (still published). */
|
|
13
|
+
rotate(body = {}, idempotencyKey) {
|
|
14
|
+
return request({ method: 'POST', path: `${base}/signing_keys`, body, idempotencyKey });
|
|
15
|
+
},
|
|
16
|
+
/** Retire a non-active key (it leaves the JWKS). */
|
|
17
|
+
retire(kid) {
|
|
18
|
+
return request({ method: 'POST', path: `${base}/signing_keys/${(0, request_1.enc)(kid)}/retire` });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function customOAuthProvidersResource(request) {
|
|
23
|
+
const base = (id) => `/v1/custom_oauth_providers/${(0, request_1.enc)(id)}`;
|
|
24
|
+
return {
|
|
25
|
+
list() {
|
|
26
|
+
return request({ method: 'GET', path: '/v1/custom_oauth_providers' });
|
|
27
|
+
},
|
|
28
|
+
get(id) {
|
|
29
|
+
return request({ method: 'GET', path: base(id) });
|
|
30
|
+
},
|
|
31
|
+
create(body, idempotencyKey) {
|
|
32
|
+
return request({ method: 'POST', path: '/v1/custom_oauth_providers', body, idempotencyKey });
|
|
33
|
+
},
|
|
34
|
+
update(id, body, idempotencyKey) {
|
|
35
|
+
return request({ method: 'PATCH', path: base(id), body, idempotencyKey });
|
|
36
|
+
},
|
|
37
|
+
delete(id) {
|
|
38
|
+
return request({ method: 'DELETE', path: base(id) });
|
|
39
|
+
},
|
|
40
|
+
/** Fetch + validate an issuer's OpenID configuration (for autofill). */
|
|
41
|
+
discover(body) {
|
|
42
|
+
return request({ method: 'POST', path: '/v1/custom_oauth_providers/discover', body });
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Run a mapping against a pasted sample. With `id`, the provider's stored
|
|
46
|
+
* mapping is used unless the body carries one.
|
|
47
|
+
*/
|
|
48
|
+
previewProfileMapping(body, id) {
|
|
49
|
+
return request({
|
|
50
|
+
method: 'POST',
|
|
51
|
+
path: id ? `${base(id)}/profile_mapping/preview` : '/v1/custom_oauth_providers/profile_mapping/preview',
|
|
52
|
+
body,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
signingKeys(id) {
|
|
56
|
+
return upstreamSigningKeys(request, base(id));
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=custom-oauth-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-oauth-providers.js","sourceRoot":"","sources":["../../src/client/custom-oauth-providers.ts"],"names":[],"mappings":";;AAqOA,kDAcC;AAED,oEAqCC;AA1RD,uCAAgD;AAoOhD,kFAAkF;AAClF,SAAgB,mBAAmB,CAAC,OAAkB,EAAE,IAAY;IAClE,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,sFAAsF;QACtF,MAAM,CAAC,OAA8C,EAAE,EAAE,cAAuB;YAC9E,OAA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,CAAC,CAAC;QACvD,CAAC;QACD,wEAAwE;QACxE,QAAQ,CAAC,IAAgD;YACvD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,qCAAqC,EAAE,IAAI,EAAE,CAAC,CAAC;QACxF,CAAC;QACD;;;WAGG;QACH,qBAAqB,CAAC,IAA+B,EAAE,EAAW;YAChE,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,oDAAoD;gBACvG,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QACD,WAAW,CAAC,EAAU;YACpB,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RequestFn } from './request';
|
|
2
2
|
import type { ListPage } from './types';
|
|
3
3
|
/** The transactional email a template drives. */
|
|
4
|
-
export type EmailTemplateName = 'verification_code' | 'magic_link' | 'password_reset' | 'password_changed' | 'account_exists_notice' | 'organization_invitation' | 'new_device_sign_in' | 'session_revoked_token_reuse' | 'account_locked' | 'account_secured' | 'team_member_added' | 'team_role_changed' | 'email_changed' | 'verification_link' | 'password_reset_link';
|
|
4
|
+
export type EmailTemplateName = 'verification_code' | 'magic_link' | 'password_reset' | 'password_changed' | 'account_exists_notice' | 'organization_invitation' | 'new_device_sign_in' | 'session_revoked_token_reuse' | 'account_locked' | 'account_secured' | 'team_member_added' | 'team_role_changed' | 'email_changed' | 'verification_link' | 'password_reset_link' | 'account_reactivated';
|
|
5
5
|
/** The customizable body of a template: a subject line and a text body. */
|
|
6
6
|
export interface EmailTemplateBody {
|
|
7
7
|
subject?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-templates.js","sourceRoot":"","sources":["../../src/client/email-templates.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"email-templates.js","sourceRoot":"","sources":["../../src/client/email-templates.ts"],"names":[],"mappings":";;AA6DA,wDAkBC;AA/ED,uCAAgD;AA6DhD,SAAgB,sBAAsB,CAAC,OAAkB;IACvD,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,2EAA2E;QAC3E,OAAO,CAAC,IAAY,EAAE,OAA0B,EAAE;YAChD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,2DAA2D;QAC3D,MAAM,CAAC,IAAY,EAAE,IAAuB;YAC1C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,8BAA8B;QAC9B,MAAM,CAAC,IAAY;YACjB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;KACF,CAAC;AACJ,CAAC"}
|