@xmtp/node-bindings 0.0.25-internal-fix-forked-groups → 0.0.26

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.
@@ -0,0 +1,325 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare class Client {
4
+ accountAddress: string
5
+ inboxId(): string
6
+ isRegistered(): boolean
7
+ installationId(): string
8
+ installationIdBytes(): Uint8Array
9
+ canMessage(accountAddresses: Array<string>): Promise<Record<string, boolean>>
10
+ registerIdentity(): Promise<void>
11
+ conversations(): Conversations
12
+ sendHistorySyncRequest(): Promise<void>
13
+ sendConsentSyncRequest(): Promise<void>
14
+ findInboxIdByAddress(address: string): Promise<string | null>
15
+ addressesFromInboxId(refreshFromNetwork: boolean, inboxIds: Array<string>): Promise<Array<InboxState>>
16
+ isAddressAuthorized(inboxId: string, address: string): Promise<boolean>
17
+ isInstallationAuthorized(inboxId: string, installationId: Uint8Array): Promise<boolean>
18
+ setConsentStates(records: Array<Consent>): Promise<void>
19
+ getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>
20
+ /**
21
+ * Get the client's inbox state.
22
+ *
23
+ * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
24
+ * Otherwise, the state will be read from the local database.
25
+ */
26
+ inboxState(refreshFromNetwork: boolean): Promise<InboxState>
27
+ getLatestInboxState(inboxId: string): Promise<InboxState>
28
+ createInboxSignatureText(): Promise<string | null>
29
+ addWalletSignatureText(newWalletAddress: string): Promise<string>
30
+ revokeWalletSignatureText(walletAddress: string): Promise<string>
31
+ revokeInstallationsSignatureText(): Promise<string>
32
+ addSignature(signatureType: SignatureRequestType, signatureBytes: Uint8Array): Promise<void>
33
+ addScwSignature(signatureType: SignatureRequestType, signatureBytes: Uint8Array, chainId: bigint, blockNumber?: bigint | undefined | null): Promise<void>
34
+ applySignatureRequests(): Promise<void>
35
+ signWithInstallationKey(signatureText: string): Uint8Array
36
+ verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): void
37
+ }
38
+
39
+ export declare class Conversation {
40
+ id(): string
41
+ send(encodedContent: EncodedContent): Promise<string>
42
+ sendOptimistic(encodedContent: EncodedContent): string
43
+ publishMessages(): Promise<void>
44
+ sync(): Promise<void>
45
+ findMessages(opts?: ListMessagesOptions | undefined | null): Array<Message>
46
+ processStreamedGroupMessage(envelopeBytes: Uint8Array): Promise<Message>
47
+ listMembers(): Promise<Array<GroupMember>>
48
+ adminList(): Array<string>
49
+ superAdminList(): Array<string>
50
+ isAdmin(inboxId: string): boolean
51
+ isSuperAdmin(inboxId: string): boolean
52
+ addMembers(accountAddresses: Array<string>): Promise<void>
53
+ addAdmin(inboxId: string): Promise<void>
54
+ removeAdmin(inboxId: string): Promise<void>
55
+ addSuperAdmin(inboxId: string): Promise<void>
56
+ removeSuperAdmin(inboxId: string): Promise<void>
57
+ groupPermissions(): GroupPermissions
58
+ addMembersByInboxId(inboxIds: Array<string>): Promise<void>
59
+ removeMembers(accountAddresses: Array<string>): Promise<void>
60
+ removeMembersByInboxId(inboxIds: Array<string>): Promise<void>
61
+ updateGroupName(groupName: string): Promise<void>
62
+ groupName(): string
63
+ updateGroupImageUrlSquare(groupImageUrlSquare: string): Promise<void>
64
+ groupImageUrlSquare(): string
65
+ updateGroupDescription(groupDescription: string): Promise<void>
66
+ groupDescription(): string
67
+ updateGroupPinnedFrameUrl(pinnedFrameUrl: string): Promise<void>
68
+ groupPinnedFrameUrl(): string
69
+ stream(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
70
+ createdAtNs(): number
71
+ isActive(): boolean
72
+ addedByInboxId(): string
73
+ groupMetadata(): GroupMetadata
74
+ consentState(): ConsentState
75
+ updateConsentState(state: ConsentState): void
76
+ dmPeerInboxId(): string
77
+ }
78
+
79
+ export declare class Conversations {
80
+ createGroup(accountAddresses: Array<string>, options?: CreateGroupOptions | undefined | null): Promise<Conversation>
81
+ createDm(accountAddress: string): Promise<Conversation>
82
+ findGroupById(groupId: string): Conversation
83
+ findDmByTargetInboxId(targetInboxId: string): Conversation
84
+ findMessageById(messageId: string): Message
85
+ processStreamedWelcomeMessage(envelopeBytes: Uint8Array): Promise<Conversation>
86
+ sync(): Promise<void>
87
+ syncAllConversations(): Promise<bigint>
88
+ list(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
89
+ listGroups(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
90
+ listDms(opts?: ListConversationsOptions | undefined | null): Promise<Array<Conversation>>
91
+ stream(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
92
+ streamGroups(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
93
+ streamDms(callback: (err: null | Error, result: Conversation | undefined) => void): StreamCloser
94
+ streamAllMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
95
+ streamAllGroupMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
96
+ streamAllDmMessages(callback: (err: null | Error, result: Message | undefined) => void): StreamCloser
97
+ }
98
+
99
+ export declare class GroupMember {
100
+ inboxId: string
101
+ accountAddresses: Array<string>
102
+ installationIds: Array<string>
103
+ permissionLevel: PermissionLevel
104
+ consentState: ConsentState
105
+ }
106
+
107
+ export declare class GroupMetadata {
108
+ creatorInboxId(): string
109
+ conversationType(): string
110
+ }
111
+
112
+ export declare class GroupPermissions {
113
+ policyType(): GroupPermissionsOptions
114
+ policySet(): PermissionPolicySet
115
+ }
116
+
117
+ export declare class StreamCloser {
118
+ /**
119
+ * Signal the stream to end
120
+ * Does not wait for the stream to end.
121
+ */
122
+ end(): void
123
+ /**
124
+ * End the stream and `await` for it to shutdown
125
+ * Returns the `Result` of the task.
126
+ * End the stream and asyncronously wait for it to shutdown
127
+ */
128
+ endAndWait(): Promise<void>
129
+ waitForReady(): Promise<void>
130
+ /** Checks if this stream is closed */
131
+ isClosed(): boolean
132
+ }
133
+
134
+ export interface Consent {
135
+ entityType: ConsentEntityType
136
+ state: ConsentState
137
+ entity: string
138
+ }
139
+
140
+ export declare const enum ConsentEntityType {
141
+ GroupId = 0,
142
+ InboxId = 1,
143
+ Address = 2
144
+ }
145
+
146
+ export declare const enum ConsentState {
147
+ Unknown = 0,
148
+ Allowed = 1,
149
+ Denied = 2
150
+ }
151
+
152
+ export interface ContentTypeId {
153
+ authorityId: string
154
+ typeId: string
155
+ versionMajor: number
156
+ versionMinor: number
157
+ }
158
+
159
+ export declare const enum ConversationType {
160
+ Dm = 0,
161
+ Group = 1,
162
+ Sync = 2
163
+ }
164
+
165
+ /**
166
+ * Create a client
167
+ *
168
+ * Optionally specify a filter for the log level as a string.
169
+ * It can be one of: `debug`, `info`, `warn`, `error` or 'off'.
170
+ * By default, logging is disabled.
171
+ */
172
+ export declare export declare function createClient(host: string, isSecure: boolean, dbPath: string | undefined | null, inboxId: string, accountAddress: string, encryptionKey?: Uint8Array | undefined | null, historySyncUrl?: string | undefined | null, logOptions?: LogOptions | undefined | null): Promise<Client>
173
+
174
+ export interface CreateGroupOptions {
175
+ permissions?: GroupPermissionsOptions
176
+ groupName?: string
177
+ groupImageUrlSquare?: string
178
+ groupDescription?: string
179
+ groupPinnedFrameUrl?: string
180
+ }
181
+
182
+ export declare const enum DeliveryStatus {
183
+ Unpublished = 0,
184
+ Published = 1,
185
+ Failed = 2
186
+ }
187
+
188
+ export interface EncodedContent {
189
+ type?: ContentTypeId
190
+ parameters: Record<string, string>
191
+ fallback?: string
192
+ compression?: number
193
+ content: Uint8Array
194
+ }
195
+
196
+ export declare export declare function generateInboxId(accountAddress: string): string
197
+
198
+ export declare export declare function getInboxIdForAddress(host: string, isSecure: boolean, accountAddress: string): Promise<string | null>
199
+
200
+ export declare const enum GroupMembershipState {
201
+ Allowed = 0,
202
+ Rejected = 1,
203
+ Pending = 2
204
+ }
205
+
206
+ export declare const enum GroupMessageKind {
207
+ Application = 0,
208
+ MembershipChange = 1
209
+ }
210
+
211
+ export declare const enum GroupPermissionsOptions {
212
+ AllMembers = 0,
213
+ AdminOnly = 1,
214
+ CustomPolicy = 2
215
+ }
216
+
217
+ export interface InboxState {
218
+ inboxId: string
219
+ recoveryAddress: string
220
+ installations: Array<Installation>
221
+ accountAddresses: Array<string>
222
+ }
223
+
224
+ export interface Installation {
225
+ id: string
226
+ clientTimestampNs?: bigint
227
+ }
228
+
229
+ export declare export declare function isAddressAuthorized(host: string, inboxId: string, address: string): Promise<boolean>
230
+
231
+ export declare export declare function isInstallationAuthorized(host: string, inboxId: string, installationId: Uint8Array): Promise<boolean>
232
+
233
+ export interface ListConversationsOptions {
234
+ allowedStates?: Array<GroupMembershipState>
235
+ createdAfterNs?: number
236
+ createdBeforeNs?: number
237
+ limit?: number
238
+ conversationType?: ConversationType
239
+ }
240
+
241
+ export interface ListMessagesOptions {
242
+ sentBeforeNs?: number
243
+ sentAfterNs?: number
244
+ limit?: number
245
+ deliveryStatus?: DeliveryStatus
246
+ direction?: SortDirection
247
+ }
248
+
249
+ export declare const enum LogLevel {
250
+ off = 'off',
251
+ error = 'error',
252
+ warn = 'warn',
253
+ info = 'info',
254
+ debug = 'debug',
255
+ trace = 'trace'
256
+ }
257
+
258
+ /** Specify options for the logger */
259
+ export interface LogOptions {
260
+ /**
261
+ * enable structured JSON logging to stdout.Useful for third-party log viewers
262
+ * an option so that it does not require being specified in js object.
263
+ */
264
+ structured?: boolean
265
+ /** Filter logs by level */
266
+ level?: LogLevel
267
+ }
268
+
269
+ export interface Message {
270
+ id: string
271
+ sentAtNs: number
272
+ convoId: string
273
+ senderInboxId: string
274
+ content: EncodedContent
275
+ kind: GroupMessageKind
276
+ deliveryStatus: DeliveryStatus
277
+ }
278
+
279
+ export declare const enum PermissionLevel {
280
+ Member = 0,
281
+ Admin = 1,
282
+ SuperAdmin = 2
283
+ }
284
+
285
+ export declare const enum PermissionPolicy {
286
+ Allow = 0,
287
+ Deny = 1,
288
+ Admin = 2,
289
+ SuperAdmin = 3,
290
+ DoesNotExist = 4,
291
+ Other = 5
292
+ }
293
+
294
+ export interface PermissionPolicySet {
295
+ addMemberPolicy: PermissionPolicy
296
+ removeMemberPolicy: PermissionPolicy
297
+ addAdminPolicy: PermissionPolicy
298
+ removeAdminPolicy: PermissionPolicy
299
+ updateGroupNamePolicy: PermissionPolicy
300
+ updateGroupDescriptionPolicy: PermissionPolicy
301
+ updateGroupImageUrlSquarePolicy: PermissionPolicy
302
+ updateGroupPinnedFrameUrlPolicy: PermissionPolicy
303
+ }
304
+
305
+ export declare const enum PermissionUpdateType {
306
+ AddMember = 0,
307
+ RemoveMember = 1,
308
+ AddAdmin = 2,
309
+ RemoveAdmin = 3,
310
+ UpdateMetadata = 4
311
+ }
312
+
313
+ export declare const enum SignatureRequestType {
314
+ AddWallet = 0,
315
+ CreateInbox = 1,
316
+ RevokeWallet = 2,
317
+ RevokeInstallations = 3
318
+ }
319
+
320
+ export declare const enum SortDirection {
321
+ Ascending = 0,
322
+ Descending = 1
323
+ }
324
+
325
+ export declare export declare function verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): void
package/dist/index.js ADDED
@@ -0,0 +1,394 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ import { createRequire } from 'node:module'
7
+ const require = createRequire(import.meta.url)
8
+ const __dirname = new URL('.', import.meta.url).pathname
9
+
10
+ const { readFileSync } = require('node:fs')
11
+ let nativeBinding = null
12
+ const loadErrors = []
13
+
14
+ const isMusl = () => {
15
+ let musl = false
16
+ if (process.platform === 'linux') {
17
+ musl = isMuslFromFilesystem()
18
+ if (musl === null) {
19
+ musl = isMuslFromReport()
20
+ }
21
+ if (musl === null) {
22
+ musl = isMuslFromChildProcess()
23
+ }
24
+ }
25
+ return musl
26
+ }
27
+
28
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
29
+
30
+ const isMuslFromFilesystem = () => {
31
+ try {
32
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
33
+ } catch {
34
+ return null
35
+ }
36
+ }
37
+
38
+ const isMuslFromReport = () => {
39
+ const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
40
+ if (!report) {
41
+ return null
42
+ }
43
+ if (report.header && report.header.glibcVersionRuntime) {
44
+ return false
45
+ }
46
+ if (Array.isArray(report.sharedObjects)) {
47
+ if (report.sharedObjects.some(isFileMusl)) {
48
+ return true
49
+ }
50
+ }
51
+ return false
52
+ }
53
+
54
+ const isMuslFromChildProcess = () => {
55
+ try {
56
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
57
+ } catch (e) {
58
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
59
+ return false
60
+ }
61
+ }
62
+
63
+ function requireNative() {
64
+ if (process.platform === 'android') {
65
+ if (process.arch === 'arm64') {
66
+ try {
67
+ return require('./bindings_node.android-arm64.node')
68
+ } catch (e) {
69
+ loadErrors.push(e)
70
+ }
71
+ try {
72
+ return require('@xmtp/node-bindings-android-arm64')
73
+ } catch (e) {
74
+ loadErrors.push(e)
75
+ }
76
+
77
+ } else if (process.arch === 'arm') {
78
+ try {
79
+ return require('./bindings_node.android-arm-eabi.node')
80
+ } catch (e) {
81
+ loadErrors.push(e)
82
+ }
83
+ try {
84
+ return require('@xmtp/node-bindings-android-arm-eabi')
85
+ } catch (e) {
86
+ loadErrors.push(e)
87
+ }
88
+
89
+ } else {
90
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
91
+ }
92
+ } else if (process.platform === 'win32') {
93
+ if (process.arch === 'x64') {
94
+ try {
95
+ return require('./bindings_node.win32-x64-msvc.node')
96
+ } catch (e) {
97
+ loadErrors.push(e)
98
+ }
99
+ try {
100
+ return require('@xmtp/node-bindings-win32-x64-msvc')
101
+ } catch (e) {
102
+ loadErrors.push(e)
103
+ }
104
+
105
+ } else if (process.arch === 'ia32') {
106
+ try {
107
+ return require('./bindings_node.win32-ia32-msvc.node')
108
+ } catch (e) {
109
+ loadErrors.push(e)
110
+ }
111
+ try {
112
+ return require('@xmtp/node-bindings-win32-ia32-msvc')
113
+ } catch (e) {
114
+ loadErrors.push(e)
115
+ }
116
+
117
+ } else if (process.arch === 'arm64') {
118
+ try {
119
+ return require('./bindings_node.win32-arm64-msvc.node')
120
+ } catch (e) {
121
+ loadErrors.push(e)
122
+ }
123
+ try {
124
+ return require('@xmtp/node-bindings-win32-arm64-msvc')
125
+ } catch (e) {
126
+ loadErrors.push(e)
127
+ }
128
+
129
+ } else {
130
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
131
+ }
132
+ } else if (process.platform === 'darwin') {
133
+ try {
134
+ return require('./bindings_node.darwin-universal.node')
135
+ } catch (e) {
136
+ loadErrors.push(e)
137
+ }
138
+ try {
139
+ return require('@xmtp/node-bindings-darwin-universal')
140
+ } catch (e) {
141
+ loadErrors.push(e)
142
+ }
143
+
144
+ if (process.arch === 'x64') {
145
+ try {
146
+ return require('./bindings_node.darwin-x64.node')
147
+ } catch (e) {
148
+ loadErrors.push(e)
149
+ }
150
+ try {
151
+ return require('@xmtp/node-bindings-darwin-x64')
152
+ } catch (e) {
153
+ loadErrors.push(e)
154
+ }
155
+
156
+ } else if (process.arch === 'arm64') {
157
+ try {
158
+ return require('./bindings_node.darwin-arm64.node')
159
+ } catch (e) {
160
+ loadErrors.push(e)
161
+ }
162
+ try {
163
+ return require('@xmtp/node-bindings-darwin-arm64')
164
+ } catch (e) {
165
+ loadErrors.push(e)
166
+ }
167
+
168
+ } else {
169
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
170
+ }
171
+ } else if (process.platform === 'freebsd') {
172
+ if (process.arch === 'x64') {
173
+ try {
174
+ return require('./bindings_node.freebsd-x64.node')
175
+ } catch (e) {
176
+ loadErrors.push(e)
177
+ }
178
+ try {
179
+ return require('@xmtp/node-bindings-freebsd-x64')
180
+ } catch (e) {
181
+ loadErrors.push(e)
182
+ }
183
+
184
+ } else if (process.arch === 'arm64') {
185
+ try {
186
+ return require('./bindings_node.freebsd-arm64.node')
187
+ } catch (e) {
188
+ loadErrors.push(e)
189
+ }
190
+ try {
191
+ return require('@xmtp/node-bindings-freebsd-arm64')
192
+ } catch (e) {
193
+ loadErrors.push(e)
194
+ }
195
+
196
+ } else {
197
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
198
+ }
199
+ } else if (process.platform === 'linux') {
200
+ if (process.arch === 'x64') {
201
+ if (isMusl()) {
202
+ try {
203
+ return require('./bindings_node.linux-x64-musl.node')
204
+ } catch (e) {
205
+ loadErrors.push(e)
206
+ }
207
+ try {
208
+ return require('@xmtp/node-bindings-linux-x64-musl')
209
+ } catch (e) {
210
+ loadErrors.push(e)
211
+ }
212
+
213
+ } else {
214
+ try {
215
+ return require('./bindings_node.linux-x64-gnu.node')
216
+ } catch (e) {
217
+ loadErrors.push(e)
218
+ }
219
+ try {
220
+ return require('@xmtp/node-bindings-linux-x64-gnu')
221
+ } catch (e) {
222
+ loadErrors.push(e)
223
+ }
224
+
225
+ }
226
+ } else if (process.arch === 'arm64') {
227
+ if (isMusl()) {
228
+ try {
229
+ return require('./bindings_node.linux-arm64-musl.node')
230
+ } catch (e) {
231
+ loadErrors.push(e)
232
+ }
233
+ try {
234
+ return require('@xmtp/node-bindings-linux-arm64-musl')
235
+ } catch (e) {
236
+ loadErrors.push(e)
237
+ }
238
+
239
+ } else {
240
+ try {
241
+ return require('./bindings_node.linux-arm64-gnu.node')
242
+ } catch (e) {
243
+ loadErrors.push(e)
244
+ }
245
+ try {
246
+ return require('@xmtp/node-bindings-linux-arm64-gnu')
247
+ } catch (e) {
248
+ loadErrors.push(e)
249
+ }
250
+
251
+ }
252
+ } else if (process.arch === 'arm') {
253
+ if (isMusl()) {
254
+ try {
255
+ return require('./bindings_node.linux-arm-musleabihf.node')
256
+ } catch (e) {
257
+ loadErrors.push(e)
258
+ }
259
+ try {
260
+ return require('@xmtp/node-bindings-linux-arm-musleabihf')
261
+ } catch (e) {
262
+ loadErrors.push(e)
263
+ }
264
+
265
+ } else {
266
+ try {
267
+ return require('./bindings_node.linux-arm-gnueabihf.node')
268
+ } catch (e) {
269
+ loadErrors.push(e)
270
+ }
271
+ try {
272
+ return require('@xmtp/node-bindings-linux-arm-gnueabihf')
273
+ } catch (e) {
274
+ loadErrors.push(e)
275
+ }
276
+
277
+ }
278
+ } else if (process.arch === 'riscv64') {
279
+ if (isMusl()) {
280
+ try {
281
+ return require('./bindings_node.linux-riscv64-musl.node')
282
+ } catch (e) {
283
+ loadErrors.push(e)
284
+ }
285
+ try {
286
+ return require('@xmtp/node-bindings-linux-riscv64-musl')
287
+ } catch (e) {
288
+ loadErrors.push(e)
289
+ }
290
+
291
+ } else {
292
+ try {
293
+ return require('./bindings_node.linux-riscv64-gnu.node')
294
+ } catch (e) {
295
+ loadErrors.push(e)
296
+ }
297
+ try {
298
+ return require('@xmtp/node-bindings-linux-riscv64-gnu')
299
+ } catch (e) {
300
+ loadErrors.push(e)
301
+ }
302
+
303
+ }
304
+ } else if (process.arch === 'ppc64') {
305
+ try {
306
+ return require('./bindings_node.linux-ppc64-gnu.node')
307
+ } catch (e) {
308
+ loadErrors.push(e)
309
+ }
310
+ try {
311
+ return require('@xmtp/node-bindings-linux-ppc64-gnu')
312
+ } catch (e) {
313
+ loadErrors.push(e)
314
+ }
315
+
316
+ } else if (process.arch === 's390x') {
317
+ try {
318
+ return require('./bindings_node.linux-s390x-gnu.node')
319
+ } catch (e) {
320
+ loadErrors.push(e)
321
+ }
322
+ try {
323
+ return require('@xmtp/node-bindings-linux-s390x-gnu')
324
+ } catch (e) {
325
+ loadErrors.push(e)
326
+ }
327
+
328
+ } else {
329
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
330
+ }
331
+ } else {
332
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
333
+ }
334
+ }
335
+
336
+ nativeBinding = requireNative()
337
+
338
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
339
+ try {
340
+ nativeBinding = require('./bindings_node.wasi.cjs')
341
+ } catch (err) {
342
+ if (process.env.NAPI_RS_FORCE_WASI) {
343
+ loadErrors.push(err)
344
+ }
345
+ }
346
+ if (!nativeBinding) {
347
+ try {
348
+ nativeBinding = require('@xmtp/node-bindings-wasm32-wasi')
349
+ } catch (err) {
350
+ if (process.env.NAPI_RS_FORCE_WASI) {
351
+ loadErrors.push(err)
352
+ }
353
+ }
354
+ }
355
+ }
356
+
357
+ if (!nativeBinding) {
358
+ if (loadErrors.length > 0) {
359
+ // TODO Link to documentation with potential fixes
360
+ // - The package owner could build/publish bindings for this arch
361
+ // - The user may need to bundle the correct files
362
+ // - The user may need to re-install node_modules to get new packages
363
+ throw new Error('Failed to load native binding', { cause: loadErrors })
364
+ }
365
+ throw new Error(`Failed to load native binding`)
366
+ }
367
+
368
+ const { Client, Conversation, Conversations, GroupMember, GroupMetadata, GroupPermissions, StreamCloser, ConsentEntityType, ConsentState, ConversationType, createClient, DeliveryStatus, generateInboxId, getInboxIdForAddress, GroupMembershipState, GroupMessageKind, GroupPermissionsOptions, isAddressAuthorized, isInstallationAuthorized, LogLevel, PermissionLevel, PermissionPolicy, PermissionUpdateType, SignatureRequestType, SortDirection, verifySignedWithPublicKey } = 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 { isAddressAuthorized }
387
+ export { isInstallationAuthorized }
388
+ export { LogLevel }
389
+ export { PermissionLevel }
390
+ export { PermissionPolicy }
391
+ export { PermissionUpdateType }
392
+ export { SignatureRequestType }
393
+ export { SortDirection }
394
+ export { verifySignedWithPublicKey }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmtp/node-bindings",
3
- "version": "0.0.25-internal-fix-forked-groups",
3
+ "version": "0.0.26",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://git@github.com/xmtp/libxmtp.git",