@lunora/client 1.0.0-alpha.3 → 1.0.0-alpha.300

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.
Files changed (100) hide show
  1. package/LICENSE.md +207 -104
  2. package/README.md +24 -7
  3. package/dist/admin/index.d.mts +689 -0
  4. package/dist/admin/index.d.ts +689 -0
  5. package/dist/admin/index.mjs +1 -0
  6. package/dist/auth/index.d.mts +174 -13
  7. package/dist/auth/index.d.ts +174 -13
  8. package/dist/auth/index.mjs +1 -60
  9. package/dist/index.d.mts +1121 -190
  10. package/dist/index.d.ts +1121 -190
  11. package/dist/index.mjs +1 -14
  12. package/dist/packem_shared/ADMIN_AUTH_DEFAULT_PAGE_SIZE-aKbm8N1z.mjs +1 -0
  13. package/dist/packem_shared/CONFLICT_ERROR_CODE-B7qNZMMk.mjs +1 -0
  14. package/dist/packem_shared/DEFAULT_MAX_BUFFER-Bd-_iyiV.mjs +1 -0
  15. package/dist/packem_shared/LunoraAdminClient-ClQxFDiy.mjs +1 -0
  16. package/dist/packem_shared/LunoraClient-D8eDGCKr.mjs +1 -0
  17. package/dist/packem_shared/OfflineQueue-BGkx7pBL.mjs +1 -0
  18. package/dist/packem_shared/RETIRE_AFTER_DURABLE_SEQ_ADVANCE-DoEHtuR8.mjs +1 -0
  19. package/dist/packem_shared/SKIP-d7LeP-sY.mjs +1 -0
  20. package/dist/packem_shared/SubscriptionRegistry-DjFfxba2.mjs +1 -0
  21. package/dist/packem_shared/TabCoordinator-DIySdaRV.mjs +1 -0
  22. package/dist/packem_shared/applyDelta-CaudNj2C.mjs +1 -0
  23. package/dist/packem_shared/base64-849R7V-V.mjs +1 -0
  24. package/dist/packem_shared/client-tuning-C10B2KCO.mjs +1 -0
  25. package/dist/packem_shared/client-urls-BHLUjjcG.mjs +1 -0
  26. package/dist/packem_shared/connectLiveStream-BdjsWP1-.mjs +1 -0
  27. package/dist/packem_shared/createAsyncStoragePersistence-BgfdvLwe.mjs +1 -0
  28. package/dist/packem_shared/createAsyncStorageQueryCache-6Y94ocbQ.mjs +1 -0
  29. package/dist/packem_shared/createCallRunner-Bwcrfh76.mjs +1 -0
  30. package/dist/packem_shared/createClientQuery-B8Nfj-7o.mjs +1 -0
  31. package/dist/packem_shared/createInMemoryBookmarkStorage-BooZhW0n.mjs +1 -0
  32. package/dist/packem_shared/createInMemoryPersistence-C-IzNVbg.mjs +1 -0
  33. package/dist/packem_shared/createInMemoryQueryCache-DR6AorA2.mjs +1 -0
  34. package/dist/packem_shared/createLocalStore-WKNHD1ca.mjs +1 -0
  35. package/dist/packem_shared/createMutatorRunner-CuMRJpUx.mjs +1 -0
  36. package/dist/packem_shared/createReconnect-CjTmjJDH.mjs +1 -0
  37. package/dist/packem_shared/createServerClient-CcH_sS6i.mjs +1 -0
  38. package/dist/packem_shared/createSnapshotPrecondition-BXP1NPBW.mjs +1 -0
  39. package/dist/packem_shared/delta-merge-C6OqMEPH.mjs +1 -0
  40. package/dist/packem_shared/deserializePreloaded-DxozvweR.mjs +1 -0
  41. package/dist/packem_shared/frame-hint-D-NK691z.mjs +1 -0
  42. package/dist/packem_shared/function-reference.d-Br_hsKje.d.mts +45 -0
  43. package/dist/packem_shared/function-reference.d-Br_hsKje.d.ts +45 -0
  44. package/dist/packem_shared/getServerSession-BaOoo1p6.mjs +1 -0
  45. package/dist/packem_shared/httpStream-DN3D9WqW.mjs +7 -0
  46. package/dist/packem_shared/idb-utility-BS7xvou1.mjs +1 -0
  47. package/dist/packem_shared/live-stream-DBKgZlnb.mjs +10 -0
  48. package/dist/packem_shared/liveTopicSubscription-DQtKMFKw.mjs +1 -0
  49. package/dist/packem_shared/lunora-client-BC2DJGwq.mjs +1 -0
  50. package/dist/packem_shared/lunora-client.d-BswMNnv7.d.mts +5060 -0
  51. package/dist/packem_shared/lunora-client.d-TchceUzJ.d.ts +5060 -0
  52. package/dist/packem_shared/lunoraQueryKey-CucWmxnx.mjs +1 -0
  53. package/dist/packem_shared/offline-queue-HwrYARIL.mjs +1 -0
  54. package/dist/packem_shared/optimistic-layers-BI61YTO3.mjs +1 -0
  55. package/dist/packem_shared/preload.d-BKdXfr3n.d.ts +21 -0
  56. package/dist/packem_shared/preload.d-qY64gg1w.d.mts +21 -0
  57. package/dist/packem_shared/preloadQuery-uFy24PCR.mjs +1 -0
  58. package/dist/packem_shared/setAuthTokenProvider-DhBppDiZ.mjs +1 -0
  59. package/dist/packem_shared/single-blob-store-DeaYPBSS.mjs +1 -0
  60. package/dist/packem_shared/snapshot-precondition-BEtcSbWr.mjs +1 -0
  61. package/dist/packem_shared/stream-idle-C7CsIT_m.mjs +1 -0
  62. package/dist/packem_shared/wire-errors-BDckSTKZ.mjs +1 -0
  63. package/dist/pagination/index.d.mts +72 -43
  64. package/dist/pagination/index.d.ts +72 -43
  65. package/dist/pagination/index.mjs +1 -61
  66. package/dist/query/index.d.mts +183 -44
  67. package/dist/query/index.d.ts +183 -44
  68. package/dist/query/index.mjs +1 -1
  69. package/dist/service.d.mts +49 -0
  70. package/dist/service.d.ts +49 -0
  71. package/dist/service.mjs +1 -0
  72. package/dist/ssr/index.d.mts +109 -80
  73. package/dist/ssr/index.d.ts +109 -80
  74. package/dist/ssr/index.mjs +1 -4
  75. package/dist/upload.d.mts +49 -0
  76. package/dist/upload.d.ts +49 -0
  77. package/dist/upload.mjs +1 -0
  78. package/package.json +22 -2
  79. package/dist/packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs +0 -4
  80. package/dist/packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs +0 -107
  81. package/dist/packem_shared/LunoraClient-UiULzH_1.mjs +0 -2165
  82. package/dist/packem_shared/OfflineQueue-D5p_QgF_.mjs +0 -127
  83. package/dist/packem_shared/SKIP-vItZChkw.mjs +0 -50
  84. package/dist/packem_shared/SubscriptionRegistry-B-Qx_Gux.mjs +0 -26
  85. package/dist/packem_shared/applyDelta-4jFGTPA3.mjs +0 -61
  86. package/dist/packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs +0 -45
  87. package/dist/packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs +0 -11
  88. package/dist/packem_shared/createInMemoryPersistence-CW82inU5.mjs +0 -105
  89. package/dist/packem_shared/createInMemoryQueryCache-B1PQ9Twl.mjs +0 -138
  90. package/dist/packem_shared/createLocalStore-DSUfoLqY.mjs +0 -36
  91. package/dist/packem_shared/createMutationRunner-BqsavzvG.mjs +0 -21
  92. package/dist/packem_shared/createReconnect-Di_-oHH7.mjs +0 -22
  93. package/dist/packem_shared/createServerClient-BjZc3gD8.mjs +0 -11
  94. package/dist/packem_shared/deserializePreloaded-C0eJTY_W.mjs +0 -4
  95. package/dist/packem_shared/getServerSession-8jXewqxd.mjs +0 -13
  96. package/dist/packem_shared/lunora-client.d-DGvyuJ_p.d.mts +0 -1597
  97. package/dist/packem_shared/lunora-client.d-DGvyuJ_p.d.ts +0 -1597
  98. package/dist/packem_shared/preload.d-BoDmFqSG.d.ts +0 -20
  99. package/dist/packem_shared/preload.d-dSaRMuhL.d.mts +0 -20
  100. package/dist/packem_shared/preloadQuery-lobFkD2Z.mjs +0 -13
