@multiplatform.one/frappe 9.17.0 → 10.0.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/dist/cjs/auth.cjs +34 -44
- package/dist/cjs/auth.native.cjs +97 -0
- package/dist/cjs/auth.native.js +77 -82
- package/dist/cjs/auth.native.js.map +1 -1
- package/dist/cjs/call.cjs +31 -35
- package/dist/cjs/call.native.cjs +92 -0
- package/dist/cjs/call.native.js +72 -71
- package/dist/cjs/call.native.js.map +1 -1
- package/dist/cjs/collection.cjs +243 -287
- package/dist/cjs/collection.native.cjs +461 -0
- package/dist/cjs/collection.native.js +436 -499
- package/dist/cjs/collection.native.js.map +1 -1
- package/dist/cjs/common/types.cjs +9 -11
- package/dist/cjs/common/types.native.cjs +18 -0
- package/dist/cjs/common/types.native.js +9 -10
- package/dist/cjs/common/types.native.js.map +1 -1
- package/dist/cjs/connectionKey.cjs +18 -22
- package/dist/cjs/connectionKey.native.cjs +32 -0
- package/dist/cjs/connectionKey.native.js +19 -22
- package/dist/cjs/connectionKey.native.js.map +1 -1
- package/dist/cjs/core/http.cjs +404 -407
- package/dist/cjs/core/http.native.cjs +659 -0
- package/dist/cjs/core/http.native.js +611 -615
- package/dist/cjs/core/http.native.js.map +1 -1
- package/dist/cjs/core/serverMessages.cjs +48 -43
- package/dist/cjs/core/serverMessages.native.cjs +89 -0
- package/dist/cjs/core/serverMessages.native.js +69 -70
- package/dist/cjs/core/serverMessages.native.js.map +1 -1
- package/dist/cjs/core/sessionGate.cjs +94 -97
- package/dist/cjs/core/sessionGate.native.cjs +270 -0
- package/dist/cjs/core/sessionGate.native.js +220 -232
- package/dist/cjs/core/sessionGate.native.js.map +1 -1
- package/dist/cjs/core/types.cjs +37 -39
- package/dist/cjs/core/types.native.cjs +169 -0
- package/dist/cjs/core/types.native.js +129 -136
- package/dist/cjs/core/types.native.js.map +1 -1
- package/dist/cjs/core/wire.cjs +28 -30
- package/dist/cjs/core/wire.native.cjs +53 -0
- package/dist/cjs/core/wire.native.js +28 -29
- package/dist/cjs/core/wire.native.js.map +1 -1
- package/dist/cjs/db.cjs +434 -449
- package/dist/cjs/db.native.cjs +625 -0
- package/dist/cjs/db.native.js +583 -590
- package/dist/cjs/db.native.js.map +1 -1
- package/dist/cjs/devtools/FrappeDevtoolsPanel.cjs +774 -799
- package/dist/cjs/devtools/FrappeDevtoolsPanel.native.cjs +878 -0
- package/dist/cjs/devtools/FrappeDevtoolsPanel.native.js +821 -862
- package/dist/cjs/devtools/FrappeDevtoolsPanel.native.js.map +1 -1
- package/dist/cjs/devtools/index.cjs +15 -17
- package/dist/cjs/devtools/index.native.cjs +30 -0
- package/dist/cjs/devtools/index.native.js +15 -16
- package/dist/cjs/devtools/index.native.js.map +1 -1
- package/dist/cjs/devtools/plugin.cjs +22 -26
- package/dist/cjs/devtools/plugin.native.cjs +46 -0
- package/dist/cjs/devtools/plugin.native.js +27 -35
- package/dist/cjs/devtools/plugin.native.js.map +1 -1
- package/dist/cjs/devtools/theme.cjs +40 -44
- package/dist/cjs/devtools/theme.native.cjs +53 -0
- package/dist/cjs/devtools/theme.native.js +40 -43
- package/dist/cjs/devtools/theme.native.js.map +1 -1
- package/dist/cjs/doctype.cjs +493 -440
- package/dist/cjs/doctype.native.cjs +631 -0
- package/dist/cjs/doctype.native.js +587 -563
- package/dist/cjs/doctype.native.js.map +1 -1
- package/dist/cjs/file.cjs +27 -31
- package/dist/cjs/file.native.cjs +78 -0
- package/dist/cjs/file.native.js +58 -62
- package/dist/cjs/file.native.js.map +1 -1
- package/dist/cjs/fixtureDb.cjs +187 -209
- package/dist/cjs/fixtureDb.native.cjs +313 -0
- package/dist/cjs/fixtureDb.native.js +291 -300
- package/dist/cjs/fixtureDb.native.js.map +1 -1
- package/dist/cjs/fixtures.cjs +173 -192
- package/dist/cjs/fixtures.native.cjs +379 -0
- package/dist/cjs/fixtures.native.js +359 -381
- package/dist/cjs/fixtures.native.js.map +1 -1
- package/dist/cjs/frappeApp.cjs +94 -101
- package/dist/cjs/frappeApp.native.cjs +181 -0
- package/dist/cjs/frappeApp.native.js +153 -152
- package/dist/cjs/frappeApp.native.js.map +1 -1
- package/dist/cjs/frappeReact.cjs +555 -528
- package/dist/cjs/frappeReact.native.cjs +710 -0
- package/dist/cjs/frappeReact.native.js +637 -632
- package/dist/cjs/frappeReact.native.js.map +1 -1
- package/dist/cjs/index.cjs +128 -135
- package/dist/cjs/index.gnome.cjs +61 -63
- package/dist/cjs/index.gnome.native.cjs +87 -0
- package/dist/cjs/index.gnome.native.js +61 -62
- package/dist/cjs/index.gnome.native.js.map +1 -1
- package/dist/cjs/index.native.cjs +171 -0
- package/dist/cjs/index.native.js +130 -136
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/optimistic.cjs +35 -39
- package/dist/cjs/optimistic.native.cjs +59 -0
- package/dist/cjs/optimistic.native.js +38 -41
- package/dist/cjs/optimistic.native.js.map +1 -1
- package/dist/cjs/pacer.cjs +170 -176
- package/dist/cjs/pacer.native.cjs +263 -0
- package/dist/cjs/pacer.native.js +234 -245
- package/dist/cjs/pacer.native.js.map +1 -1
- package/dist/cjs/plugin/index.cjs +104 -112
- package/dist/cjs/plugin/index.native.cjs +178 -0
- package/dist/cjs/plugin/index.native.js +164 -177
- package/dist/cjs/plugin/index.native.js.map +1 -1
- package/dist/cjs/realtime.cjs +581 -610
- package/dist/cjs/realtime.native.cjs +945 -0
- package/dist/cjs/realtime.native.js +918 -928
- package/dist/cjs/realtime.native.js.map +1 -1
- package/dist/cjs/serverLoaders.cjs +60 -78
- package/dist/cjs/serverLoaders.native.cjs +103 -0
- package/dist/cjs/serverLoaders.native.js +73 -95
- package/dist/cjs/serverLoaders.native.js.map +1 -1
- package/dist/cjs/sync/backfill.cjs +281 -301
- package/dist/cjs/sync/backfill.native.cjs +475 -0
- package/dist/cjs/sync/backfill.native.js +449 -465
- package/dist/cjs/sync/backfill.native.js.map +1 -1
- package/dist/cjs/sync/filters.cjs +309 -267
- package/dist/cjs/sync/filters.native.cjs +472 -0
- package/dist/cjs/sync/filters.native.js +426 -398
- package/dist/cjs/sync/filters.native.js.map +1 -1
- package/dist/cjs/sync/index.cjs +476 -496
- package/dist/cjs/sync/index.native.cjs +771 -0
- package/dist/cjs/sync/index.native.js +738 -737
- package/dist/cjs/sync/index.native.js.map +1 -1
- package/dist/cjs/sync/merge.cjs +392 -393
- package/dist/cjs/sync/merge.native.cjs +681 -0
- package/dist/cjs/sync/merge.native.js +642 -673
- package/dist/cjs/sync/merge.native.js.map +1 -1
- package/dist/cjs/sync/mutationEngine.cjs +785 -829
- package/dist/cjs/sync/mutationEngine.native.cjs +1190 -0
- package/dist/cjs/sync/mutationEngine.native.js +1162 -1216
- package/dist/cjs/sync/mutationEngine.native.js.map +1 -1
- package/dist/cjs/sync/mutationJournal.cjs +147 -149
- package/dist/cjs/sync/mutationJournal.native.cjs +302 -0
- package/dist/cjs/sync/mutationJournal.native.js +278 -269
- package/dist/cjs/sync/mutationJournal.native.js.map +1 -1
- package/dist/cjs/sync/normalizedCache.cjs +127 -134
- package/dist/cjs/sync/normalizedCache.native.cjs +232 -0
- package/dist/cjs/sync/normalizedCache.native.js +212 -212
- package/dist/cjs/sync/normalizedCache.native.js.map +1 -1
- package/dist/cjs/sync/persistence.cjs +649 -661
- package/dist/cjs/sync/persistence.native.cjs +996 -0
- package/dist/cjs/sync/persistence.native.js +967 -965
- package/dist/cjs/sync/persistence.native.js.map +1 -1
- package/dist/cjs/sync/realtime.cjs +307 -315
- package/dist/cjs/sync/realtime.native.cjs +486 -0
- package/dist/cjs/sync/realtime.native.js +465 -461
- package/dist/cjs/sync/realtime.native.js.map +1 -1
- package/dist/cjs/sync/rehydration.cjs +279 -321
- package/dist/cjs/sync/rehydration.native.cjs +495 -0
- package/dist/cjs/sync/rehydration.native.js +473 -515
- package/dist/cjs/sync/rehydration.native.js.map +1 -1
- package/dist/cjs/sync/storage.cjs +127 -129
- package/dist/cjs/sync/storage.native.cjs +211 -0
- package/dist/cjs/sync/storage.native.js +188 -184
- package/dist/cjs/sync/storage.native.js.map +1 -1
- package/dist/cjs/sync/subscriptionManager.cjs +686 -708
- package/dist/cjs/sync/subscriptionManager.native.cjs +1205 -0
- package/dist/cjs/sync/subscriptionManager.native.js +1179 -1220
- package/dist/cjs/sync/subscriptionManager.native.js.map +1 -1
- package/dist/cjs/sync/types.cjs +79 -81
- package/dist/cjs/sync/types.native.cjs +103 -0
- package/dist/cjs/sync/types.native.js +89 -90
- package/dist/cjs/sync/types.native.js.map +1 -1
- package/dist/cjs/sync/virtualPageManager.cjs +762 -806
- package/dist/cjs/sync/virtualPageManager.native.cjs +1097 -0
- package/dist/cjs/sync/virtualPageManager.native.js +1072 -1097
- package/dist/cjs/sync/virtualPageManager.native.js.map +1 -1
- package/dist/cjs/syncOptionsKey.cjs +38 -45
- package/dist/cjs/syncOptionsKey.native.cjs +69 -0
- package/dist/cjs/syncOptionsKey.native.js +51 -63
- package/dist/cjs/syncOptionsKey.native.js.map +1 -1
- package/dist/cjs/useLiveQuery.cjs +14 -18
- package/dist/cjs/useLiveQuery.native.cjs +26 -0
- package/dist/cjs/useLiveQuery.native.js +14 -17
- package/dist/cjs/useLiveQuery.native.js.map +1 -1
- package/dist/cjs/util.cjs +22 -24
- package/dist/cjs/util.native.cjs +40 -0
- package/dist/cjs/util.native.js +22 -28
- package/dist/cjs/util.native.js.map +1 -1
- package/dist/esm/auth.mjs +22 -27
- package/dist/esm/auth.mjs.map +1 -1
- package/dist/esm/auth.native.js +64 -65
- package/dist/esm/auth.native.js.map +1 -1
- package/dist/esm/call.mjs +19 -18
- package/dist/esm/call.mjs.map +1 -1
- package/dist/esm/call.native.js +59 -54
- package/dist/esm/call.native.js.map +1 -1
- package/dist/esm/collection.mjs +228 -268
- package/dist/esm/collection.mjs.map +1 -1
- package/dist/esm/collection.native.js +421 -481
- package/dist/esm/collection.native.js.map +1 -1
- package/dist/esm/common/types.mjs +0 -2
- package/dist/esm/common/types.native.js +0 -2
- package/dist/esm/connectionKey.mjs +5 -4
- package/dist/esm/connectionKey.mjs.map +1 -1
- package/dist/esm/connectionKey.native.js +6 -5
- package/dist/esm/connectionKey.native.js.map +1 -1
- package/dist/esm/core/http.mjs +383 -382
- package/dist/esm/core/http.mjs.map +1 -1
- package/dist/esm/core/http.native.js +590 -591
- package/dist/esm/core/http.native.js.map +1 -1
- package/dist/esm/core/serverMessages.mjs +34 -26
- package/dist/esm/core/serverMessages.mjs.map +1 -1
- package/dist/esm/core/serverMessages.native.js +55 -54
- package/dist/esm/core/serverMessages.native.js.map +1 -1
- package/dist/esm/core/sessionGate.mjs +79 -79
- package/dist/esm/core/sessionGate.mjs.map +1 -1
- package/dist/esm/core/sessionGate.native.js +205 -215
- package/dist/esm/core/sessionGate.native.js.map +1 -1
- package/dist/esm/core/types.mjs +23 -22
- package/dist/esm/core/types.mjs.map +1 -1
- package/dist/esm/core/types.native.js +114 -119
- package/dist/esm/core/types.native.js.map +1 -1
- package/dist/esm/core/wire.mjs +10 -9
- package/dist/esm/core/wire.mjs.map +1 -1
- package/dist/esm/core/wire.native.js +10 -9
- package/dist/esm/core/wire.native.js.map +1 -1
- package/dist/esm/db.mjs +421 -432
- package/dist/esm/db.mjs.map +1 -1
- package/dist/esm/db.native.js +570 -574
- package/dist/esm/db.native.js.map +1 -1
- package/dist/esm/devtools/FrappeDevtoolsPanel.mjs +762 -781
- package/dist/esm/devtools/FrappeDevtoolsPanel.mjs.map +1 -1
- package/dist/esm/devtools/FrappeDevtoolsPanel.native.js +808 -839
- package/dist/esm/devtools/FrappeDevtoolsPanel.native.js.map +1 -1
- package/dist/esm/devtools/index.mjs +2 -2
- package/dist/esm/devtools/index.native.js +2 -2
- package/dist/esm/devtools/plugin.mjs +10 -8
- package/dist/esm/devtools/plugin.mjs.map +1 -1
- package/dist/esm/devtools/plugin.native.js +14 -12
- package/dist/esm/devtools/plugin.native.js.map +1 -1
- package/dist/esm/devtools/theme.mjs +27 -26
- package/dist/esm/devtools/theme.mjs.map +1 -1
- package/dist/esm/devtools/theme.native.js +27 -26
- package/dist/esm/devtools/theme.native.js.map +1 -1
- package/dist/esm/doctype.mjs +473 -416
- package/dist/esm/doctype.mjs.map +1 -1
- package/dist/esm/doctype.native.js +566 -539
- package/dist/esm/doctype.native.js.map +1 -1
- package/dist/esm/file.mjs +15 -14
- package/dist/esm/file.mjs.map +1 -1
- package/dist/esm/file.native.js +45 -45
- package/dist/esm/file.native.js.map +1 -1
- package/dist/esm/fixtureDb.mjs +175 -191
- package/dist/esm/fixtureDb.mjs.map +1 -1
- package/dist/esm/fixtureDb.native.js +279 -283
- package/dist/esm/fixtureDb.native.js.map +1 -1
- package/dist/esm/fixtures.mjs +161 -175
- package/dist/esm/fixtures.mjs.map +1 -1
- package/dist/esm/fixtures.native.js +346 -364
- package/dist/esm/fixtures.native.js.map +1 -1
- package/dist/esm/frappeApp.mjs +82 -83
- package/dist/esm/frappeApp.mjs.map +1 -1
- package/dist/esm/frappeApp.native.js +141 -135
- package/dist/esm/frappeApp.native.js.map +1 -1
- package/dist/esm/frappeReact.mjs +535 -504
- package/dist/esm/frappeReact.mjs.map +1 -1
- package/dist/esm/frappeReact.native.js +615 -607
- package/dist/esm/frappeReact.native.js.map +1 -1
- package/dist/esm/index.gnome.mjs +5 -5
- package/dist/esm/index.gnome.native.js +5 -5
- package/dist/esm/index.mjs +17 -18
- package/dist/esm/index.native.js +17 -18
- package/dist/esm/optimistic.mjs +19 -19
- package/dist/esm/optimistic.mjs.map +1 -1
- package/dist/esm/optimistic.native.js +22 -22
- package/dist/esm/optimistic.native.js.map +1 -1
- package/dist/esm/pacer.mjs +156 -158
- package/dist/esm/pacer.mjs.map +1 -1
- package/dist/esm/pacer.native.js +220 -228
- package/dist/esm/pacer.native.js.map +1 -1
- package/dist/esm/plugin/index.mjs +91 -94
- package/dist/esm/plugin/index.mjs.map +1 -1
- package/dist/esm/plugin/index.native.js +151 -160
- package/dist/esm/plugin/index.native.js.map +1 -1
- package/dist/esm/realtime.mjs +569 -594
- package/dist/esm/realtime.mjs.map +1 -1
- package/dist/esm/realtime.native.js +905 -912
- package/dist/esm/realtime.native.js.map +1 -1
- package/dist/esm/serverLoaders.mjs +47 -61
- package/dist/esm/serverLoaders.mjs.map +1 -1
- package/dist/esm/serverLoaders.native.js +56 -75
- package/dist/esm/serverLoaders.native.js.map +1 -1
- package/dist/esm/sync/backfill.mjs +268 -284
- package/dist/esm/sync/backfill.mjs.map +1 -1
- package/dist/esm/sync/backfill.native.js +435 -448
- package/dist/esm/sync/backfill.native.js.map +1 -1
- package/dist/esm/sync/filters.mjs +286 -241
- package/dist/esm/sync/filters.mjs.map +1 -1
- package/dist/esm/sync/filters.native.js +403 -373
- package/dist/esm/sync/filters.native.js.map +1 -1
- package/dist/esm/sync/index.mjs +465 -479
- package/dist/esm/sync/index.mjs.map +1 -1
- package/dist/esm/sync/index.native.js +726 -720
- package/dist/esm/sync/index.native.js.map +1 -1
- package/dist/esm/sync/merge.mjs +368 -366
- package/dist/esm/sync/merge.mjs.map +1 -1
- package/dist/esm/sync/merge.native.js +618 -647
- package/dist/esm/sync/merge.native.js.map +1 -1
- package/dist/esm/sync/mutationEngine.mjs +775 -814
- package/dist/esm/sync/mutationEngine.mjs.map +1 -1
- package/dist/esm/sync/mutationEngine.native.js +1152 -1202
- package/dist/esm/sync/mutationEngine.native.js.map +1 -1
- package/dist/esm/sync/mutationJournal.mjs +135 -133
- package/dist/esm/sync/mutationJournal.mjs.map +1 -1
- package/dist/esm/sync/mutationJournal.native.js +265 -253
- package/dist/esm/sync/mutationJournal.native.js.map +1 -1
- package/dist/esm/sync/normalizedCache.mjs +115 -117
- package/dist/esm/sync/normalizedCache.mjs.map +1 -1
- package/dist/esm/sync/normalizedCache.native.js +199 -195
- package/dist/esm/sync/normalizedCache.native.js.map +1 -1
- package/dist/esm/sync/persistence.mjs +637 -645
- package/dist/esm/sync/persistence.mjs.map +1 -1
- package/dist/esm/sync/persistence.native.js +954 -949
- package/dist/esm/sync/persistence.native.js.map +1 -1
- package/dist/esm/sync/realtime.mjs +296 -298
- package/dist/esm/sync/realtime.mjs.map +1 -1
- package/dist/esm/sync/realtime.native.js +453 -444
- package/dist/esm/sync/realtime.native.js.map +1 -1
- package/dist/esm/sync/rehydration.mjs +268 -304
- package/dist/esm/sync/rehydration.mjs.map +1 -1
- package/dist/esm/sync/rehydration.native.js +461 -498
- package/dist/esm/sync/rehydration.native.js.map +1 -1
- package/dist/esm/sync/storage.mjs +115 -113
- package/dist/esm/sync/storage.mjs.map +1 -1
- package/dist/esm/sync/storage.native.js +175 -168
- package/dist/esm/sync/storage.native.js.map +1 -1
- package/dist/esm/sync/subscriptionManager.mjs +675 -691
- package/dist/esm/sync/subscriptionManager.mjs.map +1 -1
- package/dist/esm/sync/subscriptionManager.native.js +1168 -1204
- package/dist/esm/sync/subscriptionManager.native.js.map +1 -1
- package/dist/esm/sync/types.mjs +56 -55
- package/dist/esm/sync/types.mjs.map +1 -1
- package/dist/esm/sync/types.native.js +66 -65
- package/dist/esm/sync/types.native.js.map +1 -1
- package/dist/esm/sync/virtualPageManager.mjs +749 -789
- package/dist/esm/sync/virtualPageManager.mjs.map +1 -1
- package/dist/esm/sync/virtualPageManager.native.js +1058 -1080
- package/dist/esm/sync/virtualPageManager.native.js.map +1 -1
- package/dist/esm/syncOptionsKey.mjs +25 -27
- package/dist/esm/syncOptionsKey.mjs.map +1 -1
- package/dist/esm/syncOptionsKey.native.js +38 -46
- package/dist/esm/syncOptionsKey.native.js.map +1 -1
- package/dist/esm/useLiveQuery.mjs +2 -2
- package/dist/esm/useLiveQuery.native.js +2 -2
- package/dist/esm/util.mjs +9 -7
- package/dist/esm/util.mjs.map +1 -1
- package/dist/esm/util.native.js +8 -11
- package/dist/esm/util.native.js.map +1 -1
- package/dist/jsx/auth.mjs +22 -27
- package/dist/jsx/auth.mjs.map +1 -1
- package/dist/jsx/auth.native.cjs +97 -0
- package/dist/jsx/auth.native.js +77 -82
- package/dist/jsx/auth.native.js.map +1 -1
- package/dist/jsx/call.mjs +19 -18
- package/dist/jsx/call.mjs.map +1 -1
- package/dist/jsx/call.native.cjs +92 -0
- package/dist/jsx/call.native.js +72 -71
- package/dist/jsx/call.native.js.map +1 -1
- package/dist/jsx/collection.mjs +228 -268
- package/dist/jsx/collection.mjs.map +1 -1
- package/dist/jsx/collection.native.cjs +461 -0
- package/dist/jsx/collection.native.js +436 -499
- package/dist/jsx/collection.native.js.map +1 -1
- package/dist/jsx/common/types.mjs +0 -2
- package/dist/jsx/common/types.native.cjs +18 -0
- package/dist/jsx/common/types.native.js +9 -10
- package/dist/jsx/common/types.native.js.map +1 -1
- package/dist/jsx/connectionKey.mjs +5 -4
- package/dist/jsx/connectionKey.mjs.map +1 -1
- package/dist/jsx/connectionKey.native.cjs +32 -0
- package/dist/jsx/connectionKey.native.js +19 -22
- package/dist/jsx/connectionKey.native.js.map +1 -1
- package/dist/jsx/core/http.mjs +383 -382
- package/dist/jsx/core/http.mjs.map +1 -1
- package/dist/jsx/core/http.native.cjs +659 -0
- package/dist/jsx/core/http.native.js +611 -615
- package/dist/jsx/core/http.native.js.map +1 -1
- package/dist/jsx/core/serverMessages.mjs +34 -26
- package/dist/jsx/core/serverMessages.mjs.map +1 -1
- package/dist/jsx/core/serverMessages.native.cjs +89 -0
- package/dist/jsx/core/serverMessages.native.js +69 -70
- package/dist/jsx/core/serverMessages.native.js.map +1 -1
- package/dist/jsx/core/sessionGate.mjs +79 -79
- package/dist/jsx/core/sessionGate.mjs.map +1 -1
- package/dist/jsx/core/sessionGate.native.cjs +270 -0
- package/dist/jsx/core/sessionGate.native.js +220 -232
- package/dist/jsx/core/sessionGate.native.js.map +1 -1
- package/dist/jsx/core/types.mjs +23 -22
- package/dist/jsx/core/types.mjs.map +1 -1
- package/dist/jsx/core/types.native.cjs +169 -0
- package/dist/jsx/core/types.native.js +129 -136
- package/dist/jsx/core/types.native.js.map +1 -1
- package/dist/jsx/core/wire.mjs +10 -9
- package/dist/jsx/core/wire.mjs.map +1 -1
- package/dist/jsx/core/wire.native.cjs +53 -0
- package/dist/jsx/core/wire.native.js +28 -29
- package/dist/jsx/core/wire.native.js.map +1 -1
- package/dist/jsx/db.mjs +421 -432
- package/dist/jsx/db.mjs.map +1 -1
- package/dist/jsx/db.native.cjs +625 -0
- package/dist/jsx/db.native.js +583 -590
- package/dist/jsx/db.native.js.map +1 -1
- package/dist/jsx/devtools/FrappeDevtoolsPanel.mjs +762 -781
- package/dist/jsx/devtools/FrappeDevtoolsPanel.mjs.map +1 -1
- package/dist/jsx/devtools/FrappeDevtoolsPanel.native.cjs +878 -0
- package/dist/jsx/devtools/FrappeDevtoolsPanel.native.js +821 -862
- package/dist/jsx/devtools/FrappeDevtoolsPanel.native.js.map +1 -1
- package/dist/jsx/devtools/index.mjs +2 -2
- package/dist/jsx/devtools/index.native.cjs +30 -0
- package/dist/jsx/devtools/index.native.js +15 -16
- package/dist/jsx/devtools/index.native.js.map +1 -1
- package/dist/jsx/devtools/plugin.mjs +10 -8
- package/dist/jsx/devtools/plugin.mjs.map +1 -1
- package/dist/jsx/devtools/plugin.native.cjs +46 -0
- package/dist/jsx/devtools/plugin.native.js +27 -35
- package/dist/jsx/devtools/plugin.native.js.map +1 -1
- package/dist/jsx/devtools/theme.mjs +27 -26
- package/dist/jsx/devtools/theme.mjs.map +1 -1
- package/dist/jsx/devtools/theme.native.cjs +53 -0
- package/dist/jsx/devtools/theme.native.js +40 -43
- package/dist/jsx/devtools/theme.native.js.map +1 -1
- package/dist/jsx/doctype.mjs +473 -416
- package/dist/jsx/doctype.mjs.map +1 -1
- package/dist/jsx/doctype.native.cjs +631 -0
- package/dist/jsx/doctype.native.js +587 -563
- package/dist/jsx/doctype.native.js.map +1 -1
- package/dist/jsx/file.mjs +15 -14
- package/dist/jsx/file.mjs.map +1 -1
- package/dist/jsx/file.native.cjs +78 -0
- package/dist/jsx/file.native.js +58 -62
- package/dist/jsx/file.native.js.map +1 -1
- package/dist/jsx/fixtureDb.mjs +175 -191
- package/dist/jsx/fixtureDb.mjs.map +1 -1
- package/dist/jsx/fixtureDb.native.cjs +313 -0
- package/dist/jsx/fixtureDb.native.js +291 -300
- package/dist/jsx/fixtureDb.native.js.map +1 -1
- package/dist/jsx/fixtures.mjs +161 -175
- package/dist/jsx/fixtures.mjs.map +1 -1
- package/dist/jsx/fixtures.native.cjs +379 -0
- package/dist/jsx/fixtures.native.js +359 -381
- package/dist/jsx/fixtures.native.js.map +1 -1
- package/dist/jsx/frappeApp.mjs +82 -83
- package/dist/jsx/frappeApp.mjs.map +1 -1
- package/dist/jsx/frappeApp.native.cjs +181 -0
- package/dist/jsx/frappeApp.native.js +153 -152
- package/dist/jsx/frappeApp.native.js.map +1 -1
- package/dist/jsx/frappeReact.mjs +535 -504
- package/dist/jsx/frappeReact.mjs.map +1 -1
- package/dist/jsx/frappeReact.native.cjs +710 -0
- package/dist/jsx/frappeReact.native.js +636 -631
- package/dist/jsx/frappeReact.native.js.map +1 -1
- package/dist/jsx/index.gnome.mjs +5 -5
- package/dist/jsx/index.gnome.native.cjs +87 -0
- package/dist/jsx/index.gnome.native.js +61 -62
- package/dist/jsx/index.gnome.native.js.map +1 -1
- package/dist/jsx/index.js +17 -18
- package/dist/jsx/index.mjs +17 -18
- package/dist/jsx/index.native.cjs +171 -0
- package/dist/jsx/index.native.js +128 -134
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/optimistic.mjs +19 -19
- package/dist/jsx/optimistic.mjs.map +1 -1
- package/dist/jsx/optimistic.native.cjs +59 -0
- package/dist/jsx/optimistic.native.js +38 -41
- package/dist/jsx/optimistic.native.js.map +1 -1
- package/dist/jsx/pacer.mjs +156 -158
- package/dist/jsx/pacer.mjs.map +1 -1
- package/dist/jsx/pacer.native.cjs +263 -0
- package/dist/jsx/pacer.native.js +234 -245
- package/dist/jsx/pacer.native.js.map +1 -1
- package/dist/jsx/plugin/index.mjs +91 -94
- package/dist/jsx/plugin/index.mjs.map +1 -1
- package/dist/jsx/plugin/index.native.cjs +178 -0
- package/dist/jsx/plugin/index.native.js +164 -177
- package/dist/jsx/plugin/index.native.js.map +1 -1
- package/dist/jsx/realtime.mjs +569 -594
- package/dist/jsx/realtime.mjs.map +1 -1
- package/dist/jsx/realtime.native.cjs +945 -0
- package/dist/jsx/realtime.native.js +918 -928
- package/dist/jsx/realtime.native.js.map +1 -1
- package/dist/jsx/serverLoaders.mjs +47 -61
- package/dist/jsx/serverLoaders.mjs.map +1 -1
- package/dist/jsx/serverLoaders.native.cjs +103 -0
- package/dist/jsx/serverLoaders.native.js +73 -95
- package/dist/jsx/serverLoaders.native.js.map +1 -1
- package/dist/jsx/sync/backfill.mjs +268 -284
- package/dist/jsx/sync/backfill.mjs.map +1 -1
- package/dist/jsx/sync/backfill.native.cjs +475 -0
- package/dist/jsx/sync/backfill.native.js +449 -465
- package/dist/jsx/sync/backfill.native.js.map +1 -1
- package/dist/jsx/sync/filters.mjs +286 -241
- package/dist/jsx/sync/filters.mjs.map +1 -1
- package/dist/jsx/sync/filters.native.cjs +472 -0
- package/dist/jsx/sync/filters.native.js +426 -398
- package/dist/jsx/sync/filters.native.js.map +1 -1
- package/dist/jsx/sync/index.mjs +465 -479
- package/dist/jsx/sync/index.mjs.map +1 -1
- package/dist/jsx/sync/index.native.cjs +771 -0
- package/dist/jsx/sync/index.native.js +738 -737
- package/dist/jsx/sync/index.native.js.map +1 -1
- package/dist/jsx/sync/merge.mjs +368 -366
- package/dist/jsx/sync/merge.mjs.map +1 -1
- package/dist/jsx/sync/merge.native.cjs +681 -0
- package/dist/jsx/sync/merge.native.js +642 -673
- package/dist/jsx/sync/merge.native.js.map +1 -1
- package/dist/jsx/sync/mutationEngine.mjs +775 -814
- package/dist/jsx/sync/mutationEngine.mjs.map +1 -1
- package/dist/jsx/sync/mutationEngine.native.cjs +1190 -0
- package/dist/jsx/sync/mutationEngine.native.js +1162 -1216
- package/dist/jsx/sync/mutationEngine.native.js.map +1 -1
- package/dist/jsx/sync/mutationJournal.mjs +135 -133
- package/dist/jsx/sync/mutationJournal.mjs.map +1 -1
- package/dist/jsx/sync/mutationJournal.native.cjs +302 -0
- package/dist/jsx/sync/mutationJournal.native.js +278 -269
- package/dist/jsx/sync/mutationJournal.native.js.map +1 -1
- package/dist/jsx/sync/normalizedCache.mjs +115 -117
- package/dist/jsx/sync/normalizedCache.mjs.map +1 -1
- package/dist/jsx/sync/normalizedCache.native.cjs +232 -0
- package/dist/jsx/sync/normalizedCache.native.js +212 -212
- package/dist/jsx/sync/normalizedCache.native.js.map +1 -1
- package/dist/jsx/sync/persistence.mjs +637 -645
- package/dist/jsx/sync/persistence.mjs.map +1 -1
- package/dist/jsx/sync/persistence.native.cjs +996 -0
- package/dist/jsx/sync/persistence.native.js +967 -965
- package/dist/jsx/sync/persistence.native.js.map +1 -1
- package/dist/jsx/sync/realtime.mjs +296 -298
- package/dist/jsx/sync/realtime.mjs.map +1 -1
- package/dist/jsx/sync/realtime.native.cjs +486 -0
- package/dist/jsx/sync/realtime.native.js +465 -461
- package/dist/jsx/sync/realtime.native.js.map +1 -1
- package/dist/jsx/sync/rehydration.mjs +268 -304
- package/dist/jsx/sync/rehydration.mjs.map +1 -1
- package/dist/jsx/sync/rehydration.native.cjs +495 -0
- package/dist/jsx/sync/rehydration.native.js +473 -515
- package/dist/jsx/sync/rehydration.native.js.map +1 -1
- package/dist/jsx/sync/storage.mjs +115 -113
- package/dist/jsx/sync/storage.mjs.map +1 -1
- package/dist/jsx/sync/storage.native.cjs +211 -0
- package/dist/jsx/sync/storage.native.js +188 -184
- package/dist/jsx/sync/storage.native.js.map +1 -1
- package/dist/jsx/sync/subscriptionManager.mjs +675 -691
- package/dist/jsx/sync/subscriptionManager.mjs.map +1 -1
- package/dist/jsx/sync/subscriptionManager.native.cjs +1205 -0
- package/dist/jsx/sync/subscriptionManager.native.js +1179 -1220
- package/dist/jsx/sync/subscriptionManager.native.js.map +1 -1
- package/dist/jsx/sync/types.mjs +56 -55
- package/dist/jsx/sync/types.mjs.map +1 -1
- package/dist/jsx/sync/types.native.cjs +103 -0
- package/dist/jsx/sync/types.native.js +89 -90
- package/dist/jsx/sync/types.native.js.map +1 -1
- package/dist/jsx/sync/virtualPageManager.mjs +749 -789
- package/dist/jsx/sync/virtualPageManager.mjs.map +1 -1
- package/dist/jsx/sync/virtualPageManager.native.cjs +1097 -0
- package/dist/jsx/sync/virtualPageManager.native.js +1072 -1097
- package/dist/jsx/sync/virtualPageManager.native.js.map +1 -1
- package/dist/jsx/syncOptionsKey.mjs +25 -27
- package/dist/jsx/syncOptionsKey.mjs.map +1 -1
- package/dist/jsx/syncOptionsKey.native.cjs +69 -0
- package/dist/jsx/syncOptionsKey.native.js +51 -63
- package/dist/jsx/syncOptionsKey.native.js.map +1 -1
- package/dist/jsx/useLiveQuery.mjs +2 -2
- package/dist/jsx/useLiveQuery.native.cjs +26 -0
- package/dist/jsx/useLiveQuery.native.js +14 -17
- package/dist/jsx/useLiveQuery.native.js.map +1 -1
- package/dist/jsx/util.mjs +9 -7
- package/dist/jsx/util.mjs.map +1 -1
- package/dist/jsx/util.native.cjs +40 -0
- package/dist/jsx/util.native.js +22 -28
- package/dist/jsx/util.native.js.map +1 -1
- package/package.json +10 -10
- package/src/devtools/FrappeDevtoolsPanel.stories.tsx +16 -16
- package/src/devtools/plugin.stories.tsx +4 -4
- package/src/useFrappeCollection.stories.tsx +14 -14
- package/src/useFrappeInfiniteList.stories.tsx +11 -11
- package/src/useFrappePendingMutations.stories.tsx +12 -12
- package/types/devtools/FrappeDevtoolsPanel.d.ts +2 -1
- package/types/devtools/FrappeDevtoolsPanel.d.ts.map +1 -1
- package/types/devtools/plugin.d.ts +2 -1
- package/types/devtools/plugin.d.ts.map +1 -1
- package/dist/esm/common/types.mjs.map +0 -1
- package/dist/esm/common/types.native.js.map +0 -1
- package/dist/esm/devtools/index.mjs.map +0 -1
- package/dist/esm/devtools/index.native.js.map +0 -1
- package/dist/esm/index.gnome.mjs.map +0 -1
- package/dist/esm/index.gnome.native.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/useLiveQuery.mjs.map +0 -1
- package/dist/esm/useLiveQuery.native.js.map +0 -1
- package/dist/jsx/common/types.mjs.map +0 -1
- package/dist/jsx/devtools/index.mjs.map +0 -1
- package/dist/jsx/index.gnome.mjs.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/useLiveQuery.mjs.map +0 -1
|
@@ -5,489 +5,473 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
23
|
var backfill_exports = {};
|
|
26
24
|
__export(backfill_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
BackfillManager: () => BackfillManager,
|
|
26
|
+
BackfillReason: () => BackfillReason,
|
|
27
|
+
BackfillStrategy: () => BackfillStrategy
|
|
30
28
|
});
|
|
31
29
|
module.exports = __toCommonJS(backfill_exports);
|
|
32
30
|
var import_filters = require("./filters.native.js");
|
|
33
31
|
function _class_call_check(instance, Constructor) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
if (!(instance instanceof Constructor)) {
|
|
33
|
+
throw new TypeError("Cannot call a class as a function");
|
|
34
|
+
}
|
|
37
35
|
}
|
|
38
36
|
function _defineProperties(target, props) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
for (var i = 0; i < props.length; i++) {
|
|
38
|
+
var descriptor = props[i];
|
|
39
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
40
|
+
descriptor.configurable = true;
|
|
41
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
42
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
43
|
+
}
|
|
46
44
|
}
|
|
47
45
|
function _create_class(Constructor, protoProps, staticProps) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
47
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
48
|
+
return Constructor;
|
|
51
49
|
}
|
|
52
50
|
function _define_property(obj, key, value) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
if (key in obj) {
|
|
52
|
+
Object.defineProperty(obj, key, {
|
|
53
|
+
value,
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
obj[key] = value;
|
|
60
|
+
}
|
|
61
|
+
return obj;
|
|
64
62
|
}
|
|
65
63
|
function calculateCheckpointFromDocs(docs) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
return maxTimestamp || void 0;
|
|
64
|
+
if (docs.length === 0) return void 0;
|
|
65
|
+
var maxTimestamp = "";
|
|
66
|
+
var maxDate = null;
|
|
67
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
68
|
+
try {
|
|
69
|
+
for (var _iterator = docs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
70
|
+
var doc = _step.value;
|
|
71
|
+
var modified = doc.modified;
|
|
72
|
+
if (!modified) continue;
|
|
73
|
+
try {
|
|
74
|
+
var date = new Date(modified);
|
|
75
|
+
if (Number.isNaN(date.getTime())) continue;
|
|
76
|
+
if (!maxDate || date > maxDate) {
|
|
77
|
+
maxDate = date;
|
|
78
|
+
maxTimestamp = modified;
|
|
79
|
+
}
|
|
80
|
+
} catch (unused) {
|
|
81
|
+
if (!maxTimestamp || modified > maxTimestamp) {
|
|
82
|
+
maxTimestamp = modified;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} catch (err) {
|
|
87
|
+
_didIteratorError = true;
|
|
88
|
+
_iteratorError = err;
|
|
89
|
+
} finally {
|
|
90
|
+
try {
|
|
91
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
92
|
+
_iterator.return();
|
|
93
|
+
}
|
|
94
|
+
} finally {
|
|
95
|
+
if (_didIteratorError) {
|
|
96
|
+
throw _iteratorError;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return maxTimestamp || void 0;
|
|
105
101
|
}
|
|
106
102
|
var log = console;
|
|
107
|
-
var BackfillReason = /* @__PURE__ */
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}({});
|
|
118
|
-
var BackfillStrategy = /* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}({});
|
|
126
|
-
var BackfillManager = /* @__PURE__ */
|
|
127
|
-
|
|
103
|
+
var BackfillReason = /* @__PURE__ */ (function(BackfillReason2) {
|
|
104
|
+
BackfillReason2["DeleteGap"] = "delete-gap";
|
|
105
|
+
BackfillReason2["Initial"] = "initial";
|
|
106
|
+
BackfillReason2["Pagination"] = "pagination";
|
|
107
|
+
BackfillReason2["Periodic"] = "periodic";
|
|
108
|
+
BackfillReason2["Recovery"] = "recovery";
|
|
109
|
+
BackfillReason2["Rehydration"] = "rehydration";
|
|
110
|
+
BackfillReason2["RemoteCreate"] = "remote-create";
|
|
111
|
+
BackfillReason2["RemoteUpdate"] = "remote-update";
|
|
112
|
+
return BackfillReason2;
|
|
113
|
+
})({});
|
|
114
|
+
var BackfillStrategy = /* @__PURE__ */ (function(BackfillStrategy2) {
|
|
115
|
+
BackfillStrategy2["CursorFetch"] = "cursor-fetch";
|
|
116
|
+
BackfillStrategy2["FullRefresh"] = "full-refresh";
|
|
117
|
+
BackfillStrategy2["GapFill"] = "gap-fill";
|
|
118
|
+
BackfillStrategy2["Incremental"] = "incremental";
|
|
119
|
+
BackfillStrategy2["PageOnly"] = "page-only";
|
|
120
|
+
return BackfillStrategy2;
|
|
121
|
+
})({});
|
|
122
|
+
var BackfillManager = /* @__PURE__ */ (function() {
|
|
123
|
+
"use strict";
|
|
124
|
+
function BackfillManager2(db, normalizedCache) {
|
|
125
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
126
|
+
_class_call_check(this, BackfillManager2);
|
|
127
|
+
_define_property(this, "activeBackfills", /* @__PURE__ */ new Map());
|
|
128
|
+
_define_property(this, "backfillQueue", /* @__PURE__ */ new Map());
|
|
129
|
+
_define_property(this, "db", void 0);
|
|
130
|
+
_define_property(this, "normalizedCache", void 0);
|
|
131
|
+
_define_property(this, "options", void 0);
|
|
132
|
+
this.db = db;
|
|
133
|
+
this.normalizedCache = normalizedCache;
|
|
134
|
+
this.options = options;
|
|
135
|
+
}
|
|
136
|
+
_create_class(BackfillManager2, [
|
|
137
|
+
{
|
|
138
|
+
key: "backfill",
|
|
139
|
+
value: async function backfill(subscription, reason) {
|
|
140
|
+
var subscriptionId = subscription.id;
|
|
141
|
+
if (this.activeBackfills.has(subscriptionId)) {
|
|
142
|
+
this.queueBackfill(subscriptionId, reason);
|
|
143
|
+
return this.activeBackfills.get(subscriptionId);
|
|
144
|
+
}
|
|
145
|
+
var backfillPromise = this.performBackfill(subscription, reason);
|
|
146
|
+
this.activeBackfills.set(subscriptionId, backfillPromise);
|
|
147
|
+
var backfillSucceeded = false;
|
|
148
|
+
try {
|
|
149
|
+
await backfillPromise;
|
|
150
|
+
backfillSucceeded = true;
|
|
151
|
+
} catch (err) {
|
|
152
|
+
log.error(err);
|
|
153
|
+
} finally {
|
|
154
|
+
this.activeBackfills.delete(subscriptionId);
|
|
155
|
+
if (backfillSucceeded) {
|
|
156
|
+
var queued = this.backfillQueue.get(subscriptionId);
|
|
157
|
+
if (queued && queued.length > 0) {
|
|
158
|
+
var _$reason = queued.shift();
|
|
159
|
+
if (queued.length === 0) this.backfillQueue.delete(subscriptionId);
|
|
160
|
+
if (_$reason) this.backfill(subscription, _$reason).catch(log.error);
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
this.backfillQueue.delete(subscriptionId);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
key: "backfillOne",
|
|
170
|
+
value: (
|
|
171
|
+
/**
|
|
172
|
+
* Backfill one item to fill a gap
|
|
173
|
+
*/
|
|
174
|
+
async function backfillOne(subscription) {
|
|
175
|
+
if (!subscription.getProgressiveCache().hasMore) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
var docs = await this.fetchWithCursor(subscription, 1);
|
|
180
|
+
if (docs.length > 0) {
|
|
181
|
+
var doc = docs[0];
|
|
182
|
+
subscription.processDocuments([doc], this.normalizedCache, { calculateCheckpoint: false });
|
|
183
|
+
return doc;
|
|
184
|
+
}
|
|
185
|
+
subscription.updateProgressiveCache({ hasMore: false });
|
|
186
|
+
return null;
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error("Failed to backfill one item:", error);
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
key: "rehydrateCurrentPage",
|
|
195
|
+
value: (
|
|
196
|
+
/**
|
|
197
|
+
* Rehydrate current page
|
|
198
|
+
*/
|
|
199
|
+
async function rehydrateCurrentPage(subscription) {
|
|
200
|
+
var pageSize = subscription.viewWindow.pageSize;
|
|
201
|
+
var currentPage = subscription.viewWindow.currentPage;
|
|
202
|
+
var start = (currentPage - 1) * pageSize;
|
|
203
|
+
try {
|
|
204
|
+
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
205
|
+
fields: subscription.query.fields,
|
|
206
|
+
filters: subscription.query.filters,
|
|
207
|
+
orderBy: subscription.query.orderBy,
|
|
208
|
+
limitStart: start,
|
|
209
|
+
limit: pageSize
|
|
210
|
+
});
|
|
211
|
+
var newDocIds = response.map(function(doc2) {
|
|
212
|
+
return doc2.name;
|
|
213
|
+
});
|
|
214
|
+
var currentDocIds = subscription.getProgressiveCache().docIds;
|
|
215
|
+
var updatedDocIds = [...currentDocIds];
|
|
216
|
+
updatedDocIds.splice(start, pageSize, ...newDocIds);
|
|
217
|
+
subscription.updateProgressiveCache({ docIds: updatedDocIds });
|
|
218
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
219
|
+
try {
|
|
220
|
+
for (var _iterator = response[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
221
|
+
var doc = _step.value;
|
|
222
|
+
this.normalizedCache.upsert(doc);
|
|
223
|
+
}
|
|
224
|
+
} catch (err) {
|
|
225
|
+
_didIteratorError = true;
|
|
226
|
+
_iteratorError = err;
|
|
227
|
+
} finally {
|
|
228
|
+
try {
|
|
229
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
230
|
+
_iterator.return();
|
|
231
|
+
}
|
|
232
|
+
} finally {
|
|
233
|
+
if (_didIteratorError) {
|
|
234
|
+
throw _iteratorError;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
subscription.needsRehydration = false;
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error("Failed to rehydrate current page:", error);
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
key: "performBackfill",
|
|
247
|
+
value: async function performBackfill(subscription, reason) {
|
|
248
|
+
var strategy = this.determineStrategy(subscription, reason);
|
|
249
|
+
switch (strategy) {
|
|
250
|
+
case "full-refresh":
|
|
251
|
+
await this.fullRefresh(subscription);
|
|
252
|
+
break;
|
|
253
|
+
case "incremental":
|
|
254
|
+
await this.incrementalBackfill(subscription);
|
|
255
|
+
break;
|
|
256
|
+
case "page-only":
|
|
257
|
+
await this.pageBackfill(subscription);
|
|
258
|
+
break;
|
|
259
|
+
case "gap-fill":
|
|
260
|
+
await this.gapBackfill(subscription);
|
|
261
|
+
break;
|
|
262
|
+
case "cursor-fetch":
|
|
263
|
+
await this.cursorFetch(subscription);
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "determineStrategy",
|
|
270
|
+
value: function determineStrategy(subscription, reason) {
|
|
271
|
+
switch (reason) {
|
|
272
|
+
case "initial": return "full-refresh";
|
|
273
|
+
case "pagination": return subscription.getProgressiveCache().nextCursor ? "cursor-fetch" : "incremental";
|
|
274
|
+
case "delete-gap": return "gap-fill";
|
|
275
|
+
case "remote-create":
|
|
276
|
+
case "remote-update":
|
|
277
|
+
case "rehydration": return "page-only";
|
|
278
|
+
case "periodic": return subscription.checkpoint ? "incremental" : "full-refresh";
|
|
279
|
+
case "recovery": return subscription.checkpoint ? "incremental" : "full-refresh";
|
|
280
|
+
default: return "incremental";
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: "fullRefresh",
|
|
286
|
+
value: async function fullRefresh(subscription) {
|
|
287
|
+
var batchSize = this.options.batchSize || this.options.pageSize || 100;
|
|
288
|
+
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
289
|
+
fields: subscription.query.fields,
|
|
290
|
+
filters: subscription.query.filters,
|
|
291
|
+
orderBy: subscription.query.orderBy,
|
|
292
|
+
limit: batchSize,
|
|
293
|
+
limitStart: 0
|
|
294
|
+
});
|
|
295
|
+
subscription.processDocuments(response, this.normalizedCache);
|
|
296
|
+
subscription.updateProgressiveCache({ hasMore: response.length === batchSize });
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
key: "incrementalBackfill",
|
|
301
|
+
value: async function incrementalBackfill(subscription) {
|
|
302
|
+
if (!subscription.checkpoint) {
|
|
303
|
+
return this.fullRefresh(subscription);
|
|
304
|
+
}
|
|
305
|
+
try {
|
|
306
|
+
var _this_options_maxPages;
|
|
307
|
+
var maxPages = (_this_options_maxPages = this.options.maxPages) !== null && _this_options_maxPages !== void 0 ? _this_options_maxPages : 20;
|
|
308
|
+
for (var page = 0; page < maxPages; page++) {
|
|
309
|
+
var _response_checkpoint, _ref;
|
|
310
|
+
var _response_deleted;
|
|
311
|
+
var response = await this.db.backfill({
|
|
312
|
+
doctype: subscription.query.doctype,
|
|
313
|
+
fields: subscription.query.fields,
|
|
314
|
+
filters: subscription.query.filters,
|
|
315
|
+
modifiedAfter: subscription.checkpoint,
|
|
316
|
+
limit: this.options.pageSize || 200
|
|
317
|
+
});
|
|
318
|
+
if ("deleted" in response && Array.isArray(response.deleted)) {
|
|
319
|
+
var deletedDocIds = response.deleted.filter(function(deletion) {
|
|
320
|
+
return deletion === null || deletion === void 0 ? void 0 : deletion.name;
|
|
321
|
+
}).map(function(deletion) {
|
|
322
|
+
return deletion.name;
|
|
323
|
+
});
|
|
324
|
+
if (deletedDocIds.length > 0) {
|
|
325
|
+
subscription.removeDocuments(deletedDocIds, this.normalizedCache);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
329
|
+
try {
|
|
330
|
+
for (var _iterator = response.rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
331
|
+
var doc = _step.value;
|
|
332
|
+
var exists = subscription.getProgressiveCache().docIds.includes(doc.name);
|
|
333
|
+
var matches = (0, import_filters.matchesFilters)(doc, subscription.query.filters);
|
|
334
|
+
if (exists && !matches) {
|
|
335
|
+
subscription.removeDocuments([doc.name], this.normalizedCache);
|
|
336
|
+
} else if (!exists && matches) {
|
|
337
|
+
subscription.needsRehydration = true;
|
|
338
|
+
} else if (exists) {
|
|
339
|
+
this.normalizedCache.upsert(doc);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
} catch (err) {
|
|
343
|
+
_didIteratorError = true;
|
|
344
|
+
_iteratorError = err;
|
|
345
|
+
} finally {
|
|
346
|
+
try {
|
|
347
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
348
|
+
_iterator.return();
|
|
349
|
+
}
|
|
350
|
+
} finally {
|
|
351
|
+
if (_didIteratorError) {
|
|
352
|
+
throw _iteratorError;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
subscription.checkpoint = (_response_checkpoint = response.checkpoint) !== null && _response_checkpoint !== void 0 ? _response_checkpoint : calculateCheckpointFromDocs(response.rows);
|
|
357
|
+
var madeProgress = response.rows.length > 0 || ((_ref = (_response_deleted = response.deleted) === null || _response_deleted === void 0 ? void 0 : _response_deleted.length) !== null && _ref !== void 0 ? _ref : 0) > 0;
|
|
358
|
+
if (!response.has_more || !response.checkpoint || !madeProgress) break;
|
|
359
|
+
}
|
|
360
|
+
} catch (error) {
|
|
361
|
+
console.error("Incremental backfill failed:", error);
|
|
362
|
+
await this.fullRefresh(subscription);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
key: "pageBackfill",
|
|
368
|
+
value: async function pageBackfill(subscription) {
|
|
369
|
+
var pageSize = subscription.viewWindow.pageSize;
|
|
370
|
+
var currentPage = subscription.viewWindow.currentPage;
|
|
371
|
+
var start = (currentPage - 1) * pageSize;
|
|
372
|
+
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
373
|
+
fields: subscription.query.fields,
|
|
374
|
+
filters: subscription.query.filters,
|
|
375
|
+
orderBy: subscription.query.orderBy,
|
|
376
|
+
limitStart: start,
|
|
377
|
+
limit: pageSize
|
|
378
|
+
});
|
|
379
|
+
var newDocIds = response.map(function(doc2) {
|
|
380
|
+
return doc2.name;
|
|
381
|
+
});
|
|
382
|
+
var currentDocIds = subscription.getProgressiveCache().docIds;
|
|
383
|
+
var updatedDocIds = [...currentDocIds];
|
|
384
|
+
updatedDocIds.splice(start, pageSize, ...newDocIds);
|
|
385
|
+
subscription.updateProgressiveCache({ docIds: updatedDocIds });
|
|
386
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
387
|
+
try {
|
|
388
|
+
for (var _iterator = response[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
389
|
+
var doc = _step.value;
|
|
390
|
+
this.normalizedCache.upsert(doc);
|
|
391
|
+
}
|
|
392
|
+
} catch (err) {
|
|
393
|
+
_didIteratorError = true;
|
|
394
|
+
_iteratorError = err;
|
|
395
|
+
} finally {
|
|
396
|
+
try {
|
|
397
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
398
|
+
_iterator.return();
|
|
399
|
+
}
|
|
400
|
+
} finally {
|
|
401
|
+
if (_didIteratorError) {
|
|
402
|
+
throw _iteratorError;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
subscription.needsRehydration = false;
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
key: "gapBackfill",
|
|
411
|
+
value: async function gapBackfill(subscription) {
|
|
412
|
+
await this.backfillOne(subscription);
|
|
413
|
+
subscription.pendingBackfill = false;
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
key: "cursorFetch",
|
|
418
|
+
value: async function cursorFetch(subscription) {
|
|
419
|
+
if (!subscription.getProgressiveCache().hasMore) return;
|
|
420
|
+
var batchSize = this.options.batchSize || this.options.pageSize || 100;
|
|
421
|
+
var docs = await this.fetchWithCursor(subscription, batchSize);
|
|
422
|
+
subscription.updateProgressiveCache({
|
|
423
|
+
docIds: [...subscription.getProgressiveCache().docIds, ...docs.map(function(doc2) {
|
|
424
|
+
return doc2.name;
|
|
425
|
+
})],
|
|
426
|
+
nextCursor: docs.length > 0 ? docs[docs.length - 1].name : subscription.getProgressiveCache().nextCursor,
|
|
427
|
+
hasMore: docs.length === batchSize
|
|
428
|
+
});
|
|
429
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
430
|
+
try {
|
|
431
|
+
for (var _iterator = docs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
432
|
+
var doc = _step.value;
|
|
433
|
+
this.normalizedCache.upsert(doc);
|
|
434
|
+
}
|
|
435
|
+
} catch (err) {
|
|
436
|
+
_didIteratorError = true;
|
|
437
|
+
_iteratorError = err;
|
|
438
|
+
} finally {
|
|
439
|
+
try {
|
|
440
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
441
|
+
_iterator.return();
|
|
442
|
+
}
|
|
443
|
+
} finally {
|
|
444
|
+
if (_didIteratorError) {
|
|
445
|
+
throw _iteratorError;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
key: "fetchWithCursor",
|
|
453
|
+
value: async function fetchWithCursor(subscription, limit) {
|
|
454
|
+
return this.db.getDocList(subscription.query.doctype, {
|
|
455
|
+
fields: subscription.query.fields,
|
|
456
|
+
filters: subscription.query.filters,
|
|
457
|
+
orderBy: subscription.query.orderBy,
|
|
458
|
+
cursor: subscription.getProgressiveCache().nextCursor,
|
|
459
|
+
limit
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
key: "queueBackfill",
|
|
465
|
+
value: function queueBackfill(subscriptionId, reason) {
|
|
466
|
+
if (!this.backfillQueue.has(subscriptionId)) {
|
|
467
|
+
this.backfillQueue.set(subscriptionId, []);
|
|
468
|
+
}
|
|
469
|
+
var queue = this.backfillQueue.get(subscriptionId);
|
|
470
|
+
if (!queue.includes(reason)) queue.push(reason);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
]);
|
|
474
|
+
return BackfillManager2;
|
|
475
|
+
})();
|
|
128
476
|
|
|
129
|
-
function BackfillManager2(db, normalizedCache) {
|
|
130
|
-
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
131
|
-
_class_call_check(this, BackfillManager2);
|
|
132
|
-
_define_property(this, "activeBackfills", /* @__PURE__ */new Map());
|
|
133
|
-
_define_property(this, "backfillQueue", /* @__PURE__ */new Map());
|
|
134
|
-
_define_property(this, "db", void 0);
|
|
135
|
-
_define_property(this, "normalizedCache", void 0);
|
|
136
|
-
_define_property(this, "options", void 0);
|
|
137
|
-
this.db = db;
|
|
138
|
-
this.normalizedCache = normalizedCache;
|
|
139
|
-
this.options = options;
|
|
140
|
-
}
|
|
141
|
-
_create_class(BackfillManager2, [{
|
|
142
|
-
key: "backfill",
|
|
143
|
-
value: async function backfill(subscription, reason) {
|
|
144
|
-
var subscriptionId = subscription.id;
|
|
145
|
-
if (this.activeBackfills.has(subscriptionId)) {
|
|
146
|
-
this.queueBackfill(subscriptionId, reason);
|
|
147
|
-
return this.activeBackfills.get(subscriptionId);
|
|
148
|
-
}
|
|
149
|
-
var backfillPromise = this.performBackfill(subscription, reason);
|
|
150
|
-
this.activeBackfills.set(subscriptionId, backfillPromise);
|
|
151
|
-
var backfillSucceeded = false;
|
|
152
|
-
try {
|
|
153
|
-
await backfillPromise;
|
|
154
|
-
backfillSucceeded = true;
|
|
155
|
-
} catch (err) {
|
|
156
|
-
log.error(err);
|
|
157
|
-
} finally {
|
|
158
|
-
this.activeBackfills.delete(subscriptionId);
|
|
159
|
-
if (backfillSucceeded) {
|
|
160
|
-
var queued = this.backfillQueue.get(subscriptionId);
|
|
161
|
-
if (queued && queued.length > 0) {
|
|
162
|
-
var _$reason = queued.shift();
|
|
163
|
-
if (queued.length === 0) this.backfillQueue.delete(subscriptionId);
|
|
164
|
-
if (_$reason) this.backfill(subscription, _$reason).catch(log.error);
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
this.backfillQueue.delete(subscriptionId);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}, {
|
|
172
|
-
key: "backfillOne",
|
|
173
|
-
value: (
|
|
174
|
-
/**
|
|
175
|
-
* Backfill one item to fill a gap
|
|
176
|
-
*/
|
|
177
|
-
async function backfillOne(subscription) {
|
|
178
|
-
if (!subscription.getProgressiveCache().hasMore) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
try {
|
|
182
|
-
var docs = await this.fetchWithCursor(subscription, 1);
|
|
183
|
-
if (docs.length > 0) {
|
|
184
|
-
var doc = docs[0];
|
|
185
|
-
subscription.processDocuments([doc], this.normalizedCache, {
|
|
186
|
-
calculateCheckpoint: false
|
|
187
|
-
});
|
|
188
|
-
return doc;
|
|
189
|
-
}
|
|
190
|
-
subscription.updateProgressiveCache({
|
|
191
|
-
hasMore: false
|
|
192
|
-
});
|
|
193
|
-
return null;
|
|
194
|
-
} catch (error) {
|
|
195
|
-
console.error("Failed to backfill one item:", error);
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
}, {
|
|
200
|
-
key: "rehydrateCurrentPage",
|
|
201
|
-
value: (
|
|
202
|
-
/**
|
|
203
|
-
* Rehydrate current page
|
|
204
|
-
*/
|
|
205
|
-
async function rehydrateCurrentPage(subscription) {
|
|
206
|
-
var pageSize = subscription.viewWindow.pageSize;
|
|
207
|
-
var currentPage = subscription.viewWindow.currentPage;
|
|
208
|
-
var start = (currentPage - 1) * pageSize;
|
|
209
|
-
try {
|
|
210
|
-
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
211
|
-
fields: subscription.query.fields,
|
|
212
|
-
filters: subscription.query.filters,
|
|
213
|
-
orderBy: subscription.query.orderBy,
|
|
214
|
-
limitStart: start,
|
|
215
|
-
limit: pageSize
|
|
216
|
-
});
|
|
217
|
-
var newDocIds = response.map(function (doc2) {
|
|
218
|
-
return doc2.name;
|
|
219
|
-
});
|
|
220
|
-
var currentDocIds = subscription.getProgressiveCache().docIds;
|
|
221
|
-
var updatedDocIds = [...currentDocIds];
|
|
222
|
-
updatedDocIds.splice(start, pageSize, ...newDocIds);
|
|
223
|
-
subscription.updateProgressiveCache({
|
|
224
|
-
docIds: updatedDocIds
|
|
225
|
-
});
|
|
226
|
-
var _iteratorNormalCompletion = true,
|
|
227
|
-
_didIteratorError = false,
|
|
228
|
-
_iteratorError = void 0;
|
|
229
|
-
try {
|
|
230
|
-
for (var _iterator = response[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
231
|
-
var doc = _step.value;
|
|
232
|
-
this.normalizedCache.upsert(doc);
|
|
233
|
-
}
|
|
234
|
-
} catch (err) {
|
|
235
|
-
_didIteratorError = true;
|
|
236
|
-
_iteratorError = err;
|
|
237
|
-
} finally {
|
|
238
|
-
try {
|
|
239
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
240
|
-
_iterator.return();
|
|
241
|
-
}
|
|
242
|
-
} finally {
|
|
243
|
-
if (_didIteratorError) {
|
|
244
|
-
throw _iteratorError;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
subscription.needsRehydration = false;
|
|
249
|
-
} catch (error) {
|
|
250
|
-
console.error("Failed to rehydrate current page:", error);
|
|
251
|
-
throw error;
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
}, {
|
|
255
|
-
key: "performBackfill",
|
|
256
|
-
value: async function performBackfill(subscription, reason) {
|
|
257
|
-
var strategy = this.determineStrategy(subscription, reason);
|
|
258
|
-
switch (strategy) {
|
|
259
|
-
case "full-refresh":
|
|
260
|
-
await this.fullRefresh(subscription);
|
|
261
|
-
break;
|
|
262
|
-
case "incremental":
|
|
263
|
-
await this.incrementalBackfill(subscription);
|
|
264
|
-
break;
|
|
265
|
-
case "page-only":
|
|
266
|
-
await this.pageBackfill(subscription);
|
|
267
|
-
break;
|
|
268
|
-
case "gap-fill":
|
|
269
|
-
await this.gapBackfill(subscription);
|
|
270
|
-
break;
|
|
271
|
-
case "cursor-fetch":
|
|
272
|
-
await this.cursorFetch(subscription);
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}, {
|
|
277
|
-
key: "determineStrategy",
|
|
278
|
-
value: function determineStrategy(subscription, reason) {
|
|
279
|
-
switch (reason) {
|
|
280
|
-
case "initial":
|
|
281
|
-
return "full-refresh";
|
|
282
|
-
case "pagination":
|
|
283
|
-
return subscription.getProgressiveCache().nextCursor ? "cursor-fetch" : "incremental";
|
|
284
|
-
case "delete-gap":
|
|
285
|
-
return "gap-fill";
|
|
286
|
-
case "remote-create":
|
|
287
|
-
case "remote-update":
|
|
288
|
-
case "rehydration":
|
|
289
|
-
return "page-only";
|
|
290
|
-
case "periodic":
|
|
291
|
-
return subscription.checkpoint ? "incremental" : "full-refresh";
|
|
292
|
-
case "recovery":
|
|
293
|
-
return subscription.checkpoint ? "incremental" : "full-refresh";
|
|
294
|
-
default:
|
|
295
|
-
return "incremental";
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}, {
|
|
299
|
-
key: "fullRefresh",
|
|
300
|
-
value: async function fullRefresh(subscription) {
|
|
301
|
-
var batchSize = this.options.batchSize || this.options.pageSize || 100;
|
|
302
|
-
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
303
|
-
fields: subscription.query.fields,
|
|
304
|
-
filters: subscription.query.filters,
|
|
305
|
-
orderBy: subscription.query.orderBy,
|
|
306
|
-
limit: batchSize,
|
|
307
|
-
limitStart: 0
|
|
308
|
-
});
|
|
309
|
-
subscription.processDocuments(response, this.normalizedCache);
|
|
310
|
-
subscription.updateProgressiveCache({
|
|
311
|
-
hasMore: response.length === batchSize
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}, {
|
|
315
|
-
key: "incrementalBackfill",
|
|
316
|
-
value: async function incrementalBackfill(subscription) {
|
|
317
|
-
if (!subscription.checkpoint) {
|
|
318
|
-
return this.fullRefresh(subscription);
|
|
319
|
-
}
|
|
320
|
-
try {
|
|
321
|
-
var _this_options_maxPages;
|
|
322
|
-
var maxPages = (_this_options_maxPages = this.options.maxPages) !== null && _this_options_maxPages !== void 0 ? _this_options_maxPages : 20;
|
|
323
|
-
for (var page = 0; page < maxPages; page++) {
|
|
324
|
-
var _response_checkpoint, _ref;
|
|
325
|
-
var _response_deleted;
|
|
326
|
-
var response = await this.db.backfill({
|
|
327
|
-
doctype: subscription.query.doctype,
|
|
328
|
-
fields: subscription.query.fields,
|
|
329
|
-
filters: subscription.query.filters,
|
|
330
|
-
modifiedAfter: subscription.checkpoint,
|
|
331
|
-
limit: this.options.pageSize || 200
|
|
332
|
-
});
|
|
333
|
-
if ("deleted" in response && Array.isArray(response.deleted)) {
|
|
334
|
-
var deletedDocIds = response.deleted.filter(function (deletion) {
|
|
335
|
-
return deletion === null || deletion === void 0 ? void 0 : deletion.name;
|
|
336
|
-
}).map(function (deletion) {
|
|
337
|
-
return deletion.name;
|
|
338
|
-
});
|
|
339
|
-
if (deletedDocIds.length > 0) {
|
|
340
|
-
subscription.removeDocuments(deletedDocIds, this.normalizedCache);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
var _iteratorNormalCompletion = true,
|
|
344
|
-
_didIteratorError = false,
|
|
345
|
-
_iteratorError = void 0;
|
|
346
|
-
try {
|
|
347
|
-
for (var _iterator = response.rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
348
|
-
var doc = _step.value;
|
|
349
|
-
var exists = subscription.getProgressiveCache().docIds.includes(doc.name);
|
|
350
|
-
var matches = (0, import_filters.matchesFilters)(doc, subscription.query.filters);
|
|
351
|
-
if (exists && !matches) {
|
|
352
|
-
subscription.removeDocuments([doc.name], this.normalizedCache);
|
|
353
|
-
} else if (!exists && matches) {
|
|
354
|
-
subscription.needsRehydration = true;
|
|
355
|
-
} else if (exists) {
|
|
356
|
-
this.normalizedCache.upsert(doc);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
} catch (err) {
|
|
360
|
-
_didIteratorError = true;
|
|
361
|
-
_iteratorError = err;
|
|
362
|
-
} finally {
|
|
363
|
-
try {
|
|
364
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
365
|
-
_iterator.return();
|
|
366
|
-
}
|
|
367
|
-
} finally {
|
|
368
|
-
if (_didIteratorError) {
|
|
369
|
-
throw _iteratorError;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
subscription.checkpoint = (_response_checkpoint = response.checkpoint) !== null && _response_checkpoint !== void 0 ? _response_checkpoint : calculateCheckpointFromDocs(response.rows);
|
|
374
|
-
var madeProgress = response.rows.length > 0 || ((_ref = (_response_deleted = response.deleted) === null || _response_deleted === void 0 ? void 0 : _response_deleted.length) !== null && _ref !== void 0 ? _ref : 0) > 0;
|
|
375
|
-
if (!response.has_more || !response.checkpoint || !madeProgress) break;
|
|
376
|
-
}
|
|
377
|
-
} catch (error) {
|
|
378
|
-
console.error("Incremental backfill failed:", error);
|
|
379
|
-
await this.fullRefresh(subscription);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}, {
|
|
383
|
-
key: "pageBackfill",
|
|
384
|
-
value: async function pageBackfill(subscription) {
|
|
385
|
-
var pageSize = subscription.viewWindow.pageSize;
|
|
386
|
-
var currentPage = subscription.viewWindow.currentPage;
|
|
387
|
-
var start = (currentPage - 1) * pageSize;
|
|
388
|
-
var response = await this.db.getDocList(subscription.query.doctype, {
|
|
389
|
-
fields: subscription.query.fields,
|
|
390
|
-
filters: subscription.query.filters,
|
|
391
|
-
orderBy: subscription.query.orderBy,
|
|
392
|
-
limitStart: start,
|
|
393
|
-
limit: pageSize
|
|
394
|
-
});
|
|
395
|
-
var newDocIds = response.map(function (doc2) {
|
|
396
|
-
return doc2.name;
|
|
397
|
-
});
|
|
398
|
-
var currentDocIds = subscription.getProgressiveCache().docIds;
|
|
399
|
-
var updatedDocIds = [...currentDocIds];
|
|
400
|
-
updatedDocIds.splice(start, pageSize, ...newDocIds);
|
|
401
|
-
subscription.updateProgressiveCache({
|
|
402
|
-
docIds: updatedDocIds
|
|
403
|
-
});
|
|
404
|
-
var _iteratorNormalCompletion = true,
|
|
405
|
-
_didIteratorError = false,
|
|
406
|
-
_iteratorError = void 0;
|
|
407
|
-
try {
|
|
408
|
-
for (var _iterator = response[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
409
|
-
var doc = _step.value;
|
|
410
|
-
this.normalizedCache.upsert(doc);
|
|
411
|
-
}
|
|
412
|
-
} catch (err) {
|
|
413
|
-
_didIteratorError = true;
|
|
414
|
-
_iteratorError = err;
|
|
415
|
-
} finally {
|
|
416
|
-
try {
|
|
417
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
418
|
-
_iterator.return();
|
|
419
|
-
}
|
|
420
|
-
} finally {
|
|
421
|
-
if (_didIteratorError) {
|
|
422
|
-
throw _iteratorError;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
subscription.needsRehydration = false;
|
|
427
|
-
}
|
|
428
|
-
}, {
|
|
429
|
-
key: "gapBackfill",
|
|
430
|
-
value: async function gapBackfill(subscription) {
|
|
431
|
-
await this.backfillOne(subscription);
|
|
432
|
-
subscription.pendingBackfill = false;
|
|
433
|
-
}
|
|
434
|
-
}, {
|
|
435
|
-
key: "cursorFetch",
|
|
436
|
-
value: async function cursorFetch(subscription) {
|
|
437
|
-
if (!subscription.getProgressiveCache().hasMore) return;
|
|
438
|
-
var batchSize = this.options.batchSize || this.options.pageSize || 100;
|
|
439
|
-
var docs = await this.fetchWithCursor(subscription, batchSize);
|
|
440
|
-
subscription.updateProgressiveCache({
|
|
441
|
-
docIds: [...subscription.getProgressiveCache().docIds, ...docs.map(function (doc2) {
|
|
442
|
-
return doc2.name;
|
|
443
|
-
})],
|
|
444
|
-
nextCursor: docs.length > 0 ? docs[docs.length - 1].name : subscription.getProgressiveCache().nextCursor,
|
|
445
|
-
hasMore: docs.length === batchSize
|
|
446
|
-
});
|
|
447
|
-
var _iteratorNormalCompletion = true,
|
|
448
|
-
_didIteratorError = false,
|
|
449
|
-
_iteratorError = void 0;
|
|
450
|
-
try {
|
|
451
|
-
for (var _iterator = docs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
452
|
-
var doc = _step.value;
|
|
453
|
-
this.normalizedCache.upsert(doc);
|
|
454
|
-
}
|
|
455
|
-
} catch (err) {
|
|
456
|
-
_didIteratorError = true;
|
|
457
|
-
_iteratorError = err;
|
|
458
|
-
} finally {
|
|
459
|
-
try {
|
|
460
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
461
|
-
_iterator.return();
|
|
462
|
-
}
|
|
463
|
-
} finally {
|
|
464
|
-
if (_didIteratorError) {
|
|
465
|
-
throw _iteratorError;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}, {
|
|
471
|
-
key: "fetchWithCursor",
|
|
472
|
-
value: async function fetchWithCursor(subscription, limit) {
|
|
473
|
-
return this.db.getDocList(subscription.query.doctype, {
|
|
474
|
-
fields: subscription.query.fields,
|
|
475
|
-
filters: subscription.query.filters,
|
|
476
|
-
orderBy: subscription.query.orderBy,
|
|
477
|
-
cursor: subscription.getProgressiveCache().nextCursor,
|
|
478
|
-
limit
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
}, {
|
|
482
|
-
key: "queueBackfill",
|
|
483
|
-
value: function queueBackfill(subscriptionId, reason) {
|
|
484
|
-
if (!this.backfillQueue.has(subscriptionId)) {
|
|
485
|
-
this.backfillQueue.set(subscriptionId, []);
|
|
486
|
-
}
|
|
487
|
-
var queue = this.backfillQueue.get(subscriptionId);
|
|
488
|
-
if (!queue.includes(reason)) queue.push(reason);
|
|
489
|
-
}
|
|
490
|
-
}]);
|
|
491
|
-
return BackfillManager2;
|
|
492
|
-
}();
|
|
493
477
|
//# sourceMappingURL=backfill.native.js.map
|