neurastream 0.3.7 → 0.3.8
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/package.json
CHANGED
package/src/core/owner-log.ts
CHANGED
|
@@ -41,6 +41,12 @@ export function newEntryId(atMs: number, rand: (n: number) => Uint8Array = rando
|
|
|
41
41
|
return atMs.toString(36).padStart(9, "0") + Buffer.from(rand(4)).toString("hex");
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// The second an entry id was minted at; undefined for an id that is not in newEntryId's form.
|
|
45
|
+
export function entryIdSec(id: string): number | undefined {
|
|
46
|
+
if (!/^[0-9a-z]{9}[0-9a-f]{8}$/.test(id)) return undefined;
|
|
47
|
+
return Math.floor(Number.parseInt(id.slice(0, 9), 36) / 1000);
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
// The one writer: the recall dir is 0700 and the file 0600, also when they pre-exist looser.
|
|
45
51
|
export function appendJsonLines(file: string, rows: readonly object[]): void {
|
|
46
52
|
const dir = dirname(file);
|
package/src/core/owner-topics.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { join } from "node:path";
|
|
|
7
7
|
import { nowSec } from "./clock.ts";
|
|
8
8
|
import type { Config } from "./config.ts";
|
|
9
9
|
import { tryLock } from "./file-lock.ts";
|
|
10
|
-
import { appendJsonLines, type LogEntry, ownerLogDir, ownerLogFile, readEntries, readLines } from "./owner-log.ts";
|
|
10
|
+
import { appendJsonLines, entryIdSec, type LogEntry, ownerLogDir, ownerLogFile, readEntries, readLines } from "./owner-log.ts";
|
|
11
11
|
import { loadKnownSecrets, redactSecrets } from "./secret-redact.ts";
|
|
12
12
|
|
|
13
13
|
export interface CompleteRequest {
|
|
@@ -143,7 +143,7 @@ function parseRow(line: string): TopicRow | undefined {
|
|
|
143
143
|
if (v === null || typeof v !== "object" || typeof v.from !== "string" || typeof v.to !== "string") return undefined;
|
|
144
144
|
if (typeof v.at !== "number") return undefined;
|
|
145
145
|
if (v.skipped === true) {
|
|
146
|
-
return { from: v.from, to: v.to, at: v.at, skipped: true, why: typeof v.why === "string" ? v.why : "" };
|
|
146
|
+
return { from: v.from, to: v.to, at: entryIdSec(v.from) ?? v.at, skipped: true, why: typeof v.why === "string" ? v.why : "" };
|
|
147
147
|
}
|
|
148
148
|
if (
|
|
149
149
|
typeof v.title !== "string" ||
|
|
@@ -159,7 +159,7 @@ function parseRow(line: string): TopicRow | undefined {
|
|
|
159
159
|
return {
|
|
160
160
|
from: v.from,
|
|
161
161
|
to: v.to,
|
|
162
|
-
at: v.at,
|
|
162
|
+
at: entryIdSec(v.from) ?? v.at,
|
|
163
163
|
open: v.open,
|
|
164
164
|
title: v.title,
|
|
165
165
|
keywords: v.keywords,
|