@ekanos/sdk 0.18.0 → 0.20.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.
- package/api-report.md +112 -2
- package/dist/components/base-activation-dialog.js +1 -1
- package/dist/components/base-activation-dialog.js.map +1 -1
- package/dist/components/current-return-path.d.ts +16 -1
- package/dist/components/current-return-path.js +18 -1
- package/dist/components/current-return-path.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/oauth-activation-form.js +2 -2
- package/dist/components/oauth-activation-form.js.map +1 -1
- package/dist/components/widgets/ai-prompt-chip.js +1 -1
- package/dist/components/widgets/ai-prompt-chip.js.map +1 -1
- package/dist/components/widgets/widget-ask-bar.js +2 -2
- package/dist/components/widgets/widget-ask-bar.js.map +1 -1
- package/dist/components/widgets/widget-state-components.js +1 -1
- package/dist/components/widgets/widget-state-components.js.map +1 -1
- package/dist/components/widgets/widget.js +19 -4
- package/dist/components/widgets/widget.js.map +1 -1
- package/dist/contract/derive-contract.d.ts +14 -0
- package/dist/contract/derive-contract.js +237 -0
- package/dist/contract/derive-contract.js.map +1 -0
- package/dist/contract/index.d.ts +8 -0
- package/dist/contract/index.js +9 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/synthesize-example.d.ts +6 -0
- package/dist/contract/synthesize-example.js +61 -0
- package/dist/contract/synthesize-example.js.map +1 -0
- package/dist/contract/to-json-schema.d.ts +19 -0
- package/dist/contract/to-json-schema.js +300 -0
- package/dist/contract/to-json-schema.js.map +1 -0
- package/dist/contract/types.d.ts +39 -0
- package/dist/contract/types.js +12 -0
- package/dist/contract/types.js.map +1 -0
- package/dist/experience/client.d.ts +55 -0
- package/dist/experience/client.js +125 -0
- package/dist/experience/client.js.map +1 -0
- package/dist/experience/define-experience.d.ts +172 -0
- package/dist/experience/define-experience.js +147 -0
- package/dist/experience/define-experience.js.map +1 -0
- package/dist/experience/index.d.ts +13 -0
- package/dist/experience/index.js +13 -0
- package/dist/experience/index.js.map +1 -0
- package/dist/experience/runtime.d.ts +54 -0
- package/dist/experience/runtime.js +2 -0
- package/dist/experience/runtime.js.map +1 -0
- package/dist/experience/server.d.ts +11 -0
- package/dist/experience/server.js +47 -0
- package/dist/experience/server.js.map +1 -0
- package/dist/experience/types.d.ts +76 -0
- package/dist/experience/types.js +2 -0
- package/dist/experience/types.js.map +1 -0
- package/dist/experience/workflow-template.d.ts +103 -0
- package/dist/experience/workflow-template.js +132 -0
- package/dist/experience/workflow-template.js.map +1 -0
- package/dist/hooks/use-oauth-connection-status.d.ts +7 -217
- package/dist/hooks/use-oauth-connection-status.js +17 -1
- package/dist/hooks/use-oauth-connection-status.js.map +1 -1
- package/dist/types/integration.d.ts +3 -3
- package/dist/types/integration.js.map +1 -1
- package/eslint.design-preset.mjs +3 -2
- package/eslint.design-rules.mjs +285 -3
- package/eslint.experience-preset.mjs +85 -0
- package/package.json +44 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /** Render inline instead of in a dialog */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'experience' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/layout`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'experience' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'experience'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n isCollapsible?: boolean;\n // For collapsed state persistence\n collapsed?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /** Render inline instead of in a dialog */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'feature' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/layout`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'feature' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'feature'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n isCollapsible?: boolean;\n // For collapsed state persistence\n collapsed?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
|
package/eslint.design-preset.mjs
CHANGED
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
* inputs, selects, textareas and labels, each of which carries accessibility
|
|
23
23
|
* wiring a bare element does not.
|
|
24
24
|
*
|
|
25
|
-
* The other
|
|
25
|
+
* The other thirteen are the host's own `design/*` rules — palette-adjacent
|
|
26
26
|
* white/black utilities, Badge tone variants, overlay widths, rounded row
|
|
27
27
|
* hovers, faded muted text, viewport breakpoints in widgets, tinted chips,
|
|
28
|
-
* toolbar tabs, raw type steps, raw buttons, hand-drawn cards
|
|
28
|
+
* toolbar tabs, raw type steps, raw buttons, hand-drawn cards, motion off the
|
|
29
|
+
* tokens, hover that moves — imported from `./eslint.design-rules.mjs`, the single
|
|
29
30
|
* implementation the host repo's oxlint plugin also loads (through the
|
|
30
31
|
* two-line re-export the host's lint config keeps). There is
|
|
31
32
|
* exactly one copy of each rule, so a partner is held to what the host holds
|
package/eslint.design-rules.mjs
CHANGED
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
|
|
69
69
|
const FADED_MUTED = /(?:^|[\s:'"`])(?:[\w-]+:)*text-muted-foreground\/\d+/;
|
|
70
70
|
|
|
71
|
+
/** `text-primary`, with any variant prefix or opacity step, but not
|
|
72
|
+
* `text-primary-strong` or `text-primary-foreground`. */
|
|
73
|
+
const BASE_PRIMARY_TEXT =
|
|
74
|
+
/(?:^|[\s'"`])(?:\S*:)?text-primary(?:\/\d+)?(?=$|[\s'"`])/;
|
|
75
|
+
|
|
71
76
|
/** `bg-white`, `text-black/50`, `dark:border-white`… — @shadcn/lint's
|
|
72
77
|
* no-raw-colors covers the palette scales but not these two. */
|
|
73
78
|
const ABSOLUTE_COLOR =
|
|
@@ -317,8 +322,9 @@ const TOOLBARS = new Set(['PageToolbar', 'PageToolbarActions']);
|
|
|
317
322
|
|
|
318
323
|
/**
|
|
319
324
|
* Whether a JSX element is the value of a `render` prop —
|
|
320
|
-
* `<Item render={<button type="button" />}>`.
|
|
321
|
-
*
|
|
325
|
+
* `<Item render={<button type="button" />}>`. Not reported here, so the call
|
|
326
|
+
* sites that still do it lint clean, but it is not the sanctioned form: new
|
|
327
|
+
* code uses the kit's `Button`, `ItemButton` or `CardButton`.
|
|
322
328
|
*
|
|
323
329
|
* @param {JsxElement} node the opening element
|
|
324
330
|
*/
|
|
@@ -352,9 +358,204 @@ function isHandDrawnCard(value) {
|
|
|
352
358
|
);
|
|
353
359
|
}
|
|
354
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Motion written outside the tokens (plan 253): a raw `duration-<ms>` step
|
|
363
|
+
* or `transition-all`. Durations come from the motion tokens
|
|
364
|
+
* (`duration-(--duration-enter)`, `-exit`, `-colour`, `-press`, `-release`,
|
|
365
|
+
* `-spring`, `-sheet`), so one change re-times the product and the specimen's
|
|
366
|
+
* slow-motion switch reaches every one; `transition-all` animates whatever
|
|
367
|
+
* property changes next, layout included. Prefix variants ride along, and
|
|
368
|
+
* `duration-0` (no motion at all) is allowed.
|
|
369
|
+
*/
|
|
370
|
+
const RAW_MOTION =
|
|
371
|
+
/(?:^|[\s:])(?:transition-all|duration-(?:[1-9]\d*|\[[\d.]*[1-9][\d.]*m?s\]))(?=$|\s)/;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* A hover that moves (plan 251 D42, plan 253): hover changes colour only, so
|
|
375
|
+
* a scale or a translate under `hover:` / `group-hover:` / `peer-hover:` is
|
|
376
|
+
* motion the pointer triggers dozens of times an hour.
|
|
377
|
+
*/
|
|
378
|
+
const HOVER_MOTION =
|
|
379
|
+
/(?:^|\s)(?:[\w\-[\]/]+:)*(?:group-|peer-)?hover(?:\/[\w-]+)?:(?:[\w\-[\]]+:)*-?(?:scale|translate-[xy])-/;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* A focus ring faded with an opacity step (plan 254): `focus-visible:ring-ring/50`
|
|
383
|
+
* and the like. The ring token is solved to 3:1 on every surface at full
|
|
384
|
+
* strength; an opacity step drops it below that, so the keyboard user loses
|
|
385
|
+
* the only mark of where they are. Any variant chain naming `focus` counts.
|
|
386
|
+
*/
|
|
387
|
+
const FADED_FOCUS_RING =
|
|
388
|
+
/(?:^|[\s'"`])(?:[\w\-[\]&>*=]+:)*[\w\-[\]]*focus[\w\-[\]/]*:(?:[\w\-[\]]+:)*(?:ring|outline)-(?!offset-)[a-z][\w-]*\/\d+(?=$|[\s'"`])/;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* A raw Tailwind shadow step (plan 254). Elevation comes from the shadow
|
|
392
|
+
* vocabulary — `shadow-ring`, `-control`, `-popover`, `-modal`, `-sticky`,
|
|
393
|
+
* `-rail` — whose tiers are drawn so a layer on top reads as on top in both
|
|
394
|
+
* modes; `shadow-md` and its siblings are invisible on charcoal and pile on
|
|
395
|
+
* in light. `shadow-none` is allowed.
|
|
396
|
+
*/
|
|
397
|
+
const RAW_SHADOW =
|
|
398
|
+
/(?:^|[\s'"`])(?:[\w\-[\]&>*=/]+:)*!?shadow-(?:2xs|xs|sm|md|lg|xl|2xl|inner|\[[^\s'"`]+\])(?=$|[\s'"`])/;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* The words a steady, healthy state is labelled with. "Healthy" is the
|
|
402
|
+
* `clear` tone, ink and a check (the Quiet All-Clear Rule);
|
|
403
|
+
* `success` is green and stays for an action that just finished ("Saved",
|
|
404
|
+
* "Sent", "Paid"), which none of these words describe. `on` and `live` only
|
|
405
|
+
* count as the label's first word, so "Saved on Friday" is not a health label.
|
|
406
|
+
*/
|
|
407
|
+
const HEALTH_WORDS = new Set([
|
|
408
|
+
'active',
|
|
409
|
+
'connected',
|
|
410
|
+
'current',
|
|
411
|
+
'enabled',
|
|
412
|
+
'granted',
|
|
413
|
+
'healthy',
|
|
414
|
+
'online',
|
|
415
|
+
'operational',
|
|
416
|
+
'passing',
|
|
417
|
+
'ready',
|
|
418
|
+
'valid',
|
|
419
|
+
'verified',
|
|
420
|
+
]);
|
|
421
|
+
const HEALTH_LEADS = new Set([...HEALTH_WORDS, 'live', 'on']);
|
|
422
|
+
|
|
423
|
+
/** @param {string} label */
|
|
424
|
+
function isHealthLabel(label) {
|
|
425
|
+
const words = label.toLowerCase().match(/[a-z]+/g) ?? [];
|
|
426
|
+
const [lead] = words[0] === 'all' ? words.slice(1) : words;
|
|
427
|
+
|
|
428
|
+
return (
|
|
429
|
+
(lead !== undefined && HEALTH_LEADS.has(lead)) ||
|
|
430
|
+
words.some((word) => HEALTH_WORDS.has(word))
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** The keys a status map names a pill's words under, beside its `tone`. */
|
|
435
|
+
const STATUS_LABEL_KEYS = new Set([
|
|
436
|
+
'label',
|
|
437
|
+
'labelDefault',
|
|
438
|
+
'fallback',
|
|
439
|
+
'headline',
|
|
440
|
+
]);
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Every key a status map's entry may carry. An object with any other key
|
|
444
|
+
* (`value`, `total`) is a different component's row, such as a meter, whose
|
|
445
|
+
* tone is not a pill's.
|
|
446
|
+
*/
|
|
447
|
+
const STATUS_ENTRY_KEYS = new Set([
|
|
448
|
+
...STATUS_LABEL_KEYS,
|
|
449
|
+
'tone',
|
|
450
|
+
'icon',
|
|
451
|
+
'className',
|
|
452
|
+
'labelKey',
|
|
453
|
+
'i18nKey',
|
|
454
|
+
'description',
|
|
455
|
+
'detail',
|
|
456
|
+
]);
|
|
457
|
+
|
|
458
|
+
const SUCCESS_HEALTH_MESSAGE =
|
|
459
|
+
'A healthy state is tone="clear", not "success": ink and a check, so green never competes with what needs the owner. Keep success for an action that just finished ("Saved", "Sent", "Paid") (the Quiet All-Clear Rule).';
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* The text a JSX element's children spell, or null when any child is not a
|
|
463
|
+
* literal (a translated label, a variable): the rule only judges words it
|
|
464
|
+
* can read.
|
|
465
|
+
*
|
|
466
|
+
* @param {Array<{ type?: string, value?: unknown, expression?: Expression }>} children
|
|
467
|
+
*/
|
|
468
|
+
function literalChildText(children) {
|
|
469
|
+
let text = '';
|
|
470
|
+
|
|
471
|
+
for (const child of children) {
|
|
472
|
+
if (child.type === 'JSXText' && typeof child.value === 'string') {
|
|
473
|
+
text += child.value;
|
|
474
|
+
} else if (
|
|
475
|
+
child.type === 'JSXExpressionContainer' &&
|
|
476
|
+
child.expression?.type === 'Literal' &&
|
|
477
|
+
typeof child.expression.value === 'string'
|
|
478
|
+
) {
|
|
479
|
+
text += child.expression.value;
|
|
480
|
+
} else if (child.type === 'JSXElement') {
|
|
481
|
+
continue;
|
|
482
|
+
} else {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return text.trim() || null;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @param {{ type?: string, name?: string, value?: unknown }} key
|
|
492
|
+
* @returns {string | null}
|
|
493
|
+
*/
|
|
494
|
+
function propertyName(key) {
|
|
495
|
+
if (key.type === 'Identifier' && typeof key.name === 'string') {
|
|
496
|
+
return key.name;
|
|
497
|
+
}
|
|
498
|
+
if (key.type === 'Literal' && typeof key.value === 'string') {
|
|
499
|
+
return key.value;
|
|
500
|
+
}
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
|
|
355
504
|
export default {
|
|
356
505
|
meta: { name: 'design' },
|
|
357
506
|
rules: {
|
|
507
|
+
'motion-tokens': {
|
|
508
|
+
meta: {
|
|
509
|
+
type: 'problem',
|
|
510
|
+
docs: {
|
|
511
|
+
description:
|
|
512
|
+
'Disallow a raw duration step and transition-all; motion comes from the motion tokens and a named property list.',
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
create: stringVisitors(
|
|
516
|
+
RAW_MOTION,
|
|
517
|
+
'Time motion with a token, not a raw step: duration-(--duration-enter) for an entrance, -exit for an exit, -colour for a colour change, -press / -release for a press, -spring, -sheet; or a press-* recipe for a pressable. Name the properties (transition-colors, transition-[opacity,translate]) instead of transition-all, which also animates layout (plan 253).',
|
|
518
|
+
),
|
|
519
|
+
},
|
|
520
|
+
'no-hover-motion': {
|
|
521
|
+
meta: {
|
|
522
|
+
type: 'problem',
|
|
523
|
+
docs: {
|
|
524
|
+
description:
|
|
525
|
+
'Disallow scale or translate on hover; hover changes colour only.',
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
create: stringVisitors(
|
|
529
|
+
HOVER_MOTION,
|
|
530
|
+
'Hover changes colour only: no scale and no translate under hover:, group-hover: or peer-hover:. An interactive card darkens its ring and steps its surface (cardSurfaceVariants({ interactive: true })); a control answers the press, not the hover, through a press-* recipe (plan 251 D42, plan 253).',
|
|
531
|
+
),
|
|
532
|
+
},
|
|
533
|
+
'no-faded-focus-ring': {
|
|
534
|
+
meta: {
|
|
535
|
+
type: 'problem',
|
|
536
|
+
docs: {
|
|
537
|
+
description:
|
|
538
|
+
'Disallow an opacity step on a focus ring or outline colour; the ring is drawn at full strength.',
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
create: stringVisitors(
|
|
542
|
+
FADED_FOCUS_RING,
|
|
543
|
+
'Draw the focus ring at full strength: focus-visible:ring-ring (or outline-ring), never ring-ring/50. The ring token is solved to 3:1 on every surface, and an opacity step drops it below that (the Inputs rule).',
|
|
544
|
+
),
|
|
545
|
+
},
|
|
546
|
+
'shadow-tokens': {
|
|
547
|
+
meta: {
|
|
548
|
+
type: 'problem',
|
|
549
|
+
docs: {
|
|
550
|
+
description:
|
|
551
|
+
'Disallow a raw shadow step; elevation comes from the shadow vocabulary.',
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
create: stringVisitors(
|
|
555
|
+
RAW_SHADOW,
|
|
556
|
+
'Use the shadow vocabulary, not a raw step: shadow-ring for a card or container, shadow-control for a field or button edge, shadow-popover for a menu, popover or tooltip, shadow-modal for a dialog or sheet, shadow-sticky / shadow-rail for one edge. A surface never lifts on hover: darken its ring instead (the Stacking rule).',
|
|
557
|
+
),
|
|
558
|
+
},
|
|
358
559
|
'no-tone-badge-variant': {
|
|
359
560
|
meta: {
|
|
360
561
|
type: 'problem',
|
|
@@ -396,6 +597,74 @@ export default {
|
|
|
396
597
|
};
|
|
397
598
|
},
|
|
398
599
|
},
|
|
600
|
+
'no-success-health-label': {
|
|
601
|
+
meta: {
|
|
602
|
+
type: 'problem',
|
|
603
|
+
docs: {
|
|
604
|
+
description:
|
|
605
|
+
'Disallow the success tone on a health label; a healthy state is StatusBadge tone="clear".',
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
/** @param {RuleContext} context */
|
|
609
|
+
create(context) {
|
|
610
|
+
return {
|
|
611
|
+
/**
|
|
612
|
+
* `<StatusBadge tone="success">Connected</StatusBadge>`.
|
|
613
|
+
*
|
|
614
|
+
* @param {JsxElement & { children?: Array<{ type?: string, value?: unknown, expression?: Expression }> }} node
|
|
615
|
+
*/
|
|
616
|
+
JSXElement(node) {
|
|
617
|
+
const opening = node.openingElement;
|
|
618
|
+
if (jsxName(opening?.name) !== 'StatusBadge') return;
|
|
619
|
+
|
|
620
|
+
const tone = (opening?.attributes ?? []).find(
|
|
621
|
+
(attribute) =>
|
|
622
|
+
attribute.type === 'JSXAttribute' &&
|
|
623
|
+
attribute.name?.name === 'tone',
|
|
624
|
+
);
|
|
625
|
+
if (!tone || literalValue(tone.value) !== 'success') return;
|
|
626
|
+
|
|
627
|
+
const label = literalChildText(node.children ?? []);
|
|
628
|
+
if (label && isHealthLabel(label)) {
|
|
629
|
+
context.report({ node: tone, message: SUCCESS_HEALTH_MESSAGE });
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
/**
|
|
633
|
+
* A status map's entry: `{ label: 'Healthy', tone: 'success' }`.
|
|
634
|
+
*
|
|
635
|
+
* @param {{ properties?: Array<{ type?: string, key?: { type?: string, name?: string, value?: unknown }, value?: Expression }> }} node
|
|
636
|
+
*/
|
|
637
|
+
ObjectExpression(node) {
|
|
638
|
+
let tone = null;
|
|
639
|
+
let label = null;
|
|
640
|
+
|
|
641
|
+
for (const property of node.properties ?? []) {
|
|
642
|
+
if (property.type !== 'Property' || !property.key) continue;
|
|
643
|
+
|
|
644
|
+
const name = propertyName(property.key);
|
|
645
|
+
if (!name || !STATUS_ENTRY_KEYS.has(name)) return;
|
|
646
|
+
|
|
647
|
+
const value = property.value;
|
|
648
|
+
const literal =
|
|
649
|
+
value?.type === 'TSAsExpression'
|
|
650
|
+
? value.expression?.value
|
|
651
|
+
: value?.type === 'Literal'
|
|
652
|
+
? value.value
|
|
653
|
+
: undefined;
|
|
654
|
+
|
|
655
|
+
if (name === 'tone' && literal === 'success') tone = property;
|
|
656
|
+
if (STATUS_LABEL_KEYS.has(name) && typeof literal === 'string') {
|
|
657
|
+
label = literal;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (tone && label && isHealthLabel(label)) {
|
|
662
|
+
context.report({ node: tone, message: SUCCESS_HEALTH_MESSAGE });
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
};
|
|
666
|
+
},
|
|
667
|
+
},
|
|
399
668
|
'no-faded-muted-text': {
|
|
400
669
|
meta: {
|
|
401
670
|
type: 'problem',
|
|
@@ -409,6 +678,19 @@ export default {
|
|
|
409
678
|
'Opacity on text-muted-foreground fails WCAG AA: even /90 measures 4.18:1 on a dark card. Use plain text-muted-foreground, a smaller size if it must recede, or text-border for a decorative separator (design-system opacity-on-muted rule).',
|
|
410
679
|
),
|
|
411
680
|
},
|
|
681
|
+
'no-base-primary-text': {
|
|
682
|
+
meta: {
|
|
683
|
+
type: 'problem',
|
|
684
|
+
docs: {
|
|
685
|
+
description:
|
|
686
|
+
'Disallow text-primary; the base primary is a 3:1 mark, and teal text or icons use text-primary-strong.',
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
create: stringVisitors(
|
|
690
|
+
BASE_PRIMARY_TEXT,
|
|
691
|
+
'text-primary is a 3:1 mark colour and reads faint on a light page. Teal text or an icon that marks the action, where you are or a live state takes text-primary-strong; anything else is ink (text-foreground) or text-muted-foreground. A link is buttonVariants({ variant: "link" }); an icon tile is <IconTile> (design-system Strong-Step and Earned Attention rules).',
|
|
692
|
+
),
|
|
693
|
+
},
|
|
412
694
|
'no-absolute-colors': {
|
|
413
695
|
meta: {
|
|
414
696
|
type: 'problem',
|
|
@@ -599,7 +881,7 @@ export default {
|
|
|
599
881
|
context.report({
|
|
600
882
|
node,
|
|
601
883
|
message:
|
|
602
|
-
'A raw <button> misses the focus ring, disabled and loading states, the size scale and the per-Source retint. Use Button (variant="ghost" or "link", size="xs" for a quiet text action),
|
|
884
|
+
'A raw <button> misses the focus ring, disabled and loading states, the size scale and the per-Source retint. Use Button (variant="ghost" or "link", size="xs" for a quiet text action), ItemButton for a row or CardButton for a card that acts on press (design-system buttons rule).',
|
|
603
885
|
});
|
|
604
886
|
},
|
|
605
887
|
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ekanos/sdk/eslint/experience — keeps integration code out of an experience.
|
|
3
|
+
*
|
|
4
|
+
* An experience reaches integrations ONLY through integrations (`useOperation`,
|
|
5
|
+
* `operation()`, `step.tool`). This preset is the fast, in-editor half of that
|
|
6
|
+
* rule; the authoritative half is `ekanos check` / `ekanos build`
|
|
7
|
+
* (`experience-boundary`), which also resolves real imports and scans the
|
|
8
|
+
* bundle, so a path this preset cannot see (a helper package that re-exports an
|
|
9
|
+
* integration, a computed `import()`) still fails the build.
|
|
10
|
+
*
|
|
11
|
+
* import experiencePreset from '@ekanos/sdk/eslint/experience';
|
|
12
|
+
* export default [...baseConfig, ...experiencePreset];
|
|
13
|
+
*
|
|
14
|
+
* Inline `eslint-disable` is ignored over `src/`, by design: the boundary has
|
|
15
|
+
* no per-line exceptions.
|
|
16
|
+
*/
|
|
17
|
+
const SOURCE_GLOB = ['src/**/*.ts', 'src/**/*.tsx'];
|
|
18
|
+
|
|
19
|
+
const INTEGRATION_REMEDIATION =
|
|
20
|
+
'An experience calls integrations only through integrations: ' +
|
|
21
|
+
"`useOperation('<integration>', '<tool|action>/<name>')` on the client, " +
|
|
22
|
+
'`operation(...)` on the server, `step.tool(...)` in a workflow. Add the ' +
|
|
23
|
+
'integration with `ekanos add <integration>@<line>`; its types come from the ' +
|
|
24
|
+
'pinned contract, not from integration source.';
|
|
25
|
+
|
|
26
|
+
export const restrictedImportPatterns = [
|
|
27
|
+
{
|
|
28
|
+
group: ['@companydotcom/integration-*', '@companydotcom/integration-*/**'],
|
|
29
|
+
message: `Importing an integration package into an experience is forbidden. ${INTEGRATION_REMEDIATION}`,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
group: [
|
|
33
|
+
'**/integrations/*/src/**',
|
|
34
|
+
'**/integrations/*',
|
|
35
|
+
'**/node_modules/@companydotcom/integration-*/**',
|
|
36
|
+
],
|
|
37
|
+
message: `A path into an integration project is forbidden. ${INTEGRATION_REMEDIATION}`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
group: ['@kit/*', '@kit/**'],
|
|
41
|
+
message:
|
|
42
|
+
'`@kit/*` is host-internal and does not exist for a partner. Build with `@ekanos/ui` and `@ekanos/sdk`.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
group: [
|
|
46
|
+
'@ekanos/harness',
|
|
47
|
+
'@ekanos/harness/**',
|
|
48
|
+
'@ekanos/cli',
|
|
49
|
+
'@ekanos/cli/**',
|
|
50
|
+
],
|
|
51
|
+
message: 'Dev tooling is not a runtime dependency of an experience.',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export default [
|
|
56
|
+
{
|
|
57
|
+
name: '@ekanos/sdk/eslint/experience',
|
|
58
|
+
files: SOURCE_GLOB,
|
|
59
|
+
linterOptions: { noInlineConfig: true },
|
|
60
|
+
rules: {
|
|
61
|
+
'no-restricted-imports': [
|
|
62
|
+
'error',
|
|
63
|
+
{ patterns: restrictedImportPatterns },
|
|
64
|
+
],
|
|
65
|
+
'no-restricted-syntax': [
|
|
66
|
+
'error',
|
|
67
|
+
{
|
|
68
|
+
selector: "ImportExpression[source.type!='Literal']",
|
|
69
|
+
message:
|
|
70
|
+
'A computed dynamic import() can name an integration at runtime and cannot be checked. Import a static specifier.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
selector:
|
|
74
|
+
'ImportExpression[source.value=/^@companydotcom\\/integration-|\\/integrations\\//]',
|
|
75
|
+
message: `Dynamic import of an integration is forbidden. ${INTEGRATION_REMEDIATION}`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
selector:
|
|
79
|
+
"CallExpression[callee.name='require'][arguments.0.value=/^@companydotcom\\/integration-|\\/integrations\\//]",
|
|
80
|
+
message: `require() of an integration is forbidden. ${INTEGRATION_REMEDIATION}`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The official SDK for building Ekanos integrations.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/sdk/overview",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"LICENSE",
|
|
17
17
|
"eslint.preset.mjs",
|
|
18
18
|
"eslint.design-preset.mjs",
|
|
19
|
-
"eslint.design-rules.mjs"
|
|
19
|
+
"eslint.design-rules.mjs",
|
|
20
|
+
"eslint.experience-preset.mjs"
|
|
20
21
|
],
|
|
21
22
|
"type": "module",
|
|
22
23
|
"sideEffects": [
|
|
@@ -36,6 +37,21 @@
|
|
|
36
37
|
"integration": [
|
|
37
38
|
"dist/integration/index.d.ts"
|
|
38
39
|
],
|
|
40
|
+
"contract": [
|
|
41
|
+
"dist/contract/index.d.ts"
|
|
42
|
+
],
|
|
43
|
+
"experience": [
|
|
44
|
+
"dist/experience/index.d.ts"
|
|
45
|
+
],
|
|
46
|
+
"experience/client": [
|
|
47
|
+
"dist/experience/client.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"experience/server": [
|
|
50
|
+
"dist/experience/server.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"experience/runtime": [
|
|
53
|
+
"dist/experience/runtime.d.ts"
|
|
54
|
+
],
|
|
39
55
|
"*": [
|
|
40
56
|
"dist/*"
|
|
41
57
|
]
|
|
@@ -70,17 +86,39 @@
|
|
|
70
86
|
"types": "./dist/integration/index.d.ts",
|
|
71
87
|
"default": "./dist/integration/index.js"
|
|
72
88
|
},
|
|
89
|
+
"./contract": {
|
|
90
|
+
"types": "./dist/contract/index.d.ts",
|
|
91
|
+
"default": "./dist/contract/index.js"
|
|
92
|
+
},
|
|
73
93
|
"./eslint": "./eslint.preset.mjs",
|
|
74
|
-
"./eslint/design": "./eslint.design-preset.mjs"
|
|
94
|
+
"./eslint/design": "./eslint.design-preset.mjs",
|
|
95
|
+
"./experience": {
|
|
96
|
+
"types": "./dist/experience/index.d.ts",
|
|
97
|
+
"default": "./dist/experience/index.js"
|
|
98
|
+
},
|
|
99
|
+
"./experience/client": {
|
|
100
|
+
"types": "./dist/experience/client.d.ts",
|
|
101
|
+
"default": "./dist/experience/client.js"
|
|
102
|
+
},
|
|
103
|
+
"./experience/server": {
|
|
104
|
+
"types": "./dist/experience/server.d.ts",
|
|
105
|
+
"default": "./dist/experience/server.js"
|
|
106
|
+
},
|
|
107
|
+
"./experience/runtime": {
|
|
108
|
+
"types": "./dist/experience/runtime.d.ts",
|
|
109
|
+
"default": "./dist/experience/runtime.js"
|
|
110
|
+
},
|
|
111
|
+
"./eslint/experience": "./eslint.experience-preset.mjs"
|
|
75
112
|
},
|
|
76
113
|
"publishConfig": {
|
|
77
114
|
"access": "public"
|
|
78
115
|
},
|
|
79
116
|
"dependencies": {
|
|
80
|
-
"@ekanos/integration-schema": "0.
|
|
81
|
-
"@ekanos/ui": "0.
|
|
117
|
+
"@ekanos/integration-schema": "0.20.0",
|
|
118
|
+
"@ekanos/ui": "0.20.0",
|
|
82
119
|
"@supabase/supabase-js": "2.118.0",
|
|
83
|
-
"server-only": "^0.0.1"
|
|
120
|
+
"server-only": "^0.0.1",
|
|
121
|
+
"zod-to-json-schema": "3.25.2"
|
|
84
122
|
},
|
|
85
123
|
"devDependencies": {
|
|
86
124
|
"@hookform/resolvers": "^5.9.2",
|