node-type-registry 0.18.1 → 0.19.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.
|
@@ -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
|
}
|
|
@@ -394,21 +394,6 @@ function buildBlueprintTableUniqueConstraint() {
|
|
|
394
394
|
addJSDoc(optionalProp('schema_name', t.tsStringKeyword()), 'Optional schema name override.')
|
|
395
395
|
]), 'A unique constraint nested inside a table definition (table_name not required).');
|
|
396
396
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Build the BlueprintStoragePolicy interface.
|
|
399
|
-
*
|
|
400
|
-
* Matches the jsonb policy objects accepted by apply_storage_security():
|
|
401
|
-
* { "$type": "AuthzPublishable", "privileges": ["select"], "data": {...}, "tables": [...], "policy_name": "pub" }
|
|
402
|
-
*/
|
|
403
|
-
function buildBlueprintStoragePolicy() {
|
|
404
|
-
return addJSDoc(exportInterface('BlueprintStoragePolicy', [
|
|
405
|
-
addJSDoc(requiredProp('$type', t.tsStringKeyword()), 'Authz* policy generator type (e.g., "AuthzPublishable", "AuthzDirectOwner", "AuthzEntityMembership").'),
|
|
406
|
-
addJSDoc(requiredProp('privileges', t.tsArrayType(t.tsStringKeyword())), 'Privilege array (e.g., ["select", "insert", "update", "delete"]). Intersected with each storage table\'s supported operations.'),
|
|
407
|
-
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}).'),
|
|
408
|
-
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).'),
|
|
409
|
-
addJSDoc(optionalProp('policy_name', t.tsStringKeyword()), 'Custom RLS policy name suffix. Auto-derived from $type when omitted (pub/own/mem).')
|
|
410
|
-
]), 'A storage-specific RLS policy object for apply_storage_security(). Each entry defines an Authz* policy with explicit privileges, scoped to specific storage tables.');
|
|
411
|
-
}
|
|
412
397
|
/**
|
|
413
398
|
* Build the BlueprintBucketSeed interface.
|
|
414
399
|
*
|
|
@@ -431,13 +416,17 @@ function buildBlueprintBucketSeed() {
|
|
|
431
416
|
*/
|
|
432
417
|
function buildBlueprintStorageConfig() {
|
|
433
418
|
return addJSDoc(exportInterface('BlueprintStorageConfig', [
|
|
434
|
-
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.'),
|
|
435
419
|
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).'),
|
|
436
420
|
addJSDoc(optionalProp('upload_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned upload URL expiry time in seconds.'),
|
|
437
421
|
addJSDoc(optionalProp('download_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned download URL expiry time in seconds.'),
|
|
438
422
|
addJSDoc(optionalProp('default_max_file_size', t.tsNumberKeyword()), 'Default maximum file size in bytes for the storage module.'),
|
|
439
|
-
addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.')
|
|
440
|
-
|
|
423
|
+
addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.'),
|
|
424
|
+
addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
|
|
425
|
+
optionalProp('files', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
|
|
426
|
+
optionalProp('buckets', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
|
|
427
|
+
optionalProp('upload_requests', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
|
|
428
|
+
])), '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.')
|
|
429
|
+
]), '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.');
|
|
441
430
|
}
|
|
442
431
|
function buildBlueprintEntityTableProvision() {
|
|
443
432
|
return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
|
|
@@ -463,6 +452,7 @@ function buildBlueprintEntityType() {
|
|
|
463
452
|
addJSDoc(optionalProp('has_profiles', t.tsBooleanKeyword()), 'Whether to provision a profiles module for this entity type. Defaults to false.'),
|
|
464
453
|
addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
|
|
465
454
|
addJSDoc(optionalProp('has_storage', t.tsBooleanKeyword()), 'Whether to provision a storage module (buckets, files, upload_requests tables) for this entity type. Defaults to false.'),
|
|
455
|
+
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.'),
|
|
466
456
|
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.'),
|
|
467
457
|
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).'),
|
|
468
458
|
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).')
|
|
@@ -493,7 +483,7 @@ function buildBlueprintDefinition() {
|
|
|
493
483
|
addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFullTextSearch')))), 'Full-text search configurations.'),
|
|
494
484
|
addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
|
|
495
485
|
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.'),
|
|
496
|
-
addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL)
|
|
486
|
+
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.')
|
|
497
487
|
]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
|
|
498
488
|
}
|
|
499
489
|
// ---------------------------------------------------------------------------
|
|
@@ -547,7 +537,6 @@ function buildProgram(meta) {
|
|
|
547
537
|
statements.push(buildBlueprintTableIndex());
|
|
548
538
|
statements.push(buildBlueprintUniqueConstraint());
|
|
549
539
|
statements.push(buildBlueprintTableUniqueConstraint());
|
|
550
|
-
statements.push(buildBlueprintStoragePolicy());
|
|
551
540
|
statements.push(buildBlueprintBucketSeed());
|
|
552
541
|
statements.push(buildBlueprintStorageConfig());
|
|
553
542
|
statements.push(buildBlueprintEntityTableProvision());
|
|
@@ -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
|
}
|
|
@@ -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());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-type-registry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
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": "
|
|
50
|
+
"gitHead": "4ec54068fedd13e6145808b8059121f4a1b3891d"
|
|
51
51
|
}
|