@ai-matrx/records 0.87.32 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +115 -0
- package/dist/{client-E0VQ0NPO.d.ts → client-DE9Mq6YX.d.cts} +8 -5
- package/dist/{client-C3ZZNfGH.d.cts → client-vJAb7g9r.d.ts} +8 -5
- package/dist/core/index.cjs +25 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +23 -12
- package/dist/core/index.d.ts +23 -12
- package/dist/core/index.js +25 -7
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +19 -7
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.d.cts +12 -142
- package/dist/data/index.d.ts +12 -142
- package/dist/data/index.js +19 -7
- package/dist/data/index.js.map +1 -1
- package/dist/{declareTable-BK3zufr7.d.cts → declareTable-Btg5bql1.d.cts} +4 -4
- package/dist/{declareTable-B12XybRp.d.ts → declareTable-JKt2q34d.d.ts} +4 -4
- package/dist/entity/index.cjs +984 -0
- package/dist/entity/index.cjs.map +1 -0
- package/dist/entity/index.d.cts +36 -0
- package/dist/entity/index.d.ts +36 -0
- package/dist/entity/index.js +964 -0
- package/dist/entity/index.js.map +1 -0
- package/dist/entity/react.cjs +1024 -0
- package/dist/entity/react.cjs.map +1 -0
- package/dist/entity/react.d.cts +511 -0
- package/dist/entity/react.d.ts +511 -0
- package/dist/entity/react.js +1015 -0
- package/dist/entity/react.js.map +1 -0
- package/dist/{field-BanTVGK2.d.cts → field-BJBnTyJ0.d.cts} +1 -1
- package/dist/{field-BPABOJ2Y.d.ts → field-Ti5iAxFr.d.ts} +1 -1
- package/dist/forms/index.cjs +984 -0
- package/dist/forms/index.cjs.map +1 -0
- package/dist/forms/index.d.cts +333 -0
- package/dist/forms/index.d.ts +333 -0
- package/dist/forms/index.js +961 -0
- package/dist/forms/index.js.map +1 -0
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.cts +7 -6
- package/dist/memory/index.d.ts +7 -6
- package/dist/port-CPVBfDxS.d.cts +301 -0
- package/dist/port-D2i2o7Lg.d.ts +301 -0
- package/dist/portal-Db4CYyHe.d.ts +331 -0
- package/dist/portal-DfeY2Boy.d.cts +331 -0
- package/dist/{ports-TMWX-t9l.d.ts → ports-BWtxAnXh.d.ts} +2 -2
- package/dist/{ports-D8-iuY1P.d.cts → ports-DSU2RsR6.d.cts} +2 -2
- package/dist/react/index.cjs +55 -523
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +14 -1
- package/dist/react/index.d.ts +14 -1
- package/dist/react/index.js +52 -527
- package/dist/react/index.js.map +1 -1
- package/dist/realtime/index.d.cts +2 -2
- package/dist/realtime/index.d.ts +2 -2
- package/dist/{record-DpB2QgAZ.d.cts → record-BQi92d4-.d.cts} +7 -1
- package/dist/{record-DpB2QgAZ.d.ts → record-BQi92d4-.d.ts} +7 -1
- package/dist/relation-DMwkmzgN.d.cts +230 -0
- package/dist/relation-DlcqV_W5.d.ts +230 -0
- package/dist/rule-B8kR0l01.d.ts +250 -0
- package/dist/rule-BMViCLmW.d.cts +250 -0
- package/dist/search/index.cjs +283 -0
- package/dist/search/index.cjs.map +1 -0
- package/dist/search/index.d.cts +44 -0
- package/dist/search/index.d.ts +44 -0
- package/dist/search/index.js +260 -0
- package/dist/search/index.js.map +1 -0
- package/dist/setup/index.cjs +6854 -0
- package/dist/setup/index.cjs.map +1 -0
- package/dist/setup/index.d.cts +87 -0
- package/dist/setup/index.d.ts +87 -0
- package/dist/setup/index.js +6829 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/{subscription-D7KQBHXN.d.ts → subscription-5CLN3Jug.d.ts} +3 -249
- package/dist/{subscription-BD9DnJxX.d.cts → subscription-D-VEzvyy.d.cts} +3 -249
- package/dist/{table-kind-BZu8mtND.d.cts → table-kind-CVp43g6h.d.ts} +3 -558
- package/dist/{table-kind-xKxTHtrV.d.ts → table-kind-Cm6PXkWx.d.cts} +3 -558
- package/dist/templates/index.d.cts +10 -9
- package/dist/templates/index.d.ts +10 -9
- package/dist/typed-table/index.cjs +19 -7
- package/dist/typed-table/index.cjs.map +1 -1
- package/dist/typed-table/index.d.cts +10 -7
- package/dist/typed-table/index.d.ts +10 -7
- package/dist/typed-table/index.js +19 -7
- package/dist/typed-table/index.js.map +1 -1
- package/dist/{types-CLP5H4Wk.d.cts → types-9Q5SHRDJ.d.cts} +2 -2
- package/dist/{types-DmPkWQic.d.ts → types-CfYy-vdV.d.ts} +2 -2
- package/dist/{types-C2uspRtf.d.cts → types-Cs2MyE3u.d.cts} +2 -2
- package/dist/{types-Dv61jStB.d.ts → types-DF-dxB_l.d.ts} +2 -2
- package/dist/types-DTEGaxso.d.cts +139 -0
- package/dist/types-Dji5SpFS.d.ts +139 -0
- package/dist/use-cases/index.d.cts +5 -5
- package/dist/use-cases/index.d.ts +5 -5
- package/dist/{validate-CWVToe1T.d.ts → validate-BydKd-Le.d.ts} +1 -1
- package/dist/{validate-DEB_mn4Y.d.cts → validate-CqJakTKk.d.cts} +1 -1
- package/dist/versions/index.cjs +375 -0
- package/dist/versions/index.cjs.map +1 -0
- package/dist/versions/index.d.cts +160 -0
- package/dist/versions/index.d.ts +160 -0
- package/dist/versions/index.js +353 -0
- package/dist/versions/index.js.map +1 -0
- package/package.json +62 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _ai_matrx_realtime from '@ai-matrx/realtime';
|
|
2
2
|
import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
|
|
3
|
-
import { R as RecordsRealtimePort } from '../ports-
|
|
4
|
-
import '../record-
|
|
3
|
+
import { R as RecordsRealtimePort } from '../ports-DSU2RsR6.cjs';
|
|
4
|
+
import '../record-BQi92d4-.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The topic is a CONTRACT WITH THE DATABASE (a Postgres trigger writes it, an RLS policy parses it),
|
package/dist/realtime/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _ai_matrx_realtime from '@ai-matrx/realtime';
|
|
2
2
|
import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
|
|
3
|
-
import { R as RecordsRealtimePort } from '../ports-
|
|
4
|
-
import '../record-
|
|
3
|
+
import { R as RecordsRealtimePort } from '../ports-BWtxAnXh.js';
|
|
4
|
+
import '../record-BQi92d4-.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The topic is a CONTRACT WITH THE DATABASE (a Postgres trigger writes it, an RLS policy parses it),
|
|
@@ -6180,6 +6180,12 @@ interface RecordRead {
|
|
|
6180
6180
|
* was never asked for).
|
|
6181
6181
|
*/
|
|
6182
6182
|
computedUnavailable?: RecordsError | null;
|
|
6183
|
+
/**
|
|
6184
|
+
* The version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
|
|
6185
|
+
* second call. Read beside the document in the same round of requests; `null` when the store
|
|
6186
|
+
* could not answer it (a write then refuses as "version unread", never as last-write-wins).
|
|
6187
|
+
*/
|
|
6188
|
+
version?: number | null;
|
|
6183
6189
|
}
|
|
6184
6190
|
|
|
6185
|
-
export {
|
|
6191
|
+
export { type Freshness as $, type Actor as A, type PredictedRefusal as B, type ComputeOn as C, type DeclarableFieldKind as D, ABSENCE_REASONS as E, type FieldSource as F, ACTOR_VOCABULARY as G, type HiddenFieldNotice as H, type AbsenceReason as I, COMPUTE_ON as J, CONTEXT_POLICIES as K, DECLARABLE_FIELD_KINDS as L, DELIVERIES as M, type Delivery as N, type OnDelete as O, type PgError as P, ENTITY_TOKENS as Q, type RecordsResult as R, type StorageMode as S, type Timestamp as T, type Uuid as U, type EntityToken as V, type WriteConflict as W, FIELD_SENSITIVITIES as X, FIELD_SOURCES as Y, FRESHNESS as Z, type ForbiddenEnvelopeWord as _, type RecordsError as a, KERNEL_TABLES as a0, type KernelTableName as a1, type KeysetRow as a2, MERGE_FIELD_MODIFIERS as a3, MERGE_FIELD_SEMANTIC_TYPES as a4, MERGE_FIELD_SOURCES as a5, type MergeFieldModifier as a6, type MergeFieldSemanticType as a7, type MergeFieldSource as a8, ON_DELETE as a9, type ValueAlternateKey as aA, type ValueEnvelope as aB, type ValueEnvelopeKey as aC, type ValueSource as aD, err as aE, isLockedStub as aF, isRecordsErr as aG, ok as aH, splitLockedRows as aI, OVERRIDE_POLICIES as aa, type OverridePolicy as ab, PARITY_FIELD_TYPES as ac, PER_VALUE_ACCESS_WORDS as ad, type PerValueAccessWord as ae, type ProvenancePointer as af, RELATION_BINDINGS as ag, RELATION_CARDINALITIES as ah, RELATION_FLAVORS as ai, RETIRED_ACTOR_WORDS as aj, RULE_NODE_KINDS as ak, RULE_USES as al, type RetiredActorWord as am, STORAGE_MODES as an, STORE_DOORS as ao, STORE_KNOBS as ap, STORE_REFUSAL_CODES as aq, type StoreDoorName as ar, type StoreRefusalCode as as, TABLE_DISPLAYS as at, TABLE_ORIGINS as au, TABLE_TYPES as av, type TableOrigin as aw, VALUE_ALTERNATE_KEYS as ax, VALUE_ENVELOPE_KEYS as ay, type ValueAlternate as az, type RelationFlavor as b, type RelationBinding as c, type RelationCardinality as d, type RuleNodeKind as e, type RuleUse as f, type TableType as g, type TableDisplay as h, type FieldSensitivity as i, type ContextPolicy as j, type RecordsErrorCode as k, type RecordDocument as l, type RecordChange as m, type RecordChangeResult as n, type RecordGraphWritten as o, type RecordRead as p, type ReadRow as q, type RecordPageSort as r, type RecordPage as s, type RecordKeysetPage as t, type StoredRecord as u, type RecordRevision as v, type ReadValue as w, type FieldBehavior as x, type ParityFieldType as y, type StaleWriteDetail as z };
|
|
@@ -6180,6 +6180,12 @@ interface RecordRead {
|
|
|
6180
6180
|
* was never asked for).
|
|
6181
6181
|
*/
|
|
6182
6182
|
computedUnavailable?: RecordsError | null;
|
|
6183
|
+
/**
|
|
6184
|
+
* The version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
|
|
6185
|
+
* second call. Read beside the document in the same round of requests; `null` when the store
|
|
6186
|
+
* could not answer it (a write then refuses as "version unread", never as last-write-wins).
|
|
6187
|
+
*/
|
|
6188
|
+
version?: number | null;
|
|
6183
6189
|
}
|
|
6184
6190
|
|
|
6185
|
-
export {
|
|
6191
|
+
export { type Freshness as $, type Actor as A, type PredictedRefusal as B, type ComputeOn as C, type DeclarableFieldKind as D, ABSENCE_REASONS as E, type FieldSource as F, ACTOR_VOCABULARY as G, type HiddenFieldNotice as H, type AbsenceReason as I, COMPUTE_ON as J, CONTEXT_POLICIES as K, DECLARABLE_FIELD_KINDS as L, DELIVERIES as M, type Delivery as N, type OnDelete as O, type PgError as P, ENTITY_TOKENS as Q, type RecordsResult as R, type StorageMode as S, type Timestamp as T, type Uuid as U, type EntityToken as V, type WriteConflict as W, FIELD_SENSITIVITIES as X, FIELD_SOURCES as Y, FRESHNESS as Z, type ForbiddenEnvelopeWord as _, type RecordsError as a, KERNEL_TABLES as a0, type KernelTableName as a1, type KeysetRow as a2, MERGE_FIELD_MODIFIERS as a3, MERGE_FIELD_SEMANTIC_TYPES as a4, MERGE_FIELD_SOURCES as a5, type MergeFieldModifier as a6, type MergeFieldSemanticType as a7, type MergeFieldSource as a8, ON_DELETE as a9, type ValueAlternateKey as aA, type ValueEnvelope as aB, type ValueEnvelopeKey as aC, type ValueSource as aD, err as aE, isLockedStub as aF, isRecordsErr as aG, ok as aH, splitLockedRows as aI, OVERRIDE_POLICIES as aa, type OverridePolicy as ab, PARITY_FIELD_TYPES as ac, PER_VALUE_ACCESS_WORDS as ad, type PerValueAccessWord as ae, type ProvenancePointer as af, RELATION_BINDINGS as ag, RELATION_CARDINALITIES as ah, RELATION_FLAVORS as ai, RETIRED_ACTOR_WORDS as aj, RULE_NODE_KINDS as ak, RULE_USES as al, type RetiredActorWord as am, STORAGE_MODES as an, STORE_DOORS as ao, STORE_KNOBS as ap, STORE_REFUSAL_CODES as aq, type StoreDoorName as ar, type StoreRefusalCode as as, TABLE_DISPLAYS as at, TABLE_ORIGINS as au, TABLE_TYPES as av, type TableOrigin as aw, VALUE_ALTERNATE_KEYS as ax, VALUE_ENVELOPE_KEYS as ay, type ValueAlternate as az, type RelationFlavor as b, type RelationBinding as c, type RelationCardinality as d, type RuleNodeKind as e, type RuleUse as f, type TableType as g, type TableDisplay as h, type FieldSensitivity as i, type ContextPolicy as j, type RecordsErrorCode as k, type RecordDocument as l, type RecordChange as m, type RecordChangeResult as n, type RecordGraphWritten as o, type RecordRead as p, type ReadRow as q, type RecordPageSort as r, type RecordPage as s, type RecordKeysetPage as t, type StoredRecord as u, type RecordRevision as v, type ReadValue as w, type FieldBehavior as x, type ParityFieldType as y, type StaleWriteDetail as z };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BQi92d4-.cjs';
|
|
2
|
+
import { c as RecordsDataSource } from './ports-DSU2RsR6.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* REL-6. Whether Visibility flows along this relation and the MAXIMUM access
|
|
6
|
+
* level it carries. Default off on `referenced`, on for `owned`.
|
|
7
|
+
*/
|
|
8
|
+
interface RelationCarries {
|
|
9
|
+
carries: boolean;
|
|
10
|
+
/** The ceiling — a relation never carries more access than this. */
|
|
11
|
+
max_access: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** The seven properties, each its own question. */
|
|
14
|
+
interface RelationProperties {
|
|
15
|
+
/** REL-1. Stored once on the contained table, read from the field's side. */
|
|
16
|
+
flavor: RelationFlavor;
|
|
17
|
+
/** REL-2. Separate from flavour. */
|
|
18
|
+
on_delete: OnDelete;
|
|
19
|
+
/** REL-3. A snapshot is a frozen copy in the relation's payload — never a pointer into History. */
|
|
20
|
+
binding: RelationBinding;
|
|
21
|
+
/** REL-4. */
|
|
22
|
+
ordered: boolean;
|
|
23
|
+
/** REL-5. */
|
|
24
|
+
loops: "allowed" | "refused";
|
|
25
|
+
/** REL-6. */
|
|
26
|
+
carries: RelationCarries;
|
|
27
|
+
/** REL-7. */
|
|
28
|
+
cardinality: RelationCardinality;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* REL-8 / REL-N-1. A target is a REFERENCE, written that way from the first
|
|
32
|
+
* line of code, because it may name a row outside our database. One Table,
|
|
33
|
+
* several, or any — polymorphic without restriction. External targets are
|
|
34
|
+
* read-only in v1.
|
|
35
|
+
*/
|
|
36
|
+
type RelationTarget = {
|
|
37
|
+
kind: "ours";
|
|
38
|
+
entity_token: string;
|
|
39
|
+
row_id: Uuid;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "external";
|
|
42
|
+
connection_token: string;
|
|
43
|
+
external_table: string;
|
|
44
|
+
external_key: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "any";
|
|
47
|
+
};
|
|
48
|
+
/** One edge, as the store holds it in `platform.associations`. */
|
|
49
|
+
interface Relation {
|
|
50
|
+
id: Uuid;
|
|
51
|
+
organization_id: Uuid;
|
|
52
|
+
/** REL-10. The field key, which is what `role` holds. */
|
|
53
|
+
role: string;
|
|
54
|
+
source: RelationTarget;
|
|
55
|
+
target: RelationTarget;
|
|
56
|
+
properties: RelationProperties;
|
|
57
|
+
/** REL-4. Meaningful only when `ordered`. */
|
|
58
|
+
position: number | null;
|
|
59
|
+
/** REL-3. The frozen copy, when `binding` is `snapshot`. */
|
|
60
|
+
payload: Record<string, unknown> | null;
|
|
61
|
+
/** REL-14. Hydrated from the target's title field AT READ — never stored. */
|
|
62
|
+
label: string | null;
|
|
63
|
+
created_at: Timestamp;
|
|
64
|
+
updated_at: Timestamp;
|
|
65
|
+
/** REL-13 / REL-16. Associations are versioned, so relation history exists. */
|
|
66
|
+
version: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* DOOR-6. A query coordinate: "related to THIS, along THAT role, in that
|
|
70
|
+
* direction". Any combination, and any subset of them.
|
|
71
|
+
*/
|
|
72
|
+
interface RelationCoordinate {
|
|
73
|
+
/** The record at the other end. */
|
|
74
|
+
record_id: Uuid;
|
|
75
|
+
/** The field key the edge carries as its role. Omit to mean any role. */
|
|
76
|
+
role?: string;
|
|
77
|
+
/** Which way to walk. `out` is this record's own relation fields. */
|
|
78
|
+
direction?: "out" | "in" | "either";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The arguments of the ONE relation-words resolver: the FIELD, because that is where its display
|
|
82
|
+
* spec is declared and judged (`custom._display_of_field` reads it server-side; the caller never
|
|
83
|
+
* carries it), and the ids of a page of cells.
|
|
84
|
+
*/
|
|
85
|
+
/** A linked record's icon, and its table's icon for a record that has none (`relationWordsMany`). */
|
|
86
|
+
interface RelationIcons {
|
|
87
|
+
icon: string | null;
|
|
88
|
+
tableIcon: string | null;
|
|
89
|
+
}
|
|
90
|
+
interface RelationWordsManyArgs {
|
|
91
|
+
field_id: Uuid;
|
|
92
|
+
record_ids: Uuid[];
|
|
93
|
+
}
|
|
94
|
+
/** One reference as the store keeps it. */
|
|
95
|
+
interface EntityRef {
|
|
96
|
+
/** The `platform.entity_types` token: `note`, `web_site`, `agent` … */
|
|
97
|
+
token: string;
|
|
98
|
+
id: Uuid;
|
|
99
|
+
}
|
|
100
|
+
/** One reference as a read door answers it. */
|
|
101
|
+
interface EntityRefWithWords extends EntityRef {
|
|
102
|
+
/**
|
|
103
|
+
* The thing's own title — or the store's withheld sentence when the reader
|
|
104
|
+
* may not open it; `null` when the kind names no title.
|
|
105
|
+
*/
|
|
106
|
+
label: string | null;
|
|
107
|
+
}
|
|
108
|
+
/** One kind of platform thing a record may point at (`custom.entity_reference_kinds`). */
|
|
109
|
+
interface EntityReferenceKind {
|
|
110
|
+
token: string;
|
|
111
|
+
/** What a person reads: "Note", "Site", "Agent". */
|
|
112
|
+
label: string;
|
|
113
|
+
/** The picker's grouping: the admin-assigned reference category, else the schema. */
|
|
114
|
+
category: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The references a cell holds, whichever shape it arrived in — one object, a
|
|
118
|
+
* list, or what a read door rendered (with labels). Anything that is not a
|
|
119
|
+
* reference is left out, never guessed at.
|
|
120
|
+
*/
|
|
121
|
+
declare function entityRefsOf(value: unknown): EntityRefWithWords[];
|
|
122
|
+
/**
|
|
123
|
+
* What to WRITE for an entity-reference cell: `{token, id}` only, each thing
|
|
124
|
+
* once, first mention first — the label a read door added is dropped, because
|
|
125
|
+
* the store reads it and never keeps it (REL-14). A single-valued column gets
|
|
126
|
+
* the one object (or `null`), a multi-valued one the list.
|
|
127
|
+
*/
|
|
128
|
+
declare function entityRefsToWrite(value: unknown, multi: boolean): EntityRef | EntityRef[] | null;
|
|
129
|
+
/**
|
|
130
|
+
* The kinds of platform thing a record may point at — what the field editor's
|
|
131
|
+
* kind picker lists. `custom.entity_reference_kinds()`.
|
|
132
|
+
*/
|
|
133
|
+
declare function entityReferenceKinds(source: RecordsDataSource): Promise<RecordsResult<EntityReferenceKind[]>>;
|
|
134
|
+
/**
|
|
135
|
+
* THE SEARCH DOOR (lane REFERENCE-CARRY). The platform things of these kinds whose words hold
|
|
136
|
+
* `search`, that THIS person may point a record at — each one a thing the store's own write check
|
|
137
|
+
* (`custom._entity_reference_target_ok`) would accept, so a picked reference is never refused on
|
|
138
|
+
* save. `custom.entity_reference_search`. An empty search lists the first things by name.
|
|
139
|
+
*/
|
|
140
|
+
declare function entityReferenceSearch(source: RecordsDataSource, organizationId: Uuid | null, tokens: readonly string[], search: string, limit?: number): Promise<RecordsResult<EntityRefWithWords[]>>;
|
|
141
|
+
/**
|
|
142
|
+
* THE WORDS HELPER. The words of each `{token, id}` for a picker or a chip
|
|
143
|
+
* before anything is saved — each label read by the store for THIS person and
|
|
144
|
+
* withheld when they may not open the thing. `custom.entity_reference_words`.
|
|
145
|
+
* A saved cell needs no call: every read door already answers its labels.
|
|
146
|
+
*/
|
|
147
|
+
declare function entityReferenceWords(source: RecordsDataSource, organizationId: Uuid | null, refs: readonly EntityRef[]): Promise<RecordsResult<EntityRefWithWords[]>>;
|
|
148
|
+
/** One reverse column of a Table, as `custom.reverse_columns` answers it. */
|
|
149
|
+
interface ReverseColumn {
|
|
150
|
+
/** Stable key: the linking Field's `inverse_key`, else `linked_<field id>`. Never a Field key of B. */
|
|
151
|
+
key: string;
|
|
152
|
+
/** What the column is called on B: the linking table's name (plus the column's when ambiguous). */
|
|
153
|
+
label: string;
|
|
154
|
+
/** The relation Field on the linking table. */
|
|
155
|
+
source_field_id: Uuid;
|
|
156
|
+
source_field_key: string;
|
|
157
|
+
source_field_label: string;
|
|
158
|
+
/** The linking table. */
|
|
159
|
+
source_table_id: Uuid;
|
|
160
|
+
source_table_name: string;
|
|
161
|
+
/** Always `many`: any number of records may link to one. */
|
|
162
|
+
cardinality: "many";
|
|
163
|
+
/**
|
|
164
|
+
* True for a virtual back-link (written only from the linking table's side). False for a TWO-WAY
|
|
165
|
+
* LINK (NOTION-PROPS): the reverse end is a real Field on this table — `key` is its key, `label`
|
|
166
|
+
* its label — and `relationReverseSet` writes its links from here.
|
|
167
|
+
*/
|
|
168
|
+
read_only: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* NOTION-PROPS. A two-way link's reverse Field: a relation whose `config.reverse_of` names the
|
|
172
|
+
* forward relation it mirrors. It holds no value of its own — its links are the forward Field's.
|
|
173
|
+
*/
|
|
174
|
+
declare function isReverseField(field: {
|
|
175
|
+
type?: unknown;
|
|
176
|
+
config?: unknown;
|
|
177
|
+
} | null | undefined): boolean;
|
|
178
|
+
/** One linking record, as a chip shows it. */
|
|
179
|
+
interface ReverseLink {
|
|
180
|
+
id: Uuid;
|
|
181
|
+
/** The linking record's name, read by the store for this reader. */
|
|
182
|
+
words: string;
|
|
183
|
+
}
|
|
184
|
+
/** The links of one record through one reverse column: how many the reader may see, and one page. */
|
|
185
|
+
interface ReverseLinks {
|
|
186
|
+
total: number;
|
|
187
|
+
links: ReverseLink[];
|
|
188
|
+
}
|
|
189
|
+
interface ReverseLinksManyArgs {
|
|
190
|
+
/** The Table whose records are being shown (B). */
|
|
191
|
+
table_id: Uuid;
|
|
192
|
+
/** `ReverseColumn.source_field_id`. */
|
|
193
|
+
source_field_id: Uuid;
|
|
194
|
+
/** A page of B's record ids — up to 200 a call; more are sent in groups by the client. */
|
|
195
|
+
record_ids: readonly Uuid[];
|
|
196
|
+
/** Links per record, 1–50 (the store holds it there). Default 10. */
|
|
197
|
+
limit?: number;
|
|
198
|
+
/** Skip this many links of each record — the next page of one hub record. Default 0. */
|
|
199
|
+
offset?: number;
|
|
200
|
+
}
|
|
201
|
+
/** `reverseLinksFields`: the links of a page through several reverse columns, in one call. */
|
|
202
|
+
interface ReverseLinksFieldsArgs {
|
|
203
|
+
table_id: Uuid;
|
|
204
|
+
/** Each `ReverseColumn.source_field_id` — at most 20. */
|
|
205
|
+
source_field_ids: readonly Uuid[];
|
|
206
|
+
record_ids: readonly Uuid[];
|
|
207
|
+
limit?: number;
|
|
208
|
+
offset?: number;
|
|
209
|
+
}
|
|
210
|
+
/** The store's per-call ceiling on records for `custom.reverse_links_many`. */
|
|
211
|
+
declare const REVERSE_LINKS_RECORDS_PER_CALL = 200;
|
|
212
|
+
/** The store's ceiling on links a record per call. */
|
|
213
|
+
declare const REVERSE_LINKS_PAGE_MAX = 50;
|
|
214
|
+
/** The store's typed "source archived" answer for a lookup or roll-up. */
|
|
215
|
+
interface SourceArchived {
|
|
216
|
+
__unavailable: "source_archived";
|
|
217
|
+
/** `link`: the relation it reads through is archived; `column`: the far column it reads is. */
|
|
218
|
+
reads: "link" | "column";
|
|
219
|
+
/** The archived Field. Absent when the reader may not know its Table. */
|
|
220
|
+
field_id?: Uuid;
|
|
221
|
+
/** Its label. Absent when the reader may not know its Table. */
|
|
222
|
+
label?: string;
|
|
223
|
+
table_id?: Uuid;
|
|
224
|
+
/** Its Table's name. Absent when the reader may not know that Table. */
|
|
225
|
+
table?: string;
|
|
226
|
+
}
|
|
227
|
+
/** The typed "source archived" answer, when `value` is one; null for any other value. */
|
|
228
|
+
declare function sourceArchivedOf(value: unknown): SourceArchived | null;
|
|
229
|
+
|
|
230
|
+
export { type EntityRefWithWords as E, type RelationCoordinate as R, type SourceArchived as S, type RelationWordsManyArgs as a, type RelationIcons as b, type ReverseColumn as c, type ReverseLinksManyArgs as d, type ReverseLinks as e, type ReverseLinksFieldsArgs as f, type EntityRef as g, type EntityReferenceKind as h, REVERSE_LINKS_PAGE_MAX as i, REVERSE_LINKS_RECORDS_PER_CALL as j, type Relation as k, type RelationCarries as l, type RelationProperties as m, type RelationTarget as n, type ReverseLink as o, entityReferenceKinds as p, entityReferenceSearch as q, entityReferenceWords as r, entityRefsOf as s, entityRefsToWrite as t, isReverseField as u, sourceArchivedOf as v };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BQi92d4-.js';
|
|
2
|
+
import { c as RecordsDataSource } from './ports-BWtxAnXh.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* REL-6. Whether Visibility flows along this relation and the MAXIMUM access
|
|
6
|
+
* level it carries. Default off on `referenced`, on for `owned`.
|
|
7
|
+
*/
|
|
8
|
+
interface RelationCarries {
|
|
9
|
+
carries: boolean;
|
|
10
|
+
/** The ceiling — a relation never carries more access than this. */
|
|
11
|
+
max_access: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** The seven properties, each its own question. */
|
|
14
|
+
interface RelationProperties {
|
|
15
|
+
/** REL-1. Stored once on the contained table, read from the field's side. */
|
|
16
|
+
flavor: RelationFlavor;
|
|
17
|
+
/** REL-2. Separate from flavour. */
|
|
18
|
+
on_delete: OnDelete;
|
|
19
|
+
/** REL-3. A snapshot is a frozen copy in the relation's payload — never a pointer into History. */
|
|
20
|
+
binding: RelationBinding;
|
|
21
|
+
/** REL-4. */
|
|
22
|
+
ordered: boolean;
|
|
23
|
+
/** REL-5. */
|
|
24
|
+
loops: "allowed" | "refused";
|
|
25
|
+
/** REL-6. */
|
|
26
|
+
carries: RelationCarries;
|
|
27
|
+
/** REL-7. */
|
|
28
|
+
cardinality: RelationCardinality;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* REL-8 / REL-N-1. A target is a REFERENCE, written that way from the first
|
|
32
|
+
* line of code, because it may name a row outside our database. One Table,
|
|
33
|
+
* several, or any — polymorphic without restriction. External targets are
|
|
34
|
+
* read-only in v1.
|
|
35
|
+
*/
|
|
36
|
+
type RelationTarget = {
|
|
37
|
+
kind: "ours";
|
|
38
|
+
entity_token: string;
|
|
39
|
+
row_id: Uuid;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "external";
|
|
42
|
+
connection_token: string;
|
|
43
|
+
external_table: string;
|
|
44
|
+
external_key: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "any";
|
|
47
|
+
};
|
|
48
|
+
/** One edge, as the store holds it in `platform.associations`. */
|
|
49
|
+
interface Relation {
|
|
50
|
+
id: Uuid;
|
|
51
|
+
organization_id: Uuid;
|
|
52
|
+
/** REL-10. The field key, which is what `role` holds. */
|
|
53
|
+
role: string;
|
|
54
|
+
source: RelationTarget;
|
|
55
|
+
target: RelationTarget;
|
|
56
|
+
properties: RelationProperties;
|
|
57
|
+
/** REL-4. Meaningful only when `ordered`. */
|
|
58
|
+
position: number | null;
|
|
59
|
+
/** REL-3. The frozen copy, when `binding` is `snapshot`. */
|
|
60
|
+
payload: Record<string, unknown> | null;
|
|
61
|
+
/** REL-14. Hydrated from the target's title field AT READ — never stored. */
|
|
62
|
+
label: string | null;
|
|
63
|
+
created_at: Timestamp;
|
|
64
|
+
updated_at: Timestamp;
|
|
65
|
+
/** REL-13 / REL-16. Associations are versioned, so relation history exists. */
|
|
66
|
+
version: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* DOOR-6. A query coordinate: "related to THIS, along THAT role, in that
|
|
70
|
+
* direction". Any combination, and any subset of them.
|
|
71
|
+
*/
|
|
72
|
+
interface RelationCoordinate {
|
|
73
|
+
/** The record at the other end. */
|
|
74
|
+
record_id: Uuid;
|
|
75
|
+
/** The field key the edge carries as its role. Omit to mean any role. */
|
|
76
|
+
role?: string;
|
|
77
|
+
/** Which way to walk. `out` is this record's own relation fields. */
|
|
78
|
+
direction?: "out" | "in" | "either";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The arguments of the ONE relation-words resolver: the FIELD, because that is where its display
|
|
82
|
+
* spec is declared and judged (`custom._display_of_field` reads it server-side; the caller never
|
|
83
|
+
* carries it), and the ids of a page of cells.
|
|
84
|
+
*/
|
|
85
|
+
/** A linked record's icon, and its table's icon for a record that has none (`relationWordsMany`). */
|
|
86
|
+
interface RelationIcons {
|
|
87
|
+
icon: string | null;
|
|
88
|
+
tableIcon: string | null;
|
|
89
|
+
}
|
|
90
|
+
interface RelationWordsManyArgs {
|
|
91
|
+
field_id: Uuid;
|
|
92
|
+
record_ids: Uuid[];
|
|
93
|
+
}
|
|
94
|
+
/** One reference as the store keeps it. */
|
|
95
|
+
interface EntityRef {
|
|
96
|
+
/** The `platform.entity_types` token: `note`, `web_site`, `agent` … */
|
|
97
|
+
token: string;
|
|
98
|
+
id: Uuid;
|
|
99
|
+
}
|
|
100
|
+
/** One reference as a read door answers it. */
|
|
101
|
+
interface EntityRefWithWords extends EntityRef {
|
|
102
|
+
/**
|
|
103
|
+
* The thing's own title — or the store's withheld sentence when the reader
|
|
104
|
+
* may not open it; `null` when the kind names no title.
|
|
105
|
+
*/
|
|
106
|
+
label: string | null;
|
|
107
|
+
}
|
|
108
|
+
/** One kind of platform thing a record may point at (`custom.entity_reference_kinds`). */
|
|
109
|
+
interface EntityReferenceKind {
|
|
110
|
+
token: string;
|
|
111
|
+
/** What a person reads: "Note", "Site", "Agent". */
|
|
112
|
+
label: string;
|
|
113
|
+
/** The picker's grouping: the admin-assigned reference category, else the schema. */
|
|
114
|
+
category: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The references a cell holds, whichever shape it arrived in — one object, a
|
|
118
|
+
* list, or what a read door rendered (with labels). Anything that is not a
|
|
119
|
+
* reference is left out, never guessed at.
|
|
120
|
+
*/
|
|
121
|
+
declare function entityRefsOf(value: unknown): EntityRefWithWords[];
|
|
122
|
+
/**
|
|
123
|
+
* What to WRITE for an entity-reference cell: `{token, id}` only, each thing
|
|
124
|
+
* once, first mention first — the label a read door added is dropped, because
|
|
125
|
+
* the store reads it and never keeps it (REL-14). A single-valued column gets
|
|
126
|
+
* the one object (or `null`), a multi-valued one the list.
|
|
127
|
+
*/
|
|
128
|
+
declare function entityRefsToWrite(value: unknown, multi: boolean): EntityRef | EntityRef[] | null;
|
|
129
|
+
/**
|
|
130
|
+
* The kinds of platform thing a record may point at — what the field editor's
|
|
131
|
+
* kind picker lists. `custom.entity_reference_kinds()`.
|
|
132
|
+
*/
|
|
133
|
+
declare function entityReferenceKinds(source: RecordsDataSource): Promise<RecordsResult<EntityReferenceKind[]>>;
|
|
134
|
+
/**
|
|
135
|
+
* THE SEARCH DOOR (lane REFERENCE-CARRY). The platform things of these kinds whose words hold
|
|
136
|
+
* `search`, that THIS person may point a record at — each one a thing the store's own write check
|
|
137
|
+
* (`custom._entity_reference_target_ok`) would accept, so a picked reference is never refused on
|
|
138
|
+
* save. `custom.entity_reference_search`. An empty search lists the first things by name.
|
|
139
|
+
*/
|
|
140
|
+
declare function entityReferenceSearch(source: RecordsDataSource, organizationId: Uuid | null, tokens: readonly string[], search: string, limit?: number): Promise<RecordsResult<EntityRefWithWords[]>>;
|
|
141
|
+
/**
|
|
142
|
+
* THE WORDS HELPER. The words of each `{token, id}` for a picker or a chip
|
|
143
|
+
* before anything is saved — each label read by the store for THIS person and
|
|
144
|
+
* withheld when they may not open the thing. `custom.entity_reference_words`.
|
|
145
|
+
* A saved cell needs no call: every read door already answers its labels.
|
|
146
|
+
*/
|
|
147
|
+
declare function entityReferenceWords(source: RecordsDataSource, organizationId: Uuid | null, refs: readonly EntityRef[]): Promise<RecordsResult<EntityRefWithWords[]>>;
|
|
148
|
+
/** One reverse column of a Table, as `custom.reverse_columns` answers it. */
|
|
149
|
+
interface ReverseColumn {
|
|
150
|
+
/** Stable key: the linking Field's `inverse_key`, else `linked_<field id>`. Never a Field key of B. */
|
|
151
|
+
key: string;
|
|
152
|
+
/** What the column is called on B: the linking table's name (plus the column's when ambiguous). */
|
|
153
|
+
label: string;
|
|
154
|
+
/** The relation Field on the linking table. */
|
|
155
|
+
source_field_id: Uuid;
|
|
156
|
+
source_field_key: string;
|
|
157
|
+
source_field_label: string;
|
|
158
|
+
/** The linking table. */
|
|
159
|
+
source_table_id: Uuid;
|
|
160
|
+
source_table_name: string;
|
|
161
|
+
/** Always `many`: any number of records may link to one. */
|
|
162
|
+
cardinality: "many";
|
|
163
|
+
/**
|
|
164
|
+
* True for a virtual back-link (written only from the linking table's side). False for a TWO-WAY
|
|
165
|
+
* LINK (NOTION-PROPS): the reverse end is a real Field on this table — `key` is its key, `label`
|
|
166
|
+
* its label — and `relationReverseSet` writes its links from here.
|
|
167
|
+
*/
|
|
168
|
+
read_only: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* NOTION-PROPS. A two-way link's reverse Field: a relation whose `config.reverse_of` names the
|
|
172
|
+
* forward relation it mirrors. It holds no value of its own — its links are the forward Field's.
|
|
173
|
+
*/
|
|
174
|
+
declare function isReverseField(field: {
|
|
175
|
+
type?: unknown;
|
|
176
|
+
config?: unknown;
|
|
177
|
+
} | null | undefined): boolean;
|
|
178
|
+
/** One linking record, as a chip shows it. */
|
|
179
|
+
interface ReverseLink {
|
|
180
|
+
id: Uuid;
|
|
181
|
+
/** The linking record's name, read by the store for this reader. */
|
|
182
|
+
words: string;
|
|
183
|
+
}
|
|
184
|
+
/** The links of one record through one reverse column: how many the reader may see, and one page. */
|
|
185
|
+
interface ReverseLinks {
|
|
186
|
+
total: number;
|
|
187
|
+
links: ReverseLink[];
|
|
188
|
+
}
|
|
189
|
+
interface ReverseLinksManyArgs {
|
|
190
|
+
/** The Table whose records are being shown (B). */
|
|
191
|
+
table_id: Uuid;
|
|
192
|
+
/** `ReverseColumn.source_field_id`. */
|
|
193
|
+
source_field_id: Uuid;
|
|
194
|
+
/** A page of B's record ids — up to 200 a call; more are sent in groups by the client. */
|
|
195
|
+
record_ids: readonly Uuid[];
|
|
196
|
+
/** Links per record, 1–50 (the store holds it there). Default 10. */
|
|
197
|
+
limit?: number;
|
|
198
|
+
/** Skip this many links of each record — the next page of one hub record. Default 0. */
|
|
199
|
+
offset?: number;
|
|
200
|
+
}
|
|
201
|
+
/** `reverseLinksFields`: the links of a page through several reverse columns, in one call. */
|
|
202
|
+
interface ReverseLinksFieldsArgs {
|
|
203
|
+
table_id: Uuid;
|
|
204
|
+
/** Each `ReverseColumn.source_field_id` — at most 20. */
|
|
205
|
+
source_field_ids: readonly Uuid[];
|
|
206
|
+
record_ids: readonly Uuid[];
|
|
207
|
+
limit?: number;
|
|
208
|
+
offset?: number;
|
|
209
|
+
}
|
|
210
|
+
/** The store's per-call ceiling on records for `custom.reverse_links_many`. */
|
|
211
|
+
declare const REVERSE_LINKS_RECORDS_PER_CALL = 200;
|
|
212
|
+
/** The store's ceiling on links a record per call. */
|
|
213
|
+
declare const REVERSE_LINKS_PAGE_MAX = 50;
|
|
214
|
+
/** The store's typed "source archived" answer for a lookup or roll-up. */
|
|
215
|
+
interface SourceArchived {
|
|
216
|
+
__unavailable: "source_archived";
|
|
217
|
+
/** `link`: the relation it reads through is archived; `column`: the far column it reads is. */
|
|
218
|
+
reads: "link" | "column";
|
|
219
|
+
/** The archived Field. Absent when the reader may not know its Table. */
|
|
220
|
+
field_id?: Uuid;
|
|
221
|
+
/** Its label. Absent when the reader may not know its Table. */
|
|
222
|
+
label?: string;
|
|
223
|
+
table_id?: Uuid;
|
|
224
|
+
/** Its Table's name. Absent when the reader may not know that Table. */
|
|
225
|
+
table?: string;
|
|
226
|
+
}
|
|
227
|
+
/** The typed "source archived" answer, when `value` is one; null for any other value. */
|
|
228
|
+
declare function sourceArchivedOf(value: unknown): SourceArchived | null;
|
|
229
|
+
|
|
230
|
+
export { type EntityRefWithWords as E, type RelationCoordinate as R, type SourceArchived as S, type RelationWordsManyArgs as a, type RelationIcons as b, type ReverseColumn as c, type ReverseLinksManyArgs as d, type ReverseLinks as e, type ReverseLinksFieldsArgs as f, type EntityRef as g, type EntityReferenceKind as h, REVERSE_LINKS_PAGE_MAX as i, REVERSE_LINKS_RECORDS_PER_CALL as j, type Relation as k, type RelationCarries as l, type RelationProperties as m, type RelationTarget as n, type ReverseLink as o, entityReferenceKinds as p, entityReferenceSearch as q, entityReferenceWords as r, entityRefsOf as s, entityRefsToWrite as t, isReverseField as u, sourceArchivedOf as v };
|