@ic-reactor/core 0.3.2 → 0.3.3
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 +4 -3
- package/dist/types.d.ts +19 -19
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CreateReActorOptions } from "@ic-reactor/store";
|
|
2
|
-
import {
|
|
2
|
+
import { ActorQuery, ActorUpdate } from "./types";
|
|
3
3
|
export declare const createReActor: <A extends unknown>(options: CreateReActorOptions) => {
|
|
4
|
+
canisterId: import("@ic-reactor/store").CanisterId;
|
|
4
5
|
methodFields: import("@ic-reactor/store").ActorMethodField<A>[];
|
|
5
6
|
unsubscribeActor: () => void;
|
|
6
7
|
updateMethodState: (newState: Partial<import("@ic-reactor/store").ActorMethodStates<A>>) => void;
|
|
@@ -11,6 +12,6 @@ export declare const createReActor: <A extends unknown>(options: CreateReActorOp
|
|
|
11
12
|
getAgent: () => import("@ic-reactor/store").HttpAgent;
|
|
12
13
|
actorStore: import("@ic-reactor/store").ActorStore<A>;
|
|
13
14
|
authStore: import("@ic-reactor/store").AuthenticateStore;
|
|
14
|
-
queryCall:
|
|
15
|
-
updateCall:
|
|
15
|
+
queryCall: ActorQuery<A>;
|
|
16
|
+
updateCall: ActorUpdate<A>;
|
|
16
17
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { ActorMethod, ActorSubclass, ExtractActorMethodArgs, ExtractActorMethodReturnType, ActorMethodState } from "@ic-reactor/store";
|
|
3
|
-
export type
|
|
3
|
+
export type ActorGetStateFunction<A, M extends keyof A> = {
|
|
4
4
|
(key: "data"): ExtractActorMethodReturnType<A[M]> | undefined;
|
|
5
5
|
(key: "loading"): boolean;
|
|
6
6
|
(key: "error"): Error | undefined;
|
|
7
7
|
(): ActorMethodState<A, M>[string];
|
|
8
8
|
};
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
9
|
+
export type ActorSubscribeFunction<A, M extends keyof A> = (callback: (state: ActorMethodState<A, M>[string]) => void) => () => void;
|
|
10
|
+
export type ActorCallFunction<A, M extends keyof A> = (replaceArgs?: ExtractActorMethodArgs<A[M]>) => Promise<ExtractActorMethodReturnType<A[M]> | undefined>;
|
|
11
|
+
export type ActorQueryReturn<A, M extends keyof A> = {
|
|
12
12
|
intervalId: NodeJS.Timeout | null;
|
|
13
13
|
requestHash: string;
|
|
14
|
-
getState:
|
|
15
|
-
subscribe:
|
|
16
|
-
call:
|
|
14
|
+
getState: ActorGetStateFunction<A, M>;
|
|
15
|
+
subscribe: ActorSubscribeFunction<A, M>;
|
|
16
|
+
call: ActorCallFunction<A, M>;
|
|
17
17
|
initialData: Promise<ExtractActorMethodReturnType<A[M]> | undefined>;
|
|
18
18
|
};
|
|
19
|
-
export type
|
|
19
|
+
export type ActorUpdateReturn<A, M extends keyof A> = {
|
|
20
20
|
requestHash: string;
|
|
21
|
-
getState:
|
|
22
|
-
subscribe:
|
|
23
|
-
call:
|
|
21
|
+
getState: ActorGetStateFunction<A, M>;
|
|
22
|
+
subscribe: ActorSubscribeFunction<A, M>;
|
|
23
|
+
call: ActorCallFunction<A, M>;
|
|
24
24
|
};
|
|
25
|
-
export type
|
|
25
|
+
export type ActorQueryArgs<A, M extends keyof A> = {
|
|
26
26
|
functionName: M;
|
|
27
27
|
args?: ExtractActorMethodArgs<A[M]>;
|
|
28
28
|
disableInitialCall?: boolean;
|
|
29
29
|
autoRefresh?: boolean;
|
|
30
30
|
refreshInterval?: number;
|
|
31
31
|
};
|
|
32
|
-
export type
|
|
32
|
+
export type ActorUpdateArgs<A, M extends keyof A> = {
|
|
33
33
|
functionName: M;
|
|
34
34
|
args?: ExtractActorMethodArgs<A[M]>;
|
|
35
35
|
};
|
|
36
|
-
export type
|
|
37
|
-
export type
|
|
38
|
-
export type
|
|
39
|
-
export interface
|
|
40
|
-
queryCall:
|
|
41
|
-
updateCall:
|
|
36
|
+
export type ActorMethodCall<A = Record<string, ActorMethod>> = <M extends keyof A>(functionName: M, ...args: ExtractActorMethodArgs<A[M]>) => ActorUpdateReturn<A, M>;
|
|
37
|
+
export type ActorQuery<A = Record<string, ActorMethod>> = <M extends keyof A>(options: ActorQueryArgs<A, M>) => ActorQueryReturn<A, M>;
|
|
38
|
+
export type ActorUpdate<A = Record<string, ActorMethod>> = <M extends keyof A>(options: ActorUpdateArgs<A, M>) => ActorUpdateReturn<A, M>;
|
|
39
|
+
export interface ActorCoreActions<A extends ActorSubclass<any>> {
|
|
40
|
+
queryCall: ActorQuery<A>;
|
|
41
|
+
updateCall: ActorUpdate<A>;
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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.3.
|
|
38
|
+
"@ic-reactor/store": "^0.3.3"
|
|
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": "775be03971c6aea66f44c1d482576e636bf66f2c"
|
|
50
50
|
}
|