@atlasauth/backend 0.5.0 → 0.7.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 (119) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +227 -0
  3. package/dist/client/activity.d.ts +104 -0
  4. package/dist/client/activity.js +29 -0
  5. package/dist/client/activity.js.map +1 -0
  6. package/dist/client/api-keys.d.ts +100 -0
  7. package/dist/client/api-keys.js +15 -0
  8. package/dist/client/api-keys.js.map +1 -1
  9. package/dist/client/audit-events.d.ts +103 -0
  10. package/dist/client/audit-events.js +43 -0
  11. package/dist/client/audit-events.js.map +1 -0
  12. package/dist/client/billing-plans.d.ts +43 -0
  13. package/dist/client/billing-plans.js +26 -0
  14. package/dist/client/billing-plans.js.map +1 -1
  15. package/dist/client/connectors.d.ts +174 -0
  16. package/dist/client/connectors.js +54 -0
  17. package/dist/client/connectors.js.map +1 -0
  18. package/dist/client/data-subject-requests.d.ts +21 -0
  19. package/dist/client/data-subject-requests.js +15 -0
  20. package/dist/client/data-subject-requests.js.map +1 -1
  21. package/dist/client/design.d.ts +295 -0
  22. package/dist/client/design.js +76 -0
  23. package/dist/client/design.js.map +1 -0
  24. package/dist/client/diagnostics.d.ts +53 -0
  25. package/dist/client/diagnostics.js +24 -0
  26. package/dist/client/diagnostics.js.map +1 -0
  27. package/dist/client/email-addresses.d.ts +22 -0
  28. package/dist/client/email-addresses.js +17 -0
  29. package/dist/client/email-addresses.js.map +1 -0
  30. package/dist/client/entitlement-overrides.d.ts +50 -0
  31. package/dist/client/entitlement-overrides.js +20 -0
  32. package/dist/client/entitlement-overrides.js.map +1 -0
  33. package/dist/client/error.d.ts +34 -0
  34. package/dist/client/error.js +33 -1
  35. package/dist/client/error.js.map +1 -1
  36. package/dist/client/import-export.d.ts +2 -0
  37. package/dist/client/import-export.js.map +1 -1
  38. package/dist/client/index.d.ts +461 -16
  39. package/dist/client/index.js +76 -2
  40. package/dist/client/index.js.map +1 -1
  41. package/dist/client/instance.d.ts +54 -0
  42. package/dist/client/instance.js +18 -0
  43. package/dist/client/instance.js.map +1 -1
  44. package/dist/client/invitations.d.ts +14 -0
  45. package/dist/client/invitations.js +9 -0
  46. package/dist/client/invitations.js.map +1 -1
  47. package/dist/client/legacy-auth.d.ts +45 -0
  48. package/dist/client/legacy-auth.js +18 -0
  49. package/dist/client/legacy-auth.js.map +1 -0
  50. package/dist/client/mcp.d.ts +86 -0
  51. package/dist/client/mcp.js +47 -0
  52. package/dist/client/mcp.js.map +1 -0
  53. package/dist/client/notifications.d.ts +92 -0
  54. package/dist/client/notifications.js +55 -0
  55. package/dist/client/notifications.js.map +1 -0
  56. package/dist/client/oauth-clients.d.ts +46 -2
  57. package/dist/client/oauth-clients.js +4 -0
  58. package/dist/client/oauth-clients.js.map +1 -1
  59. package/dist/client/oauth-providers.d.ts +67 -7
  60. package/dist/client/oauth-providers.js +7 -2
  61. package/dist/client/oauth-providers.js.map +1 -1
  62. package/dist/client/openfga.d.ts +137 -0
  63. package/dist/client/openfga.js +72 -0
  64. package/dist/client/openfga.js.map +1 -0
  65. package/dist/client/org-ldap-connections.d.ts +75 -0
  66. package/dist/client/org-ldap-connections.js +36 -0
  67. package/dist/client/org-ldap-connections.js.map +1 -0
  68. package/dist/client/organization-settings-schema.d.ts +24 -0
  69. package/dist/client/organization-settings-schema.js +30 -0
  70. package/dist/client/organization-settings-schema.js.map +1 -0
  71. package/dist/client/organizations.d.ts +205 -4
  72. package/dist/client/organizations.js +109 -0
  73. package/dist/client/organizations.js.map +1 -1
  74. package/dist/client/pca.d.ts +59 -0
  75. package/dist/client/pca.js +40 -0
  76. package/dist/client/pca.js.map +1 -0
  77. package/dist/client/platform.d.ts +328 -0
  78. package/dist/client/platform.js +187 -0
  79. package/dist/client/platform.js.map +1 -0
  80. package/dist/client/redirect-urls.d.ts +23 -0
  81. package/dist/client/redirect-urls.js +22 -0
  82. package/dist/client/redirect-urls.js.map +1 -0
  83. package/dist/client/request.d.ts +45 -0
  84. package/dist/client/request.js +35 -2
  85. package/dist/client/request.js.map +1 -1
  86. package/dist/client/session-exchange-apps.d.ts +43 -0
  87. package/dist/client/session-exchange-apps.js +25 -0
  88. package/dist/client/session-exchange-apps.js.map +1 -0
  89. package/dist/client/sessions.d.ts +28 -0
  90. package/dist/client/sessions.js +20 -0
  91. package/dist/client/sessions.js.map +1 -1
  92. package/dist/client/sign-in-tokens.d.ts +13 -1
  93. package/dist/client/sign-in-tokens.js +11 -0
  94. package/dist/client/sign-in-tokens.js.map +1 -1
  95. package/dist/client/test-mode.d.ts +44 -0
  96. package/dist/client/test-mode.js +26 -0
  97. package/dist/client/test-mode.js.map +1 -0
  98. package/dist/client/tickets.d.ts +49 -0
  99. package/dist/client/tickets.js +19 -0
  100. package/dist/client/tickets.js.map +1 -0
  101. package/dist/client/users.d.ts +351 -0
  102. package/dist/client/users.js +228 -0
  103. package/dist/client/users.js.map +1 -1
  104. package/dist/client/waitlist.d.ts +21 -0
  105. package/dist/client/waitlist.js +16 -0
  106. package/dist/client/waitlist.js.map +1 -1
  107. package/dist/client/webhooks.d.ts +60 -6
  108. package/dist/client/webhooks.js +36 -2
  109. package/dist/client/webhooks.js.map +1 -1
  110. package/dist/index.d.ts +2 -0
  111. package/dist/index.js +9 -1
  112. package/dist/index.js.map +1 -1
  113. package/dist/logout-token.d.ts +97 -0
  114. package/dist/logout-token.js +182 -0
  115. package/dist/logout-token.js.map +1 -0
  116. package/dist/verify.d.ts +7 -0
  117. package/dist/verify.js +13 -0
  118. package/dist/verify.js.map +1 -1
  119. package/package.json +3 -2
