@ai-matrx/records 0.7.2 → 0.11.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.
@@ -1,5 +1,5 @@
1
- import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, 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, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, 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, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok } from '../index.cjs';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.cjs';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, CustomFieldTableType, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityFieldValue, EntityRecordMatch, 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, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, 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, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.cjs';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -179,6 +179,51 @@ interface RecordsClient {
179
179
  fieldRetire(args: {
180
180
  field_id: Uuid;
181
181
  }): Promise<RecordsResult<boolean>>;
182
+ /** What the registry says about a token, and whether it can hold a value at all. */
183
+ entityTable(args: {
184
+ token: string;
185
+ }): Promise<RecordsResult<EntityTableFacts>>;
186
+ /** The fields THIS organization added to that standard table. */
187
+ entityFields(args: {
188
+ token: string;
189
+ }): Promise<RecordsResult<Field[]>>;
190
+ /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */
191
+ entityFieldDeclare(args: {
192
+ token: string;
193
+ spec: NewEntityFieldDeclaration;
194
+ }): Promise<RecordsResult<Uuid>>;
195
+ /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */
196
+ entityFieldUpdate(args: {
197
+ field_id: Uuid;
198
+ patch: Record<string, unknown>;
199
+ }): Promise<RecordsResult<Uuid>>;
200
+ /** Take a custom field off a standard table. The values already written stay in each row. */
201
+ entityFieldRetire(args: {
202
+ field_id: Uuid;
203
+ }): Promise<RecordsResult<Uuid>>;
204
+ /** May this person add a column here - and if not, the store's own sentence saying why. */
205
+ entityFieldRights(args: {
206
+ token: string;
207
+ }): Promise<RecordsResult<EntityFieldRights>>;
208
+ /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */
209
+ entityRecordRead(args: {
210
+ token: string;
211
+ record_id: Uuid;
212
+ }): Promise<RecordsResult<EntityRecordRead>>;
213
+ /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */
214
+ entityValueWrite(args: {
215
+ token: string;
216
+ record_id: Uuid;
217
+ patch: Record<string, unknown>;
218
+ }): Promise<RecordsResult<EntityRecordRead>>;
219
+ /** Rows of that standard table with this custom value. Refuses a field nobody declared. */
220
+ entityRecordsFind(args: {
221
+ token: string;
222
+ key: string;
223
+ value?: unknown;
224
+ limit?: number;
225
+ offset?: number;
226
+ }): Promise<RecordsResult<EntityRecordsFound>>;
182
227
  /** The kernel Tables a caller writes a Home, a Field or a Rule into. */
183
228
  personKernelId(): Promise<RecordsResult<Uuid>>;
184
229
  fieldKernelId(): Promise<RecordsResult<Uuid>>;
@@ -204,6 +249,29 @@ interface RecordsClient {
204
249
  values: Record<string, unknown>;
205
250
  context?: Record<string, unknown>;
206
251
  }): Promise<RecordsResult<unknown>>;
