@ai-matrx/records 0.3.0 → 0.4.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.
@@ -1,5 +1,5 @@
1
- import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, RecordsError, WriteConflict, PgError, StaleWriteDetail, PredictedRefusal } from '../index.cjs';
2
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsDataSource, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, err, isRecordsErr, measureKey, ok } from '../index.cjs';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.cjs';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, err, isRecordsErr, measureKey, ok } from '../index.cjs';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -574,6 +574,38 @@ declare function doorCensus(): {
574
574
  absent: string[];
575
575
  };
576
576
 
577
+ /**
578
+ * The structural shape of the supabase client this adapter needs. Deliberately
579
+ * NOT `SupabaseClient<Database>`: a generated `Database` type makes
580
+ * `schema().from().select()` enormous, and a host app that passed its typed
581
+ * client in got `TS2589: Type instantiation is excessively deep and possibly
582
+ * infinite` in its own build (matrx-frontend, 2026-09-18, on all three campaign
583
+ * routes at once). The cast lives here, once, where it is explained.
584
+ */
585
+ interface SupabaseLike {
586
+ schema(name: string): {
587
+ rpc(fn: string, args?: Record<string, unknown>): PromiseLike<{
588
+ data: unknown;
589
+ error: PgError | null;
590
+ }>;
591
+ from(table: string): unknown;
592
+ };
593
+ }
594
+ /**
595
+ * Bind a supabase-js client (or anything with the same `schema(name).rpc()`
596
+ * shape) as this package's data seam.
597
+ *
598
+ * Two things never happen here, both of them loudly:
599
+ *
600
+ * - A call with NO schema is never sent. It is refused by name, because
601
+ * sending it would reach `public` and get the store's PGRST202 several
602
+ * layers away from the mistake.
603
+ * - A client with no `.schema()` is never used. supabase-js has had it since
604
+ * v2.0; a host that binds something else is told exactly what is missing
605
+ * instead of throwing `undefined is not a function` inside a render.
606
+ */
607
+ declare function supabaseDataSource(client: object): RecordsDataSource;
608
+
577
609
  /** The SQLSTATEs this package claims to understand. Exported for the guard. */
578
610
  declare const MAPPED_SQLSTATES: string[];
579
611
  /** Map a PostgREST/supabase-js failure into the package's refusal shape. */
@@ -649,4 +681,4 @@ declare function parseCsv(text: string): string[][];
649
681
  declare function importCsv(fields: Field[], text: string): ParsedImport;
650
682
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
651
683
 
652
- export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, toAoa };
684
+ export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -1,5 +1,5 @@
1
- import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, RecordsError, WriteConflict, PgError, StaleWriteDetail, PredictedRefusal } from '../index.js';
2
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsDataSource, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, err, isRecordsErr, measureKey, ok } from '../index.js';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.js';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, err, isRecordsErr, measureKey, ok } from '../index.js';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -574,6 +574,38 @@ declare function doorCensus(): {
574
574
  absent: string[];
575
575
  };
576
576
 
577
+ /**
578
+ * The structural shape of the supabase client this adapter needs. Deliberately
579
+ * NOT `SupabaseClient<Database>`: a generated `Database` type makes
580
+ * `schema().from().select()` enormous, and a host app that passed its typed
581
+ * client in got `TS2589: Type instantiation is excessively deep and possibly
582
+ * infinite` in its own build (matrx-frontend, 2026-09-18, on all three campaign
583
+ * routes at once). The cast lives here, once, where it is explained.
584
+ */
585
+ interface SupabaseLike {
586
+ schema(name: string): {
587
+ rpc(fn: string, args?: Record<string, unknown>): PromiseLike<{
588
+ data: unknown;
589
+ error: PgError | null;
590
+ }>;
591
+ from(table: string): unknown;
592
+ };
593
+ }
594
+ /**
595
+ * Bind a supabase-js client (or anything with the same `schema(name).rpc()`
596
+ * shape) as this package's data seam.
597
+ *
598
+ * Two things never happen here, both of them loudly:
599
+ *
600
+ * - A call with NO schema is never sent. It is refused by name, because
601
+ * sending it would reach `public` and get the store's PGRST202 several
602
+ * layers away from the mistake.
603
+ * - A client with no `.schema()` is never used. supabase-js has had it since
604
+ * v2.0; a host that binds something else is told exactly what is missing
605
+ * instead of throwing `undefined is not a function` inside a render.
606
+ */
607
+ declare function supabaseDataSource(client: object): RecordsDataSource;
608
+
577
609
  /** The SQLSTATEs this package claims to understand. Exported for the guard. */
