Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions graphql/node-type-registry/src/blueprint-types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ export interface BlueprintStorageConfig {
/** CORS allowed origins for the storage module. */
allowed_origins?: string[];
}
/** Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely. */
/** Override object for the entity table created by a BlueprintEntityType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely. */
export interface BlueprintEntityTableProvision {
/** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
use_rls?: boolean;
Expand All @@ -890,8 +890,8 @@ export interface BlueprintEntityTableProvision {
/** RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op). */
policies?: BlueprintPolicy[];
}
/** A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision. */
export interface BlueprintMembershipType {
/** An entity type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision. */
export interface BlueprintEntityType {
/** Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database. */
name: string;
/** Short prefix for generated objects (e.g., "dr", "ch", "dept"). Used in table/trigger naming. */
Expand Down Expand Up @@ -1151,5 +1151,7 @@ export interface BlueprintDefinition {
/** Unique constraints on table columns. */
unique_constraints?: BlueprintUniqueConstraint[];
/** Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security. */
membership_types?: BlueprintMembershipType[];
entity_types?: BlueprintEntityType[];
/** App-level storage configuration. Creates a storage_module (membership_type = NULL) with the specified policies, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead. */
storage?: BlueprintStorageConfig;
}
21 changes: 14 additions & 7 deletions graphql/node-type-registry/src/codegen/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,13 @@ function buildBlueprintEntityTableProvision(): t.ExportNamedDeclaration {
'RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op).'
)
]),
'Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely.'
'Override object for the entity table created by a BlueprintEntityType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely.'
);
}

function buildBlueprintMembershipType(): t.ExportNamedDeclaration {
function buildBlueprintEntityType(): t.ExportNamedDeclaration {
return addJSDoc(
exportInterface('BlueprintMembershipType', [
exportInterface('BlueprintEntityType', [
addJSDoc(
requiredProp('name', t.tsStringKeyword()),
'Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database.'
Expand Down Expand Up @@ -862,7 +862,7 @@ function buildBlueprintMembershipType(): t.ExportNamedDeclaration {
'Storage configuration. Only used when has_storage is true. Controls RLS policies on storage tables, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS).'
)
]),
'A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision.'
'An entity type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision.'
);
}

Expand Down Expand Up @@ -984,12 +984,19 @@ function buildBlueprintDefinition(): t.ExportNamedDeclaration {
),
addJSDoc(
optionalProp(
'membership_types',
'entity_types',
t.tsArrayType(
t.tsTypeReference(t.identifier('BlueprintMembershipType'))
t.tsTypeReference(t.identifier('BlueprintEntityType'))
)
),
'Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security.'
),
addJSDoc(
optionalProp(
'storage',
t.tsTypeReference(t.identifier('BlueprintStorageConfig'))
),
'App-level storage configuration. Creates a storage_module (membership_type = NULL) with the specified policies, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead.'
)
]),
'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().'
Expand Down Expand Up @@ -1066,7 +1073,7 @@ function buildProgram(meta?: MetaTableInfo[]): string {
statements.push(buildBlueprintBucketSeed());
statements.push(buildBlueprintStorageConfig());
statements.push(buildBlueprintEntityTableProvision());
statements.push(buildBlueprintMembershipType());
statements.push(buildBlueprintEntityType());

// -- Node types discriminated union --
statements.push(
Expand Down
Loading