252
+ /**
253
+ * Write ONE Rule as a real Rule. `recordWrite` into the Rule kernel makes a
254
+ * valid Rule document that carries `data_class = 'record'`, and every reader
255
+ * that looks for a Rule looks for the class — `custom.agg_subscriptions`
256
+ * selects `where data_class = 'rule'` — so a subscription written that way
257
+ * fires at nobody. This is the door that closes it.
258
+ */
259
+ /** This organization's forms, with how many answers arrived and how many are in the table. */
260
+ forms(args?: {
261
+ table_id?: Uuid | null;
262
+ }): Promise<RecordsResult<FormSummary[]>>;
263
+ /** Create or re-state one form. A question naming no Field of that Table is refused BY NAME. */
264
+ formDeclare(args: {
265
+ table_id: Uuid;
266
+ title: string;
267
+ questions: unknown[];
268
+ presentation?: Record<string, unknown> | null;
269
+ submission_cap?: number | null;
270
+ quarantine_rule_id?: Uuid | null;
271
+ notify_rule_id?: Uuid | null;
272
+ form_id?: Uuid | null;
273
+ slug?: string | null;
274
+ }): Promise<RecordsResult<Uuid>>;
207
275
  /**
208
276
  * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The
209
277
  * aggregate node sits above the visibility join, so what a chart draws is
@@ -439,6 +507,86 @@ interface RecordsClient {
439
507
  workSlotExpire(args: {
440
508
  table_id: Uuid;
441
509
  }): Promise<RecordsResult<number>>;
510
+ /**
511
+ * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one
512
+ * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the
513
+ * agent's suggestions is the thing this replaces.
514
+ */
515
+ workInbox(args?: {
516
+ limit?: number;
517
+ offset?: number;
518
+ includeDecided?: boolean;
519
+ }): Promise<RecordsResult<WorkInboxItem[]>>;
520
+ /** "My work", "work I assigned", "waiting on somebody being chosen". */
521
+ workList(args?: {
522
+ flavour?: WorkListFlavour;
523
+ includeFinished?: boolean;
524
+ limit?: number;
525
+ offset?: number;
526
+ }): Promise<RecordsResult<WorkListItem[]>>;
527
+ /**
528
+ * Give one record to one person: the Assignee value AND editor access, in one
529
+ * transaction. Passing no `user_id` un-assigns and says plainly that nobody's
530
+ * access was taken away.
531
+ */
532
+ workAssign(args: {
533
+ record_id: Uuid;
534
+ user_id?: Uuid | null;
535
+ dueDate?: string | null;
536
+ clearDue?: boolean;
537
+ }): Promise<RecordsResult<WorkAssignment>>;
538
+ /** The states this record may be moved to, and the sentence for each it may not. */
539
+ workRecordStates(args: {
540
+ record_id: Uuid;
541
+ }): Promise<RecordsResult<WorkRecordState[]>>;
542
+ /** Move it. The store refuses a move the model forbids, in its own words. */
543
+ workSetState(args: {
544
+ record_id: Uuid;
545
+ state_id: Uuid | null;
546
+ }): Promise<RecordsResult<unknown>>;
547
+ /** The person-kernel record standing for a signed-in person here. */
548
+ workPerson(args: {
549
+ user_id: Uuid;
550
+ create?: boolean;
551
+ }): Promise<RecordsResult<Uuid | null>>;
552
+ /** The templates this person may run, so a picker has ids to offer. */
553
+ workTemplates(args?: {
554
+ limit?: number;
555
+ }): Promise<RecordsResult<Array<{
556
+ template_id: Uuid;
557
+ name: string;
558
+ nodes: number;
559
+ relations: number;
560
+ created_at: string;
561
+ }>>>;
562
+ /** Who may decide a change about this subject, and why each of them may. */
563
+ workApprovalApprovers(args: {
564
+ subject_id: Uuid | null;
565
+ approver_id?: Uuid | null;
566
+ }): Promise<RecordsResult<WorkApprover[]>>;
567
+ /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */
568
+ workApprovalRequest(args: {
569
+ subject_id: Uuid;
570
+ change: WorkChange;
571
+ note?: string | null;
572
+ approver_id?: Uuid | null;
573
+ origin?: "person" | "agent";
574
+ conversation_id?: Uuid | null;
575
+ }): Promise<RecordsResult<WorkApprovalFiled>>;
576
+ /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */
577
+ workApprovalMayDecide(args: {
578
+ approval_id: Uuid;
579
+ }): Promise<RecordsResult<boolean>>;
580
+ /** Approve or decline. Approving APPLIES the change, as the person approving. */
581
+ workApprovalDecide(args: {
582
+ approval_id: Uuid;
583
+ approve: boolean;
584
+ note?: string | null;
585
+ }): Promise<RecordsResult<WorkApprovalDecision>>;
586
+ /** One waiting change in full, for the person deciding it or the one who asked. */
587
+ workApprovalRead(args: {
588
+ approval_id: Uuid;
589
+ }): Promise<RecordsResult<Record<string, unknown>>>;
442
590
  /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */
