You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Important:**`index.ts` re-exports `select-types` but NOT `types.ts`/`input-types.ts` to avoid name collisions (many types like `Field`, `Table`, `Policy` exist in both files with different shapes). See [Accessing Input Types](#accessing-input-types-deep-imports) below.
51
69
52
70
## Client API
53
71
@@ -436,3 +454,65 @@ const result = await db.login({
436
454
password: 'secret',
437
455
}).execute();
438
456
```
457
+
458
+
## Accessing Input Types (Deep Imports)
459
+
460
+
The ORM `index.ts` re-exports `select-types` but deliberately does **not** re-export `types.ts` / `input-types.ts`. This is because many type names exist in both files with incompatible shapes (e.g. `Field`, `Table`, `Policy`, `Index`, `User` — ~80+ collisions). A blanket `export *` from both would cause TypeScript `TS2308` ambiguity errors.
461
+
462
+
### Why the collision exists
463
+
464
+
-**`input-types.ts`** contains the full entity interfaces with all fields (used for create/update inputs and query results)
465
+
-**`select-types.ts`** contains const-generic select types that narrow the return type to only selected fields
466
+
467
+
Both files define types with the same names (e.g. `Field` in `input-types.ts` is the full entity, `Field` in `select-types.ts` is the select-narrowed version). Re-exporting both through `index.ts` would be ambiguous.
468
+
469
+
### How to access input types
470
+
471
+
Use a **deep import** to reach `input-types.ts` directly. This works with standard Node.js module resolution — no `exports` field or special configuration needed:
If you use the `@constructive-io/node` package (which wraps the SDK), types are available through the namespace:
503
+
504
+
```typescript
505
+
import { public_ } from'@constructive-io/node';
506
+
507
+
// Access types through the namespace
508
+
typeMyBlueprint=public_.Blueprint;
509
+
typeMyTable=public_.SecureTableProvision;
510
+
```
511
+
512
+
The namespace import pulls from `select-types` (via `index.ts`), so it gives you the select-narrowed versions. For the full entity types (e.g. for constructing mutation inputs), use the deep import path above.
513
+
514
+
### Important notes
515
+
516
+
- The deep import path depends on the SDK's internal file layout. If the SDK reorganizes directories in a future version, the path may change.
517
+
- Add `@constructive-io/sdk` as a **direct dependency** (not just devDependency) if your package needs these types at build time — this ensures pnpm creates the symlink for the deep path to resolve.
518
+
- The `types.ts` barrel (`export * from './input-types'`) exists as a convenience re-export within the `orm/` directory but is not chained through `index.ts`.
Copy file name to clipboardExpand all lines: .agents/skills/constructive/references/blueprint-definition-format.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
The blueprint `definition` is a JSONB document that declaratively describes a complete domain schema. It uses structured table config with inline `$type` discriminators for nodes, policies, and relations.
4
4
5
+
> **snake_case convention:** The definition uses **snake_case** keys (`table_name`, `grant_roles`, `delete_action`, etc.) because it is stored as opaque JSONB in PostgreSQL. PostGraphile/GraphQL does not transform keys inside JSONB fields — the JSON is passed through to the `construct_blueprint()` PL/pgSQL function as-is, which reads snake_case keys directly. This is intentional and differs from the camelCase conventions used in the SDK's ORM types (`SecureTableProvision`, `RelationProvision`), which represent the metaschema row types. When writing blueprint definitions, always use snake_case.
0 commit comments