Skip to content

feat: add storage types to node type registry#1035

Merged
pyramation merged 2 commits intomainfrom
feat/node-registry-storage-types
Apr 29, 2026
Merged

feat: add storage types to node type registry#1035
pyramation merged 2 commits intomainfrom
feat/node-registry-storage-types

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented Apr 29, 2026

Summary

Adds storage-related types to the node type registry and tightens all blueprint types for full autocomplete and type safety.

Storage types:

  • BlueprintStoragePolicy — typed policy objects for apply_storage_security()
  • BlueprintBucketSeed — bucket seed entries for storage_config.buckets[]
  • BlueprintStorageConfig — top-level storage configuration
  • BlueprintMembershipType.has_storage / .storage — storage support on membership types

Type tightening (discriminated unions):

  • BlueprintPolicy — converted from flat interface to discriminated union on $type. Typing $type: "AuthzPublishable" narrows data to AuthzPublishableParams with autocomplete for is_published_field, published_at_field, require_published_at.
  • BlueprintStoragePolicy — same discriminated union. $type is literal union of all 16 Authz* types, data typed per type.
  • BlueprintPrivilege — new type: "select" | "insert" | "update" | "delete". Used by policy and grant types.
  • BlueprintFtsSource.weightstring"A" | "B" | "C" | "D"
  • Grant privilegesunknown[][BlueprintPrivilege, string | string[]][] (typed [verb, columns] tuples)

Codegen improvements:

  • Babel generator now emits single quotes (matches project eslint config)
  • Generated file header includes eslint-disable for @typescript-eslint/no-empty-object-type

All Authz* *Params interfaces from the existing node type registry are reused — no new type definitions invented.

Review & Testing Checklist for Human

  • Verify discriminated union narrowing works in your IDE — create a BlueprintPolicy with $type: "AuthzEntityMembership" and confirm data autocompletes with entity_field, membership_type, permission, etc.
  • Verify BlueprintStoragePolicy narrows data correctly when $type is set
  • Confirm that existing blueprint definitions still type-check against the tightened types (e.g., any code that builds BlueprintPolicy or BlueprintStoragePolicy objects)
  • Run cd graphql/node-type-registry && pnpm generate:types to confirm codegen is reproducible

Notes

  • Index options fields remain Record<string, unknown> — they are genuinely open-ended per index type (GIN, GiST, etc.)
  • The 2 pre-existing @typescript-eslint/no-require-imports errors in generate-types.ts line 21 are unchanged

Link to Devin session: https://app.devin.ai/sessions/58b40b3f63804c20b86643cc873ba844
Requested by: @pyramation

Add BlueprintStoragePolicy, BlueprintBucketSeed, and BlueprintStorageConfig
interfaces to the node type registry. Wire has_storage and storage properties
into BlueprintMembershipType to match the construct_blueprint() SQL signature.

These types provide autocomplete and type safety when building blueprint JSON
with storage configuration (policies, bucket seeds, module-level overrides).
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…s, FTS weights, grant tuples

- BlueprintPolicy: convert from interface to discriminated union on $type
  so data is typed per Authz* policy type (autocomplete for all 16 types)
- BlueprintStoragePolicy: same treatment — typed data per $type plus
  the storage-specific tables/policy_name fields
- Add BlueprintPrivilege type alias: 'select' | 'insert' | 'update' | 'delete'
- BlueprintFtsSource.weight: string → 'A' | 'B' | 'C' | 'D'
- Grant privileges: unknown[] → [BlueprintPrivilege, string | string[]][]
  (typed [verb, columns] tuples)
- Fix codegen to emit single quotes (matches project eslint config)
- Add eslint-disable for @typescript-eslint/no-empty-object-type in
  generated file header
@pyramation pyramation merged commit acf43bc into main Apr 29, 2026
52 checks passed
@pyramation pyramation deleted the feat/node-registry-storage-types branch April 29, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant