node-type-registry 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ /**
3
+ * Standalone chunking node type.
4
+ *
5
+ * Creates an embedding_chunks record that provisions a chunks table with:
6
+ * - FK to parent table (CASCADE delete)
7
+ * - content text field
8
+ * - chunk_index integer field
9
+ * - embedding vector(N) field with HNSW index
10
+ * - metadata jsonb field
11
+ * - RLS policies inherited from parent
12
+ * - Optional job trigger for automatic chunking on INSERT/UPDATE
13
+ *
14
+ * This node is also composed internally by DataFileEmbedding (enabled by
15
+ * default in extract mode). Use it standalone when you want a chunks table
16
+ * without the full file-embedding pipeline.
17
+ */
18
+ export declare const DataChunks: NodeTypeDefinition;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataChunks = void 0;
4
+ /**
5
+ * Standalone chunking node type.
6
+ *
7
+ * Creates an embedding_chunks record that provisions a chunks table with:
8
+ * - FK to parent table (CASCADE delete)
9
+ * - content text field
10
+ * - chunk_index integer field
11
+ * - embedding vector(N) field with HNSW index
12
+ * - metadata jsonb field
13
+ * - RLS policies inherited from parent
14
+ * - Optional job trigger for automatic chunking on INSERT/UPDATE
15
+ *
16
+ * This node is also composed internally by DataFileEmbedding (enabled by
17
+ * default in extract mode). Use it standalone when you want a chunks table
18
+ * without the full file-embedding pipeline.
19
+ */
20
+ exports.DataChunks = {
21
+ name: 'DataChunks',
22
+ slug: 'data_chunks',
23
+ category: 'data',
24
+ display_name: 'Chunks',
25
+ description: 'Creates a chunked-embedding child table for any parent table. ' +
26
+ 'Provisions the chunks table with content, chunk_index, embedding vector, ' +
27
+ 'metadata, HNSW index, inherited RLS, and optional job trigger for ' +
28
+ 'automatic text splitting. Composed internally by DataFileEmbedding ' +
29
+ '(enabled by default in extract mode) but can also be used standalone.',
30
+ parameter_schema: {
31
+ type: 'object',
32
+ properties: {
33
+ // ── Content config ─────────────────────────────────────────────
34
+ content_field_name: {
35
+ type: 'string',
36
+ format: 'column-ref',
37
+ description: 'Name of the text content column in the chunks table',
38
+ default: 'content'
39
+ },
40
+ // ── Chunking strategy ──────────────────────────────────────────
41
+ chunk_size: {
42
+ type: 'integer',
43
+ description: 'Maximum number of characters per chunk',
44
+ default: 1000
45
+ },
46
+ chunk_overlap: {
47
+ type: 'integer',
48
+ description: 'Number of overlapping characters between consecutive chunks',
49
+ default: 200
50
+ },
51
+ chunk_strategy: {
52
+ type: 'string',
53
+ enum: ['fixed', 'sentence', 'paragraph', 'semantic'],
54
+ description: 'Strategy for splitting text into chunks',
55
+ default: 'paragraph'
56
+ },
57
+ // ── Embedding config ───────────────────────────────────────────
58
+ dimensions: {
59
+ type: 'integer',
60
+ description: 'Vector dimensions for per-chunk embeddings',
61
+ default: 768
62
+ },
63
+ metric: {
64
+ type: 'string',
65
+ enum: ['cosine', 'l2', 'ip'],
66
+ description: 'Distance metric for the HNSW index on chunk embeddings',
67
+ default: 'cosine'
68
+ },
69
+ // ── Table naming ───────────────────────────────────────────────
70
+ chunks_table_name: {
71
+ type: 'string',
72
+ description: 'Override the chunks table name. Defaults to {parent_table}_chunks.',
73
+ },
74
+ // ── Metadata ───────────────────────────────────────────────────
75
+ metadata_fields: {
76
+ type: 'array',
77
+ items: { type: 'string' },
78
+ description: 'Field names from the parent table to copy into chunk metadata'
79
+ },
80
+ // ── Job trigger ────────────────────────────────────────────────
81
+ enqueue_chunking_job: {
82
+ type: 'boolean',
83
+ description: 'Whether to create a job trigger that auto-enqueues chunking ' +
84
+ 'on parent INSERT/UPDATE',
85
+ default: true
86
+ },
87
+ chunking_task_name: {
88
+ type: 'string',
89
+ description: 'Task identifier for the chunking job queue',
90
+ default: 'generate_chunks'
91
+ }
92
+ }
93
+ },
94
+ tags: [
95
+ 'embedding',
96
+ 'chunks',
97
+ 'vector',
98
+ 'ai',
99
+ 'rag'
100
+ ]
101
+ };
@@ -9,9 +9,10 @@ exports.DataFileEmbedding = {
9
9
  description: 'Generic, MIME-scoped embedding node for file tables. Supports two modes: ' +
10
10
  'direct (whole-file to single vector, e.g. CLIP for images) when extraction ' +
11
11
  'is omitted, or extract (file to text to chunks to per-chunk vectors) when ' +
12
- 'extraction config is provided. Composes SearchVector + DataJobTrigger ' +
13
- 'internally. Multiple instances can coexist on the same table with different ' +
14
- 'MIME scopes, field names, and embedding strategies.',
12
+ 'extraction config is provided. Composes SearchVector + DataJobTrigger + ' +
13
+ 'DataChunks (enabled by default in extract mode) internally. Multiple ' +
14
+ 'instances can coexist on the same table with different MIME scopes, field ' +
15
+ 'names, and embedding strategies.',
15
16
  parameter_schema: {
16
17
  type: 'object',
17
18
  properties: {
@@ -114,12 +115,18 @@ exports.DataFileEmbedding = {
114
115
  }
115
116
  }
116
117
  },
117
- // ── Chunking config (optional creates embedding_chunks) ──────
118
+ // ── Chunking (enabled by default in extract mode) ──────────────
119
+ include_chunks: {
120
+ type: 'boolean',
121
+ description: 'Whether to create a chunks table via DataChunks. Defaults to true ' +
122
+ 'when extraction is provided, false in direct mode. Set explicitly ' +
123
+ 'to override.',
124
+ },
118
125
  chunks: {
119
126
  type: 'object',
120
- description: 'Chunking configuration. Creates an embedding_chunks record that drives ' +
121
- 'automatic text splitting and per-chunk embedding. Only meaningful when ' +
122
- 'extraction is also provided.',
127
+ description: 'Chunking configuration passed through to DataChunks. When ' +
128
+ 'include_chunks is true (or defaults to true in extract mode), these ' +
129
+ 'params configure the chunks table, embedding dimensions, strategy, etc.',
123
130
  properties: {
124
131
  content_field_name: {
125
132
  type: 'string',
@@ -144,8 +151,9 @@ exports.DataFileEmbedding = {
144
151
  default: 'paragraph'
145
152
  },
146
153
  metadata_fields: {
147
- type: 'object',
148
- description: 'Metadata fields from parent to copy into chunks'
154
+ type: 'array',
155
+ items: { type: 'string' },
156
+ description: 'Field names from parent to copy into chunk metadata'
149
157
  },
150
158
  enqueue_chunking_job: {
151
159
  type: 'boolean',
package/data/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { DataChunks } from './data-chunks';
1
2
  export { DataCompositeField } from './data-composite-field';
2
3
  export { DataDirectOwner } from './data-direct-owner';
3
4
  export { DataEntityMembership } from './data-entity-membership';
package/data/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.DataOwnedFields = exports.DataJsonb = exports.DataLimitCounter = exports.DataJobTrigger = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.DataImageEmbedding = exports.DataId = exports.DataForceCurrentUser = exports.DataFeatureFlag = exports.DataFileEmbedding = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = void 0;
3
+ exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.DataOwnedFields = exports.DataJsonb = exports.DataLimitCounter = exports.DataJobTrigger = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.DataImageEmbedding = exports.DataId = exports.DataForceCurrentUser = exports.DataFeatureFlag = exports.DataFileEmbedding = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = exports.DataChunks = void 0;
4
+ var data_chunks_1 = require("./data-chunks");
5
+ Object.defineProperty(exports, "DataChunks", { enumerable: true, get: function () { return data_chunks_1.DataChunks; } });
4
6
  var data_composite_field_1 = require("./data-composite-field");
5
7
  Object.defineProperty(exports, "DataCompositeField", { enumerable: true, get: function () { return data_composite_field_1.DataCompositeField; } });
6
8
  var data_direct_owner_1 = require("./data-direct-owner");
@@ -0,0 +1,18 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ /**
3
+ * Standalone chunking node type.
4
+ *
5
+ * Creates an embedding_chunks record that provisions a chunks table with:
6
+ * - FK to parent table (CASCADE delete)
7
+ * - content text field
8
+ * - chunk_index integer field
9
+ * - embedding vector(N) field with HNSW index
10
+ * - metadata jsonb field
11
+ * - RLS policies inherited from parent
12
+ * - Optional job trigger for automatic chunking on INSERT/UPDATE
13
+ *
14
+ * This node is also composed internally by DataFileEmbedding (enabled by
15
+ * default in extract mode). Use it standalone when you want a chunks table
16
+ * without the full file-embedding pipeline.
17
+ */
18
+ export declare const DataChunks: NodeTypeDefinition;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Standalone chunking node type.
3
+ *
4
+ * Creates an embedding_chunks record that provisions a chunks table with:
5
+ * - FK to parent table (CASCADE delete)
6
+ * - content text field
7
+ * - chunk_index integer field
8
+ * - embedding vector(N) field with HNSW index
9
+ * - metadata jsonb field
10
+ * - RLS policies inherited from parent
11
+ * - Optional job trigger for automatic chunking on INSERT/UPDATE
12
+ *
13
+ * This node is also composed internally by DataFileEmbedding (enabled by
14
+ * default in extract mode). Use it standalone when you want a chunks table
15
+ * without the full file-embedding pipeline.
16
+ */
17
+ export const DataChunks = {
18
+ name: 'DataChunks',
19
+ slug: 'data_chunks',
20
+ category: 'data',
21
+ display_name: 'Chunks',
22
+ description: 'Creates a chunked-embedding child table for any parent table. ' +
23
+ 'Provisions the chunks table with content, chunk_index, embedding vector, ' +
24
+ 'metadata, HNSW index, inherited RLS, and optional job trigger for ' +
25
+ 'automatic text splitting. Composed internally by DataFileEmbedding ' +
26
+ '(enabled by default in extract mode) but can also be used standalone.',
27
+ parameter_schema: {
28
+ type: 'object',
29
+ properties: {
30
+ // ── Content config ─────────────────────────────────────────────
31
+ content_field_name: {
32
+ type: 'string',
33
+ format: 'column-ref',
34
+ description: 'Name of the text content column in the chunks table',
35
+ default: 'content'
36
+ },
37
+ // ── Chunking strategy ──────────────────────────────────────────
38
+ chunk_size: {
39
+ type: 'integer',
40
+ description: 'Maximum number of characters per chunk',
41
+ default: 1000
42
+ },
43
+ chunk_overlap: {
44
+ type: 'integer',
45
+ description: 'Number of overlapping characters between consecutive chunks',
46
+ default: 200
47
+ },
48
+ chunk_strategy: {
49
+ type: 'string',
50
+ enum: ['fixed', 'sentence', 'paragraph', 'semantic'],
51
+ description: 'Strategy for splitting text into chunks',
52
+ default: 'paragraph'
53
+ },
54
+ // ── Embedding config ───────────────────────────────────────────
55
+ dimensions: {
56
+ type: 'integer',
57
+ description: 'Vector dimensions for per-chunk embeddings',
58
+ default: 768
59
+ },
60
+ metric: {
61
+ type: 'string',
62
+ enum: ['cosine', 'l2', 'ip'],
63
+ description: 'Distance metric for the HNSW index on chunk embeddings',
64
+ default: 'cosine'
65
+ },
66
+ // ── Table naming ───────────────────────────────────────────────
67
+ chunks_table_name: {
68
+ type: 'string',
69
+ description: 'Override the chunks table name. Defaults to {parent_table}_chunks.',
70
+ },
71
+ // ── Metadata ───────────────────────────────────────────────────
72
+ metadata_fields: {
73
+ type: 'array',
74
+ items: { type: 'string' },
75
+ description: 'Field names from the parent table to copy into chunk metadata'
76
+ },
77
+ // ── Job trigger ────────────────────────────────────────────────
78
+ enqueue_chunking_job: {
79
+ type: 'boolean',
80
+ description: 'Whether to create a job trigger that auto-enqueues chunking ' +
81
+ 'on parent INSERT/UPDATE',
82
+ default: true
83
+ },
84
+ chunking_task_name: {
85
+ type: 'string',
86
+ description: 'Task identifier for the chunking job queue',
87
+ default: 'generate_chunks'
88
+ }
89
+ }
90
+ },
91
+ tags: [
92
+ 'embedding',
93
+ 'chunks',
94
+ 'vector',
95
+ 'ai',
96
+ 'rag'
97
+ ]
98
+ };
@@ -6,9 +6,10 @@ export const DataFileEmbedding = {
6
6
  description: 'Generic, MIME-scoped embedding node for file tables. Supports two modes: ' +
7
7
  'direct (whole-file to single vector, e.g. CLIP for images) when extraction ' +
8
8
  'is omitted, or extract (file to text to chunks to per-chunk vectors) when ' +
9
- 'extraction config is provided. Composes SearchVector + DataJobTrigger ' +
10
- 'internally. Multiple instances can coexist on the same table with different ' +
11
- 'MIME scopes, field names, and embedding strategies.',
9
+ 'extraction config is provided. Composes SearchVector + DataJobTrigger + ' +
10
+ 'DataChunks (enabled by default in extract mode) internally. Multiple ' +
11
+ 'instances can coexist on the same table with different MIME scopes, field ' +
12
+ 'names, and embedding strategies.',
12
13
  parameter_schema: {
13
14
  type: 'object',
14
15
  properties: {
@@ -111,12 +112,18 @@ export const DataFileEmbedding = {
111
112
  }
112
113
  }
113
114
  },
114
- // ── Chunking config (optional creates embedding_chunks) ──────
115
+ // ── Chunking (enabled by default in extract mode) ──────────────
116
+ include_chunks: {
117
+ type: 'boolean',
118
+ description: 'Whether to create a chunks table via DataChunks. Defaults to true ' +
119
+ 'when extraction is provided, false in direct mode. Set explicitly ' +
120
+ 'to override.',
121
+ },
115
122
  chunks: {
116
123
  type: 'object',
117
- description: 'Chunking configuration. Creates an embedding_chunks record that drives ' +
118
- 'automatic text splitting and per-chunk embedding. Only meaningful when ' +
119
- 'extraction is also provided.',
124
+ description: 'Chunking configuration passed through to DataChunks. When ' +
125
+ 'include_chunks is true (or defaults to true in extract mode), these ' +
126
+ 'params configure the chunks table, embedding dimensions, strategy, etc.',
120
127
  properties: {
121
128
  content_field_name: {
122
129
  type: 'string',
@@ -141,8 +148,9 @@ export const DataFileEmbedding = {
141
148
  default: 'paragraph'
142
149
  },
143
150
  metadata_fields: {
144
- type: 'object',
145
- description: 'Metadata fields from parent to copy into chunks'
151
+ type: 'array',
152
+ items: { type: 'string' },
153
+ description: 'Field names from parent to copy into chunk metadata'
146
154
  },
147
155
  enqueue_chunking_job: {
148
156
  type: 'boolean',
@@ -1,3 +1,4 @@
1
+ export { DataChunks } from './data-chunks';
1
2
  export { DataCompositeField } from './data-composite-field';
2
3
  export { DataDirectOwner } from './data-direct-owner';
3
4
  export { DataEntityMembership } from './data-entity-membership';
package/esm/data/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { DataChunks } from './data-chunks';
1
2
  export { DataCompositeField } from './data-composite-field';
2
3
  export { DataDirectOwner } from './data-direct-owner';
3
4
  export { DataEntityMembership } from './data-entity-membership';
@@ -33,6 +33,9 @@ export const PresetAuthEmailMagic = {
33
33
  modules: [
34
34
  'users_module',
35
35
  'membership_types_module',
36
+ 'permissions_module:app',
37
+ 'limits_module:app',
38
+ 'levels_module:app',
36
39
  'memberships_module:app',
37
40
  'sessions_module',
38
41
  'secrets_module',
@@ -9,9 +9,13 @@ import type { ModulePreset } from './types';
9
9
  * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
10
10
  * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
11
11
  *
12
+ * Includes `permissions_module:app`, `limits_module:app`, and
13
+ * `levels_module:app` because `memberships_module:app` has NOT NULL
14
+ * foreign keys to the tables they create (grants, caps, levels).
15
+ *
12
16
  * It deliberately excludes rate limits, connected accounts / identity
13
17
  * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
14
- * permissions, and org-scoped memberships. Bolt those on by moving to a
15
- * richer preset (`auth:hardened`, `b2b`) when you actually need them.
18
+ * and org-scoped memberships. Bolt those on by moving to a richer preset
19
+ * (`auth:hardened`, `b2b`) when you actually need them.
16
20
  */
17
21
  export declare const PresetAuthEmail: ModulePreset;
@@ -8,24 +8,28 @@
8
8
  * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
9
9
  * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
10
10
  *
11
+ * Includes `permissions_module:app`, `limits_module:app`, and
12
+ * `levels_module:app` because `memberships_module:app` has NOT NULL
13
+ * foreign keys to the tables they create (grants, caps, levels).
14
+ *
11
15
  * It deliberately excludes rate limits, connected accounts / identity
12
16
  * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
13
- * permissions, and org-scoped memberships. Bolt those on by moving to a
14
- * richer preset (`auth:hardened`, `b2b`) when you actually need them.
17
+ * and org-scoped memberships. Bolt those on by moving to a richer preset
18
+ * (`auth:hardened`, `b2b`) when you actually need them.
15
19
  */
16
20
  export const PresetAuthEmail = {
17
21
  name: 'auth:email',
18
22
  display_name: 'Email + Password',
19
- summary: 'Standard email/password auth flow. No orgs, no SSO, no MFA, no rate limits.',
23
+ summary: 'Standard email/password auth flow with app-level permissions. No orgs, no SSO, no MFA.',
20
24
  description: 'Installs `user_auth_module` with exactly the table dependencies its insert trigger ' +
21
- 'hard-requires: users, app-scoped memberships, emails, secrets, encrypted secrets, ' +
22
- 'sessions, plus RLS. You get the standard password-based auth procedures (sign_up, ' +
23
- "sign_in, reset_password, verify_email, delete_account, ...) and that's it. " +
24
- 'Everything else in the module catalog — SSO, passkeys, SMS, rate limits, orgs, ' +
25
- 'invites, permissions is deliberately omitted. This is the right shape for single-tenant ' +
26
- 'consumer apps in the first weeks, internal tools that need a real login, or anything ' +
27
- 'where you want the lightest possible working auth and will add complexity only when ' +
28
- 'forced to.',
25
+ 'hard-requires: users, app-scoped memberships (plus their permissions/limits/levels ' +
26
+ 'dependencies), emails, secrets, encrypted secrets, sessions, plus RLS. You get the ' +
27
+ 'standard password-based auth procedures (sign_up, sign_in, reset_password, ' +
28
+ "verify_email, delete_account, ...) and that's it. Everything else in the module " +
29
+ 'catalogSSO, passkeys, SMS, rate limits, orgs, invites is deliberately omitted. ' +
30
+ 'This is the right shape for single-tenant consumer apps in the first weeks, internal ' +
31
+ 'tools that need a real login, or anything where you want the lightest possible working ' +
32
+ 'auth and will add complexity only when forced to.',
29
33
  good_for: [
30
34
  'Single-tenant consumer apps in the first week of development',
31
35
  'Internal tools where one simple login is enough',
@@ -40,6 +44,9 @@ export const PresetAuthEmail = {
40
44
  modules: [
41
45
  'users_module',
42
46
  'membership_types_module',
47
+ 'permissions_module:app',
48
+ 'limits_module:app',
49
+ 'levels_module:app',
43
50
  'memberships_module:app',
44
51
  'sessions_module',
45
52
  'secrets_module',
@@ -51,6 +58,9 @@ export const PresetAuthEmail = {
51
58
  includes_notes: {
52
59
  'memberships_module:app': 'Required by `user_auth_module`: every user gets an app-level membership row at sign-up.',
53
60
  membership_types_module: "Required by `memberships_module:app`; defines the 'app' scope.",
61
+ 'permissions_module:app': 'Required by `memberships_module:app`: NOT NULL FK to grants table.',
62
+ 'limits_module:app': 'Required by `memberships_module:app`: NOT NULL FK to caps table.',
63
+ 'levels_module:app': 'Required by `memberships_module:app`: NOT NULL FK to levels table.',
54
64
  emails_module: 'Required by the `user_auth_module` insert trigger (`RAISE EXCEPTION REQUIRES emails_module`).',
55
65
  encrypted_secrets_module: 'Required for password hashing; referenced by `set_password`, `verify_password`, and reset flows.',
56
66
  secrets_module: 'API-key storage (`create_api_key`, `revoke_api_key`, `my_api_keys`).'
@@ -62,7 +72,6 @@ export const PresetAuthEmail = {
62
72
  webauthn_credentials_module: 'No passkeys — add `auth:passkey`.',
63
73
  phone_numbers_module: 'No SMS login — add `auth:hardened` or the SMS-only refactor path.',
64
74
  'memberships_module:org': 'No org/team structure — move to `b2b` when you need one.',
65
- 'permissions_module:app': 'No fine-grained RBAC; the `is_admin` flag on users is the only gate.',
66
75
  invites_module: 'Self-serve signup only.',
67
76
  session_secrets_module: 'No magic-link / email-OTP nonces; add `auth:email+magic`.'
68
77
  }
@@ -30,6 +30,9 @@ export const PresetAuthHardened = {
30
30
  modules: [
31
31
  'users_module',
32
32
  'membership_types_module',
33
+ 'permissions_module:app',
34
+ 'limits_module:app',
35
+ 'levels_module:app',
33
36
  'memberships_module:app',
34
37
  'sessions_module',
35
38
  'secrets_module',
@@ -56,7 +59,6 @@ export const PresetAuthHardened = {
56
59
  },
57
60
  omits_notes: {
58
61
  'memberships_module:org': 'No orgs / teams — use `b2b` when you need multi-tenancy.',
59
- 'permissions_module:app': 'No RBAC beyond the `is_admin` flag — add via `b2b`.',
60
62
  invites_module: 'No invite flow — add via `b2b`.',
61
63
  storage_module: 'Add separately if you need file uploads.',
62
64
  crypto_addresses_module: 'Not a web3 preset; omit unless doing wallet sign-in.'
@@ -31,6 +31,9 @@ export const PresetAuthPasskey = {
31
31
  modules: [
32
32
  'users_module',
33
33
  'membership_types_module',
34
+ 'permissions_module:app',
35
+ 'limits_module:app',
36
+ 'levels_module:app',
34
37
  'memberships_module:app',
35
38
  'sessions_module',
36
39
  'secrets_module',
@@ -40,6 +40,9 @@ export const PresetAuthSso = {
40
40
  modules: [
41
41
  'users_module',
42
42
  'membership_types_module',
43
+ 'permissions_module:app',
44
+ 'limits_module:app',
45
+ 'levels_module:app',
43
46
  'memberships_module:app',
44
47
  'sessions_module',
45
48
  'secrets_module',
@@ -0,0 +1,13 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `b2b:storage` — everything in `b2b` plus `storage_module` for file uploads.
4
+ *
5
+ * This is the common shape for B2B SaaS apps that need file upload
6
+ * infrastructure tied to their org/workspace structure. The storage module
7
+ * creates `app_buckets` and `app_files` tables with RLS policies, and
8
+ * entity-type-level storage scopes can be provisioned on top.
9
+ *
10
+ * If you don't need orgs, use a lighter preset and add `storage_module`
11
+ * separately via provisioning options.
12
+ */
13
+ export declare const PresetB2bStorage: ModulePreset;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `b2b:storage` — everything in `b2b` plus `storage_module` for file uploads.
3
+ *
4
+ * This is the common shape for B2B SaaS apps that need file upload
5
+ * infrastructure tied to their org/workspace structure. The storage module
6
+ * creates `app_buckets` and `app_files` tables with RLS policies, and
7
+ * entity-type-level storage scopes can be provisioned on top.
8
+ *
9
+ * If you don't need orgs, use a lighter preset and add `storage_module`
10
+ * separately via provisioning options.
11
+ */
12
+ export const PresetB2bStorage = {
13
+ name: 'b2b:storage',
14
+ display_name: 'B2B SaaS + File Storage',
15
+ summary: '`b2b` + file upload infrastructure (buckets, files, RLS).',
16
+ description: 'Everything in `b2b` (auth:hardened + orgs + invites + permissions + levels + profiles + ' +
17
+ 'hierarchy), plus `storage_module` for file uploads. The storage module creates ' +
18
+ '`app_buckets` and `app_files` tables with full RLS: AuthzPublishable for public reads, ' +
19
+ 'AuthzAppMembership for member access, AuthzDirectOwner for uploader-only modify/delete. ' +
20
+ 'Entity-type provisioning with `has_storage=true` adds per-scope storage tables ' +
21
+ 'automatically. Choose this when your B2B app needs file uploads, avatars, attachments, ' +
22
+ 'or any object storage tied to workspaces.',
23
+ good_for: [
24
+ 'B2B SaaS with file uploads (documents, avatars, attachments)',
25
+ 'Apps where storage is scoped to orgs/workspaces',
26
+ 'Apps that need per-entity-type file storage (e.g., project files, team assets)'
27
+ ],
28
+ not_for: [
29
+ 'Single-tenant consumer apps — use `auth:email` or `auth:hardened` and add storage separately',
30
+ 'Apps without file upload needs — use `b2b` to avoid the storage table overhead'
31
+ ],
32
+ modules: [
33
+ 'users_module',
34
+ 'membership_types_module',
35
+ 'permissions_module:app',
36
+ 'permissions_module:org',
37
+ 'limits_module:app',
38
+ 'limits_module:org',
39
+ 'levels_module:app',
40
+ 'levels_module:org',
41
+ 'memberships_module:app',
42
+ 'memberships_module:org',
43
+ 'sessions_module',
44
+ 'secrets_module',
45
+ 'encrypted_secrets_module',
46
+ 'emails_module',
47
+ 'rls_module',
48
+ 'user_auth_module',
49
+ 'session_secrets_module',
50
+ 'rate_limits_module',
51
+ 'connected_accounts_module',
52
+ 'identity_providers_module',
53
+ 'webauthn_credentials_module',
54
+ 'webauthn_auth_module',
55
+ 'phone_numbers_module',
56
+ 'profiles_module:app',
57
+ 'profiles_module:org',
58
+ 'hierarchy_module:org',
59
+ 'invites_module:app',
60
+ 'invites_module:org',
61
+ 'storage_module'
62
+ ],
63
+ includes_notes: {
64
+ storage_module: 'File upload infrastructure: app_buckets + app_files tables with RLS. Entity-type storage scopes layered on top via `has_storage=true`.'
65
+ },
66
+ omits_notes: {
67
+ crypto_addresses_module: 'Not a web3 preset.'
68
+ },
69
+ extends: ['b2b']
70
+ };
@@ -5,10 +5,11 @@ import { PresetAuthHardened } from './auth-hardened';
5
5
  import { PresetAuthPasskey } from './auth-passkey';
6
6
  import { PresetAuthSso } from './auth-sso';
7
7
  import { PresetB2b } from './b2b';
8
+ import { PresetB2bStorage } from './b2b-storage';
8
9
  import { PresetFull } from './full';
9
10
  import { PresetMinimal } from './minimal';
10
11
  import type { ModulePreset } from './types';
11
- export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetFull, PresetMinimal };
12
+ export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetB2bStorage, PresetFull, PresetMinimal };
12
13
  /**
13
14
  * Ordered list of all shipped module presets, from smallest to largest
14
15
  * module footprint. Stable ordering — CLIs / UIs can present this directly.
@@ -4,9 +4,10 @@ import { PresetAuthHardened } from './auth-hardened';
4
4
  import { PresetAuthPasskey } from './auth-passkey';
5
5
  import { PresetAuthSso } from './auth-sso';
6
6
  import { PresetB2b } from './b2b';
7
+ import { PresetB2bStorage } from './b2b-storage';
7
8
  import { PresetFull } from './full';
8
9
  import { PresetMinimal } from './minimal';
9
- export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetFull, PresetMinimal };
10
+ export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetB2bStorage, PresetFull, PresetMinimal };
10
11
  /**
11
12
  * Ordered list of all shipped module presets, from smallest to largest
12
13
  * module footprint. Stable ordering — CLIs / UIs can present this directly.
@@ -19,6 +20,7 @@ export const allModulePresets = [
19
20
  PresetAuthPasskey,
20
21
  PresetAuthHardened,
21
22
  PresetB2b,
23
+ PresetB2bStorage,
22
24
  PresetFull
23
25
  ];
24
26
  /** Look up a preset by name. Returns undefined if the name isn't known. */
@@ -36,6 +36,9 @@ exports.PresetAuthEmailMagic = {
36
36
  modules: [
37
37
  'users_module',
38
38
  'membership_types_module',
39
+ 'permissions_module:app',
40
+ 'limits_module:app',
41
+ 'levels_module:app',
39
42
  'memberships_module:app',
40
43
  'sessions_module',
41
44
  'secrets_module',
@@ -9,9 +9,13 @@ import type { ModulePreset } from './types';
9
9
  * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
10
10
  * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
11
11
  *
12
+ * Includes `permissions_module:app`, `limits_module:app`, and
13
+ * `levels_module:app` because `memberships_module:app` has NOT NULL
14
+ * foreign keys to the tables they create (grants, caps, levels).
15
+ *
12
16
  * It deliberately excludes rate limits, connected accounts / identity
13
17
  * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
14
- * permissions, and org-scoped memberships. Bolt those on by moving to a
15
- * richer preset (`auth:hardened`, `b2b`) when you actually need them.
18
+ * and org-scoped memberships. Bolt those on by moving to a richer preset
19
+ * (`auth:hardened`, `b2b`) when you actually need them.
16
20
  */
17
21
  export declare const PresetAuthEmail: ModulePreset;
@@ -11,24 +11,28 @@ exports.PresetAuthEmail = void 0;
11
11
  * `set_password`, `reset_password`, `forgot_password`, `verify_email`,
12
12
  * `delete_account`, `my_sessions`, API-key CRUD. Nothing more.
13
13
  *
14
+ * Includes `permissions_module:app`, `limits_module:app`, and
15
+ * `levels_module:app` because `memberships_module:app` has NOT NULL
16
+ * foreign keys to the tables they create (grants, caps, levels).
17
+ *
14
18
  * It deliberately excludes rate limits, connected accounts / identity
15
19
  * providers (OAuth), WebAuthn (passkeys), phone numbers (SMS), invites,
16
- * permissions, and org-scoped memberships. Bolt those on by moving to a
17
- * richer preset (`auth:hardened`, `b2b`) when you actually need them.
20
+ * and org-scoped memberships. Bolt those on by moving to a richer preset
21
+ * (`auth:hardened`, `b2b`) when you actually need them.
18
22
  */
19
23
  exports.PresetAuthEmail = {
20
24
  name: 'auth:email',
21
25
  display_name: 'Email + Password',
22
- summary: 'Standard email/password auth flow. No orgs, no SSO, no MFA, no rate limits.',
26
+ summary: 'Standard email/password auth flow with app-level permissions. No orgs, no SSO, no MFA.',
23
27
  description: 'Installs `user_auth_module` with exactly the table dependencies its insert trigger ' +
24
- 'hard-requires: users, app-scoped memberships, emails, secrets, encrypted secrets, ' +
25
- 'sessions, plus RLS. You get the standard password-based auth procedures (sign_up, ' +
26
- "sign_in, reset_password, verify_email, delete_account, ...) and that's it. " +
27
- 'Everything else in the module catalog — SSO, passkeys, SMS, rate limits, orgs, ' +
28
- 'invites, permissions is deliberately omitted. This is the right shape for single-tenant ' +
29
- 'consumer apps in the first weeks, internal tools that need a real login, or anything ' +
30
- 'where you want the lightest possible working auth and will add complexity only when ' +
31
- 'forced to.',
28
+ 'hard-requires: users, app-scoped memberships (plus their permissions/limits/levels ' +
29
+ 'dependencies), emails, secrets, encrypted secrets, sessions, plus RLS. You get the ' +
30
+ 'standard password-based auth procedures (sign_up, sign_in, reset_password, ' +
31
+ "verify_email, delete_account, ...) and that's it. Everything else in the module " +
32
+ 'catalogSSO, passkeys, SMS, rate limits, orgs, invites is deliberately omitted. ' +
33
+ 'This is the right shape for single-tenant consumer apps in the first weeks, internal ' +
34
+ 'tools that need a real login, or anything where you want the lightest possible working ' +
35
+ 'auth and will add complexity only when forced to.',
32
36
  good_for: [
33
37
  'Single-tenant consumer apps in the first week of development',
34
38
  'Internal tools where one simple login is enough',
@@ -43,6 +47,9 @@ exports.PresetAuthEmail = {
43
47
  modules: [
44
48
  'users_module',
45
49
  'membership_types_module',
50
+ 'permissions_module:app',
51
+ 'limits_module:app',
52
+ 'levels_module:app',
46
53
  'memberships_module:app',
47
54
  'sessions_module',
48
55
  'secrets_module',
@@ -54,6 +61,9 @@ exports.PresetAuthEmail = {
54
61
  includes_notes: {
55
62
  'memberships_module:app': 'Required by `user_auth_module`: every user gets an app-level membership row at sign-up.',
56
63
  membership_types_module: "Required by `memberships_module:app`; defines the 'app' scope.",
64
+ 'permissions_module:app': 'Required by `memberships_module:app`: NOT NULL FK to grants table.',
65
+ 'limits_module:app': 'Required by `memberships_module:app`: NOT NULL FK to caps table.',
66
+ 'levels_module:app': 'Required by `memberships_module:app`: NOT NULL FK to levels table.',
57
67
  emails_module: 'Required by the `user_auth_module` insert trigger (`RAISE EXCEPTION REQUIRES emails_module`).',
58
68
  encrypted_secrets_module: 'Required for password hashing; referenced by `set_password`, `verify_password`, and reset flows.',
59
69
  secrets_module: 'API-key storage (`create_api_key`, `revoke_api_key`, `my_api_keys`).'
@@ -65,7 +75,6 @@ exports.PresetAuthEmail = {
65
75
  webauthn_credentials_module: 'No passkeys — add `auth:passkey`.',
66
76
  phone_numbers_module: 'No SMS login — add `auth:hardened` or the SMS-only refactor path.',
67
77
  'memberships_module:org': 'No org/team structure — move to `b2b` when you need one.',
68
- 'permissions_module:app': 'No fine-grained RBAC; the `is_admin` flag on users is the only gate.',
69
78
  invites_module: 'Self-serve signup only.',
70
79
  session_secrets_module: 'No magic-link / email-OTP nonces; add `auth:email+magic`.'
71
80
  }
@@ -33,6 +33,9 @@ exports.PresetAuthHardened = {
33
33
  modules: [
34
34
  'users_module',
35
35
  'membership_types_module',
36
+ 'permissions_module:app',
37
+ 'limits_module:app',
38
+ 'levels_module:app',
36
39
  'memberships_module:app',
37
40
  'sessions_module',
38
41
  'secrets_module',
@@ -59,7 +62,6 @@ exports.PresetAuthHardened = {
59
62
  },
60
63
  omits_notes: {
61
64
  'memberships_module:org': 'No orgs / teams — use `b2b` when you need multi-tenancy.',
62
- 'permissions_module:app': 'No RBAC beyond the `is_admin` flag — add via `b2b`.',
63
65
  invites_module: 'No invite flow — add via `b2b`.',
64
66
  storage_module: 'Add separately if you need file uploads.',
65
67
  crypto_addresses_module: 'Not a web3 preset; omit unless doing wallet sign-in.'
@@ -34,6 +34,9 @@ exports.PresetAuthPasskey = {
34
34
  modules: [
35
35
  'users_module',
36
36
  'membership_types_module',
37
+ 'permissions_module:app',
38
+ 'limits_module:app',
39
+ 'levels_module:app',
37
40
  'memberships_module:app',
38
41
  'sessions_module',
39
42
  'secrets_module',
@@ -43,6 +43,9 @@ exports.PresetAuthSso = {
43
43
  modules: [
44
44
  'users_module',
45
45
  'membership_types_module',
46
+ 'permissions_module:app',
47
+ 'limits_module:app',
48
+ 'levels_module:app',
46
49
  'memberships_module:app',
47
50
  'sessions_module',
48
51
  'secrets_module',
@@ -0,0 +1,13 @@
1
+ import type { ModulePreset } from './types';
2
+ /**
3
+ * `b2b:storage` — everything in `b2b` plus `storage_module` for file uploads.
4
+ *
5
+ * This is the common shape for B2B SaaS apps that need file upload
6
+ * infrastructure tied to their org/workspace structure. The storage module
7
+ * creates `app_buckets` and `app_files` tables with RLS policies, and
8
+ * entity-type-level storage scopes can be provisioned on top.
9
+ *
10
+ * If you don't need orgs, use a lighter preset and add `storage_module`
11
+ * separately via provisioning options.
12
+ */
13
+ export declare const PresetB2bStorage: ModulePreset;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetB2bStorage = void 0;
4
+ /**
5
+ * `b2b:storage` — everything in `b2b` plus `storage_module` for file uploads.
6
+ *
7
+ * This is the common shape for B2B SaaS apps that need file upload
8
+ * infrastructure tied to their org/workspace structure. The storage module
9
+ * creates `app_buckets` and `app_files` tables with RLS policies, and
10
+ * entity-type-level storage scopes can be provisioned on top.
11
+ *
12
+ * If you don't need orgs, use a lighter preset and add `storage_module`
13
+ * separately via provisioning options.
14
+ */
15
+ exports.PresetB2bStorage = {
16
+ name: 'b2b:storage',
17
+ display_name: 'B2B SaaS + File Storage',
18
+ summary: '`b2b` + file upload infrastructure (buckets, files, RLS).',
19
+ description: 'Everything in `b2b` (auth:hardened + orgs + invites + permissions + levels + profiles + ' +
20
+ 'hierarchy), plus `storage_module` for file uploads. The storage module creates ' +
21
+ '`app_buckets` and `app_files` tables with full RLS: AuthzPublishable for public reads, ' +
22
+ 'AuthzAppMembership for member access, AuthzDirectOwner for uploader-only modify/delete. ' +
23
+ 'Entity-type provisioning with `has_storage=true` adds per-scope storage tables ' +
24
+ 'automatically. Choose this when your B2B app needs file uploads, avatars, attachments, ' +
25
+ 'or any object storage tied to workspaces.',
26
+ good_for: [
27
+ 'B2B SaaS with file uploads (documents, avatars, attachments)',
28
+ 'Apps where storage is scoped to orgs/workspaces',
29
+ 'Apps that need per-entity-type file storage (e.g., project files, team assets)'
30
+ ],
31
+ not_for: [
32
+ 'Single-tenant consumer apps — use `auth:email` or `auth:hardened` and add storage separately',
33
+ 'Apps without file upload needs — use `b2b` to avoid the storage table overhead'
34
+ ],
35
+ modules: [
36
+ 'users_module',
37
+ 'membership_types_module',
38
+ 'permissions_module:app',
39
+ 'permissions_module:org',
40
+ 'limits_module:app',
41
+ 'limits_module:org',
42
+ 'levels_module:app',
43
+ 'levels_module:org',
44
+ 'memberships_module:app',
45
+ 'memberships_module:org',
46
+ 'sessions_module',
47
+ 'secrets_module',
48
+ 'encrypted_secrets_module',
49
+ 'emails_module',
50
+ 'rls_module',
51
+ 'user_auth_module',
52
+ 'session_secrets_module',
53
+ 'rate_limits_module',
54
+ 'connected_accounts_module',
55
+ 'identity_providers_module',
56
+ 'webauthn_credentials_module',
57
+ 'webauthn_auth_module',
58
+ 'phone_numbers_module',
59
+ 'profiles_module:app',
60
+ 'profiles_module:org',
61
+ 'hierarchy_module:org',
62
+ 'invites_module:app',
63
+ 'invites_module:org',
64
+ 'storage_module'
65
+ ],
66
+ includes_notes: {
67
+ storage_module: 'File upload infrastructure: app_buckets + app_files tables with RLS. Entity-type storage scopes layered on top via `has_storage=true`.'
68
+ },
69
+ omits_notes: {
70
+ crypto_addresses_module: 'Not a web3 preset.'
71
+ },
72
+ extends: ['b2b']
73
+ };
@@ -5,10 +5,11 @@ import { PresetAuthHardened } from './auth-hardened';
5
5
  import { PresetAuthPasskey } from './auth-passkey';
6
6
  import { PresetAuthSso } from './auth-sso';
7
7
  import { PresetB2b } from './b2b';
8
+ import { PresetB2bStorage } from './b2b-storage';
8
9
  import { PresetFull } from './full';
9
10
  import { PresetMinimal } from './minimal';
10
11
  import type { ModulePreset } from './types';
11
- export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetFull, PresetMinimal };
12
+ export { PresetAuthEmail, PresetAuthEmailMagic, PresetAuthHardened, PresetAuthPasskey, PresetAuthSso, PresetB2b, PresetB2bStorage, PresetFull, PresetMinimal };
12
13
  /**
13
14
  * Ordered list of all shipped module presets, from smallest to largest
14
15
  * module footprint. Stable ordering — CLIs / UIs can present this directly.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.allModulePresets = exports.PresetMinimal = exports.PresetFull = exports.PresetB2b = exports.PresetAuthSso = exports.PresetAuthPasskey = exports.PresetAuthHardened = exports.PresetAuthEmailMagic = exports.PresetAuthEmail = void 0;
3
+ exports.allModulePresets = exports.PresetMinimal = exports.PresetFull = exports.PresetB2bStorage = exports.PresetB2b = exports.PresetAuthSso = exports.PresetAuthPasskey = exports.PresetAuthHardened = exports.PresetAuthEmailMagic = exports.PresetAuthEmail = void 0;
4
4
  exports.getModulePreset = getModulePreset;
5
5
  const auth_email_1 = require("./auth-email");
6
6
  Object.defineProperty(exports, "PresetAuthEmail", { enumerable: true, get: function () { return auth_email_1.PresetAuthEmail; } });
@@ -14,6 +14,8 @@ const auth_sso_1 = require("./auth-sso");
14
14
  Object.defineProperty(exports, "PresetAuthSso", { enumerable: true, get: function () { return auth_sso_1.PresetAuthSso; } });
15
15
  const b2b_1 = require("./b2b");
16
16
  Object.defineProperty(exports, "PresetB2b", { enumerable: true, get: function () { return b2b_1.PresetB2b; } });
17
+ const b2b_storage_1 = require("./b2b-storage");
18
+ Object.defineProperty(exports, "PresetB2bStorage", { enumerable: true, get: function () { return b2b_storage_1.PresetB2bStorage; } });
17
19
  const full_1 = require("./full");
18
20
  Object.defineProperty(exports, "PresetFull", { enumerable: true, get: function () { return full_1.PresetFull; } });
19
21
  const minimal_1 = require("./minimal");
@@ -30,6 +32,7 @@ exports.allModulePresets = [
30
32
  auth_passkey_1.PresetAuthPasskey,
31
33
  auth_hardened_1.PresetAuthHardened,
32
34
  b2b_1.PresetB2b,
35
+ b2b_storage_1.PresetB2bStorage,
33
36
  full_1.PresetFull
34
37
  ];
35
38
  /** Look up a preset by name. Returns undefined if the name isn't known. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-type-registry",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Node type definitions for the Constructive blueprint system. Single source of truth for all Authz*, Data*, Relation*, and View* node types.",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -47,5 +47,5 @@
47
47
  "registry",
48
48
  "graphile"
49
49
  ],
50
- "gitHead": "0538fe39630e6bafd228cb3f2b114fff4f9a61aa"
50
+ "gitHead": "97ec8e14f2b0855b0ee0bc732a082e1a91301b64"
51
51
  }