@ic-reactor/core 0.3.5 → 0.4.1
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.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { CreateReActorOptions } from "@ic-reactor/store";
|
|
|
2
2
|
import { ActorQuery, ActorUpdate } from "./types";
|
|
3
3
|
export declare const createReActor: <A extends unknown>(options: CreateReActorOptions) => {
|
|
4
4
|
canisterId: import("@ic-reactor/store").CanisterId;
|
|
5
|
-
|
|
5
|
+
serviceFields: import("@ic-reactor/store").ExtractedService<A>;
|
|
6
6
|
unsubscribeActor: () => void;
|
|
7
|
+
initialize: (options?: import("@ic-reactor/store").UpdateAgentOptions | undefined) => Promise<void>;
|
|
7
8
|
updateMethodState: (newState: Partial<import("@ic-reactor/store").ActorMethodStates<A>>) => void;
|
|
8
9
|
subscribeAgent: (callback: (agent: import("@ic-reactor/store").HttpAgent) => void) => () => void;
|
|
9
10
|
unsubscribeAgent: (callback: (agent: import("@ic-reactor/store").HttpAgent) => void) => void;
|
|
@@ -11,7 +12,7 @@ export declare const createReActor: <A extends unknown>(options: CreateReActorOp
|
|
|
11
12
|
authenticate: () => Promise<void>;
|
|
12
13
|
getAgent: () => import("@ic-reactor/store").HttpAgent;
|
|
13
14
|
actorStore: import("@ic-reactor/store").ActorStore<A>;
|
|
14
|
-
authStore: import("@ic-reactor/store").
|
|
15
|
+
authStore: import("@ic-reactor/store").AgentAuthStore;
|
|
15
16
|
queryCall: ActorQuery<A>;
|
|
16
17
|
updateCall: ActorUpdate<A>;
|
|
17
18
|
};
|
package/dist/index.js
CHANGED
|
@@ -104,7 +104,7 @@ const createReActor = (options) => {
|
|
|
104
104
|
throw error;
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
-
const queryCall = ({ functionName, args = [],
|
|
107
|
+
const queryCall = ({ functionName, args = [], callOnMount = false, autoRefresh = false, refreshInterval = 5000, }) => {
|
|
108
108
|
let intervalId = null;
|
|
109
109
|
const _a = reActorMethod(functionName, ...args), { call } = _a, rest = __rest(_a, ["call"]);
|
|
110
110
|
if (autoRefresh) {
|
|
@@ -113,7 +113,7 @@ const createReActor = (options) => {
|
|
|
113
113
|
}, refreshInterval);
|
|
114
114
|
}
|
|
115
115
|
let initialData = Promise.resolve();
|
|
116
|
-
if (
|
|
116
|
+
if (callOnMount)
|
|
117
117
|
initialData = call();
|
|
118
118
|
return Object.assign(Object.assign({}, rest), { call, initialData, intervalId });
|
|
119
119
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type ActorUpdateReturn<A, M extends keyof A> = {
|
|
|
25
25
|
export type ActorQueryArgs<A, M extends keyof A> = {
|
|
26
26
|
functionName: M;
|
|
27
27
|
args?: ExtractActorMethodArgs<A[M]>;
|
|
28
|
-
|
|
28
|
+
callOnMount?: boolean;
|
|
29
29
|
autoRefresh?: boolean;
|
|
30
30
|
refreshInterval?: number;
|
|
31
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A React library for interacting with Dfinity actors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"node": ">=10"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ic-reactor/store": "^0.
|
|
38
|
+
"@ic-reactor/store": "^0.4.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@dfinity/agent": "^0.20",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@peculiar/webcrypto": "1.4",
|
|
47
47
|
"zustand": "4.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1086988151f4b52e95db045856a125b847d66639"
|
|
50
50
|
}
|