@wirecat/cli-core 0.378.0 → 0.379.0
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/CHANGELOG.md +21 -0
- package/dist/cli/envelope.d.ts +10 -0
- package/dist/cli/list-query.js +2 -2
- package/dist/cli/meeting-preparation-read.js +5 -5
- package/dist/cli/meeting-series-inventory-read.js +3 -4
- package/dist/cli/messenger/contacts-command.js +1 -1
- package/dist/cli/messenger/stats-command.js +3 -1
- package/dist/domain/moment.d.ts +8 -0
- package/dist/domain/moment.js +14 -0
- package/dist/domain/send-time.d.ts +2 -2
- package/dist/domain/send-time.js +4 -3
- package/dist/entities/account-session.d.ts +2 -2
- package/dist/entities/admin-report.d.ts +8 -8
- package/dist/entities/agenda.d.ts +12 -12
- package/dist/entities/chat-event.d.ts +1 -1
- package/dist/entities/chat-stats.d.ts +5 -5
- package/dist/entities/chat.d.ts +4 -4
- package/dist/entities/contact-note.d.ts +2 -2
- package/dist/entities/contact.d.ts +13 -13
- package/dist/entities/conversation.d.ts +3 -3
- package/dist/entities/counter-reading.d.ts +1 -1
- package/dist/entities/counters.d.ts +2 -2
- package/dist/entities/document.d.ts +2 -2
- package/dist/entities/evidence.d.ts +72 -72
- package/dist/entities/fact.d.ts +3 -3
- package/dist/entities/fields.d.ts +3 -1
- package/dist/entities/fields.js +2 -0
- package/dist/entities/hit.d.ts +1 -1
- package/dist/entities/index.d.ts +216 -215
- package/dist/entities/index.js +1 -0
- package/dist/entities/invite-link.d.ts +1 -1
- package/dist/entities/job.d.ts +2 -2
- package/dist/entities/join-request.d.ts +1 -1
- package/dist/entities/meeting-communications.d.ts +4 -4
- package/dist/entities/meeting-findings.d.ts +2 -2
- package/dist/entities/meeting-preparation-parts.d.ts +9 -9
- package/dist/entities/meeting-preparation.d.ts +23 -23
- package/dist/entities/meeting-series-inventory.d.ts +3 -3
- package/dist/entities/member.d.ts +3 -3
- package/dist/entities/memory.d.ts +3 -3
- package/dist/entities/message.d.ts +6 -6
- package/dist/entities/note.d.ts +3 -3
- package/dist/entities/official-stats.d.ts +2 -2
- package/dist/entities/poll-vote.d.ts +1 -1
- package/dist/entities/ranking.d.ts +2 -2
- package/dist/entities/relationship.d.ts +1 -1
- package/dist/entities/retention.d.ts +4 -4
- package/dist/entities/saved-search.d.ts +2 -2
- package/dist/entities/tagging.d.ts +1 -1
- package/dist/entities/task.d.ts +7 -7
- package/dist/entities/topic.d.ts +2 -2
- package/dist/mcp/tools/stats.js +3 -1
- package/dist/meetings/answers.d.ts +14 -14
- package/dist/meetings/cli/index.js +7 -4
- package/dist/meetings/cli/search.js +11 -13
- package/dist/meetings/item.d.ts +4 -4
- package/dist/meetings/project-evidence-answer.d.ts +3 -3
- package/dist/services/admin-statistics.js +2 -2
- package/dist/services/moment.d.ts +4 -2
- package/dist/services/moment.js +13 -4
- package/dist/store/sqlite/facts.js +2 -1
- package/package.json +3 -3
|
@@ -18,7 +18,7 @@ export declare const meetingHit: v.StrictObjectSchema<{
|
|
|
18
18
|
readonly source: v.OptionalSchema<v.StrictObjectSchema<{
|
|
19
19
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
20
20
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
21
|
-
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
21
|
+
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
22
22
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
23
23
|
}, undefined>, undefined>;
|
|
24
24
|
}, undefined>;
|
|
@@ -29,8 +29,8 @@ export declare const meetingTranscript: v.StrictObjectSchema<{
|
|
|
29
29
|
readonly source: v.StringSchema<undefined>;
|
|
30
30
|
readonly language: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
31
31
|
/** When a newer transcript of the same source replaced it; `meetings transcript --history` shows those too. */
|
|
32
|
-
readonly superseded_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
33
|
-
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
32
|
+
readonly superseded_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
33
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
34
34
|
readonly lines: v.ArraySchema<v.StrictObjectSchema<{
|
|
35
35
|
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
36
36
|
readonly offset_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -53,8 +53,8 @@ export declare const meetingSummary: v.StrictObjectSchema<{
|
|
|
53
53
|
readonly next_steps: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
54
54
|
readonly content: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
55
55
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
56
|
-
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
57
|
-
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
56
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
57
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
58
58
|
}, undefined>;
|
|
59
59
|
/** `meetings show`: the meeting with who took part, what was said in its chat, and what it holds. */
|
|
60
60
|
export declare const meetingDetails: v.StrictObjectSchema<{
|
|
@@ -66,13 +66,13 @@ export declare const meetingDetails: v.StrictObjectSchema<{
|
|
|
66
66
|
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
67
67
|
readonly location: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
68
68
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
69
|
-
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
70
|
-
readonly ended_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
69
|
+
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
70
|
+
readonly ended_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
71
71
|
readonly duration_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
72
72
|
readonly timezone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
73
73
|
readonly participants_count: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
74
|
-
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
75
|
-
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
74
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
75
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
76
76
|
/** The stored event and series it belongs to, as `meetings_list` takes them. */
|
|
77
77
|
readonly event_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
78
78
|
readonly series_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -81,8 +81,8 @@ export declare const meetingDetails: v.StrictObjectSchema<{
|
|
|
81
81
|
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
82
82
|
readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
83
83
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
-
readonly joined_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
85
|
-
readonly left_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
84
|
+
readonly joined_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
85
|
+
readonly left_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
86
86
|
readonly duration_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
87
87
|
}, undefined>, undefined>;
|
|
88
88
|
readonly transcripts: v.ArraySchema<v.StrictObjectSchema<{
|
|
@@ -92,7 +92,7 @@ export declare const meetingDetails: v.StrictObjectSchema<{
|
|
|
92
92
|
readonly lines_count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
93
93
|
}, undefined>, undefined>;
|
|
94
94
|
readonly chat: v.ArraySchema<v.StrictObjectSchema<{
|
|
95
|
-
readonly sent_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
95
|
+
readonly sent_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
96
96
|
readonly sender: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
97
97
|
readonly recipient: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
98
98
|
readonly text: v.StringSchema<undefined>;
|
|
@@ -110,8 +110,8 @@ export declare const meetingDetails: v.StrictObjectSchema<{
|
|
|
110
110
|
readonly next_steps: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
111
111
|
readonly content: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
112
112
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
113
|
-
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
114
|
-
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
113
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
114
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
115
115
|
}, undefined>, undefined>;
|
|
116
116
|
readonly attachments: v.ArraySchema<v.StrictObjectSchema<{
|
|
117
117
|
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
2
|
-
import { defineQuery, fieldsHelp } from "@wirecat/cli-base/query";
|
|
2
|
+
import { defineQuery, fieldsHelp, timezoneOf, zonedMoment } from "@wirecat/cli-base/query";
|
|
3
3
|
import { InvalidArgumentError, Option } from "commander";
|
|
4
4
|
import { exportMeeting } from "../export.js";
|
|
5
5
|
import { importFiles } from "../import.js";
|
|
@@ -19,9 +19,12 @@ const lookbackDays = (text) => {
|
|
|
19
19
|
return Number(text);
|
|
20
20
|
};
|
|
21
21
|
const date = (text) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
try {
|
|
23
|
+
return zonedMoment(text, timezoneOf(), { start: 0, end: text.length });
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new InvalidArgumentError("expected an ISO date, or a time with or without an offset");
|
|
27
|
+
}
|
|
25
28
|
};
|
|
26
29
|
const LOCAL_READ = { remote: "none", local: "read" };
|
|
27
30
|
const LOCAL_WRITE = { remote: "none", local: "write" };
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { timezoneOf, zonedMoment } from "@wirecat/cli-base/query";
|
|
3
4
|
import { Command } from "commander";
|
|
4
5
|
import { meetingHitsList } from "../answers.js";
|
|
5
6
|
import { validateMeetingHitSearch } from "../search-validation.js";
|
|
6
7
|
export { validateMeetingHitSearch } from "../search-validation.js";
|
|
8
|
+
const moment = (flag, end) => (value) => {
|
|
9
|
+
try {
|
|
10
|
+
return zonedMoment(value, timezoneOf(), { start: 0, end: value.length }, { end });
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
throw new CliError("validation_error", `${flag} takes an ISO date, or a time with or without an offset`);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
7
16
|
const integer = (value) => {
|
|
8
17
|
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
9
18
|
throw new CliError("validation_error", "expected a positive safe integer");
|
|
10
19
|
return Number(value);
|
|
11
20
|
};
|
|
12
|
-
const timestamp = (value) => {
|
|
13
|
-
const parsed = Date.parse(value);
|
|
14
|
-
const date = value.slice(0, 10);
|
|
15
|
-
const day = Date.parse(`${date}T00:00:00Z`);
|
|
16
|
-
if (!/^\d{4}-\d{2}-\d{2}(?:T.+(?:Z|[+-]\d{2}:\d{2}))?$/.test(value) ||
|
|
17
|
-
!Number.isFinite(parsed) ||
|
|
18
|
-
!Number.isFinite(day) ||
|
|
19
|
-
new Date(day).toISOString().slice(0, 10) !== date)
|
|
20
|
-
throw new CliError("validation_error", "meeting search dates require a real ISO date or timestamp with offset");
|
|
21
|
-
return parsed;
|
|
22
|
-
};
|
|
23
21
|
/** Shared grammar without an action: a host with other source reports supplies their transport routing. */
|
|
24
22
|
export const createMeetingSearchCommand = (program) => {
|
|
25
23
|
let search = program.commands.find((command) => command.name() === "search");
|
|
@@ -39,8 +37,8 @@ export const createMeetingSearchCommand = (program) => {
|
|
|
39
37
|
.option("--project <name>", "meetings confirmed in this project, by name, key or alias")
|
|
40
38
|
.option("--tag <name>", "meetings with this tag, by name or alias")
|
|
41
39
|
.option("--topic <name>", "meetings with this topic, by name or alias")
|
|
42
|
-
.option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time",
|
|
43
|
-
.option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time",
|
|
40
|
+
.option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time", moment("--since-time", false))
|
|
41
|
+
.option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time; a date alone covers that whole local day", moment("--until-time", true))
|
|
44
42
|
.option("--limit <n>", "how many hits, 1 through 1000 (default 100)", integer)
|
|
45
43
|
.option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters")
|
|
46
44
|
.option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer);
|
package/dist/meetings/item.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ export declare const meeting: v.StrictObjectSchema<{
|
|
|
11
11
|
readonly location: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
12
12
|
/** The link that joins it. */
|
|
13
13
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
14
|
-
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
15
|
-
readonly ended_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
14
|
+
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
15
|
+
readonly ended_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
16
16
|
readonly duration_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
17
17
|
readonly timezone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
18
18
|
readonly participants_count: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
19
|
-
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
20
|
-
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
19
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
20
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
21
21
|
}, undefined>;
|
|
22
22
|
export type MeetingItem = v.InferOutput<typeof meeting>;
|
|
23
23
|
/** Which provider and account a stored meeting account is, as `MeetingStore.account` answers it. */
|
|
@@ -27,7 +27,7 @@ export declare const meetingProjectEvidence: v.StrictObjectSchema<{
|
|
|
27
27
|
readonly source: v.OptionalSchema<v.StrictObjectSchema<{
|
|
28
28
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
29
29
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
30
|
-
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
30
|
+
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
31
31
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
32
32
|
}, undefined>, undefined>;
|
|
33
33
|
}, undefined>, undefined>;
|
|
@@ -40,8 +40,8 @@ export declare const meetingProjectEvidence: v.StrictObjectSchema<{
|
|
|
40
40
|
readonly tag_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
41
41
|
readonly event_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
42
42
|
readonly series_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
43
|
-
readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
44
|
-
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time
|
|
43
|
+
readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
44
|
+
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
45
45
|
}, undefined>;
|
|
46
46
|
readonly limits: v.StrictObjectSchema<{
|
|
47
47
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -213,10 +213,10 @@ export const adminStatisticsService = (deps) => ({
|
|
|
213
213
|
: duration(query.olderThan ?? "24h", "--older-than"),
|
|
214
214
|
within: query.within === undefined && pinned ? pinned.options.within : duration(query.within ?? "7d", "--within"),
|
|
215
215
|
joinSince: query.sinceTime
|
|
216
|
-
? momentOf(query.sinceTime, "--since-time", cutoff)
|
|
216
|
+
? momentOf(query.sinceTime, "--since-time", cutoff, { zone: prepared.timezone })
|
|
217
217
|
: (pinned?.options.joinSince ?? cutoff - 30 * 86_400_000),
|
|
218
218
|
joinUntil: query.untilTime
|
|
219
|
-
? momentOf(query.untilTime, "--until-time", cutoff)
|
|
219
|
+
? momentOf(query.untilTime, "--until-time", cutoff, { zone: prepared.timezone, end: true })
|
|
220
220
|
: (pinned?.options.joinUntil ?? cutoff),
|
|
221
221
|
minViews: count(query.minViews ?? pinned?.options.minViews ?? 1, "--min-views"),
|
|
222
222
|
maxReplies: count(query.maxReplies ?? pinned?.options.maxReplies ?? 0, "--max-replies"),
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { type MomentZone } from "../domain/moment.js";
|
|
2
|
+
export type { MomentZone };
|
|
1
3
|
/** Shaped like a moment `momentOf` reads, whether or not it is a valid one. */
|
|
2
4
|
export declare const isMoment: (reference: string) => boolean;
|
|
3
5
|
/**
|
|
4
6
|
* `--since` as a moment: ISO 8601, or `30m`, `2h`, `1d` ago. Unlike max-cli, never a message id —
|
|
5
7
|
* a MAX id carries its time, and a Telegram id is only a counter within one chat.
|
|
6
8
|
*/
|
|
7
|
-
export declare const momentOf: (reference: string, flag?: string, now?: number) => number;
|
|
9
|
+
export declare const momentOf: (reference: string, flag?: string, now?: number, at?: MomentZone) => number;
|
|
8
10
|
/**
|
|
9
11
|
* A time ahead, for a due date or the next check: ISO 8601, or `30m`, `2h`, `3d` from now. `none`
|
|
10
12
|
* is not a time; a caller that clears a date checks for it first.
|
|
11
13
|
*/
|
|
12
|
-
export declare const aheadOf: (reference: string, flag: string, now?: number) => number;
|
|
14
|
+
export declare const aheadOf: (reference: string, flag: string, now?: number, at?: MomentZone) => number;
|
package/dist/services/moment.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { calendarMoment } from "../domain/moment.js";
|
|
2
3
|
const AGO = /^(\d+)(m|h|d)$/;
|
|
3
4
|
const AGO_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
|
|
4
5
|
const DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -11,11 +12,15 @@ export const isMoment = (reference) => {
|
|
|
11
12
|
* `--since` as a moment: ISO 8601, or `30m`, `2h`, `1d` ago. Unlike max-cli, never a message id —
|
|
12
13
|
* a MAX id carries its time, and a Telegram id is only a counter within one chat.
|
|
13
14
|
*/
|
|
14
|
-
export const momentOf = (reference, flag = "--since", now = Date.now()) => {
|
|
15
|
+
export const momentOf = (reference, flag = "--since", now = Date.now(), at = {}) => {
|
|
15
16
|
const wanted = reference.trim();
|
|
16
17
|
const [, amount, unit] = AGO.exec(wanted) ?? [];
|
|
17
18
|
// By shape: `Date.parse("12345")` is the year 12345, so a message id would pass as a date.
|
|
18
|
-
const time = amount && unit
|
|
19
|
+
const time = amount && unit
|
|
20
|
+
? now - Number(amount) * (AGO_MS[unit] ?? 0)
|
|
21
|
+
: DATE.test(wanted)
|
|
22
|
+
? calendarMoment(wanted, flag, at)
|
|
23
|
+
: Number.NaN;
|
|
19
24
|
if (Number.isNaN(time)) {
|
|
20
25
|
throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 1d ago — not "${wanted}"`);
|
|
21
26
|
}
|
|
@@ -25,10 +30,14 @@ export const momentOf = (reference, flag = "--since", now = Date.now()) => {
|
|
|
25
30
|
* A time ahead, for a due date or the next check: ISO 8601, or `30m`, `2h`, `3d` from now. `none`
|
|
26
31
|
* is not a time; a caller that clears a date checks for it first.
|
|
27
32
|
*/
|
|
28
|
-
export const aheadOf = (reference, flag, now = Date.now()) => {
|
|
33
|
+
export const aheadOf = (reference, flag, now = Date.now(), at = {}) => {
|
|
29
34
|
const wanted = reference.trim();
|
|
30
35
|
const [, amount, unit] = AGO.exec(wanted) ?? [];
|
|
31
|
-
const time = amount && unit
|
|
36
|
+
const time = amount && unit
|
|
37
|
+
? now + Number(amount) * (AGO_MS[unit] ?? 0)
|
|
38
|
+
: DATE.test(wanted)
|
|
39
|
+
? calendarMoment(wanted, flag, at)
|
|
40
|
+
: Number.NaN;
|
|
32
41
|
if (Number.isNaN(time)) {
|
|
33
42
|
throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 3d from now — not "${wanted}"`);
|
|
34
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { FACT_TYPES, MEMORY_SCOPES } from "../../domain/knowledge.js";
|
|
3
|
+
import { calendarMoment } from "../../domain/moment.js";
|
|
3
4
|
import { linkKind } from "./link-kinds.js";
|
|
4
5
|
import { authorActor, authorOf, evidenceOf, linkEvidence } from "./memories.js";
|
|
5
6
|
import { requiredThing } from "./notes.js";
|
|
@@ -64,7 +65,7 @@ export const factOperationsOver = (context) => {
|
|
|
64
65
|
if (!statement || statement.length > 2000)
|
|
65
66
|
throw new CliError("validation_error", "a fact's statement takes 1–2000 characters");
|
|
66
67
|
const scope = input.scope === undefined ? null : oneOf(input.scope, MEMORY_SCOPES, "a fact's scope");
|
|
67
|
-
const occurredAt = input.occurredAt === undefined ? null :
|
|
68
|
+
const occurredAt = input.occurredAt === undefined ? null : calendarMoment(input.occurredAt, "occurredAt");
|
|
68
69
|
if (occurredAt !== null && !Number.isFinite(occurredAt))
|
|
69
70
|
throw new CliError("validation_error", "occurredAt takes an ISO timestamp");
|
|
70
71
|
if (input.supersedes !== undefined && type !== "decision")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.379.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"@types/node": "^22.20.4",
|
|
203
203
|
"@types/pngjs": "6.0.5",
|
|
204
204
|
"@vitest/coverage-v8": "^5.0.2",
|
|
205
|
-
"@wirecat/cli-base": "0.
|
|
205
|
+
"@wirecat/cli-base": "0.48.0",
|
|
206
206
|
"commander": "15.0.0",
|
|
207
207
|
"cspell": "10.3.6",
|
|
208
208
|
"drizzle-kit": "1.0.0-rc.4",
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
},
|
|
223
223
|
"peerDependencies": {
|
|
224
224
|
"@napi-rs/canvas": ">=0.1.69 <2",
|
|
225
|
-
"@wirecat/cli-base": ">=0.
|
|
225
|
+
"@wirecat/cli-base": ">=0.48.0 <0.49.0",
|
|
226
226
|
"commander": ">=15"
|
|
227
227
|
},
|
|
228
228
|
"bin": {
|