@@ -0,0 +1 @@
1
+ import{stableWireKey as a}from"@lunora/wire";const s=(e,r,y)=>["lunora",e,r,y??null],n=(e,r,y)=>s(e.__lunoraRef,a(r),y),t=(e,r,y,u={})=>{const o=y??{};return{queryFn:()=>e.query(r,o,{shardKey:u.shardKey}),queryKey:n(r,o,u.shardKey),staleTime:Number.POSITIVE_INFINITY}};export{n as lunoraQueryKey,s as lunoraQueryKeyFromArgsKey,t as lunoraQueryOptions};
@@ -0,0 +1 @@
1
+ let a=0;const d=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();a+=1;const o=typeof crypto<"u"&&typeof crypto.getRandomValues=="function"?Array.from(crypto.getRandomValues(new Uint8Array(8)),e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(16).slice(2,12);return`id_${Date.now().toString(36)}_${a.toString(36)}_${o}`},l=(o,e)=>o!==void 0&&e!==o,f=d,h=(o,e,t,i)=>{if(o)try{o({error:t,mutationId:i,operation:e});return}catch{}console.warn(`[lunora] offline-queue persistence ${e} failed`,t)};class p{queueBeforeFirstConnect;maxItems;onPersistenceError;persistence;onEvict;onSizeChange;onReplayingChange;version;items=[];replayingIds=new Map;appending=new Map;unsettled=new Map;unpersisted=new Set;constructor(e={},t={}){this.maxItems=e.maxItems??1e3,this.queueBeforeFirstConnect=e.queueBeforeFirstConnect??!1,this.onPersistenceError=e.onPersistenceError,this.persistence=t.persistence,this.onEvict=t.onEvict,this.onSizeChange=t.onSizeChange,this.onReplayingChange=t.onReplayingChange,this.version=t.version}get size(){return this.items.length}get replaying(){return this.replayingIds.size}enqueue(e){const t=e;t.id??=f();let i=this.items.length;for(;t.issueSeq!==void 0&&i>0&&(this.items[i-1]?.issueSeq??-1)>t.issueSeq;)i-=1;this.items.splice(i,0,t),this.unsettled.set(t.id,t),this.persist(this.recordOf(t,t.id)),this.evictOverflow(),this.notifySize()}discard(e){this.unsettled.delete(e),this.unpersisted.delete(e),this.replayingIds.delete(e)&&this.onReplayingChange?.();const{persistence:t}=this;t&&(this.appending.get(e)??Promise.resolve()).then(async()=>t.remove(e)).catch(i=>{h(this.onPersistenceError,"remove",i,e)})}flushUnpersisted(){for(const e of this.unpersisted){const t=this.unsettled.get(e);t&&!this.appending.has(e)&&this.persist(this.recordOf(t,e))}}async hydrate(){if(!this.persistence)return[];let e;try{e=await this.persistence.load()}catch(s){throw h(this.onPersistenceError,"load",s),s}const t=[],i=new Set(this.items.map(s=>s.id));for(const s of e)if(!i.has(s.id)){if(l(this.version,s.version)){this.persistence.remove(s.id).catch(c=>{h(this.onPersistenceError,"remove",c,s.id)});continue}i.add(s.id),t.push({args:s.args,baselineSeq:s.baselineSeq,clientId:s.clientId,functionPath:s.functionPath,id:s.id,identity:s.identity,reject:()=>{},resolve:()=>{},shardKey:s.shardKey})}this.items.unshift(...t),this.evictOverflow(),this.notifySize();const n=new Set(this.items),r=new Set;for(const s of t)n.has(s)&&r.add(s.shardKey);return[...r]}restampIdentity(e,t){for(const i of[...this.items,...this.replayingIds.values()]){if(i.identity!==e)continue;i.identity=t;const{id:n}=i;!this.persistence||n===void 0||this.rewriteStamp(n,this.recordOf(i,n)).catch(r=>{h(this.onPersistenceError,"replace",r,n)})}}hasPending(e){return this.items.some(t=>e(t))}drain(e){if(!e){const n=[...this.items];return this.items.length=0,this.markReplaying(n),this.notifySize(),n}const t=[],i=[];for(const n of this.items)(e(n)?t:i).push(n);return this.items.length=0,this.items.push(...i),this.markReplaying(t),this.notifySize(),t}requeue(e){if(e.length!==0){for(const t of e)t.id!==void 0&&this.replayingIds.delete(t.id);this.items.unshift(...e),this.notifySize()}}drainConflict(){const e=[],t=[];for(const i of this.items){let n=!0,r;if(i.precondition!==void 0)try{n=i.precondition()}catch(s){n=!1,r=s}if(n)t.push(i);else{const s=new Error("offline mutation skipped: precondition failed before replay",r===void 0?void 0:{cause:r});s.code="OFFLINE_PRECONDITION_FAILED",i.reject(s),e.push(i)}}return e.length>0&&(this.items.length=0,this.items.push(...t),this.notifySize()),e}clear(){for(const e of new Set([...this.items,...this.unsettled.values()])){const t=new Error("CLIENT_CLOSED"),i=e.id??"",n=s=>{t.code="CLIENT_CLOSED",t.persisted=s,e.reject(t)},r=this.appending.get(i);this.replayingIds.has(i)?n(!1):r===void 0?n(this.persistence!==void 0&&!this.unpersisted.has(i)):r.catch(()=>!1).then(n).catch(()=>{})}this.items.length=0,this.replayingIds.clear(),this.unsettled.clear(),this.unpersisted.clear(),this.notifySize()}recordOf(e,t){return{args:e.args,...e.baselineSeq===void 0?{}:{baselineSeq:e.baselineSeq},clientId:e.clientId,functionPath:e.functionPath,id:t,identity:e.identity,shardKey:e.shardKey,...this.version===void 0?{}:{version:this.version}}}persist(e){const{persistence:t}=this;if(!t)return;const i=(async()=>{try{return await t.append(e),this.unpersisted.delete(e.id),!0}catch(n){return this.unsettled.has(e.id)&&this.unpersisted.add(e.id),h(this.onPersistenceError,"append",n,e.id),!1}})();this.appending.set(e.id,i),i.finally(()=>{this.appending.get(e.id)===i&&this.appending.delete(e.id)}).catch(()=>{})}async rewriteStamp(e,t){const i=this.persistence;if(i)try{await this.appending.get(e),await i.replace(t)}catch(n){h(this.onPersistenceError,"replace",n,e)}}evictOverflow(){for(;this.items.length>this.maxItems;){const e=this.items.shift();if(e){e.id&&this.discard(e.id);const t=new Error("offline queue overflow");t.code="OFFLINE_QUEUE_OVERFLOW",e.reject(t),this.onEvict?.(e,t)}}}markReplaying(e){for(const t of e)t.id!==void 0&&this.replayingIds.set(t.id,t)}notifySize(){this.onSizeChange?.(this.items.length)}}export{p as O,l as i,f as n,h as r};
@@ -0,0 +1 @@
1
+ let l=0,t;const f=(r,i)=>{for(const o of r)try{o(i)}catch{}},m=r=>{const i=[...r.callbacks],o=r.lastValue;return()=>{for(const e of i){if(r.lastValue!==o)return;r.callbacks.has(e)&&f([e],o)}}},k=r=>{t===void 0?r():t.add(r)},L=()=>l,p=(r,i)=>{let o=r;for(const e of i)try{o=e.transform(o)}catch{}return o},d=(r,i)=>{if(i!==r.lastValue)if(r.lastValue=i,t===void 0){const{retirements:o}=r;for(const e of r.callbacks){if(r.retirements!==o&&r.lastValue!==i)return;f([e],i)}}else t.add(r)},b=(r,i=()=>!0)=>{const o=new Set;t=o;try{r()}finally{t=void 0;const e=[...o].map(c=>typeof c=="function"?c:m(c));for(const c of e){if(!i())break;try{c()}catch{}}}},y=(r,i)=>{d(r,p(i,r.optimisticLayers))},h=(r,i)=>{let o;try{o=i(r.lastValue)}catch{return}const e={id:Symbol("optimistic"),transform:i};let c=!1;r.optimisticLayers.push(e),d(r,o);const s=()=>{const n=r.optimisticLayers.findIndex(u=>u.id===e.id);return n===-1?!1:(r.optimisticLayers.splice(n,1),!0)},a=()=>{y(r,r.serverBase)};return{confirm:n=>{if(n===void 0){s();return}e.commitCursor=n,l+=1,e.acknowledgedAt=l,r.serverCursor!==void 0&&r.serverCursor>=n&&s()&&a()},rollback:()=>{c||(c=!0,s(),a())}}},v=(r,i)=>{if(i===void 0||r.optimisticLayers.length===0)return!1;const o=r.optimisticLayers.length;return r.optimisticLayers=r.optimisticLayers.filter(e=>e.commitCursor===void 0||e.commitCursor>i),r.optimisticLayers.length!==o},g=(r,i)=>{r.optimisticLayers.length!==0&&(r.optimisticLayers=r.optimisticLayers.filter(o=>o.acknowledgedAt===void 0||o.acknowledgedAt>i))},w=r=>{for(let i=r.length-1;i>=0;i-=1)r[i]?.()};export{h as a,v as b,w as c,k as d,g as e,L as f,y as r,b as w};
@@ -0,0 +1,21 @@
1
+ import { L as LunoraClient, P as Preloaded } from "./lunora-client.d-TchceUzJ.js";
2
+ import { F as FunctionReference, A as ArgsOf, R as ReturnOf } from "./function-reference.d-Br_hsKje.js";
3
+ /**
4
+ * Run a query once on the server (during SSR) and capture its result in a
5
+ * serializable {@link Preloaded} token. Embed the token in the rendered HTML and
6
+ * pass it to `usePreloadedQuery` on the client: the first client render shows
7
+ * the server value with no loading flash, then a live subscription takes over.
8
+ *
9
+ * The query is executed through the supplied {@link LunoraClient} over the same
10
+ * HTTP RPC path the browser uses, so the SSR client only needs a `fetch`
11
+ * implementation that can reach the worker — no in-process Durable Object access.
12
+ */
13
+ declare const preloadQuery: <F extends FunctionReference>(client: LunoraClient, function_: F, args: ArgsOf<F>, options?: {
14
+ shardKey?: string;
15
+ }) => Promise<Preloaded<ReturnOf<F>>>;
16
+ /**
17
+ * Read the captured value out of a {@link Preloaded} token without subscribing.
18
+ * Useful on the server (or in tests) when you only need the data, not a live feed.
19
+ */
20
+ declare const preloadedQueryResult: <T>(preloaded: Preloaded<T>) => T;
21
+ export { preloadedQueryResult as a, preloadQuery as p };
@@ -0,0 +1,21 @@
1
+ import { L as LunoraClient, P as Preloaded } from "./lunora-client.d-BswMNnv7.mjs";
2
+ import { F as FunctionReference, A as ArgsOf, R as ReturnOf } from "./function-reference.d-Br_hsKje.mjs";
3
+ /**
4
+ * Run a query once on the server (during SSR) and capture its result in a
5
+ * serializable {@link Preloaded} token. Embed the token in the rendered HTML and
6
+ * pass it to `usePreloadedQuery` on the client: the first client render shows
7
+ * the server value with no loading flash, then a live subscription takes over.
8
+ *
9
+ * The query is executed through the supplied {@link LunoraClient} over the same
10
+ * HTTP RPC path the browser uses, so the SSR client only needs a `fetch`
11
+ * implementation that can reach the worker — no in-process Durable Object access.
12
+ */
13
+ declare const preloadQuery: <F extends FunctionReference>(client: LunoraClient, function_: F, args: ArgsOf<F>, options?: {
14
+ shardKey?: string;
15
+ }) => Promise<Preloaded<ReturnOf<F>>>;
16
+ /**
17
+ * Read the captured value out of a {@link Preloaded} token without subscribing.
18
+ * Useful on the server (or in tests) when you only need the data, not a live feed.
19
+ */
20
+ declare const preloadedQueryResult: <T>(preloaded: Preloaded<T>) => T;
21
+ export { preloadedQueryResult as a, preloadQuery as p };
@@ -0,0 +1 @@
1
+ const t=async(e,r,a,u={})=>{const l=await e.query(r,a,u);return{__lunoraPreloaded:!0,args:a??{},functionPath:r.__lunoraRef,shardKey:u.shardKey,value:l}},d=e=>e.value;export{t as preloadQuery,d as preloadedQueryResult};
@@ -0,0 +1 @@
1
+ import{f}from"./base64-849R7V-V.mjs";const d=1e4,h=1e3,m=864e5,l=5e3,y=o=>{try{const t=JSON.parse(new TextDecoder().decode(f(o.split(".")[1]??""))),r=typeof t=="object"&&t!==null?t.exp:void 0;return typeof r=="number"?r*1e3:void 0}catch{return}},E=(o,t,r={})=>{let s=!1,c,n;const v=async()=>{let e;try{e=await t()}catch{return l}if(s)return;o.setAuthToken(e,e===null?void 0:r.subject);const u=e===null?void 0:y(e);if(u===void 0)return;const i=u-Date.now();return i<=0?l:Math.min(m,Math.max(h,i>d?i-d:i/2))},a=async()=>{if(n!==void 0)return;clearTimeout(c),n=v();let e;try{e=await n}finally{n=void 0}e!==void 0&&!s&&(c=setTimeout(()=>{a().catch(()=>{})},e))},p=o.onTokenExpired(()=>{a().catch(()=>{})});return a().catch(()=>{}),()=>{s=!0,clearTimeout(c),p()}};export{E as setAuthTokenProvider};
@@ -0,0 +1 @@
1
+ import{encodeWire as s,parseWire as a}from"@lunora/wire";const c=Symbol("lunora.corrupt-blob"),m=(r,t)=>{let n=Promise.resolve();const o=e=>{const i=n.then(e,e);return n=i.then(()=>{},()=>{}),i};return{clear:()=>o(()=>r.removeItem(t)),read:async()=>{const e=await r.getItem(t);if(e!==null)try{return a(e)}catch{return c}},serialize:o,write:async e=>{await r.setItem(t,JSON.stringify(s(e)))}}};export{c as C,m as s};
@@ -0,0 +1 @@
1
+ import{stableWireKey as p}from"@lunora/wire";const u=new WeakMap,i=(e,t)=>{u.set(e,t)},d=e=>e===void 0?void 0:u.get(e),h=(e,t,s,n)=>{const o=e.peekActiveQuerySnapshot(t.__lunoraRef,s,n),a=o.present&&o.answered?p(o.value):void 0,c=()=>{const r=e.peekActiveQuerySnapshot(t.__lunoraRef,s,n);return!o.present||!o.answered||!r.present||!r.answered?!0:p(r.value)===a};return a!==void 0&&i(c,{args:s,functionPath:t.__lunoraRef,shardKey:n}),c};export{h as c,i as r,d as s};
@@ -0,0 +1 @@
1
+ import{LunoraError as v}from"@lunora/errors";import{TransportError as f}from"./CONFLICT_ERROR_CODE-B7qNZMMk.mjs";const c=t=>t.reason??Object.assign(new Error("The operation was aborted"),{name:"AbortError"}),m=async(t,r,o,i=()=>new f(`LunoraClient: request timed out after ${t.toString()}ms`))=>{if(r?.aborted)throw c(r);const n=new AbortController,e=[],u=new Promise((b,d)=>{if(t>0){const a=setTimeout(()=>{d(i()),n.abort()},t);e.push(()=>{clearTimeout(a)})}if(r){const a=()=>{n.abort(),d(c(r))};r.addEventListener("abort",a,{once:!0}),e.push(()=>{r.removeEventListener("abort",a)})}}),s=o(n.signal);s.catch(()=>{});try{return await Promise.race([s,u])}finally{for(const b of e)b()}},E=async(t,r)=>{if(r===void 0)return t;if(r.aborted)throw t.catch(()=>{}),c(r);let o=()=>{};const i=new Promise((n,e)=>{o=()=>{e(c(r))},r.addEventListener("abort",o,{once:!0})});t.catch(()=>{});try{return await Promise.race([t,i])}finally{r.removeEventListener("abort",o)}},y=async(t,r)=>!Number.isFinite(r)||r<=0?t.read():m(r,void 0,async()=>t.read(),()=>new v("STREAM_IDLE",`stream received nothing for ${r.toString()}ms`));export{E as a,c as b,y as r,m as w};
@@ -0,0 +1 @@
1
+ import{LunoraError as i}from"@lunora/errors";import{decodeWire as u}from"@lunora/wire";import{TransportError as l,getRetryAfterMs as m}from"./CONFLICT_ERROR_CODE-B7qNZMMk.mjs";import{f as a}from"./frame-hint-D-NK691z.mjs";const v=t=>{if(t===null)return;const r=Number(t);if(Number.isFinite(r))return r>0?r*1e3:void 0;const e=Date.parse(t);if(Number.isNaN(e))return;const o=e-Date.now();return o>0?o:void 0},p=(t,r)=>{const e=v(r);if(!(e===void 0||m(t)!==void 0))return t.data===void 0?{retryAfterMs:e}:typeof t.data=="object"&&t.data!==null&&!Array.isArray(t.data)?{...t.data,retryAfterMs:e}:void 0},y=t=>{const r=t?.error;if(typeof r!="object"||r===null||Array.isArray(r))return;const{why:e,...o}=r;return typeof e=="string"?{...o,why:e}:o},E=()=>new l("LunoraClient: batch slot carried no error envelope"),c=(t,r)=>{const e=t.error,o=typeof e?.code=="string"?e.code:void 0,s=typeof e?.message=="string"?e.message:void 0;return{code:o,messageText:(typeof t.message=="string"?t.message:void 0)??s??r}},D=t=>{const{code:r,messageText:e}=c(t,"stream error"),o=t.error,s=o?.why,n=r===void 0?new Error(e):new i(r,e,a(o?.hint));return typeof s=="string"&&(n.why=s),n},O=t=>{const{code:r,messageText:e}=c(t,"subscription error"),o=t.error,s=typeof o?.why=="string"?{why:o.why}:{};return{message:e,...r===void 0?{}:{code:r},...a(o?.hint),...s}},h=Symbol.for("lunora.serverVerdict"),d=t=>{const r=new Error(t.message??"request failed");if(r.code=t.code,r[h]=!0,t.data!==void 0)try{r.data=u(t.data)}catch{}return t.hint!==void 0&&(r.hint=t.hint),t.docsUrl!==void 0&&(r.docsUrl=t.docsUrl),typeof t.why=="string"&&(r.why=t.why),r},b=t=>Object.freeze(Object.fromEntries([...t].filter(([r])=>r!=="set-cookie"))),w=(t,r)=>Object.defineProperty(t,"headers",{value:b(r)}),j=(t,r)=>{const e=d(t),o=p(e,r.get("retry-after"));return o!==void 0&&(e.data=o),w(e,r)},M=t=>{const r=y(t);return r===void 0?E():d(r)},f=new WeakSet,N=t=>{const r=new i("WIRE_DECODE_FAILED",`LunoraClient: the call succeeded but its result could not be decoded (a mutation has still committed) — ${t instanceof Error?t.message:String(t)}`,{cause:t});return f.add(r),r},T=t=>t instanceof Error&&f.has(t);export{v as a,j as b,D as c,O as d,y as e,E as f,T as i,d as r,M as s,N as u,w};
@@ -1,13 +1,13 @@
1
1
  /**
2
- * `@lunora/client/pagination` — the framework-agnostic pagination state machine
3
- * shared by every Lunora UI adapter (React, Vue, Svelte, Solid).
4
- *
5
- * Owns cursor tracking, page-size rebalancing (split/join), `initialPages`,
6
- * `rebalance`, and the shared types (`Page`, `PaginationResult`,
7
- * `PaginationStatus`, `PaginatedCoreResult`). Nothing here imports a UI
8
- * framework — each adapter wires the pure functions into its own reactive
9
- * primitives.
10
- */
2
+ * `@lunora/client/pagination` — the framework-agnostic pagination state machine
3
+ * shared by every Lunora UI adapter (React, Vue, Svelte, Solid).
4
+ *
5
+ * Owns cursor tracking, page-size rebalancing (split/join), `initialPages`,
6
+ * `rebalance`, and the shared types (`Page`, `PaginationResult`,
7
+ * `PaginationStatus`, `PaginatedCoreResult`). Nothing here imports a UI
8
+ * framework — each adapter wires the pure functions into its own reactive
9
+ * primitives.
10
+ */
11
11
  /** Grow factor: a bounded page is split when it exceeds this multiple of its target size. */
