diff --git a/.agents/skills/cli-public/SKILL.md b/.agents/skills/cli-public/SKILL.md index fcfba33de..a0e852598 100644 --- a/.agents/skills/cli-public/SKILL.md +++ b/.agents/skills/cli-public/SKILL.md @@ -1,13 +1,13 @@ --- name: cli-public -description: CLI tool (csdk) for the public API — provides CRUD commands for 149 tables and 70 custom operations +description: CLI tool (csdk) for the public API — provides CRUD commands for 149 tables and 71 custom operations --- # cli-public -CLI tool (csdk) for the public API — provides CRUD commands for 149 tables and 70 custom operations +CLI tool (csdk) for the public API — provides CRUD commands for 149 tables and 71 custom operations ## Usage @@ -253,6 +253,7 @@ See the `references/` directory for detailed per-entity API documentation: - [provision-spatial-relation](references/provision-spatial-relation.md) - [bootstrap-user](references/bootstrap-user.md) - [set-field-order](references/set-field-order.md) +- [provision-check-constraint](references/provision-check-constraint.md) - [provision-unique-constraint](references/provision-unique-constraint.md) - [provision-full-text-search](references/provision-full-text-search.md) - [provision-index](references/provision-index.md) diff --git a/.agents/skills/cli-public/references/api-setting.md b/.agents/skills/cli-public/references/api-setting.md index f70932a1c..767471a60 100644 --- a/.agents/skills/cli-public/references/api-setting.md +++ b/.agents/skills/cli-public/references/api-setting.md @@ -12,8 +12,8 @@ csdk api-setting list --where.. --orderBy csdk api-setting list --limit 10 --after csdk api-setting find-first --where.. csdk api-setting get --id -csdk api-setting create --databaseId --apiId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] -csdk api-setting update --id [--databaseId ] [--apiId ] [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] +csdk api-setting create --databaseId --apiId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] +csdk api-setting update --id [--databaseId ] [--apiId ] [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] csdk api-setting delete --id ``` @@ -58,7 +58,7 @@ csdk api-setting list --where.id.equalTo --orderBy ID_ASC ### Create a apiSetting ```bash -csdk api-setting create --databaseId --apiId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] +csdk api-setting create --databaseId --apiId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] ``` ### Get a apiSetting by id diff --git a/.agents/skills/cli-public/references/construct-blueprint.md b/.agents/skills/cli-public/references/construct-blueprint.md index a0b3bca3b..f82c1ff55 100644 --- a/.agents/skills/cli-public/references/construct-blueprint.md +++ b/.agents/skills/cli-public/references/construct-blueprint.md @@ -2,7 +2,7 @@ -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. ## Usage diff --git a/.agents/skills/cli-public/references/database-setting.md b/.agents/skills/cli-public/references/database-setting.md index 5d2e8c89f..8671d75fe 100644 --- a/.agents/skills/cli-public/references/database-setting.md +++ b/.agents/skills/cli-public/references/database-setting.md @@ -12,8 +12,8 @@ csdk database-setting list --where.. --orderBy csdk database-setting list --limit 10 --after csdk database-setting find-first --where.. csdk database-setting get --id -csdk database-setting create --databaseId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] -csdk database-setting update --id [--databaseId ] [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] +csdk database-setting create --databaseId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] +csdk database-setting update --id [--databaseId ] [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] csdk database-setting delete --id ``` @@ -58,7 +58,7 @@ csdk database-setting list --where.id.equalTo --orderBy ID_ASC ### Create a databaseSetting ```bash -csdk database-setting create --databaseId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--options ] +csdk database-setting create --databaseId [--enableAggregates ] [--enablePostgis ] [--enableSearch ] [--enableDirectUploads ] [--enablePresignedUploads ] [--enableManyToMany ] [--enableConnectionFilter ] [--enableLtree ] [--enableLlm ] [--enableRealtime ] [--options ] ``` ### Get a databaseSetting by id diff --git a/.agents/skills/cli-public/references/provision-check-constraint.md b/.agents/skills/cli-public/references/provision-check-constraint.md new file mode 100644 index 000000000..9f3c8bac7 --- /dev/null +++ b/.agents/skills/cli-public/references/provision-check-constraint.md @@ -0,0 +1,19 @@ +# provisionCheckConstraint + + + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +## Usage + +```bash +csdk provision-check-constraint --input.clientMutationId --input.databaseId --input.tableId --input.definition +``` + +## Examples + +### Run provisionCheckConstraint + +```bash +csdk provision-check-constraint --input.clientMutationId --input.databaseId --input.tableId --input.definition +``` diff --git a/.agents/skills/hooks-public/SKILL.md b/.agents/skills/hooks-public/SKILL.md index 7537a9875..a73f6625e 100644 --- a/.agents/skills/hooks-public/SKILL.md +++ b/.agents/skills/hooks-public/SKILL.md @@ -1,13 +1,13 @@ --- name: hooks-public -description: React Query hooks for the public API — provides typed query and mutation hooks for 149 tables and 70 custom operations +description: React Query hooks for the public API — provides typed query and mutation hooks for 149 tables and 71 custom operations --- # hooks-public -React Query hooks for the public API — provides typed query and mutation hooks for 149 tables and 70 custom operations +React Query hooks for the public API — provides typed query and mutation hooks for 149 tables and 71 custom operations ## Usage @@ -234,6 +234,7 @@ See the `references/` directory for detailed per-entity API documentation: - [provision-spatial-relation](references/provision-spatial-relation.md) - [bootstrap-user](references/bootstrap-user.md) - [set-field-order](references/set-field-order.md) +- [provision-check-constraint](references/provision-check-constraint.md) - [provision-unique-constraint](references/provision-unique-constraint.md) - [provision-full-text-search](references/provision-full-text-search.md) - [provision-index](references/provision-index.md) diff --git a/.agents/skills/hooks-public/references/api-setting.md b/.agents/skills/hooks-public/references/api-setting.md index b9fde14ad..bd7865fe0 100644 --- a/.agents/skills/hooks-public/references/api-setting.md +++ b/.agents/skills/hooks-public/references/api-setting.md @@ -7,8 +7,8 @@ Per-API feature flag overrides; NULL columns inherit from database_settings, exp ## Usage ```typescript -useApiSettingsQuery({ selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } } }) -useApiSettingQuery({ id: '', selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } } }) +useApiSettingsQuery({ selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } } }) +useApiSettingQuery({ id: '', selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } } }) useCreateApiSettingMutation({ selection: { fields: { id: true } } }) useUpdateApiSettingMutation({ selection: { fields: { id: true } } }) useDeleteApiSettingMutation({}) @@ -20,7 +20,7 @@ useDeleteApiSettingMutation({}) ```typescript const { data, isLoading } = useApiSettingsQuery({ - selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }, + selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }, }); ``` @@ -30,5 +30,5 @@ const { data, isLoading } = useApiSettingsQuery({ const { mutate } = useCreateApiSettingMutation({ selection: { fields: { id: true } }, }); -mutate({ databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }); +mutate({ databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }); ``` diff --git a/.agents/skills/hooks-public/references/construct-blueprint.md b/.agents/skills/hooks-public/references/construct-blueprint.md index a49259f8b..772be8cc8 100644 --- a/.agents/skills/hooks-public/references/construct-blueprint.md +++ b/.agents/skills/hooks-public/references/construct-blueprint.md @@ -2,7 +2,7 @@ -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. ## Usage diff --git a/.agents/skills/hooks-public/references/database-setting.md b/.agents/skills/hooks-public/references/database-setting.md index 2882b26ef..0500059cf 100644 --- a/.agents/skills/hooks-public/references/database-setting.md +++ b/.agents/skills/hooks-public/references/database-setting.md @@ -7,8 +7,8 @@ Database-wide feature flags and settings; controls which platform features are a ## Usage ```typescript -useDatabaseSettingsQuery({ selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } } }) -useDatabaseSettingQuery({ id: '', selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } } }) +useDatabaseSettingsQuery({ selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } } }) +useDatabaseSettingQuery({ id: '', selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } } }) useCreateDatabaseSettingMutation({ selection: { fields: { id: true } } }) useUpdateDatabaseSettingMutation({ selection: { fields: { id: true } } }) useDeleteDatabaseSettingMutation({}) @@ -20,7 +20,7 @@ useDeleteDatabaseSettingMutation({}) ```typescript const { data, isLoading } = useDatabaseSettingsQuery({ - selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }, + selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }, }); ``` @@ -30,5 +30,5 @@ const { data, isLoading } = useDatabaseSettingsQuery({ const { mutate } = useCreateDatabaseSettingMutation({ selection: { fields: { id: true } }, }); -mutate({ databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }); +mutate({ databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }); ``` diff --git a/.agents/skills/hooks-public/references/provision-check-constraint.md b/.agents/skills/hooks-public/references/provision-check-constraint.md new file mode 100644 index 000000000..f2a75b484 --- /dev/null +++ b/.agents/skills/hooks-public/references/provision-check-constraint.md @@ -0,0 +1,20 @@ +# provisionCheckConstraint + + + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +## Usage + +```typescript +const { mutate } = useProvisionCheckConstraintMutation(); mutate({ input: { databaseId: '', tableId: '', definition: '' } }); +``` + +## Examples + +### Use useProvisionCheckConstraintMutation + +```typescript +const { mutate, isLoading } = useProvisionCheckConstraintMutation(); +mutate({ input: { databaseId: '', tableId: '', definition: '' } }); +``` diff --git a/.agents/skills/orm-public/SKILL.md b/.agents/skills/orm-public/SKILL.md index fe29c8cb7..72f313417 100644 --- a/.agents/skills/orm-public/SKILL.md +++ b/.agents/skills/orm-public/SKILL.md @@ -1,13 +1,13 @@ --- name: orm-public -description: ORM client for the public API — provides typed CRUD operations for 149 tables and 70 custom operations +description: ORM client for the public API — provides typed CRUD operations for 149 tables and 71 custom operations --- # orm-public -ORM client for the public API — provides typed CRUD operations for 149 tables and 70 custom operations +ORM client for the public API — provides typed CRUD operations for 149 tables and 71 custom operations ## Usage @@ -234,6 +234,7 @@ See the `references/` directory for detailed per-entity API documentation: - [provision-spatial-relation](references/provision-spatial-relation.md) - [bootstrap-user](references/bootstrap-user.md) - [set-field-order](references/set-field-order.md) +- [provision-check-constraint](references/provision-check-constraint.md) - [provision-unique-constraint](references/provision-unique-constraint.md) - [provision-full-text-search](references/provision-full-text-search.md) - [provision-index](references/provision-index.md) diff --git a/.agents/skills/orm-public/references/api-setting.md b/.agents/skills/orm-public/references/api-setting.md index 5b302cc99..7dca78e67 100644 --- a/.agents/skills/orm-public/references/api-setting.md +++ b/.agents/skills/orm-public/references/api-setting.md @@ -9,7 +9,7 @@ Per-API feature flag overrides; NULL columns inherit from database_settings, exp ```typescript db.apiSetting.findMany({ select: { id: true } }).execute() db.apiSetting.findOne({ id: '', select: { id: true } }).execute() -db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute() +db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute() db.apiSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute() db.apiSetting.delete({ where: { id: '' } }).execute() ``` @@ -28,7 +28,7 @@ const items = await db.apiSetting.findMany({ ```typescript const item = await db.apiSetting.create({ - data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, + data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); ``` diff --git a/.agents/skills/orm-public/references/construct-blueprint.md b/.agents/skills/orm-public/references/construct-blueprint.md index 5de8ca465..ca6c20d56 100644 --- a/.agents/skills/orm-public/references/construct-blueprint.md +++ b/.agents/skills/orm-public/references/construct-blueprint.md @@ -2,7 +2,7 @@ -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. ## Usage diff --git a/.agents/skills/orm-public/references/database-setting.md b/.agents/skills/orm-public/references/database-setting.md index 5c6e32c32..f91559e3a 100644 --- a/.agents/skills/orm-public/references/database-setting.md +++ b/.agents/skills/orm-public/references/database-setting.md @@ -9,7 +9,7 @@ Database-wide feature flags and settings; controls which platform features are a ```typescript db.databaseSetting.findMany({ select: { id: true } }).execute() db.databaseSetting.findOne({ id: '', select: { id: true } }).execute() -db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute() +db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute() db.databaseSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute() db.databaseSetting.delete({ where: { id: '' } }).execute() ``` @@ -28,7 +28,7 @@ const items = await db.databaseSetting.findMany({ ```typescript const item = await db.databaseSetting.create({ - data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, + data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); ``` diff --git a/.agents/skills/orm-public/references/provision-check-constraint.md b/.agents/skills/orm-public/references/provision-check-constraint.md new file mode 100644 index 000000000..bf24f3809 --- /dev/null +++ b/.agents/skills/orm-public/references/provision-check-constraint.md @@ -0,0 +1,19 @@ +# provisionCheckConstraint + + + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +## Usage + +```typescript +db.mutation.provisionCheckConstraint({ input: { databaseId: '', tableId: '', definition: '' } }).execute() +``` + +## Examples + +### Run provisionCheckConstraint + +```typescript +const result = await db.mutation.provisionCheckConstraint({ input: { databaseId: '', tableId: '', definition: '' } }).execute(); +``` diff --git a/sdk/constructive-cli/src/admin/orm/client.ts b/sdk/constructive-cli/src/admin/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-cli/src/admin/orm/client.ts +++ b/sdk/constructive-cli/src/admin/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-cli/src/auth/orm/client.ts b/sdk/constructive-cli/src/auth/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-cli/src/auth/orm/client.ts +++ b/sdk/constructive-cli/src/auth/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-cli/src/objects/orm/client.ts b/sdk/constructive-cli/src/objects/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-cli/src/objects/orm/client.ts +++ b/sdk/constructive-cli/src/objects/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-cli/src/public/README.md b/sdk/constructive-cli/src/public/README.md index a49f5629a..a4ffb952f 100644 --- a/sdk/constructive-cli/src/public/README.md +++ b/sdk/constructive-cli/src/public/README.md @@ -10,7 +10,7 @@ - **Tables:** 149 - **Custom queries:** 22 -- **Custom mutations:** 48 +- **Custom mutations:** 49 **Generators:** ORM, CLI diff --git a/sdk/constructive-cli/src/public/cli/README.md b/sdk/constructive-cli/src/public/cli/README.md index e5c41c4ce..eb87ed94a 100644 --- a/sdk/constructive-cli/src/public/cli/README.md +++ b/sdk/constructive-cli/src/public/cli/README.md @@ -215,7 +215,7 @@ csdk auth set-token | `verify-email` | verifyEmail | | `freeze-objects` | freezeObjects | | `init-empty-repo` | initEmptyRepo | -| `construct-blueprint` | Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. | +| `construct-blueprint` | Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. | | `provision-new-user` | provisionNewUser | | `reset-password` | resetPassword | | `remove-node-at-path` | removeNodeAtPath | @@ -223,6 +223,7 @@ csdk auth set-token | `provision-spatial-relation` | Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin ↔ param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist — this is a metadata-only insert. | | `bootstrap-user` | bootstrapUser | | `set-field-order` | setFieldOrder | +| `provision-check-constraint` | Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. | | `provision-unique-constraint` | Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. | | `provision-full-text-search` | Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id. | | `provision-index` | Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id. | @@ -1799,10 +1800,11 @@ CRUD operations for ApiSetting records. | `enableConnectionFilter` | Boolean | | `enableLtree` | Boolean | | `enableLlm` | Boolean | +| `enableRealtime` | Boolean | | `options` | JSON | **Required create fields:** `databaseId`, `apiId` -**Optional create fields (backend defaults):** `enableAggregates`, `enablePostgis`, `enableSearch`, `enableDirectUploads`, `enablePresignedUploads`, `enableManyToMany`, `enableConnectionFilter`, `enableLtree`, `enableLlm`, `options` +**Optional create fields (backend defaults):** `enableAggregates`, `enablePostgis`, `enableSearch`, `enableDirectUploads`, `enablePresignedUploads`, `enableManyToMany`, `enableConnectionFilter`, `enableLtree`, `enableLlm`, `enableRealtime`, `options` ### `connected-accounts-module` @@ -4545,10 +4547,11 @@ CRUD operations for DatabaseSetting records. | `enableConnectionFilter` | Boolean | | `enableLtree` | Boolean | | `enableLlm` | Boolean | +| `enableRealtime` | Boolean | | `options` | JSON | **Required create fields:** `databaseId` -**Optional create fields (backend defaults):** `enableAggregates`, `enablePostgis`, `enableSearch`, `enableDirectUploads`, `enablePresignedUploads`, `enableManyToMany`, `enableConnectionFilter`, `enableLtree`, `enableLlm`, `options` +**Optional create fields (backend defaults):** `enableAggregates`, `enablePostgis`, `enableSearch`, `enableDirectUploads`, `enablePresignedUploads`, `enableManyToMany`, `enableConnectionFilter`, `enableLtree`, `enableLlm`, `enableRealtime`, `options` ### `plans-module` @@ -5419,7 +5422,7 @@ initEmptyRepo ### `construct-blueprint` -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. - **Type:** mutation - **Arguments:** @@ -5536,6 +5539,20 @@ setFieldOrder | `--input.clientMutationId` | String | | `--input.fieldIds` | UUID | +### `provision-check-constraint` + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +- **Type:** mutation +- **Arguments:** + + | Argument | Type | + |----------|------| + | `--input.clientMutationId` | String | + | `--input.databaseId` | UUID | + | `--input.tableId` | UUID | + | `--input.definition` | JSON | + ### `provision-unique-constraint` Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. diff --git a/sdk/constructive-cli/src/public/cli/commands.ts b/sdk/constructive-cli/src/public/cli/commands.ts index b0e18a3b5..3d9d468c5 100644 --- a/sdk/constructive-cli/src/public/cli/commands.ts +++ b/sdk/constructive-cli/src/public/cli/commands.ts @@ -203,6 +203,7 @@ import copyTemplateToBlueprintCmd from './commands/copy-template-to-blueprint'; import provisionSpatialRelationCmd from './commands/provision-spatial-relation'; import bootstrapUserCmd from './commands/bootstrap-user'; import setFieldOrderCmd from './commands/set-field-order'; +import provisionCheckConstraintCmd from './commands/provision-check-constraint'; import provisionUniqueConstraintCmd from './commands/provision-unique-constraint'; import provisionFullTextSearchCmd from './commands/provision-full-text-search'; import provisionIndexCmd from './commands/provision-index'; @@ -432,6 +433,7 @@ const createCommandMap: () => Record< 'provision-spatial-relation': provisionSpatialRelationCmd, 'bootstrap-user': bootstrapUserCmd, 'set-field-order': setFieldOrderCmd, + 'provision-check-constraint': provisionCheckConstraintCmd, 'provision-unique-constraint': provisionUniqueConstraintCmd, 'provision-full-text-search': provisionFullTextSearchCmd, 'provision-index': provisionIndexCmd, @@ -456,7 +458,7 @@ const createCommandMap: () => Record< 'provision-bucket': provisionBucketCmd, }); const usage = - "\ncsdk \n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n object object CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n spatial-relation spatialRelation CRUD operations\n partition partition CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n session-secrets-module sessionSecretsModule CRUD operations\n identity-providers-module identityProvidersModule CRUD operations\n realtime-module realtimeModule CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n function function CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n cors-setting corsSetting CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n api-setting apiSetting CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n entity-type-provision entityTypeProvision CRUD operations\n webauthn-credentials-module webauthnCredentialsModule CRUD operations\n webauthn-auth-module webauthnAuthModule CRUD operations\n notifications-module notificationsModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n app-limit-credit appLimitCredit CRUD operations\n app-limit-credit-code-item appLimitCreditCodeItem CRUD operations\n app-limit-credit-redemption appLimitCreditRedemption CRUD operations\n org-limit orgLimit CRUD operations\n org-limit-credit orgLimitCredit CRUD operations\n org-limit-aggregate orgLimitAggregate CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n webauthn-credential webauthnCredential CRUD operations\n app-invite appInvite CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n agent-thread agentThread CRUD operations\n agent-message agentMessage CRUD operations\n agent-task agentTask CRUD operations\n role-type roleType CRUD operations\n identity-provider identityProvider CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-limit-credit-code appLimitCreditCode CRUD operations\n app-limit-caps-default appLimitCapsDefault CRUD operations\n org-limit-caps-default orgLimitCapsDefault CRUD operations\n app-limit-cap appLimitCap CRUD operations\n org-limit-cap orgLimitCap CRUD operations\n membership-type membershipType CRUD operations\n migrate-file migrateFile CRUD operations\n devices-module devicesModule CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n user-connected-account userConnectedAccount CRUD operations\n commit commit CRUD operations\n pubkey-setting pubkeySetting CRUD operations\n rate-limits-module rateLimitsModule CRUD operations\n usage-snapshot usageSnapshot CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-setting rlsSetting CRUD operations\n app-limit-event appLimitEvent CRUD operations\n org-limit-event orgLimitEvent CRUD operations\n rls-module rlsModule CRUD operations\n database-setting databaseSetting CRUD operations\n plans-module plansModule CRUD operations\n sql-action sqlAction CRUD operations\n billing-module billingModule CRUD operations\n ast-migration astMigration CRUD operations\n user user CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n webauthn-setting webauthnSetting CRUD operations\n app-membership appMembership CRUD operations\n billing-provider-module billingProviderModule CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-user-agent currentUserAgent\n current-ip-address currentIpAddress\n require-step-up requireStepUp\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n resolve-blueprint-field Resolves a field_name within a given table_id to a field_id. Throws if no match is found. Used by construct_blueprint to translate user-authored field names (e.g. \"location\") into field UUIDs for downstream provisioning procedures. table_id must already be resolved (via resolve_blueprint_table) before calling this.\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n disconnect-account disconnectAccount\n revoke-api-key revokeApiKey\n revoke-session revokeSession\n verify-password verifyPassword\n verify-totp verifyTotp\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n provision-new-user provisionNewUser\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-spatial-relation Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin \u2194 param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist \u2014 this is a metadata-only insert.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-cross-origin signInCrossOrigin\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n create-api-key createApiKey\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n sign-up signUp\n request-cross-origin-token requestCrossOriginToken\n sign-in signIn\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\n --help, -h Show this help message\n --version, -v Show version\n"; + "\ncsdk \n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n object object CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n spatial-relation spatialRelation CRUD operations\n partition partition CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n session-secrets-module sessionSecretsModule CRUD operations\n identity-providers-module identityProvidersModule CRUD operations\n realtime-module realtimeModule CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n function function CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n cors-setting corsSetting CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n api-setting apiSetting CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n entity-type-provision entityTypeProvision CRUD operations\n webauthn-credentials-module webauthnCredentialsModule CRUD operations\n webauthn-auth-module webauthnAuthModule CRUD operations\n notifications-module notificationsModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n app-limit-credit appLimitCredit CRUD operations\n app-limit-credit-code-item appLimitCreditCodeItem CRUD operations\n app-limit-credit-redemption appLimitCreditRedemption CRUD operations\n org-limit orgLimit CRUD operations\n org-limit-credit orgLimitCredit CRUD operations\n org-limit-aggregate orgLimitAggregate CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n webauthn-credential webauthnCredential CRUD operations\n app-invite appInvite CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n agent-thread agentThread CRUD operations\n agent-message agentMessage CRUD operations\n agent-task agentTask CRUD operations\n role-type roleType CRUD operations\n identity-provider identityProvider CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-limit-credit-code appLimitCreditCode CRUD operations\n app-limit-caps-default appLimitCapsDefault CRUD operations\n org-limit-caps-default orgLimitCapsDefault CRUD operations\n app-limit-cap appLimitCap CRUD operations\n org-limit-cap orgLimitCap CRUD operations\n membership-type membershipType CRUD operations\n migrate-file migrateFile CRUD operations\n devices-module devicesModule CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n user-connected-account userConnectedAccount CRUD operations\n commit commit CRUD operations\n pubkey-setting pubkeySetting CRUD operations\n rate-limits-module rateLimitsModule CRUD operations\n usage-snapshot usageSnapshot CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-setting rlsSetting CRUD operations\n app-limit-event appLimitEvent CRUD operations\n org-limit-event orgLimitEvent CRUD operations\n rls-module rlsModule CRUD operations\n database-setting databaseSetting CRUD operations\n plans-module plansModule CRUD operations\n sql-action sqlAction CRUD operations\n billing-module billingModule CRUD operations\n ast-migration astMigration CRUD operations\n user user CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n webauthn-setting webauthnSetting CRUD operations\n app-membership appMembership CRUD operations\n billing-provider-module billingProviderModule CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-user-agent currentUserAgent\n current-ip-address currentIpAddress\n require-step-up requireStepUp\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n resolve-blueprint-field Resolves a field_name within a given table_id to a field_id. Throws if no match is found. Used by construct_blueprint to translate user-authored field names (e.g. \"location\") into field UUIDs for downstream provisioning procedures. table_id must already be resolved (via resolve_blueprint_table) before calling this.\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n disconnect-account disconnectAccount\n revoke-api-key revokeApiKey\n revoke-session revokeSession\n verify-password verifyPassword\n verify-totp verifyTotp\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n provision-new-user provisionNewUser\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-spatial-relation Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin \u2194 param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist \u2014 this is a metadata-only insert.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n provision-check-constraint Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists.\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-cross-origin signInCrossOrigin\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n create-api-key createApiKey\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n sign-up signUp\n request-cross-origin-token requestCrossOriginToken\n sign-in signIn\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\n --help, -h Show this help message\n --version, -v Show version\n"; export const commands = async ( argv: Partial>, prompter: Inquirerer, diff --git a/sdk/constructive-cli/src/public/cli/commands/api-setting.ts b/sdk/constructive-cli/src/public/cli/commands/api-setting.ts index efccf8f86..b983358f9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api-setting.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api-setting.ts @@ -28,6 +28,7 @@ const fieldSchema: FieldSchema = { enableConnectionFilter: 'boolean', enableLtree: 'boolean', enableLlm: 'boolean', + enableRealtime: 'boolean', options: 'json', }; const usage = @@ -93,6 +94,7 @@ async function handleList(argv: Partial>, _prompter: Inq enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }; const findManyArgs = parseFindManyArgs< @@ -126,6 +128,7 @@ async function handleFindFirst(argv: Partial>, _prompter enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }; const findFirstArgs = parseFindFirstArgs< @@ -171,6 +174,7 @@ async function handleGet(argv: Partial>, prompter: Inqui enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) @@ -262,6 +266,13 @@ async function handleCreate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'boolean', + name: 'enableRealtime', + message: 'enableRealtime', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'options', @@ -287,6 +298,7 @@ async function handleCreate(argv: Partial>, prompter: In enableConnectionFilter: cleanedData.enableConnectionFilter, enableLtree: cleanedData.enableLtree, enableLlm: cleanedData.enableLlm, + enableRealtime: cleanedData.enableRealtime, options: cleanedData.options, }, select: { @@ -302,6 +314,7 @@ async function handleCreate(argv: Partial>, prompter: In enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) @@ -399,6 +412,13 @@ async function handleUpdate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'boolean', + name: 'enableRealtime', + message: 'enableRealtime', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'options', @@ -427,6 +447,7 @@ async function handleUpdate(argv: Partial>, prompter: In enableConnectionFilter: cleanedData.enableConnectionFilter, enableLtree: cleanedData.enableLtree, enableLlm: cleanedData.enableLlm, + enableRealtime: cleanedData.enableRealtime, options: cleanedData.options, }, select: { @@ -442,6 +463,7 @@ async function handleUpdate(argv: Partial>, prompter: In enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) diff --git a/sdk/constructive-cli/src/public/cli/commands/construct-blueprint.ts b/sdk/constructive-cli/src/public/cli/commands/construct-blueprint.ts index 6a7d31acf..ea92ac998 100644 --- a/sdk/constructive-cli/src/public/cli/commands/construct-blueprint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/construct-blueprint.ts @@ -16,7 +16,7 @@ export default async ( try { if (argv.help || argv.h) { console.log( - 'construct-blueprint - Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n\nUsage: construct-blueprint [OPTIONS]\n' + 'construct-blueprint - Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n\nUsage: construct-blueprint [OPTIONS]\n' ); process.exit(0); } diff --git a/sdk/constructive-cli/src/public/cli/commands/database-setting.ts b/sdk/constructive-cli/src/public/cli/commands/database-setting.ts index b4d5de02d..f0e156359 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database-setting.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database-setting.ts @@ -27,6 +27,7 @@ const fieldSchema: FieldSchema = { enableConnectionFilter: 'boolean', enableLtree: 'boolean', enableLlm: 'boolean', + enableRealtime: 'boolean', options: 'json', }; const usage = @@ -91,6 +92,7 @@ async function handleList(argv: Partial>, _prompter: Inq enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }; const findManyArgs = parseFindManyArgs< @@ -123,6 +125,7 @@ async function handleFindFirst(argv: Partial>, _prompter enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }; const findFirstArgs = parseFindFirstArgs< @@ -167,6 +170,7 @@ async function handleGet(argv: Partial>, prompter: Inqui enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) @@ -252,6 +256,13 @@ async function handleCreate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'boolean', + name: 'enableRealtime', + message: 'enableRealtime', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'options', @@ -279,6 +290,7 @@ async function handleCreate(argv: Partial>, prompter: In enableConnectionFilter: cleanedData.enableConnectionFilter, enableLtree: cleanedData.enableLtree, enableLlm: cleanedData.enableLlm, + enableRealtime: cleanedData.enableRealtime, options: cleanedData.options, }, select: { @@ -293,6 +305,7 @@ async function handleCreate(argv: Partial>, prompter: In enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) @@ -384,6 +397,13 @@ async function handleUpdate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'boolean', + name: 'enableRealtime', + message: 'enableRealtime', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'options', @@ -411,6 +431,7 @@ async function handleUpdate(argv: Partial>, prompter: In enableConnectionFilter: cleanedData.enableConnectionFilter, enableLtree: cleanedData.enableLtree, enableLlm: cleanedData.enableLlm, + enableRealtime: cleanedData.enableRealtime, options: cleanedData.options, }, select: { @@ -425,6 +446,7 @@ async function handleUpdate(argv: Partial>, prompter: In enableConnectionFilter: true, enableLtree: true, enableLlm: true, + enableRealtime: true, options: true, }, }) diff --git a/sdk/constructive-cli/src/public/cli/commands/provision-check-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/provision-check-constraint.ts new file mode 100644 index 000000000..9139f8dfb --- /dev/null +++ b/sdk/constructive-cli/src/public/cli/commands/provision-check-constraint.ts @@ -0,0 +1,53 @@ +/** + * CLI command for mutation provisionCheckConstraint + * @generated by @constructive-io/graphql-codegen + * DO NOT EDIT - changes will be overwritten + */ +import { CLIOptions, Inquirerer } from 'inquirerer'; +import { getClient } from '../executor'; +import { unflattenDotNotation, buildSelectFromPaths } from '../utils'; +import type { ProvisionCheckConstraintVariables } from '../../orm/mutation'; +import type { ProvisionCheckConstraintPayloadSelect } from '../../orm/input-types'; +export default async ( + argv: Partial>, + prompter: Inquirerer, + _options: CLIOptions +) => { + try { + if (argv.help || argv.h) { + console.log( + 'provision-check-constraint - Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists.\n\nUsage: provision-check-constraint [OPTIONS]\n' + ); + process.exit(0); + } + const answers = await prompter.prompt(argv, [ + { + type: 'text', + name: 'input', + message: + 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.', + required: true, + }, + ]); + const client = getClient(); + const parsedAnswers = unflattenDotNotation(answers); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); + const result = await client.mutation + .provisionCheckConstraint( + parsedAnswers as unknown as ProvisionCheckConstraintVariables, + { + select: selectFields, + } as unknown as { + select: ProvisionCheckConstraintPayloadSelect; + } + ) + .execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed: provisionCheckConstraint'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +}; diff --git a/sdk/constructive-cli/src/public/orm/README.md b/sdk/constructive-cli/src/public/orm/README.md index b50ee1954..2d39cb95b 100644 --- a/sdk/constructive-cli/src/public/orm/README.md +++ b/sdk/constructive-cli/src/public/orm/README.md @@ -2004,19 +2004,20 @@ CRUD operations for ApiSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all apiSetting records -const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.apiSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -5392,19 +5393,20 @@ CRUD operations for DatabaseSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all databaseSetting records -const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.databaseSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -6470,7 +6472,7 @@ const result = await db.mutation.initEmptyRepo({ input: { dbId: '', storeI ### `db.mutation.constructBlueprint` -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. - **Type:** mutation - **Arguments:** @@ -6588,6 +6590,21 @@ setFieldOrder const result = await db.mutation.setFieldOrder({ input: { fieldIds: '' } }).execute(); ``` +### `db.mutation.provisionCheckConstraint` + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +- **Type:** mutation +- **Arguments:** + + | Argument | Type | + |----------|------| + | `input` | ProvisionCheckConstraintInput (required) | + +```typescript +const result = await db.mutation.provisionCheckConstraint({ input: { databaseId: '', tableId: '', definition: '' } }).execute(); +``` + ### `db.mutation.provisionUniqueConstraint` Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. diff --git a/sdk/constructive-cli/src/public/orm/client.ts b/sdk/constructive-cli/src/public/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-cli/src/public/orm/client.ts +++ b/sdk/constructive-cli/src/public/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-cli/src/public/orm/input-types.ts b/sdk/constructive-cli/src/public/orm/input-types.ts index 262babe2e..5bdd88600 100644 --- a/sdk/constructive-cli/src/public/orm/input-types.ts +++ b/sdk/constructive-cli/src/public/orm/input-types.ts @@ -1043,6 +1043,8 @@ export interface ApiSetting { enableLtree?: boolean | null; /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ enableLlm?: boolean | null; + /** Override: enable realtime subscriptions (NULL = inherit from database_settings) */ + enableRealtime?: boolean | null; /** Extensible JSON for additional per-API settings that do not have dedicated columns */ options?: Record | null; } @@ -2665,6 +2667,8 @@ export interface DatabaseSetting { enableLtree?: boolean | null; /** Enable LLM/AI integration features in the GraphQL API */ enableLlm?: boolean | null; + /** Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API */ + enableRealtime?: boolean | null; /** Extensible JSON for additional settings that do not have dedicated columns */ options?: Record | null; } @@ -5585,6 +5589,7 @@ export type ApiSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; api?: { select: ApiSelect; @@ -7485,6 +7490,7 @@ export type DatabaseSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; database?: { select: DatabaseSelect; @@ -10228,6 +10234,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -13364,6 +13372,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -15279,6 +15289,8 @@ export type ApiSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type ConnectedAccountsModuleOrderBy = @@ -17365,6 +17377,8 @@ export type DatabaseSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type PlansModuleOrderBy = @@ -19256,6 +19270,7 @@ export interface CreateApiSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -19271,6 +19286,7 @@ export interface ApiSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateApiSettingInput { @@ -22137,6 +22153,7 @@ export interface CreateDatabaseSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -22151,6 +22168,7 @@ export interface DatabaseSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateDatabaseSettingInput { @@ -22930,6 +22948,12 @@ export interface SetFieldOrderInput { clientMutationId?: string; fieldIds?: string[]; } +export interface ProvisionCheckConstraintInput { + clientMutationId?: string; + databaseId?: string; + tableId?: string; + definition?: Record; +} export interface ProvisionUniqueConstraintInput { clientMutationId?: string; databaseId?: string; @@ -26569,6 +26593,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -30403,6 +30429,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -31442,6 +31470,12 @@ export interface SetFieldOrderPayload { export type SetFieldOrderPayloadSelect = { clientMutationId?: boolean; }; +export interface ProvisionCheckConstraintPayload { + clientMutationId?: string | null; +} +export type ProvisionCheckConstraintPayloadSelect = { + clientMutationId?: boolean; +}; export interface ProvisionUniqueConstraintPayload { clientMutationId?: string | null; } diff --git a/sdk/constructive-cli/src/public/orm/mutation/index.ts b/sdk/constructive-cli/src/public/orm/mutation/index.ts index 24af7c323..89ed2f871 100644 --- a/sdk/constructive-cli/src/public/orm/mutation/index.ts +++ b/sdk/constructive-cli/src/public/orm/mutation/index.ts @@ -33,6 +33,7 @@ import type { ProvisionSpatialRelationInput, BootstrapUserInput, SetFieldOrderInput, + ProvisionCheckConstraintInput, ProvisionUniqueConstraintInput, ProvisionFullTextSearchInput, ProvisionIndexInput, @@ -81,6 +82,7 @@ import type { ProvisionSpatialRelationPayload, BootstrapUserPayload, SetFieldOrderPayload, + ProvisionCheckConstraintPayload, ProvisionUniqueConstraintPayload, ProvisionFullTextSearchPayload, ProvisionIndexPayload, @@ -129,6 +131,7 @@ import type { ProvisionSpatialRelationPayloadSelect, BootstrapUserPayloadSelect, SetFieldOrderPayloadSelect, + ProvisionCheckConstraintPayloadSelect, ProvisionUniqueConstraintPayloadSelect, ProvisionFullTextSearchPayloadSelect, ProvisionIndexPayloadSelect, @@ -209,7 +212,7 @@ export interface InitEmptyRepoVariables { } /** * Variables for constructBlueprint - * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. + * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. */ export interface ConstructBlueprintVariables { input: ConstructBlueprintInput; @@ -243,6 +246,13 @@ export interface BootstrapUserVariables { export interface SetFieldOrderVariables { input: SetFieldOrderInput; } +/** + * Variables for provisionCheckConstraint + * Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + */ +export interface ProvisionCheckConstraintVariables { + input: ProvisionCheckConstraintInput; +} /** * Variables for provisionUniqueConstraint * Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. @@ -1111,6 +1121,35 @@ export function createMutationOperations(client: OrmClient) { 'SetFieldOrderPayload' ), }), + provisionCheckConstraint: ( + args: ProvisionCheckConstraintVariables, + options: { + select: S; + } & StrictSelect + ) => + new QueryBuilder<{ + provisionCheckConstraint: InferSelectResult | null; + }>({ + client, + operation: 'mutation', + operationName: 'ProvisionCheckConstraint', + fieldName: 'provisionCheckConstraint', + ...buildCustomDocument( + 'mutation', + 'ProvisionCheckConstraint', + 'provisionCheckConstraint', + options.select, + args, + [ + { + name: 'input', + type: 'ProvisionCheckConstraintInput!', + }, + ], + connectionFieldsMap, + 'ProvisionCheckConstraintPayload' + ), + }), provisionUniqueConstraint: ( args: ProvisionUniqueConstraintVariables, options: { diff --git a/sdk/constructive-react/src/admin/orm/client.ts b/sdk/constructive-react/src/admin/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-react/src/admin/orm/client.ts +++ b/sdk/constructive-react/src/admin/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-react/src/auth/orm/client.ts b/sdk/constructive-react/src/auth/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-react/src/auth/orm/client.ts +++ b/sdk/constructive-react/src/auth/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-react/src/objects/orm/client.ts b/sdk/constructive-react/src/objects/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-react/src/objects/orm/client.ts +++ b/sdk/constructive-react/src/objects/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-react/src/public/README.md b/sdk/constructive-react/src/public/README.md index 35a5008f7..6a5ef8b7c 100644 --- a/sdk/constructive-react/src/public/README.md +++ b/sdk/constructive-react/src/public/README.md @@ -10,7 +10,7 @@ - **Tables:** 149 - **Custom queries:** 22 -- **Custom mutations:** 48 +- **Custom mutations:** 49 **Generators:** ORM, React Query diff --git a/sdk/constructive-react/src/public/hooks/README.md b/sdk/constructive-react/src/public/hooks/README.md index a2f0b2a73..8163f12dd 100644 --- a/sdk/constructive-react/src/public/hooks/README.md +++ b/sdk/constructive-react/src/public/hooks/README.md @@ -869,7 +869,7 @@ function App() { | `useVerifyEmailMutation` | Mutation | verifyEmail | | `useFreezeObjectsMutation` | Mutation | freezeObjects | | `useInitEmptyRepoMutation` | Mutation | initEmptyRepo | -| `useConstructBlueprintMutation` | Mutation | Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. | +| `useConstructBlueprintMutation` | Mutation | Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. | | `useProvisionNewUserMutation` | Mutation | provisionNewUser | | `useResetPasswordMutation` | Mutation | resetPassword | | `useRemoveNodeAtPathMutation` | Mutation | removeNodeAtPath | @@ -877,6 +877,7 @@ function App() { | `useProvisionSpatialRelationMutation` | Mutation | Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin ↔ param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist — this is a metadata-only insert. | | `useBootstrapUserMutation` | Mutation | bootstrapUser | | `useSetFieldOrderMutation` | Mutation | setFieldOrder | +| `useProvisionCheckConstraintMutation` | Mutation | Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. | | `useProvisionUniqueConstraintMutation` | Mutation | Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. | | `useProvisionFullTextSearchMutation` | Mutation | Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id. | | `useProvisionIndexMutation` | Mutation | Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id. | @@ -1916,20 +1917,20 @@ create({ databaseId: '', siteId: '', name: '', appImage: '', - selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }, + selection: { fields: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }, }); // Create a apiSetting const { mutate: create } = useCreateApiSettingMutation({ selection: { fields: { id: true } }, }); -create({ databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }); +create({ databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }); ``` ### ConnectedAccountsModule @@ -3788,20 +3789,20 @@ create({ databaseId: '', schemaId: '', privateSchemaId: '', se ```typescript // List all databaseSettings const { data, isLoading } = useDatabaseSettingsQuery({ - selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }, + selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }, }); // Get one databaseSetting const { data: item } = useDatabaseSettingQuery({ id: '', - selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }, + selection: { fields: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }, }); // Create a databaseSetting const { mutate: create } = useCreateDatabaseSettingMutation({ selection: { fields: { id: true } }, }); -create({ databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }); +create({ databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }); ``` ### PlansModule @@ -4476,7 +4477,7 @@ initEmptyRepo ### `useConstructBlueprintMutation` -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. - **Type:** mutation - **Arguments:** @@ -4562,6 +4563,17 @@ setFieldOrder |----------|------| | `input` | SetFieldOrderInput (required) | +### `useProvisionCheckConstraintMutation` + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +- **Type:** mutation +- **Arguments:** + + | Argument | Type | + |----------|------| + | `input` | ProvisionCheckConstraintInput (required) | + ### `useProvisionUniqueConstraintMutation` Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. diff --git a/sdk/constructive-react/src/public/hooks/mutation-keys.ts b/sdk/constructive-react/src/public/hooks/mutation-keys.ts index dc8dfd4ce..8ef40d210 100644 --- a/sdk/constructive-react/src/public/hooks/mutation-keys.ts +++ b/sdk/constructive-react/src/public/hooks/mutation-keys.ts @@ -1466,6 +1466,12 @@ export const customMutationKeys = { identifier ? (['mutation', 'setFieldOrder', identifier] as const) : (['mutation', 'setFieldOrder'] as const), + /** Mutation key for provisionCheckConstraint */ provisionCheckConstraint: ( + identifier?: string + ) => + identifier + ? (['mutation', 'provisionCheckConstraint', identifier] as const) + : (['mutation', 'provisionCheckConstraint'] as const), /** Mutation key for provisionUniqueConstraint */ provisionUniqueConstraint: ( identifier?: string ) => diff --git a/sdk/constructive-react/src/public/hooks/mutations/index.ts b/sdk/constructive-react/src/public/hooks/mutations/index.ts index 00a726a71..272ddbf1a 100644 --- a/sdk/constructive-react/src/public/hooks/mutations/index.ts +++ b/sdk/constructive-react/src/public/hooks/mutations/index.ts @@ -456,6 +456,7 @@ export * from './useCopyTemplateToBlueprintMutation'; export * from './useProvisionSpatialRelationMutation'; export * from './useBootstrapUserMutation'; export * from './useSetFieldOrderMutation'; +export * from './useProvisionCheckConstraintMutation'; export * from './useProvisionUniqueConstraintMutation'; export * from './useProvisionFullTextSearchMutation'; export * from './useProvisionIndexMutation'; diff --git a/sdk/constructive-react/src/public/hooks/mutations/useProvisionCheckConstraintMutation.ts b/sdk/constructive-react/src/public/hooks/mutations/useProvisionCheckConstraintMutation.ts new file mode 100644 index 000000000..2e18ad627 --- /dev/null +++ b/sdk/constructive-react/src/public/hooks/mutations/useProvisionCheckConstraintMutation.ts @@ -0,0 +1,60 @@ +/** + * Custom mutation hook for provisionCheckConstraint + * @generated by @constructive-io/graphql-codegen + * DO NOT EDIT - changes will be overwritten + */ + +import { useMutation } from '@tanstack/react-query'; +import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'; +import { getClient } from '../client'; +import { buildSelectionArgs } from '../selection'; +import type { SelectionConfig } from '../selection'; +import { customMutationKeys } from '../mutation-keys'; +import type { ProvisionCheckConstraintVariables } from '../../orm/mutation'; +import type { + ProvisionCheckConstraintPayloadSelect, + ProvisionCheckConstraintPayload, +} from '../../orm/input-types'; +import type { InferSelectResult, HookStrictSelect, StrictSelect } from '../../orm/select-types'; +export type { ProvisionCheckConstraintVariables } from '../../orm/mutation'; +export type { ProvisionCheckConstraintPayloadSelect } from '../../orm/input-types'; +export function useProvisionCheckConstraintMutation< + S extends ProvisionCheckConstraintPayloadSelect, +>( + params: { + selection: { + fields: S & ProvisionCheckConstraintPayloadSelect; + } & HookStrictSelect, ProvisionCheckConstraintPayloadSelect>; + } & Omit< + UseMutationOptions< + { + provisionCheckConstraint: InferSelectResult | null; + }, + Error, + ProvisionCheckConstraintVariables + >, + 'mutationFn' + > +): UseMutationResult< + { + provisionCheckConstraint: InferSelectResult | null; + }, + Error, + ProvisionCheckConstraintVariables +> { + const args = buildSelectionArgs(params.selection); + const { selection: _selection, ...mutationOptions } = params ?? {}; + void _selection; + return useMutation({ + mutationKey: customMutationKeys.provisionCheckConstraint(), + mutationFn: (variables: ProvisionCheckConstraintVariables) => + getClient() + .mutation.provisionCheckConstraint(variables, { + select: args.select, + } as { + select: S; + } & StrictSelect) + .unwrap(), + ...mutationOptions, + }); +} diff --git a/sdk/constructive-react/src/public/orm/README.md b/sdk/constructive-react/src/public/orm/README.md index b50ee1954..2d39cb95b 100644 --- a/sdk/constructive-react/src/public/orm/README.md +++ b/sdk/constructive-react/src/public/orm/README.md @@ -2004,19 +2004,20 @@ CRUD operations for ApiSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all apiSetting records -const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.apiSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -5392,19 +5393,20 @@ CRUD operations for DatabaseSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all databaseSetting records -const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.databaseSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -6470,7 +6472,7 @@ const result = await db.mutation.initEmptyRepo({ input: { dbId: '', storeI ### `db.mutation.constructBlueprint` -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. - **Type:** mutation - **Arguments:** @@ -6588,6 +6590,21 @@ setFieldOrder const result = await db.mutation.setFieldOrder({ input: { fieldIds: '' } }).execute(); ``` +### `db.mutation.provisionCheckConstraint` + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +- **Type:** mutation +- **Arguments:** + + | Argument | Type | + |----------|------| + | `input` | ProvisionCheckConstraintInput (required) | + +```typescript +const result = await db.mutation.provisionCheckConstraint({ input: { databaseId: '', tableId: '', definition: '' } }).execute(); +``` + ### `db.mutation.provisionUniqueConstraint` Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. diff --git a/sdk/constructive-react/src/public/orm/client.ts b/sdk/constructive-react/src/public/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-react/src/public/orm/client.ts +++ b/sdk/constructive-react/src/public/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-react/src/public/orm/input-types.ts b/sdk/constructive-react/src/public/orm/input-types.ts index 262babe2e..5bdd88600 100644 --- a/sdk/constructive-react/src/public/orm/input-types.ts +++ b/sdk/constructive-react/src/public/orm/input-types.ts @@ -1043,6 +1043,8 @@ export interface ApiSetting { enableLtree?: boolean | null; /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ enableLlm?: boolean | null; + /** Override: enable realtime subscriptions (NULL = inherit from database_settings) */ + enableRealtime?: boolean | null; /** Extensible JSON for additional per-API settings that do not have dedicated columns */ options?: Record | null; } @@ -2665,6 +2667,8 @@ export interface DatabaseSetting { enableLtree?: boolean | null; /** Enable LLM/AI integration features in the GraphQL API */ enableLlm?: boolean | null; + /** Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API */ + enableRealtime?: boolean | null; /** Extensible JSON for additional settings that do not have dedicated columns */ options?: Record | null; } @@ -5585,6 +5589,7 @@ export type ApiSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; api?: { select: ApiSelect; @@ -7485,6 +7490,7 @@ export type DatabaseSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; database?: { select: DatabaseSelect; @@ -10228,6 +10234,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -13364,6 +13372,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -15279,6 +15289,8 @@ export type ApiSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type ConnectedAccountsModuleOrderBy = @@ -17365,6 +17377,8 @@ export type DatabaseSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type PlansModuleOrderBy = @@ -19256,6 +19270,7 @@ export interface CreateApiSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -19271,6 +19286,7 @@ export interface ApiSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateApiSettingInput { @@ -22137,6 +22153,7 @@ export interface CreateDatabaseSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -22151,6 +22168,7 @@ export interface DatabaseSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateDatabaseSettingInput { @@ -22930,6 +22948,12 @@ export interface SetFieldOrderInput { clientMutationId?: string; fieldIds?: string[]; } +export interface ProvisionCheckConstraintInput { + clientMutationId?: string; + databaseId?: string; + tableId?: string; + definition?: Record; +} export interface ProvisionUniqueConstraintInput { clientMutationId?: string; databaseId?: string; @@ -26569,6 +26593,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -30403,6 +30429,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -31442,6 +31470,12 @@ export interface SetFieldOrderPayload { export type SetFieldOrderPayloadSelect = { clientMutationId?: boolean; }; +export interface ProvisionCheckConstraintPayload { + clientMutationId?: string | null; +} +export type ProvisionCheckConstraintPayloadSelect = { + clientMutationId?: boolean; +}; export interface ProvisionUniqueConstraintPayload { clientMutationId?: string | null; } diff --git a/sdk/constructive-react/src/public/orm/mutation/index.ts b/sdk/constructive-react/src/public/orm/mutation/index.ts index 24af7c323..89ed2f871 100644 --- a/sdk/constructive-react/src/public/orm/mutation/index.ts +++ b/sdk/constructive-react/src/public/orm/mutation/index.ts @@ -33,6 +33,7 @@ import type { ProvisionSpatialRelationInput, BootstrapUserInput, SetFieldOrderInput, + ProvisionCheckConstraintInput, ProvisionUniqueConstraintInput, ProvisionFullTextSearchInput, ProvisionIndexInput, @@ -81,6 +82,7 @@ import type { ProvisionSpatialRelationPayload, BootstrapUserPayload, SetFieldOrderPayload, + ProvisionCheckConstraintPayload, ProvisionUniqueConstraintPayload, ProvisionFullTextSearchPayload, ProvisionIndexPayload, @@ -129,6 +131,7 @@ import type { ProvisionSpatialRelationPayloadSelect, BootstrapUserPayloadSelect, SetFieldOrderPayloadSelect, + ProvisionCheckConstraintPayloadSelect, ProvisionUniqueConstraintPayloadSelect, ProvisionFullTextSearchPayloadSelect, ProvisionIndexPayloadSelect, @@ -209,7 +212,7 @@ export interface InitEmptyRepoVariables { } /** * Variables for constructBlueprint - * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. + * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. */ export interface ConstructBlueprintVariables { input: ConstructBlueprintInput; @@ -243,6 +246,13 @@ export interface BootstrapUserVariables { export interface SetFieldOrderVariables { input: SetFieldOrderInput; } +/** + * Variables for provisionCheckConstraint + * Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + */ +export interface ProvisionCheckConstraintVariables { + input: ProvisionCheckConstraintInput; +} /** * Variables for provisionUniqueConstraint * Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. @@ -1111,6 +1121,35 @@ export function createMutationOperations(client: OrmClient) { 'SetFieldOrderPayload' ), }), + provisionCheckConstraint: ( + args: ProvisionCheckConstraintVariables, + options: { + select: S; + } & StrictSelect + ) => + new QueryBuilder<{ + provisionCheckConstraint: InferSelectResult | null; + }>({ + client, + operation: 'mutation', + operationName: 'ProvisionCheckConstraint', + fieldName: 'provisionCheckConstraint', + ...buildCustomDocument( + 'mutation', + 'ProvisionCheckConstraint', + 'provisionCheckConstraint', + options.select, + args, + [ + { + name: 'input', + type: 'ProvisionCheckConstraintInput!', + }, + ], + connectionFieldsMap, + 'ProvisionCheckConstraintPayload' + ), + }), provisionUniqueConstraint: ( args: ProvisionUniqueConstraintVariables, options: { diff --git a/sdk/constructive-react/src/public/schema-types.ts b/sdk/constructive-react/src/public/schema-types.ts index 687d71486..c18af5b19 100644 --- a/sdk/constructive-react/src/public/schema-types.ts +++ b/sdk/constructive-react/src/public/schema-types.ts @@ -1264,6 +1264,8 @@ export type ApiSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; /** Methods to use when ordering `ConnectedAccountsModule`. */ @@ -3531,6 +3533,8 @@ export type DatabaseSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; /** Methods to use when ordering `PlansModule`. */ @@ -8674,6 +8678,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -9120,6 +9126,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -12142,6 +12150,12 @@ export interface SetFieldOrderInput { clientMutationId?: string; fieldIds?: string[]; } +export interface ProvisionCheckConstraintInput { + clientMutationId?: string; + databaseId?: string; + tableId?: string; + definition?: unknown; +} export interface ProvisionUniqueConstraintInput { clientMutationId?: string; databaseId?: string; @@ -13883,38 +13897,6 @@ export interface AppLevelInput { createdAt?: string; updatedAt?: string; } -export interface CreateDatabaseSettingInput { - clientMutationId?: string; - /** The `DatabaseSetting` to be created by this mutation. */ - databaseSetting: DatabaseSettingInput; -} -/** An input for mutations affecting `DatabaseSetting` */ -export interface DatabaseSettingInput { - /** Unique identifier for this settings record */ - id?: string; - /** Reference to the metaschema database these settings apply to */ - databaseId: string; - /** Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API */ - enableAggregates?: boolean; - /** Enable PostGIS spatial types and operators in the GraphQL API */ - enablePostgis?: boolean; - /** Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API */ - enableSearch?: boolean; - /** Enable direct (multipart) file upload mutations in the GraphQL API */ - enableDirectUploads?: boolean; - /** Enable presigned URL upload flow for S3/MinIO storage */ - enablePresignedUploads?: boolean; - /** Enable many-to-many relationship queries in the GraphQL API */ - enableManyToMany?: boolean; - /** Enable connection filter (where argument) in the GraphQL API */ - enableConnectionFilter?: boolean; - /** Enable ltree hierarchical data type support in the GraphQL API */ - enableLtree?: boolean; - /** Enable LLM/AI integration features in the GraphQL API */ - enableLlm?: boolean; - /** Extensible JSON for additional settings that do not have dedicated columns */ - options?: unknown; -} export interface CreateBlueprintInput { clientMutationId?: string; /** The `Blueprint` to be created by this mutation. */ @@ -13987,38 +13969,38 @@ export interface RealtimeModuleInput { partitionInterval?: string; notifyChannel?: string; } -export interface CreateApiSettingInput { +export interface CreateDatabaseSettingInput { clientMutationId?: string; - /** The `ApiSetting` to be created by this mutation. */ - apiSetting: ApiSettingInput; + /** The `DatabaseSetting` to be created by this mutation. */ + databaseSetting: DatabaseSettingInput; } -/** An input for mutations affecting `ApiSetting` */ -export interface ApiSettingInput { - /** Unique identifier for this API settings record */ +/** An input for mutations affecting `DatabaseSetting` */ +export interface DatabaseSettingInput { + /** Unique identifier for this settings record */ id?: string; - /** Reference to the metaschema database */ + /** Reference to the metaschema database these settings apply to */ databaseId: string; - /** API these settings override for */ - apiId: string; - /** Override: enable aggregate queries (NULL = inherit from database_settings) */ + /** Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API */ enableAggregates?: boolean; - /** Override: enable PostGIS spatial types (NULL = inherit from database_settings) */ + /** Enable PostGIS spatial types and operators in the GraphQL API */ enablePostgis?: boolean; - /** Override: enable unified search (NULL = inherit from database_settings) */ + /** Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API */ enableSearch?: boolean; - /** Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) */ + /** Enable direct (multipart) file upload mutations in the GraphQL API */ enableDirectUploads?: boolean; - /** Override: enable presigned URL upload flow (NULL = inherit from database_settings) */ + /** Enable presigned URL upload flow for S3/MinIO storage */ enablePresignedUploads?: boolean; - /** Override: enable many-to-many relationships (NULL = inherit from database_settings) */ + /** Enable many-to-many relationship queries in the GraphQL API */ enableManyToMany?: boolean; - /** Override: enable connection filter (NULL = inherit from database_settings) */ + /** Enable connection filter (where argument) in the GraphQL API */ enableConnectionFilter?: boolean; - /** Override: enable ltree hierarchical data type (NULL = inherit from database_settings) */ + /** Enable ltree hierarchical data type support in the GraphQL API */ enableLtree?: boolean; - /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ + /** Enable LLM/AI integration features in the GraphQL API */ enableLlm?: boolean; - /** Extensible JSON for additional per-API settings that do not have dedicated columns */ + /** Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API */ + enableRealtime?: boolean; + /** Extensible JSON for additional settings that do not have dedicated columns */ options?: unknown; } export interface CreatePlansModuleInput { @@ -14141,6 +14123,42 @@ export interface DatabaseTransferInput { updatedAt?: string; completedAt?: string; } +export interface CreateApiSettingInput { + clientMutationId?: string; + /** The `ApiSetting` to be created by this mutation. */ + apiSetting: ApiSettingInput; +} +/** An input for mutations affecting `ApiSetting` */ +export interface ApiSettingInput { + /** Unique identifier for this API settings record */ + id?: string; + /** Reference to the metaschema database */ + databaseId: string; + /** API these settings override for */ + apiId: string; + /** Override: enable aggregate queries (NULL = inherit from database_settings) */ + enableAggregates?: boolean; + /** Override: enable PostGIS spatial types (NULL = inherit from database_settings) */ + enablePostgis?: boolean; + /** Override: enable unified search (NULL = inherit from database_settings) */ + enableSearch?: boolean; + /** Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) */ + enableDirectUploads?: boolean; + /** Override: enable presigned URL upload flow (NULL = inherit from database_settings) */ + enablePresignedUploads?: boolean; + /** Override: enable many-to-many relationships (NULL = inherit from database_settings) */ + enableManyToMany?: boolean; + /** Override: enable connection filter (NULL = inherit from database_settings) */ + enableConnectionFilter?: boolean; + /** Override: enable ltree hierarchical data type (NULL = inherit from database_settings) */ + enableLtree?: boolean; + /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ + enableLlm?: boolean; + /** Override: enable realtime subscriptions (NULL = inherit from database_settings) */ + enableRealtime?: boolean; + /** Extensible JSON for additional per-API settings that do not have dedicated columns */ + options?: unknown; +} export interface CreateBillingModuleInput { clientMutationId?: string; /** The `BillingModule` to be created by this mutation. */ @@ -17295,40 +17313,6 @@ export interface AppLevelPatch { /** Upload for Badge or icon image associated with this level */ imageUpload?: File; } -export interface UpdateDatabaseSettingInput { - clientMutationId?: string; - /** Unique identifier for this settings record */ - id: string; - /** An object where the defined keys will be set on the `DatabaseSetting` being updated. */ - databaseSettingPatch: DatabaseSettingPatch; -} -/** Represents an update to a `DatabaseSetting`. Fields that are set will be updated. */ -export interface DatabaseSettingPatch { - /** Unique identifier for this settings record */ - id?: string; - /** Reference to the metaschema database these settings apply to */ - databaseId?: string; - /** Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API */ - enableAggregates?: boolean; - /** Enable PostGIS spatial types and operators in the GraphQL API */ - enablePostgis?: boolean; - /** Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API */ - enableSearch?: boolean; - /** Enable direct (multipart) file upload mutations in the GraphQL API */ - enableDirectUploads?: boolean; - /** Enable presigned URL upload flow for S3/MinIO storage */ - enablePresignedUploads?: boolean; - /** Enable many-to-many relationship queries in the GraphQL API */ - enableManyToMany?: boolean; - /** Enable connection filter (where argument) in the GraphQL API */ - enableConnectionFilter?: boolean; - /** Enable ltree hierarchical data type support in the GraphQL API */ - enableLtree?: boolean; - /** Enable LLM/AI integration features in the GraphQL API */ - enableLlm?: boolean; - /** Extensible JSON for additional settings that do not have dedicated columns */ - options?: unknown; -} export interface UpdateBlueprintInput { clientMutationId?: string; /** Unique identifier for this blueprint. */ @@ -17405,40 +17389,40 @@ export interface RealtimeModulePatch { partitionInterval?: string; notifyChannel?: string; } -export interface UpdateApiSettingInput { +export interface UpdateDatabaseSettingInput { clientMutationId?: string; - /** Unique identifier for this API settings record */ + /** Unique identifier for this settings record */ id: string; - /** An object where the defined keys will be set on the `ApiSetting` being updated. */ - apiSettingPatch: ApiSettingPatch; + /** An object where the defined keys will be set on the `DatabaseSetting` being updated. */ + databaseSettingPatch: DatabaseSettingPatch; } -/** Represents an update to a `ApiSetting`. Fields that are set will be updated. */ -export interface ApiSettingPatch { - /** Unique identifier for this API settings record */ +/** Represents an update to a `DatabaseSetting`. Fields that are set will be updated. */ +export interface DatabaseSettingPatch { + /** Unique identifier for this settings record */ id?: string; - /** Reference to the metaschema database */ + /** Reference to the metaschema database these settings apply to */ databaseId?: string; - /** API these settings override for */ - apiId?: string; - /** Override: enable aggregate queries (NULL = inherit from database_settings) */ + /** Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API */ enableAggregates?: boolean; - /** Override: enable PostGIS spatial types (NULL = inherit from database_settings) */ + /** Enable PostGIS spatial types and operators in the GraphQL API */ enablePostgis?: boolean; - /** Override: enable unified search (NULL = inherit from database_settings) */ + /** Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API */ enableSearch?: boolean; - /** Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) */ + /** Enable direct (multipart) file upload mutations in the GraphQL API */ enableDirectUploads?: boolean; - /** Override: enable presigned URL upload flow (NULL = inherit from database_settings) */ + /** Enable presigned URL upload flow for S3/MinIO storage */ enablePresignedUploads?: boolean; - /** Override: enable many-to-many relationships (NULL = inherit from database_settings) */ + /** Enable many-to-many relationship queries in the GraphQL API */ enableManyToMany?: boolean; - /** Override: enable connection filter (NULL = inherit from database_settings) */ + /** Enable connection filter (where argument) in the GraphQL API */ enableConnectionFilter?: boolean; - /** Override: enable ltree hierarchical data type (NULL = inherit from database_settings) */ + /** Enable ltree hierarchical data type support in the GraphQL API */ enableLtree?: boolean; - /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ + /** Enable LLM/AI integration features in the GraphQL API */ enableLlm?: boolean; - /** Extensible JSON for additional per-API settings that do not have dedicated columns */ + /** Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API */ + enableRealtime?: boolean; + /** Extensible JSON for additional settings that do not have dedicated columns */ options?: unknown; } export interface UpdatePlansModuleInput { @@ -17546,6 +17530,44 @@ export interface DatabaseTransferPatch { updatedAt?: string; completedAt?: string; } +export interface UpdateApiSettingInput { + clientMutationId?: string; + /** Unique identifier for this API settings record */ + id: string; + /** An object where the defined keys will be set on the `ApiSetting` being updated. */ + apiSettingPatch: ApiSettingPatch; +} +/** Represents an update to a `ApiSetting`. Fields that are set will be updated. */ +export interface ApiSettingPatch { + /** Unique identifier for this API settings record */ + id?: string; + /** Reference to the metaschema database */ + databaseId?: string; + /** API these settings override for */ + apiId?: string; + /** Override: enable aggregate queries (NULL = inherit from database_settings) */ + enableAggregates?: boolean; + /** Override: enable PostGIS spatial types (NULL = inherit from database_settings) */ + enablePostgis?: boolean; + /** Override: enable unified search (NULL = inherit from database_settings) */ + enableSearch?: boolean; + /** Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) */ + enableDirectUploads?: boolean; + /** Override: enable presigned URL upload flow (NULL = inherit from database_settings) */ + enablePresignedUploads?: boolean; + /** Override: enable many-to-many relationships (NULL = inherit from database_settings) */ + enableManyToMany?: boolean; + /** Override: enable connection filter (NULL = inherit from database_settings) */ + enableConnectionFilter?: boolean; + /** Override: enable ltree hierarchical data type (NULL = inherit from database_settings) */ + enableLtree?: boolean; + /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ + enableLlm?: boolean; + /** Override: enable realtime subscriptions (NULL = inherit from database_settings) */ + enableRealtime?: boolean; + /** Extensible JSON for additional per-API settings that do not have dedicated columns */ + options?: unknown; +} export interface UpdateBillingModuleInput { clientMutationId?: string; id: string; @@ -19520,11 +19542,6 @@ export interface DeleteAppLevelInput { clientMutationId?: string; id: string; } -export interface DeleteDatabaseSettingInput { - clientMutationId?: string; - /** Unique identifier for this settings record */ - id: string; -} export interface DeleteBlueprintInput { clientMutationId?: string; /** Unique identifier for this blueprint. */ @@ -19538,9 +19555,9 @@ export interface DeleteRealtimeModuleInput { clientMutationId?: string; id: string; } -export interface DeleteApiSettingInput { +export interface DeleteDatabaseSettingInput { clientMutationId?: string; - /** Unique identifier for this API settings record */ + /** Unique identifier for this settings record */ id: string; } export interface DeletePlansModuleInput { @@ -19559,6 +19576,11 @@ export interface DeleteDatabaseTransferInput { clientMutationId?: string; id: string; } +export interface DeleteApiSettingInput { + clientMutationId?: string; + /** Unique identifier for this API settings record */ + id: string; +} export interface DeleteBillingModuleInput { clientMutationId?: string; id: string; @@ -20406,13 +20428,6 @@ export interface AppLevelConnection { pageInfo: PageInfo; totalCount: number; } -/** A connection to a list of `DatabaseSetting` values. */ -export interface DatabaseSettingConnection { - nodes: DatabaseSetting[]; - edges: DatabaseSettingEdge[]; - pageInfo: PageInfo; - totalCount: number; -} /** A connection to a list of `Blueprint` values. */ export interface BlueprintConnection { nodes: Blueprint[]; @@ -20434,10 +20449,10 @@ export interface RealtimeModuleConnection { pageInfo: PageInfo; totalCount: number; } -/** A connection to a list of `ApiSetting` values. */ -export interface ApiSettingConnection { - nodes: ApiSetting[]; - edges: ApiSettingEdge[]; +/** A connection to a list of `DatabaseSetting` values. */ +export interface DatabaseSettingConnection { + nodes: DatabaseSetting[]; + edges: DatabaseSettingEdge[]; pageInfo: PageInfo; totalCount: number; } @@ -20476,6 +20491,13 @@ export interface DatabaseTransferConnection { pageInfo: PageInfo; totalCount: number; } +/** A connection to a list of `ApiSetting` values. */ +export interface ApiSettingConnection { + nodes: ApiSetting[]; + edges: ApiSettingEdge[]; + pageInfo: PageInfo; + totalCount: number; +} /** A connection to a list of `BillingModule` values. */ export interface BillingModuleConnection { nodes: BillingModule[]; @@ -20901,6 +20923,9 @@ export interface BootstrapUserPayload { export interface SetFieldOrderPayload { clientMutationId?: string | null; } +export interface ProvisionCheckConstraintPayload { + clientMutationId?: string | null; +} export interface ProvisionUniqueConstraintPayload { clientMutationId?: string | null; } @@ -21517,12 +21542,6 @@ export interface CreateAppLevelPayload { appLevel?: AppLevel | null; appLevelEdge?: AppLevelEdge | null; } -export interface CreateDatabaseSettingPayload { - clientMutationId?: string | null; - /** The `DatabaseSetting` that was created by this mutation. */ - databaseSetting?: DatabaseSetting | null; - databaseSettingEdge?: DatabaseSettingEdge | null; -} export interface CreateBlueprintPayload { clientMutationId?: string | null; /** The `Blueprint` that was created by this mutation. */ @@ -21541,11 +21560,11 @@ export interface CreateRealtimeModulePayload { realtimeModule?: RealtimeModule | null; realtimeModuleEdge?: RealtimeModuleEdge | null; } -export interface CreateApiSettingPayload { +export interface CreateDatabaseSettingPayload { clientMutationId?: string | null; - /** The `ApiSetting` that was created by this mutation. */ - apiSetting?: ApiSetting | null; - apiSettingEdge?: ApiSettingEdge | null; + /** The `DatabaseSetting` that was created by this mutation. */ + databaseSetting?: DatabaseSetting | null; + databaseSettingEdge?: DatabaseSettingEdge | null; } export interface CreatePlansModulePayload { clientMutationId?: string | null; @@ -21576,6 +21595,12 @@ export interface CreateDatabaseTransferPayload { databaseTransfer?: DatabaseTransfer | null; databaseTransferEdge?: DatabaseTransferEdge | null; } +export interface CreateApiSettingPayload { + clientMutationId?: string | null; + /** The `ApiSetting` that was created by this mutation. */ + apiSetting?: ApiSetting | null; + apiSettingEdge?: ApiSettingEdge | null; +} export interface CreateBillingModulePayload { clientMutationId?: string | null; /** The `BillingModule` that was created by this mutation. */ @@ -22361,12 +22386,6 @@ export interface UpdateAppLevelPayload { appLevel?: AppLevel | null; appLevelEdge?: AppLevelEdge | null; } -export interface UpdateDatabaseSettingPayload { - clientMutationId?: string | null; - /** The `DatabaseSetting` that was updated by this mutation. */ - databaseSetting?: DatabaseSetting | null; - databaseSettingEdge?: DatabaseSettingEdge | null; -} export interface UpdateBlueprintPayload { clientMutationId?: string | null; /** The `Blueprint` that was updated by this mutation. */ @@ -22385,11 +22404,11 @@ export interface UpdateRealtimeModulePayload { realtimeModule?: RealtimeModule | null; realtimeModuleEdge?: RealtimeModuleEdge | null; } -export interface UpdateApiSettingPayload { +export interface UpdateDatabaseSettingPayload { clientMutationId?: string | null; - /** The `ApiSetting` that was updated by this mutation. */ - apiSetting?: ApiSetting | null; - apiSettingEdge?: ApiSettingEdge | null; + /** The `DatabaseSetting` that was updated by this mutation. */ + databaseSetting?: DatabaseSetting | null; + databaseSettingEdge?: DatabaseSettingEdge | null; } export interface UpdatePlansModulePayload { clientMutationId?: string | null; @@ -22415,6 +22434,12 @@ export interface UpdateDatabaseTransferPayload { databaseTransfer?: DatabaseTransfer | null; databaseTransferEdge?: DatabaseTransferEdge | null; } +export interface UpdateApiSettingPayload { + clientMutationId?: string | null; + /** The `ApiSetting` that was updated by this mutation. */ + apiSetting?: ApiSetting | null; + apiSettingEdge?: ApiSettingEdge | null; +} export interface UpdateBillingModulePayload { clientMutationId?: string | null; /** The `BillingModule` that was updated by this mutation. */ @@ -23195,12 +23220,6 @@ export interface DeleteAppLevelPayload { appLevel?: AppLevel | null; appLevelEdge?: AppLevelEdge | null; } -export interface DeleteDatabaseSettingPayload { - clientMutationId?: string | null; - /** The `DatabaseSetting` that was deleted by this mutation. */ - databaseSetting?: DatabaseSetting | null; - databaseSettingEdge?: DatabaseSettingEdge | null; -} export interface DeleteBlueprintPayload { clientMutationId?: string | null; /** The `Blueprint` that was deleted by this mutation. */ @@ -23219,11 +23238,11 @@ export interface DeleteRealtimeModulePayload { realtimeModule?: RealtimeModule | null; realtimeModuleEdge?: RealtimeModuleEdge | null; } -export interface DeleteApiSettingPayload { +export interface DeleteDatabaseSettingPayload { clientMutationId?: string | null; - /** The `ApiSetting` that was deleted by this mutation. */ - apiSetting?: ApiSetting | null; - apiSettingEdge?: ApiSettingEdge | null; + /** The `DatabaseSetting` that was deleted by this mutation. */ + databaseSetting?: DatabaseSetting | null; + databaseSettingEdge?: DatabaseSettingEdge | null; } export interface DeletePlansModulePayload { clientMutationId?: string | null; @@ -23249,6 +23268,12 @@ export interface DeleteDatabaseTransferPayload { databaseTransfer?: DatabaseTransfer | null; databaseTransferEdge?: DatabaseTransferEdge | null; } +export interface DeleteApiSettingPayload { + clientMutationId?: string | null; + /** The `ApiSetting` that was deleted by this mutation. */ + apiSetting?: ApiSetting | null; + apiSettingEdge?: ApiSettingEdge | null; +} export interface DeleteBillingModulePayload { clientMutationId?: string | null; /** The `BillingModule` that was deleted by this mutation. */ @@ -24102,12 +24127,6 @@ export interface AppLevelEdge { /** The `AppLevel` at the end of the edge. */ node?: AppLevel | null; } -/** A `DatabaseSetting` edge in the connection. */ -export interface DatabaseSettingEdge { - cursor?: string | null; - /** The `DatabaseSetting` at the end of the edge. */ - node?: DatabaseSetting | null; -} /** A `Blueprint` edge in the connection. */ export interface BlueprintEdge { cursor?: string | null; @@ -24126,11 +24145,11 @@ export interface RealtimeModuleEdge { /** The `RealtimeModule` at the end of the edge. */ node?: RealtimeModule | null; } -/** A `ApiSetting` edge in the connection. */ -export interface ApiSettingEdge { +/** A `DatabaseSetting` edge in the connection. */ +export interface DatabaseSettingEdge { cursor?: string | null; - /** The `ApiSetting` at the end of the edge. */ - node?: ApiSetting | null; + /** The `DatabaseSetting` at the end of the edge. */ + node?: DatabaseSetting | null; } /** A `PlansModule` edge in the connection. */ export interface PlansModuleEdge { @@ -24162,6 +24181,12 @@ export interface DatabaseTransferEdge { /** The `DatabaseTransfer` at the end of the edge. */ node?: DatabaseTransfer | null; } +/** A `ApiSetting` edge in the connection. */ +export interface ApiSettingEdge { + cursor?: string | null; + /** The `ApiSetting` at the end of the edge. */ + node?: ApiSetting | null; +} /** A `BillingModule` edge in the connection. */ export interface BillingModuleEdge { cursor?: string | null; diff --git a/sdk/constructive-react/src/public/types.ts b/sdk/constructive-react/src/public/types.ts index ac091c912..e8f76dc90 100644 --- a/sdk/constructive-react/src/public/types.ts +++ b/sdk/constructive-react/src/public/types.ts @@ -588,6 +588,7 @@ export interface ApiSetting { enableConnectionFilter: boolean | null; enableLtree: boolean | null; enableLlm: boolean | null; + enableRealtime: boolean | null; options: unknown | null; } export interface ConnectedAccountsModule { @@ -1636,6 +1637,7 @@ export interface DatabaseSetting { enableConnectionFilter: boolean | null; enableLtree: boolean | null; enableLlm: boolean | null; + enableRealtime: boolean | null; options: unknown | null; } export interface PlansModule { diff --git a/sdk/constructive-sdk/schemas/public.graphql b/sdk/constructive-sdk/schemas/public.graphql index ee8fc4562..527384184 100644 --- a/sdk/constructive-sdk/schemas/public.graphql +++ b/sdk/constructive-sdk/schemas/public.graphql @@ -2796,35 +2796,6 @@ type Query { orderBy: [AppLevelOrderBy!] = [PRIMARY_KEY_ASC] ): AppLevelConnection - """Reads and enables pagination through a set of `DatabaseSetting`.""" - databaseSettings( - """Only read the first `n` values of the set.""" - first: Int - - """Only read the last `n` values of the set.""" - last: Int - - """ - Skip the first `n` values from our `after` cursor, an alternative to cursor - based pagination. May not be used with `last`. - """ - offset: Int - - """Read all values in the set before (above) this cursor.""" - before: Cursor - - """Read all values in the set after (below) this cursor.""" - after: Cursor - - """ - A filter to be used in determining which values should be returned by the collection. - """ - where: DatabaseSettingFilter - - """The method to use when ordering `DatabaseSetting`.""" - orderBy: [DatabaseSettingOrderBy!] = [PRIMARY_KEY_ASC] - ): DatabaseSettingConnection - """Reads and enables pagination through a set of `Blueprint`.""" blueprints( """Only read the first `n` values of the set.""" @@ -2914,8 +2885,8 @@ type Query { orderBy: [RealtimeModuleOrderBy!] = [PRIMARY_KEY_ASC] ): RealtimeModuleConnection - """Reads and enables pagination through a set of `ApiSetting`.""" - apiSettings( + """Reads and enables pagination through a set of `DatabaseSetting`.""" + databaseSettings( """Only read the first `n` values of the set.""" first: Int @@ -2937,11 +2908,11 @@ type Query { """ A filter to be used in determining which values should be returned by the collection. """ - where: ApiSettingFilter + where: DatabaseSettingFilter - """The method to use when ordering `ApiSetting`.""" - orderBy: [ApiSettingOrderBy!] = [PRIMARY_KEY_ASC] - ): ApiSettingConnection + """The method to use when ordering `DatabaseSetting`.""" + orderBy: [DatabaseSettingOrderBy!] = [PRIMARY_KEY_ASC] + ): DatabaseSettingConnection """Reads and enables pagination through a set of `PlansModule`.""" plansModules( @@ -3088,6 +3059,35 @@ type Query { orderBy: [DatabaseTransferOrderBy!] = [PRIMARY_KEY_ASC] ): DatabaseTransferConnection + """Reads and enables pagination through a set of `ApiSetting`.""" + apiSettings( + """Only read the first `n` values of the set.""" + first: Int + + """Only read the last `n` values of the set.""" + last: Int + + """ + Skip the first `n` values from our `after` cursor, an alternative to cursor + based pagination. May not be used with `last`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """ + A filter to be used in determining which values should be returned by the collection. + """ + where: ApiSettingFilter + + """The method to use when ordering `ApiSetting`.""" + orderBy: [ApiSettingOrderBy!] = [PRIMARY_KEY_ASC] + ): ApiSettingConnection + """Reads and enables pagination through a set of `BillingModule`.""" billingModules( """Only read the first `n` values of the set.""" @@ -17885,6 +17885,9 @@ input ApiSettingFilter { """Filter by the object’s `enableLlm` field.""" enableLlm: BooleanFilter + """Filter by the object’s `enableRealtime` field.""" + enableRealtime: BooleanFilter + """Filter by the object’s `options` field.""" options: JSONFilter @@ -18574,6 +18577,9 @@ input DatabaseSettingFilter { """Filter by the object’s `enableLlm` field.""" enableLlm: BooleanFilter + """Filter by the object’s `enableRealtime` field.""" + enableRealtime: BooleanFilter + """Filter by the object’s `options` field.""" options: JSONFilter @@ -25518,6 +25524,11 @@ type ApiSetting { """ enableLlm: Boolean + """ + Override: enable realtime subscriptions (NULL = inherit from database_settings) + """ + enableRealtime: Boolean + """ Extensible JSON for additional per-API settings that do not have dedicated columns """ @@ -25977,6 +25988,11 @@ type DatabaseSetting { """Enable LLM/AI integration features in the GraphQL API""" enableLlm: Boolean! + """ + Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API + """ + enableRealtime: Boolean! + """ Extensible JSON for additional settings that do not have dedicated columns """ @@ -26041,6 +26057,8 @@ enum ApiSettingOrderBy { ENABLE_LTREE_DESC ENABLE_LLM_ASC ENABLE_LLM_DESC + ENABLE_REALTIME_ASC + ENABLE_REALTIME_DESC OPTIONS_ASC OPTIONS_DESC } @@ -35573,6 +35591,8 @@ enum DatabaseSettingOrderBy { ENABLE_LTREE_DESC ENABLE_LLM_ASC ENABLE_LLM_DESC + ENABLE_REALTIME_ASC + ENABLE_REALTIME_DESC OPTIONS_ASC OPTIONS_DESC } @@ -36614,7 +36634,7 @@ type Mutation { ): InitEmptyRepoPayload """ - Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. + Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. """ constructBlueprint( """ @@ -36673,6 +36693,16 @@ type Mutation { input: SetFieldOrderInput! ): SetFieldOrderPayload + """ + Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + """ + provisionCheckConstraint( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: ProvisionCheckConstraintInput! + ): ProvisionCheckConstraintPayload + """ Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. """ @@ -37541,14 +37571,6 @@ type Mutation { input: CreateAppLevelInput! ): CreateAppLevelPayload - """Creates a single `DatabaseSetting`.""" - createDatabaseSetting( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateDatabaseSettingInput! - ): CreateDatabaseSettingPayload - """Creates a single `Blueprint`.""" createBlueprint( """ @@ -37573,13 +37595,13 @@ type Mutation { input: CreateRealtimeModuleInput! ): CreateRealtimeModulePayload - """Creates a single `ApiSetting`.""" - createApiSetting( + """Creates a single `DatabaseSetting`.""" + createDatabaseSetting( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ - input: CreateApiSettingInput! - ): CreateApiSettingPayload + input: CreateDatabaseSettingInput! + ): CreateDatabaseSettingPayload """Creates a single `PlansModule`.""" createPlansModule( @@ -37621,6 +37643,14 @@ type Mutation { input: CreateDatabaseTransferInput! ): CreateDatabaseTransferPayload + """Creates a single `ApiSetting`.""" + createApiSetting( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateApiSettingInput! + ): CreateApiSettingPayload + """Creates a single `BillingModule`.""" createBillingModule( """ @@ -38697,14 +38727,6 @@ type Mutation { input: UpdateAppLevelInput! ): UpdateAppLevelPayload - """Updates a single `DatabaseSetting` using a unique key and a patch.""" - updateDatabaseSetting( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateDatabaseSettingInput! - ): UpdateDatabaseSettingPayload - """Updates a single `Blueprint` using a unique key and a patch.""" updateBlueprint( """ @@ -38731,13 +38753,13 @@ type Mutation { input: UpdateRealtimeModuleInput! ): UpdateRealtimeModulePayload - """Updates a single `ApiSetting` using a unique key and a patch.""" - updateApiSetting( + """Updates a single `DatabaseSetting` using a unique key and a patch.""" + updateDatabaseSetting( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ - input: UpdateApiSettingInput! - ): UpdateApiSettingPayload + input: UpdateDatabaseSettingInput! + ): UpdateDatabaseSettingPayload """Updates a single `PlansModule` using a unique key and a patch.""" updatePlansModule( @@ -38771,6 +38793,14 @@ type Mutation { input: UpdateDatabaseTransferInput! ): UpdateDatabaseTransferPayload + """Updates a single `ApiSetting` using a unique key and a patch.""" + updateApiSetting( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateApiSettingInput! + ): UpdateApiSettingPayload + """Updates a single `BillingModule` using a unique key and a patch.""" updateBillingModule( """ @@ -39823,14 +39853,6 @@ type Mutation { input: DeleteAppLevelInput! ): DeleteAppLevelPayload - """Deletes a single `DatabaseSetting` using a unique key.""" - deleteDatabaseSetting( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteDatabaseSettingInput! - ): DeleteDatabaseSettingPayload - """Deletes a single `Blueprint` using a unique key.""" deleteBlueprint( """ @@ -39855,13 +39877,13 @@ type Mutation { input: DeleteRealtimeModuleInput! ): DeleteRealtimeModulePayload - """Deletes a single `ApiSetting` using a unique key.""" - deleteApiSetting( + """Deletes a single `DatabaseSetting` using a unique key.""" + deleteDatabaseSetting( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ - input: DeleteApiSettingInput! - ): DeleteApiSettingPayload + input: DeleteDatabaseSettingInput! + ): DeleteDatabaseSettingPayload """Deletes a single `PlansModule` using a unique key.""" deletePlansModule( @@ -39895,6 +39917,14 @@ type Mutation { input: DeleteDatabaseTransferInput! ): DeleteDatabaseTransferPayload + """Deletes a single `ApiSetting` using a unique key.""" + deleteApiSetting( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteApiSettingInput! + ): DeleteApiSettingPayload + """Deletes a single `BillingModule` using a unique key.""" deleteBillingModule( """ @@ -40951,6 +40981,32 @@ input SetFieldOrderInput { fieldIds: [UUID] } +"""The output of our `provisionCheckConstraint` mutation.""" +type ProvisionCheckConstraintPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query +} + +"""All input for the `provisionCheckConstraint` mutation.""" +input ProvisionCheckConstraintInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + databaseId: UUID + tableId: UUID + definition: JSON +} + """The output of our `provisionUniqueConstraint` mutation.""" type ProvisionUniqueConstraintPayload { """ @@ -46320,84 +46376,6 @@ input AppLevelInput { updatedAt: Datetime } -"""The output of our create `DatabaseSetting` mutation.""" -type CreateDatabaseSettingPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `DatabaseSetting` that was created by this mutation.""" - databaseSetting: DatabaseSetting - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `DatabaseSetting`. May be used by Relay 1.""" - databaseSettingEdge( - """The method to use when ordering `DatabaseSetting`.""" - orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): DatabaseSettingEdge -} - -"""All input for the create `DatabaseSetting` mutation.""" -input CreateDatabaseSettingInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """The `DatabaseSetting` to be created by this mutation.""" - databaseSetting: DatabaseSettingInput! -} - -"""An input for mutations affecting `DatabaseSetting`""" -input DatabaseSettingInput { - """Unique identifier for this settings record""" - id: UUID - - """Reference to the metaschema database these settings apply to""" - databaseId: UUID! - - """Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API""" - enableAggregates: Boolean - - """Enable PostGIS spatial types and operators in the GraphQL API""" - enablePostgis: Boolean - - """ - Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API - """ - enableSearch: Boolean - - """Enable direct (multipart) file upload mutations in the GraphQL API""" - enableDirectUploads: Boolean - - """Enable presigned URL upload flow for S3/MinIO storage""" - enablePresignedUploads: Boolean - - """Enable many-to-many relationship queries in the GraphQL API""" - enableManyToMany: Boolean - - """Enable connection filter (where argument) in the GraphQL API""" - enableConnectionFilter: Boolean - - """Enable ltree hierarchical data type support in the GraphQL API""" - enableLtree: Boolean - - """Enable LLM/AI integration features in the GraphQL API""" - enableLlm: Boolean - - """ - Extensible JSON for additional settings that do not have dedicated columns - """ - options: JSON -} - """The output of our create `Blueprint` mutation.""" type CreateBlueprintPayload { """ @@ -46584,99 +46562,85 @@ input RealtimeModuleInput { notifyChannel: String } -"""The output of our create `ApiSetting` mutation.""" -type CreateApiSettingPayload { +"""The output of our create `DatabaseSetting` mutation.""" +type CreateDatabaseSettingPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The `ApiSetting` that was created by this mutation.""" - apiSetting: ApiSetting + """The `DatabaseSetting` that was created by this mutation.""" + databaseSetting: DatabaseSetting """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our `ApiSetting`. May be used by Relay 1.""" - apiSettingEdge( - """The method to use when ordering `ApiSetting`.""" - orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): ApiSettingEdge + """An edge for our `DatabaseSetting`. May be used by Relay 1.""" + databaseSettingEdge( + """The method to use when ordering `DatabaseSetting`.""" + orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): DatabaseSettingEdge } -"""All input for the create `ApiSetting` mutation.""" -input CreateApiSettingInput { +"""All input for the create `DatabaseSetting` mutation.""" +input CreateDatabaseSettingInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """The `ApiSetting` to be created by this mutation.""" - apiSetting: ApiSettingInput! + """The `DatabaseSetting` to be created by this mutation.""" + databaseSetting: DatabaseSettingInput! } -"""An input for mutations affecting `ApiSetting`""" -input ApiSettingInput { - """Unique identifier for this API settings record""" +"""An input for mutations affecting `DatabaseSetting`""" +input DatabaseSettingInput { + """Unique identifier for this settings record""" id: UUID - """Reference to the metaschema database""" + """Reference to the metaschema database these settings apply to""" databaseId: UUID! - """API these settings override for""" - apiId: UUID! - - """ - Override: enable aggregate queries (NULL = inherit from database_settings) - """ + """Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API""" enableAggregates: Boolean - """ - Override: enable PostGIS spatial types (NULL = inherit from database_settings) - """ + """Enable PostGIS spatial types and operators in the GraphQL API""" enablePostgis: Boolean """ - Override: enable unified search (NULL = inherit from database_settings) + Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API """ enableSearch: Boolean - """ - Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) - """ + """Enable direct (multipart) file upload mutations in the GraphQL API""" enableDirectUploads: Boolean - """ - Override: enable presigned URL upload flow (NULL = inherit from database_settings) - """ + """Enable presigned URL upload flow for S3/MinIO storage""" enablePresignedUploads: Boolean - """ - Override: enable many-to-many relationships (NULL = inherit from database_settings) - """ + """Enable many-to-many relationship queries in the GraphQL API""" enableManyToMany: Boolean - """ - Override: enable connection filter (NULL = inherit from database_settings) - """ + """Enable connection filter (where argument) in the GraphQL API""" enableConnectionFilter: Boolean - """ - Override: enable ltree hierarchical data type (NULL = inherit from database_settings) - """ + """Enable ltree hierarchical data type support in the GraphQL API""" enableLtree: Boolean + """Enable LLM/AI integration features in the GraphQL API""" + enableLlm: Boolean + """ - Override: enable LLM/AI integration features (NULL = inherit from database_settings) + Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API """ - enableLlm: Boolean + enableRealtime: Boolean """ - Extensible JSON for additional per-API settings that do not have dedicated columns + Extensible JSON for additional settings that do not have dedicated columns """ options: JSON } @@ -46982,6 +46946,108 @@ input DatabaseTransferInput { completedAt: Datetime } +"""The output of our create `ApiSetting` mutation.""" +type CreateApiSettingPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `ApiSetting` that was created by this mutation.""" + apiSetting: ApiSetting + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `ApiSetting`. May be used by Relay 1.""" + apiSettingEdge( + """The method to use when ordering `ApiSetting`.""" + orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): ApiSettingEdge +} + +"""All input for the create `ApiSetting` mutation.""" +input CreateApiSettingInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """The `ApiSetting` to be created by this mutation.""" + apiSetting: ApiSettingInput! +} + +"""An input for mutations affecting `ApiSetting`""" +input ApiSettingInput { + """Unique identifier for this API settings record""" + id: UUID + + """Reference to the metaschema database""" + databaseId: UUID! + + """API these settings override for""" + apiId: UUID! + + """ + Override: enable aggregate queries (NULL = inherit from database_settings) + """ + enableAggregates: Boolean + + """ + Override: enable PostGIS spatial types (NULL = inherit from database_settings) + """ + enablePostgis: Boolean + + """ + Override: enable unified search (NULL = inherit from database_settings) + """ + enableSearch: Boolean + + """ + Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) + """ + enableDirectUploads: Boolean + + """ + Override: enable presigned URL upload flow (NULL = inherit from database_settings) + """ + enablePresignedUploads: Boolean + + """ + Override: enable many-to-many relationships (NULL = inherit from database_settings) + """ + enableManyToMany: Boolean + + """ + Override: enable connection filter (NULL = inherit from database_settings) + """ + enableConnectionFilter: Boolean + + """ + Override: enable ltree hierarchical data type (NULL = inherit from database_settings) + """ + enableLtree: Boolean + + """ + Override: enable LLM/AI integration features (NULL = inherit from database_settings) + """ + enableLlm: Boolean + + """ + Override: enable realtime subscriptions (NULL = inherit from database_settings) + """ + enableRealtime: Boolean + + """ + Extensible JSON for additional per-API settings that do not have dedicated columns + """ + options: JSON +} + """The output of our create `BillingModule` mutation.""" type CreateBillingModulePayload { """ @@ -55266,91 +55332,6 @@ input AppLevelPatch { imageUpload: Upload } -"""The output of our update `DatabaseSetting` mutation.""" -type UpdateDatabaseSettingPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `DatabaseSetting` that was updated by this mutation.""" - databaseSetting: DatabaseSetting - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `DatabaseSetting`. May be used by Relay 1.""" - databaseSettingEdge( - """The method to use when ordering `DatabaseSetting`.""" - orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): DatabaseSettingEdge -} - -"""All input for the `updateDatabaseSetting` mutation.""" -input UpdateDatabaseSettingInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """Unique identifier for this settings record""" - id: UUID! - - """ - An object where the defined keys will be set on the `DatabaseSetting` being updated. - """ - databaseSettingPatch: DatabaseSettingPatch! -} - -""" -Represents an update to a `DatabaseSetting`. Fields that are set will be updated. -""" -input DatabaseSettingPatch { - """Unique identifier for this settings record""" - id: UUID - - """Reference to the metaschema database these settings apply to""" - databaseId: UUID - - """Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API""" - enableAggregates: Boolean - - """Enable PostGIS spatial types and operators in the GraphQL API""" - enablePostgis: Boolean - - """ - Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API - """ - enableSearch: Boolean - - """Enable direct (multipart) file upload mutations in the GraphQL API""" - enableDirectUploads: Boolean - - """Enable presigned URL upload flow for S3/MinIO storage""" - enablePresignedUploads: Boolean - - """Enable many-to-many relationship queries in the GraphQL API""" - enableManyToMany: Boolean - - """Enable connection filter (where argument) in the GraphQL API""" - enableConnectionFilter: Boolean - - """Enable ltree hierarchical data type support in the GraphQL API""" - enableLtree: Boolean - - """Enable LLM/AI integration features in the GraphQL API""" - enableLlm: Boolean - - """ - Extensible JSON for additional settings that do not have dedicated columns - """ - options: JSON -} - """The output of our update `Blueprint` mutation.""" type UpdateBlueprintPayload { """ @@ -55554,106 +55535,92 @@ input RealtimeModulePatch { notifyChannel: String } -"""The output of our update `ApiSetting` mutation.""" -type UpdateApiSettingPayload { +"""The output of our update `DatabaseSetting` mutation.""" +type UpdateDatabaseSettingPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The `ApiSetting` that was updated by this mutation.""" - apiSetting: ApiSetting + """The `DatabaseSetting` that was updated by this mutation.""" + databaseSetting: DatabaseSetting """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our `ApiSetting`. May be used by Relay 1.""" - apiSettingEdge( - """The method to use when ordering `ApiSetting`.""" - orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): ApiSettingEdge + """An edge for our `DatabaseSetting`. May be used by Relay 1.""" + databaseSettingEdge( + """The method to use when ordering `DatabaseSetting`.""" + orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): DatabaseSettingEdge } -"""All input for the `updateApiSetting` mutation.""" -input UpdateApiSettingInput { +"""All input for the `updateDatabaseSetting` mutation.""" +input UpdateDatabaseSettingInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """Unique identifier for this API settings record""" + """Unique identifier for this settings record""" id: UUID! """ - An object where the defined keys will be set on the `ApiSetting` being updated. + An object where the defined keys will be set on the `DatabaseSetting` being updated. """ - apiSettingPatch: ApiSettingPatch! + databaseSettingPatch: DatabaseSettingPatch! } """ -Represents an update to a `ApiSetting`. Fields that are set will be updated. +Represents an update to a `DatabaseSetting`. Fields that are set will be updated. """ -input ApiSettingPatch { - """Unique identifier for this API settings record""" +input DatabaseSettingPatch { + """Unique identifier for this settings record""" id: UUID - """Reference to the metaschema database""" + """Reference to the metaschema database these settings apply to""" databaseId: UUID - """API these settings override for""" - apiId: UUID - - """ - Override: enable aggregate queries (NULL = inherit from database_settings) - """ + """Enable aggregate queries (sum, avg, min, max, etc.) in the GraphQL API""" enableAggregates: Boolean - """ - Override: enable PostGIS spatial types (NULL = inherit from database_settings) - """ + """Enable PostGIS spatial types and operators in the GraphQL API""" enablePostgis: Boolean """ - Override: enable unified search (NULL = inherit from database_settings) + Enable unified search (tsvector, BM25, pg_trgm, pgvector) in the GraphQL API """ enableSearch: Boolean - """ - Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) - """ + """Enable direct (multipart) file upload mutations in the GraphQL API""" enableDirectUploads: Boolean - """ - Override: enable presigned URL upload flow (NULL = inherit from database_settings) - """ + """Enable presigned URL upload flow for S3/MinIO storage""" enablePresignedUploads: Boolean - """ - Override: enable many-to-many relationships (NULL = inherit from database_settings) - """ + """Enable many-to-many relationship queries in the GraphQL API""" enableManyToMany: Boolean - """ - Override: enable connection filter (NULL = inherit from database_settings) - """ + """Enable connection filter (where argument) in the GraphQL API""" enableConnectionFilter: Boolean - """ - Override: enable ltree hierarchical data type (NULL = inherit from database_settings) - """ + """Enable ltree hierarchical data type support in the GraphQL API""" enableLtree: Boolean + """Enable LLM/AI integration features in the GraphQL API""" + enableLlm: Boolean + """ - Override: enable LLM/AI integration features (NULL = inherit from database_settings) + Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API """ - enableLlm: Boolean + enableRealtime: Boolean """ - Extensible JSON for additional per-API settings that do not have dedicated columns + Extensible JSON for additional settings that do not have dedicated columns """ options: JSON } @@ -55936,6 +55903,115 @@ input DatabaseTransferPatch { completedAt: Datetime } +"""The output of our update `ApiSetting` mutation.""" +type UpdateApiSettingPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `ApiSetting` that was updated by this mutation.""" + apiSetting: ApiSetting + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `ApiSetting`. May be used by Relay 1.""" + apiSettingEdge( + """The method to use when ordering `ApiSetting`.""" + orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): ApiSettingEdge +} + +"""All input for the `updateApiSetting` mutation.""" +input UpdateApiSettingInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """Unique identifier for this API settings record""" + id: UUID! + + """ + An object where the defined keys will be set on the `ApiSetting` being updated. + """ + apiSettingPatch: ApiSettingPatch! +} + +""" +Represents an update to a `ApiSetting`. Fields that are set will be updated. +""" +input ApiSettingPatch { + """Unique identifier for this API settings record""" + id: UUID + + """Reference to the metaschema database""" + databaseId: UUID + + """API these settings override for""" + apiId: UUID + + """ + Override: enable aggregate queries (NULL = inherit from database_settings) + """ + enableAggregates: Boolean + + """ + Override: enable PostGIS spatial types (NULL = inherit from database_settings) + """ + enablePostgis: Boolean + + """ + Override: enable unified search (NULL = inherit from database_settings) + """ + enableSearch: Boolean + + """ + Override: enable direct (multipart) file uploads (NULL = inherit from database_settings) + """ + enableDirectUploads: Boolean + + """ + Override: enable presigned URL upload flow (NULL = inherit from database_settings) + """ + enablePresignedUploads: Boolean + + """ + Override: enable many-to-many relationships (NULL = inherit from database_settings) + """ + enableManyToMany: Boolean + + """ + Override: enable connection filter (NULL = inherit from database_settings) + """ + enableConnectionFilter: Boolean + + """ + Override: enable ltree hierarchical data type (NULL = inherit from database_settings) + """ + enableLtree: Boolean + + """ + Override: enable LLM/AI integration features (NULL = inherit from database_settings) + """ + enableLlm: Boolean + + """ + Override: enable realtime subscriptions (NULL = inherit from database_settings) + """ + enableRealtime: Boolean + + """ + Extensible JSON for additional per-API settings that do not have dedicated columns + """ + options: JSON +} + """The output of our update `BillingModule` mutation.""" type UpdateBillingModulePayload { """ @@ -62335,41 +62411,6 @@ input DeleteAppLevelInput { id: UUID! } -"""The output of our delete `DatabaseSetting` mutation.""" -type DeleteDatabaseSettingPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `DatabaseSetting` that was deleted by this mutation.""" - databaseSetting: DatabaseSetting - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `DatabaseSetting`. May be used by Relay 1.""" - databaseSettingEdge( - """The method to use when ordering `DatabaseSetting`.""" - orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): DatabaseSettingEdge -} - -"""All input for the `deleteDatabaseSetting` mutation.""" -input DeleteDatabaseSettingInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """Unique identifier for this settings record""" - id: UUID! -} - """The output of our delete `Blueprint` mutation.""" type DeleteBlueprintPayload { """ @@ -62471,38 +62512,38 @@ input DeleteRealtimeModuleInput { id: UUID! } -"""The output of our delete `ApiSetting` mutation.""" -type DeleteApiSettingPayload { +"""The output of our delete `DatabaseSetting` mutation.""" +type DeleteDatabaseSettingPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The `ApiSetting` that was deleted by this mutation.""" - apiSetting: ApiSetting + """The `DatabaseSetting` that was deleted by this mutation.""" + databaseSetting: DatabaseSetting """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our `ApiSetting`. May be used by Relay 1.""" - apiSettingEdge( - """The method to use when ordering `ApiSetting`.""" - orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] - ): ApiSettingEdge + """An edge for our `DatabaseSetting`. May be used by Relay 1.""" + databaseSettingEdge( + """The method to use when ordering `DatabaseSetting`.""" + orderBy: [DatabaseSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): DatabaseSettingEdge } -"""All input for the `deleteApiSetting` mutation.""" -input DeleteApiSettingInput { +"""All input for the `deleteDatabaseSetting` mutation.""" +input DeleteDatabaseSettingInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """Unique identifier for this API settings record""" + """Unique identifier for this settings record""" id: UUID! } @@ -62638,6 +62679,41 @@ input DeleteDatabaseTransferInput { id: UUID! } +"""The output of our delete `ApiSetting` mutation.""" +type DeleteApiSettingPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `ApiSetting` that was deleted by this mutation.""" + apiSetting: ApiSetting + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `ApiSetting`. May be used by Relay 1.""" + apiSettingEdge( + """The method to use when ordering `ApiSetting`.""" + orderBy: [ApiSettingOrderBy!]! = [PRIMARY_KEY_ASC] + ): ApiSettingEdge +} + +"""All input for the `deleteApiSetting` mutation.""" +input DeleteApiSettingInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """Unique identifier for this API settings record""" + id: UUID! +} + """The output of our delete `BillingModule` mutation.""" type DeleteBillingModulePayload { """ diff --git a/sdk/constructive-sdk/src/admin/orm/client.ts b/sdk/constructive-sdk/src/admin/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-sdk/src/admin/orm/client.ts +++ b/sdk/constructive-sdk/src/admin/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-sdk/src/auth/orm/client.ts b/sdk/constructive-sdk/src/auth/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-sdk/src/auth/orm/client.ts +++ b/sdk/constructive-sdk/src/auth/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-sdk/src/objects/orm/client.ts b/sdk/constructive-sdk/src/objects/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-sdk/src/objects/orm/client.ts +++ b/sdk/constructive-sdk/src/objects/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-sdk/src/public/README.md b/sdk/constructive-sdk/src/public/README.md index 2b3d6366c..bb2a40440 100644 --- a/sdk/constructive-sdk/src/public/README.md +++ b/sdk/constructive-sdk/src/public/README.md @@ -10,7 +10,7 @@ - **Tables:** 149 - **Custom queries:** 22 -- **Custom mutations:** 48 +- **Custom mutations:** 49 **Generators:** ORM diff --git a/sdk/constructive-sdk/src/public/orm/README.md b/sdk/constructive-sdk/src/public/orm/README.md index b50ee1954..2d39cb95b 100644 --- a/sdk/constructive-sdk/src/public/orm/README.md +++ b/sdk/constructive-sdk/src/public/orm/README.md @@ -2004,19 +2004,20 @@ CRUD operations for ApiSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all apiSetting records -const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.apiSetting.findMany({ select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.apiSetting.findOne({ id: '', select: { id: true, databaseId: true, apiId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.apiSetting.create({ data: { databaseId: '', apiId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.apiSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -5392,19 +5393,20 @@ CRUD operations for DatabaseSetting records. | `enableConnectionFilter` | Boolean | Yes | | `enableLtree` | Boolean | Yes | | `enableLlm` | Boolean | Yes | +| `enableRealtime` | Boolean | Yes | | `options` | JSON | Yes | **Operations:** ```typescript // List all databaseSetting records -const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const items = await db.databaseSetting.findMany({ select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Get one by id -const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, options: true } }).execute(); +const item = await db.databaseSetting.findOne({ id: '', select: { id: true, databaseId: true, enableAggregates: true, enablePostgis: true, enableSearch: true, enableDirectUploads: true, enablePresignedUploads: true, enableManyToMany: true, enableConnectionFilter: true, enableLtree: true, enableLlm: true, enableRealtime: true, options: true } }).execute(); // Create -const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', options: '' }, select: { id: true } }).execute(); +const created = await db.databaseSetting.create({ data: { databaseId: '', enableAggregates: '', enablePostgis: '', enableSearch: '', enableDirectUploads: '', enablePresignedUploads: '', enableManyToMany: '', enableConnectionFilter: '', enableLtree: '', enableLlm: '', enableRealtime: '', options: '' }, select: { id: true } }).execute(); // Update const updated = await db.databaseSetting.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); @@ -6470,7 +6472,7 @@ const result = await db.mutation.initEmptyRepo({ input: { dbId: '', storeI ### `db.mutation.constructBlueprint` -Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. +Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. - **Type:** mutation - **Arguments:** @@ -6588,6 +6590,21 @@ setFieldOrder const result = await db.mutation.setFieldOrder({ input: { fieldIds: '' } }).execute(); ``` +### `db.mutation.provisionCheckConstraint` + +Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + +- **Type:** mutation +- **Arguments:** + + | Argument | Type | + |----------|------| + | `input` | ProvisionCheckConstraintInput (required) | + +```typescript +const result = await db.mutation.provisionCheckConstraint({ input: { databaseId: '', tableId: '', definition: '' } }).execute(); +``` + ### `db.mutation.provisionUniqueConstraint` Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. diff --git a/sdk/constructive-sdk/src/public/orm/client.ts b/sdk/constructive-sdk/src/public/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/constructive-sdk/src/public/orm/client.ts +++ b/sdk/constructive-sdk/src/public/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> { diff --git a/sdk/constructive-sdk/src/public/orm/input-types.ts b/sdk/constructive-sdk/src/public/orm/input-types.ts index 262babe2e..5bdd88600 100644 --- a/sdk/constructive-sdk/src/public/orm/input-types.ts +++ b/sdk/constructive-sdk/src/public/orm/input-types.ts @@ -1043,6 +1043,8 @@ export interface ApiSetting { enableLtree?: boolean | null; /** Override: enable LLM/AI integration features (NULL = inherit from database_settings) */ enableLlm?: boolean | null; + /** Override: enable realtime subscriptions (NULL = inherit from database_settings) */ + enableRealtime?: boolean | null; /** Extensible JSON for additional per-API settings that do not have dedicated columns */ options?: Record | null; } @@ -2665,6 +2667,8 @@ export interface DatabaseSetting { enableLtree?: boolean | null; /** Enable LLM/AI integration features in the GraphQL API */ enableLlm?: boolean | null; + /** Enable realtime subscriptions (cursor-tracked change delivery) in the GraphQL API */ + enableRealtime?: boolean | null; /** Extensible JSON for additional settings that do not have dedicated columns */ options?: Record | null; } @@ -5585,6 +5589,7 @@ export type ApiSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; api?: { select: ApiSelect; @@ -7485,6 +7490,7 @@ export type DatabaseSettingSelect = { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: boolean; database?: { select: DatabaseSelect; @@ -10228,6 +10234,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -13364,6 +13372,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -15279,6 +15289,8 @@ export type ApiSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type ConnectedAccountsModuleOrderBy = @@ -17365,6 +17377,8 @@ export type DatabaseSettingOrderBy = | 'ENABLE_LTREE_DESC' | 'ENABLE_LLM_ASC' | 'ENABLE_LLM_DESC' + | 'ENABLE_REALTIME_ASC' + | 'ENABLE_REALTIME_DESC' | 'OPTIONS_ASC' | 'OPTIONS_DESC'; export type PlansModuleOrderBy = @@ -19256,6 +19270,7 @@ export interface CreateApiSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -19271,6 +19286,7 @@ export interface ApiSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateApiSettingInput { @@ -22137,6 +22153,7 @@ export interface CreateDatabaseSettingInput { enableConnectionFilter?: boolean; enableLtree?: boolean; enableLlm?: boolean; + enableRealtime?: boolean; options?: Record; }; } @@ -22151,6 +22168,7 @@ export interface DatabaseSettingPatch { enableConnectionFilter?: boolean | null; enableLtree?: boolean | null; enableLlm?: boolean | null; + enableRealtime?: boolean | null; options?: Record | null; } export interface UpdateDatabaseSettingInput { @@ -22930,6 +22948,12 @@ export interface SetFieldOrderInput { clientMutationId?: string; fieldIds?: string[]; } +export interface ProvisionCheckConstraintInput { + clientMutationId?: string; + databaseId?: string; + tableId?: string; + definition?: Record; +} export interface ProvisionUniqueConstraintInput { clientMutationId?: string; databaseId?: string; @@ -26569,6 +26593,8 @@ export interface ApiSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -30403,6 +30429,8 @@ export interface DatabaseSettingFilter { enableLtree?: BooleanFilter; /** Filter by the object’s `enableLlm` field. */ enableLlm?: BooleanFilter; + /** Filter by the object’s `enableRealtime` field. */ + enableRealtime?: BooleanFilter; /** Filter by the object’s `options` field. */ options?: JSONFilter; /** Checks for all expressions in this list. */ @@ -31442,6 +31470,12 @@ export interface SetFieldOrderPayload { export type SetFieldOrderPayloadSelect = { clientMutationId?: boolean; }; +export interface ProvisionCheckConstraintPayload { + clientMutationId?: string | null; +} +export type ProvisionCheckConstraintPayloadSelect = { + clientMutationId?: boolean; +}; export interface ProvisionUniqueConstraintPayload { clientMutationId?: string | null; } diff --git a/sdk/constructive-sdk/src/public/orm/mutation/index.ts b/sdk/constructive-sdk/src/public/orm/mutation/index.ts index 24af7c323..89ed2f871 100644 --- a/sdk/constructive-sdk/src/public/orm/mutation/index.ts +++ b/sdk/constructive-sdk/src/public/orm/mutation/index.ts @@ -33,6 +33,7 @@ import type { ProvisionSpatialRelationInput, BootstrapUserInput, SetFieldOrderInput, + ProvisionCheckConstraintInput, ProvisionUniqueConstraintInput, ProvisionFullTextSearchInput, ProvisionIndexInput, @@ -81,6 +82,7 @@ import type { ProvisionSpatialRelationPayload, BootstrapUserPayload, SetFieldOrderPayload, + ProvisionCheckConstraintPayload, ProvisionUniqueConstraintPayload, ProvisionFullTextSearchPayload, ProvisionIndexPayload, @@ -129,6 +131,7 @@ import type { ProvisionSpatialRelationPayloadSelect, BootstrapUserPayloadSelect, SetFieldOrderPayloadSelect, + ProvisionCheckConstraintPayloadSelect, ProvisionUniqueConstraintPayloadSelect, ProvisionFullTextSearchPayloadSelect, ProvisionIndexPayloadSelect, @@ -209,7 +212,7 @@ export interface InitEmptyRepoVariables { } /** * Variables for constructBlueprint - * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. + * Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Seven phases: (0) entity_type_provision for each membership_type entry — provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints/check_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints, (6) provision_check_constraint() for top-level + deferred check constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level entries are deferred to phases 3-6 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure. */ export interface ConstructBlueprintVariables { input: ConstructBlueprintInput; @@ -243,6 +246,13 @@ export interface BootstrapUserVariables { export interface SetFieldOrderVariables { input: SetFieldOrderInput; } +/** + * Variables for provisionCheckConstraint + * Creates a check constraint on a table from a $type + data blueprint definition. Supports: CheckOneOf (enum validation via = ANY(ARRAY[...])), CheckGreaterThan (single-column > value or cross-column), CheckLessThan (single-column < value or cross-column), CheckNotEqual (cross-column inequality). Builds AST expressions via ast_helpers and inserts into metaschema_public.check_constraint. Graceful: skips if a constraint with the same name already exists. + */ +export interface ProvisionCheckConstraintVariables { + input: ProvisionCheckConstraintInput; +} /** * Variables for provisionUniqueConstraint * Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists. @@ -1111,6 +1121,35 @@ export function createMutationOperations(client: OrmClient) { 'SetFieldOrderPayload' ), }), + provisionCheckConstraint: ( + args: ProvisionCheckConstraintVariables, + options: { + select: S; + } & StrictSelect + ) => + new QueryBuilder<{ + provisionCheckConstraint: InferSelectResult | null; + }>({ + client, + operation: 'mutation', + operationName: 'ProvisionCheckConstraint', + fieldName: 'provisionCheckConstraint', + ...buildCustomDocument( + 'mutation', + 'ProvisionCheckConstraint', + 'provisionCheckConstraint', + options.select, + args, + [ + { + name: 'input', + type: 'ProvisionCheckConstraintInput!', + }, + ], + connectionFieldsMap, + 'ProvisionCheckConstraintPayload' + ), + }), provisionUniqueConstraint: ( args: ProvisionUniqueConstraintVariables, options: { diff --git a/sdk/migrate-client/src/migrate/orm/client.ts b/sdk/migrate-client/src/migrate/orm/client.ts index ccfdebd36..16e683c71 100644 --- a/sdk/migrate-client/src/migrate/orm/client.ts +++ b/sdk/migrate-client/src/migrate/orm/client.ts @@ -58,7 +58,7 @@ export class FetchAdapter implements GraphQLAdapter { fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; - this.fetchFn = fetchFn ?? createFetch(); + this.fetchFn = (fetchFn ?? createFetch()).bind(globalThis); } async execute(document: string, variables?: Record): Promise> {