@@ -0,0 +1,295 @@
1
+ import { type RequestFn } from './request';
2
+ import type { ListPage } from './types';
3
+ /**
4
+ * The structured sign-in page design, shared by the instance's hosted pages,
5
+ * per-organization overrides and Sign in with Atlas app pages.
6
+ *
7
+ * Every leaf is a closed set of values, a bounded number, a `#RRGGBB` hex colour,
8
+ * a catalog id (preset, font) or an uploaded image id (`dasset_…`) — there is no
9
+ * field for CSS, HTML or arbitrary URLs. A stored design is a set of OVERRIDES:
10
+ * every section and field is optional and falls back to the chosen preset, then
11
+ * the defaults. Unknown keys are refused by the API with their full path.
12
+ */
13
+ export type DesignHexColor = string;
14
+ export type DesignPresetId = 'minimal' | 'atlas' | 'glass' | 'midnight' | 'editorial' | 'terminal' | 'sunrise' | 'forest' | 'grape' | 'slate' | 'split-photo' | 'bold';
15
+ export type DesignColorScheme = 'auto' | 'light' | 'dark';
16
+ export type DesignTypeScale = 'minor-second' | 'major-second' | 'minor-third' | 'major-third' | 'perfect-fourth' | 'augmented-fourth' | 'perfect-fifth' | 'golden' | 'minor-seventh' | 'octave';
17
+ export type DesignImagePosition = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
18
+ /** Colour slots, each a `#RRGGBB` hex. */
19
+ export interface DesignPalette {
20
+ primary?: DesignHexColor;
21
+ /** Text/icon colour on a primary fill (button label). */
22
+ primaryInk?: DesignHexColor;
23
+ accent?: DesignHexColor;
24
+ background?: DesignHexColor;
25
+ surface?: DesignHexColor;
26
+ text?: DesignHexColor;
27
+ muted?: DesignHexColor;
28
+ border?: DesignHexColor;
29
+ danger?: DesignHexColor;
30
+ success?: DesignHexColor;
31
+ inputBackground?: DesignHexColor;
32
+ inputText?: DesignHexColor;
33
+ }
34
+ export interface DesignTypography {
35
+ /** A font id from the design catalog (`design.catalog().fonts`). */
36
+ font?: string;
37
+ headingFont?: string;
38
+ /** Body text size in px (12–20). */
39
+ baseSize?: number;
40
+ /** 400–800, in steps of 100. */
41
+ headingWeight?: number;
42
+ /** 300–600, in steps of 100. */
43
+ bodyWeight?: number;
44
+ /** Letter case of button labels. */
45
+ letterCase?: 'none' | 'uppercase';
46
+ scale?: DesignTypeScale;
47
+ }
48
+ export interface DesignShape {
49
+ /** Card corner radius, px (0–32). */
50
+ radius?: number;
51
+ /** Button + input corner radius, px (0–999; 999 = pill). */
52
+ controlRadius?: number;
53
+ /** 0–3 px. */
54
+ borderWidth?: number;
55
+ }
56
+ export interface DesignElevation {
57
+ cardShadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
58
+ }
59
+ export interface DesignSpacing {
60
+ density?: 'compact' | 'comfortable' | 'spacious';
61
+ }
62
+ export interface DesignCard {
63
+ style?: 'solid' | 'glass' | 'outline' | 'none';
64
+ /** Backdrop blur, px (0–40). Only applied when `style` is `glass`. */
65
+ blur?: number;
66
+ width?: 'narrow' | 'normal' | 'wide';
67
+ }
68
+ export interface DesignLayout {
69
+ position?: 'center' | 'left' | 'right' | 'split';
70
+ /** Which side the image panel sits on. Only applied when `position` is `split`. */
71
+ splitImageSide?: 'left' | 'right';
72
+ /** `hidden` is refused on Sign in with Atlas app pages. */
73
+ logoPlacement?: 'card' | 'page' | 'hidden';
74
+ logoSize?: 'sm' | 'md' | 'lg';
75
+ }
76
+ export interface DesignButtons {
77
+ style?: 'solid' | 'outline' | 'soft' | 'gradient';
78
+ socialLayout?: 'list' | 'grid' | 'icons';
79
+ }
80
+ export interface DesignInputs {
81
+ style?: 'outline' | 'filled' | 'underline';
82
+ }
83
+ export interface DesignGradient {
84
+ type: 'linear' | 'radial';
85
+ /** Degrees (0–360); linear only. */
86
+ angle?: number;
87
+ /** 2–4 stops; `at` is a percentage (0–100). */
88
+ stops: Array<{
89
+ color: DesignHexColor;
90
+ at: number;
91
+ }>;
92
+ }
93
+ export interface DesignBackgroundImage {
94
+ /** An uploaded background image (`dasset_…`). */
95
+ assetId: string;
96
+ fit?: 'cover' | 'contain';
97
+ position?: DesignImagePosition;
98
+ /** `opacity` is 0–1. */
99
+ overlay?: {
100
+ color: DesignHexColor;
101
+ opacity: number;
102
+ };
103
+ /** 0–20 px. */
104
+ blur?: number;
105
+ }
106
+ /**
107
+ * A page background: a colour, a gradient, an uploaded image and a pattern,
108
+ * painted bottom to top. Setting `background` replaces the preset's background
109
+ * as a whole.
110
+ */
111
+ export interface DesignBackground {
112
+ color?: DesignHexColor;
113
+ gradient?: DesignGradient;
114
+ image?: DesignBackgroundImage;
115
+ pattern?: 'none' | 'dots' | 'grid' | 'noise';
116
+ }
117
+ export interface DesignLogo {
118
+ /** Uploaded logo for light mode (`dasset_…`). */
119
+ assetId?: string;
120
+ /** Uploaded logo for dark mode; falls back to `assetId`. */
121
+ darkAssetId?: string;
122
+ }
123
+ /** A stored design: overrides on top of a preset. Every field is optional. */
124
+ export interface AtlasDesign {
125
+ version?: 1;
126
+ preset?: DesignPresetId;
127
+ colorScheme?: DesignColorScheme;
128
+ palette?: DesignPalette;
129
+ paletteDark?: DesignPalette;
130
+ typography?: DesignTypography;
131
+ shape?: DesignShape;
132
+ elevation?: DesignElevation;
133
+ spacing?: DesignSpacing;
134
+ card?: DesignCard;
135
+ layout?: DesignLayout;
136
+ buttons?: DesignButtons;
137
+ inputs?: DesignInputs;
138
+ background?: DesignBackground;
139
+ backgroundDark?: DesignBackground;
140
+ logo?: DesignLogo;
141
+ }
142
+ type DeepPatch<T> = {
143
+ [K in keyof T]?: NonNullable<T[K]> extends readonly unknown[] ? T[K] | null : NonNullable<T[K]> extends object ? DeepPatch<NonNullable<T[K]>> | null : T[K] | null;
144
+ };
145
+ /**
146
+ * A partial design update: nested objects merge, arrays (gradient stops) and
147
+ * values replace, and `null` removes a setting (falling back to the preset).
148
+ */
149
+ export type AtlasDesignPatch = DeepPatch<AtlasDesign>;
150
+ /** The fully resolved design every surface renders (defaults ← preset ← overrides). */
151
+ export interface ResolvedAtlasDesign {
152
+ version: 1;
153
+ preset: DesignPresetId;
154
+ colorScheme: DesignColorScheme;
155
+ palette: Required<DesignPalette>;
156
+ paletteDark: Required<DesignPalette>;
157
+ typography: Required<DesignTypography>;
158
+ shape: Required<DesignShape>;
159
+ elevation: Required<DesignElevation>;
160
+ spacing: Required<DesignSpacing>;
161
+ card: Required<DesignCard>;
162
+ layout: Required<DesignLayout>;
163
+ buttons: Required<DesignButtons>;
164
+ inputs: Required<DesignInputs>;
165
+ background: DesignBackground;
166
+ backgroundDark: DesignBackground;
167
+ logo: DesignLogo;
168
+ }
169
+ /** A colour pair that fails its contrast target. */
170
+ export interface DesignWarning {
171
+ code: 'low_contrast';
172
+ mode: 'light' | 'dark';
173
+ pair: string[];
174
+ ratio: number;
175
+ required: number;
176
+ /** The setting to change, e.g. `palette.primaryInk`. */
177
+ path: string;
178
+ message: string;
179
+ }
180
+ /** A stored design (instance or organization) with its resolved result. */
181
+ export interface DesignSettings {
182
+ object: 'design' | 'organization_design';
183
+ /** Organization designs only. */
184
+ organization_id?: string;
185
+ design: AtlasDesign;
186
+ resolved: ResolvedAtlasDesign;
187
+ warnings: DesignWarning[];
188
+ /** True when nothing is stored and the page is drawn from the older branding settings. */
189
+ legacy: boolean;
190
+ /** When `legacy`: the design derived from the older branding settings. */
191
+ legacy_design?: AtlasDesign | null;
192
+ }
193
+ /** A compiled, unsaved design. Nothing is stored. */
194
+ export interface DesignPreview {
195
+ object: 'design_preview';
196
+ /** The selector the CSS is scoped to: `.atlas-root`. */
197
+ scope: string;
198
+ /** CSS custom properties (`--atlas-*`) for the scope, including light/dark blocks. */
199
+ css: string;
200
+ /** Attributes to set on the scoped element (`data-atlas-layout`, …). */
201
+ data_attributes: Record<string, string>;
202
+ /** Absolute URLs of the self-hosted font stylesheets to link. */
203
+ font_stylesheets: string[];
204
+ resolved: ResolvedAtlasDesign;
205
+ warnings: DesignWarning[];
206
+ /** The sign-in page rendered with the draft design (inert, for a sandboxed frame). */
207
+ html: string;
208
+ }
209
+ export type DesignAssetKind = 'background' | 'logo';
210
+ /** An uploaded design image. Use `asset_id` in a design (`logo.assetId`, …). */
211
+ export interface DesignAsset {
212
+ object: 'design_asset';
213
+ /** `dasset_…` */
214
+ asset_id: string;
215
+ kind: DesignAssetKind;
216
+ /** Where Atlas serves the stored image. */
217
+ url: string;
218
+ width: number;
219
+ height: number;
220
+ /** `#rrggbb` for an opaque image, else null. */
221
+ dominant_color: string | null;
222
+ /** Size of the stored (WebP) image. */
223
+ bytes: number;
224
+ created_at: string;
225
+ }
226
+ export interface DeletedDesignAsset {
227
+ object: 'design_asset';
228
+ asset_id: string;
229
+ deleted: true;
230
+ }
231
+ /** Image bytes to upload: PNG, JPEG, GIF or WebP, up to 8 MB and 40 megapixels. */
232
+ export type DesignAssetData = Blob | ArrayBuffer | ArrayBufferView;
233
+ export interface UploadDesignAssetOptions {
234
+ /** What the image is for (default `background`). */
235
+ kind?: DesignAssetKind;
236
+ /** e.g. `image/png`. Required unless `data` is a Blob with a type. */
237
+ contentType?: string;
238
+ }
239
+ /** The public design-system catalog: presets, curated fonts and CSS variables. */
240
+ export interface DesignCatalog {
241
+ object: 'design_catalog';
242
+ version: 1;
243
+ presets: Array<{
244
+ id: DesignPresetId;
245
+ label: string;
246
+ description: string;
247
+ resolved: ResolvedAtlasDesign;
248
+ }>;
249
+ fonts: Array<{
250
+ id: string;
251
+ label: string;
252
+ family: string | null;
253
+ category: string;
254
+ web_font: boolean;
255
+ stylesheet: string | null;
256
+ }>;
257
+ css_variables: Array<{
258
+ name: string;
259
+ type: string;
260
+ perMode?: boolean;
261
+ description: string;
262
+ }>;
263
+ }
264
+ export declare function designResource(request: RequestFn): {
265
+ /** The instance's sign-in page design: stored overrides, resolved design, warnings. */
266
+ get(): Promise<DesignSettings>;
267
+ /** Replace the whole instance design. */
268
+ replace(design: AtlasDesign): Promise<DesignSettings>;
269
+ /** Change part of the instance design; `null` removes a setting. */
270
+ update(design: AtlasDesignPatch): Promise<DesignSettings>;
271
+ /** Compile an unsaved design (CSS, attributes, fonts, rendered page). Nothing is saved. */
272
+ preview(design: AtlasDesign): Promise<DesignPreview>;
273
+ /** Per-organization design overrides, layered over the instance design. */
274
+ organizations: {
275
+ get(organizationId: string): Promise<DesignSettings>;
276
+ /** Replace the override; `{}` removes it. */
277
+ replace(organizationId: string, design: AtlasDesign): Promise<DesignSettings>;
278
+ update(organizationId: string, design: AtlasDesignPatch): Promise<DesignSettings>;
279
+ };
280
+ /** The instance's uploaded design images. */
281
+ assets: {
282
+ /**
283
+ * Upload a background or logo image as raw bytes. Atlas checks it,
284
+ * re-encodes it as WebP and serves it.
285
+ */
286
+ upload(data: DesignAssetData, options?: UploadDesignAssetOptions): Promise<DesignAsset>;
287
+ /** Newest first (up to 100). */
288
+ list(): Promise<ListPage<DesignAsset>>;
289
+ /** Refused with 409 (`meta.used_by`) while a saved design still uses it. */
290
+ delete(assetId: string): Promise<DeletedDesignAsset>;
291
+ };
292
+ /** The public catalog: presets (resolved), curated fonts, the CSS variable set. */
293
+ catalog(): Promise<DesignCatalog>;
294
+ };
295
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.designResource = designResource;
4
+ const request_1 = require("./request");
5
+ function designResource(request) {
6
+ return {
7
+ /** The instance's sign-in page design: stored overrides, resolved design, warnings. */
8
+ get() {
9
+ return request({ method: 'GET', path: '/v1/instance/design' });
10
+ },
11
+ /** Replace the whole instance design. */
12
+ replace(design) {
13
+ return request({ method: 'PUT', path: '/v1/instance/design', body: { design } });
14
+ },
15
+ /** Change part of the instance design; `null` removes a setting. */
16
+ update(design) {
17
+ return request({ method: 'PATCH', path: '/v1/instance/design', body: { design } });
18
+ },
19
+ /** Compile an unsaved design (CSS, attributes, fonts, rendered page). Nothing is saved. */
20
+ preview(design) {
21
+ return request({ method: 'POST', path: '/v1/instance/design/preview', body: { design } });
22
+ },
23
+ /** Per-organization design overrides, layered over the instance design. */
24
+ organizations: {
25
+ get(organizationId) {
26
+ return request({
27
+ method: 'GET',
28
+ path: `/v1/organizations/${(0, request_1.enc)(organizationId)}/design`,
29
+ });
30
+ },
31
+ /** Replace the override; `{}` removes it. */
32
+ replace(organizationId, design) {
33
+ return request({
34
+ method: 'PUT',
35
+ path: `/v1/organizations/${(0, request_1.enc)(organizationId)}/design`,
36
+ body: { design },
37
+ });
38
+ },
39
+ update(organizationId, design) {
40
+ return request({
41
+ method: 'PATCH',
42
+ path: `/v1/organizations/${(0, request_1.enc)(organizationId)}/design`,
43
+ body: { design },
44
+ });
45
+ },
46
+ },
47
+ /** The instance's uploaded design images. */
48
+ assets: {
49
+ /**
50
+ * Upload a background or logo image as raw bytes. Atlas checks it,
51
+ * re-encodes it as WebP and serves it.
52
+ */
53
+ upload(data, options = {}) {
54
+ return request({
55
+ method: 'POST',
56
+ path: '/v1/design/assets',
57
+ query: { kind: options.kind },
58
+ rawBody: { data, contentType: options.contentType },
59
+ });
60
+ },
61
+ /** Newest first (up to 100). */
62
+ list() {
63
+ return request({ method: 'GET', path: '/v1/design/assets' });
64
+ },
65
+ /** Refused with 409 (`meta.used_by`) while a saved design still uses it. */
66
+ delete(assetId) {
67
+ return request({ method: 'DELETE', path: `/v1/design/assets/${(0, request_1.enc)(assetId)}` });
68
+ },
69
+ },
70
+ /** The public catalog: presets (resolved), curated fonts, the CSS variable set. */
71
+ catalog() {
72
+ return request({ method: 'GET', path: '/v1/design/catalog' });
73
+ },
74
+ };
75
+ }
76
+ //# sourceMappingURL=design.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design.js","sourceRoot":"","sources":["../../src/client/design.ts"],"names":[],"mappings":";;AAoUA,wCAsEC;AA1YD,uCAAgD;AAoUhD,SAAgB,cAAc,CAAC,OAAkB;IAC/C,OAAO;QACL,uFAAuF;QACvF,GAAG;YACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,yCAAyC;QACzC,OAAO,CAAC,MAAmB;YACzB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,oEAAoE;QACpE,MAAM,CAAC,MAAwB;YAC7B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,2FAA2F;QAC3F,OAAO,CAAC,MAAmB;YACzB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,2EAA2E;QAC3E,aAAa,EAAE;YACb,GAAG,CAAC,cAAsB;gBACxB,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,cAAc,CAAC,SAAS;iBACxD,CAAC,CAAC;YACL,CAAC;YACD,6CAA6C;YAC7C,OAAO,CAAC,cAAsB,EAAE,MAAmB;gBACjD,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,cAAc,CAAC,SAAS;oBACvD,IAAI,EAAE,EAAE,MAAM,EAAE;iBACjB,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CAAC,cAAsB,EAAE,MAAwB;gBACrD,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,OAAO;oBACf,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,cAAc,CAAC,SAAS;oBACvD,IAAI,EAAE,EAAE,MAAM,EAAE;iBACjB,CAAC,CAAC;YACL,CAAC;SACF;QACD,6CAA6C;QAC7C,MAAM,EAAE;YACN;;;eAGG;YACH,MAAM,CAAC,IAAqB,EAAE,UAAoC,EAAE;gBAClE,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,mBAAmB;oBACzB,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,gCAAgC;YAChC,IAAI;gBACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,4EAA4E;YAC5E,MAAM,CAAC,OAAe;gBACpB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YAClF,CAAC;SACF;QACD,mFAAmF;QACnF,OAAO;YACL,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { RequestFn } from './request';
2
+ export interface LoginReadinessParams {
3
+ /** The app origin to probe, e.g. `https://app.acme.com`. */
4
+ origin: string;
5
+ /** Round-trip the published JWKS for the signing check instead of inferring it. */
6
+ live?: boolean;
7
+ }
8
+ export interface LoginReadinessCheck {
9
+ name: string;
10
+ pass: boolean;
11
+ observed: unknown;
12
+ /** What was seen, and the fix when it fails. */
13
+ detail: string;
14
+ }
15
+ export interface LoginReadiness {
16
+ object: 'login_readiness';
17
+ origin: string;
18
+ live: boolean;
19
+ data_region?: string | null;
20
+ ready: boolean;
21
+ checks: LoginReadinessCheck[];
22
+ }
23
+ export interface RequestInspectorParams {
24
+ /** The browser origin making the request. */
25
+ origin: string;
26
+ /** Default `POST`. */
27
+ method?: string;
28
+ /** Default `/v1/client/sign_ins`. */
29
+ path?: string;
30
+ /** A session JWT to verify against this instance. */
31
+ token?: string;
32
+ }
33
+ export interface RequestInspectionFinding {
34
+ check: string;
35
+ /** Whether this finding alone rejects the request. */
36
+ blocks: boolean;
37
+ observed: unknown;
38
+ detail: string;
39
+ }
40
+ export interface RequestInspection {
41
+ object: 'request_inspection';
42
+ origin: string;
43
+ method: string;
44
+ path: string;
45
+ would_be_rejected: boolean;
46
+ findings: RequestInspectionFinding[];
47
+ }
48
+ export declare function diagnosticsResource(request: RequestFn): {
49
+ /** Will a browser sign-in from `origin` work? CORS, cookie, email claim and signing, each with a fix. */
50
+ loginReadiness(params: LoginReadinessParams): Promise<LoginReadiness>;
51
+ /** Why would this browser request be rejected? Each finding says whether it blocks. */
52
+ requestInspector(params: RequestInspectorParams): Promise<RequestInspection>;
53
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diagnosticsResource = diagnosticsResource;
4
+ function diagnosticsResource(request) {
5
+ return {
6
+ /** Will a browser sign-in from `origin` work? CORS, cookie, email claim and signing, each with a fix. */
7
+ loginReadiness(params) {
8
+ return request({
9
+ method: 'GET',
10
+ path: '/v1/diagnostics/login_readiness',
11
+ query: { origin: params.origin, live: params.live },
12
+ });
13
+ },
14
+ /** Why would this browser request be rejected? Each finding says whether it blocks. */
15
+ requestInspector(params) {
16
+ return request({
17
+ method: 'GET',
18
+ path: '/v1/diagnostics/request_inspector',
19
+ query: { ...params },
20
+ });
21
+ },
22
+ };
23
+ }
24
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/client/diagnostics.ts"],"names":[],"mappings":";;AAsDA,kDAmBC;AAnBD,SAAgB,mBAAmB,CAAC,OAAkB;IACpD,OAAO;QACL,yGAAyG;QACzG,cAAc,CAAC,MAA4B;YACzC,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,iCAAiC;gBACvC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;aACpD,CAAC,CAAC;QACL,CAAC;QACD,uFAAuF;QACvF,gBAAgB,CAAC,MAA8B;YAC7C,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,mCAAmC;gBACzC,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type RequestFn } from './request';
2
+ /**
3
+ * An email address addressed by its own id. The owning user is derived from
4
+ * the address, so these calls need no user id (the `users.verifyEmail` /
5
+ * `users.setPrimaryEmail` forms do the same with one).
6
+ */
7
+ export interface EmailAddressRecord {
8
+ object: 'email_address';
9
+ id: string;
10
+ email_address: string;
11
+ verification: {
12
+ status: 'verified' | 'unverified';
13
+ };
14
+ verified: boolean;
15
+ primary: boolean;
16
+ }
17
+ export declare function emailAddressesResource(request: RequestFn): {
18
+ /** `POST /v1/email_addresses/:id/verify` — mark the address verified. */
19
+ verify(id: string): Promise<EmailAddressRecord>;
20
+ /** `POST /v1/email_addresses/:id/primary` — make a verified address the user's primary. */
21
+ setPrimary(id: string): Promise<EmailAddressRecord>;
22
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emailAddressesResource = emailAddressesResource;
4
+ const request_1 = require("./request");
5
+ function emailAddressesResource(request) {
6
+ return {
7
+ /** `POST /v1/email_addresses/:id/verify` — mark the address verified. */
8
+ verify(id) {
9
+ return request({ method: 'POST', path: `/v1/email_addresses/${(0, request_1.enc)(id)}/verify` });
10
+ },
11
+ /** `POST /v1/email_addresses/:id/primary` — make a verified address the user's primary. */
12
+ setPrimary(id) {
13
+ return request({ method: 'POST', path: `/v1/email_addresses/${(0, request_1.enc)(id)}/primary` });
14
+ },
15
+ };
16
+ }
17
+ //# sourceMappingURL=email-addresses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-addresses.js","sourceRoot":"","sources":["../../src/client/email-addresses.ts"],"names":[],"mappings":";;AAgBA,wDAWC;AA3BD,uCAAgD;AAgBhD,SAAgB,sBAAsB,CAAC,OAAkB;IACvD,OAAO;QACL,yEAAyE;QACzE,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,2FAA2F;QAC3F,UAAU,CAAC,EAAU;YACnB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,IAAA,aAAG,EAAC,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;QACrF,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type RequestFn } from './request';
2
+ import type { ListPage } from './types';
3
+ export type EntitlementOverrideSubjectType = 'user' | 'org';
4
+ /**
5
+ * A sales-led entitlement override: a plan / features / limits pinned onto a
6
+ * user or organization without Stripe (e.g. an Enterprise contract). A
7
+ * non-expired override wins over the Stripe-derived entitlement and reaches the
8
+ * session claims on the next session.
9
+ */
10
+ export interface EntitlementOverride {
11
+ object: 'entitlement_override';
12
+ id: string;
13
+ subject_type: EntitlementOverrideSubjectType;
14
+ subject_id: string;
15
+ /** Pinned plan slug, or null when only features/limits are overridden. */
16
+ plan: string | null;
17
+ features: string[] | null;
18
+ limits: Record<string, unknown> | null;
19
+ /** Epoch ms when the override lapses, or null for open-ended. */
20
+ expires_at: number | null;
21
+ created_by: string | null;
22
+ created_at: number;
23
+ }
24
+ /** At least one of `plan`, `features` or `limits` is required. */
25
+ export interface CreateEntitlementOverrideBody {
26
+ subject_type: EntitlementOverrideSubjectType;
27
+ subject_id: string;
28
+ plan?: string | null;
29
+ /** Replaces (does not add to) the resolved feature set. */
30
+ features?: string[] | null;
31
+ /** Numeric limits, e.g. `{ max_devices: 50 }`. */
32
+ limits?: Record<string, unknown> | null;
33
+ /** Epoch ms; omit or null for open-ended. */
34
+ expires_at?: number | null;
35
+ }
36
+ export interface ListEntitlementOverridesParams {
37
+ subject_type?: EntitlementOverrideSubjectType;
38
+ subject_id?: string;
39
+ }
40
+ export declare function entitlementOverridesResource(request: RequestFn): {
41
+ create(body: CreateEntitlementOverrideBody, idempotencyKey?: string): Promise<EntitlementOverride>;
42
+ /** Includes expired overrides (kept for audit; they no longer apply). */
43
+ list(params?: ListEntitlementOverridesParams): Promise<ListPage<EntitlementOverride>>;
44
+ /** Revoke: the subject reverts to its Stripe-derived entitlement on the next session. */
45
+ delete(id: string): Promise<{
46
+ object: "entitlement_override";
47
+ id: string;
48
+ deleted: true;
49
+ }>;
50
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entitlementOverridesResource = entitlementOverridesResource;
4
+ const request_1 = require("./request");
5
+ function entitlementOverridesResource(request) {
6
+ return {
7
+ create(body, idempotencyKey) {
8
+ return request({ method: 'POST', path: '/v1/entitlement_overrides', body, idempotencyKey });
9
+ },
10
+ /** Includes expired overrides (kept for audit; they no longer apply). */
11
+ list(params = {}) {
12
+ return request({ method: 'GET', path: '/v1/entitlement_overrides', query: { ...params } });
13
+ },
14
+ /** Revoke: the subject reverts to its Stripe-derived entitlement on the next session. */
15
+ delete(id) {
16
+ return request({ method: 'DELETE', path: `/v1/entitlement_overrides/${(0, request_1.enc)(id)}` });
17
+ },
18
+ };
19
+ }
20
+ //# sourceMappingURL=entitlement-overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlement-overrides.js","sourceRoot":"","sources":["../../src/client/entitlement-overrides.ts"],"names":[],"mappings":";;AA4CA,oEAmBC;AA/DD,uCAAgD;AA4ChD,SAAgB,4BAA4B,CAAC,OAAkB;IAC7D,OAAO;QACL,MAAM,CACJ,IAAmC,EACnC,cAAuB;YAEvB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC9F,CAAC;QACD,yEAAyE;QACzE,IAAI,CACF,SAAyC,EAAE;YAE3C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,yFAAyF;QACzF,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,6BAA6B,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACrF,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -29,3 +29,37 @@ export declare class AtlasApiError extends Error {
29
29
  /** True when any error in the envelope carries the given stable code. */
30
30
  hasCode(code: string): boolean;
31
31
  }
32
+ /**
33
+ * Stable error codes worth branching on, as named constants. Any `code` string
34
+ * Atlas returns can be compared with `error.code` / `error.hasCode()` directly;
35
+ * these just save typing them.
36
+ */
37
+ export declare const AtlasErrorCodes: {
38
+ /** Emails cannot be sent: no email provider is configured for the instance. */
39
+ readonly EMAIL_DELIVERY_NOT_CONFIGURED: "EMAIL_DELIVERY_NOT_CONFIGURED";
40
+ /** This setting needs your own email provider configured first. */
41
+ readonly EMAIL_PROVIDER_REQUIRED: "EMAIL_PROVIDER_REQUIRED";
42
+ /** Strict mode: the body had a field this endpoint does not accept (`param` names it). */
43
+ readonly UNKNOWN_FIELD: "UNKNOWN_FIELD";
44
+ /** The billing plan still has subscribers and cannot be removed. */
45
+ readonly PLAN_IN_USE: "PLAN_IN_USE";
46
+ /** The key is valid but for another API surface (e.g. a platform key on the Backend API). */
47
+ readonly WRONG_KEY_SURFACE: "WRONG_KEY_SURFACE";
48
+ /** The key is unknown, revoked or malformed. */
49
+ readonly INVALID_KEY: "INVALID_KEY";
50
+ readonly NOT_FOUND: "NOT_FOUND";
51
+ readonly VALIDATION_FAILED: "VALIDATION_FAILED";
52
+ readonly RATE_LIMITED: "RATE_LIMITED";
53
+ /** An idempotency key was reused with a different request (e.g. another unit or amount). */
54
+ readonly IDEMPOTENCY_CONFLICT: "IDEMPOTENCY_CONFLICT";
55
+ /** A usage debit would exceed an API key's spend cap (`allowed: false` on the debit). */
56
+ readonly LIMIT_EXCEEDED: "LIMIT_EXCEEDED";
57
+ readonly SESSION_REVOKED: "SESSION_REVOKED";
58
+ readonly SESSION_IDLE_EXPIRED: "SESSION_IDLE_EXPIRED";
59
+ readonly SESSION_EXPIRED: "SESSION_EXPIRED";
60
+ readonly SCOPE_MISSING: "SCOPE_MISSING";
61
+ readonly FORBIDDEN: "FORBIDDEN";
62
+ readonly CONFLICT: "CONFLICT";
63
+ };
64
+ /** One of the named {@link AtlasErrorCodes}. */
65
+ export type AtlasErrorCode = (typeof AtlasErrorCodes)[keyof typeof AtlasErrorCodes];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AtlasApiError = void 0;
3
+ exports.AtlasErrorCodes = exports.AtlasApiError = void 0;
4
4
  class AtlasApiError extends Error {
5
5
  name = 'AtlasApiError';
6
6
  /** HTTP status of the failed response. */
@@ -25,4 +25,36 @@ class AtlasApiError extends Error {
25
25
  }
26
26
  }
27
27
  exports.AtlasApiError = AtlasApiError;
28
+ /**
29
+ * Stable error codes worth branching on, as named constants. Any `code` string
30
+ * Atlas returns can be compared with `error.code` / `error.hasCode()` directly;
31
+ * these just save typing them.
32
+ */
33
+ exports.AtlasErrorCodes = {
34
+ /** Emails cannot be sent: no email provider is configured for the instance. */
35
+ EMAIL_DELIVERY_NOT_CONFIGURED: 'EMAIL_DELIVERY_NOT_CONFIGURED',
36
+ /** This setting needs your own email provider configured first. */
37
+ EMAIL_PROVIDER_REQUIRED: 'EMAIL_PROVIDER_REQUIRED',
38
+ /** Strict mode: the body had a field this endpoint does not accept (`param` names it). */
39
+ UNKNOWN_FIELD: 'UNKNOWN_FIELD',
40
+ /** The billing plan still has subscribers and cannot be removed. */
41
+ PLAN_IN_USE: 'PLAN_IN_USE',
42
+ /** The key is valid but for another API surface (e.g. a platform key on the Backend API). */
43
+ WRONG_KEY_SURFACE: 'WRONG_KEY_SURFACE',
44
+ /** The key is unknown, revoked or malformed. */
45
+ INVALID_KEY: 'INVALID_KEY',
46
+ NOT_FOUND: 'NOT_FOUND',
47
+ VALIDATION_FAILED: 'VALIDATION_FAILED',
48
+ RATE_LIMITED: 'RATE_LIMITED',
49
+ /** An idempotency key was reused with a different request (e.g. another unit or amount). */
50
+ IDEMPOTENCY_CONFLICT: 'IDEMPOTENCY_CONFLICT',
51
+ /** A usage debit would exceed an API key's spend cap (`allowed: false` on the debit). */
52
+ LIMIT_EXCEEDED: 'LIMIT_EXCEEDED',
53
+ SESSION_REVOKED: 'SESSION_REVOKED',
54
+ SESSION_IDLE_EXPIRED: 'SESSION_IDLE_EXPIRED',
55
+ SESSION_EXPIRED: 'SESSION_EXPIRED',
56
+ SCOPE_MISSING: 'SCOPE_MISSING',
57
+ FORBIDDEN: 'FORBIDDEN',
58
+ CONFLICT: 'CONFLICT',
59
+ };
28
60
  //# sourceMappingURL=error.js.map