shogun-core 1.2.2 → 1.2.4
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/browser/shogun-core.js +1 -1
- package/dist/browser/shogun-core.js.LICENSE.txt +9 -0
- package/dist/browser/shogun-core.light.js +1 -1
- package/dist/browser/shogun-core.vendors.light.js +1 -1
- package/dist/browser.js +3 -3
- package/dist/core.js +10 -5
- package/dist/gundb/gun.js +1 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/gundb/gun.d.ts +1 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -56,7 +56,7 @@ const lazyModules = {
|
|
|
56
56
|
};
|
|
57
57
|
// Instance tracking
|
|
58
58
|
let shogunCoreInstance = null;
|
|
59
|
-
let
|
|
59
|
+
let gun = null;
|
|
60
60
|
/**
|
|
61
61
|
* Function to initialize Shogun in a browser environment
|
|
62
62
|
*
|
|
@@ -75,11 +75,11 @@ function initShogunBrowser(config) {
|
|
|
75
75
|
};
|
|
76
76
|
// Create a new ShogunCore instance with browser-optimized configuration
|
|
77
77
|
shogunCoreInstance = new index_1.ShogunCore(browserConfig);
|
|
78
|
-
|
|
78
|
+
gun = shogunCoreInstance?.gun;
|
|
79
79
|
// Support use as a global variable when included via <script>
|
|
80
80
|
if (typeof window !== "undefined") {
|
|
81
81
|
window.shogun = shogunCoreInstance;
|
|
82
|
-
window.
|
|
82
|
+
window.gun = gun;
|
|
83
83
|
}
|
|
84
84
|
return shogunCoreInstance;
|
|
85
85
|
}
|
package/dist/core.js
CHANGED
|
@@ -13,6 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
20
|
exports.ShogunCore = exports.ShogunEventEmitter = exports.ShogunStorage = exports.Webauthn = exports.Web3Connector = exports.GunDB = exports.RelayVerifier = void 0;
|
|
18
21
|
const gun_1 = require("./gundb/gun");
|
|
@@ -25,6 +28,8 @@ const shogun_1 = require("./types/shogun");
|
|
|
25
28
|
const webauthnPlugin_1 = require("./plugins/webauthn/webauthnPlugin");
|
|
26
29
|
const web3ConnectorPlugin_1 = require("./plugins/web3/web3ConnectorPlugin");
|
|
27
30
|
const nostrConnectorPlugin_1 = require("./plugins/nostr/nostrConnectorPlugin");
|
|
31
|
+
const gun_2 = __importDefault(require("gun"));
|
|
32
|
+
require("gun/sea");
|
|
28
33
|
var utils_1 = require("./contracts/utils");
|
|
29
34
|
Object.defineProperty(exports, "RelayVerifier", { enumerable: true, get: function () { return utils_1.RelayVerifier; } });
|
|
30
35
|
__exportStar(require("./utils/errorHandler"), exports);
|
|
@@ -37,8 +42,8 @@ __exportStar(require("./contracts/relay"), exports);
|
|
|
37
42
|
// Export all types
|
|
38
43
|
__exportStar(require("./types/shogun"), exports);
|
|
39
44
|
// Export classes
|
|
40
|
-
var
|
|
41
|
-
Object.defineProperty(exports, "GunDB", { enumerable: true, get: function () { return
|
|
45
|
+
var gun_3 = require("./gundb/gun");
|
|
46
|
+
Object.defineProperty(exports, "GunDB", { enumerable: true, get: function () { return gun_3.GunDB; } });
|
|
42
47
|
var web3Connector_1 = require("./plugins/web3/web3Connector");
|
|
43
48
|
Object.defineProperty(exports, "Web3Connector", { enumerable: true, get: function () { return web3Connector_1.Web3Connector; } });
|
|
44
49
|
var webauthn_1 = require("./plugins/webauthn/webauthn");
|
|
@@ -114,7 +119,7 @@ class ShogunCore {
|
|
|
114
119
|
else {
|
|
115
120
|
(0, logger_1.log)(`Creating new Gun instance with peers: ${JSON.stringify(config.peers)}`);
|
|
116
121
|
// Use the factory to create a properly configured Gun instance
|
|
117
|
-
this._gun =
|
|
122
|
+
this._gun = (0, gun_2.default)(config.peers || []);
|
|
118
123
|
}
|
|
119
124
|
(0, logger_1.log)(`Gun instance created and validated successfully`);
|
|
120
125
|
}
|
|
@@ -135,14 +140,14 @@ class ShogunCore {
|
|
|
135
140
|
}
|
|
136
141
|
(0, logger_1.log)("Initialized Gun instance");
|
|
137
142
|
try {
|
|
138
|
-
this._user = this.
|
|
143
|
+
this._user = this._gun.user().recall({ sessionStorage: true });
|
|
139
144
|
(0, logger_1.log)("Gun user initialized successfully");
|
|
140
145
|
}
|
|
141
146
|
catch (error) {
|
|
142
147
|
(0, logger_1.logError)("Error initializing Gun user:", error);
|
|
143
148
|
throw new Error(`Failed to initialize Gun user: ${error}`);
|
|
144
149
|
}
|
|
145
|
-
this.rx = new rxjs_integration_1.GunRxJS(this.
|
|
150
|
+
this.rx = new rxjs_integration_1.GunRxJS(this._gun);
|
|
146
151
|
this.registerBuiltinPlugins(config);
|
|
147
152
|
if (config.plugins?.autoRegister &&
|
|
148
153
|
config.plugins.autoRegister.length > 0) {
|
package/dist/gundb/gun.js
CHANGED
|
@@ -46,6 +46,7 @@ const rxjs_integration_1 = require("./rxjs-integration");
|
|
|
46
46
|
const GunErrors = __importStar(require("./errors"));
|
|
47
47
|
const crypto = __importStar(require("./crypto"));
|
|
48
48
|
const utils = __importStar(require("./utils"));
|
|
49
|
+
require("gun/sea");
|
|
49
50
|
class GunDB {
|
|
50
51
|
gun;
|
|
51
52
|
user = null;
|
package/dist/types/core.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { IShogunCore, ShogunSDKConfig, AuthResult, SignUpResult, LoggingConfig,
|
|
|
6
6
|
import { ethers } from "ethers";
|
|
7
7
|
import { ShogunPlugin } from "./types/plugin";
|
|
8
8
|
import { IGunUserInstance, IGunInstance } from "gun";
|
|
9
|
+
import "gun/sea";
|
|
9
10
|
export { RelayVerifier } from "./contracts/utils";
|
|
10
11
|
export * from "./utils/errorHandler";
|
|
11
12
|
export * from "./gundb/rxjs-integration";
|
|
@@ -9,6 +9,7 @@ import { GunRxJS } from "./rxjs-integration";
|
|
|
9
9
|
import * as GunErrors from "./errors";
|
|
10
10
|
import * as crypto from "./crypto";
|
|
11
11
|
import * as utils from "./utils";
|
|
12
|
+
import "gun/sea";
|
|
12
13
|
declare class GunDB {
|
|
13
14
|
gun: IGunInstance<any>;
|
|
14
15
|
user: IGunUserInstance<any> | null;
|