@awiki/dsh-plugin 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -38
- package/README.zh.md +28 -31
- package/cordis.patch.yml +0 -17
- package/lib/client.js +269 -1266
- package/lib/client.js.map +1 -1
- package/lib/index.js +316 -922
- package/lib/provider.js +16 -52
- package/lib/{sdk-adapter-BeJakxLP.mjs → sdk-adapter-CDLTgHJA.mjs} +4 -142
- package/lib/typert.host.js +89 -419
- package/lib/typert.remote-client.d.ts +3 -19
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +89 -419
- package/lib/types/client/AwikiIdentityAccess.d.ts +5 -6
- package/lib/types/client/AwikiIdentityAccess.d.ts.map +1 -1
- package/lib/types/client/AwikiIdentityAccess.js +27 -88
- package/lib/types/client/AwikiIdentityAccess.js.map +1 -1
- package/lib/types/client/AwikiOverlay.d.ts.map +1 -1
- package/lib/types/client/AwikiOverlay.js +3 -4
- package/lib/types/client/AwikiOverlay.js.map +1 -1
- package/lib/types/client/controller.d.ts +5 -20
- package/lib/types/client/controller.d.ts.map +1 -1
- package/lib/types/client/controller.js +7 -38
- package/lib/types/client/controller.js.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +0 -8
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/slots.d.ts +2 -10
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/index.d.ts +11 -54
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +176 -735
- package/lib/types/index.js.map +1 -1
- package/lib/types/listener-state.d.ts +3 -5
- package/lib/types/listener-state.d.ts.map +1 -1
- package/lib/types/listener-state.js +13 -28
- package/lib/types/listener-state.js.map +1 -1
- package/lib/types/listener.d.ts +32 -9
- package/lib/types/listener.d.ts.map +1 -1
- package/lib/types/listener.js +127 -11
- package/lib/types/listener.js.map +1 -1
- package/lib/types/profile-state.d.ts +11 -0
- package/lib/types/profile-state.d.ts.map +1 -0
- package/lib/types/profile-state.js +48 -0
- package/lib/types/profile-state.js.map +1 -0
- package/lib/types/provider-api.d.ts +4 -96
- package/lib/types/provider-api.d.ts.map +1 -1
- package/lib/types/provider.d.ts +1 -7
- package/lib/types/provider.d.ts.map +1 -1
- package/lib/types/provider.js +15 -53
- package/lib/types/provider.js.map +1 -1
- package/lib/types/sdk-adapter.d.ts +2 -28
- package/lib/types/sdk-adapter.d.ts.map +1 -1
- package/lib/types/sdk-adapter.js +3 -132
- package/lib/types/sdk-adapter.js.map +1 -1
- package/lib/types/types.d.ts +6 -76
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/package.json +18 -18
- package/lib/types/client/AwikiDevices.d.ts +0 -28
- package/lib/types/client/AwikiDevices.d.ts.map +0 -1
- package/lib/types/client/AwikiDevices.js +0 -85
- package/lib/types/client/AwikiDevices.js.map +0 -1
- package/lib/types/realtime-supervisor.d.ts +0 -43
- package/lib/types/realtime-supervisor.d.ts.map +0 -1
- package/lib/types/realtime-supervisor.js +0 -166
- package/lib/types/realtime-supervisor.js.map +0 -1
package/lib/provider.js
CHANGED
|
@@ -1,62 +1,26 @@
|
|
|
1
|
-
import { t as RustSdkAdapter } from "./sdk-adapter-
|
|
1
|
+
import { t as RustSdkAdapter } from "./sdk-adapter-CDLTgHJA.mjs";
|
|
2
2
|
import { openImCoreNodeClient } from "@awiki/im-core-node";
|
|
3
3
|
//#region lib/types/provider.js
|
|
4
4
|
/** Production AWiki provider backed by the versioned Rust IM Core Node bridge. */
|
|
5
5
|
/** Cordis plugin name used by Loader diagnostics. */
|
|
6
6
|
const name = "awiki-rust-sdk-provider";
|
|
7
|
-
/** AWiki
|
|
8
|
-
const inject = ["awiki"
|
|
9
|
-
const IDENTITY_PROVIDER_CAPABILITIES = [
|
|
10
|
-
"IDENTITY_READ",
|
|
11
|
-
"IDENTITY_CREATE",
|
|
12
|
-
"IDENTITY_IMPORT",
|
|
13
|
-
"IDENTITY_SIGN",
|
|
14
|
-
"IDENTITY_ECDH_SEALED",
|
|
15
|
-
"IDENTITY_DOCUMENT_UPDATE",
|
|
16
|
-
"IDENTITY_KEY_LIFECYCLE",
|
|
17
|
-
"IDENTITY_DELETE",
|
|
18
|
-
"IDENTITY_HTTP_SIGNATURE",
|
|
19
|
-
"AWIKI_LEGACY_ROOT_TRANSFER_V1"
|
|
20
|
-
];
|
|
7
|
+
/** The AWiki service must own its provider registry before this plugin loads. */
|
|
8
|
+
const inject = ["awiki"];
|
|
21
9
|
/** Register one SDK client whose disposal follows this provider's fiber. */
|
|
22
10
|
function apply(ctx) {
|
|
23
|
-
ctx.effect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
messageServiceEndpoint: options.messageServiceUrl,
|
|
37
|
-
mailServiceEndpoint: options.mailServiceUrl,
|
|
38
|
-
anpServiceEndpoint: options.messageServiceUrl,
|
|
39
|
-
anpServiceDid: options.messageServiceDid,
|
|
40
|
-
multiDeviceHandleRecoveryEnabled: true,
|
|
41
|
-
multiDeviceDeviceRevokeEnabled: true,
|
|
42
|
-
multiDeviceAudience: "awiki-user-service",
|
|
43
|
-
externalHttpAllowInsecureLoopbackForTesting: options.allowInsecureLoopbackForTesting,
|
|
44
|
-
identityProvider: lease
|
|
45
|
-
};
|
|
46
|
-
return new RustSdkAdapter(openImCoreNodeClient(openOptions));
|
|
47
|
-
});
|
|
48
|
-
return async () => {
|
|
49
|
-
try {
|
|
50
|
-
await unregister();
|
|
51
|
-
} finally {
|
|
52
|
-
lease.dispose();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
} catch (error) {
|
|
56
|
-
lease.dispose();
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
}, "awiki Rust SDK client");
|
|
11
|
+
ctx.effect(() => ctx.awiki.registerClientFactory((options) => new RustSdkAdapter(openImCoreNodeClient({
|
|
12
|
+
stateRoot: options.stateRoot,
|
|
13
|
+
serviceBaseUrl: options.userServiceUrl,
|
|
14
|
+
didDomain: options.userServiceDomain,
|
|
15
|
+
userServiceEndpoint: options.userServiceUrl,
|
|
16
|
+
messageServiceEndpoint: options.messageServiceUrl,
|
|
17
|
+
mailServiceEndpoint: options.mailServiceUrl,
|
|
18
|
+
anpServiceEndpoint: options.messageServiceUrl,
|
|
19
|
+
anpServiceDid: options.messageServiceDid,
|
|
20
|
+
multiDeviceHandleRecoveryEnabled: true,
|
|
21
|
+
multiDeviceAudience: "awiki-user-service",
|
|
22
|
+
externalHttpAllowInsecureLoopbackForTesting: options.allowInsecureLoopbackForTesting
|
|
23
|
+
}))), "awiki Rust SDK client");
|
|
60
24
|
}
|
|
61
25
|
//#endregion
|
|
62
26
|
export { apply, inject, name };
|
|
@@ -20,7 +20,7 @@ const RUST_FAILURE_CODES = {
|
|
|
20
20
|
auth_revoked: "identity-recovery-required",
|
|
21
21
|
conflict: "conflict",
|
|
22
22
|
join_required: "handle-unavailable",
|
|
23
|
-
state_in_use: "
|
|
23
|
+
state_in_use: "state-in-use",
|
|
24
24
|
rate_limited: "rate-limited",
|
|
25
25
|
timeout: "network",
|
|
26
26
|
transport_unavailable: "network",
|
|
@@ -197,26 +197,6 @@ function identity(value) {
|
|
|
197
197
|
registeredAt: safeInteger(value.registeredAtMs)
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
function joinProgress(value) {
|
|
201
|
-
return {
|
|
202
|
-
joinSessionId: required(value.joinSessionId),
|
|
203
|
-
localPhase: value.localPhase,
|
|
204
|
-
remoteState: value.remoteState,
|
|
205
|
-
expiresAt: required(value.expiresAt),
|
|
206
|
-
...value.sas === void 0 ? {} : { sas: required(value.sas) },
|
|
207
|
-
completed: boolean(value.completed),
|
|
208
|
-
...value.identity === void 0 ? {} : { identity: identity(value.identity) }
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function adminJoinProgress(value) {
|
|
212
|
-
return {
|
|
213
|
-
joinSessionId: required(value.joinSessionId),
|
|
214
|
-
localPhase: value.localPhase,
|
|
215
|
-
remoteState: value.remoteState,
|
|
216
|
-
expiresAt: required(value.expiresAt),
|
|
217
|
-
...value.sas === void 0 ? {} : { sas: required(value.sas) }
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
200
|
function profile(value) {
|
|
221
201
|
return {
|
|
222
202
|
did: required(value.did),
|
|
@@ -327,25 +307,17 @@ var RustSdkAdapter = class {
|
|
|
327
307
|
client;
|
|
328
308
|
attachmentConversations = /* @__PURE__ */ new Map();
|
|
329
309
|
disposal;
|
|
330
|
-
realtime;
|
|
331
|
-
agentInbox;
|
|
332
310
|
listener;
|
|
333
311
|
constructor(client) {
|
|
334
312
|
this.client = Promise.resolve(client);
|
|
335
|
-
this.
|
|
313
|
+
this.listener = {
|
|
336
314
|
syncNow: (reason) => this.listenerSyncNow(reason),
|
|
337
|
-
startRealtime: () => this.listenerStartRealtime()
|
|
338
|
-
};
|
|
339
|
-
this.agentInbox = {
|
|
315
|
+
startRealtime: () => this.listenerStartRealtime(),
|
|
340
316
|
listConversations: (request) => this.listenerConversations(request),
|
|
341
317
|
getHistory: (request) => this.listenerHistory(request),
|
|
342
318
|
markConversationRead: (conversationId) => this.markConversationRead(conversationId),
|
|
343
319
|
sendText: (request) => this.sendText(request)
|
|
344
320
|
};
|
|
345
|
-
this.listener = {
|
|
346
|
-
...this.realtime,
|
|
347
|
-
...this.agentInbox
|
|
348
|
-
};
|
|
349
321
|
}
|
|
350
322
|
async run(operation, ambiguousSend = false) {
|
|
351
323
|
try {
|
|
@@ -557,9 +529,6 @@ var RustSdkAdapter = class {
|
|
|
557
529
|
const session = await client.startRealtime();
|
|
558
530
|
return {
|
|
559
531
|
nextEvent: () => this.run(() => session.nextEvent()),
|
|
560
|
-
getStatus: () => this.run(async () => {
|
|
561
|
-
return { connected: (await session.getStatus()).connected };
|
|
562
|
-
}),
|
|
563
532
|
stop: () => this.run(() => session.stop())
|
|
564
533
|
};
|
|
565
534
|
});
|
|
@@ -622,114 +591,7 @@ var RustSdkAdapter = class {
|
|
|
622
591
|
});
|
|
623
592
|
}
|
|
624
593
|
registerIdentity(request) {
|
|
625
|
-
return this.run(async (client) =>
|
|
626
|
-
const value = await client.completeRegistrationWithOutcome(request);
|
|
627
|
-
if (value.status === "registered") return {
|
|
628
|
-
status: "registered",
|
|
629
|
-
identity: identity(value.identity)
|
|
630
|
-
};
|
|
631
|
-
return {
|
|
632
|
-
status: "join-required",
|
|
633
|
-
continuationId: required(value.existingHandle.continuationId),
|
|
634
|
-
fullHandle: required(value.existingHandle.fullHandle),
|
|
635
|
-
mode: value.existingHandle.mode === "handle_recovery_rebind" ? "handle-recovery-rebind" : "ordinary",
|
|
636
|
-
requiresUserPresence: boolean(value.existingHandle.requiresUserPresence)
|
|
637
|
-
};
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
beginDeviceJoin(request) {
|
|
641
|
-
return this.run(async (client) => joinProgress(await client.beginPreparedRegistrationJoin(request)));
|
|
642
|
-
}
|
|
643
|
-
getDeviceJoinStatus(joinSessionId) {
|
|
644
|
-
return this.run(async (client) => joinProgress(await client.resumePreparedRegistrationJoin({ joinSessionId })));
|
|
645
|
-
}
|
|
646
|
-
listLocalDeviceJoinSessions() {
|
|
647
|
-
return this.run(async (client) => (await client.listLocalDeviceJoinSessions()).map((value) => ({
|
|
648
|
-
joinSessionId: required(value.joinSessionId),
|
|
649
|
-
side: value.side,
|
|
650
|
-
localPhase: value.localPhase,
|
|
651
|
-
expiresAt: required(value.expiresAt)
|
|
652
|
-
})));
|
|
653
|
-
}
|
|
654
|
-
cancelDeviceJoin(joinSessionId) {
|
|
655
|
-
return this.run(async (client) => {
|
|
656
|
-
const value = await client.cancelPreparedRegistrationJoin({ joinSessionId });
|
|
657
|
-
return {
|
|
658
|
-
joinSessionId: required(value.joinSessionId),
|
|
659
|
-
side: value.side,
|
|
660
|
-
localPhase: value.localPhase,
|
|
661
|
-
expiresAt: required(value.expiresAt)
|
|
662
|
-
};
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
getCurrentDeviceSummary() {
|
|
666
|
-
return this.run(async (client) => {
|
|
667
|
-
const value = await client.getCurrentDeviceSummary();
|
|
668
|
-
return {
|
|
669
|
-
...value.role === void 0 ? {} : { role: value.role },
|
|
670
|
-
readiness: value.readiness,
|
|
671
|
-
canManage: boolean(value.canManage)
|
|
672
|
-
};
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
syncDeviceManagement() {
|
|
676
|
-
return this.run(async (client) => {
|
|
677
|
-
await client.syncNow({ reason: "foreground_reconcile" });
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
getDeviceRegistry() {
|
|
681
|
-
return this.run(async (client) => (await client.getDeviceRegistry()).devices.map((value) => ({
|
|
682
|
-
deviceId: required(value.protocolDeviceId),
|
|
683
|
-
status: value.status,
|
|
684
|
-
role: value.role,
|
|
685
|
-
managementReady: boolean(value.managementReady),
|
|
686
|
-
isCurrent: boolean(value.isCurrent)
|
|
687
|
-
})));
|
|
688
|
-
}
|
|
689
|
-
listLocalDeviceJoinRequests() {
|
|
690
|
-
return this.run(async (client) => (await client.listLocalDeviceJoinRequests()).map((value) => ({
|
|
691
|
-
joinSessionId: required(value.joinSessionId),
|
|
692
|
-
candidateKeyFingerprint: required(value.candidateKeyFingerprint),
|
|
693
|
-
issuedAt: required(value.issuedAt),
|
|
694
|
-
expiresAt: required(value.expiresAt),
|
|
695
|
-
state: value.state,
|
|
696
|
-
claimedByCurrentDevice: boolean(value.claimedByCurrentDevice),
|
|
697
|
-
canStartVerification: boolean(value.canStartVerification)
|
|
698
|
-
})));
|
|
699
|
-
}
|
|
700
|
-
startDeviceJoinVerification(request) {
|
|
701
|
-
return this.run(async (client) => adminJoinProgress(await client.startDeviceJoinVerification(request)));
|
|
702
|
-
}
|
|
703
|
-
getLocalDeviceJoinVerificationProgress(joinSessionId) {
|
|
704
|
-
return this.run(async (client) => adminJoinProgress(await client.getLocalDeviceJoinVerificationProgress({ joinSessionId })));
|
|
705
|
-
}
|
|
706
|
-
prepareDeviceJoinApproval(joinSessionId) {
|
|
707
|
-
return this.run(async (client) => {
|
|
708
|
-
return { approvalHandle: required((await client.prepareDeviceJoinApproval({
|
|
709
|
-
joinSessionId,
|
|
710
|
-
sasConfirmed: true
|
|
711
|
-
})).approvalHandle) };
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
confirmDeviceJoinApproval(approvalHandle) {
|
|
715
|
-
return this.run(async (client) => adminJoinProgress(await client.confirmDeviceJoinApproval({
|
|
716
|
-
approvalHandle,
|
|
717
|
-
userPresenceConfirmed: true
|
|
718
|
-
})));
|
|
719
|
-
}
|
|
720
|
-
rejectDeviceJoin(joinSessionId, reason) {
|
|
721
|
-
return this.run(async (client) => adminJoinProgress(await client.rejectDeviceJoin({
|
|
722
|
-
joinSessionId,
|
|
723
|
-
reason
|
|
724
|
-
})));
|
|
725
|
-
}
|
|
726
|
-
revokeDevice(deviceId) {
|
|
727
|
-
return this.run(async (client) => {
|
|
728
|
-
await client.revokeDevice({
|
|
729
|
-
targetDeviceId: deviceId,
|
|
730
|
-
userPresenceConfirmed: true
|
|
731
|
-
});
|
|
732
|
-
});
|
|
594
|
+
return this.run(async (client) => identity(await client.completeRegistration(request)));
|
|
733
595
|
}
|
|
734
596
|
updateDisplayName(request) {
|
|
735
597
|
return this.run(async (client) => identity(await client.updateDisplayName(request.displayName)));
|