@xmtp/node-bindings 1.6.1 → 1.6.2
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/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 +114 -31
- package/dist/index.js +334 -113
- package/package.json +17 -20
- package/dist/version.json +0 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export declare class Client {
|
|
4
|
-
accountIdentifier: Identifier
|
|
4
|
+
get accountIdentifier(): Identifier
|
|
5
5
|
inboxId(): string
|
|
6
6
|
isRegistered(): boolean
|
|
7
7
|
installationId(): string
|
|
@@ -23,18 +23,18 @@ export declare class Client {
|
|
|
23
23
|
uploadDebugArchive(serverUrl: string): Promise<string>
|
|
24
24
|
deleteMessage(messageId: Uint8Array): number
|
|
25
25
|
enrichedMessage(messageId: Array<number>): Promise<DecodedMessage>
|
|
26
|
+
releaseDbConnection(): void
|
|
27
|
+
dbReconnect(): Promise<void>
|
|
26
28
|
setConsentStates(records: Array<Consent>): Promise<void>
|
|
27
29
|
getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>
|
|
28
|
-
/**
|
|
29
|
-
* Get the client's inbox state.
|
|
30
|
+
/** * Get the client's inbox state.
|
|
30
31
|
*
|
|
31
32
|
* If `refresh_from_network` is true, the client will go to the network first to refresh the state.
|
|
32
33
|
* Otherwise, the state will be read from the local database.
|
|
33
34
|
*/
|
|
34
35
|
inboxState(refreshFromNetwork: boolean): Promise<InboxState>
|
|
35
36
|
getLatestInboxState(inboxId: string): Promise<InboxState>
|
|
36
|
-
/**
|
|
37
|
-
* Get key package statuses for a list of installation IDs.
|
|
37
|
+
/** * Get key package statuses for a list of installation IDs.
|
|
38
38
|
*
|
|
39
39
|
* Returns a JavaScript Object mapping installation ID strings to KeyPackageStatus objects.
|
|
40
40
|
*/
|
|
@@ -42,7 +42,7 @@ export declare class Client {
|
|
|
42
42
|
createInboxSignatureRequest(): Promise<SignatureRequestHandle | null>
|
|
43
43
|
addIdentifierSignatureRequest(newIdentifier: Identifier): Promise<SignatureRequestHandle>
|
|
44
44
|
revokeIdentifierSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>
|
|
45
|
-
revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle>
|
|
45
|
+
revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | null>
|
|
46
46
|
revokeInstallationsSignatureRequest(installationIds: Array<Uint8Array>): Promise<SignatureRequestHandle>
|
|
47
47
|
changeRecoveryIdentifierSignatureRequest(newRecoveryIdentifier: Identifier): Promise<SignatureRequestHandle>
|
|
48
48
|
applySignatureRequest(signatureRequest: SignatureRequestHandle): Promise<void>
|
|
@@ -76,11 +76,13 @@ export declare class Conversation {
|
|
|
76
76
|
removeMembersByInboxId(inboxIds: Array<string>): Promise<void>
|
|
77
77
|
updateGroupName(groupName: string): Promise<void>
|
|
78
78
|
groupName(): string
|
|
79
|
+
updateAppData(appData: string): Promise<void>
|
|
80
|
+
appData(): string
|
|
79
81
|
updateGroupImageUrlSquare(groupImageUrlSquare: string): Promise<void>
|
|
80
82
|
groupImageUrlSquare(): string
|
|
81
83
|
updateGroupDescription(groupDescription: string): Promise<void>
|
|
82
84
|
groupDescription(): string
|
|
83
|
-
stream(callback: (err:
|
|
85
|
+
stream(callback: ((err: Error | null, arg: Message) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
84
86
|
createdAtNs(): number
|
|
85
87
|
isActive(): boolean
|
|
86
88
|
pausedForVersion(): string | null
|
|
@@ -121,11 +123,11 @@ export declare class Conversations {
|
|
|
121
123
|
syncAllConversations(consentStates?: Array<ConsentState> | undefined | null): Promise<GroupSyncSummary>
|
|
122
124
|
list(opts?: ListConversationsOptions | undefined | null): Array<ConversationListItem>
|
|
123
125
|
getHmacKeys(): Record<string, Array<HmacKey>>
|
|
124
|
-
stream(callback: (err: Error | null,
|
|
125
|
-
streamAllMessages(callback: (err:
|
|
126
|
-
streamConsent(callback: (err:
|
|
127
|
-
streamPreferences(callback: (err:
|
|
128
|
-
streamMessageDeletions(callback: (err:
|
|
126
|
+
stream(callback: ((err: Error | null, arg: Conversation) => void), onClose: ((err: Error | null, ) => void), conversationType?: ConversationType | undefined | null): Promise<StreamCloser>
|
|
127
|
+
streamAllMessages(callback: ((err: Error | null, arg: Message) => void), onClose: ((err: Error | null, ) => void), conversationType?: ConversationType | undefined | null, consentStates?: Array<ConsentState> | undefined | null): Promise<StreamCloser>
|
|
128
|
+
streamConsent(callback: ((err: Error | null, arg: Array<Consent>) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
129
|
+
streamPreferences(callback: ((err: Error | null, arg: Array<UserPreferenceUpdate>) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
130
|
+
streamMessageDeletions(callback: ((err: Error | null, arg: string) => void)): StreamCloser
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
export declare class DecodedMessage {
|
|
@@ -134,12 +136,12 @@ export declare class DecodedMessage {
|
|
|
134
136
|
kind: GroupMessageKind
|
|
135
137
|
senderInstallationId: Array<number>
|
|
136
138
|
senderInboxId: string
|
|
137
|
-
contentType: ContentTypeId
|
|
138
139
|
conversationId: Array<number>
|
|
139
140
|
fallbackText?: string
|
|
140
141
|
deliveryStatus: DeliveryStatus
|
|
141
142
|
numReplies: number
|
|
142
143
|
get reactions(): Array<DecodedMessage>
|
|
144
|
+
get contentType(): ContentTypeId
|
|
143
145
|
get textContent(): TextContent | null
|
|
144
146
|
get replyContent(): EnrichedReply | null
|
|
145
147
|
get reactionContent(): ReactionPayload | null
|
|
@@ -159,12 +161,22 @@ export declare class EnrichedReply {
|
|
|
159
161
|
get inReplyTo(): NodeDecodedMessage | null
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
export declare class FfiAuthCallback {
|
|
165
|
+
constructor(callback: () => Promise<FfiCredential>)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare class FfiAuthHandle {
|
|
169
|
+
constructor()
|
|
170
|
+
set(credential: FfiCredential): Promise<void>
|
|
171
|
+
id(): bigint
|
|
172
|
+
}
|
|
173
|
+
|
|
162
174
|
export declare class GroupMember {
|
|
163
175
|
inboxId: string
|
|
164
|
-
accountIdentifiers: Array<Identifier>
|
|
165
176
|
installationIds: Array<string>
|
|
166
177
|
permissionLevel: PermissionLevel
|
|
167
178
|
consentState: ConsentState
|
|
179
|
+
get accountIdentifiers(): Array<Identifier>
|
|
168
180
|
}
|
|
169
181
|
|
|
170
182
|
export declare class GroupMetadata {
|
|
@@ -201,6 +213,27 @@ export declare class StreamCloser {
|
|
|
201
213
|
isClosed(): boolean
|
|
202
214
|
}
|
|
203
215
|
|
|
216
|
+
export interface Action {
|
|
217
|
+
id: string
|
|
218
|
+
label: string
|
|
219
|
+
imageUrl?: string
|
|
220
|
+
style?: ActionStyle
|
|
221
|
+
expiresAtNs?: number
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface Actions {
|
|
225
|
+
id: string
|
|
226
|
+
description: string
|
|
227
|
+
actions: Array<Action>
|
|
228
|
+
expiresAtNs?: number
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare const enum ActionStyle {
|
|
232
|
+
Primary = 0,
|
|
233
|
+
Secondary = 1,
|
|
234
|
+
Danger = 2
|
|
235
|
+
}
|
|
236
|
+
|
|
204
237
|
export interface ApiStats {
|
|
205
238
|
uploadKeyPackage: bigint
|
|
206
239
|
fetchKeyPackage: bigint
|
|
@@ -212,7 +245,7 @@ export interface ApiStats {
|
|
|
212
245
|
subscribeWelcomes: bigint
|
|
213
246
|
}
|
|
214
247
|
|
|
215
|
-
export declare
|
|
248
|
+
export declare function applySignatureRequest(v3Host: string, gatewayHost: string | undefined | null, signatureRequest: SignatureRequestHandle): Promise<void>
|
|
216
249
|
|
|
217
250
|
export interface Attachment {
|
|
218
251
|
filename?: string
|
|
@@ -220,6 +253,11 @@ export interface Attachment {
|
|
|
220
253
|
content: Array<number>
|
|
221
254
|
}
|
|
222
255
|
|
|
256
|
+
export declare const enum ClientMode {
|
|
257
|
+
default = 'default',
|
|
258
|
+
notification = 'notification'
|
|
259
|
+
}
|
|
260
|
+
|
|
223
261
|
export interface Consent {
|
|
224
262
|
entityType: ConsentEntityType
|
|
225
263
|
state: ConsentState
|
|
@@ -275,14 +313,13 @@ export declare const enum ConversationType {
|
|
|
275
313
|
Oneshot = 3
|
|
276
314
|
}
|
|
277
315
|
|
|
278
|
-
/**
|
|
279
|
-
* Create a client.
|
|
316
|
+
/** * Create a client.
|
|
280
317
|
*
|
|
281
318
|
* Optionally specify a filter for the log level as a string.
|
|
282
319
|
* It can be one of: `debug`, `info`, `warn`, `error` or 'off'.
|
|
283
320
|
* By default, logging is disabled.
|
|
284
321
|
*/
|
|
285
|
-
export declare
|
|
322
|
+
export declare function createClient(v3Host: string, gatewayHost: string | undefined | null, isSecure: boolean, dbPath: string | undefined | null, inboxId: string, accountIdentifier: Identifier, encryptionKey?: Uint8Array | undefined | null, deviceSyncServerUrl?: string | undefined | null, deviceSyncWorkerMode?: SyncWorkerMode | undefined | null, logOptions?: LogOptions | undefined | null, allowOffline?: boolean | undefined | null, disableEvents?: boolean | undefined | null, appVersion?: string | undefined | null, nonce?: bigint | undefined | null, authCallback?: FfiAuthCallback | undefined | null, authHandle?: FfiAuthHandle | undefined | null, clientMode?: ClientMode | undefined | null): Promise<Client>
|
|
286
323
|
|
|
287
324
|
export interface CreateDmOptions {
|
|
288
325
|
messageDisappearingSettings?: MessageDisappearingSettings
|
|
@@ -295,8 +332,11 @@ export interface CreateGroupOptions {
|
|
|
295
332
|
groupDescription?: string
|
|
296
333
|
customPermissionPolicySet?: PermissionPolicySet
|
|
297
334
|
messageDisappearingSettings?: MessageDisappearingSettings
|
|
335
|
+
appData?: string
|
|
298
336
|
}
|
|
299
337
|
|
|
338
|
+
export declare function decodeActions(bytes: Uint8Array): Actions
|
|
339
|
+
|
|
300
340
|
export interface DecodedMessageBody {
|
|
301
341
|
textContent?: TextContent
|
|
302
342
|
reactionContent?: ReactionPayload
|
|
@@ -307,12 +347,18 @@ export interface DecodedMessageBody {
|
|
|
307
347
|
groupUpdatedContent?: GroupUpdated
|
|
308
348
|
readReceiptContent?: ReadReceipt
|
|
309
349
|
walletSendCallsContent?: WalletSendCalls
|
|
350
|
+
intentContent?: Intent
|
|
351
|
+
actionsContent?: Actions
|
|
310
352
|
customContent?: EncodedContent
|
|
311
353
|
}
|
|
312
354
|
|
|
313
|
-
export declare
|
|
355
|
+
export declare function decodeIntent(bytes: Uint8Array): Intent
|
|
314
356
|
|
|
315
|
-
export declare
|
|
357
|
+
export declare function decodeMultiRemoteAttachment(bytes: Uint8Array): MultiRemoteAttachment
|
|
358
|
+
|
|
359
|
+
export declare function decodeReaction(bytes: Uint8Array): Reaction
|
|
360
|
+
|
|
361
|
+
export declare function decodeReply(bytes: Uint8Array): Reply
|
|
316
362
|
|
|
317
363
|
export declare const enum DeliveryStatus {
|
|
318
364
|
Unpublished = 0,
|
|
@@ -320,7 +366,9 @@ export declare const enum DeliveryStatus {
|
|
|
320
366
|
Failed = 2
|
|
321
367
|
}
|
|
322
368
|
|
|
323
|
-
export declare
|
|
369
|
+
export declare function deserializeEncodedContent(bytes: Uint8Array): EncodedContent
|
|
370
|
+
|
|
371
|
+
export declare function encodeActions(actions: Actions): Uint8Array
|
|
324
372
|
|
|
325
373
|
export interface EncodedContent {
|
|
326
374
|
type?: ContentTypeId
|
|
@@ -330,13 +378,23 @@ export interface EncodedContent {
|
|
|
330
378
|
content: Uint8Array
|
|
331
379
|
}
|
|
332
380
|
|
|
333
|
-
export declare
|
|
381
|
+
export declare function encodeIntent(intent: Intent): Uint8Array
|
|
334
382
|
|
|
335
|
-
export declare
|
|
383
|
+
export declare function encodeMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment): Uint8Array
|
|
336
384
|
|
|
337
|
-
export declare
|
|
385
|
+
export declare function encodeReaction(reaction: Reaction): Uint8Array
|
|
338
386
|
|
|
339
|
-
export declare
|
|
387
|
+
export declare function encodeReply(reply: Reply): Uint8Array
|
|
388
|
+
|
|
389
|
+
export interface FfiCredential {
|
|
390
|
+
name?: string
|
|
391
|
+
value: string
|
|
392
|
+
expiresAtSeconds: number
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export declare function generateInboxId(accountIdent: Identifier, nonce?: bigint | undefined | null): string
|
|
396
|
+
|
|
397
|
+
export declare function getInboxIdForIdentifier(v3Host: string, gatewayHost: string | undefined | null, isSecure: boolean, identifier: Identifier): Promise<string | null>
|
|
340
398
|
|
|
341
399
|
export declare const enum GroupMembershipState {
|
|
342
400
|
Allowed = 0,
|
|
@@ -402,7 +460,7 @@ export interface InboxState {
|
|
|
402
460
|
identifiers: Array<Identifier>
|
|
403
461
|
}
|
|
404
462
|
|
|
405
|
-
export declare
|
|
463
|
+
export declare function inboxStateFromInboxIds(v3Host: string, gatewayHost: string | undefined | null, inboxIds: Array<string>): Promise<Array<InboxState>>
|
|
406
464
|
|
|
407
465
|
export interface Installation {
|
|
408
466
|
bytes: Uint8Array
|
|
@@ -410,9 +468,15 @@ export interface Installation {
|
|
|
410
468
|
id: string
|
|
411
469
|
}
|
|
412
470
|
|
|
413
|
-
export
|
|
471
|
+
export interface Intent {
|
|
472
|
+
id: string
|
|
473
|
+
actionId: string
|
|
474
|
+
metadata?: Record<string, any>
|
|
475
|
+
}
|
|
414
476
|
|
|
415
|
-
export declare
|
|
477
|
+
export declare function isAddressAuthorized(host: string, gatewayHost: string | undefined | null, inboxId: string, address: string): Promise<boolean>
|
|
478
|
+
|
|
479
|
+
export declare function isInstallationAuthorized(host: string, gatewayHost: string | undefined | null, inboxId: string, installationId: Uint8Array): Promise<boolean>
|
|
416
480
|
|
|
417
481
|
export interface KeyPackageStatus {
|
|
418
482
|
lifetime?: Lifetime
|
|
@@ -449,6 +513,9 @@ export interface ListMessagesOptions {
|
|
|
449
513
|
excludeContentTypes?: Array<ContentType>
|
|
450
514
|
kind?: GroupMessageKind
|
|
451
515
|
excludeSenderInboxIds?: Array<string>
|
|
516
|
+
sortBy?: MessageSortBy
|
|
517
|
+
insertedAfterNs?: number
|
|
518
|
+
insertedBeforeNs?: number
|
|
452
519
|
}
|
|
453
520
|
|
|
454
521
|
export declare const enum LogLevel {
|
|
@@ -479,6 +546,7 @@ export interface Message {
|
|
|
479
546
|
content: EncodedContent
|
|
480
547
|
kind: GroupMessageKind
|
|
481
548
|
deliveryStatus: DeliveryStatus
|
|
549
|
+
insertedAtNs: number
|
|
482
550
|
}
|
|
483
551
|
|
|
484
552
|
export interface MessageDisappearingSettings {
|
|
@@ -486,6 +554,11 @@ export interface MessageDisappearingSettings {
|
|
|
486
554
|
inNs: number
|
|
487
555
|
}
|
|
488
556
|
|
|
557
|
+
export declare const enum MessageSortBy {
|
|
558
|
+
SentAt = 0,
|
|
559
|
+
InsertedAt = 1
|
|
560
|
+
}
|
|
561
|
+
|
|
489
562
|
export interface MessageWithReactions {
|
|
490
563
|
message: Message
|
|
491
564
|
reactions: Array<Message>
|
|
@@ -618,13 +691,19 @@ export interface RemoteAttachmentInfoPayload {
|
|
|
618
691
|
filename?: string
|
|
619
692
|
}
|
|
620
693
|
|
|
621
|
-
export
|
|
694
|
+
export interface Reply {
|
|
695
|
+
content: EncodedContent
|
|
696
|
+
reference: string
|
|
697
|
+
referenceInboxId?: string
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export declare function revokeInstallationsSignatureRequest(v3Host: string, gatewayHost: string | undefined | null, recoveryIdentifier: Identifier, inboxId: string, installationIds: Array<Uint8Array>): Promise<SignatureRequestHandle>
|
|
622
701
|
|
|
623
702
|
export interface SendMessageOpts {
|
|
624
703
|
shouldPush: boolean
|
|
625
704
|
}
|
|
626
705
|
|
|
627
|
-
export declare
|
|
706
|
+
export declare function serializeEncodedContent(content: EncodedContent): Uint8Array
|
|
628
707
|
|
|
629
708
|
export declare const enum SortDirection {
|
|
630
709
|
Ascending = 0,
|
|
@@ -656,7 +735,11 @@ export interface TransactionReference {
|
|
|
656
735
|
metadata?: TransactionMetadata
|
|
657
736
|
}
|
|
658
737
|
|
|
659
|
-
export
|
|
738
|
+
export type UserPreferenceUpdate =
|
|
739
|
+
| { type: 'ConsentUpdate', consent: Consent }
|
|
740
|
+
| { type: 'HmacKeyUpdate', key: Uint8Array }
|
|
741
|
+
|
|
742
|
+
export declare function verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): void
|
|
660
743
|
|
|
661
744
|
export interface WalletCall {
|
|
662
745
|
to?: string
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,11 @@ const isMuslFromFilesystem = () => {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const isMuslFromReport = () => {
|
|
39
|
-
|
|
39
|
+
let report = null
|
|
40
|
+
if (typeof process.report?.getReport === 'function') {
|
|
41
|
+
process.report.excludeNetwork = true
|
|
42
|
+
report = process.report.getReport()
|
|
43
|
+
}
|
|
40
44
|
if (!report) {
|
|
41
45
|
return null
|
|
42
46
|
}
|
|
@@ -61,7 +65,13 @@ const isMuslFromChildProcess = () => {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
function requireNative() {
|
|
64
|
-
if (process.
|
|
68
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
69
|
+
try {
|
|
70
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
loadErrors.push(err)
|
|
73
|
+
}
|
|
74
|
+
} else if (process.platform === 'android') {
|
|
65
75
|
if (process.arch === 'arm64') {
|
|
66
76
|
try {
|
|
67
77
|
return require('./bindings_node.android-arm64.node')
|
|
@@ -69,11 +79,15 @@ function requireNative() {
|
|
|
69
79
|
loadErrors.push(e)
|
|
70
80
|
}
|
|
71
81
|
try {
|
|
72
|
-
|
|
82
|
+
const binding = require('@xmtp/node-bindings-android-arm64')
|
|
83
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-android-arm64/package.json').version
|
|
84
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
|
+
}
|
|
87
|
+
return binding
|
|
73
88
|
} catch (e) {
|
|
74
89
|
loadErrors.push(e)
|
|
75
90
|
}
|
|
76
|
-
|
|
77
91
|
} else if (process.arch === 'arm') {
|
|
78
92
|
try {
|
|
79
93
|
return require('./bindings_node.android-arm-eabi.node')
|
|
@@ -81,27 +95,53 @@ function requireNative() {
|
|
|
81
95
|
loadErrors.push(e)
|
|
82
96
|
}
|
|
83
97
|
try {
|
|
84
|
-
|
|
98
|
+
const binding = require('@xmtp/node-bindings-android-arm-eabi')
|
|
99
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-android-arm-eabi/package.json').version
|
|
100
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
|
+
}
|
|
103
|
+
return binding
|
|
85
104
|
} catch (e) {
|
|
86
105
|
loadErrors.push(e)
|
|
87
106
|
}
|
|
88
|
-
|
|
89
107
|
} else {
|
|
90
108
|
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
91
109
|
}
|
|
92
110
|
} else if (process.platform === 'win32') {
|
|
93
111
|
if (process.arch === 'x64') {
|
|
112
|
+
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
|
113
|
+
try {
|
|
114
|
+
return require('./bindings_node.win32-x64-gnu.node')
|
|
115
|
+
} catch (e) {
|
|
116
|
+
loadErrors.push(e)
|
|
117
|
+
}
|
|
94
118
|
try {
|
|
119
|
+
const binding = require('@xmtp/node-bindings-win32-x64-gnu')
|
|
120
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-win32-x64-gnu/package.json').version
|
|
121
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
|
+
}
|
|
124
|
+
return binding
|
|
125
|
+
} catch (e) {
|
|
126
|
+
loadErrors.push(e)
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
try {
|
|
95
130
|
return require('./bindings_node.win32-x64-msvc.node')
|
|
96
131
|
} catch (e) {
|
|
97
132
|
loadErrors.push(e)
|
|
98
133
|
}
|
|
99
134
|
try {
|
|
100
|
-
|
|
135
|
+
const binding = require('@xmtp/node-bindings-win32-x64-msvc')
|
|
136
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-win32-x64-msvc/package.json').version
|
|
137
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
|
+
}
|
|
140
|
+
return binding
|
|
101
141
|
} catch (e) {
|
|
102
142
|
loadErrors.push(e)
|
|
103
143
|
}
|
|
104
|
-
|
|
144
|
+
}
|
|
105
145
|
} else if (process.arch === 'ia32') {
|
|
106
146
|
try {
|
|
107
147
|
return require('./bindings_node.win32-ia32-msvc.node')
|
|
@@ -109,11 +149,15 @@ function requireNative() {
|
|
|
109
149
|
loadErrors.push(e)
|
|
110
150
|
}
|
|
111
151
|
try {
|
|
112
|
-
|
|
152
|
+
const binding = require('@xmtp/node-bindings-win32-ia32-msvc')
|
|
153
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-win32-ia32-msvc/package.json').version
|
|
154
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
|
+
}
|
|
157
|
+
return binding
|
|
113
158
|
} catch (e) {
|
|
114
159
|
loadErrors.push(e)
|
|
115
160
|
}
|
|
116
|
-
|
|
117
161
|
} else if (process.arch === 'arm64') {
|
|
118
162
|
try {
|
|
119
163
|
return require('./bindings_node.win32-arm64-msvc.node')
|
|
@@ -121,26 +165,34 @@ function requireNative() {
|
|
|
121
165
|
loadErrors.push(e)
|
|
122
166
|
}
|
|
123
167
|
try {
|
|
124
|
-
|
|
168
|
+
const binding = require('@xmtp/node-bindings-win32-arm64-msvc')
|
|
169
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-win32-arm64-msvc/package.json').version
|
|
170
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
|
+
}
|
|
173
|
+
return binding
|
|
125
174
|
} catch (e) {
|
|
126
175
|
loadErrors.push(e)
|
|
127
176
|
}
|
|
128
|
-
|
|
129
177
|
} else {
|
|
130
178
|
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
131
179
|
}
|
|
132
180
|
} else if (process.platform === 'darwin') {
|
|
133
181
|
try {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
182
|
+
return require('./bindings_node.darwin-universal.node')
|
|
183
|
+
} catch (e) {
|
|
184
|
+
loadErrors.push(e)
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const binding = require('@xmtp/node-bindings-darwin-universal')
|
|
188
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-darwin-universal/package.json').version
|
|
189
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
|
+
}
|
|
192
|
+
return binding
|
|
193
|
+
} catch (e) {
|
|
194
|
+
loadErrors.push(e)
|
|
195
|
+
}
|
|
144
196
|
if (process.arch === 'x64') {
|
|
145
197
|
try {
|
|
146
198
|
return require('./bindings_node.darwin-x64.node')
|
|
@@ -148,11 +200,15 @@ function requireNative() {
|
|
|
148
200
|
loadErrors.push(e)
|
|
149
201
|
}
|
|
150
202
|
try {
|
|
151
|
-
|
|
203
|
+
const binding = require('@xmtp/node-bindings-darwin-x64')
|
|
204
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-darwin-x64/package.json').version
|
|
205
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
|
+
}
|
|
208
|
+
return binding
|
|
152
209
|
} catch (e) {
|
|
153
210
|
loadErrors.push(e)
|
|
154
211
|
}
|
|
155
|
-
|
|
156
212
|
} else if (process.arch === 'arm64') {
|
|
157
213
|
try {
|
|
158
214
|
return require('./bindings_node.darwin-arm64.node')
|
|
@@ -160,11 +216,15 @@ function requireNative() {
|
|
|
160
216
|
loadErrors.push(e)
|
|
161
217
|
}
|
|
162
218
|
try {
|
|
163
|
-
|
|
219
|
+
const binding = require('@xmtp/node-bindings-darwin-arm64')
|
|
220
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-darwin-arm64/package.json').version
|
|
221
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
|
+
}
|
|
224
|
+
return binding
|
|
164
225
|
} catch (e) {
|
|
165
226
|
loadErrors.push(e)
|
|
166
227
|
}
|
|
167
|
-
|
|
168
228
|
} else {
|
|
169
229
|
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
170
230
|
}
|
|
@@ -176,11 +236,15 @@ function requireNative() {
|
|
|
176
236
|
loadErrors.push(e)
|
|
177
237
|
}
|
|
178
238
|
try {
|
|
179
|
-
|
|
239
|
+
const binding = require('@xmtp/node-bindings-freebsd-x64')
|
|
240
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-freebsd-x64/package.json').version
|
|
241
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
|
+
}
|
|
244
|
+
return binding
|
|
180
245
|
} catch (e) {
|
|
181
246
|
loadErrors.push(e)
|
|
182
247
|
}
|
|
183
|
-
|
|
184
248
|
} else if (process.arch === 'arm64') {
|
|
185
249
|
try {
|
|
186
250
|
return require('./bindings_node.freebsd-arm64.node')
|
|
@@ -188,11 +252,15 @@ function requireNative() {
|
|
|
188
252
|
loadErrors.push(e)
|
|
189
253
|
}
|
|
190
254
|
try {
|
|
191
|
-
|
|
255
|
+
const binding = require('@xmtp/node-bindings-freebsd-arm64')
|
|
256
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-freebsd-arm64/package.json').version
|
|
257
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
|
+
}
|
|
260
|
+
return binding
|
|
192
261
|
} catch (e) {
|
|
193
262
|
loadErrors.push(e)
|
|
194
263
|
}
|
|
195
|
-
|
|
196
264
|
} else {
|
|
197
265
|
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
198
266
|
}
|
|
@@ -200,133 +268,259 @@ function requireNative() {
|
|
|
200
268
|
if (process.arch === 'x64') {
|
|
201
269
|
if (isMusl()) {
|
|
202
270
|
try {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
271
|
+
return require('./bindings_node.linux-x64-musl.node')
|
|
272
|
+
} catch (e) {
|
|
273
|
+
loadErrors.push(e)
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
const binding = require('@xmtp/node-bindings-linux-x64-musl')
|
|
277
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-x64-musl/package.json').version
|
|
278
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
|
+
}
|
|
281
|
+
return binding
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e)
|
|
284
|
+
}
|
|
213
285
|
} else {
|
|
214
286
|
try {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
287
|
+
return require('./bindings_node.linux-x64-gnu.node')
|
|
288
|
+
} catch (e) {
|
|
289
|
+
loadErrors.push(e)
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const binding = require('@xmtp/node-bindings-linux-x64-gnu')
|
|
293
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-x64-gnu/package.json').version
|
|
294
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
|
+
}
|
|
297
|
+
return binding
|
|
298
|
+
} catch (e) {
|
|
299
|
+
loadErrors.push(e)
|
|
300
|
+
}
|
|
225
301
|
}
|
|
226
302
|
} else if (process.arch === 'arm64') {
|
|
227
303
|
if (isMusl()) {
|
|
228
304
|
try {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
305
|
+
return require('./bindings_node.linux-arm64-musl.node')
|
|
306
|
+
} catch (e) {
|
|
307
|
+
loadErrors.push(e)
|
|
308
|
+
}
|
|
309
|
+
try {
|
|
310
|
+
const binding = require('@xmtp/node-bindings-linux-arm64-musl')
|
|
311
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-arm64-musl/package.json').version
|
|
312
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
|
+
}
|
|
315
|
+
return binding
|
|
316
|
+
} catch (e) {
|
|
317
|
+
loadErrors.push(e)
|
|
318
|
+
}
|
|
239
319
|
} else {
|
|
240
320
|
try {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
321
|
+
return require('./bindings_node.linux-arm64-gnu.node')
|
|
322
|
+
} catch (e) {
|
|
323
|
+
loadErrors.push(e)
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
const binding = require('@xmtp/node-bindings-linux-arm64-gnu')
|
|
327
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-arm64-gnu/package.json').version
|
|
328
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
|
+
}
|
|
331
|
+
return binding
|
|
332
|
+
} catch (e) {
|
|
333
|
+
loadErrors.push(e)
|
|
334
|
+
}
|
|
251
335
|
}
|
|
252
336
|
} else if (process.arch === 'arm') {
|
|
253
337
|
if (isMusl()) {
|
|
254
338
|
try {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
339
|
+
return require('./bindings_node.linux-arm-musleabihf.node')
|
|
340
|
+
} catch (e) {
|
|
341
|
+
loadErrors.push(e)
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const binding = require('@xmtp/node-bindings-linux-arm-musleabihf')
|
|
345
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-arm-musleabihf/package.json').version
|
|
346
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
|
+
}
|
|
349
|
+
return binding
|
|
350
|
+
} catch (e) {
|
|
351
|
+
loadErrors.push(e)
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
try {
|
|
355
|
+
return require('./bindings_node.linux-arm-gnueabihf.node')
|
|
356
|
+
} catch (e) {
|
|
357
|
+
loadErrors.push(e)
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const binding = require('@xmtp/node-bindings-linux-arm-gnueabihf')
|
|
361
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-arm-gnueabihf/package.json').version
|
|
362
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
|
+
}
|
|
365
|
+
return binding
|
|
366
|
+
} catch (e) {
|
|
367
|
+
loadErrors.push(e)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
} else if (process.arch === 'loong64') {
|
|
371
|
+
if (isMusl()) {
|
|
372
|
+
try {
|
|
373
|
+
return require('./bindings_node.linux-loong64-musl.node')
|
|
374
|
+
} catch (e) {
|
|
375
|
+
loadErrors.push(e)
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const binding = require('@xmtp/node-bindings-linux-loong64-musl')
|
|
379
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-loong64-musl/package.json').version
|
|
380
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
|
+
}
|
|
383
|
+
return binding
|
|
384
|
+
} catch (e) {
|
|
385
|
+
loadErrors.push(e)
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
try {
|
|
389
|
+
return require('./bindings_node.linux-loong64-gnu.node')
|
|
390
|
+
} catch (e) {
|
|
391
|
+
loadErrors.push(e)
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
const binding = require('@xmtp/node-bindings-linux-loong64-gnu')
|
|
395
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-loong64-gnu/package.json').version
|
|
396
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
|
+
}
|
|
399
|
+
return binding
|
|
400
|
+
} catch (e) {
|
|
401
|
+
loadErrors.push(e)
|
|
402
|
+
}
|
|
263
403
|
}
|
|
264
|
-
|
|
404
|
+
} else if (process.arch === 'riscv64') {
|
|
405
|
+
if (isMusl()) {
|
|
406
|
+
try {
|
|
407
|
+
return require('./bindings_node.linux-riscv64-musl.node')
|
|
408
|
+
} catch (e) {
|
|
409
|
+
loadErrors.push(e)
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
const binding = require('@xmtp/node-bindings-linux-riscv64-musl')
|
|
413
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-riscv64-musl/package.json').version
|
|
414
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
|
+
}
|
|
417
|
+
return binding
|
|
418
|
+
} catch (e) {
|
|
419
|
+
loadErrors.push(e)
|
|
420
|
+
}
|
|
265
421
|
} else {
|
|
266
422
|
try {
|
|
267
|
-
|
|
423
|
+
return require('./bindings_node.linux-riscv64-gnu.node')
|
|
424
|
+
} catch (e) {
|
|
425
|
+
loadErrors.push(e)
|
|
426
|
+
}
|
|
427
|
+
try {
|
|
428
|
+
const binding = require('@xmtp/node-bindings-linux-riscv64-gnu')
|
|
429
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-riscv64-gnu/package.json').version
|
|
430
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
|
+
}
|
|
433
|
+
return binding
|
|
434
|
+
} catch (e) {
|
|
435
|
+
loadErrors.push(e)
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
} else if (process.arch === 'ppc64') {
|
|
439
|
+
try {
|
|
440
|
+
return require('./bindings_node.linux-ppc64-gnu.node')
|
|
268
441
|
} catch (e) {
|
|
269
442
|
loadErrors.push(e)
|
|
270
443
|
}
|
|
271
444
|
try {
|
|
272
|
-
|
|
445
|
+
const binding = require('@xmtp/node-bindings-linux-ppc64-gnu')
|
|
446
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-ppc64-gnu/package.json').version
|
|
447
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
|
+
}
|
|
450
|
+
return binding
|
|
273
451
|
} catch (e) {
|
|
274
452
|
loadErrors.push(e)
|
|
275
453
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (isMusl()) {
|
|
280
|
-
try {
|
|
281
|
-
return require('./bindings_node.linux-riscv64-musl.node')
|
|
454
|
+
} else if (process.arch === 's390x') {
|
|
455
|
+
try {
|
|
456
|
+
return require('./bindings_node.linux-s390x-gnu.node')
|
|
282
457
|
} catch (e) {
|
|
283
458
|
loadErrors.push(e)
|
|
284
459
|
}
|
|
285
460
|
try {
|
|
286
|
-
|
|
461
|
+
const binding = require('@xmtp/node-bindings-linux-s390x-gnu')
|
|
462
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-linux-s390x-gnu/package.json').version
|
|
463
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
|
+
}
|
|
466
|
+
return binding
|
|
287
467
|
} catch (e) {
|
|
288
468
|
loadErrors.push(e)
|
|
289
469
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
470
|
+
} else {
|
|
471
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
472
|
+
}
|
|
473
|
+
} else if (process.platform === 'openharmony') {
|
|
474
|
+
if (process.arch === 'arm64') {
|
|
475
|
+
try {
|
|
476
|
+
return require('./bindings_node.openharmony-arm64.node')
|
|
294
477
|
} catch (e) {
|
|
295
478
|
loadErrors.push(e)
|
|
296
479
|
}
|
|
297
480
|
try {
|
|
298
|
-
|
|
481
|
+
const binding = require('@xmtp/node-bindings-openharmony-arm64')
|
|
482
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-openharmony-arm64/package.json').version
|
|
483
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
|
+
}
|
|
486
|
+
return binding
|
|
299
487
|
} catch (e) {
|
|
300
488
|
loadErrors.push(e)
|
|
301
489
|
}
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
} else if (process.arch === 'ppc64') {
|
|
490
|
+
} else if (process.arch === 'x64') {
|
|
305
491
|
try {
|
|
306
|
-
return require('./bindings_node.
|
|
492
|
+
return require('./bindings_node.openharmony-x64.node')
|
|
307
493
|
} catch (e) {
|
|
308
494
|
loadErrors.push(e)
|
|
309
495
|
}
|
|
310
496
|
try {
|
|
311
|
-
|
|
497
|
+
const binding = require('@xmtp/node-bindings-openharmony-x64')
|
|
498
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-openharmony-x64/package.json').version
|
|
499
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
|
+
}
|
|
502
|
+
return binding
|
|
312
503
|
} catch (e) {
|
|
313
504
|
loadErrors.push(e)
|
|
314
505
|
}
|
|
315
|
-
|
|
316
|
-
} else if (process.arch === 's390x') {
|
|
506
|
+
} else if (process.arch === 'arm') {
|
|
317
507
|
try {
|
|
318
|
-
return require('./bindings_node.
|
|
508
|
+
return require('./bindings_node.openharmony-arm.node')
|
|
319
509
|
} catch (e) {
|
|
320
510
|
loadErrors.push(e)
|
|
321
511
|
}
|
|
322
512
|
try {
|
|
323
|
-
|
|
513
|
+
const binding = require('@xmtp/node-bindings-openharmony-arm')
|
|
514
|
+
const bindingPackageVersion = require('@xmtp/node-bindings-openharmony-arm/package.json').version
|
|
515
|
+
if (bindingPackageVersion !== '1.6.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 1.6.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
|
+
}
|
|
518
|
+
return binding
|
|
324
519
|
} catch (e) {
|
|
325
520
|
loadErrors.push(e)
|
|
326
521
|
}
|
|
327
|
-
|
|
328
522
|
} else {
|
|
329
|
-
loadErrors.push(new Error(`Unsupported architecture on
|
|
523
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
330
524
|
}
|
|
331
525
|
} else {
|
|
332
526
|
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
@@ -336,59 +530,85 @@ function requireNative() {
|
|
|
336
530
|
nativeBinding = requireNative()
|
|
337
531
|
|
|
338
532
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
533
|
+
let wasiBinding = null
|
|
534
|
+
let wasiBindingError = null
|
|
339
535
|
try {
|
|
340
|
-
|
|
536
|
+
wasiBinding = require('./bindings_node.wasi.cjs')
|
|
537
|
+
nativeBinding = wasiBinding
|
|
341
538
|
} catch (err) {
|
|
342
539
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
343
|
-
|
|
540
|
+
wasiBindingError = err
|
|
344
541
|
}
|
|
345
542
|
}
|
|
346
543
|
if (!nativeBinding) {
|
|
347
544
|
try {
|
|
348
|
-
|
|
545
|
+
wasiBinding = require('@xmtp/node-bindings-wasm32-wasi')
|
|
546
|
+
nativeBinding = wasiBinding
|
|
349
547
|
} catch (err) {
|
|
350
548
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
549
|
+
wasiBindingError.cause = err
|
|
351
550
|
loadErrors.push(err)
|
|
352
551
|
}
|
|
353
552
|
}
|
|
354
553
|
}
|
|
554
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
555
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
556
|
+
error.cause = wasiBindingError
|
|
557
|
+
throw error
|
|
558
|
+
}
|
|
355
559
|
}
|
|
356
560
|
|
|
357
561
|
if (!nativeBinding) {
|
|
358
562
|
if (loadErrors.length > 0) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
563
|
+
throw new Error(
|
|
564
|
+
`Cannot find native binding. ` +
|
|
565
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
566
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
567
|
+
{
|
|
568
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
569
|
+
cur.cause = err
|
|
570
|
+
return cur
|
|
571
|
+
}),
|
|
572
|
+
},
|
|
573
|
+
)
|
|
364
574
|
}
|
|
365
575
|
throw new Error(`Failed to load native binding`)
|
|
366
576
|
}
|
|
367
577
|
|
|
368
|
-
const { Client, Conversation, ConversationListItem, Conversations, DecodedMessage, EnrichedReply, GroupMember, GroupMetadata, GroupPermissions, SignatureRequestHandle, StreamCloser, applySignatureRequest, ConsentEntityType, ConsentState, ContentType, ConversationType, createClient, decodeMultiRemoteAttachment, decodeReaction, DeliveryStatus, deserializeEncodedContent, encodeMultiRemoteAttachment, encodeReaction, generateInboxId, getInboxIdForIdentifier, GroupMembershipState, GroupMessageKind, GroupPermissionsOptions, IdentifierKind, inboxStateFromInboxIds, isAddressAuthorized, isInstallationAuthorized, ListConversationsOrderBy, LogLevel, MetadataField, PermissionLevel, PermissionPolicy, PermissionUpdateType, ReactionAction, ReactionSchema, revokeInstallationsSignatureRequest, serializeEncodedContent, SortDirection, SyncWorkerMode, verifySignedWithPublicKey } = nativeBinding
|
|
578
|
+
const { Client, Conversation, ConversationListItem, Conversations, DecodedMessage, EnrichedReply, FfiAuthCallback, FfiAuthHandle, GroupMember, GroupMetadata, GroupPermissions, SignatureRequestHandle, StreamCloser, ActionStyle, applySignatureRequest, ClientMode, ConsentEntityType, ConsentState, ContentType, ConversationType, createClient, decodeActions, decodeIntent, decodeMultiRemoteAttachment, decodeReaction, decodeReply, DeliveryStatus, deserializeEncodedContent, encodeActions, encodeIntent, encodeMultiRemoteAttachment, encodeReaction, encodeReply, generateInboxId, getInboxIdForIdentifier, GroupMembershipState, GroupMessageKind, GroupPermissionsOptions, IdentifierKind, inboxStateFromInboxIds, isAddressAuthorized, isInstallationAuthorized, ListConversationsOrderBy, LogLevel, MessageSortBy, MetadataField, PermissionLevel, PermissionPolicy, PermissionUpdateType, ReactionAction, ReactionSchema, revokeInstallationsSignatureRequest, serializeEncodedContent, SortDirection, SyncWorkerMode, verifySignedWithPublicKey } = nativeBinding
|
|
369
579
|
export { Client }
|
|
370
580
|
export { Conversation }
|
|
371
581
|
export { ConversationListItem }
|
|
372
582
|
export { Conversations }
|
|
373
583
|
export { DecodedMessage }
|
|
374
584
|
export { EnrichedReply }
|
|
585
|
+
export { FfiAuthCallback }
|
|
586
|
+
export { FfiAuthHandle }
|
|
375
587
|
export { GroupMember }
|
|
376
588
|
export { GroupMetadata }
|
|
377
589
|
export { GroupPermissions }
|
|
378
590
|
export { SignatureRequestHandle }
|
|
379
591
|
export { StreamCloser }
|
|
592
|
+
export { ActionStyle }
|
|
380
593
|
export { applySignatureRequest }
|
|
594
|
+
export { ClientMode }
|
|
381
595
|
export { ConsentEntityType }
|
|
382
596
|
export { ConsentState }
|
|
383
597
|
export { ContentType }
|
|
384
598
|
export { ConversationType }
|
|
385
599
|
export { createClient }
|
|
600
|
+
export { decodeActions }
|
|
601
|
+
export { decodeIntent }
|
|
386
602
|
export { decodeMultiRemoteAttachment }
|
|
387
603
|
export { decodeReaction }
|
|
604
|
+
export { decodeReply }
|
|
388
605
|
export { DeliveryStatus }
|
|
389
606
|
export { deserializeEncodedContent }
|
|
607
|
+
export { encodeActions }
|
|
608
|
+
export { encodeIntent }
|
|
390
609
|
export { encodeMultiRemoteAttachment }
|
|
391
610
|
export { encodeReaction }
|
|
611
|
+
export { encodeReply }
|
|
392
612
|
export { generateInboxId }
|
|
393
613
|
export { getInboxIdForIdentifier }
|
|
394
614
|
export { GroupMembershipState }
|
|
@@ -400,6 +620,7 @@ export { isAddressAuthorized }
|
|
|
400
620
|
export { isInstallationAuthorized }
|
|
401
621
|
export { ListConversationsOrderBy }
|
|
402
622
|
export { LogLevel }
|
|
623
|
+
export { MessageSortBy }
|
|
403
624
|
export { MetadataField }
|
|
404
625
|
export { PermissionLevel }
|
|
405
626
|
export { PermissionPolicy }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmtp/node-bindings",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://git@github.com/xmtp/libxmtp.git",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
|
-
}
|
|
16
|
-
"./version.json": "./dist/version.json"
|
|
15
|
+
}
|
|
17
16
|
},
|
|
18
17
|
"main": "dist/index.js",
|
|
19
18
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
],
|
|
23
22
|
"scripts": {
|
|
24
23
|
"artifacts": "napi artifacts",
|
|
25
|
-
"build": "yarn build:clean && yarn build:release && yarn build:finish
|
|
24
|
+
"build": "yarn build:clean && yarn build:release && yarn build:finish",
|
|
26
25
|
"build:clean": "rm -rf dist",
|
|
27
26
|
"build:debug": "napi build --platform --esm",
|
|
28
27
|
"build:finish": "mkdir dist && mv index.js dist && mv index.d.ts dist && mv *.node dist",
|
|
@@ -31,7 +30,6 @@
|
|
|
31
30
|
"clean": "yarn build:clean && yarn test:clean",
|
|
32
31
|
"format": "prettier -w .",
|
|
33
32
|
"format:check": "prettier -c .",
|
|
34
|
-
"generate:version": "tsx scripts/version.ts",
|
|
35
33
|
"lint": "yarn lint:clippy && yarn lint:fmt",
|
|
36
34
|
"lint:clippy": "cargo clippy --locked --all-features --all-targets --no-deps -- -D warnings",
|
|
37
35
|
"lint:fmt": "cargo fmt --check",
|
|
@@ -39,27 +37,26 @@
|
|
|
39
37
|
"test:clean": "rm -rf test/*.db3*"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
43
|
-
"@napi-rs/cli": "^3.
|
|
44
|
-
"@types/node": "^24.1
|
|
45
|
-
"@types/uuid": "^
|
|
40
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
41
|
+
"@napi-rs/cli": "^3.4.1",
|
|
42
|
+
"@types/node": "^24.10.1",
|
|
43
|
+
"@types/uuid": "^11.0.0",
|
|
46
44
|
"@xmtp/content-type-group-updated": "^2.0.2",
|
|
47
45
|
"@xmtp/content-type-text": "^2.0.2",
|
|
48
46
|
"fast-glob": "^3.3.3",
|
|
49
|
-
"prettier": "^3.6.
|
|
50
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
51
|
-
"tsx": "^4.20.
|
|
52
|
-
"typescript": "^5.9.
|
|
53
|
-
"uuid": "^
|
|
54
|
-
"viem": "^2.
|
|
55
|
-
"vite": "^7.
|
|
47
|
+
"prettier": "^3.6.2",
|
|
48
|
+
"prettier-plugin-packagejson": "^2.5.19",
|
|
49
|
+
"tsx": "^4.20.6",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"uuid": "^13.0.0",
|
|
52
|
+
"viem": "^2.39.0",
|
|
53
|
+
"vite": "^7.2.2",
|
|
56
54
|
"vite-tsconfig-paths": "^5.1.4",
|
|
57
|
-
"vitest": "^
|
|
58
|
-
"zx": "^8.7.1"
|
|
55
|
+
"vitest": "^4.0.8"
|
|
59
56
|
},
|
|
60
|
-
"packageManager": "yarn@4.
|
|
57
|
+
"packageManager": "yarn@4.11.0",
|
|
61
58
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
59
|
+
"node": ">=22"
|
|
63
60
|
},
|
|
64
61
|
"publishConfig": {
|
|
65
62
|
"access": "public",
|