12
12
  declare const SPLIT_FACTOR = 2;
13
13
  /** Shrink factor: a bounded page with a neighbour is joined when it falls below this multiple of its target size. */
@@ -24,20 +24,25 @@ interface PaginationResult<T = unknown> {
24
24
  isDone: boolean;
25
25
  page: T[];
26
26
  /**
27
- * Reactive-pagination only: the midpoint cursor of a bounded
28
- * `(cursor, endCursor]` page, used to split an over-grown page into two
29
- * adjacent ranges. Absent on legacy (open-ended) pages.
30
- */
27
+ * Reactive-pagination only: the midpoint cursor of a bounded
28
+ * `(cursor, endCursor]` page, used to split an over-grown page into two
29
+ * adjacent ranges. Absent on legacy (open-ended) pages.
30
+ */
31
31
  splitCursor?: null | string;
32
+ /**
33
+ * Reactive-pagination only: the server's read cut this bounded page short, so it holds only the
34
+ * first rows of its range. Split at `splitCursor` whatever the page's size.
35
+ */
36
+ splitRequired?: boolean;
32
37
  }
33
38
  /**
34
- * Lifecycle of a `usePaginatedQuery` feed.
35
- *
36
- * - `LoadingFirstPage` — the first page is in flight; `results` is empty.
37
- * - `CanLoadMore` — the loaded tail has a cursor; calling `loadMore` fetches the next page.
38
- * - `LoadingMore` — a `loadMore` page is in flight; earlier results stay visible.
39
- * - `Exhausted` — every page has loaded and the server reported `isDone`.
40
- */
39
+ * Lifecycle of a `usePaginatedQuery` feed.
40
+ *
41
+ * - `LoadingFirstPage` — the first page is in flight; `results` is empty.
42
+ * - `CanLoadMore` — the loaded tail has a cursor; calling `loadMore` fetches the next page.
43
+ * - `LoadingMore` — a `loadMore` page is in flight; earlier results stay visible.
44
+ * - `Exhausted` — every page has loaded and the server reported `isDone`.
45
+ */
41
46
  type PaginationStatus = "CanLoadMore" | "Exhausted" | "LoadingFirstPage" | "LoadingMore";
