@ai-matrx/associations 0.8.9 → 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 +67 -0
- package/README.md +5 -6
- package/dist/{CommentThread-DrZkKd3K.d.cts → CommentThread-BKDzEKvk.d.cts} +2 -2
- package/dist/{CommentThread-DrZkKd3K.d.ts → CommentThread-BKDzEKvk.d.ts} +2 -2
- package/dist/core/index.cjs +4 -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 +4 -165
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -4
- package/dist/index.d.ts +36 -4
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +2 -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 +23 -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) {
|
|
@@ -425,7 +225,9 @@ var ENTITY_TYPE_TOKENS = [
|
|
|
425
225
|
"context_item_value",
|
|
426
226
|
"conversation",
|
|
427
227
|
"conversation_value",
|
|
228
|
+
"credential_attachment",
|
|
428
229
|
"credential_item",
|
|
230
|
+
"credential_mutation_receipt",
|
|
429
231
|
"crm_address",
|
|
430
232
|
"crm_affiliation",
|
|
431
233
|
"crm_blocklist_entry",
|
|
@@ -1008,7 +810,7 @@ function useAssociations(args) {
|
|
|
1008
810
|
() => store.getEdges(type, id ?? "")
|
|
1009
811
|
);
|
|
1010
812
|
const loadedKey = useRef2(null);
|
|
1011
|
-
|
|
813
|
+
useEffect(() => {
|
|
1012
814
|
if (!autoLoad || !type || !id) return;
|
|
1013
815
|
const k = associationsKey(type, id);
|
|
1014
816
|
if (loadedKey.current === k) return;
|
|
@@ -1064,7 +866,7 @@ var useEntityRelationships = useAssociations;
|
|
|
1064
866
|
// src/react/hooks/useContainerLinks.ts
|
|
1065
867
|
import {
|
|
1066
868
|
useCallback,
|
|
1067
|
-
useEffect as
|
|
869
|
+
useEffect as useEffect2,
|
|
1068
870
|
useLayoutEffect,
|
|
1069
871
|
useRef as useRef3,
|
|
1070
872
|
useState
|
|
@@ -1135,7 +937,7 @@ function useContainerLinks(args) {
|
|
|
1135
937
|
loading: false
|
|
1136
938
|
});
|
|
1137
939
|
}, [containerId, conversationKey, store]);
|
|
1138
|
-
|
|
940
|
+
useEffect2(() => {
|
|
1139
941
|
const timeout = setTimeout(() => {
|
|
1140
942
|
void loadConversationFiles();
|
|
1141
943
|
}, 0);
|
|
@@ -1244,7 +1046,7 @@ function useContainerLinks(args) {
|
|
|
1244
1046
|
}
|
|
1245
1047
|
|
|
1246
1048
|
// src/react/hooks/useEntityTitles.ts
|
|
1247
|
-
import { useEffect as
|
|
1049
|
+
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
1248
1050
|
function useEntityTitles(refs) {
|
|
1249
1051
|
const store = useAssociationsStore();
|
|
1250
1052
|
const [resolved, setResolved] = useState2({});
|
|
@@ -1254,7 +1056,7 @@ function useEntityTitles(refs) {
|
|
|
1254
1056
|
(r) => store.registry.tryGetEntityInfo(r.token)?.titleColumn != null && store.titles.get(r.token, r.id) == null && !attempted[entityTitleCacheKey(r.token, r.id)]
|
|
1255
1057
|
);
|
|
1256
1058
|
const neededKey = needed.map((r) => entityTitleCacheKey(r.token, r.id)).sort().join("|");
|
|
1257
|
-
|
|
1059
|
+
useEffect3(() => {
|
|
1258
1060
|
if (!neededKey) return;
|
|
1259
1061
|
let cancelled = false;
|
|
1260
1062
|
setLoading(true);
|
|
@@ -1318,7 +1120,7 @@ function useEntityTitles(refs) {
|
|
|
1318
1120
|
}
|
|
1319
1121
|
|
|
1320
1122
|
// src/react/hooks/useCategories.ts
|
|
1321
|
-
import { useEffect as
|
|
1123
|
+
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1322
1124
|
var noopSubscribe2 = () => () => {
|
|
1323
1125
|
};
|
|
1324
1126
|
function useCategories(args) {
|
|
@@ -1330,7 +1132,7 @@ function useCategories(args) {
|
|
|
1330
1132
|
() => store.getCategories(dimension ?? "")
|
|
1331
1133
|
);
|
|
1332
1134
|
const loadedKey = useRef4(null);
|
|
1333
|
-
|
|
1135
|
+
useEffect4(() => {
|
|
1334
1136
|
if (!autoLoad || !dimension) return;
|
|
1335
1137
|
if (loadedKey.current === dimension) return;
|
|
1336
1138
|
loadedKey.current = dimension;
|
|
@@ -1381,7 +1183,7 @@ function useCategories(args) {
|
|
|
1381
1183
|
}
|
|
1382
1184
|
|
|
1383
1185
|
// src/react/hooks/useUniversalEntitySearch.ts
|
|
1384
|
-
import { useEffect as
|
|
1186
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState3 } from "react";
|
|
1385
1187
|
var DEBOUNCE_MS = 250;
|
|
1386
1188
|
var RECENTS_LIMIT = 12;
|
|
1387
1189
|
function useUniversalEntitySearch(args) {
|
|
@@ -1399,7 +1201,7 @@ function useUniversalEntitySearch(args) {
|
|
|
1399
1201
|
const [isRecents, setIsRecents] = useState3(true);
|
|
1400
1202
|
const runRef = useRef5(0);
|
|
1401
1203
|
const tokensKey = (tokens ?? []).join(",");
|
|
1402
|
-
|
|
1204
|
+
useEffect5(() => {
|
|
1403
1205
|
if (!enabled) return;
|
|
1404
1206
|
const run = ++runRef.current;
|
|
1405
1207
|
const trimmed = query.trim();
|
|
@@ -1464,7 +1266,7 @@ async function loadRecents(store, tokens) {
|
|
|
1464
1266
|
}
|
|
1465
1267
|
|
|
1466
1268
|
// src/react/hooks/useAssociationCandidates.ts
|
|
1467
|
-
import { useEffect as
|
|
1269
|
+
import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
1468
1270
|
function useAssociationCandidates(args) {
|
|
1469
1271
|
const { token, enabled = true, search, limit } = args;
|
|
1470
1272
|
const store = useAssociationsStore();
|
|
@@ -1473,7 +1275,7 @@ function useAssociationCandidates(args) {
|
|
|
1473
1275
|
const [loading, setLoading] = useState4(false);
|
|
1474
1276
|
const [error, setError] = useState4(null);
|
|
1475
1277
|
const [tick, setTick] = useState4(0);
|
|
1476
|
-
|
|
1278
|
+
useEffect6(() => {
|
|
1477
1279
|
if (!enabled) return void 0;
|
|
1478
1280
|
let cancelled = false;
|
|
1479
1281
|
void (async () => {
|
|
@@ -1514,7 +1316,7 @@ function currentUserIdOrNull(store) {
|
|
|
1514
1316
|
}
|
|
1515
1317
|
|
|
1516
1318
|
// src/react/hooks/useComments.ts
|
|
1517
|
-
import { useEffect as
|
|
1319
|
+
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
1518
1320
|
var noopSubscribe3 = () => () => {
|
|
1519
1321
|
};
|
|
1520
1322
|
function useComments(args) {
|
|
@@ -1527,7 +1329,7 @@ function useComments(args) {
|
|
|
1527
1329
|
() => store.getComments(token, id ?? "")
|
|
1528
1330
|
);
|
|
1529
1331
|
const loadedKey = useRef6(null);
|
|
1530
|
-
|
|
1332
|
+
useEffect7(() => {
|
|
1531
1333
|
if (!autoLoad || !key || !id) return;
|
|
1532
1334
|
if (loadedKey.current === key) return;
|
|
1533
1335
|
loadedKey.current = key;
|
|
@@ -1673,7 +1475,7 @@ import { useId } from "react";
|
|
|
1673
1475
|
// src/react/components/DefaultWindowShell.tsx
|
|
1674
1476
|
import {
|
|
1675
1477
|
useCallback as useCallback2,
|
|
1676
|
-
useEffect as
|
|
1478
|
+
useEffect as useEffect8,
|
|
1677
1479
|
useLayoutEffect as useLayoutEffect2,
|
|
1678
1480
|
useRef as useRef7,
|
|
1679
1481
|
useState as useState6
|
|
@@ -1878,7 +1680,7 @@ function DefaultWindowShell({
|
|
|
1878
1680
|
setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);
|
|
1879
1681
|
setRect(centred());
|
|
1880
1682
|
}, []);
|
|
1881
|
-
|
|
1683
|
+
useEffect8(() => {
|
|
1882
1684
|
if (!mounted) return;
|
|
1883
1685
|
const onResize = () => {
|
|
1884
1686
|
setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);
|
|
@@ -1887,14 +1689,14 @@ function DefaultWindowShell({
|
|
|
1887
1689
|
window.addEventListener("resize", onResize);
|
|
1888
1690
|
return () => window.removeEventListener("resize", onResize);
|
|
1889
1691
|
}, [mounted]);
|
|
1890
|
-
|
|
1692
|
+
useEffect8(() => {
|
|
1891
1693
|
const onKeyDown = (event) => {
|
|
1892
1694
|
if (event.key === "Escape") onClose();
|
|
1893
1695
|
};
|
|
1894
1696
|
window.addEventListener("keydown", onKeyDown);
|
|
1895
1697
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1896
1698
|
}, [onClose]);
|
|
1897
|
-
|
|
1699
|
+
useEffect8(() => {
|
|
1898
1700
|
panelRef.current?.focus({ preventScroll: true });
|
|
1899
1701
|
}, [mounted]);
|
|
1900
1702
|
const beginGesture = useCallback2(
|
|
@@ -2687,7 +2489,7 @@ function UniversalAssociationPicker(props) {
|
|
|
2687
2489
|
}
|
|
2688
2490
|
|
|
2689
2491
|
// src/react/components/AttachedItemsSheet.tsx
|
|
2690
|
-
import { useEffect as
|
|
2492
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2691
2493
|
import { cn as cn5 } from "@ai-matrx/design-system";
|
|
2692
2494
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2693
2495
|
function metadataIsPinned(metadata) {
|
|
@@ -2751,7 +2553,7 @@ function AttachedItemsBody({
|
|
|
2751
2553
|
const [titleError, setTitleError] = useState9(null);
|
|
2752
2554
|
const [busyId, setBusyId] = useState9(null);
|
|
2753
2555
|
const idKey = links.map((l) => l.resourceId).sort().join(",");
|
|
2754
|
-
|
|
2556
|
+
useEffect9(() => {
|
|
2755
2557
|
if (!enabled) return;
|
|
2756
2558
|
const ids = idKey ? idKey.split(",") : [];
|
|
2757
2559
|
if (ids.length === 0) {
|