@codecks/fetch 0.1.1 → 0.1.2
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { InferModelQuery, InferRelQuery, ModelQuery, RelQuery } from "../query-type-MH8IxqbW.js";
|
|
1
|
+
import { AnyDesc, InferModelQuery, InferRelQuery, ModelQuery, RelQuery } from "../query-type-MH8IxqbW.js";
|
|
2
2
|
import "../loader-types-DJdGWL4B.js";
|
|
3
3
|
import { _rootDesc$1 as _rootDesc } from "../_root-BG9fhc-C.js";
|
|
4
|
-
import { Store } from "../store-
|
|
4
|
+
import { Store } from "../store-mAj3G67A.js";
|
|
5
5
|
|
|
6
6
|
//#region src/_exploration/create-hooks.d.ts
|
|
7
|
-
declare const createHooks:
|
|
8
|
-
useFetch: <K extends
|
|
9
|
-
useFetchFromRoot: <const
|
|
7
|
+
declare const createHooks: (store: Store) => {
|
|
8
|
+
useFetch: <K extends string, Id extends string, const Q extends ModelQuery<AnyDesc, Record<string, AnyDesc>>>(model: K, id: Id, q: Q) => InferModelQuery<AnyDesc, Q, Record<string, AnyDesc>>;
|
|
9
|
+
useFetchFromRoot: <const Q extends RelQuery<typeof _rootDesc, Record<string, AnyDesc>>>(q: Q) => InferRelQuery<typeof _rootDesc, Q, Record<string, AnyDesc>>;
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
12
|
export { createHooks };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRelKey, makeRelQuerySerializable } from "../query-helpers-DsMMOtSO.js";
|
|
1
|
+
import { getRelKey, makeRelQuerySerializable, modelMap } from "../query-helpers-DsMMOtSO.js";
|
|
2
2
|
|
|
3
3
|
//#region src/_exploration/immediate-cache.ts
|
|
4
4
|
var ImmediateCache = class {
|
|
@@ -48,10 +48,8 @@ const calcPartKeys = (model, id, field) => {
|
|
|
48
48
|
};
|
|
49
49
|
var Store = class {
|
|
50
50
|
cache = new ImmediateCache();
|
|
51
|
-
modelMap;
|
|
52
|
-
loader
|
|
53
|
-
constructor(modelMap, loader) {
|
|
54
|
-
this.modelMap = modelMap;
|
|
51
|
+
modelMap = modelMap;
|
|
52
|
+
constructor(loader) {
|
|
55
53
|
this.loader = loader;
|
|
56
54
|
loader.setOnLoaded((model, key, res) => this.onLoaded(model, key, res));
|
|
57
55
|
}
|
|
@@ -28,10 +28,10 @@ declare class ImmediateCache {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/_exploration/store.d.ts
|
|
30
30
|
declare class Store {
|
|
31
|
+
private loader;
|
|
31
32
|
cache: ImmediateCache;
|
|
32
33
|
modelMap: Record<string, AnyDesc>;
|
|
33
|
-
loader: BaseLoader;
|
|
34
|
-
constructor(modelMap: Record<string, AnyDesc>, loader: BaseLoader);
|
|
34
|
+
constructor(loader: BaseLoader);
|
|
35
35
|
loadData(model: string, ids: string[], q: ModelQuery<any, any>, acceptDirty?: boolean, iteration?: number): LoaderResult;
|
|
36
36
|
onLoaded(model: string, key: string, partialInstance: Record<string, unknown>): void;
|
|
37
37
|
/**
|