578
610
  declare const MAPPED_SQLSTATES: string[];
579
611
  /** Map a PostgREST/supabase-js failure into the package's refusal shape. */
@@ -649,4 +681,4 @@ declare function parseCsv(text: string): string[][];
649
681
  declare function importCsv(fields: Field[], text: string): ParsedImport;
650
682
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
651
683
 
652
- export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, toAoa };
684
+ export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -151,6 +151,7 @@ var STORE_DOORS = [
151
151
  { name: "anon_token_verify", args: "p_secret text, p_origin text, p_required_mode text", returns: "TABLE(token_id uuid, organization_id uuid, form_id uuid, saved_view_id uuid, record_id uuid, mode text)", security: "definer" },
152
152
  { name: "anon_write", args: "p_secret text, p_origin text, p_payload jsonb, p_client_key text DEFAULT NULL::text, p_raw_payload jsonb DEFAULT '{}'::jsonb", returns: "uuid", security: "definer" },
153
153
  { name: "applicable_fields", args: "p_organization_id uuid, p_table_id uuid, p_record_type text DEFAULT NULL::text", returns: "SETOF custom.record", security: "definer" },
154
+ { name: "assert_client_may_change", args: "p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'editor'::permission_level, p_subject_word text DEFAULT 'record'::text", returns: "void", security: "invoker" },
154
155
  { name: "assert_client_may_reach", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
155
156
  { name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
156
157
  { name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
@@ -182,6 +183,8 @@ var STORE_DOORS = [
182
183
  { name: "doc_token_pattern", args: "", returns: "text", security: "invoker" },
183
184
  { name: "doc_tokens", args: "p_body text", returns: "TABLE(ordinal integer, raw text, field_id uuid)", security: "invoker" },
184
185
  { name: "doc_unresolved_tokens", args: "p_organization_id uuid, p_table_id uuid, p_body text", returns: "TABLE(raw text, field_id uuid, why text)", security: "invoker" },
186
+ { name: "doors_not_deciding_the_caller", args: "", returns: "TABLE(function_name text, identity_args text)", security: "invoker" },
187
+ { name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
185
188
  { name: "export_records", args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000", returns: "TABLE(id uuid, document jsonb)", security: "invoker" },
186
189
  { name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
187
190
  { name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
@@ -238,12 +241,14 @@ var STORE_DOORS = [
238
241
  { name: "migrate_reparent", args: "p_organization_id uuid, p_id uuid, p_parent_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "invoker" },
239
242
  { name: "migrate_retype", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "invoker" },
240
243
  { name: "migrate_split", args: "p_organization_id uuid, p_record_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text", returns: "jsonb", security: "invoker" },
244
+ { name: "organization_kernel_id", args: "", returns: "uuid", security: "invoker" },
241
245
  { name: "organization_references", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "TABLE(site text, what text, ref_id uuid, openable boolean)", security: "invoker" },
242
246
  { name: "parity_field_types", args: "", returns: "TABLE(parity_type text, behavior text, made_of text)", security: "invoker" },
243
247
  { name: "parity_type", args: "p_field_data jsonb", returns: "text", security: "invoker" },
244
248
  { name: "parity_values", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)", security: "invoker" },
245
249
  { name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
246
250
  { name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
251
+ { name: "presentation_kernel_id", args: "", returns: "uuid", security: "invoker" },
247
252
  { name: "promote_field", args: "p_organization_id uuid, p_table_id uuid, p_field_id uuid", returns: "jsonb", security: "invoker" },
248
253
  { name: "promote_table", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
249
254
  { name: "promoted_field_cap", args: "", returns: "integer", security: "invoker" },
@@ -339,6 +344,7 @@ var STORE_DOORS = [
339
344
  { name: "visibility_parity", args: "", returns: "TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)", security: "definer" },
340
345
  { name: "visibility_warm", args: "p_container_type text, p_container_id uuid", returns: "integer", security: "definer" },
341
346
  { name: "visible_record_ids", args: "p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "TABLE(id uuid)", security: "definer" },
347
+ { name: "widget_kernel_id", args: "", returns: "uuid", security: "invoker" },
342
348
  { name: "work_assignment_fields", args: "p_options_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(key text, label text, spec jsonb)", security: "invoker" },
343
349
  { name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
344
350
  { name: "work_instantiation_shape", args: "p_organization_id uuid, p_instantiation_id uuid", returns: "jsonb", security: "invoker" },
@@ -360,8 +366,17 @@ var STORE_DOORS = [
360
366
  ];
361
367
  var STORE_KNOBS = [
362
368
  { key: "accessible_entity_ids_guard", value: "false", type: "boolean" },
369
+ { key: "agent_schema_changes", value: '"propose"', type: "string" },
363
370
  { key: "associations_guard", value: "false", type: "boolean" },
364
371
  { key: "code_paths_enabled", value: "false", type: "boolean" },
372
+ { key: "consumer_chat_seeding_enabled", value: "false", type: "boolean" },
373
+ { key: "consumer_checkout_enabled", value: "false", type: "boolean" },
374
+ { key: "consumer_education_enabled", value: "false", type: "boolean" },
375
+ { key: "consumer_extension_enabled", value: "false", type: "boolean" },
376
+ { key: "consumer_grid_enabled", value: "false", type: "boolean" },
377
+ { key: "consumer_retirement_enabled", value: "false", type: "boolean" },
378
+ { key: "consumer_saved_ai_outputs_enabled", value: "false", type: "boolean" },
379
+ { key: "consumer_scopes_enabled", value: "false", type: "boolean" },
365
380
  { key: "containment_depth_ceiling", value: "16", type: "integer" },
366
381
  { key: "document_max_bytes", value: "1048576", type: "integer" },
367
382
  { key: "emergency_door_guard", value: "false", type: "boolean" },
@@ -393,7 +408,7 @@ var STORE_REFUSAL_CODES = [
393
408
  { code: "23505", raised_by: "doc_sign,doc_signature_write,home_add,io_proposal_accept,work_slot_hold" },
394
409
  { code: "23514", raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_rule_shape_guard,_rule_topology_guard,_table_shape_guard,_value_envelope,_work_shape_guard,doc_sign,doc_signature_write,doc_template_save,home_add,validate_value_envelope,validate_values,work_slots_declare,work_take_assignment,work_template_instantiate" },
395
410
  { code: "40001", raised_by: "has_visibility_at" },
396
- { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_reach,assert_store_door,external_write_through,io_comment_resolve,io_comment_write,io_restore,migrate_purge,promote_table,read_record,read_records" },
411
+ { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_reach,assert_store_door,external_write_through,io_comment_resolve,io_comment_write,io_restore,migrate_purge,promote_table,read_record,read_records" },
397
412
  { code: "53400", raised_by: "anon_rate_take,promote_field" },
398
413
  { code: "PT409", raised_by: "record_update" }
399
414
  ];
@@ -2464,6 +2479,42 @@ function asWriteConflict(error, recordId) {
2464
2479
  };
2465
2480
  }
2466
2481
 
2482
+ // src/core/supabase.ts
2483
+ function refuse(code, message, hint) {
2484
+ return { data: null, error: { code, message, hint, details: "" } };
2485
+ }
2486
+ function supabaseDataSource(client) {
2487
+ const supabase = client;
2488
+ const hasSchema = typeof supabase.schema === "function";
2489
+ return {
2490
+ rpc(fn, args, options) {
2491
+ if (!hasSchema) {
2492
+ return Promise.resolve(
2493
+ refuse(
2494
+ "data_source_unbound",
2495
+ `The records client was given something that is not a supabase client: it has no schema() method, so the door ${fn} cannot be called in the schema it lives in.`,
2496
+ "Pass a supabase-js v2 client (createClient(...)) to supabaseDataSource()."
2497
+ )
2498
+ );
2499
+ }
2500
+ const name = options?.schema;
2501
+ if (!name) {
2502
+ return Promise.resolve(
2503
+ refuse(
2504
+ "schema_unsaid",
2505
+ `The door ${fn} was called without saying which schema it lives in. Every door of this store is custom.${fn} and every trust door is iam.${fn}; an unqualified call reaches PostgREST's default profile (public) and is refused there.`,
2506
+ "This is a bug in the caller, not in your data: /core says the schema on every call."
2507
+ )
2508
+ );
2509
+ }
2510
+ return supabase.schema(name).rpc(fn, args);
2511
+ },
2512
+ schema(name) {
2513
+ return supabase.schema(name);
2514
+ }
2515
+ };
2516
+ }
2517
+
2467
2518
  // src/core/validation.ts
2468
2519
  var DEFAULT_VALUE_MAX_BYTES = 1e5;
2469
2520
  var DEFAULT_DOCUMENT_MAX_BYTES = 1048576;
@@ -2965,6 +3016,7 @@ export {
2965
3016
  predictValueRefusals,
2966
3017
  predictWriteRefusals,
2967
3018
  staleWriteDetail,
3019
+ supabaseDataSource,
2968
3020
  toAoa
2969
3021
  };
2970
3022
  //# sourceMappingURL=index.js.map