feat: move node-type-registry to graphql/ and update for blueprint redesign#941
Merged
pyramation merged 4 commits intomainfrom Mar 31, 2026
Merged
Conversation
…design - Move node-type-registry from graphile/ to graphql/ folder - Remove 'ref' field from BlueprintTable (table_name IS the identifier) - Add optional 'schema_name' to BlueprintTable, BlueprintIndex, BlueprintFullTextSearch - Rename source_ref/target_ref to source_table/target_table in BlueprintRelation - Add optional source_schema_name/target_schema_name to BlueprintRelation - Add BlueprintUniqueConstraint type (table_name, columns[], optional schema_name) - Add unique_constraints[] to BlueprintDefinition - Update codegen (generate-types.ts) to produce the new shapes - Update generated blueprint-types.generated.ts to match - Update README with new example (no ref, uses table_name directly) - Update all path references from graphile/ to graphql/ Corresponds to constructive-db PR #721 which implements the server-side blueprint redesign (remove refs, add table_name+schema_name resolution, extract construction state, add unique_constraints phase).
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
…ch, BlueprintTableUniqueConstraint types - BlueprintTable now supports nested indexes[], full_text_searches[], unique_constraints[] - Table-level types omit table_name (inherited from parent table) - Top-level types still require table_name - Updated codegen to generate all three table-level type variants - Matches the three-tier blueprint definition system in construct_blueprint()
The construct_blueprint SQL procedure reads policy type via: v_policy_type := v_policy_entry->>'\'; But the TypeScript BlueprintPolicy interface used 'policy_type' which doesn't match the blueprint JSON convention used by nodes and relations. Updated buildBlueprintPolicy in generate-types.ts to always use the static definition with $type (skipping the introspection-driven path which derives from the DB column name). Regenerated types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes across multiple commits:
Relocates
node-type-registryfromgraphile/→graphql/(pure rename for all 66 source files; both dirs are inpnpm-workspace.yaml).Updates blueprint TypeScript types to match the server-side redesign in constructive-db PR #721:
BlueprintTable.refremoved —table_nameis now the identifierschema_nameadded toBlueprintTable,BlueprintIndex,BlueprintFullTextSearchsource_ref/target_ref→source_table/target_tableonBlueprintRelation(+ optionalsource_schema_name/target_schema_name)BlueprintUniqueConstrainttype (table_name,columns[], optionalschema_name)BlueprintDefinition.unique_constraintsaddedBoth the codegen script (
generate-types.ts) and the generated output (blueprint-types.generated.ts) were updated.tsc --noEmitandpnpm buildpass on the package.Breaking: any consumer code referencing
ref,source_ref,target_ref,table_ref, orBlueprintPolicy.policy_typewill need updating.Updates since last revision
BlueprintTableIndex,BlueprintTableFullTextSearch,BlueprintTableUniqueConstraint— that omittable_name(inherited from parent table).BlueprintTablenow has optionalindexes[],full_text_searches[], andunique_constraints[]arrays using these nested types. This matches the three-tier definition model inconstruct_blueprint(Tier 1: Data* nodes, Tier 2: table-level arrays, Tier 3: top-level arrays).BlueprintPolicy.$type: Changedpolicy_type→$typeto match the actual blueprint JSON convention. The SQL procedure readsv_policy_entry->>'$type', notpolicy_type. The old type was incorrect. The generator (buildBlueprintPolicy) now always uses the static definition rather than introspecting the DBpolicytable (which has the column namedpolicy_type, but that's the DB schema — not the blueprint JSON shape).pnpm-lock.yamlregeneration (fixesERR_PNPM_OUTDATED_LOCKFILEin CI).Review & Testing Checklist for Human
BlueprintPolicy.$typebreaking change: Any code usingBlueprintPolicy.policy_typemust switch to$type. Search forpolicy_typein consumer code. The SQL has always expected$type, so the old type was a bug — but consumers may have been working around it.sdk/constructive-cli/src/public/cli/commands/node-type-registry.tsand any other packages importingBlueprintTable,BlueprintRelation,BlueprintIndex, orBlueprintFullTextSearchwere not updated in this PR. Search the monorepo for usages of the old field names (ref,source_ref,target_ref,table_ref) and verify they are updated before merging, or accept that this is an intentional breaking change to be fixed in a follow-up.construct_blueprint()expects on the server. In particular, confirm the three-tier merging (table-level + top-level) and the$typeconvention on policies are consistent.pnpm-lock.yamldiff is large due to format changes (likely a pnpm version difference). Verify no unintended dependency additions or removals.Suggested test plan: After merging both this PR and constructive-db #721, run
cd graphql/node-type-registry && pnpm generate:typesand confirm the output matches the committedblueprint-types.generated.ts. Thenpnpm buildat the workspace root to verify no downstream compile errors.Notes
package.jsonname (node-type-registry) is unchanged, so bare-name imports (from 'node-type-registry') should resolve via pnpm workspaces regardless of directory.graphile-settingsCHANGELOG referencesnode-type-registrybut that's just prose, not an import.buildBlueprintPolicyin the generator intentionally skips the introspection-driven path now. Themetaschema_public.policytable has apolicy_typecolumn, but the blueprint JSON convention uses$typeas the discriminator (matching nodes and relations). If new fields are added to the policy table that should surface inBlueprintPolicy, they'll need to be added to the static definition manually.Link to Devin session: https://app.devin.ai/sessions/094d88b562a04a2fa55dc2e4d85f7b8d
Requested by: @pyramation