42
47
  interface PaginatedCoreResult<T> {
43
48
  /** Request another page off the open-ended tail. A no-op unless `status === "CanLoadMore"`. */
@@ -46,37 +51,61 @@ interface PaginatedCoreResult<T> {
46
51
  pageResults: (PaginationResult<T> | undefined)[];
47
52
  status: PaginationStatus;
48
53
  }
54
+ /** The feed's head page: one open-ended range from the start of the feed. */
55
+ declare const headPage: (numberItems: number) => Page;
49
56
  /** First-page seed: a single open-ended range starting at the feed head. */
50
57
  declare const initialPages: (numberItems: number) => Page[];
51
58
  /**
52
- * Run the SPLIT/JOIN maintenance pass over the current page list given freshly
53
- * resolved results. Returns a new page list when a boundary changed, or
54
- * `undefined` when the layout is already balanced (so the caller can skip a
55
- * setState).
56
- *
57
- * Only ONE structural edit is applied per pass (the first split or join found),
58
- * letting the subsequent re-render's resolved results drive the next pass — this
59
- * keeps each transition observable and avoids reasoning about several
60
- * simultaneous boundary moves.
61
- */
59
+ * Run the SPLIT/JOIN maintenance pass over the current page list given freshly
60
+ * resolved results. Returns a new page list when a boundary changed, or
61
+ * `undefined` when the layout is already balanced (so the caller can skip a
62
+ * setState).
63
+ *
64
+ * Only ONE structural edit is applied per pass (the first split or join found),
65
+ * letting the subsequent re-render's resolved results drive the next pass — this
66
+ * keeps each transition observable and avoids reasoning about several
67
+ * simultaneous boundary moves.
68
+ */
62
69
  declare const rebalance: (pages: Page[], results: (PaginationResult | undefined)[]) => Page[] | undefined;
63
70
  /**
64
- * Derive the feed `status` and the next-page cursor from the current page list
65
- * and resolved page results. Framework adapters call this each render/effect to
66
- * compute what to expose to callers.
67
- */
71
+ * Derive the feed `status` and the next-page cursor from the current page list
72
+ * and resolved page results. Framework adapters call this each render/effect to
73
+ * compute what to expose to callers.
74
+ */
68
75
  declare const derivePaginationStatus: <T>(skipped: boolean, pageResults: (PaginationResult<T> | undefined)[]) => {
69
76
  nextCursor: null | string | undefined;
70
77
  status: PaginationStatus;
71
78
  };
72
79
  /**
73
- * Apply a `loadMore` to the current page list. Pins the open-ended tail at
74
- * `cursor` (making it a fixed bounded range) and appends a fresh open-ended
75
- * page starting at `cursor`. The shared boundary keeps the feed gap- and
76
- * dup-free.
77
- *
78
- * Returns the new page list, or `undefined` when the given `cursor` is not
79
- * valid (null or undefined — caller should no-op).
80
- */
80
+ * Apply a `loadMore` to the current page list. Pins the open-ended tail at
81
+ * `cursor` (making it a fixed bounded range) and appends a fresh open-ended
82
+ * page starting at `cursor`. The shared boundary keeps the feed gap- and
83
+ * dup-free.
84
+ *
85
+ * Returns the new page list, or `undefined` when the given `cursor` is not
86
+ * valid (null or undefined — caller should no-op).
87
+ */
81
88
  declare const applyLoadMore: (pages: Page[], cursor: null | string | undefined, numberItems: number) => Page[] | undefined;
82
- export { JOIN_FACTOR, type Page, type PaginatedCoreResult, type PaginationResult, type PaginationStatus, SPLIT_FACTOR, applyLoadMore, derivePaginationStatus, initialPages, rebalance };
89
+ /**
90
+ * What a feed does with one page's failure.
91
+ *
92
+ * - `surface` — report it (the `error` value and `onError`), as before.
93
+ * - `restart` — reload the feed from its first page, silently: the page's cursor no longer decodes.
94
+ * - `ignore` — drop it: a page the feed no longer holds, still reporting from before a restart.
95
+ */
96
+ type PageFailure = "ignore" | "restart" | "surface";
97
+ /** The feed's first page before any `loadMore`: `(null, null]`, the one page that carries no cursor. */
98
+ declare const isHeadPage: (page: Page) => boolean;
99
+ /**
100
+ * Classify a page failure. Only `INVALID_CURSOR` changes the answer: the server refuses a cursor
101
+ * minted by an older build (a deploy changed the query's order or the engine's cursor encoding), and
102
+ * every bounded page the feed holds carries one, so the only way forward is page one.
103
+ *
104
+ * Two cases surface it instead. The head page has no cursor to be stale. And `restartedSinceLoad`
105
+ * (the feed restarted, and no page past the head has had a frame since) means the server is refusing
106
+ * the cursors it mints now, which a second restart would only repeat on every `loadMore`.
107
+ */
108
+ declare const classifyPageFailure: (pages: Page[], isFailedPage: (page: Page) => boolean, error: {
109
+ code?: string;
110
+ }, restartedSinceLoad: boolean) => PageFailure;
111
+ export { JOIN_FACTOR, type Page, type PageFailure, type PaginatedCoreResult, type PaginationResult, type PaginationStatus, SPLIT_FACTOR, applyLoadMore, classifyPageFailure, derivePaginationStatus, headPage, initialPages, isHeadPage, rebalance };
@@ -1,13 +1,13 @@
1
1
  /**
2
- * `@lunora/client/pagination` — the framework-agnostic pagination state machine
3
- * shared by every Lunora UI adapter (React, Vue, Svelte, Solid).
4
- *
5
- * Owns cursor tracking, page-size rebalancing (split/join), `initialPages`,
6
- * `rebalance`, and the shared types (`Page`, `PaginationResult`,
7
- * `PaginationStatus`, `PaginatedCoreResult`). Nothing here imports a UI
8
- * framework — each adapter wires the pure functions into its own reactive
9
- * primitives.
10
- */
2
+ * `@lunora/client/pagination` — the framework-agnostic pagination state machine
3
+ * shared by every Lunora UI adapter (React, Vue, Svelte, Solid).
4
+ *
5
+ * Owns cursor tracking, page-size rebalancing (split/join), `initialPages`,
6
+ * `rebalance`, and the shared types (`Page`, `PaginationResult`,
7
+ * `PaginationStatus`, `PaginatedCoreResult`). Nothing here imports a UI
8
+ * framework — each adapter wires the pure functions into its own reactive
9
+ * primitives.
10
+ */
11
11
  /** Grow factor: a bounded page is split when it exceeds this multiple of its target size. */
12
12
  declare const SPLIT_FACTOR = 2;
13
13
  /** Shrink factor: a bounded page with a neighbour is joined when it falls below this multiple of its target size. */
@@ -24,20 +24,25 @@ interface PaginationResult<T = unknown> {
24
24
  isDone: boolean;
25
25
  page: T[];
26
26
  /**
27
- * Reactive-pagination only: the midpoint cursor of a bounded
28
- * `(cursor, endCursor]` page, used to split an over-grown page into two
29
- * adjacent ranges. Absent on legacy (open-ended) pages.
30
- */
27
+ * Reactive-pagination only: the midpoint cursor of a bounded
28
+ * `(cursor, endCursor]` page, used to split an over-grown page into two
29
+ * adjacent ranges. Absent on legacy (open-ended) pages.
30
+ */
31
31
  splitCursor?: null | string;
32
+ /**
33
+ * Reactive-pagination only: the server's read cut this bounded page short, so it holds only the
34
+ * first rows of its range. Split at `splitCursor` whatever the page's size.
35
+ */
36
+ splitRequired?: boolean;
32
37
  }
33
38
  /**
34
- * Lifecycle of a `usePaginatedQuery` feed.
35
- *
36
- * - `LoadingFirstPage` — the first page is in flight; `results` is empty.
37
- * - `CanLoadMore` — the loaded tail has a cursor; calling `loadMore` fetches the next page.
38
- * - `LoadingMore` — a `loadMore` page is in flight; earlier results stay visible.
39
- * - `Exhausted` — every page has loaded and the server reported `isDone`.
40
- */
39
+ * Lifecycle of a `usePaginatedQuery` feed.
40
+ *
41
+ * - `LoadingFirstPage` — the first page is in flight; `results` is empty.
42
+ * - `CanLoadMore` — the loaded tail has a cursor; calling `loadMore` fetches the next page.
43
+ * - `LoadingMore` — a `loadMore` page is in flight; earlier results stay visible.
44
+ * - `Exhausted` — every page has loaded and the server reported `isDone`.
45
+ */
41
46
  type PaginationStatus = "CanLoadMore" | "Exhausted" | "LoadingFirstPage" | "LoadingMore";
42
47
  interface PaginatedCoreResult<T> {
43
48
  /** Request another page off the open-ended tail. A no-op unless `status === "CanLoadMore"`. */
@@ -46,37 +51,61 @@ interface PaginatedCoreResult<T> {
46
51
  pageResults: (PaginationResult<T> | undefined)[];
47
52
  status: PaginationStatus;
48
53
  }
54
+ /** The feed's head page: one open-ended range from the start of the feed. */
55
+ declare const headPage: (numberItems: number) => Page;
49
56
  /** First-page seed: a single open-ended range starting at the feed head. */
50
57
  declare const initialPages: (numberItems: number) => Page[];
51
58
  /**
52
- * Run the SPLIT/JOIN maintenance pass over the current page list given freshly
53
- * resolved results. Returns a new page list when a boundary changed, or
54
- * `undefined` when the layout is already balanced (so the caller can skip a
55
- * setState).
56
- *
57
- * Only ONE structural edit is applied per pass (the first split or join found),
58
- * letting the subsequent re-render's resolved results drive the next pass — this
59
- * keeps each transition observable and avoids reasoning about several
60
- * simultaneous boundary moves.
61
- */
59
+ * Run the SPLIT/JOIN maintenance pass over the current page list given freshly
60
+ * resolved results. Returns a new page list when a boundary changed, or
61
+ * `undefined` when the layout is already balanced (so the caller can skip a
62
+ * setState).
63
+ *
64
+ * Only ONE structural edit is applied per pass (the first split or join found),
65
+ * letting the subsequent re-render's resolved results drive the next pass — this
66
+ * keeps each transition observable and avoids reasoning about several
67
+ * simultaneous boundary moves.
68
+ */
62
69
  declare const rebalance: (pages: Page[], results: (PaginationResult | undefined)[]) => Page[] | undefined;
63
70
  /**
64
- * Derive the feed `status` and the next-page cursor from the current page list
65
- * and resolved page results. Framework adapters call this each render/effect to
66
- * compute what to expose to callers.
67
- */
71
+ * Derive the feed `status` and the next-page cursor from the current page list
72
+ * and resolved page results. Framework adapters call this each render/effect to
73
+ * compute what to expose to callers.
74
+ */
68
75
  declare const derivePaginationStatus: <T>(skipped: boolean, pageResults: (PaginationResult<T> | undefined)[]) => {
69
76
  nextCursor: null | string | undefined;
70
77
  status: PaginationStatus;
71
78
  };
72
79
  /**
73
- * Apply a `loadMore` to the current page list. Pins the open-ended tail at
74
- * `cursor` (making it a fixed bounded range) and appends a fresh open-ended
75
- * page starting at `cursor`. The shared boundary keeps the feed gap- and
76
- * dup-free.
77
- *
78
- * Returns the new page list, or `undefined` when the given `cursor` is not
79
- * valid (null or undefined — caller should no-op).
80
- */
80
+ * Apply a `loadMore` to the current page list. Pins the open-ended tail at
81
+ * `cursor` (making it a fixed bounded range) and appends a fresh open-ended
82
+ * page starting at `cursor`. The shared boundary keeps the feed gap- and
83
+ * dup-free.
84
+ *
85
+ * Returns the new page list, or `undefined` when the given `cursor` is not
86
+ * valid (null or undefined — caller should no-op).
87
+ */
81
88
  declare const applyLoadMore: (pages: Page[], cursor: null | string | undefined, numberItems: number) => Page[] | undefined;
82
- export { JOIN_FACTOR, type Page, type PaginatedCoreResult, type PaginationResult, type PaginationStatus, SPLIT_FACTOR, applyLoadMore, derivePaginationStatus, initialPages, rebalance };
89
+ /**
90
+ * What a feed does with one page's failure.
91
+ *
92
+ * - `surface` — report it (the `error` value and `onError`), as before.
93
+ * - `restart` — reload the feed from its first page, silently: the page's cursor no longer decodes.
94
+ * - `ignore` — drop it: a page the feed no longer holds, still reporting from before a restart.
95
+ */
96
+ type PageFailure = "ignore" | "restart" | "surface";
97
+ /** The feed's first page before any `loadMore`: `(null, null]`, the one page that carries no cursor. */
98
+ declare const isHeadPage: (page: Page) => boolean;
99
+ /**
100
+ * Classify a page failure. Only `INVALID_CURSOR` changes the answer: the server refuses a cursor
101
+ * minted by an older build (a deploy changed the query's order or the engine's cursor encoding), and
102
+ * every bounded page the feed holds carries one, so the only way forward is page one.
103
+ *
104
+ * Two cases surface it instead. The head page has no cursor to be stale. And `restartedSinceLoad`
105
+ * (the feed restarted, and no page past the head has had a frame since) means the server is refusing
106
+ * the cursors it mints now, which a second restart would only repeat on every `loadMore`.
107
+ */
108
+ declare const classifyPageFailure: (pages: Page[], isFailedPage: (page: Page) => boolean, error: {
109
+ code?: string;
110
+ }, restartedSinceLoad: boolean) => PageFailure;
111
+ export { JOIN_FACTOR, type Page, type PageFailure, type PaginatedCoreResult, type PaginationResult, type PaginationStatus, SPLIT_FACTOR, applyLoadMore, classifyPageFailure, derivePaginationStatus, headPage, initialPages, isHeadPage, rebalance };
@@ -1,61 +1 @@
1
- const SPLIT_FACTOR = 2;
2
- const JOIN_FACTOR = 0.5;
3
- const initialPages = (numberItems) => [
4
- // eslint-disable-next-line unicorn/no-null -- `lower: null` is the feed head, `upper: null` the open-ended tail — both are wire-shape cursors.
5
- { lower: null, numItems: numberItems, upper: null }
6
- ];
7
- const rebalance = (pages, results) => {
8
- for (const [index, page] of pages.entries()) {
9
- if (page.upper === null) {
10
- continue;
11
- }
12
- const result = results[index];
13
- if (!result) {
14
- continue;
15
- }
16
- const size = result.page.length;
17
- if (size > SPLIT_FACTOR * page.numItems && result.splitCursor) {
18
- const split = result.splitCursor;
19
- const next = [...pages];
20
- next.splice(index, 1, { lower: page.lower, numItems: page.numItems, upper: split }, { lower: split, numItems: page.numItems, upper: page.upper });
21
- return next;
22
- }
23
- if (size < JOIN_FACTOR * page.numItems && index + 1 < pages.length) {
24
- const neighbour = pages[index + 1];
25
- if (!neighbour) {
26
- continue;
27
- }
28
- const next = [...pages];
29
- next.splice(index, 2, { lower: page.lower, numItems: page.numItems, upper: neighbour.upper });
30
- return next;
31
- }
32
- }
33
- return void 0;
34
- };
35
- const derivePaginationStatus = (skipped, pageResults) => {
36
- if (skipped || !pageResults[0]) {
37
- return { nextCursor: void 0, status: "LoadingFirstPage" };
38
- }
39
- const tail = pageResults.at(-1);
40
- if (!tail) {
41
- return { nextCursor: void 0, status: "LoadingMore" };
42
- }
43
- if (tail.isDone || tail.continueCursor === null) {
44
- return { nextCursor: void 0, status: "Exhausted" };
45
- }
46
- return { nextCursor: tail.continueCursor, status: "CanLoadMore" };
47
- };
48
- const applyLoadMore = (pages, cursor, numberItems) => {
49
- if (cursor === void 0 || cursor === null) {
50
- return void 0;
51
- }
52
- const next = [...pages];
53
- const tail = next.at(-1);
54
- if (tail) {
55
- next[next.length - 1] = { lower: tail.lower, numItems: tail.numItems, upper: cursor };
56
- }
57
- next.push({ lower: cursor, numItems: numberItems, upper: null });
58
- return next;
59
- };
60
-
61
- export { JOIN_FACTOR, SPLIT_FACTOR, applyLoadMore, derivePaginationStatus, initialPages, rebalance };
1
+ const c=2,p=.5,l=e=>({lower:null,numItems:e,upper:null}),m=e=>[l(e)],d=(e,r)=>{for(const[n,t]of e.entries()){if(t.upper===null)continue;const u=r[n];if(!u)continue;const i=u.page.length;if((i>2*t.numItems||u.splitRequired===!0)&&u.splitCursor){const o=u.splitCursor,s=[...e];return s.splice(n,1,{lower:t.lower,numItems:t.numItems,upper:o},{lower:o,numItems:t.numItems,upper:t.upper}),s}if(i<.5*t.numItems&&n+1<e.length&&r[n+1]?.splitRequired!==!0){const o=e[n+1];if(!o)continue;const s=[...e];return s.splice(n,2,{lower:t.lower,numItems:t.numItems,upper:o.upper}),s}}},f=(e,r)=>{if(e||!r[0])return{nextCursor:void 0,status:"LoadingFirstPage"};const n=r.at(-1);return n?n.isDone||n.continueCursor===null?{nextCursor:void 0,status:"Exhausted"}:{nextCursor:n.continueCursor,status:"CanLoadMore"}:{nextCursor:void 0,status:"LoadingMore"}},I=(e,r,n)=>{if(r==null)return;const t=[...e],u=t.at(-1);return u&&(t[t.length-1]={lower:u.lower,numItems:u.numItems,upper:r}),t.push({lower:r,numItems:n,upper:null}),t},a=e=>e.lower===null&&e.upper===null,C=(e,r,n,t)=>{if(n.code!=="INVALID_CURSOR")return"surface";const u=e.find(i=>r(i));return u===void 0?"ignore":a(u)||t?"surface":"restart"};export{p as JOIN_FACTOR,c as SPLIT_FACTOR,I as applyLoadMore,C as classifyPageFailure,f as derivePaginationStatus,l as headPage,m as initialPages,a as isHeadPage,d as rebalance};