@unisonlabs/sixminute-admin 0.1.1394-next → 0.1.1396-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 +270 -35
- package/package.json +1 -1
package/dist/sixminute-admin.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { homedir } from "node:os";
|
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
21
|
|
|
22
22
|
// tools/admin/src/build-info.ts
|
|
23
|
-
var BUILT = { version: "0.1.
|
|
23
|
+
var BUILT = { version: "0.1.1396-next", commit: "f07ead5d1c1cbdd2f459aa5e7fe7d1b9ac9a75c2", surface: "ac6c731b1016a56b" };
|
|
24
24
|
|
|
25
25
|
// tools/admin/src/run.ts
|
|
26
26
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -5492,7 +5492,12 @@ var CATALOGUE = {
|
|
|
5492
5492
|
run_id: GENERATE.run_id,
|
|
5493
5493
|
day_offset: GENERATE.day_offset,
|
|
5494
5494
|
entries_clipped: count(),
|
|
5495
|
-
attempts: count()
|
|
5495
|
+
attempts: count(),
|
|
5496
|
+
online_calls_by_link: count(),
|
|
5497
|
+
online_calls_by_window: count(),
|
|
5498
|
+
online_calls_by_participants: count(),
|
|
5499
|
+
online_calls_by_nearest_start: count(),
|
|
5500
|
+
online_calls_unmatched: count()
|
|
5496
5501
|
},
|
|
5497
5502
|
wire: { name: "generate.finished" }
|
|
5498
5503
|
}),
|
|
@@ -6837,6 +6842,231 @@ var TeamApplyResultSchema = exports_external.object({
|
|
|
6837
6842
|
confirmation: TeamConfirmationSchema,
|
|
6838
6843
|
connector: ConnectorSummarySchema.nullable()
|
|
6839
6844
|
});
|
|
6845
|
+
// packages/contracts/src/call/note.ts
|
|
6846
|
+
var CallEndSchema = exports_external.enum([
|
|
6847
|
+
"left",
|
|
6848
|
+
"window_closed",
|
|
6849
|
+
"app_closed",
|
|
6850
|
+
"surface_gone",
|
|
6851
|
+
"released_unknown",
|
|
6852
|
+
"lock",
|
|
6853
|
+
"sleep",
|
|
6854
|
+
"capture_stopped",
|
|
6855
|
+
"app_quit",
|
|
6856
|
+
"engine_restart"
|
|
6857
|
+
]);
|
|
6858
|
+
var CallPlatformSchema = exports_external.string().regex(/^[a-z][a-z0-9_]{0,31}$/);
|
|
6859
|
+
var CallInspectionStateSchema = exports_external.enum(["in_call", "no_surface", "window_gone", "unknown", "excluded"]);
|
|
6860
|
+
var CALL_PARTICIPANTS_MAX = 50;
|
|
6861
|
+
var CALL_NAME_MAX = 120;
|
|
6862
|
+
var CALL_TEXT_MAX = 2048;
|
|
6863
|
+
var SpanSchema = exports_external.object({ from: TimestampSchema, to: TimestampSchema });
|
|
6864
|
+
var SeenSchema = (max) => exports_external.object({ value: exports_external.string().min(1).max(max), at: TimestampSchema });
|
|
6865
|
+
var CallAppSchema = exports_external.object({ bundle_id: exports_external.string().min(1).max(CALL_NAME_MAX * 2), name: exports_external.string().min(1).max(CALL_NAME_MAX * 2) });
|
|
6866
|
+
var CallNoteSchema = exports_external.object({
|
|
6867
|
+
call_id: exports_external.string().min(1).max(64),
|
|
6868
|
+
resumes: exports_external.string().min(1).max(64).nullable(),
|
|
6869
|
+
state: exports_external.enum(["open", "closed"]),
|
|
6870
|
+
alive_at: TimestampSchema,
|
|
6871
|
+
started_at: TimestampSchema,
|
|
6872
|
+
ended_at: TimestampSchema.nullable(),
|
|
6873
|
+
end: CallEndSchema.nullable(),
|
|
6874
|
+
app: CallAppSchema,
|
|
6875
|
+
platform: CallPlatformSchema,
|
|
6876
|
+
holders: exports_external.array(exports_external.object({ image: exports_external.string().min(1).max(CALL_NAME_MAX * 2), spans: exports_external.array(SpanSchema).max(500) })).max(32),
|
|
6877
|
+
window_title: exports_external.array(SeenSchema(CALL_TEXT_MAX)).max(50),
|
|
6878
|
+
url: exports_external.array(SeenSchema(CALL_TEXT_MAX)).max(50),
|
|
6879
|
+
meeting_code: exports_external.array(SeenSchema(CALL_NAME_MAX)).max(50),
|
|
6880
|
+
participants: exports_external.array(SeenSchema(CALL_NAME_MAX)).max(CALL_PARTICIPANTS_MAX),
|
|
6881
|
+
inspections: exports_external.array(exports_external.object({ at: TimestampSchema, state: CallInspectionStateSchema, reason: exports_external.string().max(64).nullable(), matched: exports_external.string().max(CALL_NAME_MAX).nullable() })).max(2000),
|
|
6882
|
+
released: exports_external.array(SpanSchema).max(500),
|
|
6883
|
+
camera: exports_external.array(SpanSchema).max(500),
|
|
6884
|
+
build: exports_external.string().max(64),
|
|
6885
|
+
ui_language: exports_external.string().max(32).nullable(),
|
|
6886
|
+
policy_version: exports_external.string().max(64).nullable(),
|
|
6887
|
+
os_version: exports_external.string().max(64).nullable(),
|
|
6888
|
+
cost: exports_external.object({ inspections: exports_external.number().int().nonnegative(), slowest_ms: exports_external.number().int().nonnegative() })
|
|
6889
|
+
}).superRefine((note, ctx) => {
|
|
6890
|
+
if (note.state === "closed" && (note.ended_at === null || note.end === null))
|
|
6891
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: "a closed note names its end" });
|
|
6892
|
+
if (note.state === "open" && (note.ended_at !== null || note.end !== null))
|
|
6893
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: "an open note names no end" });
|
|
6894
|
+
if (note.ended_at !== null && Date.parse(note.ended_at) < Date.parse(note.started_at))
|
|
6895
|
+
ctx.addIssue({ code: "custom", path: ["ended_at"], message: "a call ends at or after its start" });
|
|
6896
|
+
if (Date.parse(note.alive_at) < Date.parse(note.started_at))
|
|
6897
|
+
ctx.addIssue({ code: "custom", path: ["alive_at"], message: "a call is alive at or after its start" });
|
|
6898
|
+
});
|
|
6899
|
+
var ContextCallSchema = exports_external.object({
|
|
6900
|
+
call_id: exports_external.string().min(1).max(64),
|
|
6901
|
+
app: exports_external.string().min(1).max(CALL_NAME_MAX * 2),
|
|
6902
|
+
platform: CallPlatformSchema,
|
|
6903
|
+
window_title: exports_external.string().min(1).max(CALL_TEXT_MAX).nullable(),
|
|
6904
|
+
participants: exports_external.array(exports_external.string().min(1).max(CALL_NAME_MAX)).max(CALL_PARTICIPANTS_MAX),
|
|
6905
|
+
live: exports_external.array(SpanSchema).min(1).max(64)
|
|
6906
|
+
});
|
|
6907
|
+
var CallNoteAnswerSchema = exports_external.object({ call_id: exports_external.string(), stored: exports_external.boolean() });
|
|
6908
|
+
// packages/contracts/src/call/controls.ts
|
|
6909
|
+
var CallControlKindSchema = exports_external.string().regex(/^[a-z][a-z0-9_]{0,31}$/);
|
|
6910
|
+
var Folded = exports_external.string().min(1).max(120).regex(/^[^\p{Lu}\p{Lt}]*$/u, "folded to lower case");
|
|
6911
|
+
var CallControlSchema = exports_external.object({
|
|
6912
|
+
kind: CallControlKindSchema,
|
|
6913
|
+
labels: exports_external.array(Folded),
|
|
6914
|
+
automation_ids: exports_external.array(exports_external.string().min(1).max(120)),
|
|
6915
|
+
starts: exports_external.boolean(),
|
|
6916
|
+
beside: exports_external.array(Folded)
|
|
6917
|
+
});
|
|
6918
|
+
var CallPlatformVocabularySchema = exports_external.object({
|
|
6919
|
+
platform: CallPlatformSchema,
|
|
6920
|
+
apps: exports_external.array(Folded),
|
|
6921
|
+
hosts: exports_external.array(Folded),
|
|
6922
|
+
titles: exports_external.array(Folded),
|
|
6923
|
+
controls: exports_external.array(CallControlSchema),
|
|
6924
|
+
surface: exports_external.array(Folded)
|
|
6925
|
+
});
|
|
6926
|
+
var CallControlsSchema = exports_external.object({
|
|
6927
|
+
version: exports_external.string().min(1),
|
|
6928
|
+
browsers: exports_external.array(Folded),
|
|
6929
|
+
platforms: exports_external.array(CallPlatformVocabularySchema)
|
|
6930
|
+
});
|
|
6931
|
+
var control = (kind, labels, starts, beside = [], automation_ids = []) => ({
|
|
6932
|
+
kind,
|
|
6933
|
+
labels,
|
|
6934
|
+
automation_ids,
|
|
6935
|
+
starts,
|
|
6936
|
+
beside
|
|
6937
|
+
});
|
|
6938
|
+
var CALL_CONTROLS = {
|
|
6939
|
+
version: "2026-11-07.3",
|
|
6940
|
+
browsers: [
|
|
6941
|
+
"com.google.chrome",
|
|
6942
|
+
"com.microsoft.edgemac",
|
|
6943
|
+
"org.mozilla.firefox",
|
|
6944
|
+
"com.apple.safari",
|
|
6945
|
+
"com.brave.browser",
|
|
6946
|
+
"company.thebrowser.browser",
|
|
6947
|
+
"chrome",
|
|
6948
|
+
"msedge",
|
|
6949
|
+
"firefox",
|
|
6950
|
+
"brave"
|
|
6951
|
+
],
|
|
6952
|
+
platforms: [
|
|
6953
|
+
{
|
|
6954
|
+
platform: "teams",
|
|
6955
|
+
apps: ["com.microsoft.teams2", "com.microsoft.teams", "ms-teams", "teams"],
|
|
6956
|
+
hosts: ["teams.microsoft.com", "teams.live.com"],
|
|
6957
|
+
titles: ["microsoft teams"],
|
|
6958
|
+
controls: [
|
|
6959
|
+
control("leave", ["hang up"], true),
|
|
6960
|
+
control("leave", ["leave"], true, ["meeting controls", "calling controls", "meeting chat"]),
|
|
6961
|
+
control("mute", ["mute", "unmute", "mute mic", "unmute mic"], false),
|
|
6962
|
+
control("camera", ["turn camera on", "turn camera off", "camera"], false),
|
|
6963
|
+
control("share", ["share", "share content"], false),
|
|
6964
|
+
control("share", ["stop sharing"], true)
|
|
6965
|
+
],
|
|
6966
|
+
surface: [
|
|
6967
|
+
"hang up",
|
|
6968
|
+
"leave",
|
|
6969
|
+
"meeting controls",
|
|
6970
|
+
"calling controls",
|
|
6971
|
+
"meeting chat",
|
|
6972
|
+
"mute",
|
|
6973
|
+
"unmute",
|
|
6974
|
+
"mute mic",
|
|
6975
|
+
"unmute mic",
|
|
6976
|
+
"turn camera on",
|
|
6977
|
+
"turn camera off",
|
|
6978
|
+
"camera",
|
|
6979
|
+
"share",
|
|
6980
|
+
"share content",
|
|
6981
|
+
"stop sharing",
|
|
6982
|
+
"you're sharing your screen",
|
|
6983
|
+
"join now"
|
|
6984
|
+
]
|
|
6985
|
+
},
|
|
6986
|
+
{
|
|
6987
|
+
platform: "zoom",
|
|
6988
|
+
apps: ["us.zoom.xos", "zoom"],
|
|
6989
|
+
hosts: ["zoom.us", "zoom.com"],
|
|
6990
|
+
titles: ["zoom meeting", "zoom workplace"],
|
|
6991
|
+
controls: [
|
|
6992
|
+
control("leave", ["leave", "leave meeting"], true),
|
|
6993
|
+
control("leave", [], true, ["audio", "video"], ["leave"]),
|
|
6994
|
+
control("end", ["end meeting"], true),
|
|
6995
|
+
control("end", ["end"], true, ["mute", "unmute", "start video", "stop video"]),
|
|
6996
|
+
control("mute", ["mute", "unmute", "mute audio", "unmute audio"], false, [], ["audio"]),
|
|
6997
|
+
control("camera", ["start video", "stop video"], false, [], ["video"]),
|
|
6998
|
+
control("share", ["share screen", "share"], false, [], ["share"]),
|
|
6999
|
+
control("window", [], false, [], ["zm.meeting.window.main"]),
|
|
7000
|
+
control("share", ["stop share"], true),
|
|
7001
|
+
control("share", ["zoom share statusbar window"], true)
|
|
7002
|
+
],
|
|
7003
|
+
surface: [
|
|
7004
|
+
"leave",
|
|
7005
|
+
"leave meeting",
|
|
7006
|
+
"end meeting",
|
|
7007
|
+
"end",
|
|
7008
|
+
"mute",
|
|
7009
|
+
"unmute",
|
|
7010
|
+
"mute audio",
|
|
7011
|
+
"unmute audio",
|
|
7012
|
+
"start video",
|
|
7013
|
+
"stop video",
|
|
7014
|
+
"share screen",
|
|
7015
|
+
"share",
|
|
7016
|
+
"stop share",
|
|
7017
|
+
"zoom share statusbar window",
|
|
7018
|
+
"audio",
|
|
7019
|
+
"video",
|
|
7020
|
+
"zm.meeting.window.main",
|
|
7021
|
+
"participants"
|
|
7022
|
+
]
|
|
7023
|
+
},
|
|
7024
|
+
{
|
|
7025
|
+
platform: "meet",
|
|
7026
|
+
apps: [],
|
|
7027
|
+
hosts: ["meet.google.com"],
|
|
7028
|
+
titles: ["meet - ", "google meet"],
|
|
7029
|
+
controls: [
|
|
7030
|
+
control("leave", ["leave call"], true),
|
|
7031
|
+
control("mute", ["turn off microphone", "turn on microphone"], false),
|
|
7032
|
+
control("camera", ["turn off camera", "turn on camera"], false),
|
|
7033
|
+
control("share", ["present now", "share screen"], false)
|
|
7034
|
+
],
|
|
7035
|
+
surface: [
|
|
7036
|
+
"leave call",
|
|
7037
|
+
"turn off microphone",
|
|
7038
|
+
"turn on microphone",
|
|
7039
|
+
"turn off camera",
|
|
7040
|
+
"turn on camera",
|
|
7041
|
+
"present now",
|
|
7042
|
+
"share screen",
|
|
7043
|
+
"join now",
|
|
7044
|
+
"ask to join"
|
|
7045
|
+
]
|
|
7046
|
+
},
|
|
7047
|
+
{
|
|
7048
|
+
platform: "webex",
|
|
7049
|
+
apps: ["cisco-systems.spark", "com.webex.meetingmanager", "webex", "ciscocollabhost"],
|
|
7050
|
+
hosts: ["webex.com"],
|
|
7051
|
+
titles: ["webex"],
|
|
7052
|
+
controls: [
|
|
7053
|
+
control("leave", ["leave meeting", "leave meeting or end meeting for everyone"], true),
|
|
7054
|
+
control("end", ["end meeting"], true),
|
|
7055
|
+
control("mute", ["mute", "unmute"], false),
|
|
7056
|
+
control("camera", ["start video", "stop video"], false)
|
|
7057
|
+
],
|
|
7058
|
+
surface: ["leave meeting", "leave meeting or end meeting for everyone", "end meeting", "mute", "unmute", "start video", "stop video"]
|
|
7059
|
+
},
|
|
7060
|
+
{
|
|
7061
|
+
platform: "slack",
|
|
7062
|
+
apps: ["com.tinyspeck.slackmacgap", "slack"],
|
|
7063
|
+
hosts: [],
|
|
7064
|
+
titles: [],
|
|
7065
|
+
controls: [control("leave", ["leave huddle"], true), control("end", ["end huddle"], true), control("mute", ["mute", "unmute"], false)],
|
|
7066
|
+
surface: ["leave huddle", "end huddle", "mute", "unmute"]
|
|
7067
|
+
}
|
|
7068
|
+
]
|
|
7069
|
+
};
|
|
6840
7070
|
// packages/contracts/src/capture.ts
|
|
6841
7071
|
var captureSampleFields = exports_external.object({
|
|
6842
7072
|
t: TimestampSchema,
|
|
@@ -6969,6 +7199,7 @@ var DEVICE_ROUTES = [
|
|
|
6969
7199
|
{ method: "POST", path: "/v1/intervals/{from}/context", platforms: DESKTOP_PLATFORMS },
|
|
6970
7200
|
{ method: "POST", path: "/v1/device/signals", platforms: DESKTOP_PLATFORMS },
|
|
6971
7201
|
{ method: "POST", path: "/v1/device/clock", platforms: DESKTOP_PLATFORMS },
|
|
7202
|
+
{ method: "POST", path: "/v1/device/calls", platforms: DESKTOP_PLATFORMS },
|
|
6972
7203
|
{ method: "POST", path: "/v1/recordings/{id}/stop", platforms: DESKTOP_PLATFORMS },
|
|
6973
7204
|
{ method: "POST", path: "/v1/recordings/{id}/clock", platforms: DESKTOP_PLATFORMS },
|
|
6974
7205
|
{ method: "POST", path: "/v1/recordings/{id}/skip", platforms: DESKTOP_PLATFORMS },
|
|
@@ -7005,7 +7236,8 @@ var DevicePolicySchema = exports_external.object({
|
|
|
7005
7236
|
time_zone: exports_external.string().min(1).nullable().default(null),
|
|
7006
7237
|
context_retention_days: exports_external.number().int().nonnegative(),
|
|
7007
7238
|
minimum_version: exports_external.string().nullable(),
|
|
7008
|
-
always_on: FirmAlwaysOnSchema.default("member_choice")
|
|
7239
|
+
always_on: FirmAlwaysOnSchema.default("member_choice"),
|
|
7240
|
+
call_controls: CallControlsSchema.optional()
|
|
7009
7241
|
});
|
|
7010
7242
|
var DEVICE_KNOWN_MAX = 16;
|
|
7011
7243
|
var DeviceKnownHeaderSchema = exports_external.string().transform((value) => [...new Set(value.split(",").map((one) => one.trim()).filter((one) => one !== ""))]).pipe(exports_external.array(DeviceIdSchema).max(DEVICE_KNOWN_MAX));
|
|
@@ -7557,6 +7789,7 @@ var COMPAT_MARKERS = [
|
|
|
7557
7789
|
...markers("row-lock-api", ["services/api/src/features/evidence/retention.ts"]),
|
|
7558
7790
|
...markers("auto-approve-api", ["services/api/src/features/practice/store.ts"]),
|
|
7559
7791
|
...markers("queued-proposal-api", ["services/api/src/features/generate/jobs.ts", "services/api/src/platform/jobs/runner.ts"]),
|
|
7792
|
+
...markers("pre-calendar-version-api", ["packages/client/src/data/queries.ts", "packages/contracts/src/pipeline-status.ts"]),
|
|
7560
7793
|
...markers("pre-lock-page", [
|
|
7561
7794
|
"apps/web/version.ts",
|
|
7562
7795
|
"packages/contracts/src/connector.ts",
|
|
@@ -8266,6 +8499,7 @@ var PipelineRecordingStatusSchema = exports_external.object({
|
|
|
8266
8499
|
var GenerateKnownSpanSchema = exports_external.object({ from: TimestampSchema, to: TimestampSchema, cut: exports_external.boolean(), written: exports_external.boolean() });
|
|
8267
8500
|
var PipelineStatusSchema = exports_external.object({
|
|
8268
8501
|
version: exports_external.number().int().nonnegative(),
|
|
8502
|
+
calendar_version: exports_external.string().nullable().optional(),
|
|
8269
8503
|
recordings: exports_external.array(PipelineRecordingStatusSchema),
|
|
8270
8504
|
deciding: exports_external.object({ recording_id: RecordingIdSchema, from: TimestampSchema, to: TimestampSchema }).nullable(),
|
|
8271
8505
|
generate: exports_external.object({
|
|
@@ -8383,7 +8617,8 @@ var intervalContextBody = {
|
|
|
8383
8617
|
last_end_before: TimestampSchema.nullable(),
|
|
8384
8618
|
first_end_inside: TimestampSchema.nullable()
|
|
8385
8619
|
}),
|
|
8386
|
-
lost: exports_external.array(exports_external.string()).optional()
|
|
8620
|
+
lost: exports_external.array(exports_external.string()).optional(),
|
|
8621
|
+
calls: exports_external.array(ContextCallSchema).max(8).optional()
|
|
8387
8622
|
};
|
|
8388
8623
|
var IntervalContextSchema = exports_external.object({
|
|
8389
8624
|
schema_version: exports_external.literal(2),
|
|
@@ -8804,7 +9039,7 @@ async function send(ctx, token, method, path, body, actingFor) {
|
|
|
8804
9039
|
}
|
|
8805
9040
|
return { status: response.status, body: parsed, actingAs: response.headers.get(ACTING_AS_HEADER) };
|
|
8806
9041
|
}
|
|
8807
|
-
async function
|
|
9042
|
+
async function call2(ctx, method, path, body, actingFor) {
|
|
8808
9043
|
let session = await currentSession(ctx.io, ctx.environment);
|
|
8809
9044
|
let answer = await send(ctx, session.access_token, method, path, body, actingFor);
|
|
8810
9045
|
if (answer.status === 401) {
|
|
@@ -9069,11 +9304,11 @@ async function runDemo(run2, subcommand) {
|
|
|
9069
9304
|
const tenantId = required(run2.flags, "tenant", "which firm, an internal one");
|
|
9070
9305
|
const path = (rest) => tenantPath(tenantId, rest);
|
|
9071
9306
|
if (subcommand === "on" || subcommand === "off") {
|
|
9072
|
-
const { tenant } = AdminDemoFlagSchema.parse(expectOk(await
|
|
9307
|
+
const { tenant } = AdminDemoFlagSchema.parse(expectOk(await call2(run2.api, "PUT", path("/demo"), { enabled: subcommand === "on" })));
|
|
9073
9308
|
return render(run2, { tenant }, [`tenant ${tenant.id} ${tenant.name}`, `demo ${tenant.demo}`]);
|
|
9074
9309
|
}
|
|
9075
9310
|
if (subcommand === "status") {
|
|
9076
|
-
const status = AdminDemoStatusSchema.parse(expectOk(await
|
|
9311
|
+
const status = AdminDemoStatusSchema.parse(expectOk(await call2(run2.api, "GET", path("/demo"))));
|
|
9077
9312
|
return render(run2, status, [
|
|
9078
9313
|
`tenant ${status.tenant.id} ${status.tenant.name} demo ${status.tenant.demo}`,
|
|
9079
9314
|
`member ${status.member_id}`,
|
|
@@ -9083,7 +9318,7 @@ async function runDemo(run2, subcommand) {
|
|
|
9083
9318
|
}
|
|
9084
9319
|
if (subcommand === "seed") {
|
|
9085
9320
|
const { body, names } = seedBody(run2);
|
|
9086
|
-
const done = AdminDemoSeedResultSchema.parse(expectOk(await
|
|
9321
|
+
const done = AdminDemoSeedResultSchema.parse(expectOk(await call2(run2.api, "POST", path("/demo/seed"), body)));
|
|
9087
9322
|
const invited = (done.members ?? []).map((one) => `member ${one.email} ${one.outcome === "invited" ? "invited" : one.outcome === "member" ? "already a member, skipped" : "already invited, skipped"}`);
|
|
9088
9323
|
if (done.range !== undefined) {
|
|
9089
9324
|
return render(run2, done, [
|
|
@@ -9103,10 +9338,10 @@ async function runDemo(run2, subcommand) {
|
|
|
9103
9338
|
if (subcommand === "reset" || subcommand === "remove") {
|
|
9104
9339
|
const day2 = dayOf2(run2.flags, "day", `the seeded day to ${subcommand}`);
|
|
9105
9340
|
if (subcommand === "remove") {
|
|
9106
|
-
const done2 = AdminDemoRemoveResultSchema.parse(expectOk(await
|
|
9341
|
+
const done2 = AdminDemoRemoveResultSchema.parse(expectOk(await call2(run2.api, "POST", path("/demo/remove"), { day: day2 })));
|
|
9107
9342
|
return render(run2, done2, [`removed ${done2.day}: ${done2.recordings_deleted} recordings, ${done2.entries_deleted} entries`]);
|
|
9108
9343
|
}
|
|
9109
|
-
const done = AdminDemoResetResultSchema.parse(expectOk(await
|
|
9344
|
+
const done = AdminDemoResetResultSchema.parse(expectOk(await call2(run2.api, "POST", path("/demo/reset"), { day: day2, generate: switched(run2.flags, "generate") })));
|
|
9110
9345
|
return render(run2, done, [
|
|
9111
9346
|
`reset ${done.day}: ${done.runs_deleted} Generate runs, ${done.drafts_deleted} drafts deleted, ${done.released_kept} released kept`,
|
|
9112
9347
|
...done.generate_run === null ? [] : [`generate ${done.generate_run}`]
|
|
@@ -9126,7 +9361,7 @@ async function runLearning(run2, subcommand) {
|
|
|
9126
9361
|
if (member !== undefined)
|
|
9127
9362
|
query.set("member", member);
|
|
9128
9363
|
if (subcommand === "terms") {
|
|
9129
|
-
const answer = await
|
|
9364
|
+
const answer = await call2(run2.api, "GET", `${tenantPath(tenant, "/learning/terms")}${query.size === 0 ? "" : `?${query}`}`);
|
|
9130
9365
|
if (answer.status !== 200)
|
|
9131
9366
|
return refused(run2, answer, [actingHead(tenant, answer)]);
|
|
9132
9367
|
const { terms } = AdminLearnedTermsSchema.parse(answer.body);
|
|
@@ -9154,7 +9389,7 @@ async function runLearning(run2, subcommand) {
|
|
|
9154
9389
|
throw new AdminUsageError(`--${name} is a date, YYYY-MM-DD, got ${JSON.stringify(value)}`);
|
|
9155
9390
|
query.set(name, value);
|
|
9156
9391
|
}
|
|
9157
|
-
const answer = await
|
|
9392
|
+
const answer = await call2(run2.api, "GET", `${tenantPath(tenant, "/learning/report")}${query.size === 0 ? "" : `?${query}`}`);
|
|
9158
9393
|
if (answer.status !== 200)
|
|
9159
9394
|
return refused(run2, answer, [actingHead(tenant, answer)]);
|
|
9160
9395
|
const report = AdminLearningReportSchema.parse(answer.body);
|
|
@@ -9239,7 +9474,7 @@ function wantedAlerts() {
|
|
|
9239
9474
|
class PosthogError extends Error {
|
|
9240
9475
|
}
|
|
9241
9476
|
function client(io, project) {
|
|
9242
|
-
const
|
|
9477
|
+
const call3 = async (method, path, body) => {
|
|
9243
9478
|
const response = await io.fetchImpl(`${POSTHOG_API}/api/projects/${encodeURIComponent(project)}${path}`, {
|
|
9244
9479
|
method,
|
|
9245
9480
|
headers: { Authorization: `Bearer ${io.posthogKey}`, "Content-Type": "application/json", Accept: "application/json" },
|
|
@@ -9251,9 +9486,9 @@ function client(io, project) {
|
|
|
9251
9486
|
return text === "" ? null : JSON.parse(text);
|
|
9252
9487
|
};
|
|
9253
9488
|
return {
|
|
9254
|
-
call:
|
|
9489
|
+
call: call3,
|
|
9255
9490
|
async list(path) {
|
|
9256
|
-
const page = await
|
|
9491
|
+
const page = await call3("GET", path);
|
|
9257
9492
|
return page?.results ?? [];
|
|
9258
9493
|
}
|
|
9259
9494
|
};
|
|
@@ -9940,7 +10175,7 @@ ${ADMIN_USAGE}`);
|
|
|
9940
10175
|
async function runLogin(run2) {
|
|
9941
10176
|
const { environment, deps } = run2;
|
|
9942
10177
|
const session = await deviceLogin(deps, environment);
|
|
9943
|
-
const probe = await
|
|
10178
|
+
const probe = await call2(run2.api, "GET", "/v1/admin/audit?limit=1").catch((err) => {
|
|
9944
10179
|
if (err instanceof AdminUsageError && /is not an operator's/.test(err.message)) {
|
|
9945
10180
|
deleteSession(deps.configDir, environment.name);
|
|
9946
10181
|
throw new AdminUsageError(`signed in as ${session.email ?? "unknown address"}, but not to the Sixminute operators organisation, so the ` + `sign-in was not kept. ${signInAgain(environment.name)} and choose "Sixminute operators" on the sign-in screen.`);
|
|
@@ -9973,7 +10208,7 @@ async function runFirm(run2, group, subcommand) {
|
|
|
9973
10208
|
const name = required(flags, "name", "a firm has a name, and it becomes the WorkOS organisation's");
|
|
9974
10209
|
const admin2 = required(flags, "admin", "somebody has to be the firm's first admin");
|
|
9975
10210
|
const role = roleOf(flags, "admin");
|
|
9976
|
-
const done = FirmCreateResultSchema.parse(expectOk(await
|
|
10211
|
+
const done = FirmCreateResultSchema.parse(expectOk(await call2(api2, "POST", "/v1/admin/firms", { name, admin_email: admin2, role })));
|
|
9977
10212
|
const { organization, invitation } = done;
|
|
9978
10213
|
return render(run2, done, [
|
|
9979
10214
|
`organization ${organization.id} ${organization.name}`,
|
|
@@ -9985,14 +10220,14 @@ async function runFirm(run2, group, subcommand) {
|
|
|
9985
10220
|
]);
|
|
9986
10221
|
}
|
|
9987
10222
|
if (group === "firm" && subcommand === "list") {
|
|
9988
|
-
const { organizations } = FirmListSchema.parse(expectOk(await
|
|
10223
|
+
const { organizations } = FirmListSchema.parse(expectOk(await call2(api2, "GET", "/v1/admin/firms")));
|
|
9989
10224
|
return render(run2, { organizations }, organizations.length === 0 ? ["no organisations"] : organizations.map((org) => `${org.id} ${org.name}`));
|
|
9990
10225
|
}
|
|
9991
10226
|
if (group === "firm" && subcommand === "invite") {
|
|
9992
10227
|
const organizationId = required(flags, "org", "an invitation names the firm it is to");
|
|
9993
10228
|
const email = required(flags, "email", "an invitation names the address it goes to");
|
|
9994
10229
|
const role = roleOf(flags, "member");
|
|
9995
|
-
const done = FirmInviteResultSchema.parse(expectOk(await
|
|
10230
|
+
const done = FirmInviteResultSchema.parse(expectOk(await call2(api2, "POST", `/v1/admin/firms/${enc2(organizationId)}/invitations`, { email, role })));
|
|
9996
10231
|
const { invitation } = done;
|
|
9997
10232
|
return render(run2, done, [
|
|
9998
10233
|
`invitation ${invitation.id} ${invitation.email} ${invitation.role} expires ${invitation.expires_at}`,
|
|
@@ -10004,12 +10239,12 @@ async function runFirm(run2, group, subcommand) {
|
|
|
10004
10239
|
}
|
|
10005
10240
|
if (group === "firm" && subcommand === "invitations") {
|
|
10006
10241
|
const organizationId = required(flags, "org", "the pending invitations of which firm");
|
|
10007
|
-
const { invitations } = FirmInvitationsSchema.parse(expectOk(await
|
|
10242
|
+
const { invitations } = FirmInvitationsSchema.parse(expectOk(await call2(api2, "GET", `/v1/admin/firms/${enc2(organizationId)}/invitations`)));
|
|
10008
10243
|
return render(run2, { invitations }, invitations.length === 0 ? ["no pending invitations"] : invitations.map((row) => `${row.id} ${row.email} ${row.role} expires ${row.expires_at}`));
|
|
10009
10244
|
}
|
|
10010
10245
|
if (group === "invite" && subcommand === "revoke") {
|
|
10011
10246
|
const id = required(flags, "id", "which invitation to revoke");
|
|
10012
|
-
const done = InvitationRevokedSchema.parse(expectOk(await
|
|
10247
|
+
const done = InvitationRevokedSchema.parse(expectOk(await call2(api2, "DELETE", `/v1/admin/invitations/${enc2(id)}`)));
|
|
10013
10248
|
return render(run2, done, [`revoked ${done.invitation.id} ${done.invitation.email}`]);
|
|
10014
10249
|
}
|
|
10015
10250
|
throw new AdminUsageError(`unknown command ${JSON.stringify([group, subcommand].filter(Boolean).join(" "))}.
|
|
@@ -10017,14 +10252,14 @@ async function runFirm(run2, group, subcommand) {
|
|
|
10017
10252
|
${ADMIN_USAGE}`);
|
|
10018
10253
|
}
|
|
10019
10254
|
var tenantPath = (tenant, rest = "") => `/v1/admin/tenants/${enc2(tenant)}${rest}`;
|
|
10020
|
-
var firmCall = (run2, tenant, method, path, body) =>
|
|
10255
|
+
var firmCall = (run2, tenant, method, path, body) => call2(run2.api, method, path, body, tenant);
|
|
10021
10256
|
async function runTenantList(run2) {
|
|
10022
|
-
const { tenants } = AdminTenantListSchema.parse(expectOk(await
|
|
10257
|
+
const { tenants } = AdminTenantListSchema.parse(expectOk(await call2(run2.api, "GET", "/v1/admin/tenants")));
|
|
10023
10258
|
return render(run2, { tenants }, tenants.length === 0 ? ["no firms"] : tenants.map((t) => `${t.id} ${t.workos_org_id} ${t.security_tier.padEnd(12)} ${t.internal ? "internal " : " "}${t.name}`));
|
|
10024
10259
|
}
|
|
10025
10260
|
async function runTenantShow(run2) {
|
|
10026
10261
|
const tenantId = required(run2.flags, "tenant", "which firm to show");
|
|
10027
|
-
const t = AdminTenantDetailSchema.parse(expectOk(await
|
|
10262
|
+
const t = AdminTenantDetailSchema.parse(expectOk(await call2(run2.api, "GET", tenantPath(tenantId))));
|
|
10028
10263
|
return render(run2, { tenant: t }, [
|
|
10029
10264
|
`tenant ${t.id} ${t.name}`,
|
|
10030
10265
|
`organization ${t.workos_org_id}`,
|
|
@@ -10043,7 +10278,7 @@ async function runTierSet(run2) {
|
|
|
10043
10278
|
if (tier !== "standard" && tier !== "confidential") {
|
|
10044
10279
|
throw new AdminUsageError(`--tier is standard or confidential, got ${JSON.stringify(tier)}`);
|
|
10045
10280
|
}
|
|
10046
|
-
const done = AdminTierResultSchema.parse(expectOk(await
|
|
10281
|
+
const done = AdminTierResultSchema.parse(expectOk(await call2(run2.api, "PUT", tenantPath(tenantId, "/tier"), { tier })));
|
|
10047
10282
|
const tenant = { id: done.tenant.id, name: done.tenant.name, security_tier: done.security_tier };
|
|
10048
10283
|
if (done.security_tier !== "confidential") {
|
|
10049
10284
|
return render(run2, { tenant }, [`tenant ${tenant.id} ${tenant.name}`, `security_tier ${tenant.security_tier}`]);
|
|
@@ -10062,7 +10297,7 @@ async function runTenantInternalSet(run2) {
|
|
|
10062
10297
|
const tenantId = required(run2.flags, "tenant", "which tenant is being marked");
|
|
10063
10298
|
required(run2.flags, "internal", "true or false");
|
|
10064
10299
|
const internal = booleanOf(run2.flags, "internal");
|
|
10065
|
-
const { tenant } = AdminTenantFlagsSchema.parse(expectOk(await
|
|
10300
|
+
const { tenant } = AdminTenantFlagsSchema.parse(expectOk(await call2(run2.api, "PUT", tenantPath(tenantId, "/internal"), { internal })));
|
|
10066
10301
|
return render(run2, { tenant }, [
|
|
10067
10302
|
`tenant ${tenant.id} ${tenant.name}`,
|
|
10068
10303
|
`internal ${tenant.internal}`,
|
|
@@ -10079,7 +10314,7 @@ async function runRawArchive(run2, subcommand) {
|
|
|
10079
10314
|
}
|
|
10080
10315
|
const allow = subcommand === "allow";
|
|
10081
10316
|
const tenantId = required(run2.flags, "tenant", "which tenant the raw archive is being set for");
|
|
10082
|
-
const { tenant } = AdminTenantFlagsSchema.parse(expectOk(await
|
|
10317
|
+
const { tenant } = AdminTenantFlagsSchema.parse(expectOk(await call2(run2.api, "PUT", tenantPath(tenantId, "/raw-archive"), { allowed: allow })));
|
|
10083
10318
|
return render(run2, { tenant: { id: tenant.id, name: tenant.name, raw_archive: tenant.raw_archive } }, [
|
|
10084
10319
|
`tenant ${tenant.id} ${tenant.name}`,
|
|
10085
10320
|
`raw_archive ${tenant.raw_archive}`,
|
|
@@ -10089,7 +10324,7 @@ async function runRawArchive(run2, subcommand) {
|
|
|
10089
10324
|
}
|
|
10090
10325
|
async function runShadowReport(run2) {
|
|
10091
10326
|
const day2 = required(run2.flags, "day", "which local day, YYYY-MM-DD");
|
|
10092
|
-
const found = ShadowReportSchema.parse(expectOk(await
|
|
10327
|
+
const found = ShadowReportSchema.parse(expectOk(await call2(run2.api, "GET", `/v1/admin/pipeline/shadow-report?day=${encodeURIComponent(day2)}`)));
|
|
10093
10328
|
const pct2 = (part, whole) => whole === 0 ? "-" : `${Math.round(100 * part / whole)}%`;
|
|
10094
10329
|
return render(run2, found, [
|
|
10095
10330
|
`day ${found.day}`,
|
|
@@ -10101,7 +10336,7 @@ async function runRetentionSet(run2) {
|
|
|
10101
10336
|
const days2 = Number(required(run2.flags, "days", "how many days after each interval's day its context is kept"));
|
|
10102
10337
|
if (!Number.isInteger(days2) || days2 < 1 || days2 > 365)
|
|
10103
10338
|
throw new AdminUsageError("--days is a whole number from 1 to 365.");
|
|
10104
|
-
const done = AdminContextRetentionResultSchema.parse(expectOk(await
|
|
10339
|
+
const done = AdminContextRetentionResultSchema.parse(expectOk(await call2(run2.api, "PUT", tenantPath(tenantId, "/context-retention"), { days: days2 })));
|
|
10105
10340
|
const moved = Object.entries(done.shifted).map(([table2, rows]) => `${table2} ${rows}`).join(", ");
|
|
10106
10341
|
return render(run2, done, [
|
|
10107
10342
|
`tenant ${done.tenant.id} ${done.tenant.name}`,
|
|
@@ -10120,7 +10355,7 @@ async function runNarrativeInstructions(run2, set) {
|
|
|
10120
10355
|
throw new AdminUsageError(`--file ${file} is not readable: ${err.message}`);
|
|
10121
10356
|
}
|
|
10122
10357
|
}
|
|
10123
|
-
const answer = await
|
|
10358
|
+
const answer = await call2(run2.api, set ? "PUT" : "GET", tenantPath(tenantId, "/narrative-instructions"), body);
|
|
10124
10359
|
if (answer.status !== 200)
|
|
10125
10360
|
return refused(run2, answer, [actingHead(tenantId, answer)]);
|
|
10126
10361
|
const done = AdminNarrativeInstructionsSchema.parse(answer.body);
|
|
@@ -10136,7 +10371,7 @@ async function runNarrativeActivities(run2, set) {
|
|
|
10136
10371
|
const tenantId = required(run2.flags, "tenant", "whose narrative activities");
|
|
10137
10372
|
const file = set ? required(run2.flags, "file", "the table is a JSON array of rows, by rank, in a file") : optional(run2.flags, "file");
|
|
10138
10373
|
const body = set ? { activities: readDocument(file, NarrativeActivitiesSchema, "a narrative activity table (a JSON array of rows, by rank)", "file").raw } : undefined;
|
|
10139
|
-
const answer = await
|
|
10374
|
+
const answer = await call2(run2.api, set ? "PUT" : "GET", tenantPath(tenantId, "/narrative-activities"), body);
|
|
10140
10375
|
if (answer.status !== 200)
|
|
10141
10376
|
return refused(run2, answer, [actingHead(tenantId, answer)]);
|
|
10142
10377
|
const done = AdminNarrativeActivitiesSchema.parse(answer.body);
|
|
@@ -10154,7 +10389,7 @@ async function runNarrativeActivities(run2, set) {
|
|
|
10154
10389
|
var ScrubStartedSchema = exports_external.object({ tenant: exports_external.string(), started: exports_external.number().int().nonnegative() });
|
|
10155
10390
|
async function runScrubPlaintext(run2) {
|
|
10156
10391
|
const tenantId = required(run2.flags, "tenant", "whose old rows to scrub");
|
|
10157
|
-
const done = ScrubStartedSchema.parse(expectOk(await
|
|
10392
|
+
const done = ScrubStartedSchema.parse(expectOk(await call2(run2.api, "POST", tenantPath(tenantId, "/scrub-plaintext"))));
|
|
10158
10393
|
return render(run2, done, [
|
|
10159
10394
|
`tenant ${done.tenant}`,
|
|
10160
10395
|
`started ${done.started} scrub job(s), one per active member`
|
|
@@ -10162,7 +10397,7 @@ async function runScrubPlaintext(run2) {
|
|
|
10162
10397
|
}
|
|
10163
10398
|
async function runVersions(run2) {
|
|
10164
10399
|
const tenantId = required(run2.flags, "tenant", "whose devices");
|
|
10165
|
-
const found = AdminDeviceVersionListSchema.parse(expectOk(await
|
|
10400
|
+
const found = AdminDeviceVersionListSchema.parse(expectOk(await call2(run2.api, "GET", tenantPath(tenantId, "/devices"))));
|
|
10166
10401
|
return render(run2, found, [
|
|
10167
10402
|
`tenant ${tenantId}${found.tenant.internal ? " (internal)" : ""}`,
|
|
10168
10403
|
...found.devices.length === 0 ? ["no devices"] : found.devices.map((d) => `${d.id} ${d.version ?? "unknown"} ${d.version_seen_at ?? "never"} ${d.platform} ` + `${d.email ?? "?"} ${d.name}${d.revoked ? " (revoked)" : ""}`)
|
|
@@ -10182,7 +10417,7 @@ async function runEntriesPurge(run2) {
|
|
|
10182
10417
|
}
|
|
10183
10418
|
const dryRun = switched(flags, "dry-run");
|
|
10184
10419
|
const yes = switched(flags, "yes");
|
|
10185
|
-
const purge = async (dry) => AdminEntriesPurgeResultSchema.parse(expectOk(await
|
|
10420
|
+
const purge = async (dry) => AdminEntriesPurgeResultSchema.parse(expectOk(await call2(run2.api, "POST", tenantPath(tenantId, "/entries/purge"), { author, demo: demo2, unmatched, dry_run: dry })));
|
|
10186
10421
|
const done = await purge(dryRun || !yes);
|
|
10187
10422
|
const total = done.rows.demo.length + done.rows.unmatched.length;
|
|
10188
10423
|
const listing = [
|
|
@@ -10230,7 +10465,7 @@ async function runAudit(run2) {
|
|
|
10230
10465
|
query.set("limit", limit);
|
|
10231
10466
|
}
|
|
10232
10467
|
const q = query.toString();
|
|
10233
|
-
const { actions } = OperatorAuditListSchema.parse(expectOk(await
|
|
10468
|
+
const { actions } = OperatorAuditListSchema.parse(expectOk(await call2(run2.api, "GET", `/v1/admin/audit${q === "" ? "" : `?${q}`}`)));
|
|
10234
10469
|
return render(run2, { actions }, actions.length === 0 ? ["no operator actions"] : actions.map((a) => `${a.created_at} ${a.status.padEnd(7)} ${String(a.http_status ?? "").padEnd(3)} ${a.action} ` + `${a.operator_email ?? a.operator_sub}${a.tenant_id === null ? "" : ` ${a.tenant_id}`}` + `${a.subject === null ? "" : ` ${a.subject}`}`));
|
|
10235
10470
|
}
|
|
10236
10471
|
async function runVocabulary(run2, group, subcommand, action, positionals) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisonlabs/sixminute-admin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1396-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": {
|