@atlasauth/backend 0.1.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 (157) hide show
  1. package/dist/client/actions.d.ts +86 -0
  2. package/dist/client/actions.js +40 -0
  3. package/dist/client/actions.js.map +1 -0
  4. package/dist/client/actor-tokens.d.ts +28 -0
  5. package/dist/client/actor-tokens.js +15 -0
  6. package/dist/client/actor-tokens.js.map +1 -0
  7. package/dist/client/api-keys.d.ts +77 -0
  8. package/dist/client/api-keys.js +31 -0
  9. package/dist/client/api-keys.js.map +1 -0
  10. package/dist/client/attack-protection.d.ts +41 -0
  11. package/dist/client/attack-protection.js +14 -0
  12. package/dist/client/attack-protection.js.map +1 -0
  13. package/dist/client/audit-logs.d.ts +20 -0
  14. package/dist/client/audit-logs.js +11 -0
  15. package/dist/client/audit-logs.js.map +1 -0
  16. package/dist/client/billing-plans.d.ts +81 -0
  17. package/dist/client/billing-plans.js +27 -0
  18. package/dist/client/billing-plans.js.map +1 -0
  19. package/dist/client/bot-signals.d.ts +88 -0
  20. package/dist/client/bot-signals.js +24 -0
  21. package/dist/client/bot-signals.js.map +1 -0
  22. package/dist/client/branding.d.ts +140 -0
  23. package/dist/client/branding.js +19 -0
  24. package/dist/client/branding.js.map +1 -0
  25. package/dist/client/data-subject-requests.d.ts +40 -0
  26. package/dist/client/data-subject-requests.js +32 -0
  27. package/dist/client/data-subject-requests.js.map +1 -0
  28. package/dist/client/domains.d.ts +45 -0
  29. package/dist/client/domains.js +21 -0
  30. package/dist/client/domains.js.map +1 -0
  31. package/dist/client/email-templates.d.ts +51 -0
  32. package/dist/client/email-templates.js +24 -0
  33. package/dist/client/email-templates.js.map +1 -0
  34. package/dist/client/error.d.ts +31 -0
  35. package/dist/client/error.js +28 -0
  36. package/dist/client/error.js.map +1 -0
  37. package/dist/client/fga.d.ts +191 -0
  38. package/dist/client/fga.js +91 -0
  39. package/dist/client/fga.js.map +1 -0
  40. package/dist/client/import-export.d.ts +88 -0
  41. package/dist/client/import-export.js +28 -0
  42. package/dist/client/import-export.js.map +1 -0
  43. package/dist/client/index.d.ts +796 -0
  44. package/dist/client/index.js +174 -0
  45. package/dist/client/index.js.map +1 -0
  46. package/dist/client/instance-security.d.ts +79 -0
  47. package/dist/client/instance-security.js +44 -0
  48. package/dist/client/instance-security.js.map +1 -0
  49. package/dist/client/instance.d.ts +34 -0
  50. package/dist/client/instance.js +14 -0
  51. package/dist/client/instance.js.map +1 -0
  52. package/dist/client/invitations.d.ts +21 -0
  53. package/dist/client/invitations.js +18 -0
  54. package/dist/client/invitations.js.map +1 -0
  55. package/dist/client/jwt-templates.d.ts +26 -0
  56. package/dist/client/jwt-templates.js +26 -0
  57. package/dist/client/jwt-templates.js.map +1 -0
  58. package/dist/client/localizations.d.ts +43 -0
  59. package/dist/client/localizations.js +24 -0
  60. package/dist/client/localizations.js.map +1 -0
  61. package/dist/client/log-streams.d.ts +66 -0
  62. package/dist/client/log-streams.js +28 -0
  63. package/dist/client/log-streams.js.map +1 -0
  64. package/dist/client/lti-platforms.d.ts +49 -0
  65. package/dist/client/lti-platforms.js +24 -0
  66. package/dist/client/lti-platforms.js.map +1 -0
  67. package/dist/client/managed-waf.d.ts +100 -0
  68. package/dist/client/managed-waf.js +33 -0
  69. package/dist/client/managed-waf.js.map +1 -0
  70. package/dist/client/messaging.d.ts +56 -0
  71. package/dist/client/messaging.js +30 -0
  72. package/dist/client/messaging.js.map +1 -0
  73. package/dist/client/network-acls.d.ts +50 -0
  74. package/dist/client/network-acls.js +29 -0
  75. package/dist/client/network-acls.js.map +1 -0
  76. package/dist/client/oauth-clients.d.ts +75 -0
  77. package/dist/client/oauth-clients.js +45 -0
  78. package/dist/client/oauth-clients.js.map +1 -0
  79. package/dist/client/oauth-providers.d.ts +109 -0
  80. package/dist/client/oauth-providers.js +48 -0
  81. package/dist/client/oauth-providers.js.map +1 -0
  82. package/dist/client/organizations.d.ts +211 -0
  83. package/dist/client/organizations.js +136 -0
  84. package/dist/client/organizations.js.map +1 -0
  85. package/dist/client/paginate.d.ts +16 -0
  86. package/dist/client/paginate.js +35 -0
  87. package/dist/client/paginate.js.map +1 -0
  88. package/dist/client/radius-clients.d.ts +52 -0
  89. package/dist/client/radius-clients.js +24 -0
  90. package/dist/client/radius-clients.js.map +1 -0
  91. package/dist/client/rate-limit.d.ts +37 -0
  92. package/dist/client/rate-limit.js +20 -0
  93. package/dist/client/rate-limit.js.map +1 -0
  94. package/dist/client/request.d.ts +52 -0
  95. package/dist/client/request.js +102 -0
  96. package/dist/client/request.js.map +1 -0
  97. package/dist/client/resource-servers.d.ts +44 -0
  98. package/dist/client/resource-servers.js +24 -0
  99. package/dist/client/resource-servers.js.map +1 -0
  100. package/dist/client/restrictions.d.ts +39 -0
  101. package/dist/client/restrictions.js +29 -0
  102. package/dist/client/restrictions.js.map +1 -0
  103. package/dist/client/risk-based-mfa.d.ts +51 -0
  104. package/dist/client/risk-based-mfa.js +20 -0
  105. package/dist/client/risk-based-mfa.js.map +1 -0
  106. package/dist/client/roles.d.ts +84 -0
  107. package/dist/client/roles.js +57 -0
  108. package/dist/client/roles.js.map +1 -0
  109. package/dist/client/scim-provisioning.d.ts +94 -0
  110. package/dist/client/scim-provisioning.js +49 -0
  111. package/dist/client/scim-provisioning.js.map +1 -0
  112. package/dist/client/scim-tokens.d.ts +34 -0
  113. package/dist/client/scim-tokens.js +18 -0
  114. package/dist/client/scim-tokens.js.map +1 -0
  115. package/dist/client/sessions.d.ts +58 -0
  116. package/dist/client/sessions.js +26 -0
  117. package/dist/client/sessions.js.map +1 -0
  118. package/dist/client/sign-in-tokens.d.ts +18 -0
  119. package/dist/client/sign-in-tokens.js +11 -0
  120. package/dist/client/sign-in-tokens.js.map +1 -0
  121. package/dist/client/sms-templates.d.ts +46 -0
  122. package/dist/client/sms-templates.js +30 -0
  123. package/dist/client/sms-templates.js.map +1 -0
  124. package/dist/client/sso-connections.d.ts +76 -0
  125. package/dist/client/sso-connections.js +28 -0
  126. package/dist/client/sso-connections.js.map +1 -0
  127. package/dist/client/sso-onboarding.d.ts +76 -0
  128. package/dist/client/sso-onboarding.js +42 -0
  129. package/dist/client/sso-onboarding.js.map +1 -0
  130. package/dist/client/tokens.d.ts +37 -0
  131. package/dist/client/tokens.js +11 -0
  132. package/dist/client/tokens.js.map +1 -0
  133. package/dist/client/types.d.ts +41 -0
  134. package/dist/client/types.js +10 -0
  135. package/dist/client/types.js.map +1 -0
  136. package/dist/client/users.d.ts +204 -0
  137. package/dist/client/users.js +135 -0
  138. package/dist/client/users.js.map +1 -0
  139. package/dist/client/waitlist.d.ts +31 -0
  140. package/dist/client/waitlist.js +16 -0
  141. package/dist/client/waitlist.js.map +1 -0
  142. package/dist/client/webhooks.d.ts +50 -0
  143. package/dist/client/webhooks.js +24 -0
  144. package/dist/client/webhooks.js.map +1 -0
  145. package/dist/handshake.d.ts +76 -0
  146. package/dist/handshake.js +96 -0
  147. package/dist/handshake.js.map +1 -0
  148. package/dist/index.d.ts +6 -0
  149. package/dist/index.js +26 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/jwks-cache.d.ts +62 -0
  152. package/dist/jwks-cache.js +114 -0
  153. package/dist/jwks-cache.js.map +1 -0
  154. package/dist/verify.d.ts +162 -0
  155. package/dist/verify.js +226 -0
  156. package/dist/verify.js.map +1 -0
  157. package/package.json +26 -0
