@lunora/react 1.0.0-alpha.3 → 1.0.0-alpha.5
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/__assets__/package-og.svg +1 -1
- package/dist/index.mjs +7 -7
- package/dist/packem_shared/{cache-CItk3fgN.mjs → cache-CAp1fVNL.mjs} +1 -1
- package/dist/packem_shared/{hydratePreloaded-BlFL9FGq.mjs → hydratePreloaded-B6OHn0eL.mjs} +2 -2
- package/dist/packem_shared/{lunoraQueryOptions-CsuWzjg1.mjs → lunoraQueryOptions-Cij4KWBK.mjs} +1 -1
- package/dist/packem_shared/query-key-B5eRQCbR.mjs +13 -0
- package/dist/packem_shared/stable-key-CaKZv9lp.mjs +30 -0
- package/dist/packem_shared/{use-paginated-core-CoOfcc-p.mjs → use-paginated-core-DxGvzQVR.mjs} +2 -2
- package/dist/packem_shared/{useInfiniteQuery-MH0x4l8h.mjs → useInfiniteQuery-HjOCDd3R.mjs} +1 -1
- package/dist/packem_shared/{usePaginatedQuery-D3PTDRGS.mjs → usePaginatedQuery-BGYvICZU.mjs} +1 -1
- package/dist/packem_shared/{useQuery-C5S0W-7K.mjs → useQuery-EB74gtBJ.mjs} +3 -2
- package/dist/packem_shared/{useStream-BRY9nemd.mjs → useStream-MdYnWDL_.mjs} +1 -1
- package/dist/packem_shared/{useSubscription-CHMCjyQg.mjs → useSubscription-DSJuryrU.mjs} +1 -1
- package/dist/server.mjs +2 -2
- package/package.json +4 -4
- package/dist/packem_shared/query-key-C5rufkEE.mjs +0 -21
package/dist/index.mjs
CHANGED
|
@@ -3,15 +3,15 @@ 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-
|
|
6
|
+
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-Cij4KWBK.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 { default as useInfiniteQuery } from './packem_shared/useInfiniteQuery-
|
|
9
|
+
export { default as useInfiniteQuery } from './packem_shared/useInfiniteQuery-HjOCDd3R.mjs';
|
|
10
10
|
export { useMutation } from './packem_shared/useMutation-CrvMXRsk.mjs';
|
|
11
|
-
export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-
|
|
12
|
-
export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-
|
|
11
|
+
export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-BGYvICZU.mjs';
|
|
12
|
+
export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-B6OHn0eL.mjs';
|
|
13
13
|
export { usePresence } from './packem_shared/usePresence-D7jLuxj0.mjs';
|
|
14
|
-
export { default as useQuery } from './packem_shared/useQuery-
|
|
14
|
+
export { default as useQuery } from './packem_shared/useQuery-EB74gtBJ.mjs';
|
|
15
15
|
export { useRateLimit } from './packem_shared/useRateLimit-DTEffQEi.mjs';
|
|
16
|
-
export { useStream } from './packem_shared/useStream-
|
|
17
|
-
export { default as useSubscription } from './packem_shared/useSubscription-
|
|
16
|
+
export { useStream } from './packem_shared/useStream-MdYnWDL_.mjs';
|
|
17
|
+
export { default as useSubscription } from './packem_shared/useSubscription-DSJuryrU.mjs';
|
|
@@ -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-
|
|
4
|
+
import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
|
|
5
5
|
import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
|
|
6
|
-
import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-
|
|
6
|
+
import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-B5eRQCbR.mjs';
|
|
7
7
|
|
|
8
8
|
const usePreloadedQuery = function(preloaded) {
|
|
9
9
|
const client = useLunora();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
|
|
2
|
+
|
|
3
|
+
const keyHash = (queryKey) => stableStringify(queryKey);
|
|
4
|
+
const lunoraQueryKey = (function_, args, shardKey) => [
|
|
5
|
+
"lunora",
|
|
6
|
+
function_.__lunoraRef,
|
|
7
|
+
args,
|
|
8
|
+
// eslint-disable-next-line unicorn/no-null -- this literal is part of the JSON-serialized query key TanStack hashes for dedup; `null` keeps a stable, distinct slot from an absent shardKey across renders.
|
|
9
|
+
shardKey ?? null
|
|
10
|
+
];
|
|
11
|
+
const serializeQueryKey = (queryKey) => keyHash(queryKey);
|
|
12
|
+
|
|
13
|
+
export { keyHash as k, lunoraQueryKey as l, serializeQueryKey as s };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const compareKeys = (a, b) => {
|
|
2
|
+
if (a < b) {
|
|
3
|
+
return -1;
|
|
4
|
+
}
|
|
5
|
+
return a > b ? 1 : 0;
|
|
6
|
+
};
|
|
7
|
+
const stableStringify = (value) => {
|
|
8
|
+
if (value === void 0) {
|
|
9
|
+
return "null";
|
|
10
|
+
}
|
|
11
|
+
if (value === null || typeof value !== "object") {
|
|
12
|
+
return JSON.stringify(value);
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
16
|
+
}
|
|
17
|
+
const record = value;
|
|
18
|
+
const keys = Object.keys(record).toSorted(compareKeys);
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const key of keys) {
|
|
21
|
+
const raw = record[key];
|
|
22
|
+
if (raw === void 0) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
parts.push(`${JSON.stringify(key)}:${stableStringify(raw)}`);
|
|
26
|
+
}
|
|
27
|
+
return `{${parts.join(",")}}`;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { stableStringify as s };
|
package/dist/packem_shared/{use-paginated-core-CoOfcc-p.mjs → use-paginated-core-DxGvzQVR.mjs}
RENAMED
|
@@ -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-
|
|
5
|
+
import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
|
|
6
6
|
import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
|
|
7
|
-
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-
|
|
7
|
+
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-B5eRQCbR.mjs';
|
|
8
8
|
|
|
9
9
|
const useLazyRef = function(create) {
|
|
10
10
|
const reference = useRef(void 0);
|
|
@@ -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-
|
|
4
|
+
import { u as usePaginatedCore } from './use-paginated-core-DxGvzQVR.mjs';
|
|
5
5
|
|
|
6
6
|
const useInfiniteQuery = (function_, args, options) => {
|
|
7
7
|
const $ = c(15);
|
package/dist/packem_shared/{usePaginatedQuery-D3PTDRGS.mjs → usePaginatedQuery-BGYvICZU.mjs}
RENAMED
|
@@ -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-
|
|
3
|
+
import { u as usePaginatedCore } from './use-paginated-core-DxGvzQVR.mjs';
|
|
4
4
|
|
|
5
5
|
const usePaginatedQuery = (function_, args, options) => {
|
|
6
6
|
const $ = c(7);
|
|
@@ -1,9 +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-
|
|
4
|
+
import { g as getSubscriptionRegistry } from './cache-CAp1fVNL.mjs';
|
|
5
5
|
import { useLunora } from './LunoraProvider-D38Xp16l.mjs';
|
|
6
|
-
import { l as lunoraQueryKey,
|
|
6
|
+
import { l as lunoraQueryKey, s as serializeQueryKey } from './query-key-B5eRQCbR.mjs';
|
|
7
|
+
import { s as stableStringify } from './stable-key-CaKZv9lp.mjs';
|
|
7
8
|
|
|
8
9
|
const useQuery = (function_, args, options = {}) => {
|
|
9
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 {
|
|
4
|
+
import { s as stableStringify } from './stable-key-CaKZv9lp.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 {
|
|
6
|
+
import { s as stableStringify } from './stable-key-CaKZv9lp.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-
|
|
4
|
-
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-
|
|
3
|
+
import { l as lunoraQueryKey } from './packem_shared/query-key-B5eRQCbR.mjs';
|
|
4
|
+
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-Cij4KWBK.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.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"directory": "packages/react"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"dist",
|
|
28
|
+
"./dist",
|
|
29
29
|
"README.md",
|
|
30
30
|
"LICENSE.md",
|
|
31
31
|
"__assets__"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@lunora/client": "1.0.0-alpha.
|
|
53
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
52
|
+
"@lunora/client": "1.0.0-alpha.4",
|
|
53
|
+
"@lunora/ratelimit": "1.0.0-alpha.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@tanstack/react-query": "^5.101.0",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const keyHash = (queryKey) => JSON.stringify(queryKey);
|
|
2
|
-
const stableStringify = (value) => {
|
|
3
|
-
if (value === null || typeof value !== "object") {
|
|
4
|
-
return JSON.stringify(value);
|
|
5
|
-
}
|
|
6
|
-
if (Array.isArray(value)) {
|
|
7
|
-
return `[${value.map((entry) => stableStringify(entry)).join(",")}]`;
|
|
8
|
-
}
|
|
9
|
-
const entries = Object.entries(value).toSorted(([a], [b]) => a.localeCompare(b));
|
|
10
|
-
return `{${entries.map(([key, value_]) => `${JSON.stringify(key)}:${stableStringify(value_)}`).join(",")}}`;
|
|
11
|
-
};
|
|
12
|
-
const lunoraQueryKey = (function_, args, shardKey) => [
|
|
13
|
-
"lunora",
|
|
14
|
-
function_.__lunoraRef,
|
|
15
|
-
args,
|
|
16
|
-
// eslint-disable-next-line unicorn/no-null -- this literal is part of the JSON-serialized query key TanStack hashes for dedup; `null` keeps a stable, distinct slot from an absent shardKey across renders.
|
|
17
|
-
shardKey ?? null
|
|
18
|
-
];
|
|
19
|
-
const serializeQueryKey = (queryKey) => keyHash(queryKey);
|
|
20
|
-
|
|
21
|
-
export { stableStringify as a, keyHash as k, lunoraQueryKey as l, serializeQueryKey as s };
|