@atlasauth/backend 0.7.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +175 -1
  3. package/dist/client/activity.d.ts +5 -0
  4. package/dist/client/activity.js.map +1 -1
  5. package/dist/client/branding.d.ts +58 -0
  6. package/dist/client/branding.js.map +1 -1
  7. package/dist/client/domains.d.ts +13 -0
  8. package/dist/client/domains.js.map +1 -1
  9. package/dist/client/email-templates.d.ts +1 -1
  10. package/dist/client/email-templates.js.map +1 -1
  11. package/dist/client/index.d.ts +55 -2
  12. package/dist/client/index.js +4 -0
  13. package/dist/client/index.js.map +1 -1
  14. package/dist/client/instance.d.ts +201 -0
  15. package/dist/client/instance.js +38 -0
  16. package/dist/client/instance.js.map +1 -1
  17. package/dist/client/logout-notify-endpoints.d.ts +71 -0
  18. package/dist/client/logout-notify-endpoints.js +34 -0
  19. package/dist/client/logout-notify-endpoints.js.map +1 -0
  20. package/dist/client/messaging.d.ts +168 -0
  21. package/dist/client/messaging.js +45 -0
  22. package/dist/client/messaging.js.map +1 -1
  23. package/dist/client/oauth-clients.d.ts +86 -1
  24. package/dist/client/oauth-clients.js +23 -2
  25. package/dist/client/oauth-clients.js.map +1 -1
  26. package/dist/client/platform.d.ts +129 -0
  27. package/dist/client/platform.js +80 -0
  28. package/dist/client/platform.js.map +1 -1
  29. package/dist/client/users.d.ts +29 -1
  30. package/dist/client/users.js +10 -2
  31. package/dist/client/users.js.map +1 -1
  32. package/dist/client/webhooks.d.ts +21 -0
  33. package/dist/client/webhooks.js.map +1 -1
  34. package/dist/index.d.ts +4 -2
  35. package/dist/index.js +15 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/logout-token.d.ts +8 -0
  38. package/dist/logout-token.js +20 -15
  39. package/dist/logout-token.js.map +1 -1
  40. package/dist/oidc.d.ts +225 -0
  41. package/dist/oidc.js +631 -0
  42. package/dist/oidc.js.map +1 -0
  43. package/dist/testing.d.ts +90 -1
  44. package/dist/testing.js +202 -3
  45. package/dist/testing.js.map +1 -1
  46. package/dist/verify.d.ts +21 -0
  47. package/dist/verify.js +20 -0
  48. package/dist/verify.js.map +1 -1
  49. package/dist/webhooks.d.ts +16 -5
  50. package/dist/webhooks.js +11 -7
  51. package/dist/webhooks.js.map +1 -1
  52. package/package.json +1 -1
