node-type-registry 0.18.1 → 0.20.0
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.
- package/authz/authz-allow-all.js +10 -10
- package/authz/authz-composite.js +28 -28
- package/authz/authz-deny-all.js +10 -10
- package/authz/authz-direct-owner-any.js +19 -18
- package/authz/authz-direct-owner.js +17 -16
- package/authz/authz-entity-membership.js +39 -38
- package/authz/authz-member-list.js +17 -16
- package/authz/authz-membership-check.js +34 -34
- package/authz/authz-not-read-only.js +23 -22
- package/authz/authz-org-hierarchy.js +33 -31
- package/authz/authz-peer-ownership.js +40 -39
- package/authz/authz-publishable.js +26 -24
- package/authz/authz-related-entity-membership.js +57 -55
- package/authz/authz-related-member-list.js +35 -32
- package/authz/authz-related-peer-ownership.js +62 -59
- package/authz/authz-temporal.js +32 -30
- package/authz/index.d.ts +9 -9
- package/authz/index.js +19 -19
- package/blueprint-types.generated.d.ts +10 -17
- package/blueprint-types.generated.js +1 -1
- package/codegen/generate-types.js +10 -21
- package/data/data-composite-field.js +27 -25
- package/data/data-direct-owner.js +24 -23
- package/data/data-entity-membership.js +24 -23
- package/data/data-force-current-user.js +17 -16
- package/data/data-id.js +16 -15
- package/data/data-immutable-fields.js +20 -19
- package/data/data-inflection.js +33 -32
- package/data/data-inherit-from-parent.js +31 -29
- package/data/data-job-trigger.js +87 -84
- package/data/data-jsonb.js +27 -26
- package/data/data-owned-fields.js +25 -23
- package/data/data-ownership-in-entity.js +21 -21
- package/data/data-peoplestamps.js +19 -19
- package/data/data-publishable.js +16 -16
- package/data/data-slug.js +21 -19
- package/data/data-soft-delete.js +14 -14
- package/data/data-status-field.js +32 -31
- package/data/data-tags.js +23 -22
- package/data/data-timestamps.js +15 -15
- package/data/index.d.ts +17 -17
- package/data/index.js +35 -35
- package/data/search-bm25.js +34 -33
- package/data/search-full-text.js +49 -47
- package/data/search-spatial-aggregate.js +77 -74
- package/data/search-spatial.js +51 -50
- package/data/search-trgm.js +20 -19
- package/data/search-unified.js +170 -162
- package/data/search-vector.js +104 -101
- package/data/table-organization-settings.js +13 -13
- package/data/table-user-profiles.js +13 -13
- package/data/table-user-settings.js +13 -13
- package/esm/authz/authz-allow-all.js +10 -10
- package/esm/authz/authz-composite.js +28 -28
- package/esm/authz/authz-deny-all.js +10 -10
- package/esm/authz/authz-direct-owner-any.js +19 -18
- package/esm/authz/authz-direct-owner.js +17 -16
- package/esm/authz/authz-entity-membership.js +39 -38
- package/esm/authz/authz-member-list.js +17 -16
- package/esm/authz/authz-membership-check.js +34 -34
- package/esm/authz/authz-not-read-only.js +23 -22
- package/esm/authz/authz-org-hierarchy.js +33 -31
- package/esm/authz/authz-peer-ownership.js +40 -39
- package/esm/authz/authz-publishable.js +26 -24
- package/esm/authz/authz-related-entity-membership.js +57 -55
- package/esm/authz/authz-related-member-list.js +35 -32
- package/esm/authz/authz-related-peer-ownership.js +62 -59
- package/esm/authz/authz-temporal.js +32 -30
- package/esm/authz/index.d.ts +9 -9
- package/esm/authz/index.js +9 -9
- package/esm/blueprint-types.generated.d.ts +10 -17
- package/esm/blueprint-types.generated.js +1 -1
- package/esm/codegen/generate-types.js +10 -21
- package/esm/data/data-composite-field.js +27 -25
- package/esm/data/data-direct-owner.js +24 -23
- package/esm/data/data-entity-membership.js +24 -23
- package/esm/data/data-force-current-user.js +17 -16
- package/esm/data/data-id.js +16 -15
- package/esm/data/data-immutable-fields.js +20 -19
- package/esm/data/data-inflection.js +33 -32
- package/esm/data/data-inherit-from-parent.js +31 -29
- package/esm/data/data-job-trigger.js +87 -84
- package/esm/data/data-jsonb.js +27 -26
- package/esm/data/data-owned-fields.js +25 -23
- package/esm/data/data-ownership-in-entity.js +21 -21
- package/esm/data/data-peoplestamps.js +19 -19
- package/esm/data/data-publishable.js +16 -16
- package/esm/data/data-slug.js +21 -19
- package/esm/data/data-soft-delete.js +14 -14
- package/esm/data/data-status-field.js +32 -31
- package/esm/data/data-tags.js +23 -22
- package/esm/data/data-timestamps.js +15 -15
- package/esm/data/index.d.ts +17 -17
- package/esm/data/index.js +17 -17
- package/esm/data/search-bm25.js +34 -33
- package/esm/data/search-full-text.js +49 -47
- package/esm/data/search-spatial-aggregate.js +77 -74
- package/esm/data/search-spatial.js +51 -50
- package/esm/data/search-trgm.js +20 -19
- package/esm/data/search-unified.js +170 -162
- package/esm/data/search-vector.js +104 -101
- package/esm/data/table-organization-settings.js +13 -13
- package/esm/data/table-user-profiles.js +13 -13
- package/esm/data/table-user-settings.js +13 -13
- package/esm/index.d.ts +3 -3
- package/esm/index.js +3 -3
- package/esm/module-presets/auth-email-magic.js +2 -2
- package/esm/module-presets/auth-email.js +8 -8
- package/esm/module-presets/auth-passkey.js +4 -4
- package/esm/module-presets/auth-sso.js +7 -7
- package/esm/module-presets/full.js +1 -1
- package/esm/module-presets/index.d.ts +5 -5
- package/esm/module-presets/index.js +4 -4
- package/esm/relation/index.d.ts +1 -1
- package/esm/relation/index.js +1 -1
- package/esm/relation/relation-belongs-to.js +41 -40
- package/esm/relation/relation-has-many.js +42 -41
- package/esm/relation/relation-has-one.js +42 -41
- package/esm/relation/relation-many-to-many.js +70 -68
- package/esm/relation/relation-spatial.js +54 -54
- package/esm/view/index.d.ts +3 -3
- package/esm/view/index.js +3 -3
- package/esm/view/view-aggregated.js +50 -48
- package/esm/view/view-composite.js +18 -18
- package/esm/view/view-filtered-table.js +37 -36
- package/esm/view/view-joined-tables.js +65 -61
- package/esm/view/view-table-projection.js +29 -28
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/module-presets/auth-email-magic.js +2 -2
- package/module-presets/auth-email.js +8 -8
- package/module-presets/auth-passkey.js +4 -4
- package/module-presets/auth-sso.js +7 -7
- package/module-presets/full.js +1 -1
- package/module-presets/index.d.ts +5 -5
- package/module-presets/index.js +7 -7
- package/package.json +2 -2
- package/relation/index.d.ts +1 -1
- package/relation/index.js +3 -3
- package/relation/relation-belongs-to.js +41 -40
- package/relation/relation-has-many.js +42 -41
- package/relation/relation-has-one.js +42 -41
- package/relation/relation-many-to-many.js +70 -68
- package/relation/relation-spatial.js +54 -54
- package/view/index.d.ts +3 -3
- package/view/index.js +7 -7
- package/view/view-aggregated.js +50 -48
- package/view/view-composite.js +18 -18
- package/view/view-filtered-table.js +37 -36
- package/view/view-joined-tables.js +65 -61
- package/view/view-table-projection.js +29 -28
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
export const AuthzTemporal = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
name: 'AuthzTemporal',
|
|
3
|
+
slug: 'authz_temporal',
|
|
4
|
+
category: 'authz',
|
|
5
|
+
display_name: 'Temporal Access',
|
|
6
|
+
description: 'Time-window based access control. Restricts access based on valid_from and/or valid_until timestamps. At least one of valid_from_field or valid_until_field must be provided.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
valid_from_field: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: 'Column for start time (at least one of valid_from_field or valid_until_field required)'
|
|
13
14
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
valid_until_field: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
format: 'column-ref',
|
|
18
|
+
description: 'Column for end time (at least one of valid_from_field or valid_until_field required)'
|
|
17
19
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
valid_from_inclusive: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
description: 'Include start boundary',
|
|
23
|
+
default: true
|
|
22
24
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
valid_until_inclusive: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
description: 'Include end boundary',
|
|
28
|
+
default: false
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
|
-
|
|
31
|
+
anyOf: [
|
|
30
32
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
required: [
|
|
34
|
+
'valid_from_field'
|
|
33
35
|
]
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
required: [
|
|
39
|
+
'valid_until_field'
|
|
38
40
|
]
|
|
39
41
|
}
|
|
40
42
|
]
|
|
41
43
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
tags: [
|
|
45
|
+
'temporal',
|
|
46
|
+
'authz'
|
|
45
47
|
]
|
|
46
48
|
};
|
package/esm/authz/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
export { AuthzAllowAll } from './authz-allow-all';
|
|
2
|
+
export { AuthzComposite } from './authz-composite';
|
|
3
|
+
export { AuthzDenyAll } from './authz-deny-all';
|
|
1
4
|
export { AuthzDirectOwner } from './authz-direct-owner';
|
|
2
5
|
export { AuthzDirectOwnerAny } from './authz-direct-owner-any';
|
|
3
|
-
export { AuthzMembership } from './authz-membership-check';
|
|
4
6
|
export { AuthzEntityMembership } from './authz-entity-membership';
|
|
5
|
-
export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
|
|
6
|
-
export { AuthzOrgHierarchy } from './authz-org-hierarchy';
|
|
7
|
-
export { AuthzTemporal } from './authz-temporal';
|
|
8
|
-
export { AuthzPublishable } from './authz-publishable';
|
|
9
7
|
export { AuthzMemberList } from './authz-member-list';
|
|
10
|
-
export {
|
|
11
|
-
export { AuthzAllowAll } from './authz-allow-all';
|
|
12
|
-
export { AuthzDenyAll } from './authz-deny-all';
|
|
13
|
-
export { AuthzComposite } from './authz-composite';
|
|
8
|
+
export { AuthzMembership } from './authz-membership-check';
|
|
14
9
|
export { AuthzNotReadOnly } from './authz-not-read-only';
|
|
10
|
+
export { AuthzOrgHierarchy } from './authz-org-hierarchy';
|
|
15
11
|
export { AuthzPeerOwnership } from './authz-peer-ownership';
|
|
12
|
+
export { AuthzPublishable } from './authz-publishable';
|
|
13
|
+
export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
|
|
14
|
+
export { AuthzRelatedMemberList } from './authz-related-member-list';
|
|
16
15
|
export { AuthzRelatedPeerOwnership } from './authz-related-peer-ownership';
|
|
16
|
+
export { AuthzTemporal } from './authz-temporal';
|
package/esm/authz/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
export { AuthzAllowAll } from './authz-allow-all';
|
|
2
|
+
export { AuthzComposite } from './authz-composite';
|
|
3
|
+
export { AuthzDenyAll } from './authz-deny-all';
|
|
1
4
|
export { AuthzDirectOwner } from './authz-direct-owner';
|
|
2
5
|
export { AuthzDirectOwnerAny } from './authz-direct-owner-any';
|
|
3
|
-
export { AuthzMembership } from './authz-membership-check';
|
|
4
6
|
export { AuthzEntityMembership } from './authz-entity-membership';
|
|
5
|
-
export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
|
|
6
|
-
export { AuthzOrgHierarchy } from './authz-org-hierarchy';
|
|
7
|
-
export { AuthzTemporal } from './authz-temporal';
|
|
8
|
-
export { AuthzPublishable } from './authz-publishable';
|
|
9
7
|
export { AuthzMemberList } from './authz-member-list';
|
|
10
|
-
export {
|
|
11
|
-
export { AuthzAllowAll } from './authz-allow-all';
|
|
12
|
-
export { AuthzDenyAll } from './authz-deny-all';
|
|
13
|
-
export { AuthzComposite } from './authz-composite';
|
|
8
|
+
export { AuthzMembership } from './authz-membership-check';
|
|
14
9
|
export { AuthzNotReadOnly } from './authz-not-read-only';
|
|
10
|
+
export { AuthzOrgHierarchy } from './authz-org-hierarchy';
|
|
15
11
|
export { AuthzPeerOwnership } from './authz-peer-ownership';
|
|
12
|
+
export { AuthzPublishable } from './authz-publishable';
|
|
13
|
+
export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
|
|
14
|
+
export { AuthzRelatedMemberList } from './authz-related-member-list';
|
|
16
15
|
export { AuthzRelatedPeerOwnership } from './authz-related-peer-ownership';
|
|
16
|
+
export { AuthzTemporal } from './authz-temporal';
|
|
@@ -574,19 +574,6 @@ export interface BlueprintTableUniqueConstraint {
|
|
|
574
574
|
/** Optional schema name override. */
|
|
575
575
|
schema_name?: string;
|
|
576
576
|
}
|
|
577
|
-
/** A storage-specific RLS policy object for apply_storage_security(). Each entry defines an Authz* policy with explicit privileges, scoped to specific storage tables. */
|
|
578
|
-
export interface BlueprintStoragePolicy {
|
|
579
|
-
/** Authz* policy generator type (e.g., "AuthzPublishable", "AuthzDirectOwner", "AuthzEntityMembership"). */
|
|
580
|
-
$type: string;
|
|
581
|
-
/** Privilege array (e.g., ["select", "insert", "update", "delete"]). Intersected with each storage table's supported operations. */
|
|
582
|
-
privileges: string[];
|
|
583
|
-
/** Policy data config. Auto-derived from $type when omitted (e.g., AuthzPublishable defaults to {"is_published_field": "is_public", "require_published_at": false}). */
|
|
584
|
-
data?: Record<string, unknown>;
|
|
585
|
-
/** Which storage tables to apply this policy to. Defaults to all three when omitted. Uses logical names (not prefixed). */
|
|
586
|
-
tables?: ('buckets' | 'files' | 'upload_requests')[];
|
|
587
|
-
/** Custom RLS policy name suffix. Auto-derived from $type when omitted (pub/own/mem). */
|
|
588
|
-
policy_name?: string;
|
|
589
|
-
}
|
|
590
577
|
/** A bucket seed entry for storage_config.buckets[]. Creates an initial bucket row in the {prefix}_buckets table during entity type provisioning. Only used for app-level storage (not entity-scoped). */
|
|
591
578
|
export interface BlueprintBucketSeed {
|
|
592
579
|
/** Bucket key name (e.g., "avatars", "documents"). Becomes the key column value. */
|
|
@@ -602,10 +589,8 @@ export interface BlueprintBucketSeed {
|
|
|
602
589
|
/** CORS allowed origins for this bucket. */
|
|
603
590
|
allowed_origins?: string[];
|
|
604
591
|
}
|
|
605
|
-
/** Storage configuration for an entity type.
|
|
592
|
+
/** Storage configuration for an entity type. Seeds initial buckets, overrides module-level settings (expiry times, file size limits, CORS), and provides per-table provisioning overrides via provisions. */
|
|
606
593
|
export interface BlueprintStorageConfig {
|
|
607
|
-
/** Custom RLS policies for storage tables. When provided, replaces the default policy set (AuthzPublishable + membership + AuthzDirectOwner). Each entry is a policy object with $type, privileges, and optional data/tables/policy_name. */
|
|
608
|
-
policies?: BlueprintStoragePolicy[];
|
|
609
594
|
/** Initial bucket seed entries. Each creates a row in {prefix}_buckets during provisioning. Only used for app-level storage (not entity-scoped). */
|
|
610
595
|
buckets?: BlueprintBucketSeed[];
|
|
611
596
|
/** Override for presigned upload URL expiry time in seconds. */
|
|
@@ -616,6 +601,12 @@ export interface BlueprintStorageConfig {
|
|
|
616
601
|
default_max_file_size?: number;
|
|
617
602
|
/** CORS allowed origins for the storage module. */
|
|
618
603
|
allowed_origins?: string[];
|
|
604
|
+
/** Per-table overrides for storage tables. Each key targets a specific storage table (files, buckets, upload_requests) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision targeting the corresponding table. When a key includes policies[], those REPLACE the default storage policies for that table; tables without a key still get defaults. */
|
|
605
|
+
provisions?: {
|
|
606
|
+
files?: BlueprintEntityTableProvision;
|
|
607
|
+
buckets?: BlueprintEntityTableProvision;
|
|
608
|
+
upload_requests?: BlueprintEntityTableProvision;
|
|
609
|
+
};
|
|
619
610
|
}
|
|
620
611
|
/** 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. */
|
|
621
612
|
export interface BlueprintEntityTableProvision {
|
|
@@ -655,6 +646,8 @@ export interface BlueprintEntityType {
|
|
|
655
646
|
has_levels?: boolean;
|
|
656
647
|
/** Whether to provision a storage module (buckets, files, upload_requests tables) for this entity type. Defaults to false. */
|
|
657
648
|
has_storage?: boolean;
|
|
649
|
+
/** Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false. */
|
|
650
|
+
has_invites?: boolean;
|
|
658
651
|
/** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
|
|
659
652
|
skip_entity_policies?: boolean;
|
|
660
653
|
/** Override for the entity table. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, its policies[] replaces the five default entity-table policies; is_visible becomes a no-op. When NULL (default), the five default policies are applied (gated by is_visible). */
|
|
@@ -877,6 +870,6 @@ export interface BlueprintDefinition {
|
|
|
877
870
|
unique_constraints?: BlueprintUniqueConstraint[];
|
|
878
871
|
/** Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security. */
|
|
879
872
|
entity_types?: BlueprintEntityType[];
|
|
880
|
-
/** App-level storage configuration. Creates a storage_module (membership_type = NULL)
|
|
873
|
+
/** App-level storage configuration. Creates a storage_module (membership_type = NULL), seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). Use provisions for per-table policy overrides. For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead. */
|
|
881
874
|
storage?: BlueprintStorageConfig;
|
|
882
875
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
3
3
|
//
|
|
4
4
|
// Regenerate with:
|
|
5
|
-
// cd
|
|
5
|
+
// cd packages/node-type-registry && pnpm generate:types
|
|
6
6
|
//
|
|
7
7
|
// These types match the JSONB shape expected by construct_blueprint().
|
|
8
8
|
// All field names are snake_case to match the SQL convention.
|
|
@@ -359,21 +359,6 @@ function buildBlueprintTableUniqueConstraint() {
|
|
|
359
359
|
addJSDoc(optionalProp('schema_name', t.tsStringKeyword()), 'Optional schema name override.')
|
|
360
360
|
]), 'A unique constraint nested inside a table definition (table_name not required).');
|
|
361
361
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Build the BlueprintStoragePolicy interface.
|
|
364
|
-
*
|
|
365
|
-
* Matches the jsonb policy objects accepted by apply_storage_security():
|
|
366
|
-
* { "$type": "AuthzPublishable", "privileges": ["select"], "data": {...}, "tables": [...], "policy_name": "pub" }
|
|
367
|
-
*/
|
|
368
|
-
function buildBlueprintStoragePolicy() {
|
|
369
|
-
return addJSDoc(exportInterface('BlueprintStoragePolicy', [
|
|
370
|
-
addJSDoc(requiredProp('$type', t.tsStringKeyword()), 'Authz* policy generator type (e.g., "AuthzPublishable", "AuthzDirectOwner", "AuthzEntityMembership").'),
|
|
371
|
-
addJSDoc(requiredProp('privileges', t.tsArrayType(t.tsStringKeyword())), 'Privilege array (e.g., ["select", "insert", "update", "delete"]). Intersected with each storage table\'s supported operations.'),
|
|
372
|
-
addJSDoc(optionalProp('data', recordType(t.tsStringKeyword(), t.tsUnknownKeyword())), 'Policy data config. Auto-derived from $type when omitted (e.g., AuthzPublishable defaults to {"is_published_field": "is_public", "require_published_at": false}).'),
|
|
373
|
-
addJSDoc(optionalProp('tables', t.tsArrayType(strUnion(['buckets', 'files', 'upload_requests']))), 'Which storage tables to apply this policy to. Defaults to all three when omitted. Uses logical names (not prefixed).'),
|
|
374
|
-
addJSDoc(optionalProp('policy_name', t.tsStringKeyword()), 'Custom RLS policy name suffix. Auto-derived from $type when omitted (pub/own/mem).')
|
|
375
|
-
]), 'A storage-specific RLS policy object for apply_storage_security(). Each entry defines an Authz* policy with explicit privileges, scoped to specific storage tables.');
|
|
376
|
-
}
|
|
377
362
|
/**
|
|
378
363
|
* Build the BlueprintBucketSeed interface.
|
|
379
364
|
*
|
|
@@ -396,13 +381,17 @@ function buildBlueprintBucketSeed() {
|
|
|
396
381
|
*/
|
|
397
382
|
function buildBlueprintStorageConfig() {
|
|
398
383
|
return addJSDoc(exportInterface('BlueprintStorageConfig', [
|
|
399
|
-
addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintStoragePolicy')))), 'Custom RLS policies for storage tables. When provided, replaces the default policy set (AuthzPublishable + membership + AuthzDirectOwner). Each entry is a policy object with $type, privileges, and optional data/tables/policy_name.'),
|
|
400
384
|
addJSDoc(optionalProp('buckets', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintBucketSeed')))), 'Initial bucket seed entries. Each creates a row in {prefix}_buckets during provisioning. Only used for app-level storage (not entity-scoped).'),
|
|
401
385
|
addJSDoc(optionalProp('upload_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned upload URL expiry time in seconds.'),
|
|
402
386
|
addJSDoc(optionalProp('download_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned download URL expiry time in seconds.'),
|
|
403
387
|
addJSDoc(optionalProp('default_max_file_size', t.tsNumberKeyword()), 'Default maximum file size in bytes for the storage module.'),
|
|
404
|
-
addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.')
|
|
405
|
-
|
|
388
|
+
addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.'),
|
|
389
|
+
addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
|
|
390
|
+
optionalProp('files', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
|
|
391
|
+
optionalProp('buckets', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
|
|
392
|
+
optionalProp('upload_requests', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
|
|
393
|
+
])), 'Per-table overrides for storage tables. Each key targets a specific storage table (files, buckets, upload_requests) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision targeting the corresponding table. When a key includes policies[], those REPLACE the default storage policies for that table; tables without a key still get defaults.')
|
|
394
|
+
]), 'Storage configuration for an entity type. Seeds initial buckets, overrides module-level settings (expiry times, file size limits, CORS), and provides per-table provisioning overrides via provisions.');
|
|
406
395
|
}
|
|
407
396
|
function buildBlueprintEntityTableProvision() {
|
|
408
397
|
return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
|
|
@@ -428,6 +417,7 @@ function buildBlueprintEntityType() {
|
|
|
428
417
|
addJSDoc(optionalProp('has_profiles', t.tsBooleanKeyword()), 'Whether to provision a profiles module for this entity type. Defaults to false.'),
|
|
429
418
|
addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
|
|
430
419
|
addJSDoc(optionalProp('has_storage', t.tsBooleanKeyword()), 'Whether to provision a storage module (buckets, files, upload_requests tables) for this entity type. Defaults to false.'),
|
|
420
|
+
addJSDoc(optionalProp('has_invites', t.tsBooleanKeyword()), 'Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false.'),
|
|
431
421
|
addJSDoc(optionalProp('skip_entity_policies', t.tsBooleanKeyword()), 'Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false.'),
|
|
432
422
|
addJSDoc(optionalProp('table_provision', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))), 'Override for the entity table. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, its policies[] replaces the five default entity-table policies; is_visible becomes a no-op. When NULL (default), the five default policies are applied (gated by is_visible).'),
|
|
433
423
|
addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), '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).')
|
|
@@ -458,7 +448,7 @@ function buildBlueprintDefinition() {
|
|
|
458
448
|
addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFullTextSearch')))), 'Full-text search configurations.'),
|
|
459
449
|
addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
|
|
460
450
|
addJSDoc(optionalProp('entity_types', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintEntityType')))), 'Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security.'),
|
|
461
|
-
addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL)
|
|
451
|
+
addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL), seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). Use provisions for per-table policy overrides. For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead.')
|
|
462
452
|
]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
|
|
463
453
|
}
|
|
464
454
|
// ---------------------------------------------------------------------------
|
|
@@ -512,7 +502,6 @@ function buildProgram(meta) {
|
|
|
512
502
|
statements.push(buildBlueprintTableIndex());
|
|
513
503
|
statements.push(buildBlueprintUniqueConstraint());
|
|
514
504
|
statements.push(buildBlueprintTableUniqueConstraint());
|
|
515
|
-
statements.push(buildBlueprintStoragePolicy());
|
|
516
505
|
statements.push(buildBlueprintBucketSeed());
|
|
517
506
|
statements.push(buildBlueprintStorageConfig());
|
|
518
507
|
statements.push(buildBlueprintEntityTableProvision());
|
|
@@ -535,7 +524,7 @@ function buildProgram(meta) {
|
|
|
535
524
|
'/* eslint-disable @typescript-eslint/no-empty-object-type */',
|
|
536
525
|
'//',
|
|
537
526
|
'// Regenerate with:',
|
|
538
|
-
'// cd
|
|
527
|
+
'// cd packages/node-type-registry && pnpm generate:types',
|
|
539
528
|
'//',
|
|
540
529
|
'// These types match the JSONB shape expected by construct_blueprint().',
|
|
541
530
|
'// All field names are snake_case to match the SQL convention.',
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
export const DataCompositeField = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
name: 'DataCompositeField',
|
|
3
|
+
slug: 'data_composite_field',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Composite Field',
|
|
6
|
+
description: "Creates a derived text field that automatically concatenates multiple source fields via BEFORE INSERT/UPDATE triggers. Used to produce a unified text representation (e.g., embedding_text) from multiple columns on a table. The trigger fires with '_000' prefix to run before Search* triggers alphabetically.",
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
target: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: "Name of the derived text field to create (default: 'embedding_text')"
|
|
13
14
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
source_fields: {
|
|
16
|
+
type: 'array',
|
|
17
|
+
items: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
format: 'column-ref'
|
|
18
20
|
},
|
|
19
|
-
|
|
21
|
+
description: 'Array of source field names to concatenate into the target field'
|
|
20
22
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
format: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['labeled', 'plain'],
|
|
26
|
+
description: "Output format: 'labeled' (field_name: value) or 'plain' (values only). Default: 'labeled'"
|
|
25
27
|
}
|
|
26
28
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
required: [
|
|
30
|
+
'source_fields'
|
|
29
31
|
]
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
tags: [
|
|
34
|
+
'transform',
|
|
35
|
+
'behavior'
|
|
34
36
|
]
|
|
35
37
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
export const DataDirectOwner = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
name: 'DataDirectOwner',
|
|
3
|
+
slug: 'data_direct_owner',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Ownership',
|
|
6
|
+
description: 'Adds ownership column for direct user ownership. Enables AuthzDirectOwner authorization.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
owner_field_name: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: 'Column name for owner ID',
|
|
14
|
+
default: 'owner_id'
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
include_id: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
description: 'If true, also adds a UUID primary key column with auto-generation',
|
|
19
|
+
default: true
|
|
19
20
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
include_user_fk: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'If true, adds a foreign key constraint from owner_id to the users table',
|
|
24
|
+
default: true
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
tags: [
|
|
29
|
+
'ownership',
|
|
30
|
+
'schema'
|
|
30
31
|
]
|
|
31
32
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
export const DataEntityMembership = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
name: 'DataEntityMembership',
|
|
3
|
+
slug: 'data_entity_membership',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Entity Membership',
|
|
6
|
+
description: 'Adds entity reference for organization/group scoping. Enables AuthzEntityMembership, AuthzMembership, AuthzOrgHierarchy authorization.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
entity_field_name: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: 'Column name for entity ID',
|
|
14
|
+
default: 'entity_id'
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
include_id: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
description: 'If true, also adds a UUID primary key column with auto-generation',
|
|
19
|
+
default: true
|
|
19
20
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
include_user_fk: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'If true, adds a foreign key constraint from entity_id to the users table',
|
|
24
|
+
default: true
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
tags: [
|
|
29
|
+
'membership',
|
|
30
|
+
'schema'
|
|
30
31
|
]
|
|
31
32
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
export const DataForceCurrentUser = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
name: 'DataForceCurrentUser',
|
|
3
|
+
slug: 'data_force_current_user',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Force Current User',
|
|
6
|
+
description: 'BEFORE INSERT trigger that forces a field to the value of jwt_public.current_user_id(). Prevents clients from spoofing the actor/uploader identity. The field value is always overwritten regardless of what the client provides.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
field_name: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: 'Name of the field to force to current_user_id()',
|
|
14
|
+
default: 'actor_id'
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
tags: [
|
|
19
|
+
'trigger',
|
|
20
|
+
'security',
|
|
21
|
+
'schema'
|
|
21
22
|
]
|
|
22
23
|
};
|
package/esm/data/data-id.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
export const DataId = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
name: 'DataId',
|
|
3
|
+
slug: 'data_id',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Primary Key ID',
|
|
6
|
+
description: 'Adds a UUID primary key column with auto-generation default (uuidv7). This is the standard primary key pattern for all tables.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
field_name: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'column-ref',
|
|
13
|
+
description: 'Column name for the primary key',
|
|
14
|
+
default: 'id'
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
tags: [
|
|
19
|
+
'primary_key',
|
|
20
|
+
'schema'
|
|
20
21
|
]
|
|
21
22
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
export const DataImmutableFields = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
name: 'DataImmutableFields',
|
|
3
|
+
slug: 'data_immutable_fields',
|
|
4
|
+
category: 'data',
|
|
5
|
+
display_name: 'Immutable Fields',
|
|
6
|
+
description: 'BEFORE UPDATE trigger that prevents changes to a list of specified fields after INSERT. Raises an exception if any of the listed fields have changed. Unlike FieldImmutable (single-field), this handles multiple fields in a single trigger for efficiency.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
fields: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
items: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
format: 'column-ref'
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
+
description: 'Field names that cannot be modified after INSERT (e.g. ["key", "bucket_id", "owner_id"])'
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
required: [
|
|
20
|
+
'fields'
|
|
20
21
|
]
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
tags: [
|
|
24
|
+
'trigger',
|
|
25
|
+
'constraint',
|
|
26
|
+
'schema'
|
|
26
27
|
]
|
|
27
28
|
};
|