@bandeira-tech/b3nd-web 0.2.6 → 0.2.7

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.
@@ -1,3 +1,6 @@
1
+ import {
2
+ MemoryClient
3
+ } from "./chunk-GIMIWVPX.js";
1
4
  import {
2
5
  WalletServerCore
3
6
  } from "./chunk-F3W5GZU6.js";
@@ -6,9 +9,6 @@ import {
6
9
  generateEncryptionKeyPair,
7
10
  generateSigningKeyPair
8
11
  } from "./chunk-JN75UL5C.js";
9
- import {
10
- MemoryClient
11
- } from "./chunk-GIMIWVPX.js";
12
12
 
13
13
  // wallet/client.ts
14
14
  var WalletClient = class {
@@ -442,14 +442,14 @@ var MemoryWalletClient = class _MemoryWalletClient {
442
442
  */
443
443
  static async create(config = {}) {
444
444
  const serverKeys = config.serverKeys || await generateTestServerKeys();
445
- const storageClient = config.storageClient || createWalletMemoryClient();
445
+ const backend = config.backend || createWalletMemoryClient();
446
446
  const serverConfig = {
447
447
  serverKeys,
448
448
  jwtSecret: config.jwtSecret || "test-jwt-secret-for-memory-wallet-client!!",
449
449
  jwtExpirationSeconds: config.jwtExpirationSeconds || 3600,
450
450
  deps: {
451
- credentialClient: storageClient,
452
- proxyClient: storageClient,
451
+ credentialClient: backend,
452
+ proxyClient: backend,
453
453
  logger: {
454
454
  log: () => {
455
455
  },
@@ -1,4 +1,4 @@
1
- import { N as NodeProtocolInterface, S as Schema, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, H as HealthStatus, D as DeleteResult } from '../../types-oQCx3U-_.js';
1
+ import { S as Schema, N as NodeProtocolInterface, g as WriteResult, R as ReadResult, b as ListOptions, c as ListResult, H as HealthStatus, D as DeleteResult } from '../../types-oQCx3U-_.js';
2
2
 
3
3
  type MemoryClientStorageNode<T> = {
4
4
  value?: T;
@@ -1,12 +1,16 @@
1
- import {
2
- WebSocketClient
3
- } from "../chunk-T43IWAQK.js";
4
1
  import {
5
2
  AppsClient
6
3
  } from "../chunk-VAZUCGED.js";
7
4
  import {
8
5
  WalletClient
9
- } from "../chunk-FVLXYKYS.js";
6
+ } from "../chunk-7O4D7SF6.js";
7
+ import {
8
+ LocalStorageClient
9
+ } from "../chunk-7U5JDFQW.js";
10
+ import "../chunk-GIMIWVPX.js";
11
+ import {
12
+ WebSocketClient
13
+ } from "../chunk-T43IWAQK.js";
10
14
  import "../chunk-F3W5GZU6.js";
11
15
  import {
12
16
  mod_exports
@@ -14,10 +18,6 @@ import {
14
18
  import {
15
19
  HttpClient
16
20
  } from "../chunk-LFUC4ETD.js";
17
- import {
18
- LocalStorageClient
19
- } from "../chunk-7U5JDFQW.js";
20
- import "../chunk-GIMIWVPX.js";
21
21
  import "../chunk-MLKGABMK.js";
22
22
  export {
23
23
  AppsClient,
@@ -1,9 +1,8 @@
1
1
  import { A as AuthSession, H as HealthResponse, U as UserCredentials, P as PasswordResetToken, a as UserPublicKeys, b as ProxyWriteRequest, c as ProxyWriteResponse, d as ProxyReadRequest, e as ProxyReadResponse, G as GoogleAuthSession } from '../client-B0Ekm99R.js';
2
2
  export { g as ApiResponse, C as ChangePasswordResponse, k as GoogleLoginResponse, j as GoogleSignupResponse, L as LoginResponse, h as PublicKeysResponse, R as RequestPasswordResetResponse, i as ResetPasswordResponse, S as SignupResponse, W as WalletClient, f as WalletClientConfig } from '../client-B0Ekm99R.js';
3
+ import { N as NodeProtocolInterface } from '../types-oQCx3U-_.js';
3
4
  import { S as ServerKeys, W as WalletServerCore } from '../core-CgxQpSVM.js';
4
- import { MemoryClient } from '../clients/memory/mod.js';
5
5
  import 'hono';
6
- import '../types-oQCx3U-_.js';
7
6
 
8
7
  /**
9
8
  * Memory Wallet Client
@@ -16,16 +15,22 @@ import '../types-oQCx3U-_.js';
16
15
  * @example
17
16
  * ```typescript
18
17
  * // Production
18
+ * const backend = new HttpClient({ baseUrl: "http://localhost:8842" });
19
19
  * const wallet = new WalletClient({
20
20
  * walletServerUrl: "http://localhost:8843",
21
21
  * apiBasePath: "/api/v1"
22
22
  * });
23
23
  *
24
- * // Tests
25
- * const wallet = await MemoryWalletClient.create();
24
+ * // Tests - share same backend between wallet and direct operations
25
+ * const backend = new MemoryClient({ schema: { "mutable://accounts": ... } });
26
+ * const wallet = await MemoryWalletClient.create({ backend });
26
27
  *
27
28
  * // Same API works for both
28
29
  * await wallet.signupWithToken(appKey, { username: "alice", password: "secret" });
30
+ * await wallet.proxyWrite({ uri: "mutable://data/test", data: { foo: "bar" } });
31
+ *
32
+ * // Direct backend access in tests
33
+ * const result = await backend.read("mutable://accounts/...");
29
34
  * ```
30
35
  */
31
36
 
@@ -43,10 +48,21 @@ interface MemoryWalletClientConfig {
43
48
  */
44
49
  jwtExpirationSeconds?: number;
45
50
  /**
46
- * Optional existing MemoryClient to use as storage backend.
47
- * If not provided, a new one is created.
51
+ * Shared backend storage (e.g., MemoryClient).
52
+ * Use this to share the same storage between wallet and direct operations.
53
+ * If not provided, a new MemoryClient is created.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const backend = new MemoryClient({ schema: { ... } });
58
+ * const wallet = await MemoryWalletClient.create({ backend });
59
+ *
60
+ * // Both use the same storage
61
+ * await backend.write("mutable://accounts/...", data);
62
+ * await wallet.proxyWrite({ uri: "mutable://...", data });
63
+ * ```
48
64
  */
49
- storageClient?: MemoryClient;
65
+ backend?: NodeProtocolInterface;
50
66
  }
51
67
  /**
52
68
  * Generate server keys for testing
@@ -2,11 +2,11 @@ import {
2
2
  MemoryWalletClient,
3
3
  WalletClient,
4
4
  generateTestServerKeys
5
- } from "../chunk-FVLXYKYS.js";
5
+ } from "../chunk-7O4D7SF6.js";
6
+ import "../chunk-GIMIWVPX.js";
6
7
  import "../chunk-F3W5GZU6.js";
7
8
  import "../chunk-JN75UL5C.js";
8
9
  import "../chunk-LFUC4ETD.js";
9
- import "../chunk-GIMIWVPX.js";
10
10
  import "../chunk-MLKGABMK.js";
11
11
  export {
12
12
  MemoryWalletClient,
@@ -1,3 +1,6 @@
1
+ import {
2
+ LocalStorageClient
3
+ } from "../../chunk-7U5JDFQW.js";
1
4
  import {
2
5
  ConfigEnvironment,
3
6
  MemoryFileStorage,
@@ -5,9 +8,6 @@ import {
5
8
  } from "../../chunk-F3W5GZU6.js";
6
9
  import "../../chunk-JN75UL5C.js";
7
10
  import "../../chunk-LFUC4ETD.js";
8
- import {
9
- LocalStorageClient
10
- } from "../../chunk-7U5JDFQW.js";
11
11
  import "../../chunk-MLKGABMK.js";
12
12
 
13
13
  // wallet-server/adapters/browser.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bandeira-tech/b3nd-web",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Browser-focused B3nd SDK bundle",
5
5
  "type": "module",
6
6
  "main": "./dist/src/mod.web.js",