@@ -12,6 +12,15 @@ export interface Instance {
12
12
  environment: string;
13
13
  publishable_key: string;
14
14
  frontend_api_host: string;
15
+ /**
16
+ * The `iss` this instance's session tokens carry. It changes when a custom
17
+ * domain goes active, so read it (and the two URLs below) rather than hard-coding it.
18
+ */
19
+ issuer: string;
20
+ /** The OpenID discovery document whose `issuer` equals {@link issuer}. */
21
+ discovery_url: string;
22
+ /** The JWKS holding this instance's signing keys. */
23
+ jwks_uri: string;
15
24
  allowed_origins: string[];
16
25
  auth_config: Metadata;
17
26
  created_at: number;
@@ -40,6 +49,30 @@ export interface PreflightFinding {
40
49
  /** Ids of what the finding is about (provider, client_id, domain, …). */
41
50
  subject?: Record<string, string>;
42
51
  }
52
+ /** An advisory published for an Atlas browser SDK version. */
53
+ export interface SdkAdvisory {
54
+ object: 'sdk_advisory';
55
+ /** e.g. `@atlasauth/react`. */
56
+ package: string;
57
+ /** The affected range, e.g. `<0.8.1`. */
58
+ affected: string;
59
+ fixed_in: string;
60
+ /** Stable code, e.g. `email_code_sign_in`. */
61
+ reason: string;
62
+ severity: 'critical' | 'high' | 'medium' | 'low';
63
+ summary: string;
64
+ /** ISO date. */
65
+ published_at: string;
66
+ }
67
+ /** An Atlas browser SDK version that called this instance recently. */
68
+ export interface SdkVersionSeen {
69
+ package: string;
70
+ version: string;
71
+ /** Epoch ms. */
72
+ last_seen_at: number;
73
+ /** The advisories that apply to this version. */
74
+ advisories: SdkAdvisory[];
75
+ }
43
76
  export interface PreflightReport {
44
77
  object: 'preflight';
45
78
  /** True when there are no error-severity findings. */
@@ -48,6 +81,8 @@ export interface PreflightReport {
48
81
  checked_at: number;
49
82
  /** Ordered error, then warning, then info. */
50
83
  findings: PreflightFinding[];
84
+ /** Atlas browser SDK versions seen in the last 7 days (newest first), with their advisories. */
85
+ sdk_versions_seen?: SdkVersionSeen[];
51
86
  }
52
87
  /** A consent tool whose documented "reopen preferences" trigger Atlas fills in. */
53
88
  export type CookieSettingsLinkPreset = 'cookiemunch' | 'cookiebot' | 'onetrust' | 'custom';
@@ -71,6 +106,27 @@ export interface CookieSettingsLink {
71
106
  /** The attributes the rendered link carries: `attributes` plus the preset's trigger. */
72
107
  rendered_attributes: Record<string, string>;
73
108
  }
109
+ /** One cookie or browser-storage key Atlas writes for the instance (all strictly necessary). */
110
+ export interface DeclaredCookie {
111
+ /** The exact name, or null when `pattern` describes a family of keys. */
112
+ name: string | null;
113
+ /** A `*` wildcard for keys with an id suffix, e.g. `atlasid:*`. */
114
+ pattern: string | null;
115
+ store: 'cookie' | 'localStorage' | 'sessionStorage' | 'indexedDB';
116
+ /** A cookie's Domain (or the exact Frontend API host); for storage, "your app's origin". */
117
+ domain: string;
118
+ /** Seconds; null = browser session (cookie) or until cleared (storage). */
119
+ lifetime_seconds: number | null;
120
+ /** The lifetime in words, for a cookie policy table. */
121
+ lifetime: string;
122
+ http_only: boolean;
123
+ category: 'necessary';
124
+ purpose: string;
125
+ written_when: string;
126
+ set_by: 'atlas_frontend_api' | 'atlas_sdk';
127
+ }
128
+ /** `page` (default): the consent tag carries the page language; `browser`: no attribute. */
129
+ export type CookieConsentCulture = 'page' | 'browser';
74
130
  /** The cookie-consent script injected into the hosted sign-in, sign-up and account pages. */
75
131
  export interface CookieConsent {
76
132
  object: 'cookie_consent';
@@ -83,6 +139,9 @@ export interface CookieConsent {
83
139
  extra_origins?: string[];
84
140
  /** The footer "Cookie settings" link, or null when none is set. */
85
141
  settings_link?: CookieSettingsLink | null;
142
+ culture?: CookieConsentCulture;
143
+ /** Every cookie and browser-storage key Atlas writes for this instance, for your cookie policy. */
144
+ declared_cookies?: DeclaredCookie[];
86
145
  }
87
146
  export interface SetCookieConsentBody {
88
147
  /** Your consent script URL. Must be https; its origin is added to the page CSP. */
@@ -97,12 +156,154 @@ export interface SetCookieConsentBody {
97
156
  extra_origins?: string[];
98
157
  /** A footer "Cookie settings" link that reopens the consent preferences; null or omitted for none. */
99
158
  settings_link?: CookieSettingsLinkInput | null;
159
+ /** `page` (default) tags the consent script with the page language; `browser` leaves it to the tool. */
160
+ culture?: CookieConsentCulture | null;
161
+ }
162
+ /** `POST /v1/instance/move_origin` (and the platform app twin). */
163
+ export interface OriginMoveRequest {
164
+ /** The old origin, `scheme://host[:port]`. */
165
+ from: string;
166
+ /** The new origin: https, or http only for localhost. */
167
+ to: string;
168
+ /** `true` reports the diff and any problems and writes nothing. */
169
+ dry_run?: boolean;
170
+ }
171
+ export interface OriginMoveChange {
172
+ object: 'instance' | 'oauth_client' | 'atlas_id_app' | 'webhook_endpoint' | 'redirect_url';
173
+ id: string;
174
+ /** e.g. `allowed_origins`, `redirect_uris`, `homepage_url`, `branding.legal.privacyUrl`. */
175
+ field: string;
176
+ before: string | string[] | null;
177
+ after: string | string[] | null;
178
+ }
179
+ export interface OriginMoveProblem {
180
+ object?: string;
181
+ id?: string;
182
+ field?: string;
183
+ url?: string;
184
+ message?: string;
185
+ }
186
+ /** The before → after diff of an origin move. A repeated run returns no changes. */
187
+ export interface OriginMove {
188
+ object: 'origin_move';
189
+ from: string;
190
+ to: string;
191
+ dry_run: boolean;
192
+ /** True when this run wrote changes. */
193
+ applied: boolean;
194
+ changes: OriginMoveChange[];
195
+ /** Values the field would refuse; a real run with problems is a 422 and writes nothing. */
196
+ problems: OriginMoveProblem[];
197
+ /** Platform app twin only: the app after the move. */
198
+ app?: Record<string, unknown>;
199
+ }
200
+ /** One link from this instance to another platform, and its health. */
201
+ export interface InstanceConnection {
202
+ object: 'connection';
203
+ kind: 'privacy_webhook' | 'cmp' | 'atlas_id_app' | 'jwt_template';
204
+ /** What was checked, e.g. `privacy_webhook_delivery`, `cmp_site`. */
205
+ check: string;
206
+ ok: boolean;
207
+ severity: 'error' | 'warning' | 'info';
208
+ subject: Record<string, string>;
209
+ /** What to do when `ok` is false. */
210
+ fix_hint: string | null;
211
+ /** Epoch ms. */
212
+ last_checked_at: number;
213
+ /** Kind-specific facts. */
214
+ details: Record<string, unknown>;
215
+ }
216
+ export interface InstanceConnections {
217
+ object: 'instance_connections';
218
+ /** False when any warning- or error-severity row is not ok. */
219
+ ok: boolean;
220
+ checked_at: number;
221
+ data: InstanceConnection[];
222
+ }
223
+ /** The Chatly connection (`enabled: false` and nothing else when none is set). */
224
+ export interface ChatlyIntegration {
225
+ object: 'chatly_integration';
226
+ enabled: boolean;
227
+ channel?: string;
228
+ /** The template name to pass to `getToken({ template: 'chatly' })`. */
229
+ template?: 'chatly';
230
+ /** `chatly:<channel>`. */
231
+ audience?: string;
232
+ issuer?: string;
233
+ jwks_url?: string;
234
+ token_ttl_seconds?: number;
235
+ identity_verification?: {
236
+ mode?: 'oidc';
237
+ issuer?: string;
238
+ jwks_url?: string;
239
+ audience?: string;
240
+ };
241
+ }
242
+ export interface SetChatlyIntegrationBody {
243
+ /** The chat channel public id (letters, digits, `_` and `-`). */
244
+ channel: string;
245
+ }
246
+ /** The Forumulate connection (`enabled: false` and nothing else when none is set). */
247
+ export interface ForumulateIntegration {
248
+ object: 'forumulate_integration';
249
+ enabled: boolean;
250
+ org_id?: string;
251
+ spaces?: Array<{
252
+ id: string;
253
+ redeem_url: string;
254
+ }>;
255
+ audience?: string;
256
+ issuer?: string;
257
+ jwks_url?: string;
258
+ token_ttl_seconds?: number;
259
+ /** The external_jwt provider to store on each space. */
260
+ reader_auth_provider?: {
261
+ method?: 'external_jwt';
262
+ order?: number;
263
+ config?: {
264
+ jwksUrl?: string;
265
+ issuer?: string;
266
+ clientId?: string;
267
+ };
268
+ };
269
+ }
270
+ export interface SetForumulateIntegrationBody {
271
+ org_id: string;
272
+ /** 1-50 space ids, or `{ id, redeem_url }`. */
273
+ spaces: Array<string | {
274
+ id: string;
275
+ redeem_url?: string | null;
276
+ }>;
277
+ /** The token `aud`. Default `forumulate:<org_id>`. */
278
+ audience?: string | null;
100
279
  }
101
280
  export declare function instanceResource(request: RequestFn): {
102
281
  get(): Promise<Instance>;
103
282
  update(body: UpdateInstanceBody): Promise<InstanceUpdateResult>;
104
283
  /** Check your setup in one call: configuration the server can see is broken or risky. */
105
284
  preflight(): Promise<PreflightReport>;
285
+ /**
286
+ * Move every URL that points at one origin to another (a domain move), across
287
+ * the instance, its OAuth clients, webhooks, redirect URLs and Sign in with
288
+ * Atlas apps. `dry_run: true` writes nothing.
289
+ */
290
+ moveOrigin(body: OriginMoveRequest): Promise<OriginMove>;
291
+ /** The instance's links to other platforms and their health. Read-only. */
292
+ connections(): Promise<InstanceConnections>;
293
+ /** Built-in connections to other platforms. */
294
+ integrations: {
295
+ chatly: {
296
+ get(): Promise<ChatlyIntegration>;
297
+ set(body: SetChatlyIntegrationBody): Promise<ChatlyIntegration>;
298
+ delete(): Promise<ChatlyIntegration>;
299
+ };
300
+ forumulate: {
301
+ get(): Promise<ForumulateIntegration>;
302
+ /** Replaces the whole connection. */
303
+ set(body: SetForumulateIntegrationBody): Promise<ForumulateIntegration>;
304
+ delete(): Promise<ForumulateIntegration>;
305
+ };
306
+ };
106
307
  /** The cookie-consent script on the hosted pages (any provider). */
107
308
  cookieConsent: {
108
309
  get(): Promise<CookieConsent>;
@@ -13,6 +13,44 @@ function instanceResource(request) {
13
13
  preflight() {
14
14
  return request({ method: 'GET', path: '/v1/instance/preflight' });
15
15
  },
16
+ /**
17
+ * Move every URL that points at one origin to another (a domain move), across
18
+ * the instance, its OAuth clients, webhooks, redirect URLs and Sign in with
19
+ * Atlas apps. `dry_run: true` writes nothing.
20
+ */
21
+ moveOrigin(body) {
22
+ return request({ method: 'POST', path: '/v1/instance/move_origin', body });
23
+ },
24
+ /** The instance's links to other platforms and their health. Read-only. */
25
+ connections() {
26
+ return request({ method: 'GET', path: '/v1/instance/connections' });
27
+ },
28
+ /** Built-in connections to other platforms. */
29
+ integrations: {
30
+ chatly: {
31
+ get() {
32
+ return request({ method: 'GET', path: '/v1/instance/integrations/chatly' });
33
+ },
34
+ set(body) {
35
+ return request({ method: 'PUT', path: '/v1/instance/integrations/chatly', body });
36
+ },
37
+ delete() {
38
+ return request({ method: 'DELETE', path: '/v1/instance/integrations/chatly' });
39
+ },
40
+ },
41
+ forumulate: {
42
+ get() {
43
+ return request({ method: 'GET', path: '/v1/instance/integrations/forumulate' });
44
+ },
45
+ /** Replaces the whole connection. */
46
+ set(body) {
47
+ return request({ method: 'PUT', path: '/v1/instance/integrations/forumulate', body });
48
+ },
49
+ delete() {
50
+ return request({ method: 'DELETE', path: '/v1/instance/integrations/forumulate' });
51
+ },
52
+ },
53
+ },
16
54
  /** The cookie-consent script on the hosted pages (any provider). */
17
55
  cookieConsent: {
18
56
  get() {
@@ -1 +1 @@
1
- {"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/client/instance.ts"],"names":[],"mappings":";;AAgHA,4CA2BC;AA3BD,SAAgB,gBAAgB,CAAC,OAAkB;IACjD,OAAO;QACL,GAAG;YACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,CAAC,IAAwB;YAC7B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,yFAAyF;QACzF,SAAS;YACP,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,oEAAoE;QACpE,aAAa,EAAE;YACb,GAAG;gBACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,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C;AACJ,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { type RequestFn } from './request';
2
+ /**
3
+ * Logout fan-out ("also notify") endpoints: downstream services that receive the
4
+ * same signed `logout_token` as your OIDC apps whenever an Atlas session ends,
5
+ * plus a subject-wide one (sub, no sid) on ban, deletion or deprovisioning.
6
+ */
7
+ export interface LogoutNotifyEndpoint {
8
+ object: 'logout_notify_endpoint';
9
+ id: string;
10
+ url: string;
11
+ /** The client_id this endpoint follows; null = instance-wide. */
12
+ oauth_client_id: string | null;
13
+ /** The `aud` its logout_tokens carry. */
14
+ audience: string;
15
+ description?: string | null;
16
+ created_at: number;
17
+ updated_at: number;
18
+ }
19
+ export interface CreateLogoutNotifyEndpointBody {
20
+ /** Public https endpoint. */
21
+ url: string;
22
+ /** A client_id of this instance to follow; omit for instance-wide. */
23
+ oauth_client_id?: string | null;
24
+ /** The logout_token `aud`. Default: the client_id when following a client, else the instance id. */
25
+ audience?: string | null;
26
+ /** Up to 200 characters. */
27
+ description?: string | null;
28
+ }
29
+ export interface UpdateLogoutNotifyEndpointBody {
30
+ url?: string;
31
+ audience?: string | null;
32
+ description?: string | null;
33
+ }
34
+ /** One logout_token sent to a fan-out endpoint. */
35
+ export interface LogoutNotifyDelivery {
36
+ object: 'logout_notify_delivery';
37
+ id: string;
38
+ sub: string;
39
+ /** null = a subject-wide logout (ban / deletion). */
40
+ sid?: string | null;
41
+ status: 'pending' | 'success' | 'failed';
42
+ attempt_number: number;
43
+ http_status?: number | null;
44
+ response_snippet?: string | null;
45
+ next_retry_at?: number | null;
46
+ delivered_at?: number | null;
47
+ created_at: number;
48
+ }
49
+ export interface LogoutNotifyList<T> {
50
+ object: 'list';
51
+ data: T[];
52
+ has_more?: boolean;
53
+ next_cursor?: string | null;
54
+ }
55
+ export declare function logoutNotifyEndpointsResource(request: RequestFn): {
56
+ list(): Promise<LogoutNotifyList<LogoutNotifyEndpoint>>;
57
+ /** Register an endpoint. The URL must be public https. */
58
+ create(body: CreateLogoutNotifyEndpointBody, idempotencyKey?: string): Promise<LogoutNotifyEndpoint>;
59
+ get(id: string): Promise<LogoutNotifyEndpoint>;
60
+ update(id: string, body: UpdateLogoutNotifyEndpointBody, idempotencyKey?: string): Promise<LogoutNotifyEndpoint>;
61
+ /** Its queued deliveries go with it. */
62
+ delete(id: string, idempotencyKey?: string): Promise<{
63
+ object: "logout_notify_endpoint";
64
+ id: string;
65
+ deleted: true;
66
+ }>;
67
+ /** The endpoint's delivery log, newest first. */
68
+ listDeliveries(id: string, params?: {
69
+ limit?: number;
70
+ }): Promise<LogoutNotifyList<LogoutNotifyDelivery>>;
71
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logoutNotifyEndpointsResource = logoutNotifyEndpointsResource;
4
+ const request_1 = require("./request");
5
+ function logoutNotifyEndpointsResource(request) {
6
+ return {
7
+ list() {
8
+ return request({ method: 'GET', path: '/v1/logout_notify_endpoints' });
9
+ },
10
+ /** Register an endpoint. The URL must be public https. */
11
+ create(body, idempotencyKey) {
12
+ return request({ method: 'POST', path: '/v1/logout_notify_endpoints', body, idempotencyKey });
13
+ },
14
+ get(id) {
15
+ return request({ method: 'GET', path: `/v1/logout_notify_endpoints/${(0, request_1.enc)(id)}` });
16
+ },
17
+ update(id, body, idempotencyKey) {
18
+ return request({ method: 'PATCH', path: `/v1/logout_notify_endpoints/${(0, request_1.enc)(id)}`, body, idempotencyKey });
19
+ },
20
+ /** Its queued deliveries go with it. */
21
+ delete(id, idempotencyKey) {
22
+ return request({ method: 'DELETE', path: `/v1/logout_notify_endpoints/${(0, request_1.enc)(id)}`, idempotencyKey });
23
+ },
24
+ /** The endpoint's delivery log, newest first. */
25
+ listDeliveries(id, params = {}) {
26
+ return request({
27
+ method: 'GET',
28
+ path: `/v1/logout_notify_endpoints/${(0, request_1.enc)(id)}/deliveries`,
29
+ query: { ...params },
30
+ });
31
+ },
32
+ };
33
+ }
34
+ //# sourceMappingURL=logout-notify-endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout-notify-endpoints.js","sourceRoot":"","sources":["../../src/client/logout-notify-endpoints.ts"],"names":[],"mappings":";;AA4DA,sEA+BC;AA3FD,uCAAgD;AA4DhD,SAAgB,6BAA6B,CAAC,OAAkB;IAC9D,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,0DAA0D;QAC1D,MAAM,CAAC,IAAoC,EAAE,cAAuB;YAClE,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAChG,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,+BAA+B,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,CAAC,EAAU,EAAE,IAAoC,EAAE,cAAuB;YAC9E,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,+BAA+B,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC5G,CAAC;QACD,wCAAwC;QACxC,MAAM,CACJ,EAAU,EACV,cAAuB;YAEvB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,+BAA+B,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACvG,CAAC;QACD,iDAAiD;QACjD,cAAc,CAAC,EAAU,EAAE,SAA6B,EAAE;YACxD,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,+BAA+B,IAAA,aAAG,EAAC,EAAE,CAAC,aAAa;gBACzD,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -193,6 +193,12 @@ interface ProviderBodyBase<T extends MessagingTransport> {
193
193
  * provider accepts. SMS: the sender number in E.164 format, e.g. `+15551234567`.
194
194
  */
195
195
  from_address?: string;
196
+ /**
197
+ * Email only. `development`: a development instance sends without a verified
198
+ * domain (Atlas sign-in templates only, `[Atlas test] ` subjects, capped);
199
+ * 409 on a production instance. Omitted on an update: the stored mode is kept.
200
+ */
201
+ mode?: 'standard' | 'development';
196
202
  }
197
203
  /**
198
204
  * First setup of transport `T` (or a switch to it): `config` carries every
@@ -246,8 +252,12 @@ type PublicConfigKey<T extends MessagingTransport> = Exclude<keyof MessagingTran
246
252
  */
247
253
  export interface MessagingProviderOf<C extends 'email' | 'sms', T extends MessagingTransport> {
248
254
  object: 'messaging_provider';
255
+ /** The provider id: pass it as `provider_id` to managed email or the development sender. */
256
+ id?: string;
249
257
  channel: C;
250
258
  transport: T;
259
+ /** How it sends: `standard` | `development` | `managed_domain`. */
260
+ mode?: 'standard' | 'development' | 'managed_domain';
251
261
  from_address: string | null;
252
262
  status: string;
253
263
  /** Non-secret config only — secret values are never returned. */
@@ -272,7 +282,131 @@ export interface MessagingProviders {
272
282
  object: 'messaging_providers';
273
283
  email: EmailProvider | null;
274
284
  sms: SmsProvider | null;
285
+ /** The Atlas-managed sending domain, when one is set up (summary). */
286
+ managed_email?: {
287
+ object: 'managed_email';
288
+ from_address: string;
289
+ domain: string;
290
+ status: string;
291
+ verified: boolean;
292
+ } | null;
293
+ /** The email provider in development mode, when it is. */
294
+ development_email?: {
295
+ object: 'development_email';
296
+ enabled: true;
297
+ from_address: string | null;
298
+ } | null;
299
+ }
300
+ /** A DNS record to publish for the managed sending domain. */
301
+ export interface ManagedEmailRecord {
302
+ purpose: 'dkim' | 'spf' | 'return_path' | 'ownership' | 'dmarc' | 'other';
303
+ type: 'TXT' | 'MX' | 'CNAME';
304
+ /** Fully-qualified record name. */
305
+ name: string;
306
+ value: string;
307
+ priority?: number;
308
+ status?: string;
309
+ }
310
+ /** Managed email: Atlas sets your sending domain up on your own Resend or Brevo account and sends through your key. */
311
+ export interface ManagedEmail {
312
+ object: 'managed_email';
313
+ id: string;
314
+ from_address: string;
315
+ domain: string;
316
+ provider: string;
317
+ /** The email service the domain lives on (your own account there): `resend` | `brevo`. */
318
+ backend?: 'resend' | 'brevo';
319
+ /** Your email provider (mode `managed_domain`) that holds the API key. */
320
+ provider_id?: string | null;
321
+ region: string | null;
322
+ /** `not_started` | `pending` | `verified` | `failed` | `temporary_failure`. Email sends only when verified. */
323
+ status: string;
324
+ verified: boolean;
325
+ records: ManagedEmailRecord[];
326
+ /** Always null: no Atlas limits apply, your provider account's own do. */
327
+ limits: null;
328
+ usage: {
329
+ sent: number;
330
+ bounces: number;
331
+ complaints: number;
332
+ last_bounce_at: number | null;
333
+ last_complaint_at: number | null;
334
+ };
335
+ reputation: 'your_provider_account';
336
+ /** Brevo, on create: whether the bounce / complaint webhook was registered on your account. */
337
+ feedback_webhook?: 'registered' | 'not_registered';
338
+ /** DNS automation, when set. The token is never returned. */
339
+ dns: {
340
+ provider: string;
341
+ token_set: boolean;
342
+ } | null;
343
+ failure_reason: string | null;
344
+ last_checked_at: number | null;
345
+ verified_at: number | null;
346
+ created_at: number;
347
+ updated_at: number;
348
+ /** Create only, with `dns`: the zone and the records Atlas wrote. */
349
+ dns_result?: Record<string, unknown>;
350
+ next_step?: string;
351
+ }
352
+ export interface CreateManagedEmailBody {
353
+ /** The From address, bare or `"Name <address>"`. Its domain becomes the sending domain. */
354
+ from_address: string;
355
+ /** Your own provider account Atlas sets the domain up on. Required with `config` unless `provider_id` is given. */
356
+ transport?: 'resend' | 'brevo';
357
+ /** Your provider API key (write-only). */
358
+ config?: {
359
+ api_key: string;
360
+ };
361
+ /** Instead of `transport` + `config`: your configured Resend or Brevo email provider. */
362
+ provider_id?: string;
363
+ region?: 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
364
+ /** Let Atlas write the DNS records. The token is write-only. */
365
+ dns?: {
366
+ provider: 'cloudflare';
367
+ /** A DNS API token with Zone Read and DNS Edit on the zone. Write-only. */
368
+ api_token: string;
369
+ /** Replace a conflicting existing record. */
370
+ overwrite?: boolean;
371
+ };
372
+ }
373
+ export interface DeletedManagedEmail {
374
+ object: 'managed_email';
375
+ domain: string;
376
+ deleted: true;
377
+ /** Whether the email provider that held the key (mode `managed_domain`) was removed too. */
378
+ provider_removed?: boolean;
275
379
  }
380
+ /** Your own email provider in development mode (development instances, no verified domain). */
381
+ export interface DevelopmentEmail {
382
+ object: 'development_email';
383
+ provider_id: string;
384
+ enabled: true;
385
+ /** False on a production instance (never sends) or when the provider is disabled. */
386
+ active: boolean;
387
+ transport: string;
388
+ from_address: string | null;
389
+ subject_prefix: string;
390
+ footer: string;
391
+ templates: string[];
392
+ limits: {
393
+ daily: number;
394
+ per_recipient_hourly: number;
395
+ };
396
+ /** Present for onboarding@resend.dev: Resend delivers it only to your Resend account address. */
397
+ note?: string;
398
+ next_step?: string;
399
+ updated_at: number;
400
+ }
401
+ /** `{ provider_id }`, or your provider exactly as `messaging.setEmail` takes it. */
402
+ export type EnableDevelopmentEmailBody = {
403
+ provider_id: string;
404
+ from_address?: string;
405
+ } | {
406
+ transport: 'resend' | 'ses' | 'smtp' | 'brevo' | 'mailgun';
407
+ config?: Record<string, string>;
408
+ from_address?: string;
409
+ };
276
410
  export interface MessagingTestResult {
277
411
  object: 'messaging_test';
278
412
  channel: string;
@@ -323,6 +457,40 @@ export declare function messagingResource(request: RequestFn): {
323
457
  deleteChannel(channel: "email" | "sms", options?: {
324
458
  force?: boolean;
325
459
  }): Promise<DeletedMessagingProvider>;
460
+ /**
461
+ * Your own email provider in development mode: a development instance sends
462
+ * Atlas's sign-in emails without a verified domain ([Atlas test] subjects, capped).
463
+ */
464
+ developmentEmail: {
465
+ /** 404 when the provider is not in development mode. */
466
+ get(): Promise<DevelopmentEmail>;
467
+ /** Turn development mode on. 409 `DEVELOPMENT_EMAIL_NOT_ALLOWED` on a production instance. */
468
+ enable(body: EnableDevelopmentEmailBody): Promise<DevelopmentEmail>;
469
+ /** Back to standard mode; the provider stays. */
470
+ disable(): Promise<{
471
+ object: "development_email";
472
+ deleted: true;
473
+ provider_id: string;
474
+ mode: "standard";
475
+ }>;
476
+ };
477
+ /** Managed email: Atlas sets your sending domain up on your own Resend or Brevo account. */
478
+ managedEmail: {
479
+ /** 404 when none is configured. */
480
+ get(): Promise<ManagedEmail>;
481
+ /** Register the sending domain; returns the DNS `records` to publish. */
482
+ create(body: CreateManagedEmailBody): Promise<ManagedEmail>;
483
+ /** Re-check the DNS records now; `verified` is true once email can be sent. */
484
+ verify(): Promise<ManagedEmail>;
485
+ /**
486
+ * Stop using managed email (DNS records are left in place). Refused with
487
+ * `409 EMAIL_PROVIDER_IN_USE` while it is the only way to send email; pass
488
+ * `{ force: true }` to remove it anyway.
489
+ */
490
+ delete(options?: {
491
+ force?: boolean;
492
+ }): Promise<DeletedManagedEmail>;
493
+ };
326
494
  /** Send a fixed, clearly-marked test message through the channel's provider. */
327
495
  test(channel: "email" | "sms", body: {
328
496
  to: string;
@@ -40,6 +40,51 @@ function messagingResource(request) {
40
40
  ...(options.force ? { query: { force: 'true' } } : {}),
41
41
  });
42
42
  },
43
+ /**
44
+ * Your own email provider in development mode: a development instance sends
45
+ * Atlas's sign-in emails without a verified domain ([Atlas test] subjects, capped).
46
+ */
47
+ developmentEmail: {
48
+ /** 404 when the provider is not in development mode. */
49
+ get() {
50
+ return request({ method: 'GET', path: '/v1/messaging_providers/email/development' });
51
+ },
52
+ /** Turn development mode on. 409 `DEVELOPMENT_EMAIL_NOT_ALLOWED` on a production instance. */
53
+ enable(body) {
54
+ return request({ method: 'POST', path: '/v1/messaging_providers/email/development', body });
55
+ },
56
+ /** Back to standard mode; the provider stays. */
57
+ disable() {
58
+ return request({ method: 'DELETE', path: '/v1/messaging_providers/email/development' });
59
+ },
60
+ },
61
+ /** Managed email: Atlas sets your sending domain up on your own Resend or Brevo account. */
62
+ managedEmail: {
63
+ /** 404 when none is configured. */
64
+ get() {
65
+ return request({ method: 'GET', path: '/v1/messaging_providers/email/managed' });
66
+ },
67
+ /** Register the sending domain; returns the DNS `records` to publish. */
68
+ create(body) {
69
+ return request({ method: 'POST', path: '/v1/messaging_providers/email/managed', body });
70
+ },
71
+ /** Re-check the DNS records now; `verified` is true once email can be sent. */
72
+ verify() {
73
+ return request({ method: 'POST', path: '/v1/messaging_providers/email/managed/verify' });
74
+ },
75
+ /**
76
+ * Stop using managed email (DNS records are left in place). Refused with
77
+ * `409 EMAIL_PROVIDER_IN_USE` while it is the only way to send email; pass
78
+ * `{ force: true }` to remove it anyway.
79
+ */
80
+ delete(options = {}) {
81
+ return request({
82
+ method: 'DELETE',
83
+ path: '/v1/messaging_providers/email/managed',
84
+ ...(options.force ? { query: { force: 'true' } } : {}),
85
+ });
86
+ },
87
+ },
43
88
  /** Send a fixed, clearly-marked test message through the channel's provider. */
44
89
  test(channel, body) {
45
90
  return request({
@@ -1 +1 @@
1
- {"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/client/messaging.ts"],"names":[],"mappings":";;AAsVA,8CA0DC;AAhZD,uCAAgD;AAsVhD,SAAgB,iBAAiB,CAAC,OAAkB;IAIlD,SAAS,QAAQ,CAAC,IAAa;QAC7B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,+BAA+B,EAAE,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC;IAKD,SAAS,MAAM,CAAC,IAAa;QAC3B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACL,0EAA0E;QAC1E,GAAG;YACD,OAAO,OAAO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