@ours.network/messenger-server 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -122,6 +122,23 @@ selectively consumes only those wire IDs. The general consuming `getMessages`
|
|
|
122
122
|
operation is intentionally absent from the REST surface. Duplicate calls are
|
|
123
123
|
harmless because only unread-to-read transitions produce receipt wire IDs.
|
|
124
124
|
|
|
125
|
+
Passive `GET /api/conversations/:contact/page` callers that do not display a chat-list
|
|
126
|
+
preview may pass `preview=none`. The response keeps `preview: ''` and all rows, counts,
|
|
127
|
+
receipts and cursors; older pages avoid the extra newest-message lookup. Omit the option
|
|
128
|
+
for the existing latest-message preview. Contact name/CID resolution is unchanged.
|
|
129
|
+
This opt-in applies to unbound REST pages; resource-bound reads keep their descriptor shape.
|
|
130
|
+
|
|
131
|
+
Contacts snapshots advertise `capabilities.canonicalPeerReads: 1`. Clients with an
|
|
132
|
+
authoritative CID can opt into `GET /api/peers/:cid/page`, `GET /api/peers/:cid/files`
|
|
133
|
+
and `POST /api/peers/:cid/read`. These paths validate an exact 64-character hexadecimal
|
|
134
|
+
CID and bypass name/contact enumeration, even after contact removal. Passive replies
|
|
135
|
+
include `peer: {kind: "cid", cid}`; page previews are omitted. The read command retains
|
|
136
|
+
the existing mutation-intent checks and consumes only unread wire IDs from that exact CID.
|
|
137
|
+
Messages/files resource descriptors opt in with `addressing: "cid"`; their bound reads
|
|
138
|
+
must use the matching peer path, with no change to legacy descriptor/query matching.
|
|
139
|
+
An older server's missing route must not trigger a legacy read fallback. Existing
|
|
140
|
+
name-based/default routes and send/file/command semantics remain unchanged.
|
|
141
|
+
|
|
125
142
|
`GET /api/events` is a bounded SSE invalidation stream:
|
|
126
143
|
|
|
127
144
|
- every connection begins with `sync_required(reason=connected)`;
|
|
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
var define_MESSENGER_BUILD_INFO_default;
|
|
39
39
|
var init_define_MESSENGER_BUILD_INFO = __esm({
|
|
40
40
|
"<define:__MESSENGER_BUILD_INFO__>"() {
|
|
41
|
-
define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "2.0.
|
|
41
|
+
define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "2.0.2", sha: "5849c383fd52ef895b0012ba494f59414a1a6397", dirty: false };
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
publicEngineError,
|
|
11
11
|
publicInternalError,
|
|
12
12
|
reportFailure
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DILYQTFT.js";
|
|
14
14
|
|
|
15
15
|
// node_modules/bn.js/lib/bn.js
|
|
16
16
|
var require_bn = __commonJS({
|
|
@@ -11181,6 +11181,9 @@ var NotificationOutbox = class {
|
|
|
11181
11181
|
cursor;
|
|
11182
11182
|
checkpoint;
|
|
11183
11183
|
running;
|
|
11184
|
+
again = false;
|
|
11185
|
+
failed = false;
|
|
11186
|
+
closed = false;
|
|
11184
11187
|
timer;
|
|
11185
11188
|
persist(entries, cursor = this.cursor, checkpoint = this.checkpoint) {
|
|
11186
11189
|
const tmp = this.file + ".tmp", fd = openSync(tmp, "w", 384);
|
|
@@ -11223,12 +11226,31 @@ var NotificationOutbox = class {
|
|
|
11223
11226
|
if (!retained.some(same(id))) retained.push({ id, value: { target }, operation: "delete-target" });
|
|
11224
11227
|
this.persist(retained);
|
|
11225
11228
|
}
|
|
11229
|
+
/**
|
|
11230
|
+
* Deliver soon after a durable enqueue instead of at the next recovery tick. A request
|
|
11231
|
+
* during a pass (which iterates its own snapshot) runs one follow-up pass after it;
|
|
11232
|
+
* after a failed pass only the recovery timer retries, so arrivals during an outage
|
|
11233
|
+
* add no attempts.
|
|
11234
|
+
*/
|
|
11235
|
+
prompt() {
|
|
11236
|
+
if (this.closed || this.failed) return;
|
|
11237
|
+
if (this.running) {
|
|
11238
|
+
this.again = true;
|
|
11239
|
+
return;
|
|
11240
|
+
}
|
|
11241
|
+
void this.drain();
|
|
11242
|
+
}
|
|
11226
11243
|
drain() {
|
|
11227
11244
|
return this.running ??= this.drainOnce().finally(() => {
|
|
11228
11245
|
this.running = void 0;
|
|
11246
|
+
if (this.again) {
|
|
11247
|
+
this.again = false;
|
|
11248
|
+
this.prompt();
|
|
11249
|
+
}
|
|
11229
11250
|
});
|
|
11230
11251
|
}
|
|
11231
11252
|
async drainOnce() {
|
|
11253
|
+
this.failed = false;
|
|
11232
11254
|
let attempts = 0;
|
|
11233
11255
|
for (const entry of [...this.entries]) {
|
|
11234
11256
|
if (!supported(entry)) continue;
|
|
@@ -11264,12 +11286,14 @@ var NotificationOutbox = class {
|
|
|
11264
11286
|
if (!response.ok) throw new Error("notification service rejected event");
|
|
11265
11287
|
this.persist(this.entries.filter((e2) => !same(entry.id)(e2)));
|
|
11266
11288
|
} catch {
|
|
11289
|
+
this.failed = true;
|
|
11267
11290
|
this.warn("Notification producer delivery pending; retrying from durable outbox");
|
|
11268
11291
|
break;
|
|
11269
11292
|
}
|
|
11270
11293
|
}
|
|
11271
11294
|
}
|
|
11272
11295
|
async close() {
|
|
11296
|
+
this.closed = true;
|
|
11273
11297
|
clearInterval(this.timer);
|
|
11274
11298
|
await this.running;
|
|
11275
11299
|
}
|
|
@@ -11744,6 +11768,7 @@ var MessengerNotificationProducer = class {
|
|
|
11744
11768
|
wire_id: record.wire_id,
|
|
11745
11769
|
...typeof record.sender_name === "string" ? { sender_name: record.sender_name.slice(0, 512) } : {}
|
|
11746
11770
|
});
|
|
11771
|
+
if (admitted) this.outbox.prompt();
|
|
11747
11772
|
return { status: admitted ? "queued" : "saturated" };
|
|
11748
11773
|
}
|
|
11749
11774
|
retireContact(cid) {
|
|
@@ -12284,8 +12309,9 @@ function projectHistoryPage(contact, history, summary, opts = {}) {
|
|
|
12284
12309
|
total: summary.total,
|
|
12285
12310
|
unread: summary.unread,
|
|
12286
12311
|
hasMore: history.next_cursor !== null,
|
|
12312
|
+
oldestSequence: history.items.at(-1)?.seq ?? null,
|
|
12287
12313
|
nextBefore: history.next_cursor === null ? null : String(history.next_cursor),
|
|
12288
|
-
preview: previewOf(opts.announcedContact ?? contact, messages.at(-1))
|
|
12314
|
+
preview: opts.preview === false ? "" : previewOf(opts.announcedContact ?? contact, messages.at(-1))
|
|
12289
12315
|
};
|
|
12290
12316
|
}
|
|
12291
12317
|
|
|
@@ -12354,10 +12380,11 @@ function canonicalResourceDescriptor(value) {
|
|
|
12354
12380
|
};
|
|
12355
12381
|
if (!value || typeof value !== "object" || Array.isArray(value)) return invalid();
|
|
12356
12382
|
const row = value;
|
|
12357
|
-
if (Object.keys(row).some((key) => !["viewId", "resource", "entityId", "window"].includes(key)) || typeof row.viewId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(row.viewId) || !["contacts", "identity", "messages", "files", "commands"].includes(String(row.resource))) return invalid();
|
|
12383
|
+
if (Object.keys(row).some((key) => !["viewId", "resource", "entityId", "window", "addressing"].includes(key)) || typeof row.viewId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(row.viewId) || !["contacts", "identity", "messages", "files", "commands", "activity"].includes(String(row.resource))) return invalid();
|
|
12358
12384
|
const resource = row.resource;
|
|
12359
12385
|
const scoped = ["messages", "files", "commands"].includes(resource);
|
|
12360
12386
|
if (scoped ? typeof row.entityId !== "string" || !row.entityId : row.entityId !== void 0) return invalid();
|
|
12387
|
+
if (row.addressing !== void 0 && (row.addressing !== "cid" || !["messages", "files"].includes(resource) || !/^[a-f0-9]{64}$/i.test(String(row.entityId)))) return invalid();
|
|
12361
12388
|
if (resource !== "messages" && row.window !== void 0) return invalid();
|
|
12362
12389
|
let window2;
|
|
12363
12390
|
if (resource === "messages") {
|
|
@@ -12371,9 +12398,23 @@ function canonicalResourceDescriptor(value) {
|
|
|
12371
12398
|
...w3.oldestSequence === void 0 ? {} : { oldestSequence: w3.oldestSequence }
|
|
12372
12399
|
};
|
|
12373
12400
|
}
|
|
12374
|
-
return {
|
|
12401
|
+
return {
|
|
12402
|
+
viewId: row.viewId,
|
|
12403
|
+
resource,
|
|
12404
|
+
...scoped ? { entityId: row.entityId } : {},
|
|
12405
|
+
...row.addressing === "cid" ? { addressing: "cid" } : {},
|
|
12406
|
+
...window2 ? { window: window2 } : {}
|
|
12407
|
+
};
|
|
12408
|
+
}
|
|
12409
|
+
var ACTIVITY_DEADLINE_MS = 5e3;
|
|
12410
|
+
async function projectActivity(client, signal, expectedSource) {
|
|
12411
|
+
signal?.throwIfAborted();
|
|
12412
|
+
const snapshot = await client.getContactActivity();
|
|
12413
|
+
signal?.throwIfAborted();
|
|
12414
|
+
if (expectedSource && (snapshot.source.producerGeneration !== expectedSource.producerGeneration || snapshot.source.position !== expectedSource.position)) throw new Error("activity source changed");
|
|
12415
|
+
return { activity: snapshot.activity };
|
|
12375
12416
|
}
|
|
12376
|
-
async function projectMessageWindow(client, contact, announcedContact, window2, signal) {
|
|
12417
|
+
async function projectMessageWindow(client, contact, announcedContact, window2, signal, options = {}) {
|
|
12377
12418
|
let before;
|
|
12378
12419
|
const rows = [];
|
|
12379
12420
|
let next = null;
|
|
@@ -12388,7 +12429,7 @@ async function projectMessageWindow(client, contact, announcedContact, window2,
|
|
|
12388
12429
|
contact,
|
|
12389
12430
|
{ items: selected, next_cursor: null },
|
|
12390
12431
|
{ total: 0, unread: 0 },
|
|
12391
|
-
{ announcedContact }
|
|
12432
|
+
{ announcedContact, ...options }
|
|
12392
12433
|
).messages));
|
|
12393
12434
|
if (totalBytes > RESOURCE_ASSEMBLY_BYTES) throw new Error("resource assembly limit exceeded");
|
|
12394
12435
|
rows.push(...selected);
|
|
@@ -12405,7 +12446,7 @@ async function projectMessageWindow(client, contact, announcedContact, window2,
|
|
|
12405
12446
|
const summary = await client.getHistorySummary({ peer_cid: contact });
|
|
12406
12447
|
signal.throwIfAborted();
|
|
12407
12448
|
return {
|
|
12408
|
-
...projectHistoryPage(contact, { items: rows, next_cursor: next }, summary, { announcedContact }),
|
|
12449
|
+
...projectHistoryPage(contact, { items: rows, next_cursor: next }, summary, { announcedContact, ...options }),
|
|
12409
12450
|
oldestSequence: rows.at(-1)?.seq ?? window2.oldestSequence ?? null
|
|
12410
12451
|
};
|
|
12411
12452
|
}
|
|
@@ -12518,6 +12559,7 @@ data: ${JSON.stringify(frame.data)}
|
|
|
12518
12559
|
});
|
|
12519
12560
|
}
|
|
12520
12561
|
};
|
|
12562
|
+
var sameSource = (a, b2) => a.producerGeneration === b2.producerGeneration && a.position === b2.position;
|
|
12521
12563
|
var ResourceBindingError = class extends Error {
|
|
12522
12564
|
constructor(status, message) {
|
|
12523
12565
|
super(message);
|
|
@@ -12529,7 +12571,68 @@ var ResourceConnections = class {
|
|
|
12529
12571
|
this.deps = deps;
|
|
12530
12572
|
}
|
|
12531
12573
|
#connections = /* @__PURE__ */ new Map();
|
|
12574
|
+
#activityRead;
|
|
12532
12575
|
producerGeneration = randomUUID2();
|
|
12576
|
+
/** Ordinary and bound demands share only pending work in this service scope.
|
|
12577
|
+
* Every new demand crosses the bound SDK API; source position is not a lease. */
|
|
12578
|
+
async activity(signal, bound, deadlineMs = ACTIVITY_DEADLINE_MS) {
|
|
12579
|
+
signal.throwIfAborted();
|
|
12580
|
+
const deadline = new AbortController();
|
|
12581
|
+
const timer = setTimeout(() => deadline.abort(new Error("activity metadata unavailable")), deadlineMs);
|
|
12582
|
+
try {
|
|
12583
|
+
return await this.#readActivity(AbortSignal.any([signal, deadline.signal]), bound);
|
|
12584
|
+
} finally {
|
|
12585
|
+
clearTimeout(timer);
|
|
12586
|
+
}
|
|
12587
|
+
}
|
|
12588
|
+
async #readActivity(signal, bound) {
|
|
12589
|
+
signal.throwIfAborted();
|
|
12590
|
+
const source = await abortableProjection(this.deps.client.resourcePosition(this.deps.identity, { signal }), signal);
|
|
12591
|
+
signal.throwIfAborted();
|
|
12592
|
+
if (bound?.source && !sameSource(bound.source, source)) throw new Error("activity baseline changed");
|
|
12593
|
+
let read = this.#activityRead;
|
|
12594
|
+
if (read && (read.settled || read.controller.signal.aborted || !sameSource(read.source, source))) {
|
|
12595
|
+
throw new Error("activity prior source still draining");
|
|
12596
|
+
}
|
|
12597
|
+
if (!read) {
|
|
12598
|
+
read = {
|
|
12599
|
+
source,
|
|
12600
|
+
controller: new AbortController(),
|
|
12601
|
+
users: /* @__PURE__ */ new Set(),
|
|
12602
|
+
promise: void 0,
|
|
12603
|
+
settled: false
|
|
12604
|
+
};
|
|
12605
|
+
const owned2 = read;
|
|
12606
|
+
this.#activityRead = owned2;
|
|
12607
|
+
owned2.promise = Promise.resolve().then(() => {
|
|
12608
|
+
owned2.controller.signal.throwIfAborted();
|
|
12609
|
+
return this.deps.project({ viewId: "activity", resource: "activity" }, owned2.controller.signal, source);
|
|
12610
|
+
}).finally(() => {
|
|
12611
|
+
owned2.settled = true;
|
|
12612
|
+
if (this.#activityRead === owned2 && !owned2.users.size) this.#activityRead = void 0;
|
|
12613
|
+
});
|
|
12614
|
+
void owned2.promise.catch(() => {
|
|
12615
|
+
});
|
|
12616
|
+
}
|
|
12617
|
+
const owned = read, user = Symbol("activity reader");
|
|
12618
|
+
owned.users.add(user);
|
|
12619
|
+
try {
|
|
12620
|
+
const payload = await abortableProjection(owned.promise, signal);
|
|
12621
|
+
const after = await abortableProjection(this.deps.client.resourcePosition(this.deps.identity, { signal }), signal);
|
|
12622
|
+
signal.throwIfAborted();
|
|
12623
|
+
if (!sameSource(source, after)) throw new Error("activity source changed");
|
|
12624
|
+
if (bound) {
|
|
12625
|
+
if (!this.#current(bound.connection, bound.view)) throw new Error("activity owner retired");
|
|
12626
|
+
}
|
|
12627
|
+
return payload;
|
|
12628
|
+
} finally {
|
|
12629
|
+
owned.users.delete(user);
|
|
12630
|
+
if (!owned.users.size) {
|
|
12631
|
+
owned.controller.abort();
|
|
12632
|
+
if (owned.settled && this.#activityRead === owned) this.#activityRead = void 0;
|
|
12633
|
+
}
|
|
12634
|
+
}
|
|
12635
|
+
}
|
|
12533
12636
|
open(response) {
|
|
12534
12637
|
const id = randomUUID2(), controller = new AbortController();
|
|
12535
12638
|
let resolveClosed;
|
|
@@ -12671,6 +12774,18 @@ data: ${JSON.stringify({
|
|
|
12671
12774
|
if (!view || view.epoch !== epoch || view.baselineId !== baselineId) throw new ResourceBindingError(409, "resource binding mismatch");
|
|
12672
12775
|
const baseline = await view.initial;
|
|
12673
12776
|
if (!this.#current(connection, view) || view.failed || !connection.observer.healthy) throw new ResourceBindingError(409, "resource binding retired");
|
|
12777
|
+
if (view.descriptor.resource === "activity") {
|
|
12778
|
+
try {
|
|
12779
|
+
const payload = await this.activity(view.controller.signal, { connection, view, source: baseline.source });
|
|
12780
|
+
if (!this.#current(connection, view) || view.failed || !connection.observer.healthy || !view.covered || !sameSource(baseline.source, view.covered))
|
|
12781
|
+
throw new Error("activity baseline changed");
|
|
12782
|
+
return { ...baseline, payload };
|
|
12783
|
+
} catch {
|
|
12784
|
+
view.failed = true;
|
|
12785
|
+
this.#retire(view);
|
|
12786
|
+
throw new ResourceBindingError(409, "resource activity binding retired");
|
|
12787
|
+
}
|
|
12788
|
+
}
|
|
12674
12789
|
return baseline;
|
|
12675
12790
|
}
|
|
12676
12791
|
#get(id) {
|
|
@@ -12761,7 +12876,7 @@ data: ${JSON.stringify({
|
|
|
12761
12876
|
if (view.dirty && this.#current(connection, view)) {
|
|
12762
12877
|
view.dirty = false;
|
|
12763
12878
|
const captured = await captureResourceProjection(this.deps.client, this.deps.identity, async () => {
|
|
12764
|
-
const payload = await this.deps.project(view.descriptor, view.controller.signal);
|
|
12879
|
+
const payload = view.descriptor.resource === "activity" ? await this.activity(view.controller.signal, { connection, view }) : await this.deps.project(view.descriptor, view.controller.signal);
|
|
12765
12880
|
const delta = view.descriptor.resource === "messages" && view.payload !== void 0 ? await messageProjectionDelta(
|
|
12766
12881
|
this.deps.client,
|
|
12767
12882
|
view.payload,
|
|
@@ -21307,7 +21422,7 @@ function resourceService(deps) {
|
|
|
21307
21422
|
identity: deps.config.identity,
|
|
21308
21423
|
identityCid: deps.identityCid,
|
|
21309
21424
|
stateDir: deps.config.stateDir,
|
|
21310
|
-
project: (descriptor, signal) => projectResourceView(deps, descriptor, signal)
|
|
21425
|
+
project: (descriptor, signal, source) => projectResourceView(deps, descriptor, signal, source)
|
|
21311
21426
|
});
|
|
21312
21427
|
resourceConnections.set(deps, service);
|
|
21313
21428
|
}
|
|
@@ -21516,6 +21631,7 @@ function publicFetchedFiles(value) {
|
|
|
21516
21631
|
function presentContacts(value) {
|
|
21517
21632
|
return {
|
|
21518
21633
|
...value,
|
|
21634
|
+
capabilities: { canonicalPeerReads: 1 },
|
|
21519
21635
|
contacts: value.contacts.map((contact) => ({
|
|
21520
21636
|
...contact,
|
|
21521
21637
|
display_name: contactDisplayName(contact.name)
|
|
@@ -21531,6 +21647,51 @@ async function resolveContact(client, contact) {
|
|
|
21531
21647
|
const row = contacts.contacts.find((item) => item.container_id === contact || item.name === contact);
|
|
21532
21648
|
return { cid: row?.container_id ?? contact, announcedName: row?.name ?? contact };
|
|
21533
21649
|
}
|
|
21650
|
+
function canonicalPeer(cid) {
|
|
21651
|
+
if (!/^[a-f0-9]{64}$/i.test(cid)) throw bad("peer CID must be exactly 64 hexadecimal characters");
|
|
21652
|
+
return { kind: "cid", cid };
|
|
21653
|
+
}
|
|
21654
|
+
async function projectConversationPage(client, contact, query, pin) {
|
|
21655
|
+
if (pin && [...query.keys()].some((key) => !["before", "limit", "preview"].includes(key) || query.getAll(key).length !== 1))
|
|
21656
|
+
throw bad("invalid peer page query");
|
|
21657
|
+
const previews = query.getAll("preview");
|
|
21658
|
+
if (previews.length > 1 || previews.length === 1 && previews[0] !== "none") {
|
|
21659
|
+
throw bad("preview must be omitted or exactly none");
|
|
21660
|
+
}
|
|
21661
|
+
const omitPreview = !!pin || previews.length === 1;
|
|
21662
|
+
const rawLimit = query.get("limit");
|
|
21663
|
+
const limit = rawLimit === null ? DEFAULT_PAGE_LIMIT : Number(rawLimit);
|
|
21664
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 200) {
|
|
21665
|
+
throw new ConversationPageError(`limit must be an integer in 1..200, got ${String(rawLimit)}`);
|
|
21666
|
+
}
|
|
21667
|
+
const peer = pin ? { cid: pin.cid, announcedName: "" } : await resolveContact(client, contact);
|
|
21668
|
+
const before = beforeSequence(query.get("before") ?? void 0);
|
|
21669
|
+
const [history, summary, newest] = await Promise.all([
|
|
21670
|
+
client.listHistory({ peer_cid: peer.cid, before_seq: before, limit }),
|
|
21671
|
+
client.getHistorySummary({ peer_cid: peer.cid }),
|
|
21672
|
+
before === void 0 || omitPreview ? Promise.resolve(null) : client.listHistory({ peer_cid: peer.cid, limit: 1 })
|
|
21673
|
+
]);
|
|
21674
|
+
const projected = projectHistoryPage(contact, history, summary, {
|
|
21675
|
+
announcedContact: peer.announcedName,
|
|
21676
|
+
...omitPreview ? { preview: false } : {}
|
|
21677
|
+
});
|
|
21678
|
+
return {
|
|
21679
|
+
...projected,
|
|
21680
|
+
...newest ? { preview: projectHistoryPage(contact, newest, summary, { announcedContact: peer.announcedName }).preview } : {},
|
|
21681
|
+
...pin ? { peer: pin } : {}
|
|
21682
|
+
};
|
|
21683
|
+
}
|
|
21684
|
+
async function markPeerRead(client, contact, cid) {
|
|
21685
|
+
const unread = (await client.listIncomingMessages()).filter((row) => row.from.id === cid);
|
|
21686
|
+
let marked = 0;
|
|
21687
|
+
for (let offset = 0; offset < unread.length; offset += 200) {
|
|
21688
|
+
const wireIds = unread.slice(offset, offset + 200).map((row) => row.wire_id);
|
|
21689
|
+
if (wireIds.length === 0) continue;
|
|
21690
|
+
const result = await client.getMessages({ wire_ids: wireIds });
|
|
21691
|
+
marked += result.messages.length;
|
|
21692
|
+
}
|
|
21693
|
+
return { contact, marked };
|
|
21694
|
+
}
|
|
21534
21695
|
function beforeSequence(raw) {
|
|
21535
21696
|
if (raw === void 0) return void 0;
|
|
21536
21697
|
const value = Number(raw);
|
|
@@ -21679,12 +21840,13 @@ async function projectCommandResource(client, deps, params) {
|
|
|
21679
21840
|
const peer = await resolveContact(client, params.contact);
|
|
21680
21841
|
return projectCatalog(peer.cid, await client.listContactCommands({ contact: peer.cid }));
|
|
21681
21842
|
}
|
|
21682
|
-
async function projectFilesResource(client, deps, params, signal) {
|
|
21683
|
-
const peer = await resolveContact(client, params.contact);
|
|
21843
|
+
async function projectFilesResource(client, deps, params, signal, pin) {
|
|
21844
|
+
const peer = pin ? { cid: pin.cid } : await resolveContact(client, params.contact);
|
|
21684
21845
|
const files = (await listAllFiles(client, peer.cid, signal, { cid: deps.identityCid, name: deps.config.identity })).reverse();
|
|
21685
21846
|
const versions = /* @__PURE__ */ new Map();
|
|
21686
21847
|
return {
|
|
21687
21848
|
contact: params.contact,
|
|
21849
|
+
...pin ? { peer: pin } : {},
|
|
21688
21850
|
files: files.map((row) => {
|
|
21689
21851
|
const logicalName = row.filename.normalize("NFC").toLocaleLowerCase("en-US");
|
|
21690
21852
|
const version = (versions.get(logicalName) ?? 0) + 1;
|
|
@@ -21696,7 +21858,7 @@ async function projectFilesResource(client, deps, params, signal) {
|
|
|
21696
21858
|
})
|
|
21697
21859
|
};
|
|
21698
21860
|
}
|
|
21699
|
-
async function projectResourceView(deps, input, signal) {
|
|
21861
|
+
async function projectResourceView(deps, input, signal, source) {
|
|
21700
21862
|
const descriptor = canonicalResourceDescriptor(input), client = deps.runtime.client;
|
|
21701
21863
|
signal.throwIfAborted();
|
|
21702
21864
|
switch (descriptor.resource) {
|
|
@@ -21705,13 +21867,22 @@ async function projectResourceView(deps, input, signal) {
|
|
|
21705
21867
|
case "identity":
|
|
21706
21868
|
return projectIdentityResource(client, deps);
|
|
21707
21869
|
case "files":
|
|
21708
|
-
return projectFilesResource(
|
|
21870
|
+
return projectFilesResource(
|
|
21871
|
+
client,
|
|
21872
|
+
deps,
|
|
21873
|
+
{ contact: descriptor.entityId },
|
|
21874
|
+
signal,
|
|
21875
|
+
descriptor.addressing === "cid" ? canonicalPeer(descriptor.entityId) : void 0
|
|
21876
|
+
);
|
|
21709
21877
|
case "commands":
|
|
21710
21878
|
return projectCommandResource(client, deps, { contact: descriptor.entityId });
|
|
21879
|
+
case "activity":
|
|
21880
|
+
return projectActivity(client, signal, source);
|
|
21711
21881
|
case "messages": {
|
|
21712
|
-
const
|
|
21713
|
-
const
|
|
21714
|
-
|
|
21882
|
+
const pin = descriptor.addressing === "cid" ? canonicalPeer(descriptor.entityId) : void 0;
|
|
21883
|
+
const peer = pin ? { cid: pin.cid, announcedName: "" } : await resolveContact(client, descriptor.entityId);
|
|
21884
|
+
const page = await projectMessageWindow(client, peer.cid, peer.announcedName, descriptor.window, signal, pin ? { preview: false } : {});
|
|
21885
|
+
return { ...page, contact: descriptor.entityId, ...pin ? { peer: pin } : {} };
|
|
21715
21886
|
}
|
|
21716
21887
|
}
|
|
21717
21888
|
}
|
|
@@ -21897,30 +22068,13 @@ var ROUTES = {
|
|
|
21897
22068
|
}).messages
|
|
21898
22069
|
};
|
|
21899
22070
|
},
|
|
21900
|
-
"GET /api/conversations/:contact/page": async ({ client, params, query }) =>
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
}
|
|
21907
|
-
const peer = await resolveContact(client, contact);
|
|
21908
|
-
const before = beforeSequence(query.get("before") ?? void 0);
|
|
21909
|
-
const [history, summary, newest] = await Promise.all([
|
|
21910
|
-
client.listHistory({
|
|
21911
|
-
peer_cid: peer.cid,
|
|
21912
|
-
before_seq: before,
|
|
21913
|
-
limit
|
|
21914
|
-
}),
|
|
21915
|
-
client.getHistorySummary({ peer_cid: peer.cid }),
|
|
21916
|
-
before === void 0 ? Promise.resolve(null) : client.listHistory({ peer_cid: peer.cid, limit: 1 })
|
|
21917
|
-
]);
|
|
21918
|
-
const projected = projectHistoryPage(contact, history, summary, { announcedContact: peer.announcedName });
|
|
21919
|
-
if (!newest) return projected;
|
|
21920
|
-
return {
|
|
21921
|
-
...projected,
|
|
21922
|
-
preview: projectHistoryPage(contact, newest, summary, { announcedContact: peer.announcedName }).preview
|
|
21923
|
-
};
|
|
22071
|
+
"GET /api/conversations/:contact/page": async ({ client, params, query }) => projectConversationPage(client, params.contact, query),
|
|
22072
|
+
// Distinct strict paths fail before mutation on an older service; never alias-fallback.
|
|
22073
|
+
"GET /api/peers/:cid/page": async ({ client, params, query }) => projectConversationPage(client, params.cid, query, canonicalPeer(params.cid)),
|
|
22074
|
+
"GET /api/peers/:cid/files": async ({ client, deps, params }) => projectFilesResource(client, deps, { contact: params.cid }, void 0, canonicalPeer(params.cid)),
|
|
22075
|
+
"POST /api/peers/:cid/read": async ({ client, params }) => {
|
|
22076
|
+
const peer = canonicalPeer(params.cid);
|
|
22077
|
+
return { ...await markPeerRead(client, peer.cid, peer.cid), peer };
|
|
21924
22078
|
},
|
|
21925
22079
|
"GET /api/conversations/:contact/receipts": async ({ client, params }) => {
|
|
21926
22080
|
const peer = await resolveContact(client, params.contact);
|
|
@@ -21941,15 +22095,7 @@ var ROUTES = {
|
|
|
21941
22095
|
// THE HUMAN READ EVENT. The only thing in this server that emits a read receipt.
|
|
21942
22096
|
"POST /api/conversations/:contact/read": async ({ client, params }) => {
|
|
21943
22097
|
const peer = await resolveContact(client, params.contact);
|
|
21944
|
-
|
|
21945
|
-
let marked = 0;
|
|
21946
|
-
for (let offset = 0; offset < unread.length; offset += 200) {
|
|
21947
|
-
const wireIds = unread.slice(offset, offset + 200).map((row) => row.wire_id);
|
|
21948
|
-
if (wireIds.length === 0) continue;
|
|
21949
|
-
const result = await client.getMessages({ wire_ids: wireIds });
|
|
21950
|
-
marked += result.messages.length;
|
|
21951
|
-
}
|
|
21952
|
-
return { contact: params.contact, marked };
|
|
22098
|
+
return markPeerRead(client, params.contact, peer.cid);
|
|
21953
22099
|
},
|
|
21954
22100
|
// The non-consuming inbox summary. Metadata only — it does NOT hand over bodies
|
|
21955
22101
|
// and does NOT mark anything, so it is safe for a frontend in a way getMessages
|
|
@@ -21957,6 +22103,12 @@ var ROUTES = {
|
|
|
21957
22103
|
"GET /api/messages/incoming": async ({ client }) => client.listIncomingMessages(),
|
|
21958
22104
|
// ---- contacts ------------------------------------------------------------
|
|
21959
22105
|
"GET /api/contacts": async ({ client }) => presentContacts(await client.listContacts()),
|
|
22106
|
+
// Last activity per contact for chat-list ordering; no message or file content.
|
|
22107
|
+
"GET /api/activity": async ({ deps, res }) => {
|
|
22108
|
+
const lifetime = new AbortController();
|
|
22109
|
+
res.once("close", () => lifetime.abort());
|
|
22110
|
+
return resourceService(deps).activity(lifetime.signal);
|
|
22111
|
+
},
|
|
21960
22112
|
// The old browser surface called this `listContactRoots`. It is not a separate
|
|
21961
22113
|
// operation: roots ride along on the contacts view.
|
|
21962
22114
|
"GET /api/contacts/roots": async ({ client }) => ({ roots: (await client.listContacts()).roots }),
|
|
@@ -22305,9 +22457,9 @@ async function serveApi(req, res, deps) {
|
|
|
22305
22457
|
const [connectionId, viewId, epoch, baselineId] = resourceHeaders.map((values) => values[0]);
|
|
22306
22458
|
const baseline = await resourceService(deps).bound(connectionId, viewId, Number(epoch), baselineId);
|
|
22307
22459
|
const descriptor = baseline.descriptor;
|
|
22308
|
-
const route = descriptor.resource === "contacts" ? "GET /api/contacts" : descriptor.resource === "identity" ? "GET /api/identity" : descriptor.resource === "commands" ? "GET /api/contacts/:contact/commands" : descriptor.resource === "files" ? "GET /api/conversations/:contact/files" : "GET /api/conversations/:contact/page";
|
|
22460
|
+
const route = descriptor.addressing === "cid" ? descriptor.resource === "files" ? "GET /api/peers/:cid/files" : "GET /api/peers/:cid/page" : descriptor.resource === "contacts" ? "GET /api/contacts" : descriptor.resource === "activity" ? "GET /api/activity" : descriptor.resource === "identity" ? "GET /api/identity" : descriptor.resource === "commands" ? "GET /api/contacts/:contact/commands" : descriptor.resource === "files" ? "GET /api/conversations/:contact/files" : "GET /api/conversations/:contact/page";
|
|
22309
22461
|
const allowedQuery = descriptor.resource === "messages" && [...url.searchParams.keys()].every((key) => key === "limit") && (!url.searchParams.has("limit") || url.searchParams.getAll("limit").length === 1 && Number(url.searchParams.get("limit")) === descriptor.window.limit);
|
|
22310
|
-
if (hit.key !== route || descriptor.entityId !== void 0 && descriptor.entityId !== hit.params.contact || url.searchParams.size > 0 && !allowedQuery) throw new ResourceBindingError(409, "resource read descriptor mismatch");
|
|
22462
|
+
if (hit.key !== route || descriptor.entityId !== void 0 && descriptor.entityId !== (hit.params.cid ?? hit.params.contact) || url.searchParams.size > 0 && !allowedQuery) throw new ResourceBindingError(409, "resource read descriptor mismatch");
|
|
22311
22463
|
res.setHeader("X-Resource-Connection", connectionId);
|
|
22312
22464
|
res.setHeader("X-Resource-View", viewId);
|
|
22313
22465
|
res.setHeader("X-Resource-Epoch", epoch);
|
|
@@ -22356,7 +22508,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
|
|
|
22356
22508
|
// node_modules/@ours.network/sdk/dist/index.js
|
|
22357
22509
|
init_define_MESSENGER_BUILD_INFO();
|
|
22358
22510
|
|
|
22359
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
22511
|
+
// node_modules/@ours.network/sdk/dist/chunk-HQL2UEEU.js
|
|
22360
22512
|
init_define_MESSENGER_BUILD_INFO();
|
|
22361
22513
|
|
|
22362
22514
|
// node_modules/@ours.network/sdk/dist/chunk-GPUVPRIY.js
|
|
@@ -22464,7 +22616,7 @@ var L = 100 * 1024 * 1024;
|
|
|
22464
22616
|
var K = { brokerUrl: "wss://broker1.ours.network", port: 3050, stateDir: E(T(), ".ours"), gcIntervalMs: 36e5, historyMaxBytes: L, apiVisibility: "owner", apiAuthMode: "legacy" };
|
|
22465
22617
|
var $2 = "daemon-token";
|
|
22466
22618
|
|
|
22467
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
22619
|
+
// node_modules/@ours.network/sdk/dist/chunk-HQL2UEEU.js
|
|
22468
22620
|
import { homedir as Te } from "node:os";
|
|
22469
22621
|
import { isAbsolute as Oe, join as Se, resolve as ue } from "node:path";
|
|
22470
22622
|
import { randomBytes as W } from "node:crypto";
|
|
@@ -22643,7 +22795,7 @@ var F = class {
|
|
|
22643
22795
|
if (!h.ok) throw new U(h.status);
|
|
22644
22796
|
if (!h.body || !h.headers.get("content-type")?.startsWith("text/event-stream")) throw new Error("Invalid resource stream response");
|
|
22645
22797
|
l = h.body.getReader(), i.addEventListener("abort", g, { once: true }), i.aborted && g();
|
|
22646
|
-
let T2 = new TextDecoder("utf-8", { fatal: true }), v2 = "", b2 = 0, _ = false,
|
|
22798
|
+
let T2 = new TextDecoder("utf-8", { fatal: true }), v2 = "", b2 = 0, _ = false, A2, O2 = -1;
|
|
22647
22799
|
for (; ; ) {
|
|
22648
22800
|
let { value: ie, done: be } = await l.read();
|
|
22649
22801
|
if (c(), be) throw new Error("Resource stream ended before disposal");
|
|
@@ -22657,16 +22809,16 @@ var F = class {
|
|
|
22657
22809
|
let oe = j.split(/\r?\n/).filter((k) => k.startsWith("data:")).map((k) => k.slice(5).trimStart()).join(`
|
|
22658
22810
|
`);
|
|
22659
22811
|
if (!oe) continue;
|
|
22660
|
-
let
|
|
22812
|
+
let R2 = JSON.parse(oe);
|
|
22661
22813
|
if (c(), j.split(/\r?\n/).some((k) => k === "event: auth_required")) throw new U(401);
|
|
22662
|
-
le(
|
|
22663
|
-
let K2 =
|
|
22814
|
+
le(R2);
|
|
22815
|
+
let K2 = R2.kind;
|
|
22664
22816
|
if (!["ready", "committed", "coverage", "resync"].includes(K2)) throw new Error("Invalid resource frame kind");
|
|
22665
|
-
if (
|
|
22666
|
-
if (
|
|
22817
|
+
if (A2 !== void 0 && (R2.producerGeneration !== A2 || R2.position < O2)) throw new Error("Resource stream continuity changed");
|
|
22818
|
+
if (A2 = R2.producerGeneration, O2 = R2.position, K2 === "ready") _ = true, a(45e3);
|
|
22667
22819
|
else if (_) a(45e3);
|
|
22668
22820
|
else if (K2 !== "resync") throw new Error("Resource mutation before ready");
|
|
22669
|
-
yield
|
|
22821
|
+
yield R2, c();
|
|
22670
22822
|
}
|
|
22671
22823
|
if (Buffer.byteLength(v2) > 512 * 1024) throw new Error("Resource frame exceeds limit");
|
|
22672
22824
|
}
|
|
@@ -22820,6 +22972,9 @@ var F = class {
|
|
|
22820
22972
|
getHistorySummary(t) {
|
|
22821
22973
|
return this.post("getHistorySummary", t);
|
|
22822
22974
|
}
|
|
22975
|
+
getContactActivity() {
|
|
22976
|
+
return this.post("getContactActivity", {});
|
|
22977
|
+
}
|
|
22823
22978
|
listFiles(t = {}) {
|
|
22824
22979
|
return this.post("listFiles", t);
|
|
22825
22980
|
}
|
|
@@ -22943,14 +23098,14 @@ var x = class extends Error {
|
|
|
22943
23098
|
super(`Invalid gateway client profile: ${t}. Configure ~/.ours-client/profile.json with ours-install client; no local service fallback is permitted.`), this.name = "ClientProfileError";
|
|
22944
23099
|
}
|
|
22945
23100
|
};
|
|
22946
|
-
function
|
|
23101
|
+
function Ae(e2 = process.env) {
|
|
22947
23102
|
if (e2.OURS_CONFIG !== void 0) {
|
|
22948
23103
|
if (!e2.OURS_CONFIG.trim()) throw new x("OURS_CONFIG must name a client profile");
|
|
22949
23104
|
return ue(e2.OURS_CONFIG);
|
|
22950
23105
|
}
|
|
22951
23106
|
return Se(e2.HOME || Te(), ".ours-client", "profile.json");
|
|
22952
23107
|
}
|
|
22953
|
-
function
|
|
23108
|
+
function Re(e2) {
|
|
22954
23109
|
let t = (o) => {
|
|
22955
23110
|
throw new x(o);
|
|
22956
23111
|
};
|
|
@@ -22973,13 +23128,13 @@ function Ae(e2) {
|
|
|
22973
23128
|
return typeof n.expectedInstanceId != "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n.expectedInstanceId) ? t("expectedInstanceId must be a lowercase UUID") : typeof n.credentialPath != "string" || !Oe(n.credentialPath) || ue(n.credentialPath) !== n.credentialPath ? t("credentialPath must be an absolute normalized path") : Object.freeze({ serverUrl: r, endpoint: i, expectedInstanceId: n.expectedInstanceId, credentialPath: n.credentialPath });
|
|
22974
23129
|
}
|
|
22975
23130
|
function pe(e2 = process.env) {
|
|
22976
|
-
let t =
|
|
23131
|
+
let t = Ae(e2), n;
|
|
22977
23132
|
try {
|
|
22978
23133
|
n = JSON.parse(m(t).toString("utf8"));
|
|
22979
23134
|
} catch {
|
|
22980
23135
|
throw new x("selected profile is missing, invalid JSON or unsafe; require a 0700 directory and a 0600 regular file");
|
|
22981
23136
|
}
|
|
22982
|
-
let r =
|
|
23137
|
+
let r = Re(n);
|
|
22983
23138
|
if (["OURS_PORT", "OURS_STATE_DIR", "OURS_API_TOKEN", "OURS_DAEMON_ID", "OURS_DAEMON_URL", "OURS_DAEMON_CREDENTIAL_PATH"].some((o) => e2[o]?.trim())) throw new x("remove legacy OURS_PORT/STATE_DIR/API_TOKEN/DAEMON_ID/DAEMON_URL/DAEMON_CREDENTIAL_PATH environment selectors");
|
|
22984
23139
|
return Object.freeze({ ...r, configPath: t });
|
|
22985
23140
|
}
|
|
@@ -23143,8 +23298,8 @@ async function Q(e2 = {}) {
|
|
|
23143
23298
|
{
|
|
23144
23299
|
let b2 = await globalThis.fetch(p(h, "/selection"), { signal: s ? AbortSignal.any([s, AbortSignal.timeout(5e3)]) : AbortSignal.timeout(5e3), redirect: "error" }), _ = await C(b2);
|
|
23145
23300
|
if (!b2.ok || !_ || Object.keys(_).length !== 3 || Object.keys(_).some((O2) => !["schema", "instanceId", "capabilities"].includes(O2)) || _.schema !== 1 || _.instanceId !== a) throw new Error("Daemon instance selection metadata is absent, incompatible or mismatched");
|
|
23146
|
-
let
|
|
23147
|
-
if (!Array.isArray(
|
|
23301
|
+
let A2 = _.capabilities;
|
|
23302
|
+
if (!Array.isArray(A2) || A2.some((O2) => typeof O2 != "string") || T2.some((O2) => !A2.includes(O2))) throw new Error("Daemon does not support the required capabilities; refusing local-mode fallback");
|
|
23148
23303
|
}
|
|
23149
23304
|
let v2 = l === void 0 ? y2 : S(l);
|
|
23150
23305
|
if (typeof v2 != "string" || !v2.trim()) throw new Error("Instance selection requires an explicit API token after daemon verification");
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
normalizeBasePath,
|
|
8
8
|
operatorError,
|
|
9
9
|
reportFailure
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-DILYQTFT.js";
|
|
11
11
|
|
|
12
12
|
// src/cli.ts
|
|
13
13
|
init_define_MESSENGER_BUILD_INFO();
|
|
@@ -131,7 +131,7 @@ async function main() {
|
|
|
131
131
|
}
|
|
132
132
|
if (process.argv.length !== 3) throw new ConfigurationError("serve does not accept command-line options");
|
|
133
133
|
const cfg = loadConfig();
|
|
134
|
-
const { start } = await import("./chunks/server-
|
|
134
|
+
const { start } = await import("./chunks/server-U75YZIHR.js");
|
|
135
135
|
const handle = await start(cfg, BUILD_INFO);
|
|
136
136
|
let closing = false;
|
|
137
137
|
const shutdown = (signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/messenger-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Self-hosted Messenger REST/SSE backend for one identity on a shared Ours daemon.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|
|
@@ -33,22 +33,22 @@
|
|
|
33
33
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
34
|
"test:startup": "node --import tsx tests/startup-readiness.test.mjs",
|
|
35
35
|
"test:runtime-catalog-candidate": "node --import tsx tests/runtime-command-catalog-reopen-e2e.test.mjs",
|
|
36
|
-
"test:offline": "for f in tests/resource-views.test.mjs tests/resource-connections.test.mjs tests/resource-http.test.mjs tests/workspace-profile-preservation.test.mjs tests/notification-producer.test.mjs tests/notification-contact-retirement.test.mjs tests/notification-outbox-contract.test.mjs tests/workspace-root-retirement.test.mjs tests/base-path.test.mjs tests/build-epoch.test.mjs tests/owner-session.test.mjs tests/v1-runtime.test.mjs tests/typed-commands-core.test.mjs tests/shared-daemon-contract.test.mjs tests/room-envelope-matrix.test.mjs tests/bundle-smoke.test.mjs tests/build-metadata.test.mjs tests/production-security.test.mjs tests/conversation-page.test.mjs tests/media-response.test.mjs tests/html-preview-transform.test.mjs tests/html-preview-response.test.mjs tests/push-store.test.mjs tests/push-store-hardening.test.mjs tests/push-delivery.test.mjs tests/push-queue-saturation.test.mjs tests/events.test.mjs tests/watch-cursor.test.mjs tests/watch-reconcile.test.mjs tests/introduction-send-guard.test.mjs tests/sse-e2e.test.mjs tests/presence.test.mjs tests/static-hosting.test.mjs tests/room-preview.test.mjs; do echo \"# $f\"; node --import tsx \"$f\" || exit 1; done",
|
|
36
|
+
"test:offline": "for f in tests/resource-views.test.mjs tests/resource-connections.test.mjs tests/resource-http.test.mjs tests/resource-activity.test.mjs tests/workspace-profile-preservation.test.mjs tests/notification-producer.test.mjs tests/notification-contact-retirement.test.mjs tests/notification-outbox-contract.test.mjs tests/workspace-root-retirement.test.mjs tests/base-path.test.mjs tests/build-epoch.test.mjs tests/owner-session.test.mjs tests/v1-runtime.test.mjs tests/typed-commands-core.test.mjs tests/shared-daemon-contract.test.mjs tests/room-envelope-matrix.test.mjs tests/bundle-smoke.test.mjs tests/build-metadata.test.mjs tests/production-security.test.mjs tests/conversation-page.test.mjs tests/conversation-preview-option.test.mjs tests/canonical-peer-reads.test.mjs tests/media-response.test.mjs tests/html-preview-transform.test.mjs tests/html-preview-response.test.mjs tests/push-store.test.mjs tests/push-store-hardening.test.mjs tests/push-delivery.test.mjs tests/push-queue-saturation.test.mjs tests/events.test.mjs tests/watch-cursor.test.mjs tests/watch-reconcile.test.mjs tests/introduction-send-guard.test.mjs tests/sse-e2e.test.mjs tests/presence.test.mjs tests/static-hosting.test.mjs tests/room-preview.test.mjs; do echo \"# $f\"; node --import tsx \"$f\" || exit 1; done",
|
|
37
37
|
"test:loopback": "for f in tests/shared-daemon-e2e.test.mjs tests/typed-command-loopback-e2e.test.mjs tests/introduction-send.test.mjs tests/rest-e2e.test.mjs; do echo \"# $f\"; node --import tsx \"$f\" || exit 1; done",
|
|
38
38
|
"test": "npm run build && npm run test:startup && npm run test:offline && npm run test:loopback",
|
|
39
39
|
"test:resource-daemon": "node --import tsx tests/resource-daemon.test.mjs",
|
|
40
|
-
"test:resources": "node --import tsx tests/resource-views.test.mjs && node --import tsx tests/resource-connections.test.mjs && node --import tsx tests/resource-http.test.mjs"
|
|
40
|
+
"test:resources": "node --import tsx tests/resource-views.test.mjs && node --import tsx tests/resource-connections.test.mjs && node --import tsx tests/resource-http.test.mjs && node --import tsx tests/resource-activity.test.mjs"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@eslint-community/regexpp": "4.12.2",
|
|
44
|
-
"@ours.network/sdk": "5.
|
|
44
|
+
"@ours.network/sdk": "5.1.0",
|
|
45
45
|
"parse5": "^8.0.1",
|
|
46
46
|
"web-push": "^3.6.7",
|
|
47
47
|
"ws": "^8.21.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@ours.network/cli": "4.0.
|
|
51
|
-
"@ours.network/daemon": "5.0.
|
|
50
|
+
"@ours.network/cli": "4.0.1",
|
|
51
|
+
"@ours.network/daemon": "5.0.1",
|
|
52
52
|
"@playwright/test": "^1.62.1",
|
|
53
53
|
"@types/node": "^20.14.0",
|
|
54
54
|
"@types/web-push": "^3.6.4",
|