@raf-query/core 0.7.6 → 0.7.8
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/CHANGELOG.md +15 -1
- package/dist/cache.mjs +6 -7
- package/dist/entry.mjs +1 -2
- package/dist/observer.mjs +1 -2
- package/dist/query.mjs +4 -5
- package/dist/share.mjs +1 -2
- package/package.json +1 -1
- package/dist/cast.mjs +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.8](https://github.com/KATT/raf-query/compare/0.7.7...0.7.8) (2026-10-14)
|
|
4
|
+
|
|
5
|
+
* inline type assertions next to their SAFETY comments ([#104](https://github.com/KATT/raf-query/issues/104)) ([53fdbdb](https://github.com/KATT/raf-query/commit/53fdbdbfdcb146799b145faadb579bbb45e19139))
|
|
6
|
+
* **release:** skip npm publish when packages did not change ([#101](https://github.com/KATT/raf-query/issues/101)) ([4c6c315](https://github.com/KATT/raf-query/commit/4c6c3156224cfb74a62f6c6e5505c30da7400289)), references [#80](https://github.com/KATT/raf-query/issues/80)
|
|
7
|
+
* say the route waits for the post and comments stream in after ([#102](https://github.com/KATT/raf-query/issues/102)) ([3d0c5f4](https://github.com/KATT/raf-query/commit/3d0c5f4c089921fc178b374179dc23bafdbe899c))
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **examples:** start prefetch off and link whole issue rows ([#105](https://github.com/KATT/raf-query/issues/105)) ([cf83077](https://github.com/KATT/raf-query/commit/cf8307701abc6e6ff50304b7245e3bc2af929f3a))
|
|
12
|
+
|
|
13
|
+
## [0.7.7](https://github.com/KATT/raf-query/compare/0.7.6...0.7.7) (2026-10-14)
|
|
14
|
+
|
|
15
|
+
- **examples:** placeholder for the Effect example's Vercel project ([#100](https://github.com/KATT/raf-query/issues/100)) ([0142c6e](https://github.com/KATT/raf-query/commit/0142c6ef9448631c6239fff4a4ddf16db02b35de))
|
|
16
|
+
|
|
3
17
|
## [0.7.6](https://github.com/KATT/raf-query/compare/0.7.5...0.7.6) (2026-10-14)
|
|
4
18
|
|
|
5
|
-
|
|
19
|
+
- **agents:** open PRs ready for review unless experimental ([#99](https://github.com/KATT/raf-query/issues/99)) ([e141269](https://github.com/KATT/raf-query/commit/e141269cf290b56dcb452bb0aa63a3b490657142))
|
|
6
20
|
|
|
7
21
|
## [0.7.5](https://github.com/KATT/raf-query/compare/0.7.4...0.7.5) (2026-10-14)
|
|
8
22
|
|
package/dist/cache.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { Platform } from "./platform.mjs";
|
|
3
|
-
import { unsafeCast } from "./cast.mjs";
|
|
4
3
|
import { hashKey, matchesKey } from "./key.mjs";
|
|
5
4
|
import { listen } from "./listen.mjs";
|
|
6
5
|
import { changes, emit, fetch, invalidate, isObserved, make as make$1, needsRefetch, onPlatformEvent, provide, remove, reset, revalidate, setData, setOptions, start } from "./entry.mjs";
|
|
@@ -37,13 +36,13 @@ function isUpdateFunction(updater) {
|
|
|
37
36
|
return Predicate.isFunction(updater);
|
|
38
37
|
}
|
|
39
38
|
function typed(entry) {
|
|
40
|
-
return
|
|
39
|
+
return entry;
|
|
41
40
|
}
|
|
42
41
|
function handleOf(entry) {
|
|
43
|
-
return
|
|
42
|
+
return entry.handle;
|
|
44
43
|
}
|
|
45
44
|
function dataOf(entry) {
|
|
46
|
-
return
|
|
45
|
+
return entry.state.data;
|
|
47
46
|
}
|
|
48
47
|
function keyMatcher(filter) {
|
|
49
48
|
const prefix = filter.queryKey;
|
|
@@ -60,7 +59,7 @@ function keyMatcher(filter) {
|
|
|
60
59
|
* once, and revalidates in the background.
|
|
61
60
|
*/
|
|
62
61
|
function load(entry, pages, fresh) {
|
|
63
|
-
if (!entry.state.hasData || fresh && needsRefetch(entry)) return
|
|
62
|
+
if (!entry.state.hasData || fresh && needsRefetch(entry)) return fetch(entry, { pages });
|
|
64
63
|
revalidate(entry);
|
|
65
64
|
return Effect.succeed(dataOf(entry));
|
|
66
65
|
}
|
|
@@ -109,7 +108,7 @@ const make = /*#__PURE__*/ Effect.fnUntraced(function* (config = {}) {
|
|
|
109
108
|
return Effect.succeed(entry);
|
|
110
109
|
});
|
|
111
110
|
const match = (target) => {
|
|
112
|
-
const [first, input] =
|
|
111
|
+
const [first, input] = target;
|
|
113
112
|
if (Predicate.isFunction(first)) {
|
|
114
113
|
const entry = state.entries.get(hashKey(optionsFor(first, input).queryKey));
|
|
115
114
|
return entry ? [entry] : [];
|
|
@@ -171,7 +170,7 @@ const make = /*#__PURE__*/ Effect.fnUntraced(function* (config = {}) {
|
|
|
171
170
|
}),
|
|
172
171
|
subscribeUnsafe,
|
|
173
172
|
[TypeId]: TypeId,
|
|
174
|
-
watch: (factory, ...args) => Stream.unwrap(Effect.map(buildFor(factory, args[0]), (entry) =>
|
|
173
|
+
watch: (factory, ...args) => Stream.unwrap(Effect.map(buildFor(factory, args[0]), (entry) => changes(entry)))
|
|
175
174
|
};
|
|
176
175
|
});
|
|
177
176
|
/** A layer that provides a {@link QueryCache} for the layer's lifetime. */
|
package/dist/entry.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { whenOnline } from "./platform.mjs";
|
|
2
|
-
import { unsafeCast } from "./cast.mjs";
|
|
3
2
|
import { replaceEqualDeep } from "./share.mjs";
|
|
4
3
|
import { fetchPages, isInfiniteData, nextPageParam, previousPageParam } from "./infinite.mjs";
|
|
5
4
|
import { listen } from "./listen.mjs";
|
|
@@ -38,7 +37,7 @@ function isQuery(value) {
|
|
|
38
37
|
return Predicate.hasProperty(value, TypeId);
|
|
39
38
|
}
|
|
40
39
|
function entryOf(query) {
|
|
41
|
-
return
|
|
40
|
+
return query;
|
|
42
41
|
}
|
|
43
42
|
function emit(cache, event) {
|
|
44
43
|
for (const listener of cache.listeners) listener(event);
|
package/dist/observer.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { Platform } from "./platform.mjs";
|
|
3
|
-
import { unsafeCast } from "./cast.mjs";
|
|
4
3
|
import { listen } from "./listen.mjs";
|
|
5
4
|
import { entryOf } from "./entry.mjs";
|
|
6
5
|
import { fetchNextPage, fetchPreviousPage, getUnsafe as getUnsafe$1, hasNextPageUnsafe, hasPreviousPageUnsafe, refetch, subscribeUnsafe as subscribeUnsafe$1 } from "./query.mjs";
|
|
@@ -61,7 +60,7 @@ function isQueryObserver(value) {
|
|
|
61
60
|
return Predicate.hasProperty(value, TypeId);
|
|
62
61
|
}
|
|
63
62
|
function implOf(self) {
|
|
64
|
-
return
|
|
63
|
+
return self;
|
|
65
64
|
}
|
|
66
65
|
function isResultKey(name) {
|
|
67
66
|
return Predicate.isString(name) && Object.hasOwn(resultKeys, name);
|
package/dist/query.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { unsafeCast } from "./cast.mjs";
|
|
3
2
|
import { BrowserOnlyError as BrowserOnlyError$1, CancelledError as CancelledError$1, TypeId as TypeId$1, changes as changes$1, entryOf, fetch as fetch$1, hasNextPageUnsafe as hasNextPageUnsafe$1, hasPreviousPageUnsafe as hasPreviousPageUnsafe$1, invalidate as invalidate$1, isQuery as isQuery$1, isStaleUnsafe as isStaleUnsafe$1, metaOf, provide, readUnsafe as readUnsafe$1, reset as reset$1, revalidate, subscribeUnsafe as subscribeUnsafe$1 } from "./entry.mjs";
|
|
4
3
|
import { Effect } from "effect";
|
|
5
4
|
import { dual } from "effect/Function";
|
|
@@ -40,10 +39,10 @@ const CancelledError = CancelledError$1;
|
|
|
40
39
|
const BrowserOnlyError = BrowserOnlyError$1;
|
|
41
40
|
const isQuery = isQuery$1;
|
|
42
41
|
function typed(effect) {
|
|
43
|
-
return
|
|
42
|
+
return effect;
|
|
44
43
|
}
|
|
45
44
|
function typedState(state) {
|
|
46
|
-
return
|
|
45
|
+
return state;
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
48
|
* Start a request, or join the one in flight. Fails with the request's
|
|
@@ -99,14 +98,14 @@ function getUnsafe(self) {
|
|
|
99
98
|
* the stream runs, so invalidation and focus refetch it.
|
|
100
99
|
*/
|
|
101
100
|
function changes(self) {
|
|
102
|
-
return
|
|
101
|
+
return changes$1(entryOf(self));
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
104
|
* The promise a render should unwrap. Starts the first request if nothing
|
|
106
105
|
* has, and retries a failed first load once its error has been shown.
|
|
107
106
|
*/
|
|
108
107
|
function readUnsafe(self) {
|
|
109
|
-
return
|
|
108
|
+
return readUnsafe$1(entryOf(self));
|
|
110
109
|
}
|
|
111
110
|
/**
|
|
112
111
|
* Refetch cached data in the background if it's stale, as `prefetch` does
|
package/dist/share.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { unsafeCast } from "./cast.mjs";
|
|
2
1
|
import { isPlainRecord } from "./key.mjs";
|
|
3
2
|
//#region src/share.ts
|
|
4
3
|
function isPlainArray(value) {
|
|
@@ -35,7 +34,7 @@ function share(previous, next, depth) {
|
|
|
35
34
|
* anything else is taken from `next`. TanStack Query's `replaceEqualDeep`.
|
|
36
35
|
*/
|
|
37
36
|
function replaceEqualDeep(previous, next) {
|
|
38
|
-
return
|
|
37
|
+
return share(previous, next, 0);
|
|
39
38
|
}
|
|
40
39
|
//#endregion
|
|
41
40
|
export { replaceEqualDeep };
|
package/package.json
CHANGED
package/dist/cast.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/cast.ts
|
|
2
|
-
/**
|
|
3
|
-
* The one place a value's static type is replaced. Every call site states
|
|
4
|
-
* the invariant that makes it sound in a `SAFETY:` comment.
|
|
5
|
-
*/
|
|
6
|
-
function unsafeCast(value) {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { unsafeCast };
|