@lunora/react 1.0.0-alpha.12 → 1.0.0-alpha.14

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/index.mjs CHANGED
@@ -3,17 +3,17 @@ export { AuthLoading, Authenticated, Unauthenticated } from './packem_shared/Aut
3
3
  export { useAuthState } from './packem_shared/useAuthState-BiGhtSCs.mjs';
4
4
  export { LunoraProvider, useLunora } from './packem_shared/LunoraProvider-D38Xp16l.mjs';
5
5
  export { CheckoutButton, CustomerPortalButton, useCheckout } from './packem_shared/CheckoutButton-CVSry8U1.mjs';
6
- export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-Cij4KWBK.mjs';
6
+ export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-C3uwOTMW.mjs';
7
7
  export { default as useAuth } from './packem_shared/useAuth-CNUKtOOp.mjs';
8
8
  export { default as useConnectionStatus } from './packem_shared/useConnectionStatus-DRSY9ldm.mjs';
9
- export { useFlag, useFlags } from './packem_shared/useFlag-Bg5DpkGv.mjs';
10
- export { default as useInfiniteQuery } from './packem_shared/useInfiniteQuery-BBIDFXBN.mjs';
9
+ export { useFlag, useFlags } from './packem_shared/useFlag-B5NFNmRD.mjs';
10
+ export { default as useInfiniteQuery } from './packem_shared/useInfiniteQuery-Ck5HRuLQ.mjs';
11
11
  export { useMutation } from './packem_shared/useMutation-CrvMXRsk.mjs';
12
12
  export { useMutator } from './packem_shared/useMutator-IIrLtDiM.mjs';
13
- export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-AQO3kdp1.mjs';
14
- export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-B6OHn0eL.mjs';
13
+ export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-UAE4P3Bd.mjs';
14
+ export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-Bwu06QLX.mjs';
15
15
  export { usePresence } from './packem_shared/usePresence-D7jLuxj0.mjs';
16
- export { default as useQuery } from './packem_shared/useQuery-EB74gtBJ.mjs';
16
+ export { default as useQuery } from './packem_shared/useQuery-ByRfO1D3.mjs';
17
17
  export { useRateLimit } from './packem_shared/useRateLimit-DTEffQEi.mjs';
18
- export { useStream } from './packem_shared/useStream-MdYnWDL_.mjs';
19
- export { default as useSubscription } from './packem_shared/useSubscription-DSJuryrU.mjs';
18
+ export { useStream } from './packem_shared/useStream-BqZeZE3w.mjs';
19
+ export { default as useSubscription } from './packem_shared/useSubscription-i78qwMed.mjs';
@@ -1,4 +1,4 @@
1
- import { k as keyHash } from './query-key-B5eRQCbR.mjs';
1
+ import { k as keyHash } from './query-key-BmCbgidV.mjs';
2
2
 
