@unisonlabs/sixminute-admin 0.1.1373-next → 0.1.1374-next
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/sixminute-admin.mjs +38 -18
- package/package.json +1 -1
package/dist/sixminute-admin.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { homedir } from "node:os";
|
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
|
|
23
23
|
// tools/admin/src/build-info.ts
|
|
24
|
-
var BUILT = { version: "0.1.
|
|
24
|
+
var BUILT = { version: "0.1.1374-next", commit: "9508ded0b8ff701d8a4cf49675b35dfa4ba77e92", surface: "20ea8005a02a0df9" };
|
|
25
25
|
|
|
26
26
|
// tools/admin/src/run.ts
|
|
27
27
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -4977,7 +4977,7 @@ var ids = {
|
|
|
4977
4977
|
|
|
4978
4978
|
// packages/contracts/src/analytics/catalogue.ts
|
|
4979
4979
|
var RawArchiveReasonSchema = oneOf(["person", "expired", "signed_out", "tenant_changed", "not_allowed", "refused", "disk_low"]);
|
|
4980
|
-
var TelemetryScreenSchema = oneOf(["day", "timeline", "entry", "settings", "sign_in", "onboarding", "permissions"]);
|
|
4980
|
+
var TelemetryScreenSchema = oneOf(["day", "timeline", "month", "entry", "settings", "sign_in", "onboarding", "permissions"]);
|
|
4981
4981
|
var TelemetryCommandSchema = oneOf([
|
|
4982
4982
|
"new-entry",
|
|
4983
4983
|
"release-all",
|
|
@@ -7906,6 +7906,26 @@ var AdminDemoStatusSchema = exports_external.object({
|
|
|
7906
7906
|
caps: exports_external.object({ calls_per_day: exports_external.number().int(), cost_usd_per_day: exports_external.number() }),
|
|
7907
7907
|
days: exports_external.array(exports_external.object({ day: LocalDaySchema, mode: exports_external.enum(["live", "replay"]), recordings: exports_external.number().int(), entries: exports_external.number().int() }))
|
|
7908
7908
|
});
|
|
7909
|
+
// packages/contracts/src/days/index.ts
|
|
7910
|
+
var DaysQuerySchema = exports_external.object({ from: LocalDaySchema, to: LocalDaySchema });
|
|
7911
|
+
var DaysClientSchema = exports_external.object({
|
|
7912
|
+
client_id: ClientSchema.shape.id.nullable(),
|
|
7913
|
+
name: ClientSchema.shape.name.nullable(),
|
|
7914
|
+
seconds: exports_external.number().int().nonnegative(),
|
|
7915
|
+
released: exports_external.number().int().nonnegative(),
|
|
7916
|
+
drafts: exports_external.number().int().nonnegative(),
|
|
7917
|
+
blocked: exports_external.number().int().nonnegative()
|
|
7918
|
+
});
|
|
7919
|
+
var DaysDaySchema = exports_external.object({
|
|
7920
|
+
day: LocalDaySchema,
|
|
7921
|
+
not_generated_seconds: exports_external.number().int().nonnegative(),
|
|
7922
|
+
clients: exports_external.array(DaysClientSchema)
|
|
7923
|
+
});
|
|
7924
|
+
var DaysReadSchema = exports_external.object({
|
|
7925
|
+
from: LocalDaySchema,
|
|
7926
|
+
to: LocalDaySchema,
|
|
7927
|
+
days: exports_external.array(DaysDaySchema)
|
|
7928
|
+
});
|
|
7909
7929
|
// packages/contracts/src/phone/index.ts
|
|
7910
7930
|
var PHONE_SYNC_MAX_CALLS = 500;
|
|
7911
7931
|
var PHONE_FORGET_MAX = 500;
|
|
@@ -8878,17 +8898,17 @@ function daysOf(run2) {
|
|
|
8878
8898
|
const value = run2.flags.values.get("days");
|
|
8879
8899
|
if (value === undefined)
|
|
8880
8900
|
return;
|
|
8881
|
-
const
|
|
8882
|
-
if (!Number.isInteger(
|
|
8901
|
+
const days2 = Number(value);
|
|
8902
|
+
if (!Number.isInteger(days2) || days2 < 1 || days2 > DEMO_MAX_DAYS)
|
|
8883
8903
|
throw new AdminUsageError(`--days is a whole number from 1 to ${DEMO_MAX_DAYS}, got ${JSON.stringify(value)}`);
|
|
8884
|
-
return
|
|
8904
|
+
return days2;
|
|
8885
8905
|
}
|
|
8886
8906
|
function seedBody(run2) {
|
|
8887
8907
|
const path = required(run2.flags, "scenario", "the scenario file to seed, or a directory of week files with --anchor or --days");
|
|
8888
8908
|
const members = membersOf(run2);
|
|
8889
|
-
const
|
|
8909
|
+
const days2 = daysOf(run2);
|
|
8890
8910
|
const anchor = run2.flags.values.has("anchor") ? dayOf2(run2.flags, "anchor", "the last day of the range") : undefined;
|
|
8891
|
-
const range =
|
|
8911
|
+
const range = days2 !== undefined || anchor !== undefined;
|
|
8892
8912
|
if (!range) {
|
|
8893
8913
|
if (isDirectory(path))
|
|
8894
8914
|
throw new AdminUsageError("a directory of scenarios seeds a range: give --days or --anchor, or name one file");
|
|
@@ -8906,7 +8926,7 @@ function seedBody(run2) {
|
|
|
8906
8926
|
if (scenarios.length === 0)
|
|
8907
8927
|
throw new AdminUsageError(`${path} holds no scenario that names its weekday`);
|
|
8908
8928
|
return {
|
|
8909
|
-
body: { scenarios, ...anchor === undefined ? {} : { anchor }, ...
|
|
8929
|
+
body: { scenarios, ...anchor === undefined ? {} : { anchor }, ...days2 === undefined ? {} : { days: days2 }, replay: true, members },
|
|
8910
8930
|
names: scenarios.map((one) => one.name).join(", ")
|
|
8911
8931
|
};
|
|
8912
8932
|
}
|
|
@@ -9154,10 +9174,10 @@ async function telemetryAlerts(io, project, yes) {
|
|
|
9154
9174
|
await step.write();
|
|
9155
9175
|
return { changes: plan.map((step) => step.change), written: yes && plan.length > 0 };
|
|
9156
9176
|
}
|
|
9157
|
-
async function telemetryCheck(io, project,
|
|
9177
|
+
async function telemetryCheck(io, project, days2) {
|
|
9158
9178
|
const posthog = client(io, project);
|
|
9159
9179
|
const answer = await posthog.call("POST", "/query/", {
|
|
9160
|
-
query: { kind: "HogQLQuery", query: `select event, count() from events where timestamp > now() - interval ${
|
|
9180
|
+
query: { kind: "HogQLQuery", query: `select event, count() from events where timestamp > now() - interval ${days2} day group by event` }
|
|
9161
9181
|
});
|
|
9162
9182
|
const received = new Set((answer?.results ?? []).map(([event]) => event));
|
|
9163
9183
|
const names = new Set(EVENT_KEYS.map((key) => CATALOGUE[key].name));
|
|
@@ -9184,16 +9204,16 @@ async function runTelemetry(subcommand, values, switches, json, io) {
|
|
|
9184
9204
|
return { code: 0, lines: [`project ${project}: every daily cloud event has its alert; nothing to change`] };
|
|
9185
9205
|
return { code: 0, lines: [`project ${project}:`, ...changes.map((line) => ` ${line}`), written ? "written." : "nothing written: run again with --yes to write these."] };
|
|
9186
9206
|
}
|
|
9187
|
-
const
|
|
9188
|
-
if (!Number.isInteger(
|
|
9207
|
+
const days2 = Number(values.get("days") ?? "7");
|
|
9208
|
+
if (!Number.isInteger(days2) || days2 < 1 || days2 > 90)
|
|
9189
9209
|
return { code: 2, lines: ["--days is a whole number of days from 1 to 90"] };
|
|
9190
|
-
const { missing, unknown } = await telemetryCheck(io, project,
|
|
9210
|
+
const { missing, unknown } = await telemetryCheck(io, project, days2);
|
|
9191
9211
|
if (json)
|
|
9192
|
-
return { code: 0, lines: [JSON.stringify({ project, days, missing, unknown }, null, 2)] };
|
|
9212
|
+
return { code: 0, lines: [JSON.stringify({ project, days: days2, missing, unknown }, null, 2)] };
|
|
9193
9213
|
return {
|
|
9194
9214
|
code: missing.length === 0 && unknown.length === 0 ? 0 : 1,
|
|
9195
9215
|
lines: [
|
|
9196
|
-
`project ${project}, the last ${
|
|
9216
|
+
`project ${project}, the last ${days2} days:`,
|
|
9197
9217
|
` not received (${missing.length}): ${missing.join(", ") || "none"}`,
|
|
9198
9218
|
` not in the catalogue (${unknown.length}): ${unknown.join(", ") || "none"}`
|
|
9199
9219
|
]
|
|
@@ -9944,10 +9964,10 @@ async function runShadowReport(run2) {
|
|
|
9944
9964
|
}
|
|
9945
9965
|
async function runRetentionSet(run2) {
|
|
9946
9966
|
const tenantId = required(run2.flags, "tenant", "whose retention");
|
|
9947
|
-
const
|
|
9948
|
-
if (!Number.isInteger(
|
|
9967
|
+
const days2 = Number(required(run2.flags, "days", "how many days after each interval's day its context is kept"));
|
|
9968
|
+
if (!Number.isInteger(days2) || days2 < 1 || days2 > 365)
|
|
9949
9969
|
throw new AdminUsageError("--days is a whole number from 1 to 365.");
|
|
9950
|
-
const done = AdminContextRetentionResultSchema.parse(expectOk(await call(run2.api, "PUT", tenantPath(tenantId, "/context-retention"), { days })));
|
|
9970
|
+
const done = AdminContextRetentionResultSchema.parse(expectOk(await call(run2.api, "PUT", tenantPath(tenantId, "/context-retention"), { days: days2 })));
|
|
9951
9971
|
const moved = Object.entries(done.shifted).map(([table2, rows]) => `${table2} ${rows}`).join(", ");
|
|
9952
9972
|
return render(run2, done, [
|
|
9953
9973
|
`tenant ${done.tenant.id} ${done.tenant.name}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisonlabs/sixminute-admin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1374-next",
|
|
4
4
|
"description": "Sixminute operator tool: the admin commands of the Sixminute API, run with your own operator sign-in.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|