@xmtp/node-bindings 1.7.0-dev.5b3dd5f → 1.7.0-dev.b057f23
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 +110 -30
- 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
|
*/
|
|
@@ -80,7 +80,7 @@ export declare class Conversation {
|
|
|
80
80
|
groupImageUrlSquare(): string
|
|
81
81
|
updateGroupDescription(groupDescription: string): Promise<void>
|
|
82
82
|
groupDescription(): string
|
|
83
|
-
stream(callback: (err:
|
|
83
|
+
stream(callback: ((err: Error | null, arg: Message) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
84
84
|
createdAtNs(): number
|
|
85
85
|
isActive(): boolean
|
|
86
86
|
pausedForVersion(): string | null
|
|
@@ -121,11 +121,11 @@ export declare class Conversations {
|
|
|
121
121
|
syncAllConversations(consentStates?: Array<ConsentState> | undefined | null): Promise<GroupSyncSummary>
|
|
122
122
|
list(opts?: ListConversationsOptions | undefined | null): Array<ConversationListItem>
|
|
123
123
|
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:
|
|
124
|
+
stream(callback: ((err: Error | null, arg: Conversation) => void), onClose: ((err: Error | null, ) => void), conversationType?: ConversationType | undefined | null): Promise<StreamCloser>
|
|
125
|
+
streamAllMessages(callback: ((err: Error | null, arg: Message) => void), onClose: ((err: Error | null, ) => void), conversationType?: ConversationType | undefined | null, consentStates?: Array<ConsentState> | undefined | null): Promise<StreamCloser>
|
|
126
|
+
streamConsent(callback: ((err: Error | null, arg: Array<Consent>) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
127
|
+
streamPreferences(callback: ((err: Error | null, arg: Array<UserPreferenceUpdate>) => void), onClose: ((err: Error | null, ) => void)): Promise<StreamCloser>
|
|
128
|
+
streamMessageDeletions(callback: ((err: Error | null, arg: string) => void)): StreamCloser
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
export declare class DecodedMessage {
|
|
@@ -134,12 +134,12 @@ export declare class DecodedMessage {
|
|
|
134
134
|
kind: GroupMessageKind
|
|
135
135
|
senderInstallationId: Array<number>
|
|
136
136
|
senderInboxId: string
|
|
137
|
-
contentType: ContentTypeId
|
|
138
137
|
conversationId: Array<number>
|
|
139
138
|
fallbackText?: string
|
|
140
139
|
deliveryStatus: DeliveryStatus
|
|
141
140
|
numReplies: number
|
|
142
141
|
get reactions(): Array<DecodedMessage>
|
|
142
|
+
get contentType(): ContentTypeId
|
|
143
143
|
get textContent(): TextContent | null
|
|
144
144
|
get replyContent(): EnrichedReply | null
|
|
145
145
|
get reactionContent(): ReactionPayload | null
|
|
@@ -159,12 +159,22 @@ export declare class EnrichedReply {
|
|
|
159
159
|
get inReplyTo(): NodeDecodedMessage | null
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
export declare class FfiAuthCallback {
|
|
163
|
+
constructor(callback: () => Promise<FfiCredential>)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export declare class FfiAuthHandle {
|
|
167
|
+
constructor()
|
|
168
|
+
set(credential: FfiCredential): Promise<void>
|
|
169
|
+
id(): bigint
|
|
170
|
+
}
|
|
171
|
+
|
|
162
172
|
export declare class GroupMember {
|
|
163
173
|
inboxId: string
|
|
164
|
-
accountIdentifiers: Array<Identifier>
|
|
165
174
|
installationIds: Array<string>
|
|
166
175
|
permissionLevel: PermissionLevel
|
|
167
176
|
consentState: ConsentState
|
|
177
|
+
get accountIdentifiers(): Array<Identifier>
|
|
168
178
|
}
|
|
169
179
|
|
|
170
180
|
export declare class GroupMetadata {
|
|
@@ -201,6 +211,27 @@ export declare class StreamCloser {
|
|
|
201
211
|
isClosed(): boolean
|
|
202
212
|
}
|
|
203
213
|
|
|
214
|
+
export interface Action {
|
|
215
|
+
id: string
|
|
216
|
+
label: string
|
|
217
|
+
imageUrl?: string
|
|
218
|
+
style?: ActionStyle
|
|
219
|
+
expiresAtNs?: number
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface Actions {
|
|
223
|
+
id: string
|
|
224
|
+
description: string
|
|
225
|
+
actions: Array<Action>
|
|
226
|
+
expiresAtNs?: number
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export declare const enum ActionStyle {
|
|
230
|
+
Primary = 0,
|
|
231
|
+
Secondary = 1,
|
|
232
|
+
Danger = 2
|
|
233
|
+
}
|
|
234
|
+
|
|
204
235
|
export interface ApiStats {
|
|
205
236
|
uploadKeyPackage: bigint
|
|
206
237
|
fetchKeyPackage: bigint
|
|
@@ -212,7 +243,7 @@ export interface ApiStats {
|
|
|
212
243
|
subscribeWelcomes: bigint
|
|
213
244
|
}
|
|
214
245
|
|
|
215
|
-
export declare
|
|
246
|
+
export declare function applySignatureRequest(v3Host: string, gatewayHost: string | undefined | null, signatureRequest: SignatureRequestHandle): Promise<void>
|
|
216
247
|
|
|
217
248
|
export interface Attachment {
|
|
218
249
|
filename?: string
|
|
@@ -220,6 +251,11 @@ export interface Attachment {
|
|
|
220
251
|
content: Array<number>
|
|
221
252
|
}
|
|
222
253
|
|
|
254
|
+
export declare const enum ClientMode {
|
|
255
|
+
default = 'default',
|
|
256
|
+
notification = 'notification'
|
|
257
|
+
}
|
|
258
|
+
|
|
223
259
|
export interface Consent {
|
|
224
260
|
entityType: ConsentEntityType
|
|
225
261
|
state: ConsentState
|
|
@@ -275,14 +311,13 @@ export declare const enum ConversationType {
|
|
|
275
311
|
Oneshot = 3
|
|
276
312
|
}
|
|
277
313
|
|
|
278
|
-
/**
|
|
279
|
-
* Create a client.
|
|
314
|
+
/** * Create a client.
|
|
280
315
|
*
|
|
281
316
|
* Optionally specify a filter for the log level as a string.
|
|
282
317
|
* It can be one of: `debug`, `info`, `warn`, `error` or 'off'.
|
|
283
318
|
* By default, logging is disabled.
|
|
284
319
|
*/
|
|
285
|
-
export declare
|
|
320
|
+
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
321
|
|
|
287
322
|
export interface CreateDmOptions {
|
|
288
323
|
messageDisappearingSettings?: MessageDisappearingSettings
|
|
@@ -297,6 +332,8 @@ export interface CreateGroupOptions {
|
|
|
297
332
|
messageDisappearingSettings?: MessageDisappearingSettings
|
|
298
333
|
}
|
|
299
334
|
|
|
335
|
+
export declare function decodeActions(bytes: Uint8Array): Actions
|
|
336
|
+
|
|
300
337
|
export interface DecodedMessageBody {
|
|
301
338
|
textContent?: TextContent
|
|
302
339
|
reactionContent?: ReactionPayload
|
|
@@ -307,12 +344,18 @@ export interface DecodedMessageBody {
|
|
|
307
344
|
groupUpdatedContent?: GroupUpdated
|
|
308
345
|
readReceiptContent?: ReadReceipt
|
|
309
346
|
walletSendCallsContent?: WalletSendCalls
|
|
347
|
+
intentContent?: Intent
|
|
348
|
+
actionsContent?: Actions
|
|
310
349
|
customContent?: EncodedContent
|
|
311
350
|
}
|
|
312
351
|
|
|
313
|
-
export declare
|
|
352
|
+
export declare function decodeIntent(bytes: Uint8Array): Intent
|
|
314
353
|
|
|
315
|
-
export declare
|
|
354
|
+
export declare function decodeMultiRemoteAttachment(bytes: Uint8Array): MultiRemoteAttachment
|
|
355
|
+
|
|
356
|
+
export declare function decodeReaction(bytes: Uint8Array): Reaction
|
|
357
|
+
|
|
358
|
+
export declare function decodeReply(bytes: Uint8Array): Reply
|
|
316
359
|
|
|
317
360
|
export declare const enum DeliveryStatus {
|
|
318
361
|
Unpublished = 0,
|
|
@@ -320,7 +363,9 @@ export declare const enum DeliveryStatus {
|
|
|
320
363
|
Failed = 2
|
|
321
364
|
}
|
|
322
365
|
|
|
323
|
-
export declare
|
|
366
|
+
export declare function deserializeEncodedContent(bytes: Uint8Array): EncodedContent
|
|
367
|
+
|
|
368
|
+
export declare function encodeActions(actions: Actions): Uint8Array
|
|
324
369
|
|
|
325
370
|
export interface EncodedContent {
|
|
326
371
|
type?: ContentTypeId
|
|
@@ -330,13 +375,23 @@ export interface EncodedContent {
|
|
|
330
375
|
content: Uint8Array
|
|
331
376
|
}
|
|
332
377
|
|
|
333
|
-
export declare
|
|
378
|
+
export declare function encodeIntent(intent: Intent): Uint8Array
|
|
334
379
|
|
|
335
|
-
export declare
|
|
380
|
+
export declare function encodeMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment): Uint8Array
|
|
336
381
|
|
|
337
|
-
export declare
|
|
382
|
+
export declare function encodeReaction(reaction: Reaction): Uint8Array
|
|
338
383
|
|
|
339
|
-
export declare
|
|
384
|
+
export declare function encodeReply(reply: Reply): Uint8Array
|
|
385
|
+
|
|
386
|
+
export interface FfiCredential {
|
|
387
|
+
name?: string
|
|
388
|
+
value: string
|
|
389
|
+
expiresAtSeconds: number
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export declare function generateInboxId(accountIdent: Identifier, nonce?: bigint | undefined | null): string
|
|
393
|
+
|
|
394
|
+
export declare function getInboxIdForIdentifier(v3Host: string, gatewayHost: string | undefined | null, isSecure: boolean, identifier: Identifier): Promise<string | null>
|
|
340
395
|
|
|
341
396
|
export declare const enum GroupMembershipState {
|
|
342
397
|
Allowed = 0,
|
|
@@ -402,7 +457,7 @@ export interface InboxState {
|
|
|
402
457
|
identifiers: Array<Identifier>
|
|
403
458
|
}
|
|
404
459
|
|
|
405
|
-
export declare
|
|
460
|
+
export declare function inboxStateFromInboxIds(v3Host: string, gatewayHost: string | undefined | null, inboxIds: Array<string>): Promise<Array<InboxState>>
|
|
406
461
|
|
|
407
462
|
export interface Installation {
|
|
408
463
|
bytes: Uint8Array
|
|
@@ -410,9 +465,15 @@ export interface Installation {
|
|
|
410
465
|
id: string
|
|
411
466
|
}
|
|
412
467
|
|
|
413
|
-
export
|
|
468
|
+
export interface Intent {
|
|
469
|
+
id: string
|
|
470
|
+
actionId: string
|
|
471
|
+
metadata?: Record<string, any>
|
|
472
|
+
}
|
|
414
473
|
|
|
415
|
-
export declare
|
|
474
|
+
export declare function isAddressAuthorized(host: string, gatewayHost: string | undefined | null, inboxId: string, address: string): Promise<boolean>
|
|
475
|
+
|
|
476
|
+
export declare function isInstallationAuthorized(host: string, gatewayHost: string | undefined | null, inboxId: string, installationId: Uint8Array): Promise<boolean>
|
|
416
477
|
|
|
417
478
|
export interface KeyPackageStatus {
|
|
418
479
|
lifetime?: Lifetime
|
|
@@ -449,6 +510,9 @@ export interface ListMessagesOptions {
|
|
|
449
510
|
excludeContentTypes?: Array<ContentType>
|
|
450
511
|
kind?: GroupMessageKind
|
|
451
512
|
excludeSenderInboxIds?: Array<string>
|
|
513
|
+
sortBy?: MessageSortBy
|
|
514
|
+
insertedAfterNs?: number
|
|
515
|
+
insertedBeforeNs?: number
|
|
452
516
|
}
|
|
453
517
|
|
|
454
518
|
export declare const enum LogLevel {
|
|
@@ -479,6 +543,7 @@ export interface Message {
|
|
|
479
543
|
content: EncodedContent
|
|
480
544
|
kind: GroupMessageKind
|
|
481
545
|
deliveryStatus: DeliveryStatus
|
|
546
|
+
insertedAtNs: number
|
|
482
547
|
}
|
|
483
548
|
|
|
484
549
|
export interface MessageDisappearingSettings {
|
|
@@ -486,6 +551,11 @@ export interface MessageDisappearingSettings {
|
|
|
486
551
|
inNs: number
|
|
487
552
|
}
|
|
488
553
|
|
|
554
|
+
export declare const enum MessageSortBy {
|
|
555
|
+
SentAt = 0,
|
|
556
|
+
InsertedAt = 1
|
|
557
|
+
}
|
|
558
|
+
|
|
489
559
|
export interface MessageWithReactions {
|
|
490
560
|
message: Message
|
|
491
561
|
reactions: Array<Message>
|
|
@@ -618,13 +688,19 @@ export interface RemoteAttachmentInfoPayload {
|
|
|
618
688
|
filename?: string
|
|
619
689
|
}
|
|
620
690
|
|
|
621
|
-
export
|
|
691
|
+
export interface Reply {
|
|
692
|
+
content: EncodedContent
|
|
693
|
+
reference: string
|
|
694
|
+
referenceInboxId?: string
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export declare function revokeInstallationsSignatureRequest(v3Host: string, gatewayHost: string | undefined | null, recoveryIdentifier: Identifier, inboxId: string, installationIds: Array<Uint8Array>): Promise<SignatureRequestHandle>
|
|
622
698
|
|
|
623
699
|
export interface SendMessageOpts {
|
|
624
700
|
shouldPush: boolean
|
|
625
701
|
}
|
|
626
702
|
|
|
627
|
-
export declare
|
|
703
|
+
export declare function serializeEncodedContent(content: EncodedContent): Uint8Array
|
|
628
704
|
|
|
629
705
|
export declare const enum SortDirection {
|
|
630
706
|
Ascending = 0,
|
|
@@ -656,7 +732,11 @@ export interface TransactionReference {
|
|
|
656
732
|
metadata?: TransactionMetadata
|
|
657
733
|
}
|
|
658
734
|
|
|
659
|
-
export
|
|
735
|
+
export type UserPreferenceUpdate =
|
|
736
|
+
| { type: 'ConsentUpdate', consent: Consent }
|
|
737
|
+
| { type: 'HmacKeyUpdate', key: Uint8Array }
|
|
738
|
+
|
|
739
|
+
export declare function verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): void
|
|
660
740
|
|
|
661
741
|
export interface WalletCall {
|
|
662
742
|
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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev' && 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.7.0-dev 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.7.0-dev.
|
|
3
|
+
"version": "1.7.0-dev.b057f23",
|
|
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",
|