@awiki/dsh-plugin 0.2.4 → 0.2.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 +80 -11
- package/README.zh.md +67 -12
- package/THIRD_PARTY_NOTICES.md +8 -1
- package/cordis.patch.yml +13 -0
- package/lib/client.js +8223 -1939
- package/lib/client.js.map +1 -1
- package/lib/index.js +1486 -59
- package/lib/model-proxy-contract.js +89 -0
- package/lib/model-proxy.js +383 -0
- package/lib/provider.js +2 -1
- package/lib/sdk-adapter-DKgkyApB.mjs +669 -0
- package/lib/typert.host.js +470 -482
- package/lib/typert.remote-client.d.ts +15 -1
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +469 -103
- package/lib/types/attachment-cache.d.ts +28 -0
- package/lib/types/attachment-cache.d.ts.map +1 -0
- package/lib/types/attachment-cache.js +194 -0
- package/lib/types/attachment-cache.js.map +1 -0
- package/lib/types/client/AwikiMail.d.ts +14 -0
- package/lib/types/client/AwikiMail.d.ts.map +1 -0
- package/lib/types/client/AwikiMail.js +260 -0
- package/lib/types/client/AwikiMail.js.map +1 -0
- package/lib/types/client/AwikiOnboarding.d.ts +22 -0
- package/lib/types/client/AwikiOnboarding.d.ts.map +1 -0
- package/lib/types/client/AwikiOnboarding.js +87 -0
- package/lib/types/client/AwikiOnboarding.js.map +1 -0
- package/lib/types/client/AwikiOverlay.d.ts +15 -0
- package/lib/types/client/AwikiOverlay.d.ts.map +1 -1
- package/lib/types/client/AwikiOverlay.js +251 -20
- package/lib/types/client/AwikiOverlay.js.map +1 -1
- package/lib/types/client/AwikiSettingsSection.d.ts +20 -4
- package/lib/types/client/AwikiSettingsSection.d.ts.map +1 -1
- package/lib/types/client/AwikiSettingsSection.js +279 -23
- package/lib/types/client/AwikiSettingsSection.js.map +1 -1
- package/lib/types/client/RechargeComingSoonDialog.d.ts +11 -0
- package/lib/types/client/RechargeComingSoonDialog.d.ts.map +1 -0
- package/lib/types/client/RechargeComingSoonDialog.js +8 -0
- package/lib/types/client/RechargeComingSoonDialog.js.map +1 -0
- package/lib/types/client/controller.d.ts +82 -4
- package/lib/types/client/controller.d.ts.map +1 -1
- package/lib/types/client/controller.js +517 -74
- package/lib/types/client/controller.js.map +1 -1
- package/lib/types/client/image-cache.d.ts +20 -0
- package/lib/types/client/image-cache.d.ts.map +1 -0
- package/lib/types/client/image-cache.js +177 -0
- package/lib/types/client/image-cache.js.map +1 -0
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +84 -41
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/model-account-settings-availability.d.ts +4 -0
- package/lib/types/client/model-account-settings-availability.d.ts.map +1 -0
- package/lib/types/client/model-account-settings-availability.js +4 -0
- package/lib/types/client/model-account-settings-availability.js.map +1 -0
- package/lib/types/client/model-availability-controller.d.ts +27 -0
- package/lib/types/client/model-availability-controller.d.ts.map +1 -0
- package/lib/types/client/model-availability-controller.js +111 -0
- package/lib/types/client/model-availability-controller.js.map +1 -0
- package/lib/types/client/model-proxy-controller.d.ts +41 -0
- package/lib/types/client/model-proxy-controller.d.ts.map +1 -0
- package/lib/types/client/model-proxy-controller.js +241 -0
- package/lib/types/client/model-proxy-controller.js.map +1 -0
- package/lib/types/client/recharge-availability.d.ts +6 -0
- package/lib/types/client/recharge-availability.d.ts.map +1 -0
- package/lib/types/client/recharge-availability.js +6 -0
- package/lib/types/client/recharge-availability.js.map +1 -0
- package/lib/types/client/settings-locales.d.ts +1 -1
- package/lib/types/client/settings-locales.d.ts.map +1 -1
- package/lib/types/client/settings-locales.js +180 -2
- package/lib/types/client/settings-locales.js.map +1 -1
- package/lib/types/client/slots.d.ts +15 -2
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/index.d.ts +56 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +462 -31
- package/lib/types/index.js.map +1 -1
- package/lib/types/listener-state.d.ts +23 -0
- package/lib/types/listener-state.d.ts.map +1 -0
- package/lib/types/listener-state.js +124 -0
- package/lib/types/listener-state.js.map +1 -0
- package/lib/types/listener.d.ts +96 -0
- package/lib/types/listener.d.ts.map +1 -0
- package/lib/types/listener.js +575 -0
- package/lib/types/listener.js.map +1 -0
- package/lib/types/mail.d.ts +8 -0
- package/lib/types/mail.d.ts.map +1 -0
- package/lib/types/mail.js +75 -0
- package/lib/types/mail.js.map +1 -0
- package/lib/types/model-proxy-contract.d.ts +61 -0
- package/lib/types/model-proxy-contract.d.ts.map +1 -0
- package/lib/types/model-proxy-contract.js +129 -0
- package/lib/types/model-proxy-contract.js.map +1 -0
- package/lib/types/model-proxy.d.ts +14 -0
- package/lib/types/model-proxy.d.ts.map +1 -0
- package/lib/types/model-proxy.js +371 -0
- package/lib/types/model-proxy.js.map +1 -0
- package/lib/types/provider-api.d.ts +78 -2
- package/lib/types/provider-api.d.ts.map +1 -1
- package/lib/types/provider.d.ts.map +1 -1
- package/lib/types/provider.js +1 -0
- package/lib/types/provider.js.map +1 -1
- package/lib/types/sdk-adapter.d.ts +26 -2
- package/lib/types/sdk-adapter.d.ts.map +1 -1
- package/lib/types/sdk-adapter.js +380 -24
- package/lib/types/sdk-adapter.js.map +1 -1
- package/lib/types/tools.d.ts +10 -0
- package/lib/types/tools.d.ts.map +1 -1
- package/lib/types/tools.js +98 -0
- package/lib/types/tools.js.map +1 -1
- package/lib/types/types.d.ts +103 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/package.json +30 -5
- package/lib/sdk-adapter-DK6RqV-c.mjs +0 -355
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
//#region lib/types/sdk-adapter.js
|
|
2
|
-
/** Rust IM Core adapter that copies native values into Host-owned public DTOs. */
|
|
3
|
-
const GROUP_LOOKUP_LIMIT = 100;
|
|
4
|
-
const MAX_GROUP_LOOKUP_PAGES = 20;
|
|
5
|
-
const RUST_FAILURE_CODES = {
|
|
6
|
-
invalid_input: "invalid-request",
|
|
7
|
-
invalid_state_root: "invalid-request",
|
|
8
|
-
invalid_cursor: "invalid-request",
|
|
9
|
-
identity_required: "not-registered",
|
|
10
|
-
identity_not_found: "not-registered",
|
|
11
|
-
identity_not_ready: "not-registered",
|
|
12
|
-
auth_required: "not-registered",
|
|
13
|
-
invalid_otp: "invalid-otp",
|
|
14
|
-
challenge_expired: "challenge-expired",
|
|
15
|
-
handle_unavailable: "handle-unavailable",
|
|
16
|
-
not_found: "not-found",
|
|
17
|
-
permission_denied: "forbidden",
|
|
18
|
-
auth_revoked: "forbidden",
|
|
19
|
-
conflict: "conflict",
|
|
20
|
-
join_required: "handle-unavailable",
|
|
21
|
-
state_in_use: "conflict",
|
|
22
|
-
rate_limited: "rate-limited",
|
|
23
|
-
timeout: "network",
|
|
24
|
-
transport_unavailable: "network",
|
|
25
|
-
sync_failed: "network",
|
|
26
|
-
session_expired: "network",
|
|
27
|
-
attachment_transfer_network: "network"
|
|
28
|
-
};
|
|
29
|
-
/** Closed provider error consumed by the Host's fixed public failure mapping. */
|
|
30
|
-
var AwikiSdkError = class extends Error {
|
|
31
|
-
code;
|
|
32
|
-
name = "AwikiSdkError";
|
|
33
|
-
constructor(code) {
|
|
34
|
-
super(`AWiki SDK operation failed: ${code}`);
|
|
35
|
-
this.code = code;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
function fail(code = "remote") {
|
|
39
|
-
throw new AwikiSdkError(code);
|
|
40
|
-
}
|
|
41
|
-
function mapError(error) {
|
|
42
|
-
if (error instanceof AwikiSdkError) throw error;
|
|
43
|
-
let code = "remote";
|
|
44
|
-
try {
|
|
45
|
-
if (typeof error === "object" && error !== null) {
|
|
46
|
-
const value = error;
|
|
47
|
-
if (value.name === "ImCoreNodeError" && typeof value.code === "string") code = RUST_FAILURE_CODES[value.code] ?? "remote";
|
|
48
|
-
}
|
|
49
|
-
} catch {}
|
|
50
|
-
fail(code);
|
|
51
|
-
}
|
|
52
|
-
function safeInteger(value, minimum = 0) {
|
|
53
|
-
if (!/^(?:0|[1-9]\d*)$/u.test(value)) fail();
|
|
54
|
-
const parsed = Number(value);
|
|
55
|
-
if (!Number.isSafeInteger(parsed) || parsed < minimum) fail();
|
|
56
|
-
return parsed;
|
|
57
|
-
}
|
|
58
|
-
function timestamp(value) {
|
|
59
|
-
const parsed = Date.parse(value);
|
|
60
|
-
if (!Number.isSafeInteger(parsed)) fail();
|
|
61
|
-
return parsed;
|
|
62
|
-
}
|
|
63
|
-
function required(value) {
|
|
64
|
-
if (value === void 0 || value.trim().length === 0) fail();
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
function sha256(value) {
|
|
68
|
-
const provided = value.sha256Hex?.toLowerCase();
|
|
69
|
-
if (provided !== void 0 && /^[a-f0-9]{64}$/u.test(provided)) return provided;
|
|
70
|
-
try {
|
|
71
|
-
const bytes = Buffer.from(value.digestB64u, "base64url");
|
|
72
|
-
if (bytes.byteLength === 32 && bytes.toString("base64url") === value.digestB64u) return bytes.toString("hex");
|
|
73
|
-
} catch {}
|
|
74
|
-
fail();
|
|
75
|
-
}
|
|
76
|
-
/** Copy one native identity without retaining provider-owned objects. */
|
|
77
|
-
function identity(value) {
|
|
78
|
-
return {
|
|
79
|
-
handle: required(value.handle),
|
|
80
|
-
did: required(value.did),
|
|
81
|
-
...value.displayName === void 0 ? {} : { displayName: value.displayName },
|
|
82
|
-
registeredAt: safeInteger(value.registeredAtMs)
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/** Copy one native attachment and normalize its decimal/digest encodings. */
|
|
86
|
-
function attachment(value) {
|
|
87
|
-
return {
|
|
88
|
-
id: required(value.id),
|
|
89
|
-
fileName: required(value.fileName),
|
|
90
|
-
mimeType: required(value.mimeType),
|
|
91
|
-
size: safeInteger(value.sizeBytes),
|
|
92
|
-
sha256: sha256(value)
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function preview(value) {
|
|
96
|
-
if (value === void 0) return void 0;
|
|
97
|
-
switch (value.content.kind) {
|
|
98
|
-
case "text": return value.content.text;
|
|
99
|
-
case "attachment": {
|
|
100
|
-
const fileName = value.content.attachment?.fileName;
|
|
101
|
-
return fileName === void 0 ? void 0 : `[附件] ${fileName}`;
|
|
102
|
-
}
|
|
103
|
-
default: return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/** Copy one native page and brand its opaque cursor for the Host API. */
|
|
107
|
-
function page(value, copy) {
|
|
108
|
-
return {
|
|
109
|
-
items: value.items.map(copy),
|
|
110
|
-
...value.nextCursor === void 0 ? {} : { nextCursor: String(value.nextCursor) },
|
|
111
|
-
hasMore: value.hasMore
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function httpHeaders(headers) {
|
|
115
|
-
return headers.map((header) => ({
|
|
116
|
-
name: String(header.name),
|
|
117
|
-
value: String(header.value)
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
function externalHttpAttempt(value) {
|
|
121
|
-
return {
|
|
122
|
-
targetUrl: String(value.targetUrl),
|
|
123
|
-
method: String(value.method),
|
|
124
|
-
headerPatch: httpHeaders(value.headerPatch),
|
|
125
|
-
retryCount: value.retryCount,
|
|
126
|
-
async handleResponse(response) {
|
|
127
|
-
try {
|
|
128
|
-
const retry = await value.handleResponse({
|
|
129
|
-
statusCode: response.statusCode,
|
|
130
|
-
headers: response.headers.map((header) => ({
|
|
131
|
-
name: header.name,
|
|
132
|
-
value: header.value
|
|
133
|
-
}))
|
|
134
|
-
});
|
|
135
|
-
return retry === null ? null : externalHttpAttempt(retry);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
mapError(error);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
/** Adapt the Rust Node bridge to the frozen Host provider interface. */
|
|
143
|
-
var RustSdkAdapter = class {
|
|
144
|
-
client;
|
|
145
|
-
attachmentConversations = /* @__PURE__ */ new Map();
|
|
146
|
-
disposal;
|
|
147
|
-
constructor(client) {
|
|
148
|
-
this.client = Promise.resolve(client);
|
|
149
|
-
}
|
|
150
|
-
async run(operation) {
|
|
151
|
-
try {
|
|
152
|
-
return await operation(await this.client);
|
|
153
|
-
} catch (error) {
|
|
154
|
-
mapError(error);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
message(value) {
|
|
158
|
-
const sentAt = value.sentAt === void 0 ? fail() : timestamp(value.sentAt);
|
|
159
|
-
const common = {
|
|
160
|
-
id: required(value.id),
|
|
161
|
-
conversationId: required(value.conversationId),
|
|
162
|
-
conversationKind: value.conversationKind,
|
|
163
|
-
senderDid: required(value.senderDid),
|
|
164
|
-
...value.senderHandle === void 0 ? {} : { senderHandle: value.senderHandle },
|
|
165
|
-
...value.senderDisplayName === void 0 ? {} : { senderDisplayName: value.senderDisplayName },
|
|
166
|
-
sentAt,
|
|
167
|
-
outgoing: value.outgoing
|
|
168
|
-
};
|
|
169
|
-
switch (value.content.kind) {
|
|
170
|
-
case "text": return {
|
|
171
|
-
...common,
|
|
172
|
-
content: {
|
|
173
|
-
kind: "text",
|
|
174
|
-
text: required(value.content.text)
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
case "attachment": {
|
|
178
|
-
if (value.content.attachment === void 0) fail();
|
|
179
|
-
const copied = attachment(value.content.attachment);
|
|
180
|
-
this.attachmentConversations.set(`${String(common.id)}\u0000${String(copied.id)}`, String(common.conversationId));
|
|
181
|
-
return {
|
|
182
|
-
...common,
|
|
183
|
-
content: {
|
|
184
|
-
kind: "attachment",
|
|
185
|
-
attachment: copied,
|
|
186
|
-
...value.content.caption === void 0 ? {} : { caption: value.content.caption }
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
default: fail();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
conversation(value) {
|
|
194
|
-
const id = required(value.id);
|
|
195
|
-
const title = value.title?.trim();
|
|
196
|
-
const lastMessagePreview = preview(value.lastMessage);
|
|
197
|
-
const common = {
|
|
198
|
-
id,
|
|
199
|
-
title: title === void 0 || title.length === 0 ? required(value.kind === "direct" ? value.peerHandle ?? value.peerDid : value.groupDid) : title,
|
|
200
|
-
unreadCount: value.unreadCount,
|
|
201
|
-
...value.lastMessageAt === void 0 ? {} : { lastMessageAt: timestamp(value.lastMessageAt) },
|
|
202
|
-
...lastMessagePreview === void 0 ? {} : { lastMessagePreview }
|
|
203
|
-
};
|
|
204
|
-
if (value.lastMessage !== void 0) this.message(value.lastMessage);
|
|
205
|
-
switch (value.kind) {
|
|
206
|
-
case "direct": return {
|
|
207
|
-
kind: "direct",
|
|
208
|
-
...common,
|
|
209
|
-
peerDid: required(value.peerDid),
|
|
210
|
-
...value.peerHandle === void 0 ? {} : { peerHandle: value.peerHandle }
|
|
211
|
-
};
|
|
212
|
-
case "group": return {
|
|
213
|
-
kind: "group",
|
|
214
|
-
...common,
|
|
215
|
-
groupDid: required(value.groupDid)
|
|
216
|
-
};
|
|
217
|
-
default: fail();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
async conversationId(client, target) {
|
|
221
|
-
if (target.kind === "direct") return required((await client.resolvePeer(target.peer)).conversationId);
|
|
222
|
-
let cursor;
|
|
223
|
-
for (let index = 0; index < MAX_GROUP_LOOKUP_PAGES; index += 1) {
|
|
224
|
-
const result = await client.listConversations({
|
|
225
|
-
...cursor === void 0 ? {} : { cursor },
|
|
226
|
-
limit: GROUP_LOOKUP_LIMIT
|
|
227
|
-
});
|
|
228
|
-
const match = result.items.find((item) => item.kind === "group" && (item.id === target.group || item.groupDid === target.group));
|
|
229
|
-
if (match !== void 0) return required(match.id);
|
|
230
|
-
if (!result.hasMore || result.nextCursor === void 0) fail("not-found");
|
|
231
|
-
cursor = result.nextCursor;
|
|
232
|
-
}
|
|
233
|
-
fail("not-found");
|
|
234
|
-
}
|
|
235
|
-
prepareExternalHttpRequest(request) {
|
|
236
|
-
return this.run(async (client) => externalHttpAttempt(await client.prepareExternalHttpRequest({
|
|
237
|
-
url: request.url,
|
|
238
|
-
method: request.method,
|
|
239
|
-
headers: request.headers.map((header) => ({
|
|
240
|
-
name: header.name,
|
|
241
|
-
value: header.value
|
|
242
|
-
})),
|
|
243
|
-
...request.body === void 0 ? {} : { body: Uint8Array.from(request.body) }
|
|
244
|
-
})));
|
|
245
|
-
}
|
|
246
|
-
getIdentity() {
|
|
247
|
-
return this.run(async (client) => {
|
|
248
|
-
const value = await client.getDefaultIdentity();
|
|
249
|
-
return value === null ? null : identity(value);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
sendRegistrationOtp(request) {
|
|
253
|
-
return this.run(async (client) => {
|
|
254
|
-
const value = await client.requestRegistrationOtp(request);
|
|
255
|
-
return {
|
|
256
|
-
retryAfterSeconds: value.retryAfterSeconds,
|
|
257
|
-
retryAt: value.retryAt
|
|
258
|
-
};
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
registerIdentity(request) {
|
|
262
|
-
return this.run(async (client) => identity(await client.completeRegistration(request)));
|
|
263
|
-
}
|
|
264
|
-
updateDisplayName(request) {
|
|
265
|
-
return this.run(async (client) => identity(await client.updateDisplayName(request.displayName)));
|
|
266
|
-
}
|
|
267
|
-
resolvePeer(peer) {
|
|
268
|
-
return this.run(async (client) => {
|
|
269
|
-
const value = await client.resolvePeer(peer);
|
|
270
|
-
return {
|
|
271
|
-
did: required(value.did),
|
|
272
|
-
conversationId: required(value.conversationId),
|
|
273
|
-
...value.handle === void 0 ? {} : { handle: value.handle },
|
|
274
|
-
...value.displayName === void 0 ? {} : { displayName: value.displayName }
|
|
275
|
-
};
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
listConversations(request) {
|
|
279
|
-
return this.run(async (client) => page(await client.listConversations(request), (value) => this.conversation(value)));
|
|
280
|
-
}
|
|
281
|
-
getHistory(request) {
|
|
282
|
-
return this.run(async (client) => {
|
|
283
|
-
const history = await client.getHistory({
|
|
284
|
-
conversationId: String(request.conversationId),
|
|
285
|
-
...request.cursor === void 0 ? {} : { cursor: String(request.cursor) },
|
|
286
|
-
...request.limit === void 0 ? {} : { limit: request.limit }
|
|
287
|
-
});
|
|
288
|
-
return page({
|
|
289
|
-
...history,
|
|
290
|
-
items: [...history.items].reverse()
|
|
291
|
-
}, (value) => this.message(value));
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
markConversationRead(conversationId) {
|
|
295
|
-
return this.run(async (client) => (await client.markConversationRead(String(conversationId))).updatedCount);
|
|
296
|
-
}
|
|
297
|
-
sendText(request) {
|
|
298
|
-
return this.run(async (client) => this.message(await client.sendText({
|
|
299
|
-
conversationId: await this.conversationId(client, request.target),
|
|
300
|
-
text: request.text,
|
|
301
|
-
idempotencyKey: request.idempotencyKey
|
|
302
|
-
})));
|
|
303
|
-
}
|
|
304
|
-
sendAttachment(request) {
|
|
305
|
-
return this.run(async (client) => this.message(await client.sendAttachment({
|
|
306
|
-
conversationId: await this.conversationId(client, request.target),
|
|
307
|
-
fileName: request.attachment.fileName,
|
|
308
|
-
mimeType: request.attachment.mimeType,
|
|
309
|
-
bytes: request.attachment.bytes,
|
|
310
|
-
...request.caption === void 0 ? {} : { caption: request.caption },
|
|
311
|
-
idempotencyKey: request.idempotencyKey
|
|
312
|
-
})));
|
|
313
|
-
}
|
|
314
|
-
downloadAttachment(request) {
|
|
315
|
-
return this.run(async (client) => {
|
|
316
|
-
const conversationId = this.attachmentConversations.get(`${String(request.messageId)}\u0000${String(request.attachmentId)}`);
|
|
317
|
-
if (conversationId === void 0) fail("not-found");
|
|
318
|
-
const value = await client.downloadAttachment({
|
|
319
|
-
conversationId,
|
|
320
|
-
messageId: String(request.messageId),
|
|
321
|
-
attachmentId: String(request.attachmentId)
|
|
322
|
-
});
|
|
323
|
-
return {
|
|
324
|
-
attachment: attachment(value.attachment),
|
|
325
|
-
bytes: Uint8Array.from(value.bytes)
|
|
326
|
-
};
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
clearLocalData() {
|
|
330
|
-
return this.run((client) => client.clearLocalData());
|
|
331
|
-
}
|
|
332
|
-
dispose() {
|
|
333
|
-
this.disposal ??= this.client.then(async (client) => {
|
|
334
|
-
try {
|
|
335
|
-
await client.close();
|
|
336
|
-
} catch (error) {
|
|
337
|
-
mapError(error);
|
|
338
|
-
}
|
|
339
|
-
}, () => void 0);
|
|
340
|
-
return this.disposal;
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* Convert a raw provider download to the Remote JSON representation.
|
|
345
|
-
* @param value - provider-verified public metadata and bytes.
|
|
346
|
-
* @returns detached metadata with canonical Base64 bytes.
|
|
347
|
-
*/
|
|
348
|
-
function downloadedAttachment(value) {
|
|
349
|
-
return {
|
|
350
|
-
attachment: { ...value.attachment },
|
|
351
|
-
bytesBase64: Buffer.from(value.bytes).toString("base64")
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
export { downloadedAttachment as n, RustSdkAdapter as t };
|