Skip to content
SegmentStream/ Docs

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu

@segmentstream/ontology · I–L

48 public exports from @segmentstream/ontology.

Public exports

IdentityClaims

The claims of a verified sign-in token that identify and describe a member.

interface IdentityClaims {
    readonly identityProvider: string;
    readonly identitySubject: string;
    readonly email?: string;
    readonly name?: string;
}
IdentityInUse

An account already belongs to another member; approval must roll back without consuming the code.

class IdentityInUse extends IdentityInUse_base {
}
IdentityProvider

Who verified a member's token: the workspace's Neon Auth, or SegmentStream, whose app tokens stay accepted while workspaces move to Neon Auth.

type IdentityProvider = "neon-auth" | "segmentstream";
InboxOptions

`inbox` of `defineOntology`: the roles of the people whose private chats with the agent the workspace's staff work, as `agent_chat` records of kind `private`: declared roles, `member`, or `guest`, the website's visitors, where the ontology declares `guest`.

interface InboxOptions<R = unknown> {
    readonly roles: ReadonlyArray<R>;
    readonly channels?: ReadonlyArray<string>;
    readonly takeover?: {
        readonly channels?: ReadonlyArray<string>;
    };
    readonly attribution?: "name" | "none";
}
IndexDefinition

An index: the covered fields in order, or the fields with options.

type IndexDefinition<Field extends string = string> = ReadonlyArray<Field> | {
    readonly properties: ReadonlyArray<Field>;
    readonly unique?: boolean;
};
IndexField

Fields an index may cover: declared properties, system properties and `rel.one` relationships between stored entities.

type IndexField<P, R> = (keyof P & string) | keyof SystemFields | OneKeys<R>;
IndexManifest
const IndexManifest: Schema.Struct<{
    readonly properties: Schema.$Array<Schema.String>;
    readonly unique: Schema.Boolean;
}>
InvalidOntology

`defineOntology` found errors. Every diagnostic, including warnings, is attached.

class InvalidOntology extends InvalidOntology_base {
}
InvalidQuery

A query does not fit the entity: an unknown field, an operator its type lacks, a stale cursor.

class InvalidQuery extends InvalidQuery_base {
}
InvalidValues

A handler wrote values that do not fit the entity: an unknown field, a missing required property, a value its property rejects. It is a defect in the handler, raised as one, never a typed failure.

class InvalidValues extends InvalidValues_base {
}
InvocableActions

The authored actions of an entity handle, each an {@link ActionInvoker}.

type InvocableActions<A, EntityName extends string = string, EntityType = unknown> = {
    readonly [K in keyof A]: ActionInvoker<A[K], EntityName, K & string, EntityType>;
};
JsonRecord

A record as JSON, as the runtime returns it and the HTTP API sends it.

type JsonRecord = {
    readonly [field: string]: Schema.Json;
};
JsonSchemaObject
type JsonSchemaObject = {
    readonly [key: string]: Schema.Json;
};
LIST_FILTER_OPERATORS

Filter operators of a list field: it holds the value, or any of the values.

const LIST_FILTER_OPERATORS: readonly [
    "has",
    "hasAny"
]
LazyEntity

`() => Entity`, for entities in files that import each other. It is typed as `Function` on purpose: a call signature would make TypeScript infer the thunk's return type while it infers the type of the entity that declares the relationship, which is circular when the two entities refer to each other. `defineOntology` checks that the thunk returns an entity.

type LazyEntity = Function;
LimitErrorDetails

The platform limit that refused a file upload or attachment, with the numbers a caller needs to explain it in its own words. `usedBytes` counts current and retained historical file revisions, reserved uploads and live agent attachments.

const LimitErrorDetails: Schema.Union<readonly [
    Schema.Struct<{
        readonly kind: Schema.Literal<"storage_quota">;
        readonly usedBytes: Schema.Int;
        readonly requestedBytes: Schema.Int;
        readonly quotaBytes: Schema.Int;
    }>,
    Schema.Struct<{
        readonly kind: Schema.Literal<"pending_uploads">;
        readonly pending: Schema.Int;
        readonly max: Schema.Int;
        readonly uploads: Schema.optionalKey<Schema.$Array<Schema.Struct<{
            readonly id: Schema.String;
            readonly filename: Schema.String;
            readonly expiresAt: Schema.String;
        }>>>;
    }>,
    Schema.Struct<{
        readonly kind: Schema.Literal<"member_attachments">;
        readonly live: Schema.Int;
        readonly max: Schema.Int;
    }>
]>
type LimitErrorDetails = typeof LimitErrorDetails.Type;
ListFilterOperator
type ListFilterOperator = (typeof LIST_FILTER_OPERATORS)[number];
ListOptions
interface ListOptions extends Omit<PropertyOptions<ReadonlyArray<string>>, "column" | "scope" | "optional" | "default" | "unique" | "renamedFrom"> {
    readonly managed: true;
}
LocalConnection

A connection the local grant covers, as the CLI describes it.

interface LocalConnection {
    readonly key: string;
    readonly apis: Readonly<Record<string, string>>;
    readonly defaultApi: string | null;
}
LocalConnectionContext

The local runtime context `segmentstream exec --connection …` passes through a pipe.

