@nivaro/react 0.3.114 → 0.3.116
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/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1728 -22
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4909 -4182
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +612 -551
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/OverflowRail.js +326 -0
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/SignalCard.js +84 -77
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/list/PhonePager.js +50 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/OwnerAvatars.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/ui/popover.js +53 -29
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/keep-row-focus.js +43 -0
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/obligation-banner.js +17 -17
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/rail-menu-context.js +9 -0
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/row-surface.js +7 -0
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/table-pins.js +20 -18
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +62 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-below-md.js +29 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { NivaroError as
|
|
2
|
-
import { sharedGetLoader as
|
|
3
|
-
import { isRehearsalCommand as
|
|
4
|
-
import { noteCredentialChanged as
|
|
5
|
-
function
|
|
1
|
+
import { NivaroError as Z, errorBodyMessage as x } from "@nivaro/sdk";
|
|
2
|
+
import { sharedGetLoader as F, createGetBatcher as W, isBatchableGetPath as J } from "./batch-gets.js";
|
|
3
|
+
import { isRehearsalCommand as K, noteOwnWriteFromCommand as N, announceWriteCommand as k } from "./own-writes.js";
|
|
4
|
+
import { noteCredentialChanged as Y, isIdentityRead as Q, claimIdentityCall as V, signedOutError as X, noteSignedIn as ee, isSignedOutError as te, noteUnauthorized as ne } from "./signed-out.js";
|
|
5
|
+
function $(e) {
|
|
6
6
|
if (!e || typeof e != "object") return "";
|
|
7
7
|
const t = Object.entries(e).filter(([, n]) => n != null).map(([n, c]) => [n, String(c)]).sort(([n], [c]) => n < c ? -1 : n > c ? 1 : 0);
|
|
8
8
|
return t.length ? new URLSearchParams(t).toString() : "";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function L(e) {
|
|
11
11
|
const t = (e._method ?? "GET").toUpperCase(), n = t === "GET" || e._body === void 0 ? "" : JSON.stringify(e._body);
|
|
12
|
-
return `${t} ${e._path ?? ""} ${
|
|
12
|
+
return `${t} ${e._path ?? ""} ${$(e._params)} ${n}`;
|
|
13
13
|
}
|
|
14
14
|
function S(e) {
|
|
15
15
|
return (e._method ?? "GET").toUpperCase() === "GET";
|
|
16
16
|
}
|
|
17
17
|
const O = /^\/(widgets-internal\/[^/]+\/render|items\/[^/]+\/[^/]+\/child-summary|items\/[^/]+\/auto-id-preview|config-conformance\/record\/.+\/check|pipelines\/instance\/[^/]+\/owners\/batch|addendums\/summary|at-risk\/evaluate|record-views\/.+\/touch)$/;
|
|
18
|
-
function
|
|
18
|
+
function re(e) {
|
|
19
19
|
return S(e) ? !0 : (e._method ?? "GET").toUpperCase() !== "POST" ? !1 : O.test((e._path ?? "").split("?")[0]);
|
|
20
20
|
}
|
|
21
21
|
function T(e) {
|
|
@@ -26,18 +26,18 @@ function T(e) {
|
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
return e[
|
|
29
|
+
const z = Symbol("nivaro.coalesced");
|
|
30
|
+
function se(e) {
|
|
31
|
+
return e[z] === !0;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const D = 20, oe = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, ae = /* @__PURE__ */ new Set([
|
|
34
34
|
"aggregate",
|
|
35
35
|
"export",
|
|
36
36
|
"distinct",
|
|
37
37
|
"resolve-paths",
|
|
38
38
|
"batch-read",
|
|
39
39
|
"filter-check"
|
|
40
|
-
]),
|
|
40
|
+
]), ie = /* @__PURE__ */ new Set([
|
|
41
41
|
"fields",
|
|
42
42
|
"filter",
|
|
43
43
|
"sort",
|
|
@@ -50,22 +50,22 @@ const k = 20, se = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, oe = /
|
|
|
50
50
|
"conditions",
|
|
51
51
|
"labels"
|
|
52
52
|
]);
|
|
53
|
-
function
|
|
53
|
+
function ce(e) {
|
|
54
54
|
const t = e;
|
|
55
55
|
if ((t._method ?? "GET").toUpperCase() !== "GET") return null;
|
|
56
|
-
const n =
|
|
56
|
+
const n = oe.exec(t._path ?? "");
|
|
57
57
|
if (!n) return null;
|
|
58
58
|
const [, c, d] = n;
|
|
59
|
-
if (d !== void 0 &&
|
|
60
|
-
const
|
|
61
|
-
for (const [a, l] of Object.entries(
|
|
59
|
+
if (d !== void 0 && ae.has(d)) return null;
|
|
60
|
+
const _ = t._params ?? {}, u = {};
|
|
61
|
+
for (const [a, l] of Object.entries(_))
|
|
62
62
|
if (l !== void 0) {
|
|
63
|
-
if (!
|
|
63
|
+
if (!ie.has(a)) return null;
|
|
64
64
|
u[a] = l;
|
|
65
65
|
}
|
|
66
66
|
return d === void 0 ? { collection: c, query: u } : { collection: c, id: d, query: u };
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function ue(e) {
|
|
69
69
|
let t = [], n;
|
|
70
70
|
const c = (u) => e.request(u.command).then(u.resolve, u.reject), d = async (u) => {
|
|
71
71
|
if (u.length === 1) return c(u[0]);
|
|
@@ -90,7 +90,7 @@ function ce(e) {
|
|
|
90
90
|
u.forEach((l, i) => {
|
|
91
91
|
const r = a == null ? void 0 : a[i];
|
|
92
92
|
if ((r == null ? void 0 : r.status) === 404 && l.read.id !== void 0) {
|
|
93
|
-
l.reject(
|
|
93
|
+
l.reject(B());
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
if ((r == null ? void 0 : r.status) !== 200 || r === void 0) {
|
|
@@ -99,12 +99,12 @@ function ce(e) {
|
|
|
99
99
|
}
|
|
100
100
|
l.resolve(l.read.id !== void 0 ? { data: r.data } : { data: r.data, ...r.meta ?? {} });
|
|
101
101
|
});
|
|
102
|
-
},
|
|
102
|
+
}, _ = () => {
|
|
103
103
|
n = void 0;
|
|
104
104
|
const u = t;
|
|
105
105
|
t = [];
|
|
106
|
-
for (let a = 0; a < u.length; a +=
|
|
107
|
-
d(u.slice(a, a +
|
|
106
|
+
for (let a = 0; a < u.length; a += D)
|
|
107
|
+
d(u.slice(a, a + D));
|
|
108
108
|
};
|
|
109
109
|
return (u, a) => new Promise((l, i) => {
|
|
110
110
|
t.push({
|
|
@@ -112,22 +112,22 @@ function ce(e) {
|
|
|
112
112
|
command: u,
|
|
113
113
|
resolve: l,
|
|
114
114
|
reject: i
|
|
115
|
-
}), n === void 0 && (n = setTimeout(
|
|
115
|
+
}), n === void 0 && (n = setTimeout(_, 0));
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
const
|
|
119
|
-
function
|
|
118
|
+
const j = 50, le = 10, fe = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
|
|
119
|
+
function de(e) {
|
|
120
120
|
const t = e;
|
|
121
|
-
if ((t._method ?? "GET").toUpperCase() !== "GET" ||
|
|
122
|
-
const n =
|
|
121
|
+
if ((t._method ?? "GET").toUpperCase() !== "GET" || $(t._params) !== "") return null;
|
|
122
|
+
const n = fe.exec(t._path ?? "");
|
|
123
123
|
return n ? n[1] : null;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function B() {
|
|
126
126
|
return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function he(e) {
|
|
129
129
|
let t = !0, n = [], c;
|
|
130
|
-
const d = (a) => e.request(a.command).then(a.resolve, a.reject),
|
|
130
|
+
const d = (a) => e.request(a.command).then(a.resolve, a.reject), _ = async (a) => {
|
|
131
131
|
const l = [...new Set(a.map((o) => o.name))];
|
|
132
132
|
if (l.length === 1 || !t) {
|
|
133
133
|
for (const o of a) d(o);
|
|
@@ -157,7 +157,7 @@ function de(e) {
|
|
|
157
157
|
}
|
|
158
158
|
const s = r, f = new Set(Array.isArray(i == null ? void 0 : i.missing) ? i.missing : []);
|
|
159
159
|
for (const o of a)
|
|
160
|
-
Object.hasOwn(s, o.name) ? o.resolve({ data: T(s[o.name]) }) : f.has(o.name) ? o.reject(
|
|
160
|
+
Object.hasOwn(s, o.name) ? o.resolve({ data: T(s[o.name]) }) : f.has(o.name) ? o.reject(B()) : d(o);
|
|
161
161
|
}, u = () => {
|
|
162
162
|
c = void 0;
|
|
163
163
|
const a = n;
|
|
@@ -166,12 +166,12 @@ function de(e) {
|
|
|
166
166
|
for (const r of a) {
|
|
167
167
|
let s = i.get(r.name);
|
|
168
168
|
if (!s) {
|
|
169
|
-
const f = l[l.length - 1], o = f ? new Set(f.map((h) => h.name)).size :
|
|
170
|
-
s = f && o <
|
|
169
|
+
const f = l[l.length - 1], o = f ? new Set(f.map((h) => h.name)).size : j;
|
|
170
|
+
s = f && o < j ? f : [], s !== f && l.push(s), i.set(r.name, s);
|
|
171
171
|
}
|
|
172
172
|
s.push(r);
|
|
173
173
|
}
|
|
174
|
-
for (const r of l)
|
|
174
|
+
for (const r of l) _(r);
|
|
175
175
|
};
|
|
176
176
|
return (a, l) => new Promise((i, r) => {
|
|
177
177
|
n.push({
|
|
@@ -179,170 +179,170 @@ function de(e) {
|
|
|
179
179
|
command: a,
|
|
180
180
|
resolve: i,
|
|
181
181
|
reject: r
|
|
182
|
-
}), c === void 0 && (c = setTimeout(u,
|
|
182
|
+
}), c === void 0 && (c = setTimeout(u, le));
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function me(e) {
|
|
186
186
|
return !e || typeof e != "object" ? "" : "?" + new URLSearchParams(
|
|
187
187
|
Object.fromEntries(
|
|
188
188
|
Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => [t, String(n)])
|
|
189
189
|
)
|
|
190
190
|
).toString();
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function _e(e) {
|
|
193
193
|
const t = e;
|
|
194
194
|
if ((t._method ?? "GET").toUpperCase() !== "GET" || t._headers && Object.keys(t._headers).length > 0) return null;
|
|
195
195
|
const n = t._path ?? "";
|
|
196
|
-
return
|
|
196
|
+
return J(n) ? n + me(t._params) : null;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function pe(e) {
|
|
199
199
|
if (!e) return null;
|
|
200
200
|
const t = Number(e);
|
|
201
201
|
if (Number.isFinite(t) && t >= 0) return Math.round(t * 1e3);
|
|
202
202
|
const n = Date.parse(e);
|
|
203
203
|
return Number.isFinite(n) ? Math.max(0, n - Date.now()) : null;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function ye(e, t) {
|
|
206
206
|
const n = t.body, c = n ?? {};
|
|
207
|
-
return new
|
|
208
|
-
message:
|
|
207
|
+
return new Z({
|
|
208
|
+
message: x(n) || `HTTP ${t.status}`,
|
|
209
209
|
status: t.status,
|
|
210
210
|
code: typeof c.code == "string" ? c.code : null,
|
|
211
211
|
requestId: t.request_id ?? null,
|
|
212
212
|
response: n,
|
|
213
213
|
method: "GET",
|
|
214
214
|
path: e._path,
|
|
215
|
-
retryAfterMs:
|
|
215
|
+
retryAfterMs: pe(t.retry_after),
|
|
216
216
|
issues: c.issues
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
const t =
|
|
219
|
+
function ge(e) {
|
|
220
|
+
const t = W({
|
|
221
221
|
post: (n) => e.request({ _method: "POST", _path: "/batch-get", _body: { reads: n } })
|
|
222
222
|
});
|
|
223
|
-
return (n, c) => (
|
|
223
|
+
return (n, c) => (F() ?? t)(c, {
|
|
224
224
|
alone: () => e.request(n),
|
|
225
|
-
error: (d) =>
|
|
225
|
+
error: (d) => ye(n, d)
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
function
|
|
228
|
+
const I = 3e3, Ee = /^\/(settings|roles|collections\/[A-Za-z_][A-Za-z0-9_-]*|field-config\/[A-Za-z_][A-Za-z0-9_-]*|collection-layouts(\/active|\/summary\/[A-Za-z_][A-Za-z0-9_-]*)?|chat\/room-types|users\/me)$/, Te = /^\/(record-views|item-locks|drafts|presence|rum|analytics|session-recordings|comments|notifications|tasks|field-rules\/evaluate|chat\/(?!room-types)|field-config\/[^/]+\/(evaluate-visibility|evaluate-defaults|evaluate-lock|cascade|project)$|items\/(?!nivaro_|directus_)[^/]+|users\/cards$|files\/verify$|batch-get$)/;
|
|
229
|
+
function be(e) {
|
|
230
230
|
const t = (e._path ?? "").split("?")[0];
|
|
231
|
-
return (e._method ?? "GET").toUpperCase() === "POST" && O.test(t) ? !0 :
|
|
231
|
+
return (e._method ?? "GET").toUpperCase() === "POST" && O.test(t) ? !0 : Te.test(t);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function ve(e) {
|
|
234
234
|
const t = e;
|
|
235
|
-
if (!S(t) || !
|
|
235
|
+
if (!S(t) || !Ee.test(t._path ?? "")) return !1;
|
|
236
236
|
const n = t._params;
|
|
237
237
|
return !(n && n.item != null && /^\/collection-layouts\/active$/.test(t._path ?? ""));
|
|
238
238
|
}
|
|
239
239
|
let y = 0;
|
|
240
|
-
function
|
|
240
|
+
function M() {
|
|
241
241
|
y++;
|
|
242
242
|
}
|
|
243
243
|
let b = 0;
|
|
244
|
-
const
|
|
245
|
-
function
|
|
244
|
+
const Ae = /^\/(presence|rum|analytics|session-recordings)(\/|$)|^\/(items\/batch-read|batch-get|users\/cards|activity\/labels)$/;
|
|
245
|
+
function we(e) {
|
|
246
246
|
const t = e, n = (t._path ?? "").split("?")[0];
|
|
247
|
-
return
|
|
247
|
+
return Ae.test(n) ? !1 : !((t._method ?? "GET").toUpperCase() === "POST" && O.test(n) && !/\/touch$/.test(n));
|
|
248
248
|
}
|
|
249
|
-
const
|
|
250
|
-
function
|
|
249
|
+
const Se = 50, Oe = /^\/items\//;
|
|
250
|
+
function Ce(e, t) {
|
|
251
251
|
return e.config === t;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Re(e, t, n, c) {
|
|
254
254
|
if (t.epoch !== c) return !1;
|
|
255
255
|
const d = e._path ?? "";
|
|
256
|
-
return !
|
|
256
|
+
return !Oe.test(d) || n - t.at < Se;
|
|
257
257
|
}
|
|
258
258
|
function w(e, t) {
|
|
259
259
|
return e.then(
|
|
260
|
-
(n) => (t &&
|
|
260
|
+
(n) => (t && ee(), n),
|
|
261
261
|
(n) => {
|
|
262
|
-
throw
|
|
262
|
+
throw te(n, t) && ne(t), n;
|
|
263
263
|
}
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
if (
|
|
268
|
-
const n = /* @__PURE__ */ new Map(), c = t.batchReads ?
|
|
266
|
+
function je(e, t = {}) {
|
|
267
|
+
if (se(e)) return e;
|
|
268
|
+
const n = /* @__PURE__ */ new Map(), c = t.batchReads ? ue(e) : null, d = t.batchCollections === !1 ? null : he(e), _ = t.batchGets ?? t.batchReads ? ge(e) : null, u = /* @__PURE__ */ new Map();
|
|
269
269
|
let a = y;
|
|
270
270
|
const l = (r, s, f) => {
|
|
271
271
|
if (s !== y) return;
|
|
272
272
|
a !== y && (u.clear(), a = y);
|
|
273
273
|
const o = Date.now();
|
|
274
|
-
for (const [h, p] of u) o - p.at >=
|
|
274
|
+
for (const [h, p] of u) o - p.at >= I && u.delete(h);
|
|
275
275
|
u.set(r, { at: o, epoch: s, value: f });
|
|
276
276
|
}, i = (r) => {
|
|
277
277
|
const s = r;
|
|
278
278
|
if (!S(s)) {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const R = !
|
|
282
|
-
R &&
|
|
283
|
-
const G =
|
|
284
|
-
G && b
|
|
279
|
+
const m = K(s._path, s._params);
|
|
280
|
+
m || N(s._method, s._path, s._body);
|
|
281
|
+
const R = !be(s);
|
|
282
|
+
R && M();
|
|
283
|
+
const G = we(s);
|
|
284
|
+
G && b++, m || k("start", s._method, s._path);
|
|
285
285
|
const P = w(e.request(r), !1).finally(() => {
|
|
286
|
-
G && b
|
|
286
|
+
G && b++, m || k("end", s._method, s._path);
|
|
287
287
|
});
|
|
288
|
-
return (R ? P.finally(
|
|
288
|
+
return (R ? P.finally(M) : P).then((q) => (m || N(s._method, s._path, s._body, q), q));
|
|
289
289
|
}
|
|
290
290
|
if (r._signal)
|
|
291
291
|
return w(e.request(r), !1);
|
|
292
|
-
const f =
|
|
292
|
+
const f = L(s), o = ve(s);
|
|
293
293
|
if (o) {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
return Promise.resolve(T(
|
|
294
|
+
const m = u.get(f);
|
|
295
|
+
if (m && m.epoch === y && Date.now() - m.at < I)
|
|
296
|
+
return Promise.resolve(T(m.value));
|
|
297
297
|
}
|
|
298
298
|
const h = n.get(f);
|
|
299
|
-
if (h && (o ?
|
|
299
|
+
if (h && (o ? Ce(h, y) : Re(s, h, Date.now(), b)))
|
|
300
300
|
return h.p.then(T);
|
|
301
|
-
const p =
|
|
302
|
-
if (p && !
|
|
303
|
-
const g = c ?
|
|
304
|
-
g && c ? c(r, g) : v && d ? d(r, v) : C &&
|
|
301
|
+
const p = Q(s._method, s._path, s._params);
|
|
302
|
+
if (p && !V()) return Promise.reject(X());
|
|
303
|
+
const g = c ? ce(s) : null, v = !g && d ? de(s) : null, C = !g && !v && _ && !p ? _e(s) : null, U = w(
|
|
304
|
+
g && c ? c(r, g) : v && d ? d(r, v) : C && _ ? _(r, C) : e.request(r),
|
|
305
305
|
p
|
|
306
|
-
),
|
|
307
|
-
var
|
|
308
|
-
((
|
|
306
|
+
), H = y, A = U.then((m) => (o && l(f, H, T(m)), m)).finally(() => {
|
|
307
|
+
var m;
|
|
308
|
+
((m = n.get(f)) == null ? void 0 : m.p) === A && n.delete(f);
|
|
309
309
|
});
|
|
310
310
|
return n.set(f, { p: A, at: Date.now(), epoch: b, config: y }), A;
|
|
311
311
|
};
|
|
312
312
|
return new Proxy(e, {
|
|
313
313
|
get(r, s, f) {
|
|
314
314
|
if (s === "request") return i;
|
|
315
|
-
if (s ===
|
|
315
|
+
if (s === z) return !0;
|
|
316
316
|
if (s === "setToken" && typeof r.setToken == "function")
|
|
317
317
|
return (h) => {
|
|
318
|
-
r.setToken(h),
|
|
318
|
+
r.setToken(h), Y();
|
|
319
319
|
};
|
|
320
320
|
const o = Reflect.get(r, s, f);
|
|
321
321
|
return typeof o == "function" ? o.bind(r) : o;
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
const
|
|
326
|
-
function
|
|
325
|
+
const Ge = /^\/(item-locks|drafts|auth)\b/, E = /* @__PURE__ */ new Set();
|
|
326
|
+
function Pe() {
|
|
327
327
|
for (const e of [...E]) e();
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Ie(e) {
|
|
330
330
|
return e.subscribe((t) => {
|
|
331
|
-
t.type === "observerAdded" && t.query.state.fetchStatus === "fetching" && E.size !== 0 &&
|
|
331
|
+
t.type === "observerAdded" && t.query.state.fetchStatus === "fetching" && E.size !== 0 && Pe();
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function Me(e, t = {}) {
|
|
335
335
|
let n = t.open ?? !0, c;
|
|
336
|
-
const d = /* @__PURE__ */ new Map(),
|
|
336
|
+
const d = /* @__PURE__ */ new Map(), _ = () => {
|
|
337
337
|
const i = [...d.values()];
|
|
338
338
|
d.clear();
|
|
339
339
|
for (const r of i) r.release();
|
|
340
340
|
}, u = () => {
|
|
341
|
-
E.delete(u),
|
|
341
|
+
E.delete(u), _();
|
|
342
342
|
}, a = (i) => {
|
|
343
343
|
const r = i;
|
|
344
|
-
if (n || !
|
|
345
|
-
const s =
|
|
344
|
+
if (n || !re(r) || Ge.test(r._path ?? "")) return e.request(i);
|
|
345
|
+
const s = L(r), f = d.get(s);
|
|
346
346
|
if (f) return f.promise.then(T);
|
|
347
347
|
let o = () => {
|
|
348
348
|
};
|
|
@@ -359,12 +359,12 @@ function Ie(e, t = {}) {
|
|
|
359
359
|
return (o) => {
|
|
360
360
|
c !== void 0 && (clearTimeout(c), c = void 0);
|
|
361
361
|
const h = n;
|
|
362
|
-
n = o, o && !h && (E.delete(u),
|
|
362
|
+
n = o, o && !h && (E.delete(u), _());
|
|
363
363
|
};
|
|
364
364
|
if (r === "dispose")
|
|
365
365
|
return () => {
|
|
366
366
|
c === void 0 && (c = setTimeout(() => {
|
|
367
|
-
c = void 0, n = !0, E.delete(u),
|
|
367
|
+
c = void 0, n = !0, E.delete(u), _();
|
|
368
368
|
}, 0));
|
|
369
369
|
};
|
|
370
370
|
const f = Reflect.get(i, r, s);
|
|
@@ -373,22 +373,22 @@ function Ie(e, t = {}) {
|
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
export {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
376
|
+
D as BATCH_READ_LIMIT,
|
|
377
|
+
j as COLLECTION_BATCH_LIMIT,
|
|
378
|
+
le as COLLECTION_BATCH_WINDOW_MS,
|
|
379
|
+
Se as RECORD_JOIN_MS,
|
|
380
|
+
I as SETTLED_READ_MS,
|
|
381
|
+
de as batchableCollectionMeta,
|
|
382
|
+
_e as batchableGet,
|
|
383
|
+
ce as batchableRead,
|
|
384
|
+
Me as createGatedClient,
|
|
385
|
+
M as forgetSettledReads,
|
|
386
|
+
se as isCoalesced,
|
|
387
|
+
ve as isSettledRead,
|
|
388
|
+
Ce as mayJoinConfigInflight,
|
|
389
|
+
Re as mayJoinInflight,
|
|
390
|
+
we as movesWriteEpoch,
|
|
391
|
+
Pe as releaseGatedReads,
|
|
392
|
+
Ie as releaseGatedReadsOnSharedFetch,
|
|
393
|
+
je as withGetCoalescing
|
|
394
394
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useQueryClient as I } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo as L, useState as q, useRef as p, useEffect as T } from "react";
|
|
3
|
+
import { parseRollupSources as b } from "../components/item-edit/live-rollups.js";
|
|
4
|
+
import { useLiveRecordEvent as D } from "./live.js";
|
|
5
|
+
import { onWriteCommand as K } from "./own-writes.js";
|
|
6
|
+
const P = 15e3, N = 350, Q = 1400;
|
|
7
|
+
function U(l) {
|
|
8
|
+
const u = /* @__PURE__ */ new Map(), f = l ?? [];
|
|
9
|
+
for (const o of f)
|
|
10
|
+
if (!(o.computed_type !== "rollup" || !o.computed_formula))
|
|
11
|
+
for (const n of b(o.computed_formula)) {
|
|
12
|
+
const c = u.get(n.related_collection) ?? /* @__PURE__ */ new Set();
|
|
13
|
+
c.add(o.field), u.set(n.related_collection, c);
|
|
14
|
+
}
|
|
15
|
+
for (const o of u.values())
|
|
16
|
+
for (const n of f) {
|
|
17
|
+
if (n.computed_type === "rollup" || o.has(n.field) || !n.computed_formula) continue;
|
|
18
|
+
const c = typeof n.computed_formula == "string" ? n.computed_formula : JSON.stringify(n.computed_formula);
|
|
19
|
+
[...o].some((m) => c.includes(`{{${m}}}`)) && o.add(n.field);
|
|
20
|
+
}
|
|
21
|
+
return u;
|
|
22
|
+
}
|
|
23
|
+
function W(l) {
|
|
24
|
+
const [u, f] = l.split("?");
|
|
25
|
+
if (!f) return null;
|
|
26
|
+
const o = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/[^/?#]+)?$/.exec(u);
|
|
27
|
+
if (!o) return null;
|
|
28
|
+
const n = new URLSearchParams(f), c = n.get("parent_collection"), m = n.get("parent_id");
|
|
29
|
+
return !c || !m ? null : { collection: o[1], parentCollection: c, parentId: m };
|
|
30
|
+
}
|
|
31
|
+
const a = /* @__PURE__ */ new Set();
|
|
32
|
+
function Y(l) {
|
|
33
|
+
const { collection: u, fields: f, dataUpdatedAt: o, enabled: n = !0 } = l, c = l.itemId == null || l.itemId === "new" ? null : String(l.itemId), m = I(), h = L(() => U(f), [f]), A = L(() => {
|
|
34
|
+
const e = /* @__PURE__ */ new Set();
|
|
35
|
+
for (const t of h.values()) for (const s of t) e.add(s);
|
|
36
|
+
return e;
|
|
37
|
+
}, [h]), [k, y] = q(a), [z, S] = q(a), d = p({
|
|
38
|
+
inflight: 0,
|
|
39
|
+
serverOpen: !1,
|
|
40
|
+
/** When the burst's last write / the server's `done` ended: a re-read after it settles. */
|
|
41
|
+
endedAt: 0,
|
|
42
|
+
fields: /* @__PURE__ */ new Set()
|
|
43
|
+
}), C = p(l.queryKey);
|
|
44
|
+
C.current = l.queryKey;
|
|
45
|
+
const r = p({}), _ = n && !!c && A.size > 0, x = (e) => {
|
|
46
|
+
const t = d.current, s = new Set(t.fields);
|
|
47
|
+
t.fields.clear(), t.inflight = 0, t.serverOpen = !1, t.endedAt = 0, r.current.max && clearTimeout(r.current.max), r.current.reread && clearTimeout(r.current.reread), y(a), e && s.size > 0 && (S(s), r.current.landed && clearTimeout(r.current.landed), r.current.landed = setTimeout(() => S(a), Q));
|
|
48
|
+
}, R = p(x);
|
|
49
|
+
R.current = x;
|
|
50
|
+
const O = (e) => {
|
|
51
|
+
const t = d.current;
|
|
52
|
+
let s = !1;
|
|
53
|
+
for (const i of e)
|
|
54
|
+
A.has(i) && !t.fields.has(i) && (t.fields.add(i), s = !0);
|
|
55
|
+
t.endedAt = 0, r.current.reread && clearTimeout(r.current.reread), s && y(new Set(t.fields)), r.current.max && clearTimeout(r.current.max), r.current.max = setTimeout(() => R.current(!1), P);
|
|
56
|
+
}, v = p(O);
|
|
57
|
+
v.current = O;
|
|
58
|
+
const M = () => {
|
|
59
|
+
const e = d.current;
|
|
60
|
+
e.fields.size === 0 || e.inflight > 0 || e.serverOpen || (e.endedAt = Date.now(), r.current.reread && clearTimeout(r.current.reread), r.current.reread = setTimeout(() => {
|
|
61
|
+
m.invalidateQueries({ queryKey: C.current });
|
|
62
|
+
}, N));
|
|
63
|
+
}, w = p(M);
|
|
64
|
+
return w.current = M, T(() => {
|
|
65
|
+
if (_)
|
|
66
|
+
return K((e) => {
|
|
67
|
+
const t = W(e.path);
|
|
68
|
+
if (!t || t.parentCollection !== u || t.parentId !== c) return;
|
|
69
|
+
const s = h.get(t.collection);
|
|
70
|
+
if (!s) return;
|
|
71
|
+
const i = d.current;
|
|
72
|
+
e.phase === "start" ? (i.inflight++, v.current(s)) : (i.inflight = Math.max(0, i.inflight - 1), w.current());
|
|
73
|
+
});
|
|
74
|
+
}, [_, u, c, h]), D(
|
|
75
|
+
"record:recalc",
|
|
76
|
+
u,
|
|
77
|
+
c,
|
|
78
|
+
(e) => {
|
|
79
|
+
const t = Array.isArray(e == null ? void 0 : e.fields) ? e.fields.map(String) : [], s = d.current;
|
|
80
|
+
if ((e == null ? void 0 : e.phase) === "start") {
|
|
81
|
+
const i = t.filter((g) => A.has(g));
|
|
82
|
+
for (const g of h.values())
|
|
83
|
+
if (i.some((E) => g.has(E))) for (const E of g) i.push(E);
|
|
84
|
+
if (i.length === 0) return;
|
|
85
|
+
s.serverOpen = !0, v.current(i);
|
|
86
|
+
} else (e == null ? void 0 : e.phase) === "done" && (s.serverOpen = !1, w.current());
|
|
87
|
+
},
|
|
88
|
+
{ includeOwn: !0, enabled: _ }
|
|
89
|
+
), T(() => {
|
|
90
|
+
const e = d.current;
|
|
91
|
+
e.endedAt > 0 && o >= e.endedAt && R.current(!0);
|
|
92
|
+
}, [o]), T(() => {
|
|
93
|
+
const e = r.current;
|
|
94
|
+
return () => {
|
|
95
|
+
for (const t of ["reread", "max", "landed"]) e[t] && clearTimeout(e[t]);
|
|
96
|
+
d.current = { inflight: 0, serverOpen: !1, endedAt: 0, fields: /* @__PURE__ */ new Set() }, y(a), S(a);
|
|
97
|
+
};
|
|
98
|
+
}, [u, c]), { pending: _ ? k : a, landed: _ ? z : a };
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
Q as RECALC_LANDED_MS,
|
|
102
|
+
P as RECALC_MAX_MS,
|
|
103
|
+
N as RECALC_REREAD_MS,
|
|
104
|
+
W as childWriteOf,
|
|
105
|
+
U as recalcFeeds,
|
|
106
|
+
Y as useRollupRecalc
|
|
107
|
+
};
|