@useatlas/types
Advanced tools
| /** | ||
| * CRM outbox wire types (#2735, slice 9 of 1.6.0). | ||
| * | ||
| * Shape of `crm_outbox` rows as surfaced to the platform-admin | ||
| * `/platform/crm-outbox` UI. The table itself lives in core | ||
| * (`packages/api/src/lib/lead-outbox/`); these types describe the | ||
| * inspection surface, not the table. | ||
| * | ||
| * `OUTBOX_STATUSES` mirrors the `crm_outbox_status_chk` CHECK constraint | ||
| * and the `OutboxStatus` union in `lib/lead-outbox/outbox.ts` — | ||
| * `@useatlas/types` keeps the wire-format copy so `@useatlas/schemas` | ||
| * can pin its `z.enum(...)` against the same tuple the API uses. | ||
| */ | ||
| export declare const OUTBOX_STATUSES: readonly ["pending", "in_flight", "done", "dead"]; | ||
| export type OutboxStatus = (typeof OUTBOX_STATUSES)[number]; | ||
| /** | ||
| * List row — what the table view renders. `lastError` is truncated by | ||
| * the API (full text is returned only by the detail endpoint) so the | ||
| * list payload stays bounded even when a row carries a multi-KB stack | ||
| * trace from a runaway upstream. | ||
| */ | ||
| export interface CrmOutboxRow { | ||
| id: string; | ||
| createdAt: string; | ||
| eventType: string; | ||
| status: OutboxStatus; | ||
| attempts: number; | ||
| /** | ||
| * Truncated by the API in list responses; the detail endpoint | ||
| * returns the full string under `fullLastError`. Null when the row | ||
| * hasn't failed. | ||
| */ | ||
| lastError: string | null; | ||
| twentyPersonId: string | null; | ||
| twentyNoteId: string | null; | ||
| /** Stamped on terminal-state transitions (done / dead). Null otherwise. */ | ||
| processedAt: string | null; | ||
| /** Upstream-supplied retry timestamp (Retry-After header). Null otherwise. */ | ||
| retryAfter: string | null; | ||
| /** When the flusher last claimed this row. Null after a terminal write. */ | ||
| claimedAt: string | null; | ||
| } | ||
| /** | ||
| * Detail row — what the row-detail view renders. Adds the full | ||
| * untruncated payload + last_error so an operator can read the original | ||
| * lead body and the upstream error verbatim. | ||
| */ | ||
| export interface CrmOutboxRowDetail extends CrmOutboxRow { | ||
| /** Full, untruncated `last_error` text. */ | ||
| fullLastError: string | null; | ||
| /** Untyped opaque event body — see EnqueueInput in lib/lead-outbox. */ | ||
| payload: unknown; | ||
| } |
| /** | ||
| * Deploy-region identity — the fixed set of first-party Atlas deployment | ||
| * instances. | ||
| * | ||
| * Each Atlas API instance is stamped with exactly one of these via the | ||
| * `ATLAS_API_REGION` env var (read at runtime by `getApiRegion()` in | ||
| * `@atlas/api/lib/residency/misrouting`, falling back to | ||
| * `residency.defaultRegion` in atlas.config.ts). The three production SaaS | ||
| * instances are `us` / `eu` / `apac`; `staging` is the single pre-prod soak | ||
| * instance under `*.staging.useatlas.dev`. | ||
| * | ||
| * This is a CLOSED union of Atlas-operated deployments — distinct from two | ||
| * neighbouring concepts: | ||
| * | ||
| * - `Region` (./residency) is an OPEN `string`: an operator-defined data- | ||
| * residency routing key for a *workspace*, not constrained to this set. A | ||
| * self-hosted operator can name regions anything. Its companion | ||
| * `WELL_KNOWN_REGIONS` suggests *finer-grained* admin-UI keys | ||
| * (`us-east`, `eu-west`, …) — independent of, and not to be confused | ||
| * with, the coarse first-party keys here: a `DeployRegion` of `"us"` is | ||
| * the `deploy/api/atlas.config.ts` residency key, not `"us-east"`. | ||
| * - `DeployEnv` (`@atlas/api/lib/env-profile`, `"production" | "staging" | | ||
| * "development"`) is the deployment *shape* that drives non-secret runtime | ||
| * toggles (email verification, cookie prefix). The three prod regions all | ||
| * share the `production` env profile; `staging` overlaps only by name — | ||
| * it's a different axis (one specific instance vs. an env class). | ||
| * | ||
| * Type-only: the runtime read remains a raw `string` via `getApiRegion()`; | ||
| * this union exists so deploy-region-aware code (e.g. the staging outbound | ||
| * clamp) can name the cases exhaustively without re-spelling the literals. | ||
| */ | ||
| export type DeployRegion = "us" | "eu" | "apac" | "staging"; | ||
| /** | ||
| * Exact runtime narrowing guard for {@link DeployRegion}. | ||
| * | ||
| * The staging email-clamp wiring (`packages/api/src/lib/email/delivery.ts`, | ||
| * #2913/#2985) reads the deploy region from `getApiRegion(): string | null` | ||
| * and MUST narrow it through this guard rather than an unchecked | ||
| * `as DeployRegion` cast. The guard is deliberately EXACT — no trim, no | ||
| * lowercase, no prefix match: only the four literal first-party regions | ||
| * return `true`. | ||
| * | ||
| * Exactness is the safety property. A "close" value — `null`, `"Staging"`, | ||
| * `"staging "` with whitespace, a granular `"us-west"`, a typo — returns | ||
| * `false`, and the wiring site treats a `false` result as "not a known | ||
| * region" and fails CLOSED (clamps outbound mail / hard-fails boot) instead | ||
| * of mistaking a mislabelled staging box for a prod region and emailing a | ||
| * real recipient. Loosening this guard would silently re-open that leak. | ||
| */ | ||
| export declare function isDeployRegion(value: string | null): value is DeployRegion; |
@@ -37,3 +37,3 @@ /** | ||
| */ | ||
| export declare const APPROVAL_RULE_SURFACES: readonly ["any", "chat", "mcp", "scheduler", "slack", "teams", "webhook"]; | ||
| export declare const APPROVAL_RULE_SURFACES: readonly ["any", "chat", "mcp", "scheduler", "slack", "teams", "telegram", "discord", "whatsapp", "gchat", "webhook"]; | ||
| export type ApprovalRuleSurface = (typeof APPROVAL_RULE_SURFACES)[number]; | ||
@@ -40,0 +40,0 @@ export type ApprovalRequestSurface = Exclude<ApprovalRuleSurface, "any">; |
+8
-0
@@ -91,2 +91,10 @@ /** | ||
| role?: string; | ||
| /** | ||
| * Org-merged effective role — `max(user.role, active-org member.role)`. | ||
| * Stamped by the server's `customSession` plugin so an org admin | ||
| * whose `user.role` defaulted to "user" still sees admin chrome. | ||
| * Optional for back-compat with older sessions; consumers | ||
| * (`useUserRole`) fall back to `role`. | ||
| */ | ||
| effectiveRole?: string | null; | ||
| /** Display name — present at runtime, not always populated. */ | ||
@@ -93,0 +101,0 @@ name?: string; |
@@ -21,2 +21,8 @@ /** | ||
| errorMessage: string | null; | ||
| /** | ||
| * Depth of the last verification, or null if never verified: | ||
| * - "full-restore" — restored into a disposable scratch DB and counted tables (proven restorable). | ||
| * - "header-only" — degraded fallback (valid pg_dump header only; NOT proven restorable). | ||
| */ | ||
| verifyLevel: "full-restore" | "header-only" | null; | ||
| } | ||
@@ -23,0 +29,0 @@ export interface BackupConfig { |
+10
-1
@@ -32,4 +32,13 @@ /** | ||
| * Google Chat, Telegram, WhatsApp. | ||
| * - `oauth-datasource` — OAuth credential acquisition (the same | ||
| * operator-owned App dance as `oauth`) but DATASOURCE persistence: | ||
| * multi-instance (`install_id` composite PK), credential written to | ||
| * `workspace_plugins.config` via selective-field encryption, and | ||
| * probe-on-install caches the `openapi_snapshot`. Distinct from `oauth` | ||
| * (single-instance chat/action, credential in `chat_cache` / per-plugin | ||
| * store). v0.0.2 slice 6c (#3030): GitHub-as-datasource reuses GitHub's | ||
| * existing App registration; the "refresh" path is App-JWT installation- | ||
| * token minting, not refresh-token rotation. Pillar: datasource. | ||
| */ | ||
| export declare const CATALOG_INSTALL_MODELS: readonly ["oauth", "form", "static-bot"]; | ||
| export declare const CATALOG_INSTALL_MODELS: readonly ["oauth", "form", "static-bot", "oauth-datasource"]; | ||
| export type CatalogInstallModel = (typeof CATALOG_INSTALL_MODELS)[number]; | ||
@@ -36,0 +45,0 @@ /** |
+1
-1
| // src/catalog.ts | ||
| var CATALOG_INSTALL_MODELS = ["oauth", "form", "static-bot"]; | ||
| var CATALOG_INSTALL_MODELS = ["oauth", "form", "static-bot", "oauth-datasource"]; | ||
| var CATALOG_ENTRY_TYPES = ["chat", "integration"]; | ||
@@ -4,0 +4,0 @@ var PILLARS = ["datasource", "chat", "action"]; |
@@ -52,2 +52,34 @@ /** Conversation persistence types — wire format for conversations and messages. */ | ||
| routingMode?: ConversationRoutingMode | null; | ||
| /** | ||
| * Per-conversation REST datasource exclude-set (#3066). The excluded | ||
| * `install_id`s — the id the scope picker surfaces — that the agent must | ||
| * NOT query for this conversation. Empty / absent = every in-scope REST | ||
| * datasource stays queryable (the column default `'{}'`), so a | ||
| * newly-installed datasource is reachable with no action. | ||
| * | ||
| * Authoritative per-conversation; the web sticky preference only seeds | ||
| * NEW chats. SQL routing (`routingMode`) is independent and unaffected. | ||
| * | ||
| * Optional (not nullable) so pre-#3066 test fixtures and external SDK | ||
| * consumers can omit it; the runtime treats missing the same as `[]`. The | ||
| * server NEVER serializes null — the column is `NOT NULL DEFAULT '{}'` and | ||
| * `rowToConversation` always yields a `string[]` (or `[]`), so unlike the | ||
| * genuinely-nullable `routingMode` this field has no null state. | ||
| */ | ||
| restExcludedDatasourceIds?: string[]; | ||
| /** | ||
| * Per-conversation REST-only focus (#3067). When set, the single | ||
| * `install_id` — the id the scope picker surfaces — the conversation | ||
| * targets exclusively; the agent runs REST-only with `executeSQL` | ||
| * SUSPENDED. `null` / absent = not focused: SQL routing (`routingMode`) | ||
| * and the exclude-set (`restExcludedDatasourceIds`) apply as normal. | ||
| * Those two fields stay populated-but-inert while focused, so clearing | ||
| * focus (back to `null`) returns to the prior default-state scope. | ||
| * | ||
| * Genuinely nullable (unlike the exclude-set): the column is plain | ||
| * nullable `text` with no default, and `null` is the meaningful | ||
| * "not focused" state. Optional so pre-#3067 fixtures / SDK consumers | ||
| * can omit it; the runtime treats missing the same as `null`. | ||
| */ | ||
| restFocusDatasourceId?: string | null; | ||
| starred: boolean; | ||
@@ -54,0 +86,0 @@ createdAt: string; |
+1
-1
@@ -64,3 +64,3 @@ import type { AuthMode } from "./auth"; | ||
| */ | ||
| export declare const CHAT_CONTEXT_WARNING_CODES: readonly ["semantic_layer_unavailable", "learned_patterns_unavailable", "plan_limit_warning", "bound_dashboard_unavailable"]; | ||
| export declare const CHAT_CONTEXT_WARNING_CODES: readonly ["semantic_layer_unavailable", "learned_patterns_unavailable", "plan_limit_warning", "bound_dashboard_unavailable", "rest_focus_unavailable"]; | ||
| export type ChatContextWarningCode = (typeof CHAT_CONTEXT_WARNING_CODES)[number]; | ||
@@ -67,0 +67,0 @@ /** Type guard — checks whether a string is a known `ChatContextWarningCode`. */ |
+2
-1
@@ -75,3 +75,4 @@ // src/errors.ts | ||
| "plan_limit_warning", | ||
| "bound_dashboard_unavailable" | ||
| "bound_dashboard_unavailable", | ||
| "rest_focus_unavailable" | ||
| ]; | ||
@@ -78,0 +79,0 @@ function isChatContextWarningCode(value) { |
+2
-0
@@ -26,3 +26,5 @@ export * from "./auth"; | ||
| export * from "./backups"; | ||
| export * from "./crm-outbox"; | ||
| export * from "./residency"; | ||
| export * from "./deploy"; | ||
| export * from "./domain"; | ||
@@ -29,0 +31,0 @@ export * from "./migration"; |
+21
-2
@@ -195,3 +195,4 @@ // src/auth.ts | ||
| "plan_limit_warning", | ||
| "bound_dashboard_unavailable" | ||
| "bound_dashboard_unavailable", | ||
| "rest_focus_unavailable" | ||
| ]; | ||
@@ -533,3 +534,3 @@ function isChatContextWarningCode(value) { | ||
| // src/catalog.ts | ||
| var CATALOG_INSTALL_MODELS = ["oauth", "form", "static-bot"]; | ||
| var CATALOG_INSTALL_MODELS = ["oauth", "form", "static-bot", "oauth-datasource"]; | ||
| var CATALOG_ENTRY_TYPES = ["chat", "integration"]; | ||
@@ -661,2 +662,6 @@ var PILLARS = ["datasource", "chat", "action"]; | ||
| "teams", | ||
| "telegram", | ||
| "discord", | ||
| "whatsapp", | ||
| "gchat", | ||
| "webhook" | ||
@@ -741,2 +746,9 @@ ]; | ||
| var BACKUP_STATUSES = ["in_progress", "completed", "failed", "verified"]; | ||
| // src/crm-outbox.ts | ||
| var OUTBOX_STATUSES = [ | ||
| "pending", | ||
| "in_flight", | ||
| "done", | ||
| "dead" | ||
| ]; | ||
| // src/residency.ts | ||
@@ -752,2 +764,7 @@ var WELL_KNOWN_REGIONS = [ | ||
| var MIGRATION_STATUSES = ["pending", "in_progress", "completed", "failed", "cancelled"]; | ||
| // src/deploy.ts | ||
| var DEPLOY_REGIONS = ["us", "eu", "apac", "staging"]; | ||
| function isDeployRegion(value) { | ||
| return value !== null && DEPLOY_REGIONS.includes(value); | ||
| } | ||
| // src/domain.ts | ||
@@ -789,2 +806,3 @@ var DOMAIN_STATUSES = ["pending", "verified", "failed"]; | ||
| isDeprecatedConfig, | ||
| isDeployRegion, | ||
| isDefaultLanding, | ||
@@ -822,2 +840,3 @@ isChatErrorCode, | ||
| PARTITION_STRATEGIES, | ||
| OUTBOX_STATUSES, | ||
| ORG_ROLES, | ||
@@ -824,0 +843,0 @@ ONBOARDING_MILESTONES, |
+22
-0
@@ -119,1 +119,23 @@ /** | ||
| } | ||
| /** | ||
| * 403 body returned by the integrations install endpoints when the | ||
| * workspace's plan tier ranks below the catalog row's `min_plan`. | ||
| * Same shape on the OAuth start (`/install`), OAuth callback | ||
| * (`/callback`), and form install (`/install-form`) routes; consumed | ||
| * by the admin UI's upgrade toast. | ||
| * | ||
| * Adding new fields here is additive — both plan fields are required | ||
| * so older SDK clients that destructure the body still type-check. | ||
| */ | ||
| export interface PlanUpgradeRequiredBody { | ||
| /** Discriminator — `"plan_upgrade_required"` only. */ | ||
| error: "plan_upgrade_required"; | ||
| /** Human-readable message including both plan names for fallback UIs. */ | ||
| message: string; | ||
| /** The plan tier the workspace would need to upgrade to. */ | ||
| required_plan: PlanTier; | ||
| /** The workspace's current tier (legacy / unknown values map to `"free"`). */ | ||
| current_plan: PlanTier; | ||
| /** Echoed from the request for log correlation. */ | ||
| requestId: string; | ||
| } |
+1
-1
| { | ||
| "name": "@useatlas/types", | ||
| "version": "0.1.7", | ||
| "version": "0.1.11", | ||
| "description": "Shared types for the Atlas text-to-SQL agent", | ||
@@ -5,0 +5,0 @@ "type": "module", |
223112
4.6%66
3.13%5578
3.76%