3
3
  class LunoraSubscriptionRegistry {
4
4
  constructor(client) {
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { useQueryClient, useQuery } from '@tanstack/react-query';
3
3
  import { useMemo, useEffect } from 'react';
4
- import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
4
+ import { g as getSubscriptionRegistry } from './cache-BFlsXmup.mjs';
5
5
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
6
- import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-B5eRQCbR.mjs';
6
+ import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-BmCbgidV.mjs';
7
7
 
8
8
  const usePreloadedQuery = function(preloaded) {
9
9
  const client = useLunora();
@@ -1,4 +1,4 @@
1
- import { l as lunoraQueryKey } from './query-key-B5eRQCbR.mjs';
1
+ import { l as lunoraQueryKey } from './query-key-BmCbgidV.mjs';
2
2
 
3
3
  const lunoraQueryOptions = (client, function_, args, options = {}) => {
4
4
  const argsRecord = args ?? {};
@@ -1,4 +1,4 @@
1
- import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
1
+ import { s as stableStringify } from './stable-key-CGp4e2Ux.mjs';
2
2
 
3
3
  const keyHash = (queryKey) => stableStringify(queryKey);
4
4
  const lunoraQueryKey = (function_, args, shardKey) => [
@@ -8,12 +8,20 @@ const stableStringify = (value) => {
8
8
  if (value === void 0) {
9
9
  return "null";
10
10
  }
11
+ if (typeof value === "bigint") {
12
+ throw new TypeError("stableStringify: cannot use a bigint in a cache key (query/subscription/shape args) — pass it as a string");
13
+ }
11
14
  if (value === null || typeof value !== "object") {
12
15
  return JSON.stringify(value);
13
16
  }
14
17
  if (Array.isArray(value)) {
15
18
  return `[${value.map((item) => stableStringify(item)).join(",")}]`;
16
19
  }
20
+ const proto = Object.getPrototypeOf(value);
21
+ if (proto !== null && proto !== Object.prototype) {
22
+ const name = value.constructor?.name ?? "value";
23
+ throw new TypeError(`stableStringify: cannot use a ${name} in a cache key (query/subscription/shape args) — only plain objects, arrays, and JSON primitives are supported`);
24
+ }
17
25
  const record = value;
18
26
  const keys = Object.keys(record).toSorted(compareKeys);
19
27
  const parts = [];
@@ -2,9 +2,9 @@
2
2
  import { initialPages, rebalance, derivePaginationStatus, applyLoadMore } from '@lunora/client/pagination';
3
3
  import { useQueryClient } from '@tanstack/react-query';
4
4
  import { useRef, useReducer, useState, useEffect, useCallback } from 'react';
5
- import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
5
+ import { g as getSubscriptionRegistry } from './cache-BFlsXmup.mjs';
6
6
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
7
- import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-B5eRQCbR.mjs';
7
+ import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-BmCbgidV.mjs';
8
8
 
9
9
  const useLazyRef = function(create) {
10
10
  const reference = useRef(void 0);
@@ -2,7 +2,7 @@
2
2
  import { c } from 'react/compiler-runtime';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
5
- import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
5
+ import { s as stableStringify } from './stable-key-CGp4e2Ux.mjs';
6
6
 
7
7
  const FLAGS_EVAL_PATH = "__lunora_flags__:eval";
8
8
  const flagKind = (value) => {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { c } from 'react/compiler-runtime';
3
3
  import { useRef, useEffect } from 'react';
4
- import { u as usePaginatedCore } from './use-paginated-core-DP72UNWn.mjs';
4
+ import { u as usePaginatedCore } from './use-paginated-core-COGbvB0R.mjs';
5
5
 
6
6
  const useInfiniteQuery = (function_, args, options) => {
7
7
  const $ = c(15);
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { c } from 'react/compiler-runtime';
3
- import { u as usePaginatedCore } from './use-paginated-core-DP72UNWn.mjs';
3
+ import { u as usePaginatedCore } from './use-paginated-core-COGbvB0R.mjs';
4
4
 
5
5
  const usePaginatedQuery = (function_, args, options) => {
6
6
  const $ = c(7);
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { useQueryClient, useQuery as useQuery$1 } from '@tanstack/react-query';
3
3
  import { useMemo, useEffect } from 'react';
4
- import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
4
+ import { g as getSubscriptionRegistry } from './cache-BFlsXmup.mjs';
5
5
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
6
- import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-B5eRQCbR.mjs';
7
- import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
6
+ import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-BmCbgidV.mjs';
7
+ import { s as stableStringify } from './stable-key-CGp4e2Ux.mjs';
8
8
 
9
9
  const useQuery = (function_, args, options = {}) => {
10
10
  const client = useLunora();
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { useReducer, useRef, useEffect } from 'react';
3
3
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
4
- import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
4
+ import { s as stableStringify } from './stable-key-CGp4e2Ux.mjs';
5
5
 
6
6
  const reducer = function(state, action) {
7
7
  switch (action.type) {
@@ -3,7 +3,7 @@ import { c } from 'react/compiler-runtime';
3
3
  import { createQuerySubscription } from '@lunora/client/query';
4
4
  import { useState, useRef, useEffect } from 'react';
5
5
  import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
6
- import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
6
+ import { s as stableStringify } from './stable-key-CGp4e2Ux.mjs';
7
7
 
8
8
  const useSubscription = (function_, args, t0) => {
9
9
  const $ = c(22);
package/dist/server.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createServerClient } from '@lunora/client/ssr';
2
2
  export { createServerClient, deserializePreloaded, getServerSession, serializePreloaded } from '@lunora/client/ssr';
3
- import { l as lunoraQueryKey } from './packem_shared/query-key-B5eRQCbR.mjs';
4
- export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-Cij4KWBK.mjs';
3
+ import { l as lunoraQueryKey } from './packem_shared/query-key-BmCbgidV.mjs';
4
+ export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-C3uwOTMW.mjs';
5
5
  export { preloadQuery, preloadedQueryResult } from '@lunora/client';
6
6
  export { HydrationBoundary, dehydrate } from '@tanstack/react-query';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/react",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.14",
4
4
  "description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -49,7 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@lunora/client": "1.0.0-alpha.10",
52
+ "@lunora/client": "1.0.0-alpha.12",
53
53
  "@lunora/ratelimit": "1.0.0-alpha.3"
54
54
  },
55
55
  "peerDependencies": {