@@ -0,0 +1,86 @@
1
+ import { type RequestFn } from './request';
2
+ import type { ListPage } from './types';
3
+ /** The fixed point in the auth pipeline an action runs at. */
4
+ export type ActionTrigger = 'post_login' | 'pre_user_registration' | 'post_user_registration';
5
+ /**
6
+ * Tenant code run in the hardened isolate at a trigger. Secret VALUES are
7
+ * write-only and never returned — a read reports only `secret_names`. Timestamps
8
+ * are epoch milliseconds.
9
+ */
10
+ export interface Action {
11
+ object: 'action';
12
+ id: string;
13
+ name: string;
14
+ trigger: ActionTrigger;
15
+ code: string;
16
+ runtime: string;
17
+ enabled: boolean;
18
+ secret_names: string[];
19
+ created_at: number;
20
+ updated_at: number;
21
+ }
22
+ export interface CreateActionBody {
23
+ name: string;
24
+ trigger: ActionTrigger;
25
+ code: string;
26
+ enabled?: boolean;
27
+ /** Write-only, encrypted at rest, never read back. */
28
+ secrets?: Record<string, string>;
29
+ }
30
+ export interface UpdateActionBody {
31
+ name?: string;
32
+ code?: string;
33
+ enabled?: boolean;
34
+ secrets?: Record<string, string>;
35
+ }
36
+ /** The sample event a dry-run runs against; every field has a stand-in default. */
37
+ export interface ActionTestEvent {
38
+ user?: {
39
+ id?: string;
40
+ email?: string;
41
+ emailVerified?: boolean;
42
+ metadata?: Record<string, unknown>;
43
+ };
44
+ connection?: {
45
+ strategy?: string;
46
+ };
47
+ request?: {
48
+ ip?: string;
49
+ user_agent?: string;
50
+ };
51
+ }
52
+ /** What an action produced against a sample event — no real data is touched. */
53
+ export interface ActionTestResult {
54
+ object: 'action_test_result';
55
+ id: string;
56
+ denied: boolean;
57
+ deny_reason: string | null;
58
+ access_token_claims: Record<string, unknown>;
59
+ id_token_claims: Record<string, unknown>;
60
+ app_metadata: Record<string, unknown>;
61
+ logs: string[];
62
+ error: string | null;
63
+ }
64
+ /** The ordered binding list for a trigger, replaced atomically as a set. */
65
+ export interface ActionBindingList {
66
+ object: 'action_binding_list';
67
+ trigger: ActionTrigger;
68
+ action_ids: string[];
69
+ }
70
+ export declare function actionsResource(request: RequestFn): {
71
+ list(): Promise<ListPage<Action>>;
72
+ create(body: CreateActionBody, idempotencyKey?: string): Promise<Action>;
73
+ get(id: string): Promise<Action>;
74
+ update(id: string, body: UpdateActionBody): Promise<Action>;
75
+ delete(id: string): Promise<{
76
+ object: "action";
77
+ id: string;
78
+ deleted: true;
79
+ }>;
80
+ /** Dry-run against a sample event in the sandbox; nothing is persisted. */
81
+ test(id: string, event?: ActionTestEvent): Promise<ActionTestResult>;
82
+ /** The actions bound to a trigger, in run order. */
83
+ getBindings(trigger: ActionTrigger): Promise<ActionBindingList>;
84
+ /** Replace a trigger's ordered binding set. */
85
+ setBindings(trigger: ActionTrigger, actionIds: string[]): Promise<ActionBindingList>;
86
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.actionsResource = actionsResource;
4
+ const request_1 = require("./request");
5
+ function actionsResource(request) {
6
+ return {
7
+ list() {
8
+ return request({ method: 'GET', path: '/v1/actions' });
9
+ },
10
+ create(body, idempotencyKey) {
11
+ return request({ method: 'POST', path: '/v1/actions', body, idempotencyKey });
12
+ },
13
+ get(id) {
14
+ return request({ method: 'GET', path: `/v1/actions/${(0, request_1.enc)(id)}` });
15
+ },
16
+ update(id, body) {
17
+ return request({ method: 'PATCH', path: `/v1/actions/${(0, request_1.enc)(id)}`, body });
18
+ },
19
+ delete(id) {
20
+ return request({ method: 'DELETE', path: `/v1/actions/${(0, request_1.enc)(id)}` });
21
+ },
22
+ /** Dry-run against a sample event in the sandbox; nothing is persisted. */
23
+ test(id, event = {}) {
24
+ return request({ method: 'POST', path: `/v1/actions/${(0, request_1.enc)(id)}/test`, body: { event } });
25
+ },
26
+ /** The actions bound to a trigger, in run order. */
27
+ getBindings(trigger) {
28
+ return request({ method: 'GET', path: `/v1/actions/bindings/${(0, request_1.enc)(trigger)}` });
29
+ },
30
+ /** Replace a trigger's ordered binding set. */
31
+ setBindings(trigger, actionIds) {
32
+ return request({
33
+ method: 'PUT',
34
+ path: `/v1/actions/bindings/${(0, request_1.enc)(trigger)}`,
35
+ body: { action_ids: actionIds },
36
+ });
37
+ },
38
+ };
39
+ }
40
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/client/actions.ts"],"names":[],"mappings":";;AAwEA,0CAkCC;AA1GD,uCAAgD;AAwEhD,SAAgB,eAAe,CAAC,OAAkB;IAChD,OAAO;QACL,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,CAAC,IAAsB,EAAE,cAAuB;YACpD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,MAAM,CAAC,EAAU,EAAE,IAAsB;YACvC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,2EAA2E;QAC3E,IAAI,CAAC,EAAU,EAAE,QAAyB,EAAE;YAC1C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,IAAA,aAAG,EAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3F,CAAC;QACD,oDAAoD;QACpD,WAAW,CAAC,OAAsB;YAChC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,+CAA+C;QAC/C,WAAW,CAAC,OAAsB,EAAE,SAAmB;YACrD,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,wBAAwB,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE;gBAC5C,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE;aAChC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type RequestFn } from './request';
2
+ export interface ActorToken {
3
+ object: 'actor_token';
4
+ id: string;
5
+ user_id: string;
6
+ actor: {
7
+ sub: string;
8
+ };
9
+ /** The one-time opaque secret, revealed once. */
10
+ token: string;
11
+ expires_in: number;
12
+ }
13
+ export interface CreateActorTokenBody {
14
+ user_id: string;
15
+ actor: {
16
+ sub: string;
17
+ };
18
+ /** Clamped server-side to [1, 3600]; defaults to 60. */
19
+ expires_in_seconds?: number;
20
+ }
21
+ export declare function actorTokensResource(request: RequestFn): {
22
+ create(body: CreateActorTokenBody, idempotencyKey?: string): Promise<ActorToken>;
23
+ revoke(id: string): Promise<{
24
+ object: "actor_token";
25
+ id: string;
26
+ revoked: true;
27
+ }>;
28
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.actorTokensResource = actorTokensResource;
4
+ const request_1 = require("./request");
5
+ function actorTokensResource(request) {
6
+ return {
7
+ create(body, idempotencyKey) {
8
+ return request({ method: 'POST', path: '/v1/actor_tokens', body, idempotencyKey });
9
+ },
10
+ revoke(id) {
11
+ return request({ method: 'POST', path: `/v1/actor_tokens/${(0, request_1.enc)(id)}/revoke` });
12
+ },
13
+ };
14
+ }
15
+ //# sourceMappingURL=actor-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-tokens.js","sourceRoot":"","sources":["../../src/client/actor-tokens.ts"],"names":[],"mappings":";;AAmBA,kDASC;AA5BD,uCAAgD;AAmBhD,SAAgB,mBAAmB,CAAC,OAAkB;IACpD,OAAO;QACL,MAAM,CAAC,IAA0B,EAAE,cAAuB;YACxD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,IAAA,aAAG,EAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACjF,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { type RequestFn } from './request';
2
+ import type { ListPage } from './types';
3
+ export type ApiKeySubjectType = 'user' | 'organization';
4
+ /**
5
+ * An end-user API key — Clerk `api_keys` parity. A tenant mints these for ITS OWN
6
+ * users/organizations and later asks Atlas to {@link ApiKeysResource.verify} one a
7
+ * subject presented. Only a hash is stored, so the `ak_` secret is shown exactly
8
+ * once at mint (see {@link ApiKeyWithSecret}); a read reports only the `prefix`.
9
+ */
10
+ export interface ApiKey {
11
+ object: 'api_key';
12
+ id: string;
13
+ subject_type: ApiKeySubjectType;
14
+ subject_id: string;
15
+ name: string | null;
16
+ /** Enough to tell two keys apart in a listing; not enough to use one. */
17
+ prefix: string;
18
+ claims: Record<string, unknown>;
19
+ last_used_at: number | null;
20
+ expires_at: number | null;
21
+ revoked_at: number | null;
22
+ created_at: number;
23
+ }
24
+ /** The mint response: the key plus its secret, revealed exactly once. */
25
+ export interface ApiKeyWithSecret extends ApiKey {
26
+ secret: string;
27
+ note: string;
28
+ }
29
+ export interface CreateApiKeyBody {
30
+ subject_type: ApiKeySubjectType;
31
+ subject_id: string;
32
+ name?: string;
33
+ claims?: Record<string, unknown>;
34
+ /** Epoch ms; null (or omitted) never expires. */
35
+ expires_at?: number | null;
36
+ }
37
+ export interface UpdateApiKeyBody {
38
+ name?: string | null;
39
+ claims?: Record<string, unknown>;
40
+ expires_at?: number | null;
41
+ }
42
+ /**
43
+ * The verify verdict. Every negative — unknown, malformed, revoked, expired, or a
44
+ * key whose subject was since deleted — resolves to the SAME `{ valid: false }`,
45
+ * so a caller learns nothing about which keys exist.
46
+ */
47
+ export type ApiKeyVerification = {
48
+ object: 'api_key_verification';
49
+ valid: false;
50
+ } | {
51
+ object: 'api_key_verification';
52
+ valid: true;
53
+ id: string;
54
+ subject_type: ApiKeySubjectType;
55
+ subject_id: string;
56
+ claims: Record<string, unknown>;
57
+ last_used_at: number | null;
58
+ };
59
+ export declare function apiKeysResource(request: RequestFn): {
60
+ /** Optionally narrowed to one subject. */
61
+ list(query?: {
62
+ subject_type?: ApiKeySubjectType;
63
+ subject_id?: string;
64
+ }): Promise<ListPage<ApiKey>>;
65
+ /** Mint a key. The secret is returned once, here. */
66
+ create(body: CreateApiKeyBody, idempotencyKey?: string): Promise<ApiKeyWithSecret>;
67
+ /** Check a presented secret. Rate-limited — it is an online credential check. */
68
+ verify(secret: string): Promise<ApiKeyVerification>;
69
+ get(id: string): Promise<ApiKey>;
70
+ update(id: string, body: UpdateApiKeyBody): Promise<ApiKey>;
71
+ /** Revoke a key. It stays queryable but never authenticates again. */
72
+ delete(id: string): Promise<{
73
+ object: "api_key";
74
+ id: string;
75
+ revoked: true;
76
+ }>;
77
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiKeysResource = apiKeysResource;
4
+ const request_1 = require("./request");
5
+ function apiKeysResource(request) {
6
+ return {
7
+ /** Optionally narrowed to one subject. */
8
+ list(query) {
9
+ return request({ method: 'GET', path: '/v1/api_keys', query });
10
+ },
11
+ /** Mint a key. The secret is returned once, here. */
12
+ create(body, idempotencyKey) {
13
+ return request({ method: 'POST', path: '/v1/api_keys', body, idempotencyKey });
14
+ },
15
+ /** Check a presented secret. Rate-limited — it is an online credential check. */
16
+ verify(secret) {
17
+ return request({ method: 'POST', path: '/v1/api_keys/verify', body: { secret } });
18
+ },
19
+ get(id) {
20
+ return request({ method: 'GET', path: `/v1/api_keys/${(0, request_1.enc)(id)}` });
21
+ },
22
+ update(id, body) {
23
+ return request({ method: 'PATCH', path: `/v1/api_keys/${(0, request_1.enc)(id)}`, body });
24
+ },
25
+ /** Revoke a key. It stays queryable but never authenticates again. */
26
+ delete(id) {
27
+ return request({ method: 'DELETE', path: `/v1/api_keys/${(0, request_1.enc)(id)}` });
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=api-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/client/api-keys.ts"],"names":[],"mappings":";;AAgEA,0CA4BC;AA5FD,uCAAgD;AAgEhD,SAAgB,eAAe,CAAC,OAAkB;IAChD,OAAO;QACL,0CAA0C;QAC1C,IAAI,CAAC,KAGJ;YACC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,qDAAqD;QACrD,MAAM,CAAC,IAAsB,EAAE,cAAuB;YACpD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,iFAAiF;QACjF,MAAM,CAAC,MAAc;YACnB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,CAAC,EAAU,EAAE,IAAsB;YACvC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,sEAAsE;QACtE,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { RequestFn } from './request';
2
+ export interface AttackProtection {
3
+ object: 'attack_protection';
4
+ brute_force: {
5
+ enabled: boolean;
6
+ tiers: Array<{
7
+ threshold: number;
8
+ window_ms: number;
9
+ lock_ms: number;
10
+ notify_user: boolean;
11
+ flag_for_admin: boolean;
12
+ }>;
13
+ };
14
+ breached_password: {
15
+ enabled: boolean;
16
+ };
17
+ suspicious_ip: {
18
+ enabled: boolean;
19
+ ip_allowlist: string[];
20
+ managed_by: 'dashboard_security';
21
+ };
22
+ captcha: {
23
+ provider: string;
24
+ site_key_set: boolean;
25
+ secret_set: boolean;
26
+ managed_by: 'auth_config_and_captcha_secret';
27
+ };
28
+ }
29
+ /** Only the two flags are writable; the rest of the object is read-only. */
30
+ export interface UpdateAttackProtectionBody {
31
+ brute_force?: {
32
+ enabled?: boolean;
33
+ };
34
+ breached_password?: {
35
+ enabled?: boolean;
36
+ };
37
+ }
38
+ export declare function attackProtectionResource(request: RequestFn): {
39
+ get(): Promise<AttackProtection>;
40
+ update(body: UpdateAttackProtectionBody): Promise<AttackProtection>;
41
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.attackProtectionResource = attackProtectionResource;
4
+ function attackProtectionResource(request) {
5
+ return {
6
+ get() {
7
+ return request({ method: 'GET', path: '/v1/attack_protection' });
8
+ },
9
+ update(body) {
10
+ return request({ method: 'PATCH', path: '/v1/attack_protection', body });
11
+ },
12
+ };
13
+ }
14
+ //# sourceMappingURL=attack-protection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attack-protection.js","sourceRoot":"","sources":["../../src/client/attack-protection.ts"],"names":[],"mappings":";;AAkCA,4DASC;AATD,SAAgB,wBAAwB,CAAC,OAAkB;IACzD,OAAO;QACL,GAAG;YACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,CAAC,IAAgC;YACrC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { RequestFn } from './request';
2
+ import type { CursorPage, CursorParams } from './types';
3
+ export interface AuditLog {
4
+ object: 'audit_log';
5
+ id: string;
6
+ actor_type: string;
7
+ actor_id: string | null;
8
+ action: string;
9
+ target_type: string | null;
10
+ target_id: string | null;
11
+ metadata: Record<string, unknown> | null;
12
+ created_at: number;
13
+ }
14
+ export interface ListAuditLogsParams extends CursorParams {
15
+ actor_id?: string;
16
+ action?: string;
17
+ }
18
+ export declare function auditLogsResource(request: RequestFn): {
19
+ list(params?: ListAuditLogsParams): Promise<CursorPage<AuditLog>>;
20
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.auditLogsResource = auditLogsResource;
4
+ function auditLogsResource(request) {
5
+ return {
6
+ list(params = {}) {
7
+ return request({ method: 'GET', path: '/v1/audit_logs', query: { ...params } });
8
+ },
9
+ };
10
+ }
11
+ //# sourceMappingURL=audit-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-logs.js","sourceRoot":"","sources":["../../src/client/audit-logs.ts"],"names":[],"mappings":";;AAoBA,8CAMC;AAND,SAAgB,iBAAiB,CAAC,OAAkB;IAClD,OAAO;QACL,IAAI,CAAC,SAA8B,EAAE;YACnC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAClF,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { type RequestFn } from './request';
2
+ import type { ListPage } from './types';
3
+ /**
4
+ * A plan a tenant defines for their app's users. `stripe_price_id` is the
5
+ * recurring price a subscriber is charged; `features` are the keys the plan
6
+ * grants, surfaced to the end user as the `fea` session claim.
7
+ */
8
+ export interface BillingPlan {
9
+ object: 'billing_plan';
10
+ id: string;
11
+ name: string;
12
+ slug: string;
13
+ stripe_price_id: string;
14
+ interval: string;
15
+ amount: string | null;
16
+ currency: string;
17
+ features: string[];
18
+ audience: string;
19
+ active: boolean;
20
+ created_at: number;
21
+ updated_at: number;
22
+ }
23
+ /**
24
+ * A read view of who is subscribed. `status` is written ONLY by the verified
25
+ * Stripe webhook, never through this SDK.
26
+ */
27
+ export interface BillingSubscription {
28
+ object: 'billing_subscription';
29
+ id: string;
30
+ subject_type: string;
31
+ subject_id: string;
32
+ plan_id: string;
33
+ status: string;
34
+ stripe_subscription_id: string | null;
35
+ stripe_customer_id: string | null;
36
+ current_period_end: number | null;
37
+ created_at: number;
38
+ updated_at: number;
39
+ }
40
+ export interface CreateBillingPlanBody {
41
+ name: string;
42
+ slug: string;
43
+ stripe_price_id: string;
44
+ /** One of `month`, `year`. Defaults to `month`. */
45
+ interval?: string;
46
+ amount?: string;
47
+ currency?: string;
48
+ features?: string[];
49
+ /** One of `user`, `org`. Defaults to `user`. */
50
+ audience?: string;
51
+ active?: boolean;
52
+ }
53
+ export interface UpdateBillingPlanBody {
54
+ name?: string;
55
+ slug?: string;
56
+ stripe_price_id?: string;
57
+ interval?: string;
58
+ amount?: string;
59
+ currency?: string;
60
+ features?: string[];
61
+ audience?: string;
62
+ active?: boolean;
63
+ }
64
+ /** Filter the subscription read view to one subject. */
65
+ export interface ListSubscriptionsParams {
66
+ /** One of `user`, `org`. */
67
+ subject_type?: string;
68
+ subject_id?: string;
69
+ }
70
+ export declare function billingResource(request: RequestFn): {
71
+ listPlans(): Promise<ListPage<BillingPlan>>;
72
+ createPlan(body: CreateBillingPlanBody, idempotencyKey?: string): Promise<BillingPlan>;
73
+ getPlan(id: string): Promise<BillingPlan>;
74
+ updatePlan(id: string, body: UpdateBillingPlanBody): Promise<BillingPlan>;
75
+ deletePlan(id: string): Promise<{
76
+ object: "billing_plan";
77
+ id: string;
78
+ deleted: true;
79
+ }>;
80
+ listSubscriptions(params?: ListSubscriptionsParams): Promise<ListPage<BillingSubscription>>;
81
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.billingResource = billingResource;
4
+ const request_1 = require("./request");
5
+ function billingResource(request) {
6
+ return {
7
+ listPlans() {
8
+ return request({ method: 'GET', path: '/v1/billing/plans' });
9
+ },
10
+ createPlan(body, idempotencyKey) {
11
+ return request({ method: 'POST', path: '/v1/billing/plans', body, idempotencyKey });
12
+ },
13
+ getPlan(id) {
14
+ return request({ method: 'GET', path: `/v1/billing/plans/${(0, request_1.enc)(id)}` });
15
+ },
16
+ updatePlan(id, body) {
17
+ return request({ method: 'PATCH', path: `/v1/billing/plans/${(0, request_1.enc)(id)}`, body });
18
+ },
19
+ deletePlan(id) {
20
+ return request({ method: 'DELETE', path: `/v1/billing/plans/${(0, request_1.enc)(id)}` });
21
+ },
22
+ listSubscriptions(params) {
23
+ return request({ method: 'GET', path: '/v1/billing/subscriptions', query: { ...params } });
24
+ },
25
+ };
26
+ }
27
+ //# sourceMappingURL=billing-plans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-plans.js","sourceRoot":"","sources":["../../src/client/billing-plans.ts"],"names":[],"mappings":";;AA2EA,0CAqBC;AAhGD,uCAAgD;AA2EhD,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,cAAuB;YAC7D,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,CAAC,EAAU;YAChB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,UAAU,CAAC,EAAU,EAAE,IAA2B;YAChD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,UAAU,CAAC,EAAU;YACnB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,iBAAiB,CAAC,MAAgC;YAChD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { type RequestFn } from './request';
2
+ /**
3
+ * One append-only row of the anti-bot signal lake: a fully anonymised feature
4
+ * vector per auth interaction. IPs are salt-hashed at ingest and behaviour is
5
+ * timing aggregates only — nothing here is a raw secret.
6
+ */
7
+ export interface BotSignal {
8
+ object: 'bot_signal';
9
+ id: string;
10
+ attempt_id: string | null;
11
+ user_id: string | null;
12
+ /** sign_in | sign_up | telemetry */
13
+ kind: string;
14
+ /** client_beacon | server */
15
+ source: string;
16
+ ip_hash: string | null;
17
+ ip_subnet: string | null;
18
+ asn: number | null;
19
+ geo_country: string | null;
20
+ geo_city: string | null;
21
+ is_datacenter: boolean | null;
22
+ is_anonymizer: boolean | null;
23
+ header_fingerprint: string | null;
24
+ accept_language: string | null;
25
+ device_id: string | null;
26
+ device_fingerprint: string | null;
27
+ device_features: Record<string, unknown>;
28
+ behavior_features: Record<string, unknown>;
29
+ captcha_provider: string | null;
30
+ captcha_score: number | null;
31
+ risk_level: string | null;
32
+ risk_score: number | null;
33
+ risk_signals: Record<string, unknown>;
34
+ heuristic_score: number | null;
35
+ heuristic_reasons: unknown[];
36
+ /** started | completed | failed | challenged | abandoned */
37
+ outcome: string | null;
38
+ created_at: number;
39
+ }
40
+ /** A supervised training label, attachable after the interaction. */
41
+ export interface BotLabel {
42
+ object: 'bot_label';
43
+ id: string;
44
+ subject_type: 'user' | 'device' | 'ip_hash' | 'attempt';
45
+ subject_id: string;
46
+ label: 'bot' | 'human' | 'suspect';
47
+ /** admin_ban | captcha_failed | mfa_failed | verified_human | analyst | model */
48
+ source: string;
49
+ confidence: number;
50
+ note: string | null;
51
+ labeled_by: string | null;
52
+ created_at: number;
53
+ }
54
+ /**
55
+ * A newest-first export page: `next_before` is the created-at epoch-ms cursor to
56
+ * pass back as `before` for the next (older) page, or null at the end.
57
+ */
58
+ export interface BotExportPage<T> {
59
+ object: 'list';
60
+ data: T[];
61
+ next_before: number | null;
62
+ }
63
+ /** limit (1..500, default 100) and an optional `before` epoch-ms cursor. */
64
+ export interface BotExportParams {
65
+ limit?: number;
66
+ /** created-at epoch-ms cursor; returns rows OLDER than this. */
67
+ before?: number;
68
+ }
69
+ export interface CreateBotLabelBody {
70
+ subject_type: 'user' | 'device' | 'ip_hash' | 'attempt';
71
+ subject_id: string;
72
+ label: 'bot' | 'human' | 'suspect';
73
+ /** Clamped to 0..1; defaults to 1. */
74
+ confidence?: number;
75
+ note?: string;
76
+ }
77
+ /**
78
+ * Export the anti-bot signal lake and its training labels, and let an analyst
79
+ * add labels — the surface a tenant pulls to train their own bot-vs-human model.
80
+ */
81
+ export declare function botSignalsResource(request: RequestFn): {
82
+ /** Page the signal lake, newest first, for an incremental pull. */
83
+ list(query?: BotExportParams): Promise<BotExportPage<BotSignal>>;
84
+ /** Page the training labels, newest first. */
85
+ listLabels(query?: BotExportParams): Promise<BotExportPage<BotLabel>>;
86
+ /** Attach a training label to a user / device / ip_hash / attempt. */
87
+ createLabel(body: CreateBotLabelBody, idempotencyKey?: string): Promise<BotLabel>;
88
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.botSignalsResource = botSignalsResource;
4
+ /**
5
+ * Export the anti-bot signal lake and its training labels, and let an analyst
6
+ * add labels — the surface a tenant pulls to train their own bot-vs-human model.
7
+ */
8
+ function botSignalsResource(request) {
9
+ return {
10
+ /** Page the signal lake, newest first, for an incremental pull. */
11
+ list(query) {
12
+ return request({ method: 'GET', path: '/v1/bot_signals', query: { ...query } });
13
+ },
14
+ /** Page the training labels, newest first. */
15
+ listLabels(query) {
16
+ return request({ method: 'GET', path: '/v1/bot_labels', query: { ...query } });
17
+ },
18
+ /** Attach a training label to a user / device / ip_hash / attempt. */
19
+ createLabel(body, idempotencyKey) {
20
+ return request({ method: 'POST', path: '/v1/bot_labels', body, idempotencyKey });
21
+ },
22
+ };
23
+ }
24
+ //# sourceMappingURL=bot-signals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-signals.js","sourceRoot":"","sources":["../../src/client/bot-signals.ts"],"names":[],"mappings":";;AAsFA,gDAeC;AAnBD;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAkB;IACnD,OAAO;QACL,mEAAmE;QACnE,IAAI,CAAC,KAAuB;YAC1B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,8CAA8C;QAC9C,UAAU,CAAC,KAAuB;YAChC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,sEAAsE;QACtE,WAAW,CAAC,IAAwB,EAAE,cAAuB;YAC3D,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACnF,CAAC;KACF,CAAC;AACJ,CAAC"}