@ai-matrx/associations 0.8.11 → 0.9.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 +49 -0
- package/README.md +5 -6
- package/dist/{CommentThread--C4Vgv0S.d.cts → CommentThread-BKDzEKvk.d.cts} +1 -1
- package/dist/{CommentThread--C4Vgv0S.d.ts → CommentThread-BKDzEKvk.d.ts} +1 -1
- package/dist/core/index.cjs +0 -165
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -37
- package/dist/core/index.d.ts +1 -37
- package/dist/core/index.js +0 -165
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +0 -195
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -12
- package/dist/react/index.d.ts +3 -12
- package/dist/react/index.js +21 -221
- package/dist/react/index.js.map +1 -1
- package/dist/react/lazy/index.d.cts +1 -1
- package/dist/react/lazy/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread
|
|
4
|
-
export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryEntity, a1 as PrimaryEntityProvider, a2 as TagPickerIcon, a3 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a4 as UseAssociationEntitySelectAdapterArgs, a5 as UseAssociationsArgs, a6 as UseAssociationsReturn, a7 as UseContainerLinksArgs, a8 as UseContainerLinksReturn, a9 as attachedKey, aa as buildCommentTree, ab as useAssociationEntitySelectAdapter, ac as useAssociations, ad as useContainerLinks, ae as useContainerLinksAdapter, af as useEntityRelationships, ag as usePrimaryEntity } from '../CommentThread
|
|
3
|
+
import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-BKDzEKvk.cjs';
|
|
4
|
+
export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryEntity, a1 as PrimaryEntityProvider, a2 as TagPickerIcon, a3 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a4 as UseAssociationEntitySelectAdapterArgs, a5 as UseAssociationsArgs, a6 as UseAssociationsReturn, a7 as UseContainerLinksArgs, a8 as UseContainerLinksReturn, a9 as attachedKey, aa as buildCommentTree, ab as useAssociationEntitySelectAdapter, ac as useAssociations, ad as useContainerLinks, ae as useContainerLinksAdapter, af as useEntityRelationships, ag as usePrimaryEntity } from '../CommentThread-BKDzEKvk.cjs';
|
|
5
5
|
|
|
6
6
|
interface AssociationsUiPorts {
|
|
7
7
|
notifier?: AssociationsNotifier;
|
|
@@ -14,18 +14,9 @@ interface AssociationsUiPorts {
|
|
|
14
14
|
interface AssociationsProviderProps extends AssociationsUiPorts {
|
|
15
15
|
/** The /core store the host constructed with `createAssociationsStore`. */
|
|
16
16
|
store: AssociationsStore;
|
|
17
|
-
/**
|
|
18
|
-
* Run the demanded-schema probe once after mount (0.6.0, C22: this was
|
|
19
|
-
* ~30 lines of boot diagnostic every host hand-wrote). Default: ON in a
|
|
20
|
-
* development build, OFF everywhere else — it is a boot check, never a
|
|
21
|
-
* hot path, and it is side-effect free by construction (see
|
|
22
|
-
* `assertDemandedSchema`). Pass `false` to silence it, `true` to force it
|
|
23
|
-
* (a CI smoke run).
|
|
24
|
-
*/
|
|
25
|
-
probeSchema?: boolean;
|
|
26
17
|
children: ReactNode;
|
|
27
18
|
}
|
|
28
|
-
declare function AssociationsProvider({ store,
|
|
19
|
+
declare function AssociationsProvider({ store, notifier, windowShell, capture, pickerOverrides, entityDoors, authorDisplay, children, }: AssociationsProviderProps): react.JSX.Element;
|
|
29
20
|
/** The /core store bound by the nearest provider. Throws when unmounted. */
|
|
30
21
|
declare function useAssociationsStore(): AssociationsStore;
|
|
31
22
|
/** The UI ports the host bound (each optional, each degradable). */
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread
|
|
4
|
-
export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryEntity, a1 as PrimaryEntityProvider, a2 as TagPickerIcon, a3 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a4 as UseAssociationEntitySelectAdapterArgs, a5 as UseAssociationsArgs, a6 as UseAssociationsReturn, a7 as UseContainerLinksArgs, a8 as UseContainerLinksReturn, a9 as attachedKey, aa as buildCommentTree, ab as useAssociationEntitySelectAdapter, ac as useAssociations, ad as useContainerLinks, ae as useContainerLinksAdapter, af as useEntityRelationships, ag as usePrimaryEntity } from '../CommentThread
|
|
3
|
+
import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-BKDzEKvk.js';
|
|
4
|
+
export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryEntity, a1 as PrimaryEntityProvider, a2 as TagPickerIcon, a3 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a4 as UseAssociationEntitySelectAdapterArgs, a5 as UseAssociationsArgs, a6 as UseAssociationsReturn, a7 as UseContainerLinksArgs, a8 as UseContainerLinksReturn, a9 as attachedKey, aa as buildCommentTree, ab as useAssociationEntitySelectAdapter, ac as useAssociations, ad as useContainerLinks, ae as useContainerLinksAdapter, af as useEntityRelationships, ag as usePrimaryEntity } from '../CommentThread-BKDzEKvk.js';
|
|
5
5
|
|
|
6
6
|
interface AssociationsUiPorts {
|
|
7
7
|
notifier?: AssociationsNotifier;
|
|
@@ -14,18 +14,9 @@ interface AssociationsUiPorts {
|
|
|
14
14
|
interface AssociationsProviderProps extends AssociationsUiPorts {
|
|
15
15
|
/** The /core store the host constructed with `createAssociationsStore`. */
|
|
16
16
|
store: AssociationsStore;
|
|
17
|
-
/**
|
|
18
|
-
* Run the demanded-schema probe once after mount (0.6.0, C22: this was
|
|
19
|
-
* ~30 lines of boot diagnostic every host hand-wrote). Default: ON in a
|
|
20
|
-
* development build, OFF everywhere else — it is a boot check, never a
|
|
21
|
-
* hot path, and it is side-effect free by construction (see
|
|
22
|
-
* `assertDemandedSchema`). Pass `false` to silence it, `true` to force it
|
|
23
|
-
* (a CI smoke run).
|
|
24
|
-
*/
|
|
25
|
-
probeSchema?: boolean;
|
|
26
17
|
children: ReactNode;
|
|
27
18
|
}
|
|
28
|
-
declare function AssociationsProvider({ store,
|
|
19
|
+
declare function AssociationsProvider({ store, notifier, windowShell, capture, pickerOverrides, entityDoors, authorDisplay, children, }: AssociationsProviderProps): react.JSX.Element;
|
|
29
20
|
/** The /core store bound by the nearest provider. Throws when unmounted. */
|
|
30
21
|
declare function useAssociationsStore(): AssociationsStore;
|
|
31
22
|
/** The UI ports the host bound (each optional, each degradable). */
|
package/dist/react/index.js
CHANGED
|
@@ -1,191 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/react/context.tsx
|
|
4
|
-
import {
|
|
5
|
-
createContext,
|
|
6
|
-
useContext,
|
|
7
|
-
useEffect,
|
|
8
|
-
useRef
|
|
9
|
-
} from "react";
|
|
10
|
-
|
|
11
|
-
// src/demanded-rpcs.generated.ts
|
|
12
|
-
var DEMANDED_RPC_NAMES = [
|
|
13
|
-
"assoc_add",
|
|
14
|
-
"assoc_remove",
|
|
15
|
-
"assoc_set_targets",
|
|
16
|
-
"assoc_remove_for_entity",
|
|
17
|
-
"assoc_for_entity",
|
|
18
|
-
"assoc_for_targets",
|
|
19
|
-
"assoc_for_sources",
|
|
20
|
-
"assoc_members_visible",
|
|
21
|
-
"conversation_file_add",
|
|
22
|
-
"conversation_file_remove",
|
|
23
|
-
"conversation_files",
|
|
24
|
-
"agent_resource_add",
|
|
25
|
-
"agent_resource_remove",
|
|
26
|
-
"cat_list",
|
|
27
|
-
"cat_create",
|
|
28
|
-
"cat_update",
|
|
29
|
-
"cat_reparent",
|
|
30
|
-
"cat_delete",
|
|
31
|
-
"ues_set",
|
|
32
|
-
"ues_list",
|
|
33
|
-
"ues_get_bulk",
|
|
34
|
-
"ues_touch",
|
|
35
|
-
"reference_search_candidates",
|
|
36
|
-
"cmt_list",
|
|
37
|
-
"cmt_add",
|
|
38
|
-
"cmt_edit",
|
|
39
|
-
"cmt_delete"
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
// src/core/assertDemandedSchema.ts
|
|
43
|
-
var BAD_UUID = "__not_a_uuid__";
|
|
44
|
-
var SELF_TEST_MISSING_RPC = "assoc_probe_self_test_missing_fn";
|
|
45
|
-
var PROBE_ARGS = {
|
|
46
|
-
// edges — writes
|
|
47
|
-
assoc_add: {
|
|
48
|
-
p_source_type: "note",
|
|
49
|
-
p_source_id: BAD_UUID,
|
|
50
|
-
p_target_type: "task",
|
|
51
|
-
p_target_id: BAD_UUID
|
|
52
|
-
},
|
|
53
|
-
assoc_remove: {
|
|
54
|
-
p_source_type: "note",
|
|
55
|
-
p_source_id: BAD_UUID,
|
|
56
|
-
p_target_type: "task",
|
|
57
|
-
p_target_id: BAD_UUID
|
|
58
|
-
},
|
|
59
|
-
assoc_set_targets: {
|
|
60
|
-
p_source_type: "note",
|
|
61
|
-
p_source_id: BAD_UUID,
|
|
62
|
-
p_target_type: "task",
|
|
63
|
-
p_target_ids: [BAD_UUID]
|
|
64
|
-
},
|
|
65
|
-
assoc_remove_for_entity: { p_type: "note", p_id: BAD_UUID },
|
|
66
|
-
// edges — reads
|
|
67
|
-
assoc_for_entity: { p_type: "note", p_id: BAD_UUID },
|
|
68
|
-
assoc_for_targets: { p_target_type: "task", p_target_ids: [BAD_UUID] },
|
|
69
|
-
assoc_for_sources: { p_source_type: "note", p_source_ids: [BAD_UUID] },
|
|
70
|
-
assoc_members_visible: { p_target_type: "task", p_target_ids: [BAD_UUID] },
|
|
71
|
-
// conversation files
|
|
72
|
-
conversation_file_add: {
|
|
73
|
-
p_conversation_id: BAD_UUID,
|
|
74
|
-
p_file_id: BAD_UUID
|
|
75
|
-
},
|
|
76
|
-
conversation_file_remove: {
|
|
77
|
-
p_conversation_id: BAD_UUID,
|
|
78
|
-
p_file_id: BAD_UUID
|
|
79
|
-
},
|
|
80
|
-
conversation_files: { p_conversation_id: BAD_UUID },
|
|
81
|
-
// agent resources
|
|
82
|
-
agent_resource_add: {
|
|
83
|
-
p_agent_id: BAD_UUID,
|
|
84
|
-
p_source_type: "note",
|
|
85
|
-
p_source_id: BAD_UUID
|
|
86
|
-
},
|
|
87
|
-
agent_resource_remove: {
|
|
88
|
-
p_agent_id: BAD_UUID,
|
|
89
|
-
p_source_type: "note",
|
|
90
|
-
p_source_id: BAD_UUID
|
|
91
|
-
},
|
|
92
|
-
// categories
|
|
93
|
-
cat_list: {},
|
|
94
|
-
cat_create: { p_dimension: "", p_name: "", p_org_id: BAD_UUID },
|
|
95
|
-
cat_update: { p_category_id: BAD_UUID, p_name: "__probe__" },
|
|
96
|
-
cat_reparent: { p_category_id: BAD_UUID },
|
|
97
|
-
cat_delete: { p_category_id: BAD_UUID },
|
|
98
|
-
// favorites / recents
|
|
99
|
-
ues_set: { p_entity_type: "__probe__", p_entity_id: BAD_UUID },
|
|
100
|
-
ues_list: {},
|
|
101
|
-
ues_get_bulk: { p_entity_type: "__probe__", p_entity_ids: [BAD_UUID] },
|
|
102
|
-
ues_touch: { p_entity_type: "__probe__", p_entity_id: BAD_UUID },
|
|
103
|
-
// candidates
|
|
104
|
-
reference_search_candidates: { p_token: "__probe__", p_limit: 1 },
|
|
105
|
-
// comments (W6) — every fn takes a uuid arg, so the unparseable sentinel
|
|
106
|
-
// guarantees 22P02 before any SECURITY DEFINER body runs (no write occurs).
|
|
107
|
-
cmt_list: { p_entity_type: "__probe__", p_entity_id: BAD_UUID },
|
|
108
|
-
cmt_add: {
|
|
109
|
-
p_entity_type: "__probe__",
|
|
110
|
-
p_entity_id: BAD_UUID,
|
|
111
|
-
p_body: "__probe__"
|
|
112
|
-
},
|
|
113
|
-
cmt_edit: { p_id: BAD_UUID, p_body: "__probe__" },
|
|
114
|
-
cmt_delete: { p_id: BAD_UUID }
|
|
115
|
-
};
|
|
116
|
-
function isMissingFunctionError(error) {
|
|
117
|
-
if (!error || typeof error !== "object") return false;
|
|
118
|
-
return error.code === "PGRST202";
|
|
119
|
-
}
|
|
120
|
-
async function assertDemandedSchema(dataSource, options = {}) {
|
|
121
|
-
const { selfTest = false, concurrency = 6, throwOnViolation = true } = options;
|
|
122
|
-
const names = [...DEMANDED_RPC_NAMES];
|
|
123
|
-
if (selfTest) names.push(SELF_TEST_MISSING_RPC);
|
|
124
|
-
const missing = [];
|
|
125
|
-
const unreachable = [];
|
|
126
|
-
const answered = [];
|
|
127
|
-
let cursor = 0;
|
|
128
|
-
async function worker() {
|
|
129
|
-
while (cursor < names.length) {
|
|
130
|
-
const fn = names[cursor];
|
|
131
|
-
cursor += 1;
|
|
132
|
-
if (!fn) continue;
|
|
133
|
-
const args = fn === SELF_TEST_MISSING_RPC ? {} : PROBE_ARGS[fn];
|
|
134
|
-
try {
|
|
135
|
-
const { error } = await dataSource.rpc(fn, args);
|
|
136
|
-
if (error == null) answered.push(fn);
|
|
137
|
-
else if (isMissingFunctionError(error)) missing.push(fn);
|
|
138
|
-
else answered.push(fn);
|
|
139
|
-
} catch (e) {
|
|
140
|
-
unreachable.push({ fn, error: e });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
await Promise.all(
|
|
145
|
-
Array.from({ length: Math.min(concurrency, names.length) }, worker)
|
|
146
|
-
);
|
|
147
|
-
if (selfTest) {
|
|
148
|
-
const selfTestMissing = missing.includes(SELF_TEST_MISSING_RPC);
|
|
149
|
-
const idx = missing.indexOf(SELF_TEST_MISSING_RPC);
|
|
150
|
-
if (idx >= 0) missing.splice(idx, 1);
|
|
151
|
-
const answeredIdx = answered.indexOf(SELF_TEST_MISSING_RPC);
|
|
152
|
-
if (answeredIdx >= 0) answered.splice(answeredIdx, 1);
|
|
153
|
-
if (!selfTestMissing) {
|
|
154
|
-
throw new Error(
|
|
155
|
-
`assertDemandedSchema self-test FAILED: the fabricated function "${SELF_TEST_MISSING_RPC}" did not come back as missing (PGRST202). This probe cannot currently fail, so its green result proves nothing \u2014 the dataSource is swallowing or faking errors.`
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (unreachable.length > 0) {
|
|
160
|
-
throw new Error(
|
|
161
|
-
`assertDemandedSchema could not complete: ${unreachable.length} probe call(s) failed to reach the database (${unreachable.map((u) => u.fn).join(", ")}). This is NOT a schema verdict \u2014 fix connectivity and re-run.`
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
const ok = missing.length === 0;
|
|
165
|
-
const report = { ok, missing, unreachable, answered };
|
|
166
|
-
if (!ok && throwOnViolation) {
|
|
167
|
-
throw new Error(
|
|
168
|
-
`DEMANDED SCHEMA VIOLATION: the database this dataSource points at cannot answer ${missing.length} demanded @ai-matrx/associations function(s): ${missing.join(", ")}. This package demands the AI Matrx platform schema (README \xA7 The demanded schema); a database without it is not this package's database.`
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
return report;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// src/react/context.tsx
|
|
4
|
+
import { createContext, useContext, useRef } from "react";
|
|
175
5
|
import { jsx } from "react/jsx-runtime";
|
|
176
6
|
var AssociationsReactContext = createContext(
|
|
177
7
|
null
|
|
178
8
|
);
|
|
179
|
-
function isDevelopmentBuild() {
|
|
180
|
-
try {
|
|
181
|
-
return typeof process !== "undefined" && true;
|
|
182
|
-
} catch {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
9
|
function AssociationsProvider({
|
|
187
10
|
store,
|
|
188
|
-
probeSchema,
|
|
189
11
|
notifier,
|
|
190
12
|
windowShell,
|
|
191
13
|
capture,
|
|
@@ -195,28 +17,6 @@ function AssociationsProvider({
|
|
|
195
17
|
children
|
|
196
18
|
}) {
|
|
197
19
|
const notifierWarned = useRef(false);
|
|
198
|
-
const shouldProbe = probeSchema ?? isDevelopmentBuild();
|
|
199
|
-
useEffect(() => {
|
|
200
|
-
if (!shouldProbe) return;
|
|
201
|
-
let stale = false;
|
|
202
|
-
void (async () => {
|
|
203
|
-
try {
|
|
204
|
-
await assertDemandedSchema(store.dataSource);
|
|
205
|
-
} catch (error) {
|
|
206
|
-
if (stale) return;
|
|
207
|
-
store.errorSink({
|
|
208
|
-
code: "demanded_schema_violation",
|
|
209
|
-
message: error instanceof Error ? error.message : "assertDemandedSchema failed",
|
|
210
|
-
context: {
|
|
211
|
-
remedy: "Run the platform.associations schema (README \xA7 The demanded schema) on the database this dataSource points at."
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
})();
|
|
216
|
-
return () => {
|
|
217
|
-
stale = true;
|
|
218
|
-
};
|
|
219
|
-
}, [shouldProbe, store]);
|
|
220
20
|
return /* @__PURE__ */ jsx(
|
|
221
21
|
AssociationsReactContext.Provider,
|
|
222
22
|
{
|
|
@@ -278,7 +78,7 @@ function useNotifier() {
|
|
|
278
78
|
}
|
|
279
79
|
|
|
280
80
|
// src/react/hooks/useAssociations.ts
|
|
281
|
-
import { useEffect
|
|
81
|
+
import { useEffect, useRef as useRef2, useSyncExternalStore } from "react";
|
|
282
82
|
|
|
283
83
|
// src/results.ts
|
|
284
84
|
function isAssociationsRpcErr(r) {
|
|
@@ -1010,7 +810,7 @@ function useAssociations(args) {
|
|
|
1010
810
|
() => store.getEdges(type, id ?? "")
|
|
1011
811
|
);
|
|
1012
812
|
const loadedKey = useRef2(null);
|
|
1013
|
-
|
|
813
|
+
useEffect(() => {
|
|
1014
814
|
if (!autoLoad || !type || !id) return;
|
|
1015
815
|
const k = associationsKey(type, id);
|
|
1016
816
|
if (loadedKey.current === k) return;
|
|
@@ -1066,7 +866,7 @@ var useEntityRelationships = useAssociations;
|
|
|
1066
866
|
// src/react/hooks/useContainerLinks.ts
|
|
1067
867
|
import {
|
|
1068
868
|
useCallback,
|
|
1069
|
-
useEffect as
|
|
869
|
+
useEffect as useEffect2,
|
|
1070
870
|
useLayoutEffect,
|
|
1071
871
|
useRef as useRef3,
|
|
1072
872
|
useState
|
|
@@ -1137,7 +937,7 @@ function useContainerLinks(args) {
|
|
|
1137
937
|
loading: false
|
|
1138
938
|
});
|
|
1139
939
|
}, [containerId, conversationKey, store]);
|
|
1140
|
-
|
|
940
|
+
useEffect2(() => {
|
|
1141
941
|
const timeout = setTimeout(() => {
|
|
1142
942
|
void loadConversationFiles();
|
|
1143
943
|
}, 0);
|
|
@@ -1246,7 +1046,7 @@ function useContainerLinks(args) {
|
|
|
1246
1046
|
}
|
|
1247
1047
|
|
|
1248
1048
|
// src/react/hooks/useEntityTitles.ts
|
|
1249
|
-
import { useEffect as
|
|
1049
|
+
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
1250
1050
|
function useEntityTitles(refs) {
|
|
1251
1051
|
const store = useAssociationsStore();
|
|
1252
1052
|
const [resolved, setResolved] = useState2({});
|
|
@@ -1256,7 +1056,7 @@ function useEntityTitles(refs) {
|
|
|
1256
1056
|
(r) => store.registry.tryGetEntityInfo(r.token)?.titleColumn != null && store.titles.get(r.token, r.id) == null && !attempted[entityTitleCacheKey(r.token, r.id)]
|
|
1257
1057
|
);
|
|
1258
1058
|
const neededKey = needed.map((r) => entityTitleCacheKey(r.token, r.id)).sort().join("|");
|
|
1259
|
-
|
|
1059
|
+
useEffect3(() => {
|
|
1260
1060
|
if (!neededKey) return;
|
|
1261
1061
|
let cancelled = false;
|
|
1262
1062
|
setLoading(true);
|
|
@@ -1320,7 +1120,7 @@ function useEntityTitles(refs) {
|
|
|
1320
1120
|
}
|
|
1321
1121
|
|
|
1322
1122
|
// src/react/hooks/useCategories.ts
|
|
1323
|
-
import { useEffect as
|
|
1123
|
+
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1324
1124
|
var noopSubscribe2 = () => () => {
|
|
1325
1125
|
};
|
|
1326
1126
|
function useCategories(args) {
|
|
@@ -1332,7 +1132,7 @@ function useCategories(args) {
|
|
|
1332
1132
|
() => store.getCategories(dimension ?? "")
|
|
1333
1133
|
);
|
|
1334
1134
|
const loadedKey = useRef4(null);
|
|
1335
|
-
|
|
1135
|
+
useEffect4(() => {
|
|
1336
1136
|
if (!autoLoad || !dimension) return;
|
|
1337
1137
|
if (loadedKey.current === dimension) return;
|
|
1338
1138
|
loadedKey.current = dimension;
|
|
@@ -1383,7 +1183,7 @@ function useCategories(args) {
|
|
|
1383
1183
|
}
|
|
1384
1184
|
|
|
1385
1185
|
// src/react/hooks/useUniversalEntitySearch.ts
|
|
1386
|
-
import { useEffect as
|
|
1186
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState3 } from "react";
|
|
1387
1187
|
var DEBOUNCE_MS = 250;
|
|
1388
1188
|
var RECENTS_LIMIT = 12;
|
|
1389
1189
|
function useUniversalEntitySearch(args) {
|
|
@@ -1401,7 +1201,7 @@ function useUniversalEntitySearch(args) {
|
|
|
1401
1201
|
const [isRecents, setIsRecents] = useState3(true);
|
|
1402
1202
|
const runRef = useRef5(0);
|
|
1403
1203
|
const tokensKey = (tokens ?? []).join(",");
|
|
1404
|
-
|
|
1204
|
+
useEffect5(() => {
|
|
1405
1205
|
if (!enabled) return;
|
|
1406
1206
|
const run = ++runRef.current;
|
|
1407
1207
|
const trimmed = query.trim();
|
|
@@ -1466,7 +1266,7 @@ async function loadRecents(store, tokens) {
|
|
|
1466
1266
|
}
|
|
1467
1267
|
|
|
1468
1268
|
// src/react/hooks/useAssociationCandidates.ts
|
|
1469
|
-
import { useEffect as
|
|
1269
|
+
import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
1470
1270
|
function useAssociationCandidates(args) {
|
|
1471
1271
|
const { token, enabled = true, search, limit } = args;
|
|
1472
1272
|
const store = useAssociationsStore();
|
|
@@ -1475,7 +1275,7 @@ function useAssociationCandidates(args) {
|
|
|
1475
1275
|
const [loading, setLoading] = useState4(false);
|
|
1476
1276
|
const [error, setError] = useState4(null);
|
|
1477
1277
|
const [tick, setTick] = useState4(0);
|
|
1478
|
-
|
|
1278
|
+
useEffect6(() => {
|
|
1479
1279
|
if (!enabled) return void 0;
|
|
1480
1280
|
let cancelled = false;
|
|
1481
1281
|
void (async () => {
|
|
@@ -1516,7 +1316,7 @@ function currentUserIdOrNull(store) {
|
|
|
1516
1316
|
}
|
|
1517
1317
|
|
|
1518
1318
|
// src/react/hooks/useComments.ts
|
|
1519
|
-
import { useEffect as
|
|
1319
|
+
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1520
1320
|
var noopSubscribe3 = () => () => {
|
|
1521
1321
|
};
|
|
1522
1322
|
function useComments(args) {
|
|
@@ -1529,7 +1329,7 @@ function useComments(args) {
|
|
|
1529
1329
|
() => store.getComments(token, id ?? "")
|
|
1530
1330
|
);
|
|
1531
1331
|
const loadedKey = useRef6(null);
|
|
1532
|
-
|
|
1332
|
+
useEffect7(() => {
|
|
1533
1333
|
if (!autoLoad || !key || !id) return;
|
|
1534
1334
|
if (loadedKey.current === key) return;
|
|
1535
1335
|
loadedKey.current = key;
|
|
@@ -1675,7 +1475,7 @@ import { useId } from "react";
|
|
|
1675
1475
|
// src/react/components/DefaultWindowShell.tsx
|
|
1676
1476
|
import {
|
|
1677
1477
|
useCallback as useCallback2,
|
|
1678
|
-
useEffect as
|
|
1478
|
+
useEffect as useEffect8,
|
|
1679
1479
|
useLayoutEffect as useLayoutEffect2,
|
|
1680
1480
|
useRef as useRef7,
|
|
1681
1481
|
useState as useState6
|
|
@@ -1880,7 +1680,7 @@ function DefaultWindowShell({
|
|
|
1880
1680
|
setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);
|
|
1881
1681
|
setRect(centred());
|
|
1882
1682
|
}, []);
|
|
1883
|
-
|
|
1683
|
+
useEffect8(() => {
|
|
1884
1684
|
if (!mounted) return;
|
|
1885
1685
|
const onResize = () => {
|
|
1886
1686
|
setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);
|
|
@@ -1889,14 +1689,14 @@ function DefaultWindowShell({
|
|
|
1889
1689
|
window.addEventListener("resize", onResize);
|
|
1890
1690
|
return () => window.removeEventListener("resize", onResize);
|
|
1891
1691
|
}, [mounted]);
|
|
1892
|
-
|
|
1692
|
+
useEffect8(() => {
|
|
1893
1693
|
const onKeyDown = (event) => {
|
|
1894
1694
|
if (event.key === "Escape") onClose();
|
|
1895
1695
|
};
|
|
1896
1696
|
window.addEventListener("keydown", onKeyDown);
|
|
1897
1697
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1898
1698
|
}, [onClose]);
|
|
1899
|
-
|
|
1699
|
+
useEffect8(() => {
|
|
1900
1700
|
panelRef.current?.focus({ preventScroll: true });
|
|
1901
1701
|
}, [mounted]);
|
|
1902
1702
|
const beginGesture = useCallback2(
|
|
@@ -2689,7 +2489,7 @@ function UniversalAssociationPicker(props) {
|
|
|
2689
2489
|
}
|
|
2690
2490
|
|
|
2691
2491
|
// src/react/components/AttachedItemsSheet.tsx
|
|
2692
|
-
import { useEffect as
|
|
2492
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2693
2493
|
import { cn as cn5 } from "@ai-matrx/design-system";
|
|
2694
2494
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2695
2495
|
function metadataIsPinned(metadata) {
|
|
@@ -2753,7 +2553,7 @@ function AttachedItemsBody({
|
|
|
2753
2553
|
const [titleError, setTitleError] = useState9(null);
|
|
2754
2554
|
const [busyId, setBusyId] = useState9(null);
|
|
2755
2555
|
const idKey = links.map((l) => l.resourceId).sort().join(",");
|
|
2756
|
-
|
|
2556
|
+
useEffect9(() => {
|
|
2757
2557
|
if (!enabled) return;
|
|
2758
2558
|
const ids = idKey ? idKey.split(",") : [];
|
|
2759
2559
|
if (ids.length === 0) {
|