interface LocalConnectionContext {
    readonly apiUrl: string;
    readonly workspaceId: string;
    readonly proxyGrant: string;
    readonly connections: ReadonlyArray<LocalConnection>;
}
LocalConnectionContextError

The local runtime context is present but cannot be used.

class LocalConnectionContextError extends Error {
    readonly name = "LocalConnectionContextError";
}
implicitMemberOf

The built-in `member` every invited or paired user, workflow and agent task holds, while the ontology declares `defineOntology({ member })`; `undefined` once it does not.

function implicitMemberOf(roles: ReadonlyArray<Role>): Role | undefined;
implicitRoleNames

The role names reserved while the ontology keeps the implicit `member`: `member` and `feedback_reporter`. Without it, none: a stored assignment of either is a role like any other.

function implicitRoleNames(roles: ReadonlyArray<Role>): ReadonlyArray<string>;
implicitRoleNamesOf

The role names a deployed manifest reserves, which listings of its members and API keys leave out: `member` and `feedback_reporter` while it has the built-in `member`, none otherwise.

function implicitRoleNamesOf(manifest: PrincipalsManifest): ReadonlyArray<string>;
inboxChannelsOf

The channels whose chats with people who are no users join the inbox, as records without members; empty without any.

function inboxChannelsOf(manifest: Pick<OntologyManifest, "inbox">): ReadonlySet<string>;
inboxRolesOf

The wire names of the roles whose people's private chats join the inbox; empty without one.

function inboxRolesOf(manifest: Pick<OntologyManifest, "inbox">): ReadonlySet<string>;
isAction

Whether a value was declared with `action(…)`; an entity handle's callable actions are too.

function isAction(value: unknown): value is Action;
isActionTrigger

Whether a trigger is an action trigger.

function isActionTrigger(trigger: WorkflowTriggerManifest): trigger is ActionTriggerManifest;
isAllowed

Whether the principal may do what `required` names: one of its permissions equals it, or covers it through a wildcard. Workload wildcards exclude user administration, feedback, the agent's drafts, the workspace's code, the agent's own tools and writes of sign-in identities.

function isAllowed(required: string, principal: PermissionHolder): boolean;
isConnection
function isConnection(value: unknown): value is AnyConnectionHandle;
isCronTrigger

Whether a trigger is a cron trigger.

function isCronTrigger(trigger: WorkflowTriggerManifest): trigger is CronTriggerManifest;
isEmailDocument

Whether the workspace lays the email out itself.

function isEmailDocument(template: EmailTemplate): template is EmailDocument;
isEntity
function isEntity(value: unknown): value is AnyEntity;
isImplicitRole

Whether the platform built this role in, rather than the workspace declaring it.

function isImplicitRole(candidate: Role): boolean;
isMe

Whether a value is `me` or a path from it, as authored.

function isMe(value: unknown): value is MeReference;
isMeMarker

Whether a value is the wire form of `me` or of a path: an object whose only key is `$me`.

function isMeMarker(value: unknown): value is MeMarker;
isNoopMigration

Nothing to run and the catalog already records the target: applying the plan changes nothing.

function isNoopMigration(plan: MigrationPlan): boolean;
isPlatformTrigger

Whether a trigger is a platform trigger.

function isPlatformTrigger(trigger: WorkflowTriggerManifest): trigger is PlatformTriggerManifest;
isPrivateReply

Whether a reply to this verified inbound event is delivered directly to the sender. Replies to shared, unknown or unverified destinations may have additional readers.

function isPrivateReply(runtime: ActionRuntime | undefined): boolean;
isToolset
function isToolset(value: unknown): value is Toolset;
isValueMatched

Whether a relationship is matched by value: either end is warehouse-backed. A value-matched relationship always declares `on`; a stored → stored relationship never does. It has no `<name>_id` column, foreign key, index or traversal route.

function isValueMatched(relationship: {
    readonly on?: unknown;
}): boolean;
isWebhookTrigger

Whether a trigger is a webhook trigger.

function isWebhookTrigger(trigger: WorkflowTriggerManifest): trigger is WebhookTriggerManifest;
isWorkflow

Whether a value was declared with `workflow(…)`.

function isWorkflow(value: unknown): value is AnyWorkflow;
isWorkflowTrigger

Whether a value was declared with a trigger constructor such as `cron(…)` or `after(…)`.

function isWorkflowTrigger(value: unknown): value is WorkflowTrigger;
keepsChatFiles

Whether the chats of the agent's channel `name` keep their files as long as their messages, as the channel's `files: { keep: true }` in `chat` declares; otherwise a file expires 24 hours after it arrives.

function keepsChatFiles(manifest: Pick<OntologyManifest, "chat">, name: string): boolean;
listApiKeys

Every API key, oldest first, revoked ones included.

function listApiKeys(listing?: StoredRolesListing): Effect.Effect<ReadonlyArray<ApiKeySummary>, never, SqlClient.SqlClient>;
listMembers

Every member, signed in or not, by email; or only the members with the ids given.

function listMembers(listing?: MemberListing): Effect.Effect<ReadonlyArray<MemberSummary>, never, SqlClient.SqlClient>;
localConnections

The transport of `segmentstream exec --connection … -- npm run dev`: each call goes to the local proxy route with the CLI's one-hour grant, for the connections the grant covers.

function localConnections(context: LocalConnectionContext, fetchImpl?: Fetch): ConnectionTransportFactory;