@useatlas/types 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/abuse.d.ts +42 -0
- package/dist/action.d.ts +67 -13
- package/dist/action.js +33 -1
- package/dist/approval.d.ts +62 -0
- package/dist/auth.d.ts +3 -1
- package/dist/auth.js +1 -1
- package/dist/backups.d.ts +29 -0
- package/dist/billing.d.ts +20 -0
- package/dist/billing.js +0 -0
- package/dist/branding.d.ts +36 -0
- package/dist/compliance.d.ts +110 -0
- package/dist/connection.d.ts +30 -0
- package/dist/conversation.d.ts +28 -0
- package/dist/domain.d.ts +26 -0
- package/dist/errors.d.ts +64 -3
- package/dist/errors.js +240 -19
- package/dist/index.d.ts +18 -0
- package/dist/index.js +401 -22
- package/dist/learned-pattern.d.ts +27 -0
- package/dist/model-config.d.ts +41 -0
- package/dist/onboarding-email.d.ts +40 -0
- package/dist/organization.d.ts +51 -0
- package/dist/platform.d.ts +67 -0
- package/dist/profiler.d.ts +137 -0
- package/dist/prompt.d.ts +27 -0
- package/dist/query-suggestion.d.ts +16 -0
- package/dist/residency.d.ts +71 -0
- package/dist/semantic.d.ts +53 -0
- package/dist/share.d.ts +14 -0
- package/dist/share.js +13 -0
- package/dist/sla.d.ts +58 -0
- package/dist/sso.d.ts +79 -0
- package/package.json +17 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthew Sywulak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @useatlas/types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types for the [Atlas](https://useatlas.dev) text-to-SQL agent.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @useatlas/types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Import from the barrel or use deep imports for tree-shaking:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { Conversation, AuthMode, DBType } from "@useatlas/types";
|
|
17
|
+
|
|
18
|
+
// Deep imports
|
|
19
|
+
import type { ChatErrorCode } from "@useatlas/types/errors";
|
|
20
|
+
import type { Recipient } from "@useatlas/types/scheduled-task";
|
|
21
|
+
import { parseChatError, authErrorMessage } from "@useatlas/types/errors";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Modules
|
|
25
|
+
|
|
26
|
+
| Import path | Contents |
|
|
27
|
+
|-------------|----------|
|
|
28
|
+
| `@useatlas/types` | Barrel — re-exports everything below |
|
|
29
|
+
| `@useatlas/types/auth` | `AuthMode`, `AtlasRole`, `AtlasUser` |
|
|
30
|
+
| `@useatlas/types/conversation` | `Conversation`, `Message`, `ConversationWithMessages` |
|
|
31
|
+
| `@useatlas/types/connection` | `DBType`, `ConnectionHealth`, `ConnectionInfo`, `ConnectionDetail` |
|
|
32
|
+
| `@useatlas/types/action` | `ActionApprovalMode`, `ActionDisplayStatus`, `ActionToolResultShape` |
|
|
33
|
+
| `@useatlas/types/scheduled-task` | `ScheduledTask`, `Recipient`, `ScheduledTaskRun` |
|
|
34
|
+
| `@useatlas/types/errors` | `ChatErrorCode`, `ChatErrorInfo`, `parseChatError`, `authErrorMessage` |
|
|
35
|
+
| `@useatlas/types/semantic` | `Dimension`, `SemanticEntitySummary`, `SemanticEntityDetail` |
|
|
36
|
+
| `@useatlas/types/share` | `ShareLink` |
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|
package/dist/abuse.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Graduated abuse response levels (escalation order). */
|
|
2
|
+
export declare const ABUSE_LEVELS: readonly ["none", "warning", "throttled", "suspended"];
|
|
3
|
+
export type AbuseLevel = (typeof ABUSE_LEVELS)[number];
|
|
4
|
+
/** Which anomaly detector triggered the abuse event. */
|
|
5
|
+
export declare const ABUSE_TRIGGERS: readonly ["query_rate", "error_rate", "unique_tables", "manual"];
|
|
6
|
+
export type AbuseTrigger = (typeof ABUSE_TRIGGERS)[number];
|
|
7
|
+
/** A single abuse event recorded in the audit trail. */
|
|
8
|
+
export interface AbuseEvent {
|
|
9
|
+
id: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
level: AbuseLevel;
|
|
12
|
+
trigger: AbuseTrigger;
|
|
13
|
+
message: string;
|
|
14
|
+
metadata: Record<string, unknown>;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
/** Who initiated the event — "system" for auto-detection, user ID for manual reinstate. */
|
|
17
|
+
actor: string;
|
|
18
|
+
}
|
|
19
|
+
/** Current abuse status for a workspace. */
|
|
20
|
+
export interface AbuseStatus {
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
workspaceName: string | null;
|
|
23
|
+
level: AbuseLevel;
|
|
24
|
+
trigger: AbuseTrigger | null;
|
|
25
|
+
message: string | null;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
/** Recent abuse events for this workspace. */
|
|
28
|
+
events: AbuseEvent[];
|
|
29
|
+
}
|
|
30
|
+
/** Abuse threshold configuration (read-only from admin API). */
|
|
31
|
+
export interface AbuseThresholdConfig {
|
|
32
|
+
/** Max queries per workspace per sliding window. */
|
|
33
|
+
queryRateLimit: number;
|
|
34
|
+
/** Sliding window duration in seconds. */
|
|
35
|
+
queryRateWindowSeconds: number;
|
|
36
|
+
/** Max error rate (0–1) before escalation. */
|
|
37
|
+
errorRateThreshold: number;
|
|
38
|
+
/** Max unique tables accessed per window before escalation. */
|
|
39
|
+
uniqueTablesLimit: number;
|
|
40
|
+
/** Delay injected for throttled workspaces, in milliseconds. */
|
|
41
|
+
throttleDelayMs: number;
|
|
42
|
+
}
|
package/dist/action.d.ts
CHANGED
|
@@ -1,29 +1,83 @@
|
|
|
1
|
+
import type { AuthMode } from "./auth";
|
|
1
2
|
export declare const ACTION_APPROVAL_MODES: readonly ["auto", "manual", "admin-only"];
|
|
2
3
|
export type ActionApprovalMode = (typeof ACTION_APPROVAL_MODES)[number];
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Display status lifecycle for action tools that require user approval.
|
|
6
|
+
*
|
|
7
|
+
* Distinct from the server-internal `ActionStatus` which uses "pending"
|
|
8
|
+
* instead of "pending_approval".
|
|
9
|
+
*/
|
|
10
|
+
export type ActionDisplayStatus = "pending_approval" | "approved" | "executed" | "auto_approved" | "denied" | "failed" | "rolled_back" | "timed_out";
|
|
11
|
+
/** A display status that is terminal (no longer pending). */
|
|
12
|
+
export type ResolvedDisplayStatus = Exclude<ActionDisplayStatus, "pending_approval">;
|
|
13
|
+
/** Single source of truth for every ActionDisplayStatus value. */
|
|
8
14
|
export declare const ALL_STATUSES: readonly ["pending_approval", "approved", "executed", "auto_approved", "denied", "failed", "rolled_back", "timed_out"];
|
|
9
15
|
/** All statuses that are terminal (no longer pending). */
|
|
10
|
-
export declare const RESOLVED_STATUSES: ReadonlySet<
|
|
11
|
-
/**
|
|
12
|
-
export
|
|
13
|
-
status:
|
|
16
|
+
export declare const RESOLVED_STATUSES: ReadonlySet<ActionDisplayStatus>;
|
|
17
|
+
/** Discriminated union returned by action tools in the tool result. */
|
|
18
|
+
export type ActionToolResultShape = {
|
|
19
|
+
status: "pending_approval";
|
|
20
|
+
actionId: string;
|
|
21
|
+
summary: string;
|
|
22
|
+
details?: Record<string, unknown>;
|
|
23
|
+
} | {
|
|
24
|
+
status: "approved" | "executed" | "auto_approved";
|
|
14
25
|
actionId: string;
|
|
26
|
+
result: unknown;
|
|
15
27
|
summary?: string;
|
|
16
28
|
details?: Record<string, unknown>;
|
|
17
|
-
|
|
29
|
+
} | {
|
|
30
|
+
status: "denied";
|
|
31
|
+
actionId: string;
|
|
18
32
|
reason?: string;
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
summary?: string;
|
|
34
|
+
details?: Record<string, unknown>;
|
|
35
|
+
} | {
|
|
36
|
+
status: "failed";
|
|
37
|
+
actionId: string;
|
|
38
|
+
error: string;
|
|
39
|
+
summary?: string;
|
|
40
|
+
details?: Record<string, unknown>;
|
|
41
|
+
} | {
|
|
42
|
+
status: "rolled_back" | "timed_out";
|
|
43
|
+
actionId: string;
|
|
44
|
+
summary?: string;
|
|
45
|
+
details?: Record<string, unknown>;
|
|
46
|
+
};
|
|
21
47
|
/** API response when approving or denying an action. */
|
|
22
48
|
export interface ActionApprovalResponse {
|
|
23
49
|
actionId: string;
|
|
24
|
-
status:
|
|
50
|
+
status: ActionDisplayStatus;
|
|
25
51
|
result?: unknown;
|
|
26
52
|
error?: string;
|
|
27
53
|
}
|
|
54
|
+
export declare const ACTION_STATUSES: readonly ["pending", "approved", "denied", "executed", "failed", "timed_out", "auto_approved", "rolled_back"];
|
|
55
|
+
export type ActionStatus = (typeof ACTION_STATUSES)[number];
|
|
56
|
+
/** Information needed to undo an executed action. */
|
|
57
|
+
export interface RollbackInfo {
|
|
58
|
+
method: string;
|
|
59
|
+
params: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/** Database row shape for the action_log table. */
|
|
62
|
+
export interface ActionLogEntry {
|
|
63
|
+
id: string;
|
|
64
|
+
requested_at: string;
|
|
65
|
+
resolved_at: string | null;
|
|
66
|
+
executed_at: string | null;
|
|
67
|
+
requested_by: string | null;
|
|
68
|
+
/** Stores the approver for approved actions and the denier for denied actions. */
|
|
69
|
+
approved_by: string | null;
|
|
70
|
+
auth_mode: AuthMode;
|
|
71
|
+
action_type: string;
|
|
72
|
+
target: string;
|
|
73
|
+
summary: string;
|
|
74
|
+
payload: Record<string, unknown>;
|
|
75
|
+
status: ActionStatus;
|
|
76
|
+
result: unknown;
|
|
77
|
+
error: string | null;
|
|
78
|
+
rollback_info: RollbackInfo | null;
|
|
79
|
+
conversation_id: string | null;
|
|
80
|
+
request_id: string | null;
|
|
81
|
+
}
|
|
28
82
|
/** Type guard: returns true if `result` looks like an action tool result. */
|
|
29
83
|
export declare function isActionToolResult(result: unknown): result is ActionToolResultShape;
|
package/dist/action.js
CHANGED
|
@@ -11,16 +11,48 @@ var ALL_STATUSES = [
|
|
|
11
11
|
"timed_out"
|
|
12
12
|
];
|
|
13
13
|
var RESOLVED_STATUSES = new Set(ALL_STATUSES.filter((s) => s !== "pending_approval"));
|
|
14
|
+
var ACTION_STATUSES = [
|
|
15
|
+
"pending",
|
|
16
|
+
"approved",
|
|
17
|
+
"denied",
|
|
18
|
+
"executed",
|
|
19
|
+
"failed",
|
|
20
|
+
"timed_out",
|
|
21
|
+
"auto_approved",
|
|
22
|
+
"rolled_back"
|
|
23
|
+
];
|
|
14
24
|
var VALID_STATUSES = new Set(ALL_STATUSES);
|
|
15
25
|
function isActionToolResult(result) {
|
|
16
26
|
if (result == null || typeof result !== "object")
|
|
17
27
|
return false;
|
|
18
28
|
const r = result;
|
|
19
|
-
|
|
29
|
+
if (typeof r.actionId !== "string" || r.actionId.length === 0)
|
|
30
|
+
return false;
|
|
31
|
+
if (typeof r.status !== "string")
|
|
32
|
+
return false;
|
|
33
|
+
if (!VALID_STATUSES.has(r.status))
|
|
34
|
+
return false;
|
|
35
|
+
switch (r.status) {
|
|
36
|
+
case "pending_approval":
|
|
37
|
+
return typeof r.summary === "string";
|
|
38
|
+
case "approved":
|
|
39
|
+
case "executed":
|
|
40
|
+
case "auto_approved":
|
|
41
|
+
return "result" in r;
|
|
42
|
+
case "failed":
|
|
43
|
+
return typeof r.error === "string";
|
|
44
|
+
case "denied":
|
|
45
|
+
case "rolled_back":
|
|
46
|
+
case "timed_out":
|
|
47
|
+
return true;
|
|
48
|
+
default:
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
20
51
|
}
|
|
21
52
|
export {
|
|
22
53
|
isActionToolResult,
|
|
23
54
|
RESOLVED_STATUSES,
|
|
24
55
|
ALL_STATUSES,
|
|
56
|
+
ACTION_STATUSES,
|
|
25
57
|
ACTION_APPROVAL_MODES
|
|
26
58
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval workflow types shared across API, frontend, and SDK.
|
|
3
|
+
*
|
|
4
|
+
* Enterprise customers can configure approval rules that intercept sensitive
|
|
5
|
+
* queries (by table, column, or cost threshold) and require sign-off before
|
|
6
|
+
* execution.
|
|
7
|
+
*/
|
|
8
|
+
export declare const APPROVAL_RULE_TYPES: readonly ["table", "column", "cost"];
|
|
9
|
+
export type ApprovalRuleType = (typeof APPROVAL_RULE_TYPES)[number];
|
|
10
|
+
export declare const APPROVAL_STATUSES: readonly ["pending", "approved", "denied", "expired"];
|
|
11
|
+
export type ApprovalStatus = (typeof APPROVAL_STATUSES)[number];
|
|
12
|
+
export interface ApprovalRule {
|
|
13
|
+
id: string;
|
|
14
|
+
orgId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
ruleType: ApprovalRuleType;
|
|
17
|
+
/** For table rules: table name pattern. For column rules: column name pattern. For cost: unused. */
|
|
18
|
+
pattern: string;
|
|
19
|
+
/** For cost rules: threshold value. Null for table/column rules. */
|
|
20
|
+
threshold: number | null;
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ApprovalRequest {
|
|
26
|
+
id: string;
|
|
27
|
+
orgId: string;
|
|
28
|
+
ruleId: string;
|
|
29
|
+
ruleName: string;
|
|
30
|
+
requesterId: string;
|
|
31
|
+
requesterEmail: string | null;
|
|
32
|
+
/** The SQL query awaiting approval. */
|
|
33
|
+
querySql: string;
|
|
34
|
+
explanation: string | null;
|
|
35
|
+
connectionId: string;
|
|
36
|
+
tablesAccessed: string[];
|
|
37
|
+
columnsAccessed: string[];
|
|
38
|
+
status: ApprovalStatus;
|
|
39
|
+
reviewerId: string | null;
|
|
40
|
+
reviewerEmail: string | null;
|
|
41
|
+
reviewComment: string | null;
|
|
42
|
+
reviewedAt: string | null;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
expiresAt: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CreateApprovalRuleRequest {
|
|
47
|
+
name: string;
|
|
48
|
+
ruleType: ApprovalRuleType;
|
|
49
|
+
pattern: string;
|
|
50
|
+
threshold?: number | null;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface UpdateApprovalRuleRequest {
|
|
54
|
+
name?: string;
|
|
55
|
+
pattern?: string;
|
|
56
|
+
threshold?: number | null;
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface ReviewApprovalRequest {
|
|
60
|
+
action: "approve" | "deny";
|
|
61
|
+
comment?: string;
|
|
62
|
+
}
|
package/dist/auth.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const AUTH_MODES: readonly ["none", "simple-key", "managed", "byot"];
|
|
9
9
|
export type AuthMode = (typeof AUTH_MODES)[number];
|
|
10
|
-
export declare const ATLAS_ROLES: readonly ["
|
|
10
|
+
export declare const ATLAS_ROLES: readonly ["member", "admin", "owner", "platform_admin"];
|
|
11
11
|
export type AtlasRole = (typeof ATLAS_ROLES)[number];
|
|
12
12
|
export interface AtlasUser {
|
|
13
13
|
id: string;
|
|
@@ -15,6 +15,8 @@ export interface AtlasUser {
|
|
|
15
15
|
label: string;
|
|
16
16
|
/** Permission role for action approval. Defaults based on auth mode when not set. */
|
|
17
17
|
role?: AtlasRole;
|
|
18
|
+
/** Active organization ID from session. All data is scoped to this org. */
|
|
19
|
+
activeOrganizationId?: string;
|
|
18
20
|
/** Auth-source claims for RLS policy evaluation (JWT payload, session user, or env-derived). */
|
|
19
21
|
claims?: Readonly<Record<string, unknown>>;
|
|
20
22
|
}
|
package/dist/auth.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backup and disaster recovery types.
|
|
3
|
+
*
|
|
4
|
+
* Used by the platform admin console for managing automated
|
|
5
|
+
* backups of the internal PostgreSQL database.
|
|
6
|
+
*/
|
|
7
|
+
export declare const BACKUP_STATUSES: readonly ["in_progress", "completed", "failed", "verified"];
|
|
8
|
+
export type BackupStatus = (typeof BACKUP_STATUSES)[number];
|
|
9
|
+
export interface BackupEntry {
|
|
10
|
+
id: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
/** Compressed backup size in bytes. Null while in_progress. */
|
|
13
|
+
sizeBytes: number | null;
|
|
14
|
+
status: BackupStatus;
|
|
15
|
+
/** Filesystem or S3 path where the backup is stored. */
|
|
16
|
+
storagePath: string;
|
|
17
|
+
/** When this backup will be auto-purged based on retention policy. */
|
|
18
|
+
retentionExpiresAt: string;
|
|
19
|
+
/** Error message if status is "failed". */
|
|
20
|
+
errorMessage: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface BackupConfig {
|
|
23
|
+
/** Cron expression for automated backups. Default: "0 3 * * *" (daily 03:00 UTC). */
|
|
24
|
+
schedule: string;
|
|
25
|
+
/** Number of days to retain backups before auto-purge. Default: 30. */
|
|
26
|
+
retentionDays: number;
|
|
27
|
+
/** Directory or S3 URI for backup storage. */
|
|
28
|
+
storagePath: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Overage status levels for a workspace's usage against its plan limits. */
|
|
2
|
+
export type OverageStatus = "ok" | "warning" | "soft_limit" | "hard_limit";
|
|
3
|
+
/**
|
|
4
|
+
* Usage status for a single metered dimension (queries or tokens).
|
|
5
|
+
*
|
|
6
|
+
* Included in billing API responses and enforcement headers so clients
|
|
7
|
+
* can display usage bars, warnings, and upgrade CTAs.
|
|
8
|
+
*/
|
|
9
|
+
export interface PlanLimitStatus {
|
|
10
|
+
/** Which metric this status applies to. */
|
|
11
|
+
metric: "queries" | "tokens";
|
|
12
|
+
/** Current usage count for the billing period. */
|
|
13
|
+
currentUsage: number;
|
|
14
|
+
/** Plan limit for the billing period. -1 = unlimited. */
|
|
15
|
+
limit: number;
|
|
16
|
+
/** Usage as a percentage of the limit. 0 = no usage, 100 = at limit. No upper bound. */
|
|
17
|
+
usagePercent: number;
|
|
18
|
+
/** Overage status level. */
|
|
19
|
+
status: OverageStatus;
|
|
20
|
+
}
|
package/dist/billing.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace branding (white-labeling) types shared across API, frontend, and SDK.
|
|
3
|
+
*
|
|
4
|
+
* Enterprise customers can configure custom logo, colors, favicon, and hide
|
|
5
|
+
* Atlas branding per workspace.
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkspaceBranding {
|
|
8
|
+
id: string;
|
|
9
|
+
orgId: string;
|
|
10
|
+
logoUrl: string | null;
|
|
11
|
+
logoText: string | null;
|
|
12
|
+
/** 6-digit hex color (e.g. #FF5500), or null for Atlas default. */
|
|
13
|
+
primaryColor: string | null;
|
|
14
|
+
faviconUrl: string | null;
|
|
15
|
+
hideAtlasBranding: boolean;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Public-safe subset of WorkspaceBranding (no internal IDs or timestamps).
|
|
21
|
+
* Returned by the public GET /api/v1/branding endpoint.
|
|
22
|
+
*/
|
|
23
|
+
export type WorkspaceBrandingPublic = Pick<WorkspaceBranding, "logoUrl" | "logoText" | "primaryColor" | "faviconUrl" | "hideAtlasBranding">;
|
|
24
|
+
/**
|
|
25
|
+
* Input for setting workspace branding. This is a full replacement —
|
|
26
|
+
* any field not included is reset to null (or false for hideAtlasBranding).
|
|
27
|
+
* Callers must send all fields to preserve existing values.
|
|
28
|
+
*/
|
|
29
|
+
export interface SetWorkspaceBrandingInput {
|
|
30
|
+
logoUrl?: string | null;
|
|
31
|
+
logoText?: string | null;
|
|
32
|
+
/** 6-digit hex color (e.g. #FF5500). Set to null to clear. */
|
|
33
|
+
primaryColor?: string | null;
|
|
34
|
+
faviconUrl?: string | null;
|
|
35
|
+
hideAtlasBranding?: boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PII detection and column masking types shared across API, frontend, and SDK.
|
|
3
|
+
*
|
|
4
|
+
* Enterprise customers can enable PII detection during database profiling to
|
|
5
|
+
* auto-tag sensitive columns. Masking rules control how PII-tagged columns
|
|
6
|
+
* appear in query results based on user role.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PII_CATEGORIES: readonly ["email", "phone", "ssn", "credit_card", "name", "ip_address", "date_of_birth", "address", "passport", "driver_license", "other"];
|
|
9
|
+
export type PIICategory = (typeof PII_CATEGORIES)[number];
|
|
10
|
+
export declare const PII_CONFIDENCE_LEVELS: readonly ["high", "medium", "low"];
|
|
11
|
+
export type PIIConfidence = (typeof PII_CONFIDENCE_LEVELS)[number];
|
|
12
|
+
export declare const MASKING_STRATEGIES: readonly ["full", "partial", "hash", "redact"];
|
|
13
|
+
export type MaskingStrategy = (typeof MASKING_STRATEGIES)[number];
|
|
14
|
+
export declare const PII_DETECTION_METHODS: readonly ["regex", "column_name", "type_heuristic"];
|
|
15
|
+
export type PIIDetectionMethod = (typeof PII_DETECTION_METHODS)[number];
|
|
16
|
+
export interface PIIDetection {
|
|
17
|
+
/** The detected PII category. */
|
|
18
|
+
category: PIICategory;
|
|
19
|
+
/** Confidence level of the detection. */
|
|
20
|
+
confidence: PIIConfidence;
|
|
21
|
+
/** How the detection was made. */
|
|
22
|
+
method: PIIDetectionMethod;
|
|
23
|
+
/** Human-readable reason for the detection. */
|
|
24
|
+
reason: string;
|
|
25
|
+
}
|
|
26
|
+
/** Roles relevant to masking decisions. */
|
|
27
|
+
export declare const MASKING_ROLES: readonly ["admin", "owner", "analyst", "viewer", "member"];
|
|
28
|
+
export type MaskingRole = (typeof MASKING_ROLES)[number];
|
|
29
|
+
export interface PIIColumnClassification {
|
|
30
|
+
id: string;
|
|
31
|
+
orgId: string;
|
|
32
|
+
/** Entity table name. */
|
|
33
|
+
tableName: string;
|
|
34
|
+
/** Column name within the table. */
|
|
35
|
+
columnName: string;
|
|
36
|
+
/** Connection ID for the datasource. */
|
|
37
|
+
connectionId: string;
|
|
38
|
+
/** Detected or manually assigned PII category. */
|
|
39
|
+
category: PIICategory;
|
|
40
|
+
/** Detection confidence level. */
|
|
41
|
+
confidence: PIIConfidence;
|
|
42
|
+
/** Masking strategy to apply in query results. */
|
|
43
|
+
maskingStrategy: MaskingStrategy;
|
|
44
|
+
/** Whether this detection has been reviewed by an admin. */
|
|
45
|
+
reviewed: boolean;
|
|
46
|
+
/** If true, admin dismissed this as a false positive. */
|
|
47
|
+
dismissed: boolean;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface UpdatePIIClassificationRequest {
|
|
52
|
+
category?: PIICategory;
|
|
53
|
+
maskingStrategy?: MaskingStrategy;
|
|
54
|
+
dismissed?: boolean;
|
|
55
|
+
reviewed?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare const COMPLIANCE_REPORT_TYPES: readonly ["data-access", "user-activity"];
|
|
58
|
+
export type ComplianceReportType = (typeof COMPLIANCE_REPORT_TYPES)[number];
|
|
59
|
+
export declare const COMPLIANCE_EXPORT_FORMATS: readonly ["json", "csv"];
|
|
60
|
+
export type ComplianceExportFormat = (typeof COMPLIANCE_EXPORT_FORMATS)[number];
|
|
61
|
+
export interface ComplianceReportFilters {
|
|
62
|
+
startDate: string;
|
|
63
|
+
endDate: string;
|
|
64
|
+
userId?: string;
|
|
65
|
+
role?: string;
|
|
66
|
+
table?: string;
|
|
67
|
+
}
|
|
68
|
+
/** A single row in the data access report. */
|
|
69
|
+
export interface DataAccessRow {
|
|
70
|
+
tableName: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
userEmail: string | null;
|
|
73
|
+
userRole: string | null;
|
|
74
|
+
queryCount: number;
|
|
75
|
+
uniqueColumns: string[];
|
|
76
|
+
hasPII: boolean;
|
|
77
|
+
firstAccess: string;
|
|
78
|
+
lastAccess: string;
|
|
79
|
+
}
|
|
80
|
+
export interface DataAccessReport {
|
|
81
|
+
rows: DataAccessRow[];
|
|
82
|
+
summary: {
|
|
83
|
+
totalQueries: number;
|
|
84
|
+
uniqueUsers: number;
|
|
85
|
+
uniqueTables: number;
|
|
86
|
+
piiTablesAccessed: number;
|
|
87
|
+
};
|
|
88
|
+
filters: ComplianceReportFilters;
|
|
89
|
+
generatedAt: string;
|
|
90
|
+
}
|
|
91
|
+
/** A single row in the user activity report. */
|
|
92
|
+
export interface UserActivityRow {
|
|
93
|
+
userId: string;
|
|
94
|
+
userEmail: string | null;
|
|
95
|
+
role: string | null;
|
|
96
|
+
totalQueries: number;
|
|
97
|
+
tablesAccessed: string[];
|
|
98
|
+
lastActiveAt: string | null;
|
|
99
|
+
lastLoginAt: string | null;
|
|
100
|
+
}
|
|
101
|
+
export interface UserActivityReport {
|
|
102
|
+
rows: UserActivityRow[];
|
|
103
|
+
summary: {
|
|
104
|
+
totalUsers: number;
|
|
105
|
+
activeUsers: number;
|
|
106
|
+
totalQueries: number;
|
|
107
|
+
};
|
|
108
|
+
filters: ComplianceReportFilters;
|
|
109
|
+
generatedAt: string;
|
|
110
|
+
}
|
package/dist/connection.d.ts
CHANGED
|
@@ -36,6 +36,36 @@ export interface ConnectionInfo {
|
|
|
36
36
|
description?: string | null;
|
|
37
37
|
health?: ConnectionHealth;
|
|
38
38
|
}
|
|
39
|
+
/** Real-time pool size counters (only available for core adapters with pool access). */
|
|
40
|
+
export interface PoolStats {
|
|
41
|
+
totalSize: number;
|
|
42
|
+
activeCount: number;
|
|
43
|
+
idleCount: number;
|
|
44
|
+
waitingCount: number;
|
|
45
|
+
}
|
|
46
|
+
/** Wire format for per-connection pool metrics. */
|
|
47
|
+
export interface PoolMetrics {
|
|
48
|
+
connectionId: string;
|
|
49
|
+
dbType: string;
|
|
50
|
+
pool: PoolStats | null;
|
|
51
|
+
totalQueries: number;
|
|
52
|
+
totalErrors: number;
|
|
53
|
+
avgQueryTimeMs: number;
|
|
54
|
+
consecutiveFailures: number;
|
|
55
|
+
lastDrainAt: string | null;
|
|
56
|
+
}
|
|
57
|
+
/** Wire format for per-org pool metrics (extends PoolMetrics with org scope). */
|
|
58
|
+
export interface OrgPoolMetrics extends PoolMetrics {
|
|
59
|
+
orgId: string;
|
|
60
|
+
}
|
|
61
|
+
/** Wire format for org pool configuration (returned by admin API). */
|
|
62
|
+
export interface OrgPoolConfig {
|
|
63
|
+
maxConnections: number;
|
|
64
|
+
idleTimeoutMs: number;
|
|
65
|
+
maxOrgs: number;
|
|
66
|
+
warmupProbes: number;
|
|
67
|
+
drainThreshold: number;
|
|
68
|
+
}
|
|
39
69
|
/** Wire format for a single connection detail response. */
|
|
40
70
|
export interface ConnectionDetail {
|
|
41
71
|
id: string;
|
package/dist/conversation.d.ts
CHANGED
|
@@ -10,6 +10,34 @@ export interface Conversation {
|
|
|
10
10
|
starred: boolean;
|
|
11
11
|
createdAt: string;
|
|
12
12
|
updatedAt: string;
|
|
13
|
+
notebookState?: NotebookStateWire | null;
|
|
14
|
+
}
|
|
15
|
+
/** Server-persisted notebook state stored as JSONB on the conversation. */
|
|
16
|
+
export interface NotebookStateWire {
|
|
17
|
+
version: number;
|
|
18
|
+
/** Custom display order of cell IDs (empty = natural message order). */
|
|
19
|
+
cellOrder?: string[];
|
|
20
|
+
/** Per-cell persisted properties (only collapsed; editing/status are transient). */
|
|
21
|
+
cellProps?: Record<string, {
|
|
22
|
+
collapsed?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/** Fork branches originating from this conversation (stored on root only). */
|
|
25
|
+
branches?: ForkBranchWire[];
|
|
26
|
+
/** If this conversation is a fork, the root conversation ID. */
|
|
27
|
+
forkRootId?: string;
|
|
28
|
+
/** If this conversation is a fork, the cell ID at the fork point. */
|
|
29
|
+
forkPointCellId?: string;
|
|
30
|
+
/** Text cell content keyed by cell ID (text cells are not message-backed). */
|
|
31
|
+
textCells?: Record<string, {
|
|
32
|
+
content: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/** A fork branch — metadata for a forked conversation. */
|
|
36
|
+
export interface ForkBranchWire {
|
|
37
|
+
conversationId: string;
|
|
38
|
+
forkPointCellId: string;
|
|
39
|
+
label: string;
|
|
40
|
+
createdAt: string;
|
|
13
41
|
}
|
|
14
42
|
export interface Message {
|
|
15
43
|
id: string;
|
package/dist/domain.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom domain types for enterprise workspace branding.
|
|
3
|
+
*
|
|
4
|
+
* Workspaces can register custom domains (e.g. data.customer.com)
|
|
5
|
+
* that are provisioned via Railway's custom domain API. Railway
|
|
6
|
+
* handles TLS certificates (Let's Encrypt) automatically. Atlas
|
|
7
|
+
* stores the mapping from domain to workspace for host-based routing.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DOMAIN_STATUSES: readonly ["pending", "verified", "failed"];
|
|
10
|
+
export type DomainStatus = (typeof DOMAIN_STATUSES)[number];
|
|
11
|
+
export declare const CERTIFICATE_STATUSES: readonly ["PENDING", "ISSUED", "FAILED"];
|
|
12
|
+
export type CertificateStatus = (typeof CERTIFICATE_STATUSES)[number];
|
|
13
|
+
export interface CustomDomain {
|
|
14
|
+
id: string;
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
status: DomainStatus;
|
|
18
|
+
/** Railway domain ID — used for Railway API calls. */
|
|
19
|
+
railwayDomainId: string | null;
|
|
20
|
+
/** CNAME target from Railway (e.g. abc123.up.railway.app). */
|
|
21
|
+
cnameTarget: string | null;
|
|
22
|
+
/** Current certificate status from Railway. */
|
|
23
|
+
certificateStatus: CertificateStatus | null;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
verifiedAt: string | null;
|
|
26
|
+
}
|