@codemem/server 0.32.2 → 0.32.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +91 -38
- package/dist/index.js.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +2 -2
- package/static/app.js +24 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;AAmFvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AACtC,KAAK,iBAAiB,GAAG;IACxB,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAoBF,UAAU,wBAAwB;IACjC,cAAc,CAAC,EAAE;QAChB,OAAO,EAAE,0BAA0B,CAAC;QACpC,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,wBAAwB,EAAE,MAAM,CAAC;QACjC,4BAA4B,EAAE,MAAM,CAAC;KACrC,CAAC;CACF;AAqyDD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EA+W7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAkpErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"drizzle-orm": "^0.45.2",
|
|
20
20
|
"hono": "^4.12.21",
|
|
21
21
|
"limiter": "^3.0.0",
|
|
22
|
-
"@codemem/core": "^0.32.
|
|
22
|
+
"@codemem/core": "^0.32.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/better-sqlite3": "^7.6.13",
|
package/static/app.js
CHANGED
|
@@ -3248,13 +3248,12 @@
|
|
|
3248
3248
|
return payload;
|
|
3249
3249
|
}
|
|
3250
3250
|
async function acceptDiscoveredPeer(peerDeviceId, fingerprint) {
|
|
3251
|
+
const body = { peer_device_id: peerDeviceId };
|
|
3252
|
+
if (fingerprint) body.fingerprint = fingerprint;
|
|
3251
3253
|
const resp = await fetch("/api/sync/peers/accept-discovered", {
|
|
3252
3254
|
method: "POST",
|
|
3253
3255
|
headers: { "Content-Type": "application/json" },
|
|
3254
|
-
body: JSON.stringify(
|
|
3255
|
-
peer_device_id: peerDeviceId,
|
|
3256
|
-
fingerprint
|
|
3257
|
-
})
|
|
3256
|
+
body: JSON.stringify(body)
|
|
3258
3257
|
});
|
|
3259
3258
|
const text = await resp.text();
|
|
3260
3259
|
let payload = {};
|
|
@@ -3461,11 +3460,16 @@
|
|
|
3461
3460
|
if (!resp.ok) throw new Error(payloadError(payload) || text || "request failed");
|
|
3462
3461
|
return payload;
|
|
3463
3462
|
}
|
|
3464
|
-
async function triggerSync(
|
|
3463
|
+
async function triggerSync(target) {
|
|
3464
|
+
const address = typeof target === "string" ? target.trim() : target?.address?.trim();
|
|
3465
|
+
const peerDeviceId = typeof target === "string" ? "" : target?.peerDeviceId?.trim();
|
|
3466
|
+
const payload = {};
|
|
3467
|
+
if (address) payload.address = address;
|
|
3468
|
+
if (peerDeviceId) payload.peer_device_id = peerDeviceId;
|
|
3465
3469
|
const resp = await fetch("/api/sync/run", {
|
|
3466
3470
|
method: "POST",
|
|
3467
3471
|
headers: { "Content-Type": "application/json" },
|
|
3468
|
-
body: JSON.stringify(
|
|
3472
|
+
body: JSON.stringify(payload)
|
|
3469
3473
|
});
|
|
3470
3474
|
const { text, payload: body } = await readJsonPayload(resp);
|
|
3471
3475
|
if (!resp.ok) throw new Error(payloadError(body) || text || "request failed");
|
|
@@ -18061,9 +18065,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
18061
18065
|
}
|
|
18062
18066
|
function shouldShowCoordinatorReviewAction(input) {
|
|
18063
18067
|
const approvalSummary = deriveCoordinatorApprovalSummary(input);
|
|
18064
|
-
|
|
18065
|
-
const fingerprint = cleanText(input.device?.fingerprint);
|
|
18066
|
-
if (!deviceId || !fingerprint) return false;
|
|
18068
|
+
if (!cleanText(input.device?.device_id)) return false;
|
|
18067
18069
|
if (input.device?.stale || input.hasAmbiguousCoordinatorGroup) return false;
|
|
18068
18070
|
if (!input.pairedLocally) return true;
|
|
18069
18071
|
return approvalSummary.state === "needs-your-approval";
|
|
@@ -19672,7 +19674,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19672
19674
|
const excludeList = listText(scope.exclude);
|
|
19673
19675
|
const primaryAddress = pickPrimaryAddress(peer.addresses);
|
|
19674
19676
|
const peerAddresses = Array.isArray(peer.addresses) ? Array.from(new Set(peer.addresses.filter(Boolean).map((value) => String(value)))) : [];
|
|
19675
|
-
const
|
|
19677
|
+
const rawHiddenAddressCount = Number(peer.address_count ?? 0);
|
|
19678
|
+
const hiddenAddressCount = Number.isFinite(rawHiddenAddressCount) && rawHiddenAddressCount > 0 ? rawHiddenAddressCount : 0;
|
|
19679
|
+
const addressLine = peerAddresses.length ? peerAddresses.map((address) => isSyncRedactionEnabled() ? redactAddress(address) : address).join(" · ") : hiddenAddressCount > 0 ? `${hiddenAddressCount} ${hiddenAddressCount === 1 ? "address" : "addresses"} hidden` : "No addresses";
|
|
19676
19680
|
const assignmentSummary = peer.actor_display_name ? `This device belongs to ${peer.claimed_local_actor ? "you" : String(peer.actor_display_name)}.` : "This device is not assigned to anyone yet.";
|
|
19677
19681
|
const lastSyncAt = String(peerStatus.last_sync_at || peerStatus.last_sync_at_utc || "");
|
|
19678
19682
|
const lastPingAt = String(peerStatus.last_ping_at || peerStatus.last_ping_at_utc || "");
|
|
@@ -19777,7 +19781,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19777
19781
|
}
|
|
19778
19782
|
}
|
|
19779
19783
|
async function sync() {
|
|
19780
|
-
if (!primaryAddress) return;
|
|
19781
19784
|
if (pendingScopeReview) {
|
|
19782
19785
|
if (!await openSyncConfirmDialog({
|
|
19783
19786
|
title: `Sync ${displayName} before scope review?`,
|
|
@@ -19953,8 +19956,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19953
19956
|
/* @__PURE__ */ u("button", {
|
|
19954
19957
|
type: "button",
|
|
19955
19958
|
className: "settings-button",
|
|
19956
|
-
disabled:
|
|
19959
|
+
disabled: syncBusy,
|
|
19957
19960
|
onClick: () => void sync(),
|
|
19961
|
+
title: primaryAddress ? void 0 : "Address details are hidden; sync will target this device by ID.",
|
|
19958
19962
|
children: syncBusy ? "Syncing…" : "Sync now"
|
|
19959
19963
|
}),
|
|
19960
19964
|
/* @__PURE__ */ u("div", {
|
|
@@ -20264,8 +20268,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20264
20268
|
},
|
|
20265
20269
|
onSync: async (peer, address) => {
|
|
20266
20270
|
try {
|
|
20267
|
-
const summary = summarizeSyncRunResult(await triggerSync(address));
|
|
20268
20271
|
const peerId = String(peer?.peer_device_id || "");
|
|
20272
|
+
const summary = summarizeSyncRunResult(await triggerSync({
|
|
20273
|
+
address,
|
|
20274
|
+
peerDeviceId: peerId || void 0
|
|
20275
|
+
}));
|
|
20269
20276
|
let feedback;
|
|
20270
20277
|
if (!summary.ok) feedback = {
|
|
20271
20278
|
message: summary.message,
|
|
@@ -21347,7 +21354,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
21347
21354
|
pairedLocally: Boolean(pairedPeer)
|
|
21348
21355
|
});
|
|
21349
21356
|
const addresses = Array.isArray(device.addresses) ? device.addresses : [];
|
|
21350
|
-
const
|
|
21357
|
+
const rawHiddenAddressCount = Number(device.address_count ?? 0);
|
|
21358
|
+
const hiddenAddressCount = Number.isFinite(rawHiddenAddressCount) && rawHiddenAddressCount > 0 ? rawHiddenAddressCount : 0;
|
|
21359
|
+
const noteParts = [addresses.length ? addresses.map((address) => isSyncRedactionEnabled() ? redactAddress(String(address || "")) : String(address || "")).filter(Boolean).join(" · ") : hiddenAddressCount > 0 ? `${hiddenAddressCount} ${device.stale ? "last-known" : "fresh"} ${hiddenAddressCount === 1 ? "address" : "addresses"} hidden` : "No fresh addresses"];
|
|
21351
21360
|
if (!addresses.length && displayTitle) noteParts.push(`device id: ${deviceId}`);
|
|
21352
21361
|
let actionMessage = null;
|
|
21353
21362
|
let mode = canAccept ? "accept" : "none";
|
|
@@ -22213,7 +22222,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
22213
22222
|
try {
|
|
22214
22223
|
const runtime = await loadRuntimeInfo();
|
|
22215
22224
|
if (!runtime?.version) return;
|
|
22216
|
-
setRuntimeLabel(runtime.version, "
|
|
22225
|
+
setRuntimeLabel(runtime.version, "882d43d");
|
|
22217
22226
|
} catch {}
|
|
22218
22227
|
}
|
|
22219
22228
|
var lastAnnouncedRefreshState = null;
|