@xmtp/node-bindings 0.0.16 → 0.0.18
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 +7 -9
- package/dist/bindings_node.darwin-arm64.node +0 -0
- package/dist/bindings_node.darwin-x64.node +0 -0
- package/dist/bindings_node.linux-arm64-gnu.node +0 -0
- package/dist/bindings_node.linux-arm64-musl.node +0 -0
- package/dist/bindings_node.linux-x64-gnu.node +0 -0
- package/dist/bindings_node.linux-x64-musl.node +0 -0
- package/dist/bindings_node.win32-x64-msvc.node +0 -0
- package/dist/index.d.ts +139 -119
- package/dist/index.js +31 -26
- package/package.json +21 -17
package/README.md
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
# Node bindings for the
|
|
1
|
+
# Node bindings for the libXMTP rust library
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
> These bindings are currently in
|
|
3
|
+
> [!CAUTION]
|
|
4
|
+
> These bindings are currently in alpha and under heavy development. The API is subject to change and it is not yet recommended for production use.
|
|
5
5
|
|
|
6
6
|
## Useful commands
|
|
7
7
|
|
|
8
8
|
- `yarn`: Installs all dependencies (required before building)
|
|
9
|
-
- `yarn build
|
|
9
|
+
- `yarn build`: Build a release version of the Node bindings for the current platform
|
|
10
|
+
- `yarn lint`: Run cargo clippy and fmt checks
|
|
11
|
+
- `yarn test`: Run the test suite on Node
|
|
10
12
|
|
|
11
13
|
## Testing
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Test users are available as exports in `users.mjs`. To register all users on the network, run the `setup.mjs` script.
|
|
16
|
-
|
|
17
|
-
Before running any of the test scripts, a local XMTP node must be running. This can be achieved by running `./dev/up` at the root of this repository.
|
|
15
|
+
Before running the test suite, a local XMTP node must be running. This can be achieved by running `./dev/up` at the root of this repository. Docker is required.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,64 +1,45 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export class
|
|
3
|
+
export declare class Client {
|
|
4
4
|
accountAddress: string
|
|
5
|
-
setConsentStates(records: Array<NapiConsent>): Promise<void>
|
|
6
|
-
getConsentState(entityType: NapiConsentEntityType, entity: string): Promise<NapiConsentState>
|
|
7
|
-
/**
|
|
8
|
-
* Get the client's inbox state.
|
|
9
|
-
*
|
|
10
|
-
* If `refresh_from_network` is true, the client will go to the network first to refresh the state.
|
|
11
|
-
* Otherwise, the state will be read from the local database.
|
|
12
|
-
*/
|
|
13
|
-
inboxState(refreshFromNetwork: boolean): Promise<NapiInboxState>
|
|
14
|
-
getLatestInboxState(inboxId: string): Promise<NapiInboxState>
|
|
15
5
|
inboxId(): string
|
|
16
6
|
isRegistered(): boolean
|
|
17
7
|
installationId(): string
|
|
18
8
|
canMessage(accountAddresses: Array<string>): Promise<Record<string, boolean>>
|
|
19
9
|
registerIdentity(): Promise<void>
|
|
20
|
-
conversations():
|
|
21
|
-
|
|
10
|
+
conversations(): Conversations
|
|
11
|
+
sendHistorySyncRequest(): Promise<void>
|
|
12
|
+
sendConsentSyncRequest(): Promise<void>
|
|
22
13
|
findInboxIdByAddress(address: string): Promise<string | null>
|
|
23
|
-
addressesFromInboxId(refreshFromNetwork: boolean, inboxIds: Array<string>): Promise<Array<
|
|
14
|
+
addressesFromInboxId(refreshFromNetwork: boolean, inboxIds: Array<string>): Promise<Array<InboxState>>
|
|
15
|
+
setConsentStates(records: Array<Consent>): Promise<void>
|
|
16
|
+
getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>
|
|
17
|
+
/**
|
|
18
|
+
* Get the client's inbox state.
|
|
19
|
+
*
|
|
20
|
+
* If `refresh_from_network` is true, the client will go to the network first to refresh the state.
|
|
21
|
+
* Otherwise, the state will be read from the local database.
|
|
22
|
+
*/
|
|
23
|
+
inboxState(refreshFromNetwork: boolean): Promise<InboxState>
|
|
24
|
+
getLatestInboxState(inboxId: string): Promise<InboxState>
|
|
24
25
|
createInboxSignatureText(): Promise<string | null>
|
|
25
26
|
addWalletSignatureText(existingWalletAddress: string, newWalletAddress: string): Promise<string>
|
|
26
27
|
revokeWalletSignatureText(walletAddress: string): Promise<string>
|
|
27
28
|
revokeInstallationsSignatureText(): Promise<string>
|
|
28
|
-
addSignature(signatureType:
|
|
29
|
+
addSignature(signatureType: SignatureRequestType, signatureBytes: Uint8Array): Promise<void>
|
|
30
|
+
addScwSignature(signatureType: SignatureRequestType, signatureBytes: Uint8Array, chainId: bigint, blockNumber?: bigint | undefined | null): Promise<void>
|
|
29
31
|
applySignatureRequests(): Promise<void>
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
export class
|
|
33
|
-
createGroup(accountAddresses: Array<string>, options?: NapiCreateGroupOptions | undefined | null): Promise<NapiGroup>
|
|
34
|
-
createDm(accountAddress: string): Promise<NapiGroup>
|
|
35
|
-
findGroupById(groupId: string): NapiGroup
|
|
36
|
-
findDmByTargetInboxId(targetInboxId: string): NapiGroup
|
|
37
|
-
findMessageById(messageId: string): NapiMessage
|
|
38
|
-
processStreamedWelcomeMessage(envelopeBytes: Uint8Array): Promise<NapiGroup>
|
|
39
|
-
sync(): Promise<void>
|
|
40
|
-
list(opts?: NapiListConversationsOptions | undefined | null): Promise<Array<NapiGroup>>
|
|
41
|
-
listGroups(opts?: NapiListConversationsOptions | undefined | null): Promise<Array<NapiGroup>>
|
|
42
|
-
listDms(opts?: NapiListConversationsOptions | undefined | null): Promise<Array<NapiGroup>>
|
|
43
|
-
stream(callback: (err: null | Error, result: NapiGroup) => void): NapiStreamCloser
|
|
44
|
-
streamGroups(callback: (err: null | Error, result: NapiGroup) => void): NapiStreamCloser
|
|
45
|
-
streamDms(callback: (err: null | Error, result: NapiGroup) => void): NapiStreamCloser
|
|
46
|
-
streamAllMessages(callback: (err: null | Error, result: NapiMessage) => void): NapiStreamCloser
|
|
47
|
-
streamAllGroupMessages(callback: (err: null | Error, result: NapiMessage) => void): NapiStreamCloser
|
|
48
|
-
streamAllDmMessages(callback: (err: null | Error, result: NapiMessage) => void): NapiStreamCloser
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export class NapiGroup {
|
|
34
|
+
export declare class Conversation {
|
|
52
35
|
id(): string
|
|
53
|
-
send(encodedContent:
|
|
54
|
-
|
|
55
|
-
sendOptimistic(encodedContent: NapiEncodedContent): string
|
|
56
|
-
/** Publish all unpublished messages */
|
|
36
|
+
send(encodedContent: EncodedContent): Promise<string>
|
|
37
|
+
sendOptimistic(encodedContent: EncodedContent): string
|
|
57
38
|
publishMessages(): Promise<void>
|
|
58
39
|
sync(): Promise<void>
|
|
59
|
-
findMessages(opts?:
|
|
60
|
-
processStreamedGroupMessage(envelopeBytes: Uint8Array): Promise<
|
|
61
|
-
listMembers(): Promise<Array<
|
|
40
|
+
findMessages(opts?: ListMessagesOptions | undefined | null): Array<Message>
|
|
41
|
+
processStreamedGroupMessage(envelopeBytes: Uint8Array): Promise<Message>
|
|
42
|
+
listMembers(): Promise<Array<GroupMember>>
|
|
62
43
|
adminList(): Array<string>
|
|
63
44
|
superAdminList(): Array<string>
|
|
64
45
|
isAdmin(inboxId: string): boolean
|
|
@@ -68,7 +49,7 @@ export class NapiGroup {
|
|
|
68
49
|
removeAdmin(inboxId: string): Promise<void>
|
|
69
50
|
addSuperAdmin(inboxId: string): Promise<void>
|
|
70
51
|
removeSuperAdmin(inboxId: string): Promise<void>
|
|
71
|
-
groupPermissions():
|
|
52
|
+
groupPermissions(): GroupPermissions
|
|
72
53
|
addMembersByInboxId(inboxIds: Array<string>): Promise<void>
|
|
73
54
|
removeMembers(accountAddresses: Array<string>): Promise<void>
|
|
74
55
|
removeMembersByInboxId(inboxIds: Array<string>): Promise<void>
|
|
@@ -80,45 +61,54 @@ export class NapiGroup {
|
|
|
80
61
|
groupDescription(): string
|
|
81
62
|
updateGroupPinnedFrameUrl(pinnedFrameUrl: string): Promise<void>
|
|
82
63
|
groupPinnedFrameUrl(): string
|
|
83
|
-
stream(callback: (err: null | Error, result:
|
|
64
|
+
stream(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
|
|
84
65
|
createdAtNs(): number
|
|
85
66
|
isActive(): boolean
|
|
86
67
|
addedByInboxId(): string
|
|
87
|
-
groupMetadata():
|
|
88
|
-
consentState():
|
|
89
|
-
updateConsentState(state:
|
|
68
|
+
groupMetadata(): GroupMetadata
|
|
69
|
+
consentState(): ConsentState
|
|
70
|
+
updateConsentState(state: ConsentState): void
|
|
90
71
|
dmPeerInboxId(): string
|
|
91
72
|
}
|
|
92
73
|
|
|
93
|
-
export class
|
|
74
|
+
export declare class Conversations {
|
|
75
|
+
createGroup(accountAddresses: Array<string>, options?: CreateGroupOptions | undefined | null): Promise<Conversation>
|
|
76
|
+
createDm(accountAddress: string): Promise<Conversation>
|
|
77
|
+
findGroupById(groupId: string): Conversation
|
|
78
|
+
findDmByTargetInboxId(targetInboxId: string): Conversation
|
|
79
|
+
findMessageById(messageId: string): Message
|
|
80
|
+
processStreamedWelcomeMessage(envelopeBytes: Uint8Array): Promise<Conversation>
|
|
81
|
+
sync(): Promise<void>
|
|
82
|
+
list(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
|
|
83
|
+
listGroups(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
|
|
84
|
+
listDms(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
|
|
85
|
+
stream(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
|
|
86
|
+
streamGroups(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
|
|
87
|
+
streamDms(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
|
|
88
|
+
streamAllMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
|
|
89
|
+
streamAllGroupMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
|
|
90
|
+
streamAllDmMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare class GroupMember {
|
|
94
94
|
inboxId: string
|
|
95
95
|
accountAddresses: Array<string>
|
|
96
96
|
installationIds: Array<string>
|
|
97
|
-
permissionLevel:
|
|
98
|
-
consentState:
|
|
97
|
+
permissionLevel: PermissionLevel
|
|
98
|
+
consentState: ConsentState
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export class
|
|
101
|
+
export declare class GroupMetadata {
|
|
102
102
|
creatorInboxId(): string
|
|
103
103
|
conversationType(): string
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
export class
|
|
107
|
-
policyType():
|
|
108
|
-
policySet():
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export class NapiMessage {
|
|
112
|
-
id: string
|
|
113
|
-
sentAtNs: number
|
|
114
|
-
convoId: string
|
|
115
|
-
senderInboxId: string
|
|
116
|
-
content: NapiEncodedContent
|
|
117
|
-
kind: NapiGroupMessageKind
|
|
118
|
-
deliveryStatus: NapiDeliveryStatus
|
|
106
|
+
export declare class GroupPermissions {
|
|
107
|
+
policyType(): GroupPermissionsOptions
|
|
108
|
+
policySet(): PermissionPolicySet
|
|
119
109
|
}
|
|
120
110
|
|
|
121
|
-
export class
|
|
111
|
+
export declare class StreamCloser {
|
|
122
112
|
/**
|
|
123
113
|
* Signal the stream to end
|
|
124
114
|
* Does not wait for the stream to end.
|
|
@@ -134,128 +124,154 @@ export class NapiStreamCloser {
|
|
|
134
124
|
isClosed(): boolean
|
|
135
125
|
}
|
|
136
126
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
* It can be one of: `debug`, `info`, `warn`, `error` or 'off'.
|
|
141
|
-
* By default, logging is set to `info`. `off` completely disables logging.
|
|
142
|
-
*/
|
|
143
|
-
export declare function createClient(host: string, isSecure: boolean, dbPath: string, inboxId: string, accountAddress: string, encryptionKey?: Uint8Array | undefined | null, historySyncUrl?: string | undefined | null, envFilter?: string | undefined | null): Promise<NapiClient>
|
|
144
|
-
|
|
145
|
-
export declare function generateInboxId(accountAddress: string): string
|
|
146
|
-
|
|
147
|
-
export declare function getInboxIdForAddress(host: string, isSecure: boolean, accountAddress: string): Promise<string | null>
|
|
148
|
-
|
|
149
|
-
export interface NapiConsent {
|
|
150
|
-
entityType: NapiConsentEntityType
|
|
151
|
-
state: NapiConsentState
|
|
127
|
+
export interface Consent {
|
|
128
|
+
entityType: ConsentEntityType
|
|
129
|
+
state: ConsentState
|
|
152
130
|
entity: string
|
|
153
131
|
}
|
|
154
132
|
|
|
155
|
-
export const enum
|
|
133
|
+
export declare const enum ConsentEntityType {
|
|
156
134
|
GroupId = 0,
|
|
157
135
|
InboxId = 1,
|
|
158
136
|
Address = 2
|
|
159
137
|
}
|
|
160
138
|
|
|
161
|
-
export const enum
|
|
139
|
+
export declare const enum ConsentState {
|
|
162
140
|
Unknown = 0,
|
|
163
141
|
Allowed = 1,
|
|
164
142
|
Denied = 2
|
|
165
143
|
}
|
|
166
144
|
|
|
167
|
-
export interface
|
|
145
|
+
export interface ContentTypeId {
|
|
168
146
|
authorityId: string
|
|
169
147
|
typeId: string
|
|
170
148
|
versionMajor: number
|
|
171
149
|
versionMinor: number
|
|
172
150
|
}
|
|
173
151
|
|
|
174
|
-
export const enum
|
|
152
|
+
export declare const enum ConversationType {
|
|
175
153
|
Dm = 0,
|
|
176
154
|
Group = 1,
|
|
177
155
|
Sync = 2
|
|
178
156
|
}
|
|
179
157
|
|
|
180
|
-
|
|
181
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Create a client
|
|
160
|
+
*
|
|
161
|
+
* Optionally specify a filter for the log level as a string.
|
|
162
|
+
* It can be one of: `debug`, `info`, `warn`, `error` or 'off'.
|
|
163
|
+
* By default, logging is disabled.
|
|
164
|
+
*/
|
|
165
|
+
export declare export declare function createClient(host: string, isSecure: boolean, dbPath: string, inboxId: string, accountAddress: string, encryptionKey?: Uint8Array | undefined | null, historySyncUrl?: string | undefined | null, logOptions?: LogOptions | undefined | null): Promise<Client>
|
|
166
|
+
|
|
167
|
+
export interface CreateGroupOptions {
|
|
168
|
+
permissions?: GroupPermissionsOptions
|
|
182
169
|
groupName?: string
|
|
183
170
|
groupImageUrlSquare?: string
|
|
184
171
|
groupDescription?: string
|
|
185
172
|
groupPinnedFrameUrl?: string
|
|
186
173
|
}
|
|
187
174
|
|
|
188
|
-
export const enum
|
|
175
|
+
export declare const enum DeliveryStatus {
|
|
189
176
|
Unpublished = 0,
|
|
190
177
|
Published = 1,
|
|
191
178
|
Failed = 2
|
|
192
179
|
}
|
|
193
180
|
|
|
194
|
-
export
|
|
195
|
-
|
|
196
|
-
Descending = 1
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface NapiEncodedContent {
|
|
200
|
-
type?: NapiContentTypeId
|
|
181
|
+
export interface EncodedContent {
|
|
182
|
+
type?: ContentTypeId
|
|
201
183
|
parameters: Record<string, string>
|
|
202
184
|
fallback?: string
|
|
203
185
|
compression?: number
|
|
204
186
|
content: Uint8Array
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
export
|
|
189
|
+
export declare export declare function generateInboxId(accountAddress: string): string
|
|
190
|
+
|
|
191
|
+
export declare export declare function getInboxIdForAddress(host: string, isSecure: boolean, accountAddress: string): Promise<string | null>
|
|
192
|
+
|
|
193
|
+
export declare const enum GroupMembershipState {
|
|
208
194
|
Allowed = 0,
|
|
209
195
|
Rejected = 1,
|
|
210
196
|
Pending = 2
|
|
211
197
|
}
|
|
212
198
|
|
|
213
|
-
export const enum
|
|
199
|
+
export declare const enum GroupMessageKind {
|
|
214
200
|
Application = 0,
|
|
215
201
|
MembershipChange = 1
|
|
216
202
|
}
|
|
217
203
|
|
|
218
|
-
export const enum
|
|
204
|
+
export declare const enum GroupPermissionsOptions {
|
|
219
205
|
AllMembers = 0,
|
|
220
206
|
AdminOnly = 1,
|
|
221
207
|
CustomPolicy = 2
|
|
222
208
|
}
|
|
223
209
|
|
|
224
|
-
export interface
|
|
210
|
+
export interface InboxState {
|
|
225
211
|
inboxId: string
|
|
226
212
|
recoveryAddress: string
|
|
227
|
-
installations: Array<
|
|
213
|
+
installations: Array<Installation>
|
|
228
214
|
accountAddresses: Array<string>
|
|
229
215
|
}
|
|
230
216
|
|
|
231
|
-
export interface
|
|
217
|
+
export interface Installation {
|
|
232
218
|
id: string
|
|
233
219
|
clientTimestampNs?: bigint
|
|
234
220
|
}
|
|
235
221
|
|
|
236
|
-
export
|
|
237
|
-
|
|
222
|
+
export declare const enum Level {
|
|
223
|
+
off = 'off',
|
|
224
|
+
error = 'error',
|
|
225
|
+
warn = 'warn',
|
|
226
|
+
info = 'info',
|
|
227
|
+
debug = 'debug',
|
|
228
|
+
trace = 'trace'
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface ListConversationsOptions {
|
|
232
|
+
allowedStates?: Array<GroupMembershipState>
|
|
238
233
|
createdAfterNs?: number
|
|
239
234
|
createdBeforeNs?: number
|
|
240
235
|
limit?: number
|
|
241
|
-
conversationType?:
|
|
236
|
+
conversationType?: ConversationType
|
|
242
237
|
}
|
|
243
238
|
|
|
244
|
-
export interface
|
|
239
|
+
export interface ListMessagesOptions {
|
|
245
240
|
sentBeforeNs?: number
|
|
246
241
|
sentAfterNs?: number
|
|
247
242
|
limit?: number
|
|
248
|
-
deliveryStatus?:
|
|
249
|
-
direction?:
|
|
243
|
+
deliveryStatus?: DeliveryStatus
|
|
244
|
+
direction?: SortDirection
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Specify options for the logger */
|
|
248
|
+
export interface LogOptions {
|
|
249
|
+
/**
|
|
250
|
+
* enable structured JSON logging to stdout.Useful for third-party log viewers
|
|
251
|
+
* an option so that it does not require being specified in js object.
|
|
252
|
+
*/
|
|
253
|
+
structured?: boolean
|
|
254
|
+
/** Filter logs by level */
|
|
255
|
+
level?: Level
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface Message {
|
|
259
|
+
id: string
|
|
260
|
+
sentAtNs: number
|
|
261
|
+
convoId: string
|
|
262
|
+
senderInboxId: string
|
|
263
|
+
content: EncodedContent
|
|
264
|
+
kind: GroupMessageKind
|
|
265
|
+
deliveryStatus: DeliveryStatus
|
|
250
266
|
}
|
|
251
267
|
|
|
252
|
-
export const enum
|
|
268
|
+
export declare const enum PermissionLevel {
|
|
253
269
|
Member = 0,
|
|
254
270
|
Admin = 1,
|
|
255
271
|
SuperAdmin = 2
|
|
256
272
|
}
|
|
257
273
|
|
|
258
|
-
export const enum
|
|
274
|
+
export declare const enum PermissionPolicy {
|
|
259
275
|
Allow = 0,
|
|
260
276
|
Deny = 1,
|
|
261
277
|
Admin = 2,
|
|
@@ -264,18 +280,18 @@ export const enum NapiPermissionPolicy {
|
|
|
264
280
|
Other = 5
|
|
265
281
|
}
|
|
266
282
|
|
|
267
|
-
export interface
|
|
268
|
-
addMemberPolicy:
|
|
269
|
-
removeMemberPolicy:
|
|
270
|
-
addAdminPolicy:
|
|
271
|
-
removeAdminPolicy:
|
|
272
|
-
updateGroupNamePolicy:
|
|
273
|
-
updateGroupDescriptionPolicy:
|
|
274
|
-
updateGroupImageUrlSquarePolicy:
|
|
275
|
-
updateGroupPinnedFrameUrlPolicy:
|
|
283
|
+
export interface PermissionPolicySet {
|
|
284
|
+
addMemberPolicy: PermissionPolicy
|
|
285
|
+
removeMemberPolicy: PermissionPolicy
|
|
286
|
+
addAdminPolicy: PermissionPolicy
|
|
287
|
+
removeAdminPolicy: PermissionPolicy
|
|
288
|
+
updateGroupNamePolicy: PermissionPolicy
|
|
289
|
+
updateGroupDescriptionPolicy: PermissionPolicy
|
|
290
|
+
updateGroupImageUrlSquarePolicy: PermissionPolicy
|
|
291
|
+
updateGroupPinnedFrameUrlPolicy: PermissionPolicy
|
|
276
292
|
}
|
|
277
293
|
|
|
278
|
-
export const enum
|
|
294
|
+
export declare const enum PermissionUpdateType {
|
|
279
295
|
AddMember = 0,
|
|
280
296
|
RemoveMember = 1,
|
|
281
297
|
AddAdmin = 2,
|
|
@@ -283,10 +299,14 @@ export const enum NapiPermissionUpdateType {
|
|
|
283
299
|
UpdateMetadata = 4
|
|
284
300
|
}
|
|
285
301
|
|
|
286
|
-
export const enum
|
|
302
|
+
export declare const enum SignatureRequestType {
|
|
287
303
|
AddWallet = 0,
|
|
288
304
|
CreateInbox = 1,
|
|
289
305
|
RevokeWallet = 2,
|
|
290
306
|
RevokeInstallations = 3
|
|
291
307
|
}
|
|
292
308
|
|
|
309
|
+
export declare const enum SortDirection {
|
|
310
|
+
Ascending = 0,
|
|
311
|
+
Descending = 1
|
|
312
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
3
4
|
/* auto-generated by NAPI-RS */
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
import { createRequire } from 'node:module'
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
const __dirname = new URL('.', import.meta.url).pathname
|
|
6
9
|
|
|
10
|
+
const { readFileSync } = require('node:fs')
|
|
7
11
|
let nativeBinding = null
|
|
8
12
|
const loadErrors = []
|
|
9
13
|
|
|
@@ -336,7 +340,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
336
340
|
nativeBinding = require('./bindings_node.wasi.cjs')
|
|
337
341
|
} catch (err) {
|
|
338
342
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
339
|
-
|
|
343
|
+
loadErrors.push(err)
|
|
340
344
|
}
|
|
341
345
|
}
|
|
342
346
|
if (!nativeBinding) {
|
|
@@ -344,7 +348,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
344
348
|
nativeBinding = require('@xmtp/node-bindings-wasm32-wasi')
|
|
345
349
|
} catch (err) {
|
|
346
350
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
347
|
-
|
|
351
|
+
loadErrors.push(err)
|
|
348
352
|
}
|
|
349
353
|
}
|
|
350
354
|
}
|
|
@@ -361,26 +365,27 @@ if (!nativeBinding) {
|
|
|
361
365
|
throw new Error(`Failed to load native binding`)
|
|
362
366
|
}
|
|
363
367
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
368
|
+
const { Client, Conversation, Conversations, GroupMember, GroupMetadata, GroupPermissions, StreamCloser, ConsentEntityType, ConsentState, ConversationType, createClient, DeliveryStatus, generateInboxId, getInboxIdForAddress, GroupMembershipState, GroupMessageKind, GroupPermissionsOptions, Level, PermissionLevel, PermissionPolicy, PermissionUpdateType, SignatureRequestType, SortDirection } = nativeBinding
|
|
369
|
+
export { Client }
|
|
370
|
+
export { Conversation }
|
|
371
|
+
export { Conversations }
|
|
372
|
+
export { GroupMember }
|
|
373
|
+
export { GroupMetadata }
|
|
374
|
+
export { GroupPermissions }
|
|
375
|
+
export { StreamCloser }
|
|
376
|
+
export { ConsentEntityType }
|
|
377
|
+
export { ConsentState }
|
|
378
|
+
export { ConversationType }
|
|
379
|
+
export { createClient }
|
|
380
|
+
export { DeliveryStatus }
|
|
381
|
+
export { generateInboxId }
|
|
382
|
+
export { getInboxIdForAddress }
|
|
383
|
+
export { GroupMembershipState }
|
|
384
|
+
export { GroupMessageKind }
|
|
385
|
+
export { GroupPermissionsOptions }
|
|
386
|
+
export { Level }
|
|
387
|
+
export { PermissionLevel }
|
|
388
|
+
export { PermissionPolicy }
|
|
389
|
+
export { PermissionUpdateType }
|
|
390
|
+
export { SignatureRequestType }
|
|
391
|
+
export { SortDirection }
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmtp/node-bindings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://git@github.com/xmtp/libxmtp.git",
|
|
7
7
|
"directory": "bindings_node"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
@@ -20,32 +21,35 @@
|
|
|
20
21
|
],
|
|
21
22
|
"scripts": {
|
|
22
23
|
"artifacts": "napi artifacts",
|
|
23
|
-
"build": "
|
|
24
|
+
"build": "yarn build:clean && yarn build:release && yarn build:finish",
|
|
24
25
|
"build:clean": "rm -rf dist",
|
|
25
|
-
"build:debug": "napi build --platform",
|
|
26
|
+
"build:debug": "napi build --platform --esm",
|
|
26
27
|
"build:finish": "mkdir dist && mv index.js dist && mv index.d.ts dist && mv *.node dist",
|
|
27
|
-
"build:release": "
|
|
28
|
+
"build:release": "napi build --platform --release --esm",
|
|
28
29
|
"clean": "yarn build:clean && yarn test:clean",
|
|
29
30
|
"format": "prettier -w .",
|
|
30
31
|
"format:check": "prettier -c .",
|
|
32
|
+
"lint": "yarn lint:clippy && yarn lint:fmt",
|
|
33
|
+
"lint:clippy": "cargo clippy --all-features --all-targets --no-deps -- -Dwarnings",
|
|
34
|
+
"lint:fmt": "cargo fmt --check",
|
|
31
35
|
"test": "vitest run",
|
|
32
36
|
"test:clean": "rm -rf test/*.db3*"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
36
|
-
"@napi-rs/cli": "^3.0.0-alpha.
|
|
37
|
-
"@types/node": "^20.
|
|
38
|
-
"@types/uuid": "^10",
|
|
39
|
-
"prettier": "^3.3.
|
|
40
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
41
|
-
"typescript": "^5.
|
|
42
|
-
"uuid": "^
|
|
43
|
-
"viem": "^2.
|
|
44
|
-
"vite": "^5.
|
|
45
|
-
"vite-tsconfig-paths": "^
|
|
46
|
-
"vitest": "^1.
|
|
39
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
|
|
40
|
+
"@napi-rs/cli": "^3.0.0-alpha.64",
|
|
41
|
+
"@types/node": "^20.17.6",
|
|
42
|
+
"@types/uuid": "^10.0.0",
|
|
43
|
+
"prettier": "^3.3.3",
|
|
44
|
+
"prettier-plugin-packagejson": "^2.5.3",
|
|
45
|
+
"typescript": "^5.6.3",
|
|
46
|
+
"uuid": "^11.0.3",
|
|
47
|
+
"viem": "^2.21.44",
|
|
48
|
+
"vite": "^5.4.11",
|
|
49
|
+
"vite-tsconfig-paths": "^5.1.2",
|
|
50
|
+
"vitest": "^2.1.4"
|
|
47
51
|
},
|
|
48
|
-
"packageManager": "yarn@4.
|
|
52
|
+
"packageManager": "yarn@4.5.1",
|
|
49
53
|
"engines": {
|
|
50
54
|
"node": ">=18"
|
|
51
55
|
},
|