import type { ProviderId } from "@opengeni/subscriptions"; import type { Database } from "../database.js"; import { type SubscriptionCoreAccess, type SubscriptionCoreAccessTarget } from "./access.js"; export type { SubscriptionCoreAccessTarget } from "./access.js"; /** What a connection serves, in the access routes' shape. */ export type ModelConnectionAccess = { allowedModels: string[] | null; allowedWorkspaces: string[] | null; allowPersonalWorkspaces: boolean; /** Chosen people (organization membership ids); shared core connections only. */ allowedPeople?: string[] | null | undefined; sharePersonal?: true | undefined; /** Organization route: move a workspace's own connection to the organization (D-52). */ moveToOrganization?: true | undefined; version: number; }; /** A requested access policy names a workspace outside the organization's shared workspaces. */ export declare class ModelConnectionWorkspaceNotInOrganizationError extends Error { constructor(); } /** The viewer can read a connection's access but may not change it. */ export declare class ModelConnectionAccessForbiddenError extends Error { constructor(); } /** * Runs an access route's reads and writes: under the subject's workspace RLS * for a workspace's connection, otherwise in the organization scope once the * subject's organization administration overview is readable. */ export declare function withModelConnectionAccessScope(db: Database, target: SubscriptionCoreAccessTarget, use: (db: Database) => Promise): Promise; /** * A shared connection's access on the shared subscription core, for any * registered provider, with the workspaces that use it as their own and its * delegated manager (design 5.4). The organization route reads any * organization account, including one a shared workspace manages; the * workspace route only one that workspace manages. */ export declare function readSubscriptionCoreModelConnectionAccess(db: Database, provider: ProviderId, target: SubscriptionCoreAccessTarget): Promise; /** * A shared connection's access policy on the shared subscription core, for * any registered provider, in the legacy shape. `allowedWorkspaces` is null * when every shared workspace, including ones created later, may use it. */ export declare function getSubscriptionCoreModelConnectionAccess(db: Database, provider: ProviderId, target: SubscriptionCoreAccessTarget): Promise; /** * Save what a shared connection of any registered provider serves on the * core (`updateSubscriptionCoreConnectionAccess`). Null when the connection * is gone or its access changed since `policy.version` was read. */ export declare function updateSubscriptionCoreModelConnectionAccess(db: Database, provider: ProviderId, target: SubscriptionCoreAccessTarget, policy: ModelConnectionAccess): Promise; /** * Removes another workspace's own connection from the workspace in `target` * (D-52). True when removed; null when no such connection serves it. */ export declare function removeSubscriptionCoreModelConnectionFromWorkspace(db: Database, provider: ProviderId, target: SubscriptionCoreAccessTarget & { workspaceId: string; }): Promise;