shogun-core 3.0.20 → 3.1.0
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/types/core.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { ShogunStorage } from "./storage/storage";
|
|
|
4
4
|
import { IShogunCore, ShogunCoreConfig, AuthResult, SignUpResult, PluginCategory, AuthMethod, Wallets } from "./interfaces/shogun";
|
|
5
5
|
import { ethers } from "ethers";
|
|
6
6
|
import { ShogunPlugin } from "./interfaces/plugin";
|
|
7
|
-
import { ISEAPair } from "gun";
|
|
8
|
-
import { DataBase, RxJS
|
|
7
|
+
import { ISEAPair, IGunInstance, IGunUserInstance } from "gun";
|
|
8
|
+
import { DataBase, RxJS } from "./gundb";
|
|
9
9
|
import { PluginManager } from "./managers/PluginManager";
|
|
10
10
|
/**
|
|
11
11
|
* Main ShogunCore class - implements the IShogunCore interface
|
|
@@ -25,8 +25,8 @@ export declare class ShogunCore implements IShogunCore {
|
|
|
25
25
|
provider?: ethers.Provider;
|
|
26
26
|
config: ShogunCoreConfig;
|
|
27
27
|
rx: RxJS;
|
|
28
|
-
_gun:
|
|
29
|
-
_user:
|
|
28
|
+
_gun: IGunInstance<any>;
|
|
29
|
+
_user: IGunUserInstance | null;
|
|
30
30
|
wallets: Wallets | undefined;
|
|
31
31
|
pluginManager: PluginManager;
|
|
32
32
|
private authManager;
|
|
@@ -44,12 +44,12 @@ export declare class ShogunCore implements IShogunCore {
|
|
|
44
44
|
* Access to the Gun instance
|
|
45
45
|
* @returns The Gun instance
|
|
46
46
|
*/
|
|
47
|
-
get gun():
|
|
47
|
+
get gun(): IGunInstance<any>;
|
|
48
48
|
/**
|
|
49
49
|
* Access to the current user
|
|
50
50
|
* @returns The current Gun user instance
|
|
51
51
|
*/
|
|
52
|
-
get user():
|
|
52
|
+
get user(): IGunUserInstance | null;
|
|
53
53
|
/**
|
|
54
54
|
* Gets the current user information
|
|
55
55
|
* @returns Current user object or null
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
|
-
import {
|
|
2
|
+
import { IGunInstance, IGunUserInstance } from "gun";
|
|
3
3
|
/**
|
|
4
4
|
* RxJS Integration for GunDB
|
|
5
5
|
* Provides reactive programming capabilities for GunDB data
|
|
@@ -11,12 +11,12 @@ export declare class RxJS {
|
|
|
11
11
|
* Initialize GunRxJS with a GunDB instance
|
|
12
12
|
* @param gun - GunDB instance
|
|
13
13
|
*/
|
|
14
|
-
constructor(gun:
|
|
14
|
+
constructor(gun: IGunInstance<any>);
|
|
15
15
|
/**
|
|
16
16
|
* Get the current user
|
|
17
17
|
* @returns The current user
|
|
18
18
|
*/
|
|
19
|
-
getUser():
|
|
19
|
+
getUser(): IGunUserInstance<any>;
|
|
20
20
|
/**
|
|
21
21
|
* Get the current user's public key
|
|
22
22
|
* @returns The current user's public key
|
|
@@ -159,10 +159,7 @@ export interface GunOperationResult {
|
|
|
159
159
|
/**
|
|
160
160
|
* Improved type definitions to reduce 'any' usage while maintaining GunDB compatibility
|
|
161
161
|
*/
|
|
162
|
-
import type { IGunUserInstance, IGunInstance,
|
|
163
|
-
export type GunInstance = IGunInstance<any>;
|
|
164
|
-
export type GunUserInstance = IGunUserInstance<any>;
|
|
165
|
-
export type GunChain = IGunChain<any, IGunInstance<any>, IGunInstance<any>, string>;
|
|
162
|
+
import type { IGunUserInstance, IGunInstance, ISEAPair } from "gun/types";
|
|
166
163
|
export interface GunAckCallback {
|
|
167
164
|
(ack: {
|
|
168
165
|
err?: string;
|
|
@@ -181,7 +178,7 @@ export interface TypedGunOperationResult<T = unknown> {
|
|
|
181
178
|
};
|
|
182
179
|
}
|
|
183
180
|
export interface TypedAuthCallback {
|
|
184
|
-
(user:
|
|
181
|
+
(user: IGunUserInstance<any>): void;
|
|
185
182
|
}
|
|
186
183
|
export interface TypedAuthResult {
|
|
187
184
|
success: boolean;
|
|
@@ -245,8 +242,8 @@ export interface TypedGunError extends Error {
|
|
|
245
242
|
export type GunOperation = "get" | "put" | "set" | "remove" | "once" | "on" | "off";
|
|
246
243
|
export type GunAuthMethod = "password" | "pair" | "webauthn" | "web3" | "nostr";
|
|
247
244
|
export interface TypedGunWrapper<T = Record<string, unknown>> {
|
|
248
|
-
gun:
|
|
249
|
-
user:
|
|
245
|
+
gun: IGunInstance<any>;
|
|
246
|
+
user: IGunUserInstance | null;
|
|
250
247
|
get(path: GunPath): Promise<T>;
|
|
251
248
|
put(path: GunPath, data: T): Promise<TypedGunOperationResult<T>>;
|
|
252
249
|
set(path: GunPath, data: T): Promise<TypedGunOperationResult<T>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ShogunCore } from "./core";
|
|
2
2
|
import { IGunUserInstance, IGunInstance, GunDataEventData, GunPeerEventData, DeriveOptions } from "./gundb/db";
|
|
3
3
|
import { RxJS, crypto, derive, GunErrors, DataBase } from "./gundb/db";
|
|
4
|
-
import { SimpleGunAPI, QuickStart, quickStart, createSimpleAPI,
|
|
4
|
+
import { SimpleGunAPI, QuickStart, quickStart, createSimpleAPI, TypedGunOperationResult, TypedAuthResult, AutoQuickStart, autoQuickStart } from "./gundb";
|
|
5
5
|
import { SEA } from "./gundb/db";
|
|
6
6
|
import Gun from "./gundb/db";
|
|
7
7
|
export * from "./utils/errorHandler";
|
|
@@ -9,5 +9,5 @@ export * from "./plugins";
|
|
|
9
9
|
export * from "./interfaces/shogun";
|
|
10
10
|
export type * from "./interfaces/plugin";
|
|
11
11
|
export * from "./config/simplified-config";
|
|
12
|
-
export type { IGunUserInstance, IGunInstance, GunDataEventData, GunPeerEventData, DeriveOptions,
|
|
12
|
+
export type { IGunUserInstance, IGunInstance, GunDataEventData, GunPeerEventData, DeriveOptions, TypedGunOperationResult, TypedAuthResult, };
|
|
13
13
|
export { Gun, ShogunCore, SEA, RxJS, crypto, derive, GunErrors, DataBase, SimpleGunAPI, QuickStart, quickStart, createSimpleAPI, AutoQuickStart, autoQuickStart, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGunInstance, IGunUserInstance } from "gun/types";
|
|
2
2
|
import { ISEAPair } from "gun";
|
|
3
3
|
import { ethers } from "ethers";
|
|
4
4
|
import { ShogunError } from "../utils/errorHandler";
|
|
@@ -114,10 +114,10 @@ export interface SignUpResult {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
export interface IShogunCore extends PluginManager {
|
|
117
|
-
gun:
|
|
118
|
-
_gun:
|
|
119
|
-
user:
|
|
120
|
-
_user:
|
|
117
|
+
gun: IGunInstance<any>;
|
|
118
|
+
_gun: IGunInstance<any>;
|
|
119
|
+
user: IGunUserInstance | null;
|
|
120
|
+
_user: IGunUserInstance | null;
|
|
121
121
|
db: DataBase;
|
|
122
122
|
rx: RxJS;
|
|
123
123
|
storage: ShogunStorage;
|
|
@@ -162,7 +162,7 @@ export interface WebauthnConfig {
|
|
|
162
162
|
* Shogun SDK configuration
|
|
163
163
|
*/
|
|
164
164
|
export interface ShogunCoreConfig {
|
|
165
|
-
gunInstance?:
|
|
165
|
+
gunInstance?: IGunInstance<any>;
|
|
166
166
|
gunOptions?: any;
|
|
167
167
|
webauthn?: WebauthnConfig;
|
|
168
168
|
web3?: {
|