Skip to content

Commit 239fb28

Browse files
authored
Merge pull request #1037 from constructive-io/feat/entity-types-rename
feat!: rename BlueprintMembershipType to BlueprintEntityType + add storage to BlueprintDefinition
2 parents 058b820 + 8f67e0a commit 239fb28

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

graphql/node-type-registry/src/blueprint-types.generated.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ export interface BlueprintStorageConfig {
874874
/** CORS allowed origins for the storage module. */
875875
allowed_origins?: string[];
876876
}
877-
/** 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. */
877+
/** 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. */
878878
export interface BlueprintEntityTableProvision {
879879
/** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
880880
use_rls?: boolean;
@@ -890,8 +890,8 @@ export interface BlueprintEntityTableProvision {
890890
/** RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op). */
891891
policies?: BlueprintPolicy[];
892892
}
893-
/** 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. */
894-
export interface BlueprintMembershipType {
893+
/** 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. */
894+
export interface BlueprintEntityType {
895895
/** Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database. */
896896
name: string;
897897
/** Short prefix for generated objects (e.g., "dr", "ch", "dept"). Used in table/trigger naming. */
@@ -1151,5 +1151,7 @@ export interface BlueprintDefinition {
11511151
/** Unique constraints on table columns. */
11521152
unique_constraints?: BlueprintUniqueConstraint[];
11531153
/** Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security. */
1154-
membership_types?: BlueprintMembershipType[];
1154+
entity_types?: BlueprintEntityType[];
1155+
/** 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. */
1156+
storage?: BlueprintStorageConfig;
11551157
}

graphql/node-type-registry/src/codegen/generate-types.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,13 +796,13 @@ function buildBlueprintEntityTableProvision(): t.ExportNamedDeclaration {
796796
'RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op).'
797797
)
798798
]),
799-
'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.'
799+
'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.'
800800
);
801801
}
802802

803-
function buildBlueprintMembershipType(): t.ExportNamedDeclaration {
803+
function buildBlueprintEntityType(): t.ExportNamedDeclaration {
804804
return addJSDoc(
805-
exportInterface('BlueprintMembershipType', [
805+
exportInterface('BlueprintEntityType', [
806806
addJSDoc(
807807
requiredProp('name', t.tsStringKeyword()),
808808
'Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database.'
@@ -862,7 +862,7 @@ function buildBlueprintMembershipType(): t.ExportNamedDeclaration {
862862
'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).'
863863
)
864864
]),
865-
'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.'
865+
'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.'
866866
);
867867
}
868868

@@ -984,12 +984,19 @@ function buildBlueprintDefinition(): t.ExportNamedDeclaration {
984984
),
985985
addJSDoc(
986986
optionalProp(
987-
'membership_types',
987+
'entity_types',
988988
t.tsArrayType(
989-
t.tsTypeReference(t.identifier('BlueprintMembershipType'))
989+
t.tsTypeReference(t.identifier('BlueprintEntityType'))
990990
)
991991
),
992992
'Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security.'
993+
),
994+
addJSDoc(
995+
optionalProp(
996+
'storage',
997+
t.tsTypeReference(t.identifier('BlueprintStorageConfig'))
998+
),
999+
'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.'
9931000
)
9941001
]),
9951002
'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().'
@@ -1066,7 +1073,7 @@ function buildProgram(meta?: MetaTableInfo[]): string {
10661073
statements.push(buildBlueprintBucketSeed());
10671074
statements.push(buildBlueprintStorageConfig());
10681075
statements.push(buildBlueprintEntityTableProvision());
1069-
statements.push(buildBlueprintMembershipType());
1076+
statements.push(buildBlueprintEntityType());
10701077

10711078
// -- Node types discriminated union --
10721079
statements.push(

0 commit comments

Comments
 (0)