@senguoyun/dsh-arkme 0.1.77 → 0.1.79
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/lib/client.js +1037 -134
- package/lib/client.js.map +1 -1
- package/lib/harness-model-client.js +26 -4
- package/lib/harness-native-selection-client.js +26 -4
- package/lib/harness-session-client.js +13 -2
- package/lib/harness-sidebar-client.js +9 -1
- package/lib/index.js +32 -1
- package/lib/persistent-extension.js +1 -1
- package/lib/{persistent-runtime-eUVtjdJU.js → persistent-runtime-CB7mEj3E.js} +507 -111
- package/lib/sdk.js +9 -1
- package/lib/types/account-session-owner.d.ts +1 -1
- package/lib/types/account-session-owner.d.ts.map +1 -1
- package/lib/types/arkme-service.d.ts +16 -0
- package/lib/types/arkme-service.d.ts.map +1 -1
- package/lib/types/client/ArkmeAccountCancellation.d.ts +8 -0
- package/lib/types/client/ArkmeAccountCancellation.d.ts.map +1 -0
- package/lib/types/client/ArkmeLogin.d.ts +3 -0
- package/lib/types/client/ArkmeLogin.d.ts.map +1 -1
- package/lib/types/client/ArkmeRecordingSurface.d.ts +2 -1
- package/lib/types/client/ArkmeRecordingSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeSearchSurface.d.ts.map +1 -1
- package/lib/types/client/ArkmeSettingsSurface.d.ts +12 -1
- package/lib/types/client/ArkmeSettingsSurface.d.ts.map +1 -1
- package/lib/types/client/arkme-auth-flow.d.ts.map +1 -1
- package/lib/types/client/arkme-login-locales.d.ts +6 -0
- package/lib/types/client/arkme-login-locales.d.ts.map +1 -1
- package/lib/types/client/auth-store.d.ts.map +1 -1
- package/lib/types/client/harness-attachment-draft.d.ts +1 -1
- package/lib/types/client/harness-attachment-draft.d.ts.map +1 -1
- package/lib/types/client/harness-session-client.d.ts.map +1 -1
- package/lib/types/client/locales/actions-en.d.ts.map +1 -1
- package/lib/types/client/locales/en.d.ts.map +1 -1
- package/lib/types/client/recordings/RecordingSearchRow.d.ts +5 -0
- package/lib/types/client/recordings/RecordingSearchRow.d.ts.map +1 -0
- package/lib/types/client/recordings/recording-search-target.d.ts +4 -0
- package/lib/types/client/recordings/recording-search-target.d.ts.map +1 -0
- package/lib/types/client/ui-controller.d.ts +3 -5
- package/lib/types/client/ui-controller.d.ts.map +1 -1
- package/lib/types/host-api.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/local-database.d.ts +2 -0
- package/lib/types/local-database.d.ts.map +1 -1
- package/lib/types/recording-presentation.d.ts +1 -0
- package/lib/types/recording-presentation.d.ts.map +1 -1
- package/lib/types/recording-search-result.d.ts +3 -0
- package/lib/types/recording-search-result.d.ts.map +1 -0
- package/lib/types/recording-search-version.d.ts +17 -0
- package/lib/types/recording-search-version.d.ts.map +1 -0
- package/lib/types/sdk/index.d.ts +7 -1
- package/lib/types/sdk/index.d.ts.map +1 -1
- package/lib/types/services/auth-service.d.ts +30 -1
- package/lib/types/services/auth-service.d.ts.map +1 -1
- package/lib/types/services/recording-service.d.ts.map +1 -1
- package/lib/types/services/search-service.d.ts +3 -1
- package/lib/types/services/search-service.d.ts.map +1 -1
- package/lib/types/services/service.d.ts +4 -0
- package/lib/types/services/service.d.ts.map +1 -1
- package/lib/types/state-store.d.ts +7 -0
- package/lib/types/state-store.d.ts.map +1 -1
- package/lib/types/types.d.ts +45 -2
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1018,16 +1018,17 @@ var ArkmeAccountSessionOwner = class {
|
|
|
1018
1018
|
async delete() {
|
|
1019
1019
|
await this.clearSession();
|
|
1020
1020
|
}
|
|
1021
|
-
async deleteIfCurrent(expected) {
|
|
1022
|
-
return await this.clearSession(expected);
|
|
1021
|
+
async deleteIfCurrent(expected, beforeDelete) {
|
|
1022
|
+
return await this.clearSession(expected, beforeDelete);
|
|
1023
1023
|
}
|
|
1024
|
-
async clearSession(expected) {
|
|
1024
|
+
async clearSession(expected, beforeDelete) {
|
|
1025
1025
|
await this.start();
|
|
1026
1026
|
let deleted = false;
|
|
1027
1027
|
await this.serial(async () => {
|
|
1028
1028
|
const current = await this.store.read();
|
|
1029
1029
|
if (current === void 0 || expected !== void 0 && (current.userId !== expected.userId || current.refreshToken !== expected.refreshToken)) return;
|
|
1030
1030
|
await this.transition({ kind: "guest" }, async () => {
|
|
1031
|
+
await beforeDelete?.(current);
|
|
1031
1032
|
await this.store.delete();
|
|
1032
1033
|
});
|
|
1033
1034
|
deleted = true;
|
|
@@ -1295,6 +1296,14 @@ var ServiceRuntime = class {
|
|
|
1295
1296
|
async deleteSession() {
|
|
1296
1297
|
await this.accountSessions.delete();
|
|
1297
1298
|
}
|
|
1299
|
+
async deleteSessionIfCurrent(expected) {
|
|
1300
|
+
return await this.accountSessions.deleteIfCurrent(expected);
|
|
1301
|
+
}
|
|
1302
|
+
async moveSessionToPendingBinding(expected) {
|
|
1303
|
+
return await this.accountSessions.deleteIfCurrent(expected, async (current) => {
|
|
1304
|
+
await this.writePendingBindingSession(current);
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1298
1307
|
requestStats() {
|
|
1299
1308
|
return this.requestCoordinator.snapshotStats();
|
|
1300
1309
|
}
|
|
@@ -1432,8 +1441,8 @@ var ServiceRuntime = class {
|
|
|
1432
1441
|
return session;
|
|
1433
1442
|
}
|
|
1434
1443
|
async writePendingBindingSession(session) {
|
|
1435
|
-
this.pendingBindingSession = session;
|
|
1436
1444
|
await this.pendingSessionStore?.write(session);
|
|
1445
|
+
this.pendingBindingSession = session;
|
|
1437
1446
|
}
|
|
1438
1447
|
async clearPendingBindingSession() {
|
|
1439
1448
|
this.pendingBindingSession = void 0;
|
|
@@ -3857,7 +3866,7 @@ var ArkmeDesktopScreenshot = class {
|
|
|
3857
3866
|
};
|
|
3858
3867
|
//#endregion
|
|
3859
3868
|
//#region src/services/record-edit-history-service.ts
|
|
3860
|
-
function invalid$
|
|
3869
|
+
function invalid$10() {
|
|
3861
3870
|
throw new ArkmePluginError("record-edit-history-invalid", "编辑记录暂不可用,请刷新后重试", true, 502);
|
|
3862
3871
|
}
|
|
3863
3872
|
var RecordEditHistoryService = class {
|
|
@@ -3868,9 +3877,9 @@ var RecordEditHistoryService = class {
|
|
|
3868
3877
|
this.projector = projector;
|
|
3869
3878
|
}
|
|
3870
3879
|
async page(target, cursorEditAt = 0, signal) {
|
|
3871
|
-
if (!Number.isSafeInteger(cursorEditAt) || cursorEditAt < 0 || target.recordUid.trim() === "") invalid$
|
|
3880
|
+
if (!Number.isSafeInteger(cursorEditAt) || cursorEditAt < 0 || target.recordUid.trim() === "") invalid$10();
|
|
3872
3881
|
const session = await this.runtime.requireSession();
|
|
3873
|
-
if (session.userId !== target.viewerUserId) invalid$
|
|
3882
|
+
if (session.userId !== target.viewerUserId) invalid$10();
|
|
3874
3883
|
const window = {
|
|
3875
3884
|
limit: 50,
|
|
3876
3885
|
...cursorEditAt === 0 ? {} : { cursor_edit_at: cursorEditAt }
|
|
@@ -3883,22 +3892,22 @@ var RecordEditHistoryService = class {
|
|
|
3883
3892
|
rel_uid: target.relationUid,
|
|
3884
3893
|
...window
|
|
3885
3894
|
}, session, signal));
|
|
3886
|
-
if (signal?.aborted || (await this.runtime.requireSession()).userId !== session.userId) invalid$
|
|
3887
|
-
if (!Array.isArray(data.items) || typeof data.has_more !== "boolean") invalid$
|
|
3895
|
+
if (signal?.aborted || (await this.runtime.requireSession()).userId !== session.userId) invalid$10();
|
|
3896
|
+
if (!Array.isArray(data.items) || typeof data.has_more !== "boolean") invalid$10();
|
|
3888
3897
|
const next = data.next_cursor_edit_at;
|
|
3889
|
-
if (data.has_more && (typeof next !== "number" || !Number.isSafeInteger(next) || next <= 0 || cursorEditAt > 0 && next >= cursorEditAt)) invalid$
|
|
3898
|
+
if (data.has_more && (typeof next !== "number" || !Number.isSafeInteger(next) || next <= 0 || cursorEditAt > 0 && next >= cursorEditAt)) invalid$10();
|
|
3890
3899
|
const seen = /* @__PURE__ */ new Set();
|
|
3891
3900
|
const snapshots = data.items.flatMap((raw) => {
|
|
3892
3901
|
const revision = objectValue$2(raw);
|
|
3893
|
-
if (revision.record_uid !== target.recordUid || typeof revision.revision_uid !== "string" || revision.revision_uid.trim() === "") invalid$
|
|
3902
|
+
if (revision.record_uid !== target.recordUid || typeof revision.revision_uid !== "string" || revision.revision_uid.trim() === "") invalid$10();
|
|
3894
3903
|
if (revision.revision_type !== 1 && revision.revision_type !== 5) return [];
|
|
3895
|
-
if (typeof revision.edit_at !== "number" || !Number.isSafeInteger(revision.edit_at) || revision.edit_at <= 0 || !Number.isFinite(new Date(revision.edit_at).getTime()) || typeof revision.text_content !== "string") invalid$
|
|
3904
|
+
if (typeof revision.edit_at !== "number" || !Number.isSafeInteger(revision.edit_at) || revision.edit_at <= 0 || !Number.isFinite(new Date(revision.edit_at).getTime()) || typeof revision.text_content !== "string") invalid$10();
|
|
3896
3905
|
if (seen.has(revision.revision_uid)) return [];
|
|
3897
3906
|
seen.add(revision.revision_uid);
|
|
3898
3907
|
return [revision];
|
|
3899
3908
|
});
|
|
3900
3909
|
const contents = snapshots.length === 0 ? [] : await this.projector.projectPage(snapshots, target, signal);
|
|
3901
|
-
if (signal?.aborted || (await this.runtime.requireSession()).userId !== session.userId || contents.length !== snapshots.length) invalid$
|
|
3910
|
+
if (signal?.aborted || (await this.runtime.requireSession()).userId !== session.userId || contents.length !== snapshots.length) invalid$10();
|
|
3902
3911
|
const items = snapshots.map((revision, index) => ({
|
|
3903
3912
|
revisionUid: revision.revision_uid,
|
|
3904
3913
|
kind: revision.revision_type === 5 ? "original" : "manual",
|
|
@@ -22451,7 +22460,7 @@ function arkmeArticleImageReference(value) {
|
|
|
22451
22460
|
}
|
|
22452
22461
|
//#endregion
|
|
22453
22462
|
//#region src/services/archive-service.ts
|
|
22454
|
-
const invalid$
|
|
22463
|
+
const invalid$9 = () => new ArkmePluginError("archive-contract-invalid", "归档数据无效,请刷新后重试", false, 502);
|
|
22455
22464
|
/** One Host owner for UI, Tools and SDK. Raw topic identities stay here. */
|
|
22456
22465
|
var ArchiveService = class {
|
|
22457
22466
|
runtime;
|
|
@@ -22475,17 +22484,17 @@ var ArchiveService = class {
|
|
|
22475
22484
|
limit: 50,
|
|
22476
22485
|
...cursor === void 0 ? {} : { cursor }
|
|
22477
22486
|
}, session, readSignal, { lane: "interactive-read" });
|
|
22478
|
-
if (!Array.isArray(data.items) || typeof data.has_more !== "boolean") throw invalid$
|
|
22487
|
+
if (!Array.isArray(data.items) || typeof data.has_more !== "boolean") throw invalid$9();
|
|
22479
22488
|
const items = [];
|
|
22480
22489
|
for (const value of data.items) {
|
|
22481
22490
|
const raw = objectValue$2(value);
|
|
22482
|
-
if (typeof raw.title !== "string" || typeof raw.privacy_locked !== "boolean") throw invalid$
|
|
22491
|
+
if (typeof raw.title !== "string" || typeof raw.privacy_locked !== "boolean") throw invalid$9();
|
|
22483
22492
|
const title = raw.privacy_locked ? "隐私主题" : raw.title;
|
|
22484
22493
|
const state = await this.state(session, raw, title);
|
|
22485
|
-
if (!state.ownerAvailable || !state.effectiveArchived) throw invalid$
|
|
22494
|
+
if (!state.ownerAvailable || !state.effectiveArchived) throw invalid$9();
|
|
22486
22495
|
const inherited = raw.inherited_from_summary === void 0 ? void 0 : objectValue$2(raw.inherited_from_summary);
|
|
22487
|
-
if (state.inheritedFrom !== void 0 !== (inherited !== void 0)) throw invalid$
|
|
22488
|
-
if (inherited !== void 0 && (typeof inherited.title !== "string" || typeof inherited.privacy_locked !== "boolean")) throw invalid$
|
|
22496
|
+
if (state.inheritedFrom !== void 0 !== (inherited !== void 0)) throw invalid$9();
|
|
22497
|
+
if (inherited !== void 0 && (typeof inherited.title !== "string" || typeof inherited.privacy_locked !== "boolean")) throw invalid$9();
|
|
22489
22498
|
items.push({
|
|
22490
22499
|
...state,
|
|
22491
22500
|
privacyLocked: raw.privacy_locked,
|
|
@@ -22504,7 +22513,7 @@ var ArchiveService = class {
|
|
|
22504
22513
|
}
|
|
22505
22514
|
});
|
|
22506
22515
|
}
|
|
22507
|
-
if (data.has_more && (typeof data.next_cursor !== "string" || data.next_cursor === "" || data.next_cursor === cursor)) throw invalid$
|
|
22516
|
+
if (data.has_more && (typeof data.next_cursor !== "string" || data.next_cursor === "" || data.next_cursor === cursor)) throw invalid$9();
|
|
22508
22517
|
await this.assertSession(session);
|
|
22509
22518
|
return {
|
|
22510
22519
|
items,
|
|
@@ -22514,7 +22523,7 @@ var ArchiveService = class {
|
|
|
22514
22523
|
}, signal);
|
|
22515
22524
|
}
|
|
22516
22525
|
async states(sourceRefs, signal) {
|
|
22517
|
-
if (sourceRefs.length === 0 || sourceRefs.length > 200 || new Set(sourceRefs).size !== sourceRefs.length) throw invalid$
|
|
22526
|
+
if (sourceRefs.length === 0 || sourceRefs.length > 200 || new Set(sourceRefs).size !== sourceRefs.length) throw invalid$9();
|
|
22518
22527
|
return this.runtime.runOwnerRead("archives", {
|
|
22519
22528
|
operation: "states",
|
|
22520
22529
|
sourceRefs
|
|
@@ -22527,12 +22536,12 @@ var ArchiveService = class {
|
|
|
22527
22536
|
entity_type: 1,
|
|
22528
22537
|
entity_uid: ref.ownerRef
|
|
22529
22538
|
})) }, session, readSignal, { lane: "interactive-read" });
|
|
22530
|
-
if (!Array.isArray(data.items) || data.items.length !== refs.length) throw invalid$
|
|
22539
|
+
if (!Array.isArray(data.items) || data.items.length !== refs.length) throw invalid$9();
|
|
22531
22540
|
const byUID = new Map(data.items.map((value) => {
|
|
22532
22541
|
const raw = objectValue$2(value);
|
|
22533
22542
|
return [raw.entity_uid, raw];
|
|
22534
22543
|
}));
|
|
22535
|
-
if (byUID.size !== refs.length) throw invalid$
|
|
22544
|
+
if (byUID.size !== refs.length) throw invalid$9();
|
|
22536
22545
|
const states = await Promise.all(refs.map(async (ref, i) => ({
|
|
22537
22546
|
...await this.state(session, byUID.get(ref.ownerRef), ""),
|
|
22538
22547
|
sourceRef: sourceRefs[i]
|
|
@@ -22542,7 +22551,7 @@ var ArchiveService = class {
|
|
|
22542
22551
|
}, signal);
|
|
22543
22552
|
}
|
|
22544
22553
|
async set(input, signal) {
|
|
22545
|
-
if (typeof input.selfArchived !== "boolean" || !Number.isSafeInteger(input.expectedRevision) || input.expectedRevision < 0) throw invalid$
|
|
22554
|
+
if (typeof input.selfArchived !== "boolean" || !Number.isSafeInteger(input.expectedRevision) || input.expectedRevision < 0) throw invalid$9();
|
|
22546
22555
|
const session = await this.runtime.requireSession();
|
|
22547
22556
|
const ref = await this.sources.openSourceRef(input.sourceRef, session.userId);
|
|
22548
22557
|
if (ref.kind !== "topic") throw new ArkmePluginError("archive-target-invalid", "仅支持个人主题归档", false, 400);
|
|
@@ -22556,7 +22565,7 @@ var ArchiveService = class {
|
|
|
22556
22565
|
self_status: input.selfArchived ? 2 : 1,
|
|
22557
22566
|
expected_revision: input.expectedRevision
|
|
22558
22567
|
}, session, signal, { trackWriteOutcome: true });
|
|
22559
|
-
if (data.entity_uid !== ref.ownerRef || data.self_status !== (input.selfArchived ? 2 : 1) || typeof data.state_changed !== "boolean" || !Number.isSafeInteger(data.effective_changed_count) || Number(data.effective_changed_count) < 0) throw invalid$
|
|
22568
|
+
if (data.entity_uid !== ref.ownerRef || data.self_status !== (input.selfArchived ? 2 : 1) || typeof data.state_changed !== "boolean" || !Number.isSafeInteger(data.effective_changed_count) || Number(data.effective_changed_count) < 0) throw invalid$9();
|
|
22560
22569
|
const state = await this.state(session, data, "");
|
|
22561
22570
|
await this.assertSession(session);
|
|
22562
22571
|
return {
|
|
@@ -22572,9 +22581,9 @@ var ArchiveService = class {
|
|
|
22572
22581
|
}
|
|
22573
22582
|
async state(session, value, title) {
|
|
22574
22583
|
const raw = objectValue$2(value);
|
|
22575
|
-
if (raw.entity_type !== 1 || typeof raw.entity_uid !== "string" || raw.entity_uid.trim() === "" || raw.self_status !== 1 && raw.self_status !== 2 || raw.effective_status !== 1 && raw.effective_status !== 2 || typeof raw.owner_available !== "boolean" || !Number.isSafeInteger(raw.revision) || Number(raw.revision) < 0 || !Number.isSafeInteger(raw.display_archive_at)) throw invalid$
|
|
22584
|
+
if (raw.entity_type !== 1 || typeof raw.entity_uid !== "string" || raw.entity_uid.trim() === "" || raw.self_status !== 1 && raw.self_status !== 2 || raw.effective_status !== 1 && raw.effective_status !== 2 || typeof raw.owner_available !== "boolean" || !Number.isSafeInteger(raw.revision) || Number(raw.revision) < 0 || !Number.isSafeInteger(raw.display_archive_at)) throw invalid$9();
|
|
22576
22585
|
const parent = raw.inherited_from === void 0 ? void 0 : objectValue$2(raw.inherited_from);
|
|
22577
|
-
if (parent !== void 0 && (parent.entity_type !== 1 || typeof parent.entity_uid !== "string" || parent.entity_uid === "")) throw invalid$
|
|
22586
|
+
if (parent !== void 0 && (parent.entity_type !== 1 || typeof parent.entity_uid !== "string" || parent.entity_uid === "")) throw invalid$9();
|
|
22578
22587
|
return {
|
|
22579
22588
|
entityType: "topic",
|
|
22580
22589
|
sourceRef: await this.sources.sealSourceRef(session.userId, "topic", raw.entity_uid, title),
|
|
@@ -22593,23 +22602,23 @@ var ArchiveService = class {
|
|
|
22593
22602
|
//#endregion
|
|
22594
22603
|
//#region src/record-deletion-ref.ts
|
|
22595
22604
|
const prefix$1 = "arkme-record-delete-v1";
|
|
22596
|
-
const invalid$
|
|
22605
|
+
const invalid$8 = () => new ArkmePluginError("record-delete-reference-invalid", "删除引用已失效,请刷新后重新选择", false, 409);
|
|
22597
22606
|
function sealRecordDeletionRef(ref, key) {
|
|
22598
22607
|
const payload = Buffer.from(JSON.stringify(ref)).toString("base64url");
|
|
22599
22608
|
return `${prefix$1}.${payload}.${createHmac("sha256", key).update(`${prefix$1}.${payload}`).digest("base64url")}`;
|
|
22600
22609
|
}
|
|
22601
22610
|
function openRecordDeletionRef(value, key) {
|
|
22602
|
-
if (typeof value !== "string" || value.length > 2048) throw invalid$
|
|
22611
|
+
if (typeof value !== "string" || value.length > 2048) throw invalid$8();
|
|
22603
22612
|
const [kind, payload, signature, extra] = value.split(".");
|
|
22604
|
-
if (kind !== prefix$1 || !payload || !signature || extra !== void 0) throw invalid$
|
|
22613
|
+
if (kind !== prefix$1 || !payload || !signature || extra !== void 0) throw invalid$8();
|
|
22605
22614
|
const actual = Buffer.from(signature, "base64url");
|
|
22606
22615
|
const expected = createHmac("sha256", key).update(`${prefix$1}.${payload}`).digest();
|
|
22607
|
-
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) throw invalid$
|
|
22616
|
+
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) throw invalid$8();
|
|
22608
22617
|
let ref;
|
|
22609
22618
|
try {
|
|
22610
22619
|
ref = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
22611
22620
|
} catch {
|
|
22612
|
-
throw invalid$
|
|
22621
|
+
throw invalid$8();
|
|
22613
22622
|
}
|
|
22614
22623
|
if (!ref || !Number.isSafeInteger(ref.userId) || ref.userId <= 0 || !Number.isSafeInteger(ref.recordVersion) || ref.recordVersion <= 0 || ![
|
|
22615
22624
|
"private_chat",
|
|
@@ -22617,7 +22626,7 @@ function openRecordDeletionRef(value, key) {
|
|
|
22617
22626
|
"send_to_self",
|
|
22618
22627
|
"default_category",
|
|
22619
22628
|
"topic"
|
|
22620
|
-
].includes(ref.sourceKind) || typeof ref.sourceOwnerRef !== "string" || !ref.sourceOwnerRef.trim() || typeof ref.recordUid !== "string" || !ref.recordUid.trim()) throw invalid$
|
|
22629
|
+
].includes(ref.sourceKind) || typeof ref.sourceOwnerRef !== "string" || !ref.sourceOwnerRef.trim() || typeof ref.recordUid !== "string" || !ref.recordUid.trim()) throw invalid$8();
|
|
22621
22630
|
return ref;
|
|
22622
22631
|
}
|
|
22623
22632
|
/** Only authoritative Record snapshots can grant deletion; missing versions never fall back to a relation version. */
|
|
@@ -22730,31 +22739,31 @@ var RecordDeletionService = class {
|
|
|
22730
22739
|
};
|
|
22731
22740
|
//#endregion
|
|
22732
22741
|
//#region src/record-topic-assignment-ref.ts
|
|
22733
|
-
const invalid$
|
|
22742
|
+
const invalid$7 = () => new ArkmePluginError("record-topic-reference-invalid", "快记归属引用已失效,请刷新后重新选择", false, 409);
|
|
22734
22743
|
const prefix = "arkme-record-topic-v1";
|
|
22735
22744
|
function sealRecordTopicAssignmentRef(reference, key) {
|
|
22736
22745
|
const payload = Buffer.from(JSON.stringify(reference)).toString("base64url");
|
|
22737
22746
|
return `${prefix}.${payload}.${createHmac("sha256", key).update(`${prefix}.${payload}`).digest("base64url")}`;
|
|
22738
22747
|
}
|
|
22739
22748
|
function openRecordTopicAssignmentRef(value, key) {
|
|
22740
|
-
if (typeof value !== "string" || value.length > 2048) throw invalid$
|
|
22749
|
+
if (typeof value !== "string" || value.length > 2048) throw invalid$7();
|
|
22741
22750
|
const parts = value.split(".");
|
|
22742
|
-
if (parts.length !== 3 || parts[0] !== prefix) throw invalid$
|
|
22751
|
+
if (parts.length !== 3 || parts[0] !== prefix) throw invalid$7();
|
|
22743
22752
|
const payload = parts[1];
|
|
22744
22753
|
const signature = Buffer.from(parts[2], "base64url");
|
|
22745
22754
|
const expected = createHmac("sha256", key).update(`${prefix}.${payload}`).digest();
|
|
22746
|
-
if (signature.length !== expected.length || !timingSafeEqual(signature, expected)) throw invalid$
|
|
22755
|
+
if (signature.length !== expected.length || !timingSafeEqual(signature, expected)) throw invalid$7();
|
|
22747
22756
|
let parsed;
|
|
22748
22757
|
try {
|
|
22749
22758
|
parsed = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
22750
22759
|
} catch {
|
|
22751
|
-
throw invalid$
|
|
22760
|
+
throw invalid$7();
|
|
22752
22761
|
}
|
|
22753
22762
|
if (!parsed || !Number.isSafeInteger(parsed.userId) || parsed.userId <= 0 || ![
|
|
22754
22763
|
"send_to_self",
|
|
22755
22764
|
"default_category",
|
|
22756
22765
|
"topic"
|
|
22757
|
-
].includes(parsed.sourceKind) || typeof parsed.sourceOwnerRef !== "string" || parsed.sourceOwnerRef.trim() === "" || typeof parsed.recordUid !== "string" || parsed.recordUid.trim() === "" || typeof parsed.sourceTopicUid !== "string") throw invalid$
|
|
22766
|
+
].includes(parsed.sourceKind) || typeof parsed.sourceOwnerRef !== "string" || parsed.sourceOwnerRef.trim() === "" || typeof parsed.recordUid !== "string" || parsed.recordUid.trim() === "" || typeof parsed.sourceTopicUid !== "string") throw invalid$7();
|
|
22758
22767
|
return parsed;
|
|
22759
22768
|
}
|
|
22760
22769
|
//#endregion
|
|
@@ -36840,6 +36849,11 @@ var AuthService = class {
|
|
|
36840
36849
|
runtime;
|
|
36841
36850
|
profile;
|
|
36842
36851
|
lifecycle;
|
|
36852
|
+
cancellationNotice;
|
|
36853
|
+
pendingCancellationLogin;
|
|
36854
|
+
pendingCancellationCleanup;
|
|
36855
|
+
cancellationTask;
|
|
36856
|
+
pendingPhoneUnbindSession;
|
|
36843
36857
|
attempts = /* @__PURE__ */ new Map();
|
|
36844
36858
|
jiwoAttemptGeneration = 0;
|
|
36845
36859
|
constructor(runtime, profile, lifecycle) {
|
|
@@ -36853,6 +36867,8 @@ var AuthService = class {
|
|
|
36853
36867
|
for (const [attemptId, attempt] of this.attempts) if (attempt.kind === "wechat") this.attempts.delete(attemptId);
|
|
36854
36868
|
}
|
|
36855
36869
|
async logout() {
|
|
36870
|
+
this.pendingCancellationLogin = void 0;
|
|
36871
|
+
this.pendingPhoneUnbindSession = void 0;
|
|
36856
36872
|
const activeSession = await this.runtime.sessionStore.read();
|
|
36857
36873
|
const pendingSession = await this.runtime.readPendingBindingSession();
|
|
36858
36874
|
const userIds = [...new Set([activeSession?.userId, pendingSession?.userId].filter((userId) => userId !== void 0))];
|
|
@@ -36874,7 +36890,24 @@ var AuthService = class {
|
|
|
36874
36890
|
};
|
|
36875
36891
|
}
|
|
36876
36892
|
async authStatus() {
|
|
36893
|
+
if (this.pendingCancellationLogin !== void 0) return this.cancellationLoginSnapshot();
|
|
36877
36894
|
const activeSession = await this.runtime.sessionStore.read();
|
|
36895
|
+
const completion = await this.runtime.stateStore.readCancellationCompletion?.();
|
|
36896
|
+
if (completion !== void 0) {
|
|
36897
|
+
if (activeSession === void 0) this.cancellationNotice = completion.result.status === "done" ? "done" : "waiting";
|
|
36898
|
+
else if (completion.userId === activeSession.userId && completion.sessionHash === this.cancellationSessionHash(activeSession)) {
|
|
36899
|
+
this.pendingCancellationCleanup = {
|
|
36900
|
+
session: activeSession,
|
|
36901
|
+
result: completion.result
|
|
36902
|
+
};
|
|
36903
|
+
await this.submitCancellation(activeSession.userId, completion.result.mode);
|
|
36904
|
+
return {
|
|
36905
|
+
status: "logged-out",
|
|
36906
|
+
environment: this.runtime.config.environment,
|
|
36907
|
+
cancellationNotice: completion.result.status === "done" ? "done" : "waiting"
|
|
36908
|
+
};
|
|
36909
|
+
}
|
|
36910
|
+
}
|
|
36878
36911
|
if (activeSession !== void 0) {
|
|
36879
36912
|
const cachedProfile = await this.runtime.stateStore.cachedProfile(activeSession.userId);
|
|
36880
36913
|
const snapshot = cachedProfile.profile === null ? await this.authSnapshotForSession(activeSession) : {
|
|
@@ -36892,7 +36925,8 @@ var AuthService = class {
|
|
|
36892
36925
|
const pendingSession = await this.runtime.readPendingBindingSession();
|
|
36893
36926
|
return pendingSession === void 0 ? {
|
|
36894
36927
|
status: "logged-out",
|
|
36895
|
-
environment: this.runtime.config.environment
|
|
36928
|
+
environment: this.runtime.config.environment,
|
|
36929
|
+
...this.cancellationNotice === void 0 ? {} : { cancellationNotice: this.cancellationNotice }
|
|
36896
36930
|
} : {
|
|
36897
36931
|
status: "binding-required",
|
|
36898
36932
|
environment: this.runtime.config.environment,
|
|
@@ -36900,6 +36934,7 @@ var AuthService = class {
|
|
|
36900
36934
|
};
|
|
36901
36935
|
}
|
|
36902
36936
|
async beginWechatLogin() {
|
|
36937
|
+
this.pendingCancellationLogin = void 0;
|
|
36903
36938
|
this.jiwoAttemptGeneration += 1;
|
|
36904
36939
|
await this.cancelAllJiwoLoginAttempts();
|
|
36905
36940
|
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/public/v1/auth/wechat-oauth-login-qrcode", {}, void 0, [200]);
|
|
@@ -36962,10 +36997,11 @@ var AuthService = class {
|
|
|
36962
36997
|
userId
|
|
36963
36998
|
};
|
|
36964
36999
|
this.attempts.delete(attemptId);
|
|
36965
|
-
return await this.acceptLoginSession(session);
|
|
37000
|
+
return await this.acceptLoginSession(session, numberValue$27(data.rest_days_cancel));
|
|
36966
37001
|
}
|
|
36967
37002
|
async beginJiwoLogin() {
|
|
36968
37003
|
if (!jiwoScanLoginAvailable(this.runtime.config)) throw new ArkmePluginError("jiwo-scan-login-disabled", "即我扫码登录当前未启用", false, 403);
|
|
37004
|
+
this.pendingCancellationLogin = void 0;
|
|
36969
37005
|
const attemptGeneration = ++this.jiwoAttemptGeneration;
|
|
36970
37006
|
await this.cancelAllJiwoLoginAttempts();
|
|
36971
37007
|
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/public/v1/auth/app-scan-login/start", {
|
|
@@ -37034,7 +37070,7 @@ var AuthService = class {
|
|
|
37034
37070
|
accessToken,
|
|
37035
37071
|
refreshToken,
|
|
37036
37072
|
userId
|
|
37037
|
-
});
|
|
37073
|
+
}, numberValue$27(data.rest_days_cancel));
|
|
37038
37074
|
}
|
|
37039
37075
|
async cancelJiwoLogin(attemptId) {
|
|
37040
37076
|
if (attemptId.trim() === "") return { canceled: true };
|
|
@@ -37072,6 +37108,7 @@ var AuthService = class {
|
|
|
37072
37108
|
async testLogin(userId) {
|
|
37073
37109
|
if (this.runtime.config.environment !== "test") throw new ArkmePluginError("test-login-disabled", "测试账号登录仅允许测试环境使用", false, 403);
|
|
37074
37110
|
if (!Number.isSafeInteger(userId) || userId <= 0) throw new ArkmePluginError("test-user-id-invalid", "请输入有效的测试账号 user_id", false);
|
|
37111
|
+
this.pendingCancellationLogin = void 0;
|
|
37075
37112
|
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/public/v1/auth/the-best-api-for-testing", {
|
|
37076
37113
|
user_id: userId,
|
|
37077
37114
|
unique_code: await this.runtime.stateStore.uniqueCode(),
|
|
@@ -37087,7 +37124,30 @@ var AuthService = class {
|
|
|
37087
37124
|
userId
|
|
37088
37125
|
};
|
|
37089
37126
|
this.attempts.clear();
|
|
37090
|
-
return await this.acceptLoginSession(session);
|
|
37127
|
+
return await this.acceptLoginSession(session, numberValue$27(data.rest_days_cancel));
|
|
37128
|
+
}
|
|
37129
|
+
async emailBindingRequest(expectedUserId, email, code) {
|
|
37130
|
+
const session = await this.runtime.requireSession();
|
|
37131
|
+
if (session.userId !== expectedUserId) throw new ArkmePluginError("email-session-changed", "账号已切换,请重新打开账号设置", false);
|
|
37132
|
+
const normalizedEmail = email.trim();
|
|
37133
|
+
if (normalizedEmail.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) throw new ArkmePluginError("email-invalid", "请输入有效的邮箱地址", false);
|
|
37134
|
+
if (code !== void 0 && !/^[0-9]{4}$/.test(code.trim())) throw new ArkmePluginError("email-code-invalid", "请输入4位邮箱验证码", false);
|
|
37135
|
+
const data = await this.runtime.post(this.runtime.config.authBaseUrl, code === void 0 ? "/api/v1/auth/email-bind-send-code" : "/api/v1/auth/email-bind", {
|
|
37136
|
+
email: normalizedEmail,
|
|
37137
|
+
...code === void 0 ? {} : { code: code.trim() }
|
|
37138
|
+
}, session.accessToken, [200]);
|
|
37139
|
+
const current = await this.runtime.requireSession();
|
|
37140
|
+
if (current.userId !== session.userId || current.refreshToken !== session.refreshToken) throw new ArkmePluginError("email-session-changed", "账号已切换,请重新打开账号设置", false);
|
|
37141
|
+
if (data.result !== 1) throw new ArkmePluginError("email-bind-rejected", data.result === 2 ? "该邮箱已绑定其他账号" : data.result === 3 ? "当前账号已绑定邮箱,请刷新账号信息" : code !== void 0 && data.result === 4 ? "邮箱或验证码错误" : "邮箱绑定响应异常,请重试", false);
|
|
37142
|
+
if (code !== void 0) this.profile.invalidate(session.userId);
|
|
37143
|
+
}
|
|
37144
|
+
async sendEmailBindCode(expectedUserId, email) {
|
|
37145
|
+
await this.emailBindingRequest(expectedUserId, email);
|
|
37146
|
+
return { sent: true };
|
|
37147
|
+
}
|
|
37148
|
+
async bindEmail(expectedUserId, email, code) {
|
|
37149
|
+
await this.emailBindingRequest(expectedUserId, email, code);
|
|
37150
|
+
return { bound: true };
|
|
37091
37151
|
}
|
|
37092
37152
|
async sendPhoneCode(phone, captcha) {
|
|
37093
37153
|
const normalizedPhone = this.normalizedPhone(phone);
|
|
@@ -37114,6 +37174,7 @@ var AuthService = class {
|
|
|
37114
37174
|
const normalizedPhone = this.normalizedPhone(phone);
|
|
37115
37175
|
const normalizedCode = code.trim();
|
|
37116
37176
|
if (!/^[0-9]{6}$/.test(normalizedCode)) throw new ArkmePluginError("phone-code-invalid", "请输入有效的短信验证码", false);
|
|
37177
|
+
this.pendingCancellationLogin = void 0;
|
|
37117
37178
|
const session = await this.runtime.sessionStore.read() ?? await this.runtime.readPendingBindingSession();
|
|
37118
37179
|
if (session !== void 0) {
|
|
37119
37180
|
const result = numberValue$27((await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/verify-bind-phone", {
|
|
@@ -37147,7 +37208,89 @@ var AuthService = class {
|
|
|
37147
37208
|
userId
|
|
37148
37209
|
};
|
|
37149
37210
|
this.attempts.clear();
|
|
37150
|
-
return await this.acceptLoginSession(sessionAfterPhoneLogin);
|
|
37211
|
+
return await this.acceptLoginSession(sessionAfterPhoneLogin, numberValue$27(data.rest_days_cancel));
|
|
37212
|
+
}
|
|
37213
|
+
async checkPhoneUnbindEligibility(expectedUserId) {
|
|
37214
|
+
const session = await this.runtime.requireSession();
|
|
37215
|
+
if (session.userId !== expectedUserId) throw new ArkmePluginError("phone-unbind-session-changed", "账号已切换,请重新打开账号设置", false);
|
|
37216
|
+
const data = await this.runtime.authenticatedAuthGet("/api/v1/auth/get-user-info?include_phone_unbind_eligibility=true", session, void 0, {
|
|
37217
|
+
lane: "auth",
|
|
37218
|
+
bypassCache: true
|
|
37219
|
+
});
|
|
37220
|
+
const current = await this.runtime.requireSession();
|
|
37221
|
+
if (current.userId !== session.userId || current.refreshToken !== session.refreshToken || data.user_id !== session.userId || typeof data.can_unbind_phone !== "boolean") throw new ArkmePluginError("phone-unbind-eligibility-unknown", "账号状态未确认,请重新打开账号设置", true);
|
|
37222
|
+
return { allowed: data.can_unbind_phone };
|
|
37223
|
+
}
|
|
37224
|
+
async sendPhoneUnbindCode(captcha) {
|
|
37225
|
+
const session = await this.runtime.requireSession();
|
|
37226
|
+
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/phone-unbind-send-code", { ...this.normalizedCaptcha(captcha) }, session.accessToken, [200]);
|
|
37227
|
+
this.checkPhoneUnbindResult(numberValue$27(data.result), true);
|
|
37228
|
+
return { sent: true };
|
|
37229
|
+
}
|
|
37230
|
+
async unbindPhone(code) {
|
|
37231
|
+
let session;
|
|
37232
|
+
try {
|
|
37233
|
+
session = await this.runtime.requireSession();
|
|
37234
|
+
} catch (error) {
|
|
37235
|
+
if (!(error instanceof ArkmePluginError) || error.code !== "login-required") throw error;
|
|
37236
|
+
const pending = await this.runtime.readPendingBindingSession();
|
|
37237
|
+
if (pending === void 0 || await this.runtime.sessionStore.read() !== void 0) throw error;
|
|
37238
|
+
return {
|
|
37239
|
+
status: "binding-required",
|
|
37240
|
+
environment: this.runtime.config.environment,
|
|
37241
|
+
userId: pending.userId
|
|
37242
|
+
};
|
|
37243
|
+
}
|
|
37244
|
+
if (!/^[0-9]{6}$/.test(code.trim())) throw new ArkmePluginError("phone-code-invalid", "请输入有效的短信验证码", false);
|
|
37245
|
+
if (this.pendingPhoneUnbindSession?.userId === session.userId && this.pendingPhoneUnbindSession.refreshToken === session.refreshToken) return await this.reconcilePhoneUnbind(session);
|
|
37246
|
+
try {
|
|
37247
|
+
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/phone-unbind", { code: code.trim() }, session.accessToken, [200], void 0, false, this.runtime.authenticatedRequestOptions(session, "auth", "write", { trackWriteOutcome: true }));
|
|
37248
|
+
if (numberValue$27(data.result) !== 1) this.checkPhoneUnbindResult(numberValue$27(data.result), false);
|
|
37249
|
+
this.pendingPhoneUnbindSession = session;
|
|
37250
|
+
} catch (error) {
|
|
37251
|
+
if (!(error instanceof ArkmePluginError) || !(error.writeOutcomeUnknown === true || [
|
|
37252
|
+
"arkme-network-error",
|
|
37253
|
+
"arkme-timeout",
|
|
37254
|
+
"arkme-response-invalid"
|
|
37255
|
+
].includes(error.code))) throw error;
|
|
37256
|
+
this.pendingPhoneUnbindSession = session;
|
|
37257
|
+
}
|
|
37258
|
+
return await this.reconcilePhoneUnbind(session);
|
|
37259
|
+
}
|
|
37260
|
+
async reconcilePhoneUnbind(session) {
|
|
37261
|
+
this.runtime.invalidateScope(this.runtime.requestScope(session.userId));
|
|
37262
|
+
this.profile.invalidate(session.userId);
|
|
37263
|
+
let phone;
|
|
37264
|
+
try {
|
|
37265
|
+
const data = await this.runtime.authenticatedAuthGet("/api/v1/auth/get-user-info", session, void 0, {
|
|
37266
|
+
lane: "auth",
|
|
37267
|
+
bypassCache: true
|
|
37268
|
+
});
|
|
37269
|
+
const current = await this.runtime.requireSession();
|
|
37270
|
+
if (data.user_id !== session.userId || typeof data.phone !== "string" || current.userId !== session.userId || current.refreshToken !== session.refreshToken) throw new Error("binding fact unavailable");
|
|
37271
|
+
phone = data.phone;
|
|
37272
|
+
} catch (error) {
|
|
37273
|
+
throw new ArkmePluginError("phone-unbind-outcome-unknown", "解绑状态尚未确认,请重试以刷新状态", true, 502, { cause: error });
|
|
37274
|
+
}
|
|
37275
|
+
if (phone.trim() !== "") {
|
|
37276
|
+
this.pendingPhoneUnbindSession = void 0;
|
|
37277
|
+
throw new ArkmePluginError("phone-unbind-not-completed", "手机号仍处于绑定状态,请重新获取验证码", false);
|
|
37278
|
+
}
|
|
37279
|
+
if (!await this.runtime.moveSessionToPendingBinding(session)) {
|
|
37280
|
+
this.pendingPhoneUnbindSession = void 0;
|
|
37281
|
+
throw new ArkmePluginError("phone-unbind-session-changed", "账号已切换,请重新打开账号设置", false);
|
|
37282
|
+
}
|
|
37283
|
+
this.lifecycle.reconnectChatRealtime();
|
|
37284
|
+
this.pendingPhoneUnbindSession = void 0;
|
|
37285
|
+
return {
|
|
37286
|
+
status: "binding-required",
|
|
37287
|
+
environment: this.runtime.config.environment,
|
|
37288
|
+
userId: session.userId
|
|
37289
|
+
};
|
|
37290
|
+
}
|
|
37291
|
+
checkPhoneUnbindResult(result, sending) {
|
|
37292
|
+
if (result === 2) return;
|
|
37293
|
+
throw new ArkmePluginError("phone-unbind-rejected", result === 1 ? "当前没有绑定手机号" : result === 3 ? "当前仅绑定了手机号,请先绑定其他登录方式" : result === 4 ? sending ? "当前号码暂不支持短信验证" : "验证码错误或已过期,请重新获取" : "手机号解绑失败,请稍后重试", false);
|
|
37151
37294
|
}
|
|
37152
37295
|
async authSnapshotForSession(session, options = {}) {
|
|
37153
37296
|
const profile = options.forceProfile === true ? await this.profile.refreshProfileForSession(session) : await this.profile.profileForSession(session);
|
|
@@ -37160,21 +37303,144 @@ var AuthService = class {
|
|
|
37160
37303
|
profileHasBoundPhone(snapshot) {
|
|
37161
37304
|
return (snapshot.profile?.contact.phoneMasked?.trim() ?? "") !== "";
|
|
37162
37305
|
}
|
|
37163
|
-
async acceptLoginSession(session) {
|
|
37306
|
+
async acceptLoginSession(session, restDaysCancel = 0, assertCurrent) {
|
|
37307
|
+
if (assertCurrent === void 0) this.pendingCancellationLogin = void 0;
|
|
37308
|
+
if (restDaysCancel > 0) {
|
|
37309
|
+
this.pendingCancellationLogin = {
|
|
37310
|
+
session,
|
|
37311
|
+
days: restDaysCancel
|
|
37312
|
+
};
|
|
37313
|
+
return this.cancellationLoginSnapshot();
|
|
37314
|
+
}
|
|
37315
|
+
await this.runtime.stateStore.writeCancellationCompletion?.(void 0);
|
|
37316
|
+
this.cancellationNotice = void 0;
|
|
37164
37317
|
this.runtime.invalidateScope(this.runtime.requestScope(session.userId));
|
|
37165
37318
|
this.profile.invalidate(session.userId);
|
|
37166
37319
|
const snapshot = await this.authSnapshotForSession(session, { forceProfile: true });
|
|
37320
|
+
assertCurrent?.();
|
|
37167
37321
|
if (snapshot.status === "authenticated") {
|
|
37168
37322
|
await this.runtime.clearPendingBindingSession();
|
|
37323
|
+
assertCurrent?.();
|
|
37169
37324
|
await this.runtime.writeSession(session);
|
|
37325
|
+
assertCurrent?.();
|
|
37170
37326
|
this.lifecycle.reconnectChatRealtime();
|
|
37171
37327
|
return snapshot;
|
|
37172
37328
|
}
|
|
37173
37329
|
await this.runtime.writePendingBindingSession(session);
|
|
37330
|
+
assertCurrent?.();
|
|
37174
37331
|
await this.runtime.deleteSession();
|
|
37332
|
+
assertCurrent?.();
|
|
37175
37333
|
this.lifecycle.reconnectChatRealtime();
|
|
37176
37334
|
return snapshot;
|
|
37177
37335
|
}
|
|
37336
|
+
cancellationLoginSnapshot() {
|
|
37337
|
+
return {
|
|
37338
|
+
status: "cancellation-pending",
|
|
37339
|
+
environment: this.runtime.config.environment,
|
|
37340
|
+
restDaysCancel: this.pendingCancellationLogin.days
|
|
37341
|
+
};
|
|
37342
|
+
}
|
|
37343
|
+
async resolveCancellationLogin(continueLogin) {
|
|
37344
|
+
const pending = this.pendingCancellationLogin;
|
|
37345
|
+
if (pending === void 0) throw new ArkmePluginError("cancellation-login-expired", "登录确认已失效,请重新登录", false);
|
|
37346
|
+
if (!continueLogin) {
|
|
37347
|
+
this.pendingCancellationLogin = void 0;
|
|
37348
|
+
return {
|
|
37349
|
+
status: "logged-out",
|
|
37350
|
+
environment: this.runtime.config.environment
|
|
37351
|
+
};
|
|
37352
|
+
}
|
|
37353
|
+
await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/abort-cancel", {}, pending.session.accessToken, [200]);
|
|
37354
|
+
if (this.pendingCancellationLogin !== pending) throw new ArkmePluginError("cancellation-login-expired", "登录确认已失效,请重新登录", false);
|
|
37355
|
+
const snapshot = await this.acceptLoginSession(pending.session, 0, () => {
|
|
37356
|
+
if (this.pendingCancellationLogin !== pending) throw new ArkmePluginError("cancellation-login-expired", "登录确认已失效,请重新登录", false);
|
|
37357
|
+
});
|
|
37358
|
+
if (this.pendingCancellationLogin === pending) this.pendingCancellationLogin = void 0;
|
|
37359
|
+
return snapshot;
|
|
37360
|
+
}
|
|
37361
|
+
async cancellationSession(expectedUserId) {
|
|
37362
|
+
const session = await this.runtime.requireSession();
|
|
37363
|
+
if (session.userId !== expectedUserId) throw new ArkmePluginError("cancellation-session-changed", "账号已切换,请重新打开账号设置", false);
|
|
37364
|
+
return session;
|
|
37365
|
+
}
|
|
37366
|
+
cancellationResult(data) {
|
|
37367
|
+
if (!data || !["immediate", "waiting"].includes(data.mode) || ![
|
|
37368
|
+
"eligible",
|
|
37369
|
+
"waiting",
|
|
37370
|
+
"done"
|
|
37371
|
+
].includes(data.status) || !Number.isSafeInteger(data.cancel_at) || data.cancel_at < 0 || typeof data.has_phone !== "boolean") throw new ArkmePluginError("cancellation-contract-invalid", "注销状态未确认,请稍后重试", true, 502);
|
|
37372
|
+
return data;
|
|
37373
|
+
}
|
|
37374
|
+
async previewCancellation(expectedUserId) {
|
|
37375
|
+
const session = await this.cancellationSession(expectedUserId);
|
|
37376
|
+
const data = await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/cancellation/preview", {}, session.accessToken, [200]);
|
|
37377
|
+
if ((await this.cancellationSession(expectedUserId)).refreshToken !== session.refreshToken) throw new ArkmePluginError("cancellation-session-changed", "登录状态已变化,请重试", false);
|
|
37378
|
+
return this.cancellationResult(data);
|
|
37379
|
+
}
|
|
37380
|
+
async submitCancellation(expectedUserId, expectedMode) {
|
|
37381
|
+
if (expectedMode !== "immediate" && expectedMode !== "waiting") throw new ArkmePluginError("cancellation-mode-invalid", "请重新确认注销方式", false);
|
|
37382
|
+
if (this.cancellationTask !== void 0) throw new ArkmePluginError("cancellation-busy", "正在处理注销,请稍候", true);
|
|
37383
|
+
const task = this.performCancellation(expectedUserId, expectedMode);
|
|
37384
|
+
this.cancellationTask = task;
|
|
37385
|
+
try {
|
|
37386
|
+
return await task;
|
|
37387
|
+
} finally {
|
|
37388
|
+
if (this.cancellationTask === task) this.cancellationTask = void 0;
|
|
37389
|
+
}
|
|
37390
|
+
}
|
|
37391
|
+
async performCancellation(expectedUserId, expectedMode) {
|
|
37392
|
+
let cleanup = this.pendingCancellationCleanup;
|
|
37393
|
+
if (cleanup === void 0) {
|
|
37394
|
+
const completion = await this.runtime.stateStore.readCancellationCompletion?.();
|
|
37395
|
+
const active = await this.runtime.sessionStore.read();
|
|
37396
|
+
if (completion?.userId === expectedUserId && active === void 0) return completion.result;
|
|
37397
|
+
if (completion?.userId === expectedUserId && active !== void 0 && completion.sessionHash === this.cancellationSessionHash(active)) {
|
|
37398
|
+
cleanup = {
|
|
37399
|
+
session: active,
|
|
37400
|
+
result: completion.result
|
|
37401
|
+
};
|
|
37402
|
+
this.pendingCancellationCleanup = cleanup;
|
|
37403
|
+
}
|
|
37404
|
+
}
|
|
37405
|
+
if (cleanup === void 0 || cleanup.session.userId !== expectedUserId) {
|
|
37406
|
+
const session = await this.cancellationSession(expectedUserId);
|
|
37407
|
+
const result = this.cancellationResult(await this.runtime.post(this.runtime.config.authBaseUrl, "/api/v1/auth/cancellation/submit", { expected_mode: expectedMode }, session.accessToken, [200], void 0, false, this.runtime.authenticatedRequestOptions(session, "auth", "write", { trackWriteOutcome: true })));
|
|
37408
|
+
if (result.changed === true && result.status === "eligible") return result;
|
|
37409
|
+
if (result.status !== "done" && result.status !== "waiting") throw new ArkmePluginError("cancellation-contract-invalid", "注销状态未确认,请稍后重试", true);
|
|
37410
|
+
cleanup = {
|
|
37411
|
+
session,
|
|
37412
|
+
result
|
|
37413
|
+
};
|
|
37414
|
+
this.pendingCancellationCleanup = cleanup;
|
|
37415
|
+
}
|
|
37416
|
+
const current = await this.runtime.sessionStore.read();
|
|
37417
|
+
if (current !== void 0 && (current.userId !== cleanup.session.userId || current.refreshToken !== cleanup.session.refreshToken)) {
|
|
37418
|
+
await this.runtime.stateStore.writeCancellationCompletion?.(void 0);
|
|
37419
|
+
this.pendingCancellationCleanup = void 0;
|
|
37420
|
+
throw new ArkmePluginError("cancellation-session-changed", "账号已切换,原账号注销已处理", false);
|
|
37421
|
+
}
|
|
37422
|
+
await this.runtime.stateStore.writeCancellationCompletion?.({
|
|
37423
|
+
userId: cleanup.session.userId,
|
|
37424
|
+
sessionHash: this.cancellationSessionHash(cleanup.session),
|
|
37425
|
+
result: cleanup.result
|
|
37426
|
+
});
|
|
37427
|
+
this.runtime.invalidateScope(this.runtime.requestScope(cleanup.session.userId));
|
|
37428
|
+
this.runtime.clearRefreshForUser(cleanup.session.userId);
|
|
37429
|
+
if (!await this.runtime.deleteSessionIfCurrent(cleanup.session) && await this.runtime.sessionStore.read() !== void 0) {
|
|
37430
|
+
await this.runtime.stateStore.writeCancellationCompletion?.(void 0);
|
|
37431
|
+
this.pendingCancellationCleanup = void 0;
|
|
37432
|
+
throw new ArkmePluginError("cancellation-session-changed", "账号已切换,原账号注销已处理", false);
|
|
37433
|
+
}
|
|
37434
|
+
this.profile.invalidate(cleanup.session.userId);
|
|
37435
|
+
this.lifecycle.clearAccountState([cleanup.session.userId]);
|
|
37436
|
+
this.lifecycle.reconnectChatRealtime();
|
|
37437
|
+
this.cancellationNotice = cleanup.result.status === "done" ? "done" : "waiting";
|
|
37438
|
+
this.pendingCancellationCleanup = void 0;
|
|
37439
|
+
return cleanup.result;
|
|
37440
|
+
}
|
|
37441
|
+
cancellationSessionHash(session) {
|
|
37442
|
+
return createHash("sha256").update(session.refreshToken).digest("hex");
|
|
37443
|
+
}
|
|
37178
37444
|
normalizedPhone(phone) {
|
|
37179
37445
|
const normalized = phone.replace(/[\s-]/g, "");
|
|
37180
37446
|
if (!/^1[3-9][0-9]{9}$/.test(normalized)) throw new ArkmePluginError("phone-invalid", "请输入有效的中国大陆手机号", false);
|
|
@@ -37231,23 +37497,23 @@ var BackgroundSoundMembershipService = class {
|
|
|
37231
37497
|
};
|
|
37232
37498
|
//#endregion
|
|
37233
37499
|
//#region src/services/membership-service.ts
|
|
37234
|
-
function invalid$
|
|
37500
|
+
function invalid$6() {
|
|
37235
37501
|
throw new ArkmePluginError("membership-contract-invalid", "会员信息暂时无法确认,请稍后重试", true, 502);
|
|
37236
37502
|
}
|
|
37237
37503
|
function integer$3(value) {
|
|
37238
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) return invalid$
|
|
37504
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) return invalid$6();
|
|
37239
37505
|
return value;
|
|
37240
37506
|
}
|
|
37241
37507
|
function timestamp(value) {
|
|
37242
37508
|
if (value === void 0 || value === null || value === 0) return null;
|
|
37243
37509
|
const micros = integer$3(value);
|
|
37244
37510
|
const millis = Math.floor(micros / 1e3);
|
|
37245
|
-
if (millis < Date.UTC(2e3, 0) || millis > Date.UTC(3e3, 0)) return invalid$
|
|
37511
|
+
if (millis < Date.UTC(2e3, 0) || millis > Date.UTC(3e3, 0)) return invalid$6();
|
|
37246
37512
|
return millis;
|
|
37247
37513
|
}
|
|
37248
37514
|
function parseMembership(raw, userId, now = Date.now()) {
|
|
37249
37515
|
const memberType = integer$3(raw.member_type);
|
|
37250
|
-
if (memberType > 2) return invalid$
|
|
37516
|
+
if (memberType > 2) return invalid$6();
|
|
37251
37517
|
const expireAtMillis = timestamp(raw.expire_at);
|
|
37252
37518
|
return {
|
|
37253
37519
|
userId,
|
|
@@ -37258,16 +37524,16 @@ function parseMembership(raw, userId, now = Date.now()) {
|
|
|
37258
37524
|
};
|
|
37259
37525
|
}
|
|
37260
37526
|
function parseMembershipProducts(raw) {
|
|
37261
|
-
if (!Array.isArray(raw.data_ls)) return invalid$
|
|
37527
|
+
if (!Array.isArray(raw.data_ls)) return invalid$6();
|
|
37262
37528
|
const products = raw.data_ls.map((entry) => {
|
|
37263
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return invalid$
|
|
37529
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return invalid$6();
|
|
37264
37530
|
const row = entry;
|
|
37265
37531
|
const memberType = integer$3(row.spu_code);
|
|
37266
|
-
if (memberType !== 1 && memberType !== 2) return invalid$
|
|
37267
|
-
if (typeof row.name !== "string" || !row.name.trim() || typeof row.is_period !== "boolean") return invalid$
|
|
37532
|
+
if (memberType !== 1 && memberType !== 2) return invalid$6();
|
|
37533
|
+
if (typeof row.name !== "string" || !row.name.trim() || typeof row.is_period !== "boolean") return invalid$6();
|
|
37268
37534
|
const alipayId = integer$3(row.alipay_product_id);
|
|
37269
37535
|
const wechatId = integer$3(row.wechat_product_id);
|
|
37270
|
-
if (alipayId === 0 && wechatId === 0) return invalid$
|
|
37536
|
+
if (alipayId === 0 && wechatId === 0) return invalid$6();
|
|
37271
37537
|
return {
|
|
37272
37538
|
id: `${memberType}:${alipayId}:${wechatId}:${row.is_period ? "recurring" : "once"}`,
|
|
37273
37539
|
memberType,
|
|
@@ -37278,7 +37544,7 @@ function parseMembershipProducts(raw) {
|
|
|
37278
37544
|
monthCount: integer$3(row.month_count)
|
|
37279
37545
|
};
|
|
37280
37546
|
});
|
|
37281
|
-
if (new Set(products.map((p) => p.id)).size !== products.length) return invalid$
|
|
37547
|
+
if (new Set(products.map((p) => p.id)).size !== products.length) return invalid$6();
|
|
37282
37548
|
return products.sort((a, b) => a.memberType - b.memberType || a.monthCount - b.monthCount || a.priceMinor - b.priceMinor);
|
|
37283
37549
|
}
|
|
37284
37550
|
/** Membership is distinct from managed-AI balance billing. Only read endpoints are exposed. */
|
|
@@ -37294,7 +37560,7 @@ var MembershipService = class {
|
|
|
37294
37560
|
return parseMembership(raw, userId);
|
|
37295
37561
|
}
|
|
37296
37562
|
async catalog(expectedUserId) {
|
|
37297
|
-
if (!Number.isSafeInteger(expectedUserId) || expectedUserId <= 0) return invalid$
|
|
37563
|
+
if (!Number.isSafeInteger(expectedUserId) || expectedUserId <= 0) return invalid$6();
|
|
37298
37564
|
const session = await this.runtime.requireSession();
|
|
37299
37565
|
if (session.userId !== expectedUserId) throw new ArkmePluginError("membership-account-changed", "账号已切换,请重新打开会员页面", false, 409);
|
|
37300
37566
|
const raw = await this.runtime.authenticatedAuthReadPost("/api/v1/payment/get/sale-product", {}, session);
|
|
@@ -37409,19 +37675,19 @@ var AccountUsageService = class {
|
|
|
37409
37675
|
//#endregion
|
|
37410
37676
|
//#region src/services/account-usage-details-service.ts
|
|
37411
37677
|
const monthPattern = /^\d{4}-(0[1-9]|1[0-2])$/;
|
|
37412
|
-
function invalid$
|
|
37678
|
+
function invalid$5() {
|
|
37413
37679
|
return new ArkmePluginError("account-usage-details-invalid", "用量明细暂时无法确认,请重试", true, 502);
|
|
37414
37680
|
}
|
|
37415
37681
|
function object$5(value) {
|
|
37416
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid$
|
|
37682
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid$5();
|
|
37417
37683
|
return value;
|
|
37418
37684
|
}
|
|
37419
37685
|
function count(value) {
|
|
37420
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw invalid$
|
|
37686
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw invalid$5();
|
|
37421
37687
|
return value;
|
|
37422
37688
|
}
|
|
37423
37689
|
function text$4(value, max = 16384) {
|
|
37424
|
-
if (typeof value !== "string" || value.length > max) throw invalid$
|
|
37690
|
+
if (typeof value !== "string" || value.length > max) throw invalid$5();
|
|
37425
37691
|
return value;
|
|
37426
37692
|
}
|
|
37427
37693
|
function tokens(value) {
|
|
@@ -37450,17 +37716,17 @@ function status(value) {
|
|
|
37450
37716
|
}
|
|
37451
37717
|
function parseTokenSummary(value, accountScope) {
|
|
37452
37718
|
const raw = object$5(value), monthKey = text$4(raw.month_key, 7);
|
|
37453
|
-
if (!monthPattern.test(monthKey) || !Array.isArray(raw.available_months)) throw invalid$
|
|
37719
|
+
if (!monthPattern.test(monthKey) || !Array.isArray(raw.available_months)) throw invalid$5();
|
|
37454
37720
|
const availableMonths = [...new Set(raw.available_months.map((value) => {
|
|
37455
37721
|
const month = text$4(value, 7);
|
|
37456
|
-
if (!monthPattern.test(month)) throw invalid$
|
|
37722
|
+
if (!monthPattern.test(month)) throw invalid$5();
|
|
37457
37723
|
return month;
|
|
37458
37724
|
}))].sort().reverse();
|
|
37459
37725
|
const timezone = text$4(raw.timezone, 100);
|
|
37460
37726
|
try {
|
|
37461
37727
|
new Intl.DateTimeFormat("en", { timeZone: timezone });
|
|
37462
37728
|
} catch {
|
|
37463
|
-
throw invalid$
|
|
37729
|
+
throw invalid$5();
|
|
37464
37730
|
}
|
|
37465
37731
|
return {
|
|
37466
37732
|
accountScope,
|
|
@@ -37477,7 +37743,7 @@ function parseTokenSummary(value, accountScope) {
|
|
|
37477
37743
|
}
|
|
37478
37744
|
function parseTokenPage(value, accountScope, kind) {
|
|
37479
37745
|
const raw = object$5(value);
|
|
37480
|
-
if (!Array.isArray(raw.items) || raw.items.length > 100) throw invalid$
|
|
37746
|
+
if (!Array.isArray(raw.items) || raw.items.length > 100) throw invalid$5();
|
|
37481
37747
|
return {
|
|
37482
37748
|
accountScope,
|
|
37483
37749
|
items: raw.items.map((value) => {
|
|
@@ -37493,7 +37759,7 @@ function parseTokenPage(value, accountScope, kind) {
|
|
|
37493
37759
|
usageStatus: status(item.usage_status)
|
|
37494
37760
|
};
|
|
37495
37761
|
const operationUid = text$4(item.operation_uid, 256), displayName = text$4(item.display_name, 2048);
|
|
37496
|
-
if (!operationUid.trim() || !displayName.trim() || !Array.isArray(item.models)) throw invalid$
|
|
37762
|
+
if (!operationUid.trim() || !displayName.trim() || !Array.isArray(item.models)) throw invalid$5();
|
|
37497
37763
|
return {
|
|
37498
37764
|
...common,
|
|
37499
37765
|
operationUid,
|
|
@@ -37520,11 +37786,11 @@ var AccountUsageDetailsService = class {
|
|
|
37520
37786
|
async read(scope, kind, query, signal) {
|
|
37521
37787
|
const session = await this.session(scope);
|
|
37522
37788
|
const month = text$4(query.monthKey, 7), timezone = text$4(query.timezone, 100) || "Asia/Shanghai";
|
|
37523
|
-
if (month && !monthPattern.test(month)) throw invalid$
|
|
37789
|
+
if (month && !monthPattern.test(month)) throw invalid$5();
|
|
37524
37790
|
try {
|
|
37525
37791
|
new Intl.DateTimeFormat("en", { timeZone: timezone });
|
|
37526
37792
|
} catch {
|
|
37527
|
-
throw invalid$
|
|
37793
|
+
throw invalid$5();
|
|
37528
37794
|
}
|
|
37529
37795
|
const body = {
|
|
37530
37796
|
month_key: month,
|
|
@@ -37536,7 +37802,7 @@ var AccountUsageDetailsService = class {
|
|
|
37536
37802
|
}
|
|
37537
37803
|
if (kind === "calls") {
|
|
37538
37804
|
const uid = text$4(query.operationUid, 256), biz = count(query.bizCode);
|
|
37539
|
-
if (!uid.trim() || biz > 32767) throw invalid$
|
|
37805
|
+
if (!uid.trim() || biz > 32767) throw invalid$5();
|
|
37540
37806
|
body.operation_uid = uid;
|
|
37541
37807
|
body.biz_code = biz;
|
|
37542
37808
|
}
|
|
@@ -37546,7 +37812,7 @@ var AccountUsageDetailsService = class {
|
|
|
37546
37812
|
}
|
|
37547
37813
|
async summary(scope, query, signal) {
|
|
37548
37814
|
const result = parseTokenSummary(await this.read(scope, "summary", query, signal), scope);
|
|
37549
|
-
if (query.monthKey && result.monthKey !== query.monthKey) throw invalid$
|
|
37815
|
+
if (query.monthKey && result.monthKey !== query.monthKey) throw invalid$5();
|
|
37550
37816
|
return result;
|
|
37551
37817
|
}
|
|
37552
37818
|
async operations(scope, query, signal) {
|
|
@@ -37559,17 +37825,17 @@ var AccountUsageDetailsService = class {
|
|
|
37559
37825
|
//#endregion
|
|
37560
37826
|
//#region src/services/data-management-service.ts
|
|
37561
37827
|
function object$4(value) {
|
|
37562
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid$
|
|
37828
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid$4();
|
|
37563
37829
|
return value;
|
|
37564
37830
|
}
|
|
37565
|
-
function invalid$
|
|
37831
|
+
function invalid$4() {
|
|
37566
37832
|
return new ArkmePluginError("data-management-contract-invalid", "数据格式暂时无法确认,请重试", true, 502);
|
|
37567
37833
|
}
|
|
37568
37834
|
function text$3(value) {
|
|
37569
37835
|
return typeof value === "string" ? value : "";
|
|
37570
37836
|
}
|
|
37571
37837
|
function integer$1(value) {
|
|
37572
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw invalid$
|
|
37838
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw invalid$4();
|
|
37573
37839
|
return value;
|
|
37574
37840
|
}
|
|
37575
37841
|
const DELETED_RETENTION_MILLIS = 720 * 60 * 60 * 1e3;
|
|
@@ -37592,7 +37858,7 @@ function lifecycle(value) {
|
|
|
37592
37858
|
function parseDeletedRecords(raw, accountScope, nowMillis = Date.now()) {
|
|
37593
37859
|
const envelope = object$4(raw);
|
|
37594
37860
|
const rows = envelope.items ?? envelope.records ?? envelope.list ?? envelope.data;
|
|
37595
|
-
if (!Array.isArray(rows)) throw invalid$
|
|
37861
|
+
if (!Array.isArray(rows)) throw invalid$4();
|
|
37596
37862
|
let unverifiedCount = 0;
|
|
37597
37863
|
return {
|
|
37598
37864
|
accountScope,
|
|
@@ -37600,7 +37866,7 @@ function parseDeletedRecords(raw, accountScope, nowMillis = Date.now()) {
|
|
|
37600
37866
|
const row = object$4(value);
|
|
37601
37867
|
const core = object$4(row.record_core ?? row.record ?? row);
|
|
37602
37868
|
const recordUid = text$3(core.record_uid).trim();
|
|
37603
|
-
if (!recordUid) throw invalid$
|
|
37869
|
+
if (!recordUid) throw invalid$4();
|
|
37604
37870
|
const status = lifecycle(core.status);
|
|
37605
37871
|
if (status === "excluded") return [];
|
|
37606
37872
|
if (status === "unknown") {
|
|
@@ -37663,7 +37929,7 @@ var DataManagementService = class {
|
|
|
37663
37929
|
}, session, signal, { lane: "interactive-read" }), this.runtime.authenticatedPost("/api/v1/records/export/session/latest", {}, session, signal, { lane: "interactive-read" })]);
|
|
37664
37930
|
await this.session(scope);
|
|
37665
37931
|
const raw = object$4(preflightResponse), latest = object$4(latestResponse);
|
|
37666
|
-
if (typeof raw.can_export !== "boolean") throw invalid$
|
|
37932
|
+
if (typeof raw.can_export !== "boolean") throw invalid$4();
|
|
37667
37933
|
return {
|
|
37668
37934
|
accountScope: scope,
|
|
37669
37935
|
canExport: raw.can_export,
|
|
@@ -37675,7 +37941,7 @@ var DataManagementService = class {
|
|
|
37675
37941
|
};
|
|
37676
37942
|
}
|
|
37677
37943
|
async recover(scope, recordUid, version) {
|
|
37678
|
-
if (!recordUid.trim() || integer$1(version) <= 0) throw invalid$
|
|
37944
|
+
if (!recordUid.trim() || integer$1(version) <= 0) throw invalid$4();
|
|
37679
37945
|
const record = (await this.deleted(scope)).items.find((item) => item.recordUid === recordUid);
|
|
37680
37946
|
if (!record || record.version !== version || record.recoverableUntilMillis === void 0 || record.recoverableUntilMillis <= Date.now()) throw new ArkmePluginError("data-management-record-changed", "记录状态已变化或无法确认可恢复,请刷新最近删除列表。", false, 409);
|
|
37681
37947
|
const session = await this.session(scope);
|
|
@@ -37685,7 +37951,7 @@ var DataManagementService = class {
|
|
|
37685
37951
|
}, session);
|
|
37686
37952
|
await this.session(scope);
|
|
37687
37953
|
const envelope = object$4(raw);
|
|
37688
|
-
if (object$4(envelope.record_core ?? envelope.record ?? envelope).record_uid !== recordUid) throw invalid$
|
|
37954
|
+
if (object$4(envelope.record_core ?? envelope.record ?? envelope).record_uid !== recordUid) throw invalid$4();
|
|
37689
37955
|
return {
|
|
37690
37956
|
accountScope: scope,
|
|
37691
37957
|
recordUid
|
|
@@ -46029,7 +46295,7 @@ var RecordReeditSubmissions = class {
|
|
|
46029
46295
|
};
|
|
46030
46296
|
//#endregion
|
|
46031
46297
|
//#region src/services/record-reedit-attachments.ts
|
|
46032
|
-
const invalid$
|
|
46298
|
+
const invalid$3 = () => new ArkmePluginError("record-reedit-attachment-invalid", "附件引用无效或不属于这条快记,请重新读取后选择", false, 409);
|
|
46033
46299
|
const refs = (payload) => Array.isArray(payload?.media_refs) ? payload.media_refs.map(objectValue$2) : [];
|
|
46034
46300
|
function recordReeditIsBackgroundSound(ref) {
|
|
46035
46301
|
return ref.content_file_role === 4;
|
|
@@ -46051,14 +46317,14 @@ function recordReeditAttachmentSelection(value, payload) {
|
|
|
46051
46317
|
try {
|
|
46052
46318
|
selection = parseArkmeRecordReeditAttachments(value);
|
|
46053
46319
|
} catch {
|
|
46054
|
-
throw invalid$
|
|
46320
|
+
throw invalid$3();
|
|
46055
46321
|
}
|
|
46056
46322
|
const groups = recordReeditMediaGroups(payload);
|
|
46057
46323
|
const supported = new Set(groups.map((group) => group.fileAssetUid));
|
|
46058
|
-
if (selection.some((item) => item.fileAssetUid !== void 0 && !supported.has(item.fileAssetUid))) throw invalid$
|
|
46324
|
+
if (selection.some((item) => item.fileAssetUid !== void 0 && !supported.has(item.fileAssetUid))) throw invalid$3();
|
|
46059
46325
|
const grouped = new Set(groups.flatMap((group) => group.refs));
|
|
46060
|
-
if (refs(payload).some((ref) => !recordReeditIsBackgroundSound(ref) && ref.render_role === 4 && !groups.some((group) => group.refs.some((item) => item.file_asset_uid === ref.file_asset_uid)))) throw invalid$
|
|
46061
|
-
if (groups.some((group) => group.fileAssetUid === "") || grouped.size !== groups.reduce((sum, group) => sum + group.refs.length, 0)) throw invalid$
|
|
46326
|
+
if (refs(payload).some((ref) => !recordReeditIsBackgroundSound(ref) && ref.render_role === 4 && !groups.some((group) => group.refs.some((item) => item.file_asset_uid === ref.file_asset_uid)))) throw invalid$3();
|
|
46327
|
+
if (groups.some((group) => group.fileAssetUid === "") || grouped.size !== groups.reduce((sum, group) => sum + group.refs.length, 0)) throw invalid$3();
|
|
46062
46328
|
return selection;
|
|
46063
46329
|
}
|
|
46064
46330
|
function recordReeditAttachmentChanges(payload, selection) {
|
|
@@ -46080,11 +46346,11 @@ function recordReeditWithAttachments(payload, selection, uploads) {
|
|
|
46080
46346
|
const media = selection.flatMap((item) => {
|
|
46081
46347
|
if (item.fileAssetUid !== void 0) {
|
|
46082
46348
|
const group = groups.find((value) => value.fileAssetUid === item.fileAssetUid);
|
|
46083
|
-
if (group === void 0) throw invalid$
|
|
46349
|
+
if (group === void 0) throw invalid$3();
|
|
46084
46350
|
return group.refs.map((ref) => structuredClone(ref));
|
|
46085
46351
|
}
|
|
46086
46352
|
const asset = uploads.get(item.fileRef);
|
|
46087
|
-
if (asset === void 0 || asset.fileAssetUid.trim() === "") throw invalid$
|
|
46353
|
+
if (asset === void 0 || asset.fileAssetUid.trim() === "") throw invalid$3();
|
|
46088
46354
|
return [{
|
|
46089
46355
|
file_asset_uid: asset.fileAssetUid,
|
|
46090
46356
|
render_role: 1,
|
|
@@ -47611,21 +47877,21 @@ var RecordService = class {
|
|
|
47611
47877
|
const LOCAL_FILE_REF = /^arkme-file-v1\.[0-9a-f-]{36}$/;
|
|
47612
47878
|
const ASSET_REF = /^[A-Za-z0-9._:-]{8,256}$/;
|
|
47613
47879
|
const MAX_AMPLITUDES = 4096;
|
|
47614
|
-
function invalid$
|
|
47880
|
+
function invalid$2(message) {
|
|
47615
47881
|
return new ArkmePluginError("background-sound-invalid", message, false, 400);
|
|
47616
47882
|
}
|
|
47617
47883
|
function invalidFile(message) {
|
|
47618
47884
|
return new ArkmePluginError("background-sound-file-invalid", message, false, 400);
|
|
47619
47885
|
}
|
|
47620
47886
|
function arkmeBackgroundSoundAmplitudes(values) {
|
|
47621
|
-
if (!Array.isArray(values) || values.length > MAX_AMPLITUDES || values.some((value) => typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1)) throw invalid$
|
|
47887
|
+
if (!Array.isArray(values) || values.length > MAX_AMPLITUDES || values.some((value) => typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1)) throw invalid$2("背景音振幅数量不能超过 4096,且每项必须是 0 到 1 之间的有限数字");
|
|
47622
47888
|
return [...values];
|
|
47623
47889
|
}
|
|
47624
47890
|
function arkmeFileBackgroundSound(value, allFileRefs) {
|
|
47625
47891
|
if (value === void 0) return void 0;
|
|
47626
|
-
if (!Array.isArray(value.fileRefs) || value.fileRefs.length === 0 || value.fileRefs.some((ref) => typeof ref !== "string" || !LOCAL_FILE_REF.test(ref)) || new Set(value.fileRefs).size !== value.fileRefs.length) throw invalid$
|
|
47892
|
+
if (!Array.isArray(value.fileRefs) || value.fileRefs.length === 0 || value.fileRefs.some((ref) => typeof ref !== "string" || !LOCAL_FILE_REF.test(ref)) || new Set(value.fileRefs).size !== value.fileRefs.length) throw invalid$2("背景音文件引用为空、重复或无效");
|
|
47627
47893
|
const allowed = new Set(allFileRefs);
|
|
47628
|
-
if (value.fileRefs.some((ref) => !allowed.has(ref))) throw invalid$
|
|
47894
|
+
if (value.fileRefs.some((ref) => !allowed.has(ref))) throw invalid$2("背景音文件必须属于同一发送任务");
|
|
47629
47895
|
return {
|
|
47630
47896
|
fileRefs: [...value.fileRefs],
|
|
47631
47897
|
amplitudes: arkmeBackgroundSoundAmplitudes(value.amplitudes)
|
|
@@ -47655,10 +47921,10 @@ function normalizedBackgroundAsset(asset) {
|
|
|
47655
47921
|
}
|
|
47656
47922
|
function arkmeRichBackgroundSound(value) {
|
|
47657
47923
|
if (value === void 0) return void 0;
|
|
47658
|
-
if (!Array.isArray(value.assets) || value.assets.length === 0 || value.assets.length > 20) throw invalid$
|
|
47924
|
+
if (!Array.isArray(value.assets) || value.assets.length === 0 || value.assets.length > 20) throw invalid$2("背景音资产为空或数量超限");
|
|
47659
47925
|
const assets = value.assets.map(normalizedBackgroundAsset);
|
|
47660
47926
|
const identities = assets.map((asset) => asset.fileAssetUid);
|
|
47661
|
-
if (new Set(identities).size !== identities.length) throw invalid$
|
|
47927
|
+
if (new Set(identities).size !== identities.length) throw invalid$2("背景音资产不能重复");
|
|
47662
47928
|
return {
|
|
47663
47929
|
assets,
|
|
47664
47930
|
amplitudes: arkmeBackgroundSoundAmplitudes(value.amplitudes)
|
|
@@ -83834,13 +84100,13 @@ var GroupService = class {
|
|
|
83834
84100
|
};
|
|
83835
84101
|
//#endregion
|
|
83836
84102
|
//#region src/services/common-group-service.ts
|
|
83837
|
-
const invalid = () => new ArkmePluginError("common-groups-response-invalid", "共同群聊响应不完整,请重试", true, 502);
|
|
84103
|
+
const invalid$1 = () => new ArkmePluginError("common-groups-response-invalid", "共同群聊响应不完整,请重试", true, 502);
|
|
83838
84104
|
function commonGroupChanges(value, known, after) {
|
|
83839
84105
|
const raw = objectValue$2(value);
|
|
83840
|
-
if (!Array.isArray(raw.items) || !Array.isArray(raw.removed) || typeof raw.has_more !== "boolean" || raw.items.length > 20 || raw.removed.length > 20) throw invalid();
|
|
84106
|
+
if (!Array.isArray(raw.items) || !Array.isArray(raw.removed) || typeof raw.has_more !== "boolean" || raw.items.length > 20 || raw.removed.length > 20) throw invalid$1();
|
|
83841
84107
|
const items = raw.items.map((value) => {
|
|
83842
84108
|
const row = objectValue$2(value);
|
|
83843
|
-
if (typeof row.chat_session_uid !== "string" || !row.chat_session_uid || row.chat_session_uid.length > 128 || typeof row.title !== "string" || row.title.length > 4096 || !Number.isSafeInteger(row.member_count) || Number(row.member_count) < 0) throw invalid();
|
|
84109
|
+
if (typeof row.chat_session_uid !== "string" || !row.chat_session_uid || row.chat_session_uid.length > 128 || typeof row.title !== "string" || row.title.length > 4096 || !Number.isSafeInteger(row.member_count) || Number(row.member_count) < 0) throw invalid$1();
|
|
83844
84110
|
return {
|
|
83845
84111
|
uid: row.chat_session_uid,
|
|
83846
84112
|
title: row.title,
|
|
@@ -83848,14 +84114,14 @@ function commonGroupChanges(value, known, after) {
|
|
|
83848
84114
|
};
|
|
83849
84115
|
});
|
|
83850
84116
|
const removed = raw.removed;
|
|
83851
|
-
if (removed.some((uid) => typeof uid !== "string" || !known.includes(uid))) throw invalid();
|
|
84117
|
+
if (removed.some((uid) => typeof uid !== "string" || !known.includes(uid))) throw invalid$1();
|
|
83852
84118
|
const identities = [...items.map((row) => row.uid), ...removed];
|
|
83853
|
-
if (new Set(identities).size !== identities.length) throw invalid();
|
|
84119
|
+
if (new Set(identities).size !== identities.length) throw invalid$1();
|
|
83854
84120
|
if (known.length) {
|
|
83855
|
-
if (raw.has_more || identities.length !== known.length || identities.some((uid) => !known.includes(String(uid)))) throw invalid();
|
|
83856
|
-
} else if (removed.length || items.some((row, i) => row.uid <= (items[i - 1]?.uid ?? after))) throw invalid();
|
|
84121
|
+
if (raw.has_more || identities.length !== known.length || identities.some((uid) => !known.includes(String(uid)))) throw invalid$1();
|
|
84122
|
+
} else if (removed.length || items.some((row, i) => row.uid <= (items[i - 1]?.uid ?? after))) throw invalid$1();
|
|
83857
84123
|
const next = raw.has_more ? raw.next_after : "";
|
|
83858
|
-
if (typeof next !== "string" || raw.has_more && (!items.length || next !== items.at(-1)?.uid || next <= after)) throw invalid();
|
|
84124
|
+
if (typeof next !== "string" || raw.has_more && (!items.length || next !== items.at(-1)?.uid || next <= after)) throw invalid$1();
|
|
83859
84125
|
return {
|
|
83860
84126
|
items,
|
|
83861
84127
|
removed,
|
|
@@ -87794,6 +88060,28 @@ var RelatedQuickNoteService = class {
|
|
|
87794
88060
|
}
|
|
87795
88061
|
};
|
|
87796
88062
|
//#endregion
|
|
88063
|
+
//#region src/recording-search-version.ts
|
|
88064
|
+
/** Public Audio contract: hash raw decrypted text, retaining whitespace and Unicode. */
|
|
88065
|
+
function recordingSearchVersion(item) {
|
|
88066
|
+
return createHash("sha256").update([
|
|
88067
|
+
item.sessionId,
|
|
88068
|
+
item.childId,
|
|
88069
|
+
item.asrItemIndex,
|
|
88070
|
+
item.transcriptSource,
|
|
88071
|
+
item.startAtMillis,
|
|
88072
|
+
item.endAtMillis,
|
|
88073
|
+
item.text
|
|
88074
|
+
].join("\n"), "utf8").digest("hex");
|
|
88075
|
+
}
|
|
88076
|
+
function recordingSearchIdentityHash(item) {
|
|
88077
|
+
return createHash("sha256").update(JSON.stringify([
|
|
88078
|
+
item.sessionId,
|
|
88079
|
+
item.transcriptSource,
|
|
88080
|
+
item.childId,
|
|
88081
|
+
item.itemIndex
|
|
88082
|
+
]), "utf8").digest("hex");
|
|
88083
|
+
}
|
|
88084
|
+
//#endregion
|
|
87797
88085
|
//#region src/recording-import-coordinator.ts
|
|
87798
88086
|
function importFailure(error) {
|
|
87799
88087
|
if (error instanceof RecordingImportContractError) return {
|
|
@@ -88327,6 +88615,7 @@ function projectRecordingTranscripts(response, speakerResponse, profilesByUserId
|
|
|
88327
88615
|
isSelf,
|
|
88328
88616
|
isBackground,
|
|
88329
88617
|
text,
|
|
88618
|
+
rawTranscriptText: stringValue(row.t ?? row.text),
|
|
88330
88619
|
...generationText === text ? {} : { generationText },
|
|
88331
88620
|
...stringValue(row.p).trim() === "" ? {} : { event: stringValue(row.p).trim() },
|
|
88332
88621
|
sourceIndex,
|
|
@@ -89727,6 +90016,18 @@ var RecordingService = class {
|
|
|
89727
90016
|
return {
|
|
89728
90017
|
itemId: item.itemId,
|
|
89729
90018
|
itemRef: this.sealRecordingRefWithKey("arkme-recording-item-v1", payload, refKey),
|
|
90019
|
+
...item.transcriptSource !== "system" ? {} : {
|
|
90020
|
+
searchIdentityHash: recordingSearchIdentityHash({
|
|
90021
|
+
sessionId: item.sessionId,
|
|
90022
|
+
childId: item.childId,
|
|
90023
|
+
itemIndex: item.asrItemIndex,
|
|
90024
|
+
transcriptSource: item.transcriptSource
|
|
90025
|
+
}),
|
|
90026
|
+
searchVersion: recordingSearchVersion({
|
|
90027
|
+
...item,
|
|
90028
|
+
text: item.rawTranscriptText ?? item.text
|
|
90029
|
+
})
|
|
90030
|
+
},
|
|
89730
90031
|
transcriptSource: item.transcriptSource,
|
|
89731
90032
|
sessionKey: createHmac("sha256", refKey).update(`recording-session:${String(viewerUserId)}:${item.sessionId}`).digest("base64url"),
|
|
89732
90033
|
startAtMillis: item.startAtMillis,
|
|
@@ -90699,6 +91000,60 @@ var RelatedRecordingService = class {
|
|
|
90699
91000
|
}
|
|
90700
91001
|
};
|
|
90701
91002
|
//#endregion
|
|
91003
|
+
//#region src/recording-search-result.ts
|
|
91004
|
+
function invalid() {
|
|
91005
|
+
throw new ArkmePluginError("recording-search-invalid", "录音搜索结果已失效,请重试", true);
|
|
91006
|
+
}
|
|
91007
|
+
function segment(raw) {
|
|
91008
|
+
const value = objectValue$2(raw);
|
|
91009
|
+
if (!stringValue$2(value.session_id).trim() || !stringValue$2(value.child_id).trim() || !Number.isSafeInteger(value.item_index) || Number(value.item_index) < 0 || value.transcript_source !== "system" || !stringValue$2(value.transcript_version).trim() || typeof value.text !== "string" || !Number.isSafeInteger(value.start_at) || !Number.isSafeInteger(value.end_at)) invalid();
|
|
91010
|
+
const speaker = objectValue$2(value.speaker);
|
|
91011
|
+
return {
|
|
91012
|
+
sessionId: String(value.session_id),
|
|
91013
|
+
childId: String(value.child_id),
|
|
91014
|
+
itemIndex: Number(value.item_index),
|
|
91015
|
+
transcriptSource: "system",
|
|
91016
|
+
transcriptVersion: String(value.transcript_version),
|
|
91017
|
+
startAtMillis: Number(value.start_at),
|
|
91018
|
+
endAtMillis: Number(value.end_at),
|
|
91019
|
+
text: String(value.text),
|
|
91020
|
+
...value.speaker === void 0 ? {} : { speaker: {
|
|
91021
|
+
speakerId: stringValue$2(speaker.speaker_id),
|
|
91022
|
+
label: stringValue$2(speaker.label) || "未知说话人",
|
|
91023
|
+
...typeof speaker.user_id === "number" && speaker.user_id > 0 ? { userId: speaker.user_id } : {},
|
|
91024
|
+
...typeof speaker.color_index === "number" ? { colorIndex: speaker.color_index } : {}
|
|
91025
|
+
} }
|
|
91026
|
+
};
|
|
91027
|
+
}
|
|
91028
|
+
function parseRecordingSearchItem(raw) {
|
|
91029
|
+
const value = objectValue$2(raw);
|
|
91030
|
+
const match = segment(value.match);
|
|
91031
|
+
const previous = value.previous == null ? void 0 : segment(value.previous);
|
|
91032
|
+
const next = value.next == null ? void 0 : segment(value.next);
|
|
91033
|
+
if (match.sessionId !== value.session_id) invalid();
|
|
91034
|
+
const day = Number(value.date_stamp);
|
|
91035
|
+
if ([previous, next].some((item) => item && item.sessionId !== match.sessionId && (!Number.isSafeInteger(day) || day <= 0 || item.startAtMillis < day || item.startAtMillis >= day + 864e5))) invalid();
|
|
91036
|
+
if (previous && previous.startAtMillis > match.startAtMillis || next && next.startAtMillis < match.startAtMillis) invalid();
|
|
91037
|
+
const ranges = Array.isArray(value.highlight_ranges) ? value.highlight_ranges : [];
|
|
91038
|
+
const length = Array.from(match.text).length;
|
|
91039
|
+
const highlightRanges = ranges.map(objectValue$2).map((range) => ({
|
|
91040
|
+
start: Number(range.start_index),
|
|
91041
|
+
length: Number(range.length)
|
|
91042
|
+
})).filter((range) => Number.isSafeInteger(range.start) && Number.isSafeInteger(range.length) && range.start >= 0 && range.length > 0 && range.start + range.length <= length).sort((a, b) => a.start - b.start).filter((range, index, all) => index === 0 || range.start >= all[index - 1].start + all[index - 1].length);
|
|
91043
|
+
return {
|
|
91044
|
+
sessionId: match.sessionId,
|
|
91045
|
+
dateStamp: Number(value.date_stamp) || 0,
|
|
91046
|
+
startAtMillis: match.startAtMillis,
|
|
91047
|
+
snippet: match.text,
|
|
91048
|
+
score: Number(value.score) || 0,
|
|
91049
|
+
match,
|
|
91050
|
+
highlightRanges,
|
|
91051
|
+
...stringValue$2(value.record_uid) ? { recordUid: String(value.record_uid) } : {},
|
|
91052
|
+
...previous ? { previous } : {},
|
|
91053
|
+
...next ? { next } : {}
|
|
91054
|
+
};
|
|
91055
|
+
}
|
|
91056
|
+
//#endregion
|
|
90702
91057
|
//#region src/dsh-search-origins.ts
|
|
90703
91058
|
/** Resolve sync identity using the public index and exact deterministic record IDs. */
|
|
90704
91059
|
async function resolveDshSearchOrigins(provider, items, signal) {
|
|
@@ -91025,13 +91380,15 @@ var SearchService = class {
|
|
|
91025
91380
|
media;
|
|
91026
91381
|
source;
|
|
91027
91382
|
privacy;
|
|
91383
|
+
profile;
|
|
91028
91384
|
localDshQuery;
|
|
91029
|
-
constructor(runtime, record, media, source, privacy = new ArkmePrivacyVisibilityService(runtime)) {
|
|
91385
|
+
constructor(runtime, record, media, source, privacy = new ArkmePrivacyVisibilityService(runtime), profile) {
|
|
91030
91386
|
this.runtime = runtime;
|
|
91031
91387
|
this.record = record;
|
|
91032
91388
|
this.media = media;
|
|
91033
91389
|
this.source = source;
|
|
91034
91390
|
this.privacy = privacy;
|
|
91391
|
+
this.profile = profile;
|
|
91035
91392
|
}
|
|
91036
91393
|
async searchRecords(options) {
|
|
91037
91394
|
const query = options.query.trim();
|
|
@@ -91393,22 +91750,37 @@ var SearchService = class {
|
|
|
91393
91750
|
const session = await this.runtime.requireSession();
|
|
91394
91751
|
const data = await this.runtime.authenticatedPost("/api/v1/search/recordings/query", {
|
|
91395
91752
|
keyword: query,
|
|
91753
|
+
result_mode: "segments",
|
|
91396
91754
|
limit: Math.min(50, Math.max(1, Math.trunc(options.limit))),
|
|
91397
91755
|
...options.cursor?.trim() ? { cursor: options.cursor.trim() } : {}
|
|
91398
91756
|
}, session, options.signal);
|
|
91757
|
+
const items = listValue$3(data.items).map(parseRecordingSearchItem);
|
|
91758
|
+
const segments = items.flatMap((item) => [
|
|
91759
|
+
item.previous,
|
|
91760
|
+
item.match,
|
|
91761
|
+
item.next
|
|
91762
|
+
].filter((value) => value !== void 0));
|
|
91763
|
+
const userIds = [...new Set(segments.flatMap((item) => item.speaker?.userId === void 0 ? [] : [item.speaker.userId]))];
|
|
91764
|
+
if (this.profile !== void 0 && userIds.length > 0) try {
|
|
91765
|
+
const profiles = await this.profile.publicProfileSummariesByUserIds(userIds, session, options.signal);
|
|
91766
|
+
const avatars = /* @__PURE__ */ new Map();
|
|
91767
|
+
await Promise.all([...profiles].map(async ([userId, profile]) => {
|
|
91768
|
+
if (profile.avatarUrl !== void 0) avatars.set(userId, await this.profile.sealProfileImageRef(session.userId, userId));
|
|
91769
|
+
}));
|
|
91770
|
+
for (const segment of segments) {
|
|
91771
|
+
const speaker = segment.speaker;
|
|
91772
|
+
if (speaker?.userId === void 0) continue;
|
|
91773
|
+
const profile = profiles.get(speaker.userId);
|
|
91774
|
+
const avatarRef = avatars.get(speaker.userId);
|
|
91775
|
+
if (avatarRef !== void 0) speaker.avatarRef = avatarRef;
|
|
91776
|
+
if (profile && (speaker.userId === session.userId || speaker.label === "未知说话人")) speaker.label = profile.displayName.trim() || profile.nickname.trim() || speaker.label;
|
|
91777
|
+
}
|
|
91778
|
+
} catch (error) {
|
|
91779
|
+
if (options.signal?.aborted) throw error;
|
|
91780
|
+
}
|
|
91399
91781
|
const guard = objectValue$2(data.query_guard);
|
|
91400
91782
|
return {
|
|
91401
|
-
items
|
|
91402
|
-
const item = objectValue$2(raw);
|
|
91403
|
-
return {
|
|
91404
|
-
sessionId: stringValue$2(item.session_id).trim(),
|
|
91405
|
-
...stringValue$2(item.record_uid).trim() === "" ? {} : { recordUid: stringValue$2(item.record_uid).trim() },
|
|
91406
|
-
dateStamp: numberValue$2(item.date_stamp),
|
|
91407
|
-
startAtMillis: numberValue$2(item.start_at),
|
|
91408
|
-
snippet: clippedText(item.snippet, 1e3),
|
|
91409
|
-
score: numberValue$2(item.score)
|
|
91410
|
-
};
|
|
91411
|
-
}).filter((item) => item.sessionId !== "" && item.snippet !== ""),
|
|
91783
|
+
items,
|
|
91412
91784
|
hasMore: booleanValue$1(data.has_more),
|
|
91413
91785
|
...stringValue$2(data.next_cursor).trim() === "" ? {} : { nextCursor: stringValue$2(data.next_cursor).trim() },
|
|
91414
91786
|
queryGuard: {
|
|
@@ -95252,7 +95624,7 @@ var ArkmeService = class {
|
|
|
95252
95624
|
await this.realtime.invalidateRecordProjection();
|
|
95253
95625
|
}, async (source, text, humans, bots, session, textFormat) => await this.chat.resolveMentions(source, text, text, humans, bots, session, void 0, textFormat));
|
|
95254
95626
|
this.calendar = new CalendarService(this.runtime, this.privacy, this.media, this.record, this.source, this.callHistory);
|
|
95255
|
-
this.search = new SearchService(this.runtime, this.record, this.media, this.source, this.privacy);
|
|
95627
|
+
this.search = new SearchService(this.runtime, this.record, this.media, this.source, this.privacy, this.profile);
|
|
95256
95628
|
if (localDshQuery !== void 0) this.search.localDshQuery = localDshQuery;
|
|
95257
95629
|
this.bot = new BotService(this.runtime, this.source);
|
|
95258
95630
|
this.messageActions = new MessageActionService(new ArkmeMessageActionGateway(this.runtime, this.source, async (target, sequence) => {
|
|
@@ -96687,12 +97059,36 @@ var ArkmeService = class {
|
|
|
96687
97059
|
async testLogin(userId) {
|
|
96688
97060
|
return await this.auth.testLogin(userId);
|
|
96689
97061
|
}
|
|
97062
|
+
async sendEmailBindCode(expectedUserId, email) {
|
|
97063
|
+
return await this.auth.sendEmailBindCode(expectedUserId, email);
|
|
97064
|
+
}
|
|
97065
|
+
async bindEmail(expectedUserId, email, code) {
|
|
97066
|
+
return await this.auth.bindEmail(expectedUserId, email, code);
|
|
97067
|
+
}
|
|
96690
97068
|
async sendPhoneCode(phone, captcha) {
|
|
96691
97069
|
return await this.auth.sendPhoneCode(phone, captcha);
|
|
96692
97070
|
}
|
|
97071
|
+
async checkPhoneUnbindEligibility(expectedUserId) {
|
|
97072
|
+
return await this.auth.checkPhoneUnbindEligibility(expectedUserId);
|
|
97073
|
+
}
|
|
97074
|
+
async sendPhoneUnbindCode(captcha) {
|
|
97075
|
+
return await this.auth.sendPhoneUnbindCode(captcha);
|
|
97076
|
+
}
|
|
97077
|
+
async unbindPhone(code) {
|
|
97078
|
+
return await this.auth.unbindPhone(code);
|
|
97079
|
+
}
|
|
96693
97080
|
async verifyPhoneCode(phone, code) {
|
|
96694
97081
|
return await this.auth.verifyPhoneCode(phone, code);
|
|
96695
97082
|
}
|
|
97083
|
+
async previewCancellation(expectedUserId) {
|
|
97084
|
+
return await this.auth.previewCancellation(expectedUserId);
|
|
97085
|
+
}
|
|
97086
|
+
async submitCancellation(expectedUserId, expectedMode) {
|
|
97087
|
+
return await this.auth.submitCancellation(expectedUserId, expectedMode);
|
|
97088
|
+
}
|
|
97089
|
+
async resolveCancellationLogin(continueLogin) {
|
|
97090
|
+
return await this.auth.resolveCancellationLogin(continueLogin);
|
|
97091
|
+
}
|
|
96696
97092
|
async logout() {
|
|
96697
97093
|
return await this.auth.logout();
|
|
96698
97094
|
}
|