Skip to content

Commit dc530e3

Browse files
authored
Update XMTP-JS SDK documentation for release @xmtp/node-sdk@4.1.1 (#376)
1 parent cbea396 commit dc530e3

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

docs/pages/agents/core-messaging/create-a-client.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ const client = await Client.create(
8787
// client options
8888
{
8989
dbEncryptionKey,
90+
// Optional: Use a function to dynamically set the database path based on inbox ID
91+
// dbPath: (inboxId) => `./agent-databases/xmtp-${inboxId}.db3`,
9092
},
9193
);
9294
```
@@ -130,7 +132,7 @@ type ClientOptions = {
130132
/**
131133
* Path to the local DB
132134
*
133-
* There are 3 value types that can be used to specify the database path:
135+
* There are 4 value types that can be used to specify the database path:
134136
*
135137
* - `undefined` (or excluded from the client options)
136138
* The database will be created in the current working directory and is based on
@@ -143,8 +145,12 @@ type ClientOptions = {
143145
* - `string`
144146
* The given path will be used to create the database.
145147
* Example: `./my-db.db3`
148+
*
149+
* - `function`
150+
* A callback function that receives the inbox ID and returns a string path.
151+
* Example: `(inboxId) => string`
146152
*/
147-
dbPath?: string | null;
153+
dbPath?: string | null | ((inboxId: string) => string);
148154
/**
149155
* Encryption key for the local DB
150156
*/

docs/pages/chat-apps/core-messaging/create-a-client.mdx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ const client = await Client.create(
106106
// client options
107107
{
108108
dbEncryptionKey,
109+
// Optional: Use a function to dynamically set the database path based on inbox ID
110+
// dbPath: (inboxId) => `./databases/xmtp-${inboxId}.db3`,
109111
},
110112
);
111113
```
@@ -193,7 +195,7 @@ type ClientOptions = {
193195
/**
194196
* Path to the local DB
195197
*
196-
* There are 3 value types that can be used to specify the database path:
198+
* There are 4 value types that can be used to specify the database path:
197199
*
198200
* - `undefined` (or excluded from the client options)
199201
* The database will be created in the current working directory and is based on
@@ -206,8 +208,12 @@ type ClientOptions = {
206208
* - `string`
207209
* The given path will be used to create the database.
208210
* Example: `./my-db.db3`
211+
*
212+
* - `function`
213+
* A callback function that receives the inbox ID and returns a string path.
214+
* Example: `(inboxId) => string`
209215
*/
210-
dbPath?: string | null;
216+
dbPath?: string | null | ((inboxId: string) => string);
211217
/**
212218
* Encryption key for the local DB
213219
*/
@@ -278,7 +284,7 @@ type ClientOptions = {
278284
/**
279285
* Path to the local DB
280286
*
281-
* There are 3 value types that can be used to specify the database path:
287+
* There are 4 value types that can be used to specify the database path:
282288
*
283289
* - `undefined` (or excluded from the client options)
284290
* The database will be created in the current working directory and is based on
@@ -291,8 +297,12 @@ type ClientOptions = {
291297
* - `string`
292298
* The given path will be used to create the database.
293299
* Example: `./my-db.db3`
300+
*
301+
* - `function`
302+
* A callback function that receives the inbox ID and returns a string path.
303+
* Example: `(inboxId) => string`
294304
*/
295-
dbPath?: string | null;
305+
dbPath?: string | null | ((inboxId: string) => string);
296306
/**
297307
* Encryption key for the local DB
298308
*/

0 commit comments

Comments
 (0)