443
591
  isExternalPrincipal(args?: {
444
592
  user_id?: Uuid | null;
@@ -486,7 +634,8 @@ interface RecordsClient {
486
634
  */
487
635
  ruleDeclare(args: {
488
636
  spec: Record<string, unknown>;
489
- }): Promise<RecordsResult<never>>;
637
+ rule_id?: Uuid | null;
638
+ }): Promise<RecordsResult<Uuid>>;
490
639
  fieldPropose(proposal: FieldProposal): Promise<RecordsResult<never>>;
491
640
  tablePropose(proposal: TableProposal): Promise<RecordsResult<never>>;
492
641
  promoteTable(args: {
@@ -545,6 +694,15 @@ declare const DOORS: {
545
694
  readonly fieldDeclare: "field_declare";
546
695
  readonly fieldUpdate: "field_update";
547
696
  readonly fieldRetire: "field_retire";
697
+ readonly entityTable: "entity_table";
698
+ readonly entityFields: "entity_fields";
699
+ readonly entityFieldDeclare: "entity_field_declare";
700
+ readonly entityFieldUpdate: "entity_field_update";
701
+ readonly entityFieldRetire: "entity_field_retire";
702
+ readonly entityFieldRights: "entity_field_rights";
703
+ readonly entityRecordRead: "entity_record_read";
704
+ readonly entityValueWrite: "entity_value_write";
705
+ readonly entityRecordsFind: "entity_records_find";
548
706
  readonly tableCapacity: "table_capacity";
549
707
  readonly tableStorage: "table_storage";
550
708
  readonly promoteTable: "promote_table";
@@ -568,6 +726,8 @@ declare const DOORS: {
568
726
  readonly ruleMembership: "rule_membership";
569
727
  readonly ruleRun: "rule_run";
570
728
  readonly ruleEval: "rule_eval";
729
+ readonly forms: "forms";
730
+ readonly formDeclare: "form_declare";
571
731
  readonly recordAggregate: "record_aggregate";
572
732
  readonly aggOperations: "agg_operations";
573
733
  readonly aggBuckets: "agg_buckets";
@@ -605,6 +765,19 @@ declare const DOORS: {
605
765
  readonly workSlotRelease: "work_slot_release";
606
766
  readonly workSlotHolds: "work_slot_holds";
607
767
  readonly workSlotExpire: "work_slot_expire";
768
+ readonly workPerson: "work_person";
769
+ readonly workAssign: "work_assign";
770
+ readonly workRecordStates: "work_record_states";
771
+ readonly workSetState: "work_set_state";
772
+ readonly workList: "work_list";
773
+ readonly workTemplates: "work_templates";
774
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
775
+ readonly workInbox: "work_inbox";
776
+ readonly workApprovalApprovers: "work_approval_approvers";
777
+ readonly workApprovalRequest: "work_approval_request";
778
+ readonly workApprovalMayDecide: "work_approval_may_decide";
779
+ readonly workApprovalDecide: "work_approval_decide";
780
+ readonly workApprovalRead: "work_approval_read";
608
781
  readonly metadataSearch: "metadata_search";
609
782
  readonly ruleDeclare: "rule_declare";
610
783
  readonly fieldPropose: "field_propose";
@@ -725,4 +898,4 @@ declare function parseCsv(text: string): string[][];
725
898
  declare function importCsv(fields: Field[], text: string): ParsedImport;
726
899
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
727
900
 
728
- 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, FieldPatch, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewFieldDeclaration, 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 };
901
+ 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, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewEntityFieldDeclaration, NewFieldDeclaration, 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, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, 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, NewFieldDeclaration, FieldPatch, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, 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, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, 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, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok } from '../index.js';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.js';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, CustomFieldTableType, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityFieldValue, EntityRecordMatch, 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, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, 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, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.js';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -179,6 +179,51 @@ interface RecordsClient {
179
179
  fieldRetire(args: {
180
180
  field_id: Uuid;
181
181
  }): Promise<RecordsResult<boolean>>;
182
+ /** What the registry says about a token, and whether it can hold a value at all. */
183
+ entityTable(args: {
184
+ token: string;
185
+ }): Promise<RecordsResult<EntityTableFacts>>;
186
+ /** The fields THIS organization added to that standard table. */
187
+ entityFields(args: {
188
+ token: string;
189
+ }): Promise<RecordsResult<Field[]>>;
190
+ /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */
191
+ entityFieldDeclare(args: {
192
+ token: string;
193
+ spec: NewEntityFieldDeclaration;
194
+ }): Promise<RecordsResult<Uuid>>;
195
+ /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */
196
+ entityFieldUpdate(args: {
197
+ field_id: Uuid;
198
+ patch: Record<string, unknown>;
199
+ }): Promise<RecordsResult<Uuid>>;
200
+ /** Take a custom field off a standard table. The values already written stay in each row. */
201
+ entityFieldRetire(args: {
202
+ field_id: Uuid;
203
+ }): Promise<RecordsResult<Uuid>>;
204
+ /** May this person add a column here - and if not, the store's own sentence saying why. */
205
+ entityFieldRights(args: {
206
+ token: string;
207
+ }): Promise<RecordsResult<EntityFieldRights>>;
208
+ /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */
209
+ entityRecordRead(args: {
210
+ token: string;
211
+ record_id: Uuid;
212
+ }): Promise<RecordsResult<EntityRecordRead>>;
213
+ /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */
214
+ entityValueWrite(args: {
215
+ token: string;
216
+ record_id: Uuid;
217
+ patch: Record<string, unknown>;
218
+ }): Promise<RecordsResult<EntityRecordRead>>;
219
+ /** Rows of that standard table with this custom value. Refuses a field nobody declared. */
220
+ entityRecordsFind(args: {
221
+ token: string;
222
+ key: string;
223
+ value?: unknown;
224
+ limit?: number;
225
+ offset?: number;
226
+ }): Promise<RecordsResult<EntityRecordsFound>>;
182
227
  /** The kernel Tables a caller writes a Home, a Field or a Rule into. */
183
228
  personKernelId(): Promise<RecordsResult<Uuid>>;
184
229
  fieldKernelId(): Promise<RecordsResult<Uuid>>;
@@ -204,6 +249,29 @@ interface RecordsClient {
204
249
  values: Record<string, unknown>;
205
250
  context?: Record<string, unknown>;
206
251
  }): Promise<RecordsResult<unknown>>;
252
+ /**
253
+ * Write ONE Rule as a real Rule. `recordWrite` into the Rule kernel makes a
254
+ * valid Rule document that carries `data_class = 'record'`, and every reader
255
+ * that looks for a Rule looks for the class — `custom.agg_subscriptions`
256
+ * selects `where data_class = 'rule'` — so a subscription written that way
257
+ * fires at nobody. This is the door that closes it.
258
+ */
259
+ /** This organization's forms, with how many answers arrived and how many are in the table. */
260
+ forms(args?: {
261
+ table_id?: Uuid | null;
262
+ }): Promise<RecordsResult<FormSummary[]>>;
263
+ /** Create or re-state one form. A question naming no Field of that Table is refused BY NAME. */
264
+ formDeclare(args: {
265
+ table_id: Uuid;
266
+ title: string;
267
+ questions: unknown[];
268
+ presentation?: Record<string, unknown> | null;
269
+ submission_cap?: number | null;
270
+ quarantine_rule_id?: Uuid | null;
271
+ notify_rule_id?: Uuid | null;
272
+ form_id?: Uuid | null;
273
+ slug?: string | null;
274
+ }): Promise<RecordsResult<Uuid>>;
207
275
  /**
208
276
  * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The
209
277
  * aggregate node sits above the visibility join, so what a chart draws is
@@ -439,6 +507,86 @@ interface RecordsClient {
439
507
  workSlotExpire(args: {
440
508
  table_id: Uuid;
441
509
  }): Promise<RecordsResult<number>>;
510
+ /**
511
+ * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one
512
+ * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the
513
+ * agent's suggestions is the thing this replaces.
514
+ */
515
+ workInbox(args?: {
516
+ limit?: number;
517
+ offset?: number;
518
+ includeDecided?: boolean;
519
+ }): Promise<RecordsResult<WorkInboxItem[]>>;
520
+ /** "My work", "work I assigned", "waiting on somebody being chosen". */
521
+ workList(args?: {
522
+ flavour?: WorkListFlavour;
523
+ includeFinished?: boolean;
524
+ limit?: number;
525
+ offset?: number;
526
+ }): Promise<RecordsResult<WorkListItem[]>>;
527
+ /**
528
+ * Give one record to one person: the Assignee value AND editor access, in one
529
+ * transaction. Passing no `user_id` un-assigns and says plainly that nobody's
530
+ * access was taken away.
531
+ */
532
+ workAssign(args: {
533
+ record_id: Uuid;
534
+ user_id?: Uuid | null;
535
+ dueDate?: string | null;
536
+ clearDue?: boolean;
537
+ }): Promise<RecordsResult<WorkAssignment>>;
538
+ /** The states this record may be moved to, and the sentence for each it may not. */
539
+ workRecordStates(args: {
540
+ record_id: Uuid;
541
+ }): Promise<RecordsResult<WorkRecordState[]>>;
542
+ /** Move it. The store refuses a move the model forbids, in its own words. */
543
+ workSetState(args: {
544
+ record_id: Uuid;
545
+ state_id: Uuid | null;
546
+ }): Promise<RecordsResult<unknown>>;
547
+ /** The person-kernel record standing for a signed-in person here. */
548
+ workPerson(args: {
549
+ user_id: Uuid;
550
+ create?: boolean;
551
+ }): Promise<RecordsResult<Uuid | null>>;
552
+ /** The templates this person may run, so a picker has ids to offer. */
553
+ workTemplates(args?: {
554
+ limit?: number;
555
+ }): Promise<RecordsResult<Array<{
556
+ template_id: Uuid;
557
+ name: string;
558
+ nodes: number;
559
+ relations: number;
560
+ created_at: string;
561
+ }>>>;
562
+ /** Who may decide a change about this subject, and why each of them may. */
563
+ workApprovalApprovers(args: {
564
+ subject_id: Uuid | null;
565
+ approver_id?: Uuid | null;
566
+ }): Promise<RecordsResult<WorkApprover[]>>;
567
+ /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */
568
+ workApprovalRequest(args: {
569
+ subject_id: Uuid;
570
+ change: WorkChange;
571
+ note?: string | null;
572
+ approver_id?: Uuid | null;
573
+ origin?: "person" | "agent";
574
+ conversation_id?: Uuid | null;
575
+ }): Promise<RecordsResult<WorkApprovalFiled>>;
576
+ /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */
577
+ workApprovalMayDecide(args: {
578
+ approval_id: Uuid;
579
+ }): Promise<RecordsResult<boolean>>;
580
+ /** Approve or decline. Approving APPLIES the change, as the person approving. */
581
+ workApprovalDecide(args: {
582
+ approval_id: Uuid;
583
+ approve: boolean;
584
+ note?: string | null;
585
+ }): Promise<RecordsResult<WorkApprovalDecision>>;
586
+ /** One waiting change in full, for the person deciding it or the one who asked. */
587
+ workApprovalRead(args: {
588
+ approval_id: Uuid;
589
+ }): Promise<RecordsResult<Record<string, unknown>>>;
442
590
  /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */
443
591
  isExternalPrincipal(args?: {
444
592
  user_id?: Uuid | null;
@@ -486,7 +634,8 @@ interface RecordsClient {
486
634
  */
487
635
  ruleDeclare(args: {
488
636
  spec: Record<string, unknown>;
489
- }): Promise<RecordsResult<never>>;
637
+ rule_id?: Uuid | null;
638
+ }): Promise<RecordsResult<Uuid>>;
490
639
  fieldPropose(proposal: FieldProposal): Promise<RecordsResult<never>>;
491
640
  tablePropose(proposal: TableProposal): Promise<RecordsResult<never>>;
492
641
  promoteTable(args: {
@@ -545,6 +694,15 @@ declare const DOORS: {
545
694
  readonly fieldDeclare: "field_declare";
546
695
  readonly fieldUpdate: "field_update";
547
696
  readonly fieldRetire: "field_retire";
697
+ readonly entityTable: "entity_table";
698
+ readonly entityFields: "entity_fields";
699
+ readonly entityFieldDeclare: "entity_field_declare";
700
+ readonly entityFieldUpdate: "entity_field_update";
701
+ readonly entityFieldRetire: "entity_field_retire";
702
+ readonly entityFieldRights: "entity_field_rights";
703
+ readonly entityRecordRead: "entity_record_read";
704
+ readonly entityValueWrite: "entity_value_write";
705
+ readonly entityRecordsFind: "entity_records_find";
548
706
  readonly tableCapacity: "table_capacity";
549
707
  readonly tableStorage: "table_storage";
550
708
  readonly promoteTable: "promote_table";
@@ -568,6 +726,8 @@ declare const DOORS: {
568
726
  readonly ruleMembership: "rule_membership";
569
727
  readonly ruleRun: "rule_run";
570
728
  readonly ruleEval: "rule_eval";
729
+ readonly forms: "forms";
730
+ readonly formDeclare: "form_declare";
571
731
  readonly recordAggregate: "record_aggregate";
572
732
  readonly aggOperations: "agg_operations";
573
733
  readonly aggBuckets: "agg_buckets";
@@ -605,6 +765,19 @@ declare const DOORS: {
605
765
  readonly workSlotRelease: "work_slot_release";
606
766
  readonly workSlotHolds: "work_slot_holds";
607
767
  readonly workSlotExpire: "work_slot_expire";
768
+ readonly workPerson: "work_person";
769
+ readonly workAssign: "work_assign";
770
+ readonly workRecordStates: "work_record_states";
771
+ readonly workSetState: "work_set_state";
772
+ readonly workList: "work_list";
773
+ readonly workTemplates: "work_templates";
774
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
775
+ readonly workInbox: "work_inbox";
776
+ readonly workApprovalApprovers: "work_approval_approvers";
777
+ readonly workApprovalRequest: "work_approval_request";
778
+ readonly workApprovalMayDecide: "work_approval_may_decide";
779
+ readonly workApprovalDecide: "work_approval_decide";
780
+ readonly workApprovalRead: "work_approval_read";
608
781
  readonly metadataSearch: "metadata_search";
609
782
  readonly ruleDeclare: "rule_declare";
610
783
  readonly fieldPropose: "field_propose";
@@ -725,4 +898,4 @@ declare function parseCsv(text: string): string[][];
725
898
  declare function importCsv(fields: Field[], text: string): ParsedImport;
726
899
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
727
900
 
728
- 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, FieldPatch, FieldProposal, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewFieldDeclaration, 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 };
901
+ 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, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewEntityFieldDeclaration, NewFieldDeclaration, 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, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, 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 };