shogun-core 3.0.13 → 3.0.15
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/README.md +27 -1
- package/dist/browser/shogun-core.js +103157 -84871
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/config/simplified-config.js +22 -16
- package/dist/core.js +18 -26
- package/dist/examples/api-test.js +273 -0
- package/dist/examples/simple-api-test.js +89 -0
- package/dist/gundb/api.js +126 -189
- package/dist/gundb/crypto.js +32 -17
- package/dist/gundb/db.js +89 -137
- package/dist/gundb/derive.js +20 -17
- package/dist/gundb/errors.js +17 -7
- package/dist/gundb/index.js +19 -3
- package/dist/gundb/rxjs.js +19 -17
- package/dist/gundb/types.js +2 -1
- package/dist/index.js +43 -12
- package/dist/interfaces/common.js +2 -1
- package/dist/interfaces/events.js +6 -2
- package/dist/interfaces/plugin.js +2 -1
- package/dist/interfaces/shogun.js +7 -4
- package/dist/managers/AuthManager.js +9 -7
- package/dist/managers/CoreInitializer.js +23 -20
- package/dist/managers/EventManager.js +7 -4
- package/dist/managers/PluginManager.js +6 -3
- package/dist/migration-test.js +13 -8
- package/dist/plugins/base.js +11 -8
- package/dist/plugins/index.js +36 -10
- package/dist/plugins/nostr/index.js +20 -4
- package/dist/plugins/nostr/nostrConnector.js +42 -36
- package/dist/plugins/nostr/nostrConnectorPlugin.js +36 -29
- package/dist/plugins/nostr/nostrSigner.js +17 -11
- package/dist/plugins/nostr/types.js +2 -1
- package/dist/plugins/oauth/index.js +7 -2
- package/dist/plugins/oauth/oauthConnector.js +75 -69
- package/dist/plugins/oauth/oauthPlugin.js +31 -27
- package/dist/plugins/oauth/types.js +2 -1
- package/dist/plugins/web3/index.js +20 -4
- package/dist/plugins/web3/types.js +2 -1
- package/dist/plugins/web3/web3Connector.js +38 -33
- package/dist/plugins/web3/web3ConnectorPlugin.js +29 -22
- package/dist/plugins/web3/web3Signer.js +24 -18
- package/dist/plugins/webauthn/index.js +19 -3
- package/dist/plugins/webauthn/types.js +5 -2
- package/dist/plugins/webauthn/webauthn.js +30 -25
- package/dist/plugins/webauthn/webauthnPlugin.js +21 -14
- package/dist/plugins/webauthn/webauthnSigner.js +20 -14
- package/dist/storage/storage.js +5 -4
- package/dist/types/events.js +8 -2
- package/dist/types/examples/api-test.d.ts +12 -0
- package/dist/types/examples/simple-api-test.d.ts +5 -0
- package/dist/types/gundb/api.d.ts +0 -26
- package/dist/types/gundb/db.d.ts +2 -35
- package/dist/types/shogun.js +7 -4
- package/dist/utils/errorHandler.js +13 -8
- package/dist/utils/eventEmitter.js +5 -2
- package/dist/utils/validation.js +14 -7
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -45,6 +45,12 @@ Shogun Core is a comprehensive SDK for building decentralized applications (dApp
|
|
|
45
45
|
- **Improved Maintainability**: Better organized codebase with clear separation between simple and advanced APIs
|
|
46
46
|
- **Better Performance**: Optimized operations with advanced peer management and user tracking
|
|
47
47
|
|
|
48
|
+
### ⚠️ **BREAKING CHANGES**
|
|
49
|
+
|
|
50
|
+
- **🚨 REMOVED: Array Functions**: `putUserArray()`, `getUserArray()`, `addToUserArray()`, `removeFromUserArray()`, `updateInUserArray()` have been **REMOVED** due to GunDB compatibility issues
|
|
51
|
+
- **⚠️ DEPRECATED: Global Array Functions**: `putArray()`, `getArray()`, `addToArray()`, `removeFromArray()`, `updateInArray()` are deprecated and show warnings
|
|
52
|
+
- **✅ MIGRATION**: Use **Collections** or **Direct GunDB Operations** instead (see examples below)
|
|
53
|
+
|
|
48
54
|
## Recent Updates (v1.7.0)
|
|
49
55
|
|
|
50
56
|
### ✅ **Type System Fixes**
|
|
@@ -217,7 +223,11 @@ const settings = await shogun.api.getSettings();
|
|
|
217
223
|
await shogun.api.savePreferences({ theme: 'dark', fontSize: 14 });
|
|
218
224
|
const preferences = await shogun.api.getPreferences();
|
|
219
225
|
|
|
220
|
-
// Collections (for structured data)
|
|
226
|
+
// Collections (recommended for structured data)
|
|
227
|
+
// Note: Array functions (putUserArray, getUserArray, etc.) have been removed due to GunDB compatibility issues
|
|
228
|
+
// Use collections or direct GunDB operations instead:
|
|
229
|
+
|
|
230
|
+
// Option 1: Collections (recommended for most use cases)
|
|
221
231
|
await shogun.api.createCollection('todos', {
|
|
222
232
|
'1': { text: 'Learn Shogun Core', done: false },
|
|
223
233
|
'2': { text: 'Build dApp', done: false }
|
|
@@ -231,6 +241,12 @@ await shogun.api.addToCollection('todos', '3', {
|
|
|
231
241
|
const todos = await shogun.api.getCollection('todos');
|
|
232
242
|
await shogun.api.removeFromCollection('todos', '2');
|
|
233
243
|
|
|
244
|
+
// Option 2: Direct GunDB operations for complex nested data
|
|
245
|
+
await shogun.api.node('users').get('alice').get('todos').get('1').put({
|
|
246
|
+
text: 'Learn Shogun Core',
|
|
247
|
+
done: false
|
|
248
|
+
});
|
|
249
|
+
|
|
234
250
|
// Utility methods
|
|
235
251
|
const currentUser = shogun.api.getCurrentUser();
|
|
236
252
|
const userExists = await shogun.api.userExists('username');
|
|
@@ -777,6 +793,16 @@ You can also use Shogun Core directly in the browser by including it from a CDN.
|
|
|
777
793
|
- `getCollection(name: string): Promise<Record<string, unknown> | null>` - Get collection
|
|
778
794
|
- `removeFromCollection(name: string, itemId: string): Promise<boolean>` - Remove item from collection
|
|
779
795
|
|
|
796
|
+
#### Utility Functions
|
|
797
|
+
- `arrayToIndexedObject<T>(arr: T[]): Record<string, T>` - Convert array to indexed object (helper)
|
|
798
|
+
- `indexedObjectToArray<T>(indexedObj: Record<string, T>): T[]` - Convert indexed object to array (helper)
|
|
799
|
+
|
|
800
|
+
#### ⚠️ **REMOVED FUNCTIONS**
|
|
801
|
+
The following array functions have been **REMOVED** due to GunDB compatibility issues:
|
|
802
|
+
- `putUserArray()`, `getUserArray()`, `addToUserArray()`, `removeFromUserArray()`, `updateInUserArray()`
|
|
803
|
+
|
|
804
|
+
**Use collections or direct GunDB operations instead** (see examples above).
|
|
805
|
+
|
|
780
806
|
### Advanced API Methods
|
|
781
807
|
|
|
782
808
|
#### Core Authentication
|