Skip to main content

DomainSchemaClient

Defined in: js-api/src/dapi.ts:1205

Lifecycle handle for one registered domain schema (see DomainsDataSource.schema): manifest export, partial applies with dry-run change plans, whole-schema audit, and full purge. Mutations apply to user-managed schemas only (package schemas deploy on publish).

Constructors

Constructor

new DomainSchemaClient(dart, name): DomainSchemaClient

Defined in: js-api/src/dapi.ts:1208

Parameters

ParameterType
dartany
namestring

Returns

DomainSchemaClient

Properties

PropertyModifierTypeDefined in
dartpublicanyjs-api/src/dapi.ts:1206
namereadonlystringjs-api/src/dapi.ts:1208

Methods

apply()

apply(body, options?): Promise<{[key: string]: any; }>

Defined in: js-api/src/dapi.ts:1238

Applies a partial manifest; dryRun returns the change plan. Named tables replace their current definition wholesale — everything omitted comes from the registry. Destructive plans require confirmDestructive; stale ifVersion → DomainVersionConflictError; a destructive plan without confirmation → DomainError code 'destructive-confirmation-required' (the plan rides in error.body.plan).

On a USER-managed schema this requires Edit and ifVersion tracks the schema's apply counter. On a PACKAGE-managed schema it is the user-extension path: it requires 'Extend' on the schema entity, ifVersion tracks ext_version (the plan echoes it as extVersion) while the plugin's own version stays frozen, and the writable surface is limited to objects you own — your own tables through tables (needs the schema's extensible.tables opt-in) and your own columns on plugin tables through extend (needs that table's extensible opt-in). extend is full state for YOUR columns of that table: omitting one you added proposes its drop. Plugin objects are immutable — touching them is a 400 ('plugin-table-not-editable', 'not-extensible', 'schema-not-extensible', 'invalid-extend', 'plugin-schema-not-editable'), and columns you add to a plugin table must stay nullable, non-unique, non-display, and must not cascade deletes. Physical names of extension columns are prefixed server-side; every API surface — reads, writes, filters, and the audit trail — keeps using the logical name, with the exception of raw PostgreSQL error text that quotes an identifier verbatim (a constraint violation naming fk_<table>_x_<column>, say).

Parameters

ParameterType
body{ confirmDestructive?: boolean; dropTables?: string[]; extend?: {[table: string]: object; }; ifVersion?: string; propertySchemas?: object; tables?: object; }
body.confirmDestructive?boolean
body.dropTables?string[]
body.extend?{[table: string]: object; }
body.ifVersion?string
body.propertySchemas?object
body.tables?object
options?{ dryRun?: boolean; }
options.dryRun?boolean

Returns

Promise<{[key: string]: any; }>


audit()

audit(options?): Promise<DomainAuditEntry[]>

Defined in: js-api/src/dapi.ts:1246

Whole-schema history: all tables' events + 'ddl' registry events, newest first.

Parameters

ParameterType
options?{ limit?: number; }
options.limit?number

Returns

Promise<DomainAuditEntry[]>


delete()

delete(): Promise<void>

Defined in: js-api/src/dapi.ts:1251

Fully purges a user-managed schema: data, audit partition, registry, entities, permissions.

Returns

Promise<void>


grant()

grant(group, permission): Promise<void>

Defined in: js-api/src/dapi.ts:1267

Idempotently grants [permission] on this schema's registry entity to [group] (a group id). Schema grants gate schema-level operations (apply requires Edit, delete requires Delete, sharing requires Share, extending a package schema requires Extend). They do NOT grant access to row data — use table('s.t').grant() per table for that. 'Extend' is meaningful on schema entities only: granting it on a table or column schema is a 400. Requires Share.

Parameters

ParameterType
groupstring
permissionDomainPermission

Returns

Promise<void>


grants()

grants(): Promise<DomainGrant[]>

Defined in: js-api/src/dapi.ts:1257

Direct permission rows on this schema's registry entity (schema-level operation rights, not row-data access — see grant). Requires Share.

Returns

Promise<DomainGrant[]>


manifest()

manifest(): Promise<{[key: string]: any; }>

Defined in: js-api/src/dapi.ts:1213

Full manifest reconstructed from the registry (feeds editors; doubles as export).

Returns

Promise<{[key: string]: any; }>


revoke()

revoke(group, permission?): Promise<void>

Defined in: js-api/src/dapi.ts:1274

Revokes [permission] (or every schema permission when omitted) from [group]. Requires Share.

Parameters

ParameterType
groupstring
permission?DomainPermission

Returns

Promise<void>