@mereon/demo 0.2.1 → 0.4.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/README.md +14 -3
- package/dist/demo.mjs +1261 -643
- package/package.json +2 -2
package/dist/demo.mjs
CHANGED
|
@@ -18,9 +18,9 @@ var __commonJS = (cb, mod) => function __require2() {
|
|
|
18
18
|
throw mod = 0, e;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
var __export = (
|
|
21
|
+
var __export = (target2, all) => {
|
|
22
22
|
for (var name in all)
|
|
23
|
-
__defProp(
|
|
23
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
24
24
|
};
|
|
25
25
|
var __copyProps = (to, from, except, desc) => {
|
|
26
26
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -30,12 +30,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
30
|
}
|
|
31
31
|
return to;
|
|
32
32
|
};
|
|
33
|
-
var __toESM = (mod, isNodeMode,
|
|
33
|
+
var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
34
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
35
|
// file that has been converted to a CommonJS file using a Babel-
|
|
36
36
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
37
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
|
|
39
39
|
mod
|
|
40
40
|
));
|
|
41
41
|
|
|
@@ -1006,14 +1006,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
1006
1006
|
var FOLD_FLOW = "flow";
|
|
1007
1007
|
var FOLD_BLOCK = "block";
|
|
1008
1008
|
var FOLD_QUOTED = "quoted";
|
|
1009
|
-
function foldFlowLines(
|
|
1009
|
+
function foldFlowLines(text2, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
1010
1010
|
if (!lineWidth || lineWidth < 0)
|
|
1011
|
-
return
|
|
1011
|
+
return text2;
|
|
1012
1012
|
if (lineWidth < minContentWidth)
|
|
1013
1013
|
minContentWidth = 0;
|
|
1014
1014
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
1015
|
-
if (
|
|
1016
|
-
return
|
|
1015
|
+
if (text2.length <= endStep)
|
|
1016
|
+
return text2;
|
|
1017
1017
|
const folds = [];
|
|
1018
1018
|
const escapedFolds = {};
|
|
1019
1019
|
let end = lineWidth - indent.length;
|
|
@@ -1030,14 +1030,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
1030
1030
|
let escStart = -1;
|
|
1031
1031
|
let escEnd = -1;
|
|
1032
1032
|
if (mode === FOLD_BLOCK) {
|
|
1033
|
-
i = consumeMoreIndentedLines(
|
|
1033
|
+
i = consumeMoreIndentedLines(text2, i, indent.length);
|
|
1034
1034
|
if (i !== -1)
|
|
1035
1035
|
end = i + endStep;
|
|
1036
1036
|
}
|
|
1037
|
-
for (let ch; ch =
|
|
1037
|
+
for (let ch; ch = text2[i += 1]; ) {
|
|
1038
1038
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
1039
1039
|
escStart = i;
|
|
1040
|
-
switch (
|
|
1040
|
+
switch (text2[i + 1]) {
|
|
1041
1041
|
case "x":
|
|
1042
1042
|
i += 3;
|
|
1043
1043
|
break;
|
|
@@ -1054,12 +1054,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
1054
1054
|
}
|
|
1055
1055
|
if (ch === "\n") {
|
|
1056
1056
|
if (mode === FOLD_BLOCK)
|
|
1057
|
-
i = consumeMoreIndentedLines(
|
|
1057
|
+
i = consumeMoreIndentedLines(text2, i, indent.length);
|
|
1058
1058
|
end = i + indent.length + endStep;
|
|
1059
1059
|
split = void 0;
|
|
1060
1060
|
} else {
|
|
1061
1061
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
1062
|
-
const next =
|
|
1062
|
+
const next = text2[i + 1];
|
|
1063
1063
|
if (next && next !== " " && next !== "\n" && next !== " ")
|
|
1064
1064
|
split = i;
|
|
1065
1065
|
}
|
|
@@ -1071,12 +1071,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
1071
1071
|
} else if (mode === FOLD_QUOTED) {
|
|
1072
1072
|
while (prev === " " || prev === " ") {
|
|
1073
1073
|
prev = ch;
|
|
1074
|
-
ch =
|
|
1074
|
+
ch = text2[i += 1];
|
|
1075
1075
|
overflow = true;
|
|
1076
1076
|
}
|
|
1077
1077
|
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
1078
1078
|
if (escapedFolds[j])
|
|
1079
|
-
return
|
|
1079
|
+
return text2;
|
|
1080
1080
|
folds.push(j);
|
|
1081
1081
|
escapedFolds[j] = true;
|
|
1082
1082
|
end = j + endStep;
|
|
@@ -1091,39 +1091,39 @@ var require_foldFlowLines = __commonJS({
|
|
|
1091
1091
|
if (overflow && onOverflow)
|
|
1092
1092
|
onOverflow();
|
|
1093
1093
|
if (folds.length === 0)
|
|
1094
|
-
return
|
|
1094
|
+
return text2;
|
|
1095
1095
|
if (onFold)
|
|
1096
1096
|
onFold();
|
|
1097
|
-
let res =
|
|
1097
|
+
let res = text2.slice(0, folds[0]);
|
|
1098
1098
|
for (let i2 = 0; i2 < folds.length; ++i2) {
|
|
1099
1099
|
const fold = folds[i2];
|
|
1100
|
-
const end2 = folds[i2 + 1] ||
|
|
1100
|
+
const end2 = folds[i2 + 1] || text2.length;
|
|
1101
1101
|
if (fold === 0)
|
|
1102
1102
|
res = `
|
|
1103
|
-
${indent}${
|
|
1103
|
+
${indent}${text2.slice(0, end2)}`;
|
|
1104
1104
|
else {
|
|
1105
1105
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
1106
|
-
res += `${
|
|
1106
|
+
res += `${text2[fold]}\\`;
|
|
1107
1107
|
res += `
|
|
1108
|
-
${indent}${
|
|
1108
|
+
${indent}${text2.slice(fold + 1, end2)}`;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
return res;
|
|
1112
1112
|
}
|
|
1113
|
-
function consumeMoreIndentedLines(
|
|
1113
|
+
function consumeMoreIndentedLines(text2, i, indent) {
|
|
1114
1114
|
let end = i;
|
|
1115
1115
|
let start = i + 1;
|
|
1116
|
-
let ch =
|
|
1116
|
+
let ch = text2[start];
|
|
1117
1117
|
while (ch === " " || ch === " ") {
|
|
1118
1118
|
if (i < start + indent) {
|
|
1119
|
-
ch =
|
|
1119
|
+
ch = text2[++i];
|
|
1120
1120
|
} else {
|
|
1121
1121
|
do {
|
|
1122
|
-
ch =
|
|
1122
|
+
ch = text2[++i];
|
|
1123
1123
|
} while (ch && ch !== "\n");
|
|
1124
1124
|
end = i;
|
|
1125
1125
|
start = i + 1;
|
|
1126
|
-
ch =
|
|
1126
|
+
ch = text2[start];
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
1129
|
return end;
|
|
@@ -1150,16 +1150,16 @@ var require_stringifyString = __commonJS({
|
|
|
1150
1150
|
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
1151
1151
|
if (!lineWidth || lineWidth < 0)
|
|
1152
1152
|
return false;
|
|
1153
|
-
const
|
|
1153
|
+
const limit2 = lineWidth - indentLength;
|
|
1154
1154
|
const strLen = str.length;
|
|
1155
|
-
if (strLen <=
|
|
1155
|
+
if (strLen <= limit2)
|
|
1156
1156
|
return false;
|
|
1157
1157
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
1158
1158
|
if (str[i] === "\n") {
|
|
1159
|
-
if (i - start >
|
|
1159
|
+
if (i - start > limit2)
|
|
1160
1160
|
return true;
|
|
1161
1161
|
start = i + 1;
|
|
1162
|
-
if (strLen - start <=
|
|
1162
|
+
if (strLen - start <= limit2)
|
|
1163
1163
|
return false;
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
@@ -6417,12 +6417,12 @@ var require_parser = __commonJS({
|
|
|
6417
6417
|
}
|
|
6418
6418
|
return prev.splice(i, prev.length);
|
|
6419
6419
|
}
|
|
6420
|
-
function arrayPushArray(
|
|
6420
|
+
function arrayPushArray(target2, source) {
|
|
6421
6421
|
if (source.length < 1e5)
|
|
6422
|
-
Array.prototype.push.apply(
|
|
6422
|
+
Array.prototype.push.apply(target2, source);
|
|
6423
6423
|
else
|
|
6424
6424
|
for (let i = 0; i < source.length; ++i)
|
|
6425
|
-
|
|
6425
|
+
target2.push(source[i]);
|
|
6426
6426
|
}
|
|
6427
6427
|
function fixFlowSeqItems(fc) {
|
|
6428
6428
|
if (fc.start.type === "flow-seq-start") {
|
|
@@ -7373,18 +7373,21 @@ var require_dist = __commonJS({
|
|
|
7373
7373
|
var CliError = class extends Error {
|
|
7374
7374
|
exitCode;
|
|
7375
7375
|
hint;
|
|
7376
|
+
/** The API's error code, for a refusal a command handles rather than reports. */
|
|
7377
|
+
code;
|
|
7376
7378
|
constructor(message, options = {}) {
|
|
7377
7379
|
super(message);
|
|
7378
7380
|
this.name = "CliError";
|
|
7379
7381
|
this.exitCode = options.exitCode ?? 1;
|
|
7380
7382
|
this.hint = options.hint;
|
|
7383
|
+
this.code = options.code;
|
|
7381
7384
|
}
|
|
7382
7385
|
};
|
|
7383
7386
|
|
|
7384
7387
|
// package.json
|
|
7385
7388
|
var package_default = {
|
|
7386
7389
|
name: "@mereon/demo",
|
|
7387
|
-
version: "0.
|
|
7390
|
+
version: "0.4.0",
|
|
7388
7391
|
description: "Record a narrated demo of a UI change and file it in your Mereon organization.",
|
|
7389
7392
|
type: "module",
|
|
7390
7393
|
license: "Apache-2.0",
|
|
@@ -7420,7 +7423,7 @@ var package_default = {
|
|
|
7420
7423
|
eslint: "^9.39.5",
|
|
7421
7424
|
"eslint-plugin-mereon": "file:../eslint-plugin-mereon",
|
|
7422
7425
|
typescript: "^5.9.3",
|
|
7423
|
-
"typescript-eslint": "^8.
|
|
7426
|
+
"typescript-eslint": "^8.73.0",
|
|
7424
7427
|
vitest: "^5.1.0",
|
|
7425
7428
|
yaml: "^2.9.1",
|
|
7426
7429
|
zod: "^4.6.6"
|
|
@@ -8244,8 +8247,8 @@ function defineLazy(object2, key, getter) {
|
|
|
8244
8247
|
function objectClone(obj) {
|
|
8245
8248
|
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
8246
8249
|
}
|
|
8247
|
-
function assignProp(
|
|
8248
|
-
Object.defineProperty(
|
|
8250
|
+
function assignProp(target2, prop, value) {
|
|
8251
|
+
Object.defineProperty(target2, prop, {
|
|
8249
8252
|
value,
|
|
8250
8253
|
writable: true,
|
|
8251
8254
|
enumerable: true,
|
|
@@ -8259,8 +8262,8 @@ function rawShape(def) {
|
|
|
8259
8262
|
function sourceShape(schema) {
|
|
8260
8263
|
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
8261
8264
|
}
|
|
8262
|
-
function deferProp(
|
|
8263
|
-
Object.defineProperty(
|
|
8265
|
+
function deferProp(target2, key, getter) {
|
|
8266
|
+
Object.defineProperty(target2, key, {
|
|
8264
8267
|
get() {
|
|
8265
8268
|
const value = getter();
|
|
8266
8269
|
assignProp(this, key, value);
|
|
@@ -8270,36 +8273,36 @@ function deferProp(target, key, getter) {
|
|
|
8270
8273
|
configurable: true
|
|
8271
8274
|
});
|
|
8272
8275
|
}
|
|
8273
|
-
function putProp(
|
|
8274
|
-
if (key in
|
|
8275
|
-
assignProp(
|
|
8276
|
+
function putProp(target2, key, value) {
|
|
8277
|
+
if (key in target2)
|
|
8278
|
+
assignProp(target2, key, value);
|
|
8276
8279
|
else
|
|
8277
|
-
|
|
8280
|
+
target2[key] = value;
|
|
8278
8281
|
}
|
|
8279
|
-
function mirrorShape(
|
|
8282
|
+
function mirrorShape(target2, source, keys, wrap) {
|
|
8280
8283
|
const raw = sourceShape(source);
|
|
8281
8284
|
for (const key of keys) {
|
|
8282
8285
|
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
8283
8286
|
if (!desc.enumerable)
|
|
8284
8287
|
continue;
|
|
8285
8288
|
if (desc.get) {
|
|
8286
|
-
deferProp(
|
|
8289
|
+
deferProp(target2, key, () => {
|
|
8287
8290
|
const value = source._zod.def.shape[key];
|
|
8288
8291
|
return wrap ? wrap(value, key) : value;
|
|
8289
8292
|
});
|
|
8290
8293
|
} else
|
|
8291
|
-
putProp(
|
|
8294
|
+
putProp(target2, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
8292
8295
|
}
|
|
8293
8296
|
}
|
|
8294
|
-
function mirrorProps(
|
|
8297
|
+
function mirrorProps(target2, source) {
|
|
8295
8298
|
for (const key of Reflect.ownKeys(source)) {
|
|
8296
8299
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
8297
8300
|
if (!desc.enumerable)
|
|
8298
8301
|
continue;
|
|
8299
8302
|
if (desc.get)
|
|
8300
|
-
deferProp(
|
|
8303
|
+
deferProp(target2, key, () => source[key]);
|
|
8301
8304
|
else
|
|
8302
|
-
putProp(
|
|
8305
|
+
putProp(target2, key, desc.value);
|
|
8303
8306
|
}
|
|
8304
8307
|
}
|
|
8305
8308
|
function mergeDefs(...defs) {
|
|
@@ -8478,35 +8481,35 @@ function normalizeParams(_params) {
|
|
|
8478
8481
|
return params;
|
|
8479
8482
|
}
|
|
8480
8483
|
function createTransparentProxy(getter) {
|
|
8481
|
-
let
|
|
8484
|
+
let target2;
|
|
8482
8485
|
return new Proxy({}, {
|
|
8483
8486
|
get(_, prop, receiver) {
|
|
8484
|
-
|
|
8485
|
-
return Reflect.get(
|
|
8487
|
+
target2 ?? (target2 = getter());
|
|
8488
|
+
return Reflect.get(target2, prop, receiver);
|
|
8486
8489
|
},
|
|
8487
8490
|
set(_, prop, value, receiver) {
|
|
8488
|
-
|
|
8489
|
-
return Reflect.set(
|
|
8491
|
+
target2 ?? (target2 = getter());
|
|
8492
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
8490
8493
|
},
|
|
8491
8494
|
has(_, prop) {
|
|
8492
|
-
|
|
8493
|
-
return Reflect.has(
|
|
8495
|
+
target2 ?? (target2 = getter());
|
|
8496
|
+
return Reflect.has(target2, prop);
|
|
8494
8497
|
},
|
|
8495
8498
|
deleteProperty(_, prop) {
|
|
8496
|
-
|
|
8497
|
-
return Reflect.deleteProperty(
|
|
8499
|
+
target2 ?? (target2 = getter());
|
|
8500
|
+
return Reflect.deleteProperty(target2, prop);
|
|
8498
8501
|
},
|
|
8499
8502
|
ownKeys(_) {
|
|
8500
|
-
|
|
8501
|
-
return Reflect.ownKeys(
|
|
8503
|
+
target2 ?? (target2 = getter());
|
|
8504
|
+
return Reflect.ownKeys(target2);
|
|
8502
8505
|
},
|
|
8503
8506
|
getOwnPropertyDescriptor(_, prop) {
|
|
8504
|
-
|
|
8505
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
8507
|
+
target2 ?? (target2 = getter());
|
|
8508
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
8506
8509
|
},
|
|
8507
8510
|
defineProperty(_, prop, descriptor) {
|
|
8508
|
-
|
|
8509
|
-
return Reflect.defineProperty(
|
|
8511
|
+
target2 ?? (target2 = getter());
|
|
8512
|
+
return Reflect.defineProperty(target2, prop, descriptor);
|
|
8510
8513
|
}
|
|
8511
8514
|
});
|
|
8512
8515
|
}
|
|
@@ -8989,10 +8992,10 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
8989
8992
|
let up = own2;
|
|
8990
8993
|
while (up && up !== ctorProto)
|
|
8991
8994
|
up = Object.getPrototypeOf(up);
|
|
8992
|
-
const
|
|
8993
|
-
if (!initialized.has(
|
|
8994
|
-
initialized.add(
|
|
8995
|
-
members(
|
|
8995
|
+
const target2 = up ?? own2;
|
|
8996
|
+
if (!initialized.has(target2)) {
|
|
8997
|
+
initialized.add(target2);
|
|
8998
|
+
members(target2, protoMembers);
|
|
8996
8999
|
}
|
|
8997
9000
|
}
|
|
8998
9001
|
const proto2 = _.prototype;
|
|
@@ -16846,8 +16849,8 @@ function ko_default() {
|
|
|
16846
16849
|
}
|
|
16847
16850
|
|
|
16848
16851
|
// ../../node_modules/zod/v4/locales/lt.js
|
|
16849
|
-
var capitalizeFirstCharacter = (
|
|
16850
|
-
return
|
|
16852
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
16853
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
16851
16854
|
};
|
|
16852
16855
|
function getUnitTypeFromNumber(number4) {
|
|
16853
16856
|
const abs = Math.abs(number4);
|
|
@@ -20504,8 +20507,8 @@ function withParser(schema, parser) {
|
|
|
20504
20507
|
installCompiledUserMethods(clone2, schema, parser);
|
|
20505
20508
|
return clone2;
|
|
20506
20509
|
}
|
|
20507
|
-
function installCompiledUserMethods(
|
|
20508
|
-
const targetAny =
|
|
20510
|
+
function installCompiledUserMethods(target2, source, parser) {
|
|
20511
|
+
const targetAny = target2;
|
|
20509
20512
|
const sourceAny = source;
|
|
20510
20513
|
if (typeof sourceAny.safeParse === "function") {
|
|
20511
20514
|
const originalSafeParse = sourceAny.safeParse;
|
|
@@ -23108,26 +23111,26 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
23108
23111
|
}
|
|
23109
23112
|
|
|
23110
23113
|
// ../../node_modules/zod/v4/core/to-json-schema.js
|
|
23111
|
-
function assignProps(
|
|
23114
|
+
function assignProps(target2, ...sources) {
|
|
23112
23115
|
for (const source of sources) {
|
|
23113
23116
|
for (const key of Reflect.ownKeys(source)) {
|
|
23114
23117
|
if (Object.prototype.propertyIsEnumerable.call(source, key)) {
|
|
23115
|
-
assignProp(
|
|
23118
|
+
assignProp(target2, key, source[key]);
|
|
23116
23119
|
}
|
|
23117
23120
|
}
|
|
23118
23121
|
}
|
|
23119
|
-
return
|
|
23122
|
+
return target2;
|
|
23120
23123
|
}
|
|
23121
23124
|
function initializeContext(params) {
|
|
23122
|
-
let
|
|
23123
|
-
if (
|
|
23124
|
-
|
|
23125
|
-
if (
|
|
23126
|
-
|
|
23125
|
+
let target2 = params?.target ?? "draft-2020-12";
|
|
23126
|
+
if (target2 === "draft-4")
|
|
23127
|
+
target2 = "draft-04";
|
|
23128
|
+
if (target2 === "draft-7")
|
|
23129
|
+
target2 = "draft-07";
|
|
23127
23130
|
return {
|
|
23128
23131
|
processors: params.processors ?? {},
|
|
23129
23132
|
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
23130
|
-
target,
|
|
23133
|
+
target: target2,
|
|
23131
23134
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
23132
23135
|
override: params?.override ?? (() => {
|
|
23133
23136
|
}),
|
|
@@ -23630,8 +23633,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
23630
23633
|
return finalize(ctx, schema);
|
|
23631
23634
|
};
|
|
23632
23635
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
23633
|
-
const { libraryOptions, target } = params ?? {};
|
|
23634
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
23636
|
+
const { libraryOptions, target: target2 } = params ?? {};
|
|
23637
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
|
|
23635
23638
|
processSchema(schema, ctx);
|
|
23636
23639
|
extractDefs(ctx, schema);
|
|
23637
23640
|
return finalize(ctx, schema);
|
|
@@ -24825,8 +24828,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
24825
24828
|
catch(params) {
|
|
24826
24829
|
return _catch2(this, params);
|
|
24827
24830
|
},
|
|
24828
|
-
pipe(
|
|
24829
|
-
return pipe(this,
|
|
24831
|
+
pipe(target2) {
|
|
24832
|
+
return pipe(this, target2);
|
|
24830
24833
|
},
|
|
24831
24834
|
readonly() {
|
|
24832
24835
|
return readonly(this);
|
|
@@ -27215,10 +27218,10 @@ function date4(params) {
|
|
|
27215
27218
|
|
|
27216
27219
|
// src/json.ts
|
|
27217
27220
|
var jsonObjectSchema = external_exports.record(external_exports.string(), external_exports.json());
|
|
27218
|
-
function parseJsonObject(
|
|
27221
|
+
function parseJsonObject(text2) {
|
|
27219
27222
|
let value;
|
|
27220
27223
|
try {
|
|
27221
|
-
const parsed = jsonObjectSchema.safeParse(JSON.parse(
|
|
27224
|
+
const parsed = jsonObjectSchema.safeParse(JSON.parse(text2));
|
|
27222
27225
|
value = parsed.success ? parsed.data : void 0;
|
|
27223
27226
|
} catch {
|
|
27224
27227
|
value = void 0;
|
|
@@ -27277,8 +27280,8 @@ async function withFileLock(path, work, busy, options = {}) {
|
|
|
27277
27280
|
}
|
|
27278
27281
|
async function readLock(lockPath) {
|
|
27279
27282
|
try {
|
|
27280
|
-
const [
|
|
27281
|
-
const object2 = parseJsonObject(
|
|
27283
|
+
const [text2, info] = await Promise.all([readFile(lockPath, "utf8"), stat(lockPath)]);
|
|
27284
|
+
const object2 = parseJsonObject(text2);
|
|
27282
27285
|
const owner = object2 === void 0 ? void 0 : lockOwnerSchema.safeParse(object2);
|
|
27283
27286
|
return { owner: owner?.success === true ? owner.data : void 0, touchedAt: info.mtimeMs };
|
|
27284
27287
|
} catch {
|
|
@@ -27471,16 +27474,16 @@ function announcementCredentialsPath(env = process.env) {
|
|
|
27471
27474
|
return join(configDirectory(env), "demo-announcement-credentials.json");
|
|
27472
27475
|
}
|
|
27473
27476
|
async function readCredentials(path) {
|
|
27474
|
-
let
|
|
27477
|
+
let text2;
|
|
27475
27478
|
try {
|
|
27476
|
-
|
|
27479
|
+
text2 = await readFile2(path, "utf8");
|
|
27477
27480
|
} catch (error62) {
|
|
27478
27481
|
if (error62 instanceof Error && "code" in error62 && error62.code === "ENOENT") {
|
|
27479
27482
|
return emptyCredentials();
|
|
27480
27483
|
}
|
|
27481
27484
|
throw error62;
|
|
27482
27485
|
}
|
|
27483
|
-
const object2 = parseJsonObject(
|
|
27486
|
+
const object2 = parseJsonObject(text2);
|
|
27484
27487
|
const current = object2 === void 0 ? void 0 : credentialsSchema.safeParse(object2);
|
|
27485
27488
|
if (current !== void 0 && current.success) return current.data;
|
|
27486
27489
|
const old = object2 === void 0 ? void 0 : credentialsV1Schema.safeParse(object2);
|
|
@@ -27660,8 +27663,8 @@ function withoutElevenLabsKey(credentials) {
|
|
|
27660
27663
|
}
|
|
27661
27664
|
|
|
27662
27665
|
// src/output.ts
|
|
27663
|
-
function forTerminal(
|
|
27664
|
-
return
|
|
27666
|
+
function forTerminal(text2) {
|
|
27667
|
+
return text2.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, "").replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?/g, "").replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g, "");
|
|
27665
27668
|
}
|
|
27666
27669
|
function createOutput(streams = { stdout: process.stdout, stderr: process.stderr }) {
|
|
27667
27670
|
let resultWritten = false;
|
|
@@ -27889,8 +27892,8 @@ async function sessionKey(platform, lockPath, exec2 = exec) {
|
|
|
27889
27892
|
);
|
|
27890
27893
|
return key === void 0 ? void 0 : { key, keychain: keychain.name };
|
|
27891
27894
|
}
|
|
27892
|
-
var decode3 = (
|
|
27893
|
-
const hex3 =
|
|
27895
|
+
var decode3 = (text2) => {
|
|
27896
|
+
const hex3 = text2.trim();
|
|
27894
27897
|
return /^[0-9a-f]{64}$/.test(hex3) ? Buffer.from(hex3, "hex") : void 0;
|
|
27895
27898
|
};
|
|
27896
27899
|
var MAC = {
|
|
@@ -28661,9 +28664,9 @@ function isSettableKey(key) {
|
|
|
28661
28664
|
return SETTABLE_KEYS.some((settable) => settable === key) || /^voices\.[a-z][a-z0-9-]*$/.test(key);
|
|
28662
28665
|
}
|
|
28663
28666
|
async function readProjectConfigFile(paths) {
|
|
28664
|
-
let
|
|
28667
|
+
let text2;
|
|
28665
28668
|
try {
|
|
28666
|
-
|
|
28669
|
+
text2 = await readFile3(paths.config, "utf8");
|
|
28667
28670
|
} catch (error62) {
|
|
28668
28671
|
if (error62 instanceof Error && "code" in error62 && error62.code === "ENOENT") {
|
|
28669
28672
|
throw new CliError(`There is no ${paths.config}.`, {
|
|
@@ -28672,7 +28675,7 @@ async function readProjectConfigFile(paths) {
|
|
|
28672
28675
|
}
|
|
28673
28676
|
throw error62;
|
|
28674
28677
|
}
|
|
28675
|
-
const parsed = parseJsonObject(
|
|
28678
|
+
const parsed = parseJsonObject(text2);
|
|
28676
28679
|
if (parsed === void 0) {
|
|
28677
28680
|
throw new CliError(`${paths.config} is not valid JSON.`, {
|
|
28678
28681
|
hint: "Fix it by hand, or delete it and run `demo init` again."
|
|
@@ -28746,14 +28749,14 @@ function sameOrigin(a, b) {
|
|
|
28746
28749
|
}
|
|
28747
28750
|
}
|
|
28748
28751
|
async function readLocalConfig(paths) {
|
|
28749
|
-
let
|
|
28752
|
+
let text2;
|
|
28750
28753
|
try {
|
|
28751
|
-
|
|
28754
|
+
text2 = await readFile3(paths.localConfig, "utf8");
|
|
28752
28755
|
} catch (error62) {
|
|
28753
28756
|
if (error62 instanceof Error && "code" in error62 && error62.code === "ENOENT") return {};
|
|
28754
28757
|
throw error62;
|
|
28755
28758
|
}
|
|
28756
|
-
const raw = parseJsonObject(
|
|
28759
|
+
const raw = parseJsonObject(text2);
|
|
28757
28760
|
if (raw === void 0) {
|
|
28758
28761
|
throw new CliError(`${paths.localConfig} is not valid JSON.`, { hint: "Fix it by hand, or delete it." });
|
|
28759
28762
|
}
|
|
@@ -28863,11 +28866,11 @@ async function readProjectPin(paths) {
|
|
|
28863
28866
|
return { kind: "unpinned" };
|
|
28864
28867
|
}
|
|
28865
28868
|
async function writeFileAtomically(path, contents) {
|
|
28866
|
-
const
|
|
28867
|
-
const temp = `${
|
|
28869
|
+
const target2 = await writeTarget(path);
|
|
28870
|
+
const temp = `${target2}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
28868
28871
|
await writeFile(temp, contents, "utf8");
|
|
28869
28872
|
try {
|
|
28870
|
-
await rename2(temp,
|
|
28873
|
+
await rename2(temp, target2);
|
|
28871
28874
|
} catch (error62) {
|
|
28872
28875
|
await rm3(temp, { force: true });
|
|
28873
28876
|
throw error62;
|
|
@@ -29177,13 +29180,13 @@ function decodeAccessTokenClaims(jwt2) {
|
|
|
29177
29180
|
if (payload === void 0) {
|
|
29178
29181
|
throw new CliError("Mereon returned a token this version cannot read.");
|
|
29179
29182
|
}
|
|
29180
|
-
let
|
|
29183
|
+
let text2;
|
|
29181
29184
|
try {
|
|
29182
|
-
|
|
29185
|
+
text2 = Buffer.from(payload, "base64url").toString("utf8");
|
|
29183
29186
|
} catch {
|
|
29184
29187
|
throw new CliError("Mereon returned a token this version cannot read.");
|
|
29185
29188
|
}
|
|
29186
|
-
const object2 = parseJsonObject(
|
|
29189
|
+
const object2 = parseJsonObject(text2);
|
|
29187
29190
|
const parsed = object2 === void 0 ? void 0 : claimsSchema.safeParse(object2);
|
|
29188
29191
|
if (parsed === void 0 || !parsed.success) {
|
|
29189
29192
|
throw new CliError("Mereon returned a token that does not say which organization it is for.");
|
|
@@ -29518,6 +29521,7 @@ var API_ERROR = {
|
|
|
29518
29521
|
sourceKeyHoldNeedsFirstUpload: "SOURCE_KEY_HOLD_NEEDS_FIRST_UPLOAD",
|
|
29519
29522
|
recordingNotReplaceable: "RECORDING_NOT_REPLACEABLE",
|
|
29520
29523
|
transcriptDraftPending: "TRANSCRIPT_DRAFT_PENDING",
|
|
29524
|
+
recordingUpdateInProgress: "RECORDING_UPDATE_IN_PROGRESS",
|
|
29521
29525
|
releaseOrganizationMismatch: "RELEASE_ORGANIZATION_MISMATCH",
|
|
29522
29526
|
releaseRepositoryMismatch: "RELEASE_REPOSITORY_MISMATCH",
|
|
29523
29527
|
narrationQuotaExceeded: "NARRATION_QUOTA_EXCEEDED"
|
|
@@ -29536,6 +29540,14 @@ var apiErrorSchema = external_exports.object({
|
|
|
29536
29540
|
message: external_exports.string().optional()
|
|
29537
29541
|
});
|
|
29538
29542
|
var UPLOAD_ATTEMPTS = 3;
|
|
29543
|
+
var RATE_LIMITED_RETRIES = 3;
|
|
29544
|
+
var LONGEST_RATE_LIMIT_WAIT_MS = 6e4;
|
|
29545
|
+
var DEFAULT_RATE_LIMIT_WAIT_MS = 15e3;
|
|
29546
|
+
function rateLimitWaitMs(retryAfter) {
|
|
29547
|
+
const seconds4 = retryAfter === null ? Number.NaN : Number(retryAfter);
|
|
29548
|
+
if (!Number.isFinite(seconds4) || seconds4 < 0) return DEFAULT_RATE_LIMIT_WAIT_MS;
|
|
29549
|
+
return Math.min(Math.max(seconds4 * 1e3, 1e3), LONGEST_RATE_LIMIT_WAIT_MS);
|
|
29550
|
+
}
|
|
29539
29551
|
var SLOWEST_UPLOAD_BYTES_PER_MS = 125;
|
|
29540
29552
|
function uploadTimeoutMs(bytes) {
|
|
29541
29553
|
return REQUEST_TIMEOUT_MS + Math.ceil(bytes / SLOWEST_UPLOAD_BYTES_PER_MS);
|
|
@@ -29544,6 +29556,13 @@ function createMereonClient(options) {
|
|
|
29544
29556
|
const sleep2 = options.sleep ?? ((ms) => new Promise((resolve8) => setTimeout(resolve8, ms)));
|
|
29545
29557
|
const timeoutFor = options.uploadTimeoutMs ?? uploadTimeoutMs;
|
|
29546
29558
|
async function send(method, path, body, wording) {
|
|
29559
|
+
for (let retry = 0; ; retry += 1) {
|
|
29560
|
+
const response = await sendOnce(method, path, body, wording);
|
|
29561
|
+
if (response.status !== 429 || retry >= RATE_LIMITED_RETRIES) return response;
|
|
29562
|
+
await sleep2(rateLimitWaitMs(response.headers.get("retry-after")));
|
|
29563
|
+
}
|
|
29564
|
+
}
|
|
29565
|
+
async function sendOnce(method, path, body, wording) {
|
|
29547
29566
|
const { accessToken } = await getFreshConnection({
|
|
29548
29567
|
path: options.credentialsPath,
|
|
29549
29568
|
apiUrl: options.apiUrl,
|
|
@@ -29581,6 +29600,11 @@ function createMereonClient(options) {
|
|
|
29581
29600
|
return {
|
|
29582
29601
|
postJson: async (path, body, schema, wording = UPLOAD_WORDING) => read2(await send("POST", path, body, wording), schema, wording),
|
|
29583
29602
|
patchJson: async (path, body, schema, wording = UPLOAD_WORDING) => read2(await send("PATCH", path, body, wording), schema, wording),
|
|
29603
|
+
putJson: async (path, body, schema, wording = UPLOAD_WORDING) => read2(await send("PUT", path, body, wording), schema, wording),
|
|
29604
|
+
async putJsonIfFound(path, body, schema, wording = UPLOAD_WORDING) {
|
|
29605
|
+
const response = await send("PUT", path, body, wording);
|
|
29606
|
+
return response.status === 404 ? void 0 : read2(response, schema, wording);
|
|
29607
|
+
},
|
|
29584
29608
|
deleteJson: async (path, schema, wording = UPLOAD_WORDING) => read2(await send("DELETE", path, void 0, wording), schema, wording),
|
|
29585
29609
|
getJson: async (path, schema, wording = UPLOAD_WORDING) => read2(await send("GET", path, void 0, wording), schema, wording),
|
|
29586
29610
|
async findJson(path, schema, wording = UPLOAD_WORDING) {
|
|
@@ -29663,6 +29687,13 @@ async function explainFailure(response, wording) {
|
|
|
29663
29687
|
return new CliError(message ?? "That video has transcript edits nobody has published.", {
|
|
29664
29688
|
hint: "Tell the user: the edits have to be published or discarded in the app before the video can take a new recording. Then upload again."
|
|
29665
29689
|
});
|
|
29690
|
+
// Steps timed for the recording people watch now would be wrong for the
|
|
29691
|
+
// one on its way, which carries its own (`demo steps`).
|
|
29692
|
+
case API_ERROR.recordingUpdateInProgress:
|
|
29693
|
+
return new CliError(message ?? "A new recording of that video is on its way.", {
|
|
29694
|
+
hint: "Its upload sends its steps with it, so there is nothing to set until it is live.",
|
|
29695
|
+
code
|
|
29696
|
+
});
|
|
29666
29697
|
// Only from a Mereon from before videos could be updated.
|
|
29667
29698
|
case API_ERROR.sourceKeyHoldNeedsFirstUpload:
|
|
29668
29699
|
return new CliError(message ?? "That video is already published, and this Mereon cannot hold a new recording for it.", {
|
|
@@ -29705,8 +29736,8 @@ function tellRequestOf(raw) {
|
|
|
29705
29736
|
const colon = value.indexOf(":");
|
|
29706
29737
|
if (colon === -1) return void 0;
|
|
29707
29738
|
const kind = KINDS.find((candidate) => candidate === value.slice(0, colon).trim().toLowerCase());
|
|
29708
|
-
const
|
|
29709
|
-
return kind === void 0 ||
|
|
29739
|
+
const target2 = value.slice(colon + 1).trim();
|
|
29740
|
+
return kind === void 0 || target2 === "" ? void 0 : { kind, value: target2 };
|
|
29710
29741
|
}
|
|
29711
29742
|
function parseTell(values) {
|
|
29712
29743
|
return values.map((raw) => {
|
|
@@ -29928,7 +29959,13 @@ var timelineSchema = external_exports.object({
|
|
|
29928
29959
|
/** Path only, relative to the app's URL: the host is the developer's machine. */
|
|
29929
29960
|
pagePath: external_exports.string(),
|
|
29930
29961
|
pageTitle: external_exports.string(),
|
|
29931
|
-
/**
|
|
29962
|
+
/** The script's label for the step, which Mereon Embed shows beside its number. Absent when it had none, and from a recording made before it was kept. */
|
|
29963
|
+
label: external_exports.string().optional(),
|
|
29964
|
+
/**
|
|
29965
|
+
* What the step acted on. `navigate` with nothing when it only moved.
|
|
29966
|
+
* `viewAnchor` in `targetInfo` is the anchor of the view it ended in, the
|
|
29967
|
+
* selected tab, which is not always the element's own.
|
|
29968
|
+
*/
|
|
29932
29969
|
actionType: external_exports.enum(STEP_ACTION_TYPES),
|
|
29933
29970
|
targetInfo: external_exports.record(external_exports.string(), external_exports.string()),
|
|
29934
29971
|
/** Relative to the output directory. Guide only. */
|
|
@@ -30004,16 +30041,16 @@ async function writeLast(paths, last) {
|
|
|
30004
30041
|
`);
|
|
30005
30042
|
}
|
|
30006
30043
|
async function readLast(paths) {
|
|
30007
|
-
const
|
|
30008
|
-
if (
|
|
30009
|
-
const object2 = parseJsonObject(
|
|
30044
|
+
const text2 = await readOptional(join6(paths.out, "last.json"));
|
|
30045
|
+
if (text2 === void 0) return void 0;
|
|
30046
|
+
const object2 = parseJsonObject(text2);
|
|
30010
30047
|
const parsed = object2 === void 0 ? void 0 : lastSchema.safeParse(object2);
|
|
30011
30048
|
return parsed?.success ? parsed.data : void 0;
|
|
30012
30049
|
}
|
|
30013
30050
|
async function readTimeline(paths, scriptId, output2) {
|
|
30014
|
-
const
|
|
30015
|
-
if (
|
|
30016
|
-
const object2 = parseJsonObject(
|
|
30051
|
+
const text2 = await readOptional(join6(outputDirectory(paths, scriptId, output2), TIMELINE_FILE));
|
|
30052
|
+
if (text2 === void 0) return void 0;
|
|
30053
|
+
const object2 = parseJsonObject(text2);
|
|
30017
30054
|
const parsed = object2 === void 0 ? void 0 : timelineSchema.safeParse(object2);
|
|
30018
30055
|
if (parsed === void 0 || !parsed.success) {
|
|
30019
30056
|
throw new CliError(`The recording of ${scriptId} (${output2}) is damaged.`, {
|
|
@@ -30035,6 +30072,393 @@ async function readOptional(file2) {
|
|
|
30035
30072
|
var UPLOAD_MODES = ["published", "review", "held"];
|
|
30036
30073
|
var uploadModeSchema = external_exports.enum(UPLOAD_MODES);
|
|
30037
30074
|
|
|
30075
|
+
// ../../lib/src/input/public-source-key.input.ts
|
|
30076
|
+
var PUBLIC_SOURCE_KEY_MAX_LENGTH = 200;
|
|
30077
|
+
var publicSourceKeySchema = external_exports.string().trim().min(1).max(PUBLIC_SOURCE_KEY_MAX_LENGTH);
|
|
30078
|
+
|
|
30079
|
+
// ../../lib/src/input/demo-release.input.ts
|
|
30080
|
+
var DEMO_SCRIPT_ID_PATTERN = /^[a-z0-9-]+$/;
|
|
30081
|
+
var DEMO_SCRIPT_HASH_PATTERN = /^[0-9a-f]{64}$/;
|
|
30082
|
+
var GIT_COMMIT_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
30083
|
+
var RELEASE_TOKEN_REPOSITORY_MAX_LENGTH = 200;
|
|
30084
|
+
var RELEASE_TOKEN_NAME_MAX_LENGTH = 100;
|
|
30085
|
+
var DEMO_RELEASE_MAX_SCRIPTS = 500;
|
|
30086
|
+
var DEMO_RELEASE_MAX_VERIFIED_COMMITS = 10;
|
|
30087
|
+
var scriptHashSchema = external_exports.string().regex(DEMO_SCRIPT_HASH_PATTERN, "must be a lowercase SHA-256 hex digest");
|
|
30088
|
+
var commitSchema = external_exports.string().regex(GIT_COMMIT_PATTERN, "must be a full lowercase git commit id");
|
|
30089
|
+
var demoHoldInputSchema = external_exports.object({
|
|
30090
|
+
scriptHash: scriptHashSchema,
|
|
30091
|
+
requiredCommit: commitSchema
|
|
30092
|
+
});
|
|
30093
|
+
var releaseRepositorySchema = external_exports.string().trim().min(1).max(RELEASE_TOKEN_REPOSITORY_MAX_LENGTH);
|
|
30094
|
+
var demoReleaseInputSchema = external_exports.object({
|
|
30095
|
+
repository: releaseRepositorySchema,
|
|
30096
|
+
/** The project's pinned organization, refused if it is not the token's. */
|
|
30097
|
+
organizationId: external_exports.string().trim().min(1).optional(),
|
|
30098
|
+
dryRun: external_exports.boolean().optional(),
|
|
30099
|
+
/** What was deployed. Recorded on each publish for the audit log. */
|
|
30100
|
+
deployedCommit: commitSchema,
|
|
30101
|
+
scripts: external_exports.array(
|
|
30102
|
+
external_exports.object({
|
|
30103
|
+
id: external_exports.string().regex(DEMO_SCRIPT_ID_PATTERN, "must be a demo script id").max(PUBLIC_SOURCE_KEY_MAX_LENGTH),
|
|
30104
|
+
scriptHash: scriptHashSchema,
|
|
30105
|
+
verifiedCommits: external_exports.array(commitSchema).max(DEMO_RELEASE_MAX_VERIFIED_COMMITS).optional()
|
|
30106
|
+
})
|
|
30107
|
+
).max(DEMO_RELEASE_MAX_SCRIPTS)
|
|
30108
|
+
}).refine((input2) => input2.dryRun === true || input2.scripts.length > 0, {
|
|
30109
|
+
message: "A release must name at least one script. Only a dry run may name none.",
|
|
30110
|
+
path: ["scripts"]
|
|
30111
|
+
});
|
|
30112
|
+
var createReleaseTokenInputSchema = external_exports.object({
|
|
30113
|
+
name: external_exports.string().trim().min(1).max(RELEASE_TOKEN_NAME_MAX_LENGTH),
|
|
30114
|
+
repository: releaseRepositorySchema,
|
|
30115
|
+
/** 90, 365 or null (never). Omitted means 365. */
|
|
30116
|
+
expiresInDays: external_exports.union([external_exports.literal(90), external_exports.literal(365), external_exports.null()]).optional()
|
|
30117
|
+
});
|
|
30118
|
+
|
|
30119
|
+
// ../../lib/src/helpers/tag-name.ts
|
|
30120
|
+
var TAG_NAME_MAX_LENGTH = 40;
|
|
30121
|
+
var TAG_NAME_PATTERN = /^[a-z0-9]+(?:[_-][a-z0-9]+)*$/;
|
|
30122
|
+
function normalizeTagName(raw) {
|
|
30123
|
+
return raw.trim().toLowerCase().replace(/[\s./\\|+,:;@#$%^&*!?()[\]{}'"<>~`=]+/g, "-").replace(/[^a-z0-9_-]/g, "").replace(/-+/g, "-").replace(/_+/g, "_").replace(/^[-_]+|[-_]+$/g, "");
|
|
30124
|
+
}
|
|
30125
|
+
function isValidTagName(normalized) {
|
|
30126
|
+
return normalized.length > 0 && normalized.length <= TAG_NAME_MAX_LENGTH && TAG_NAME_PATTERN.test(normalized);
|
|
30127
|
+
}
|
|
30128
|
+
function asTagName(name) {
|
|
30129
|
+
return name;
|
|
30130
|
+
}
|
|
30131
|
+
function toTagName(raw) {
|
|
30132
|
+
const normalized = normalizeTagName(raw);
|
|
30133
|
+
if (!isValidTagName(normalized)) return null;
|
|
30134
|
+
return asTagName(normalized);
|
|
30135
|
+
}
|
|
30136
|
+
|
|
30137
|
+
// ../../lib/src/input/tag.input.ts
|
|
30138
|
+
var tagNameSchema = external_exports.string().transform((s, ctx) => {
|
|
30139
|
+
const name = toTagName(s);
|
|
30140
|
+
if (!name) {
|
|
30141
|
+
ctx.addIssue({
|
|
30142
|
+
code: external_exports.ZodIssueCode.custom,
|
|
30143
|
+
message: `Tag name must be 1\u2013${TAG_NAME_MAX_LENGTH} characters using letters, numbers, hyphens, or underscores`
|
|
30144
|
+
});
|
|
30145
|
+
return external_exports.NEVER;
|
|
30146
|
+
}
|
|
30147
|
+
return name;
|
|
30148
|
+
});
|
|
30149
|
+
var createTagInputSchema = external_exports.object({
|
|
30150
|
+
name: tagNameSchema
|
|
30151
|
+
});
|
|
30152
|
+
var updateTagInputSchema = external_exports.object({
|
|
30153
|
+
name: tagNameSchema
|
|
30154
|
+
});
|
|
30155
|
+
var TAG_LIST_MAX_LENGTH = 50;
|
|
30156
|
+
var tagNamesArraySchema = external_exports.array(tagNameSchema).max(TAG_LIST_MAX_LENGTH);
|
|
30157
|
+
var setEntityTagsInputSchema = external_exports.object({
|
|
30158
|
+
tags: tagNamesArraySchema
|
|
30159
|
+
});
|
|
30160
|
+
|
|
30161
|
+
// ../../lib/src/input/public-guide-upload.input.ts
|
|
30162
|
+
var MAX_GUIDE_STEPS = 500;
|
|
30163
|
+
var publicGuideStepInputSchema = external_exports.object({
|
|
30164
|
+
/** Zero-based position of this step in the guide. */
|
|
30165
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
30166
|
+
/** What the user did, e.g. `click`, `type`, `navigate`. */
|
|
30167
|
+
actionType: external_exports.string().min(1),
|
|
30168
|
+
/** Whatever identifies the element acted on, as flat string values. */
|
|
30169
|
+
targetInfo: external_exports.record(external_exports.string(), external_exports.string()),
|
|
30170
|
+
pageUrl: external_exports.string(),
|
|
30171
|
+
pageTitle: external_exports.string().optional(),
|
|
30172
|
+
/** Key returned by upload-urls for this step's screenshot. */
|
|
30173
|
+
screenshotKey: external_exports.string().min(1),
|
|
30174
|
+
/** Milliseconds from the start of the audio track, when there is one. */
|
|
30175
|
+
timestamp: external_exports.number().int().nonnegative().optional(),
|
|
30176
|
+
/** Caption to show for the step before anyone edits it. */
|
|
30177
|
+
defaultText: external_exports.string().optional()
|
|
30178
|
+
});
|
|
30179
|
+
var publicGuideUploadUrlsInputSchema = external_exports.object({
|
|
30180
|
+
title: external_exports.string().optional(),
|
|
30181
|
+
/**
|
|
30182
|
+
* How many screenshot URLs to hand back. One per step.
|
|
30183
|
+
*
|
|
30184
|
+
* Capped because each one is a signing operation on an unattended surface, so
|
|
30185
|
+
* an unbounded count is a free way to make the server work. 500 is far above
|
|
30186
|
+
* any real capture session and far below anything worth worrying about.
|
|
30187
|
+
*/
|
|
30188
|
+
screenshotCount: external_exports.number().int().nonnegative().max(MAX_GUIDE_STEPS),
|
|
30189
|
+
/** Ask for an audio upload URL as well, for a narrated guide. */
|
|
30190
|
+
includeAudio: external_exports.boolean().optional(),
|
|
30191
|
+
/**
|
|
30192
|
+
* What this guide was generated from. Send it again to update that guide
|
|
30193
|
+
* instead of creating a second. Then send it to `finalize` as well.
|
|
30194
|
+
*
|
|
30195
|
+
* Someone who cannot publish gets a proposal for an administrator: their first
|
|
30196
|
+
* upload under a key files one, uploading again replaces their own pending
|
|
30197
|
+
* proposal, and uploading over a guide that already exists proposes an update
|
|
30198
|
+
* to it. The published guide stays as it is until the update is approved.
|
|
30199
|
+
*/
|
|
30200
|
+
sourceKey: publicSourceKeySchema.optional(),
|
|
30201
|
+
/**
|
|
30202
|
+
* File another proposal beside the pending one you already have under this
|
|
30203
|
+
* key, instead of replacing it. Only meaningful when you cannot publish;
|
|
30204
|
+
* ignored otherwise. The new one is a separate item that carries no key.
|
|
30205
|
+
*/
|
|
30206
|
+
stack: external_exports.boolean().optional(),
|
|
30207
|
+
/**
|
|
30208
|
+
* Hold the upload for a release instead of publishing it: it is processed so
|
|
30209
|
+
* it can be previewed, and kept out of the library, search and the knowledge
|
|
30210
|
+
* graph until the project's CI publishes it after the change ships, or a
|
|
30211
|
+
* person publishes it from the review queue (docs/DEMO_RELEASE.md).
|
|
30212
|
+
*
|
|
30213
|
+
* Requires `sourceKey`, which is how a release finds it, and cannot be
|
|
30214
|
+
* combined with `stack`. A hold on a guide that is already published holds
|
|
30215
|
+
* the update: the published guide stays as it is until the release, which
|
|
30216
|
+
* then replaces it.
|
|
30217
|
+
*/
|
|
30218
|
+
hold: demoHoldInputSchema.optional(),
|
|
30219
|
+
/**
|
|
30220
|
+
* Who the guide is for, as on a video upload: `public` for everyone in the
|
|
30221
|
+
* organization, or `public: false` with `teamIds` for those teams, or with no
|
|
30222
|
+
* teams for administrators only. Leaving both out means everyone, which is
|
|
30223
|
+
* what this route always did.
|
|
30224
|
+
*
|
|
30225
|
+
* Decided here, at the start, and kept for `finalize`: it is part of what
|
|
30226
|
+
* decides whether the upload publishes or goes to review, so it cannot change
|
|
30227
|
+
* between the two calls. It applies when the upload creates the guide. An
|
|
30228
|
+
* upload that updates a guide that already exists leaves that guide's audience
|
|
30229
|
+
* as it is.
|
|
30230
|
+
*/
|
|
30231
|
+
public: external_exports.boolean().optional(),
|
|
30232
|
+
teamIds: external_exports.array(external_exports.string().min(1).max(200)).max(100).optional()
|
|
30233
|
+
});
|
|
30234
|
+
var publicGuideFinalizeInputSchema = external_exports.object({
|
|
30235
|
+
/** The `id` returned by upload-urls. */
|
|
30236
|
+
id: external_exports.string().min(1),
|
|
30237
|
+
/** Capped to match `screenshotCount`: one step per screenshot. */
|
|
30238
|
+
steps: external_exports.array(publicGuideStepInputSchema).max(MAX_GUIDE_STEPS),
|
|
30239
|
+
/** Key returned by upload-urls for the audio track, if one was uploaded. */
|
|
30240
|
+
audioKey: external_exports.string().optional(),
|
|
30241
|
+
/**
|
|
30242
|
+
* The same `sourceKey` sent to `upload-urls`. Required to finalize an upload
|
|
30243
|
+
* that updates an existing guide, and refused for one that names a different
|
|
30244
|
+
* guide's key, since the `id` alone proves nothing. Ignored when the guide goes
|
|
30245
|
+
* to review.
|
|
30246
|
+
*/
|
|
30247
|
+
sourceKey: publicSourceKeySchema.optional(),
|
|
30248
|
+
/**
|
|
30249
|
+
* Note for the reviewer.
|
|
30250
|
+
*
|
|
30251
|
+
* Sent here rather than with `upload-urls`, because the review request is
|
|
30252
|
+
* created at finalize and there is nowhere to hold a note before it exists.
|
|
30253
|
+
* Ignored when the guide publishes directly, since there is no reviewer to
|
|
30254
|
+
* read it.
|
|
30255
|
+
*/
|
|
30256
|
+
submitterNote: external_exports.string().max(2e3).optional(),
|
|
30257
|
+
/**
|
|
30258
|
+
* Publish as soon as the guide is finalized, instead of leaving a draft for
|
|
30259
|
+
* someone to review and publish in the editor.
|
|
30260
|
+
*
|
|
30261
|
+
* For a client that already has the exact text of every step, such as a tool
|
|
30262
|
+
* that generated the narration itself. Audio is then not transcribed: the
|
|
30263
|
+
* transcript would overwrite the text the client supplied, and a transcript
|
|
30264
|
+
* that arrives after the guide is published lands after the version is cut.
|
|
30265
|
+
* Re-publishing an existing guide asks nobody to retrain unless
|
|
30266
|
+
* `retrainingIntent` says to.
|
|
30267
|
+
*
|
|
30268
|
+
* Only the direct route honours it. A guide going to review is not the
|
|
30269
|
+
* uploader's to publish, so it is ignored there, as `submitterNote` is ignored
|
|
30270
|
+
* when the guide publishes directly. Omitting it leaves a draft, exactly as
|
|
30271
|
+
* before, which is what the browser extension's edit-then-publish flow needs.
|
|
30272
|
+
*/
|
|
30273
|
+
publish: external_exports.boolean().optional(),
|
|
30274
|
+
/**
|
|
30275
|
+
* The audio was synthesized from the steps' own text, so it is not
|
|
30276
|
+
* transcribed and the text stands.
|
|
30277
|
+
*
|
|
30278
|
+
* Without it, audio is transcribed and the transcript replaces each step's
|
|
30279
|
+
* text, which is what a recording of someone speaking needs. Unlike
|
|
30280
|
+
* `publish`, this is honored when the guide goes to review too: a tool that
|
|
30281
|
+
* generated its narration should not have its text rewritten by a reviewer's
|
|
30282
|
+
* queue. `publish: true` implies it.
|
|
30283
|
+
*/
|
|
30284
|
+
scriptedNarration: external_exports.boolean().optional(),
|
|
30285
|
+
/**
|
|
30286
|
+
* Whether people who already learned this guide should be retrained once the
|
|
30287
|
+
* update is live. Only read when the upload updates a guide that exists, and
|
|
30288
|
+
* defaults to `none`.
|
|
30289
|
+
*
|
|
30290
|
+
* `changed_material` gives them a short lesson on what changed;
|
|
30291
|
+
* `full_retake` has them take the original lesson again. An update that
|
|
30292
|
+
* publishes now applies it at once; a held one applies it when it is
|
|
30293
|
+
* released; one that goes to review is offered to the reviewer, who decides.
|
|
30294
|
+
*/
|
|
30295
|
+
retrainingIntent: external_exports.nativeEnum(RetrainingIntent).optional(),
|
|
30296
|
+
/**
|
|
30297
|
+
* Tags to file the guide under, by name. Each has to be one of the
|
|
30298
|
+
* organization's tags already (`GET /v1/tags`): a name it does not have is
|
|
30299
|
+
* refused, and nothing is finalized.
|
|
30300
|
+
*
|
|
30301
|
+
* Tags are added, never removed. A new guide gets them all, a proposal
|
|
30302
|
+
* included, so they are on it when a reviewer approves it. An update adds the
|
|
30303
|
+
* ones the guide does not have, and keeps the ones it does, when it is
|
|
30304
|
+
* applied: at once for one that publishes now, and on approval or release for
|
|
30305
|
+
* one that waits.
|
|
30306
|
+
*
|
|
30307
|
+
* Sent here rather than with `upload-urls`, for the reason `submitterNote` is:
|
|
30308
|
+
* an update that waits is filed at finalize, and there is nowhere to keep its
|
|
30309
|
+
* tags before that.
|
|
30310
|
+
*/
|
|
30311
|
+
tags: tagNamesArraySchema.optional()
|
|
30312
|
+
});
|
|
30313
|
+
|
|
30314
|
+
// ../../lib/src/validation/plain-text.ts
|
|
30315
|
+
var NO_CONTROL_CHARACTERS = /^[^\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]*$/;
|
|
30316
|
+
function plainText(max) {
|
|
30317
|
+
return external_exports.string().trim().min(1).max(max).regex(NO_CONTROL_CHARACTERS, "must not contain control characters");
|
|
30318
|
+
}
|
|
30319
|
+
|
|
30320
|
+
// ../../lib/src/input/video-steps.input.ts
|
|
30321
|
+
var MAX_STEP_MS = 24 * 60 * 60 * 1e3;
|
|
30322
|
+
var VIDEO_STEP_TEXT_LIMITS = {
|
|
30323
|
+
pagePath: 2e3,
|
|
30324
|
+
pageTitle: 500,
|
|
30325
|
+
label: 200,
|
|
30326
|
+
actionType: 50,
|
|
30327
|
+
selector: 500,
|
|
30328
|
+
tagName: 50,
|
|
30329
|
+
id: 500,
|
|
30330
|
+
anchor: 200,
|
|
30331
|
+
viewAnchor: 200,
|
|
30332
|
+
role: 100,
|
|
30333
|
+
name: 500,
|
|
30334
|
+
ariaLabel: 500,
|
|
30335
|
+
title: 500
|
|
30336
|
+
};
|
|
30337
|
+
var limit = VIDEO_STEP_TEXT_LIMITS;
|
|
30338
|
+
var videoStepTargetSchema = external_exports.object({
|
|
30339
|
+
selector: plainText(limit.selector).optional(),
|
|
30340
|
+
tagName: plainText(limit.tagName).optional(),
|
|
30341
|
+
id: plainText(limit.id).optional(),
|
|
30342
|
+
/** The element's `data-mereon-anchor`, when it had one. */
|
|
30343
|
+
anchor: plainText(limit.anchor).optional(),
|
|
30344
|
+
/**
|
|
30345
|
+
* The `data-mereon-anchor` of the view the step happened in: the selected
|
|
30346
|
+
* tab, when a screen shows several at one address. Not always the element's
|
|
30347
|
+
* own, since a step can act on something inside a view.
|
|
30348
|
+
*/
|
|
30349
|
+
viewAnchor: plainText(limit.viewAnchor).optional(),
|
|
30350
|
+
role: plainText(limit.role).optional(),
|
|
30351
|
+
name: plainText(limit.name).optional(),
|
|
30352
|
+
ariaLabel: plainText(limit.ariaLabel).optional(),
|
|
30353
|
+
title: plainText(limit.title).optional()
|
|
30354
|
+
});
|
|
30355
|
+
var videoStepSchema = external_exports.object({
|
|
30356
|
+
sequence: external_exports.number().int().min(0).max(MAX_GUIDE_STEPS),
|
|
30357
|
+
/** The page's path, or its whole address, as recorded. */
|
|
30358
|
+
pagePath: plainText(limit.pagePath),
|
|
30359
|
+
pageTitle: plainText(limit.pageTitle).optional(),
|
|
30360
|
+
/** What the step is called: a demo script's step label, a few words, shown beside its number. */
|
|
30361
|
+
label: plainText(limit.label).optional(),
|
|
30362
|
+
/** What the step did there: click, type, highlight, navigate, and so on. */
|
|
30363
|
+
actionType: plainText(limit.actionType).optional(),
|
|
30364
|
+
targetInfo: videoStepTargetSchema.optional(),
|
|
30365
|
+
/** Milliseconds from the start of the video. */
|
|
30366
|
+
offsetMs: external_exports.number().int().min(0).max(MAX_STEP_MS),
|
|
30367
|
+
durationMs: external_exports.number().int().min(0).max(MAX_STEP_MS).optional()
|
|
30368
|
+
});
|
|
30369
|
+
function orderedVideoSteps(min) {
|
|
30370
|
+
return external_exports.array(videoStepSchema).min(min).max(MAX_GUIDE_STEPS).superRefine((steps, context) => {
|
|
30371
|
+
steps.forEach((step, index) => {
|
|
30372
|
+
const previous = steps[index - 1];
|
|
30373
|
+
if (previous === void 0) return;
|
|
30374
|
+
if (step.sequence <= previous.sequence) {
|
|
30375
|
+
context.addIssue({
|
|
30376
|
+
code: "custom",
|
|
30377
|
+
path: [index, "sequence"],
|
|
30378
|
+
message: "Each step comes after the one before."
|
|
30379
|
+
});
|
|
30380
|
+
}
|
|
30381
|
+
if (step.offsetMs < previous.offsetMs) {
|
|
30382
|
+
context.addIssue({
|
|
30383
|
+
code: "custom",
|
|
30384
|
+
path: [index, "offsetMs"],
|
|
30385
|
+
message: "A step cannot start before the one before it."
|
|
30386
|
+
});
|
|
30387
|
+
}
|
|
30388
|
+
});
|
|
30389
|
+
});
|
|
30390
|
+
}
|
|
30391
|
+
var videoStepsSchema = orderedVideoSteps(1);
|
|
30392
|
+
var replaceVideoStepsInputSchema = external_exports.object({
|
|
30393
|
+
steps: orderedVideoSteps(0)
|
|
30394
|
+
});
|
|
30395
|
+
var replaceVideoStepsBySourceKeyInputSchema = replaceVideoStepsInputSchema.extend({ sourceKey: publicSourceKeySchema });
|
|
30396
|
+
|
|
30397
|
+
// src/upload/video-steps.ts
|
|
30398
|
+
var CONTROL_CHARACTERS = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g;
|
|
30399
|
+
var TARGET_KEYS = [
|
|
30400
|
+
"selector",
|
|
30401
|
+
"tagName",
|
|
30402
|
+
"id",
|
|
30403
|
+
"anchor",
|
|
30404
|
+
"viewAnchor",
|
|
30405
|
+
"role",
|
|
30406
|
+
"name",
|
|
30407
|
+
"ariaLabel",
|
|
30408
|
+
"title"
|
|
30409
|
+
];
|
|
30410
|
+
function text(value, max) {
|
|
30411
|
+
if (value === void 0) return void 0;
|
|
30412
|
+
const cleaned = value.replace(CONTROL_CHARACTERS, "").trim().slice(0, max).trim();
|
|
30413
|
+
return cleaned === "" ? void 0 : cleaned;
|
|
30414
|
+
}
|
|
30415
|
+
function target(info) {
|
|
30416
|
+
const out = {};
|
|
30417
|
+
for (const key of TARGET_KEYS) {
|
|
30418
|
+
const value = text(info[key], VIDEO_STEP_TEXT_LIMITS[key]);
|
|
30419
|
+
if (value !== void 0) out[key] = value;
|
|
30420
|
+
}
|
|
30421
|
+
return Object.keys(out).length === 0 ? void 0 : out;
|
|
30422
|
+
}
|
|
30423
|
+
function labelOf(timeline, index) {
|
|
30424
|
+
const own2 = timeline.steps[index]?.label;
|
|
30425
|
+
if (own2 !== void 0) return own2;
|
|
30426
|
+
const chapters = timeline.script?.chapters ?? null;
|
|
30427
|
+
return chapters !== null && chapters.length === timeline.steps.length ? chapters[index]?.title : void 0;
|
|
30428
|
+
}
|
|
30429
|
+
function videoSteps(timeline) {
|
|
30430
|
+
if (timeline.steps.length === 0) return { steps: null, reason: "the recording has no steps" };
|
|
30431
|
+
const steps = [];
|
|
30432
|
+
for (const [index, step] of timeline.steps.entries()) {
|
|
30433
|
+
const pagePath = text(step.pagePath, VIDEO_STEP_TEXT_LIMITS.pagePath);
|
|
30434
|
+
if (pagePath === void 0) continue;
|
|
30435
|
+
const pageTitle = text(step.pageTitle, VIDEO_STEP_TEXT_LIMITS.pageTitle);
|
|
30436
|
+
const label = text(labelOf(timeline, index), VIDEO_STEP_TEXT_LIMITS.label);
|
|
30437
|
+
const actionType = text(step.actionType, VIDEO_STEP_TEXT_LIMITS.actionType);
|
|
30438
|
+
const targetInfo = target(step.targetInfo);
|
|
30439
|
+
steps.push({
|
|
30440
|
+
// The step's own number, as the API's documentation numbers them and as
|
|
30441
|
+
// `demo steps` sends them again, so a match names the step the script did.
|
|
30442
|
+
sequence: step.number,
|
|
30443
|
+
pagePath,
|
|
30444
|
+
...pageTitle !== void 0 ? { pageTitle } : {},
|
|
30445
|
+
...label !== void 0 ? { label } : {},
|
|
30446
|
+
...actionType !== void 0 ? { actionType } : {},
|
|
30447
|
+
...targetInfo !== void 0 ? { targetInfo } : {},
|
|
30448
|
+
// Already counted from the video's start, a branded title card included.
|
|
30449
|
+
offsetMs: step.offsetMs,
|
|
30450
|
+
durationMs: step.durationMs
|
|
30451
|
+
});
|
|
30452
|
+
}
|
|
30453
|
+
const checked = videoStepsSchema.safeParse(steps);
|
|
30454
|
+
if (!checked.success) {
|
|
30455
|
+
const issue2 = checked.error.issues[0];
|
|
30456
|
+
const where = issue2 === void 0 ? "" : ` (${issue2.path.join(".")}: ${issue2.message})`;
|
|
30457
|
+
return { steps: null, reason: `its steps do not fit what Mereon accepts${where}` };
|
|
30458
|
+
}
|
|
30459
|
+
return { steps: checked.data };
|
|
30460
|
+
}
|
|
30461
|
+
|
|
30038
30462
|
// src/upload/video.ts
|
|
30039
30463
|
var initSchema = external_exports.object({
|
|
30040
30464
|
videoId: external_exports.string().min(1),
|
|
@@ -30074,6 +30498,18 @@ async function completeVideoUpload(client, videoId, wording, updateId) {
|
|
|
30074
30498
|
}
|
|
30075
30499
|
async function uploadVideo(options) {
|
|
30076
30500
|
const { client, timeline } = options;
|
|
30501
|
+
const steps = videoSteps(timeline);
|
|
30502
|
+
if (steps.steps === null) {
|
|
30503
|
+
options.log(
|
|
30504
|
+
`Warning: the video goes up without its steps, because ${steps.reason}, so Mereon Embed will not find it on any screen of your app.`
|
|
30505
|
+
);
|
|
30506
|
+
} else {
|
|
30507
|
+
const count = steps.steps.length;
|
|
30508
|
+
const anchored = steps.steps.filter((step) => step.targetInfo?.anchor !== void 0).length;
|
|
30509
|
+
options.log(
|
|
30510
|
+
`Sending its ${count} step${count === 1 ? "" : "s"} for Mereon Embed to match to your app's screens${anchored > 0 ? `, ${anchored} on an element marked data-mereon-anchor` : ""}.`
|
|
30511
|
+
);
|
|
30512
|
+
}
|
|
30077
30513
|
const request = {
|
|
30078
30514
|
filename: `${timeline.title}.mp4`,
|
|
30079
30515
|
contentType: "video/mp4",
|
|
@@ -30098,7 +30534,8 @@ async function uploadVideo(options) {
|
|
|
30098
30534
|
...timeline.script.chapters !== null ? { chapters: timeline.script.chapters } : {},
|
|
30099
30535
|
language: "en"
|
|
30100
30536
|
}
|
|
30101
|
-
} : {}
|
|
30537
|
+
} : {},
|
|
30538
|
+
...steps.steps !== null ? { steps: steps.steps } : {}
|
|
30102
30539
|
};
|
|
30103
30540
|
const started = await client.postJson("/v1/videos/upload/init", request, initSchema, options.wording);
|
|
30104
30541
|
let bytes;
|
|
@@ -30128,52 +30565,11 @@ async function uploadVideo(options) {
|
|
|
30128
30565
|
...completed.url !== void 0 ? { url: completed.url } : {},
|
|
30129
30566
|
...started.replacedPending === true ? { replacedPending: true } : {},
|
|
30130
30567
|
// From init, where the video was tagged.
|
|
30131
|
-
...started.tags !== void 0 ? { tags: started.tags } : {}
|
|
30568
|
+
...started.tags !== void 0 ? { tags: started.tags } : {},
|
|
30569
|
+
steps: steps.steps === null ? 0 : steps.steps.length
|
|
30132
30570
|
};
|
|
30133
30571
|
}
|
|
30134
30572
|
|
|
30135
|
-
// ../../lib/src/helpers/tag-name.ts
|
|
30136
|
-
var TAG_NAME_MAX_LENGTH = 40;
|
|
30137
|
-
var TAG_NAME_PATTERN = /^[a-z0-9]+(?:[_-][a-z0-9]+)*$/;
|
|
30138
|
-
function normalizeTagName(raw) {
|
|
30139
|
-
return raw.trim().toLowerCase().replace(/[\s./\\|+,:;@#$%^&*!?()[\]{}'"<>~`=]+/g, "-").replace(/[^a-z0-9_-]/g, "").replace(/-+/g, "-").replace(/_+/g, "_").replace(/^[-_]+|[-_]+$/g, "");
|
|
30140
|
-
}
|
|
30141
|
-
function isValidTagName(normalized) {
|
|
30142
|
-
return normalized.length > 0 && normalized.length <= TAG_NAME_MAX_LENGTH && TAG_NAME_PATTERN.test(normalized);
|
|
30143
|
-
}
|
|
30144
|
-
function asTagName(name) {
|
|
30145
|
-
return name;
|
|
30146
|
-
}
|
|
30147
|
-
function toTagName(raw) {
|
|
30148
|
-
const normalized = normalizeTagName(raw);
|
|
30149
|
-
if (!isValidTagName(normalized)) return null;
|
|
30150
|
-
return asTagName(normalized);
|
|
30151
|
-
}
|
|
30152
|
-
|
|
30153
|
-
// ../../lib/src/input/tag.input.ts
|
|
30154
|
-
var tagNameSchema = external_exports.string().transform((s, ctx) => {
|
|
30155
|
-
const name = toTagName(s);
|
|
30156
|
-
if (!name) {
|
|
30157
|
-
ctx.addIssue({
|
|
30158
|
-
code: external_exports.ZodIssueCode.custom,
|
|
30159
|
-
message: `Tag name must be 1\u2013${TAG_NAME_MAX_LENGTH} characters using letters, numbers, hyphens, or underscores`
|
|
30160
|
-
});
|
|
30161
|
-
return external_exports.NEVER;
|
|
30162
|
-
}
|
|
30163
|
-
return name;
|
|
30164
|
-
});
|
|
30165
|
-
var createTagInputSchema = external_exports.object({
|
|
30166
|
-
name: tagNameSchema
|
|
30167
|
-
});
|
|
30168
|
-
var updateTagInputSchema = external_exports.object({
|
|
30169
|
-
name: tagNameSchema
|
|
30170
|
-
});
|
|
30171
|
-
var TAG_LIST_MAX_LENGTH = 50;
|
|
30172
|
-
var tagNamesArraySchema = external_exports.array(tagNameSchema).max(TAG_LIST_MAX_LENGTH);
|
|
30173
|
-
var setEntityTagsInputSchema = external_exports.object({
|
|
30174
|
-
tags: tagNamesArraySchema
|
|
30175
|
-
});
|
|
30176
|
-
|
|
30177
30573
|
// src/script/tags.ts
|
|
30178
30574
|
var NOT_A_TAG = `is not a tag name: it needs letters or numbers, and at most ${TAG_NAME_MAX_LENGTH} characters as Mereon writes it`;
|
|
30179
30575
|
var demoTagsSchema = external_exports.array(external_exports.string().refine((value) => toTagName(value) !== null, { message: NOT_A_TAG })).max(TAG_LIST_MAX_LENGTH, `names more than ${TAG_LIST_MAX_LENGTH} tags`);
|
|
@@ -30274,211 +30670,14 @@ import { readFile as readFile9 } from "node:fs/promises";
|
|
|
30274
30670
|
import { join as join9 } from "node:path";
|
|
30275
30671
|
import { pathToFileURL } from "node:url";
|
|
30276
30672
|
|
|
30277
|
-
// ../../lib/src/input/public-source-key.input.ts
|
|
30278
|
-
var PUBLIC_SOURCE_KEY_MAX_LENGTH = 200;
|
|
30279
|
-
var publicSourceKeySchema = external_exports.string().trim().min(1).max(PUBLIC_SOURCE_KEY_MAX_LENGTH);
|
|
30280
|
-
|
|
30281
|
-
// ../../lib/src/input/demo-release.input.ts
|
|
30282
|
-
var DEMO_SCRIPT_ID_PATTERN = /^[a-z0-9-]+$/;
|
|
30283
|
-
var DEMO_SCRIPT_HASH_PATTERN = /^[0-9a-f]{64}$/;
|
|
30284
|
-
var GIT_COMMIT_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
30285
|
-
var RELEASE_TOKEN_REPOSITORY_MAX_LENGTH = 200;
|
|
30286
|
-
var RELEASE_TOKEN_NAME_MAX_LENGTH = 100;
|
|
30287
|
-
var DEMO_RELEASE_MAX_SCRIPTS = 500;
|
|
30288
|
-
var DEMO_RELEASE_MAX_VERIFIED_COMMITS = 10;
|
|
30289
|
-
var scriptHashSchema = external_exports.string().regex(DEMO_SCRIPT_HASH_PATTERN, "must be a lowercase SHA-256 hex digest");
|
|
30290
|
-
var commitSchema = external_exports.string().regex(GIT_COMMIT_PATTERN, "must be a full lowercase git commit id");
|
|
30291
|
-
var demoHoldInputSchema = external_exports.object({
|
|
30292
|
-
scriptHash: scriptHashSchema,
|
|
30293
|
-
requiredCommit: commitSchema
|
|
30294
|
-
});
|
|
30295
|
-
var releaseRepositorySchema = external_exports.string().trim().min(1).max(RELEASE_TOKEN_REPOSITORY_MAX_LENGTH);
|
|
30296
|
-
var demoReleaseInputSchema = external_exports.object({
|
|
30297
|
-
repository: releaseRepositorySchema,
|
|
30298
|
-
/** The project's pinned organization, refused if it is not the token's. */
|
|
30299
|
-
organizationId: external_exports.string().trim().min(1).optional(),
|
|
30300
|
-
dryRun: external_exports.boolean().optional(),
|
|
30301
|
-
/** What was deployed. Recorded on each publish for the audit log. */
|
|
30302
|
-
deployedCommit: commitSchema,
|
|
30303
|
-
scripts: external_exports.array(
|
|
30304
|
-
external_exports.object({
|
|
30305
|
-
id: external_exports.string().regex(DEMO_SCRIPT_ID_PATTERN, "must be a demo script id").max(PUBLIC_SOURCE_KEY_MAX_LENGTH),
|
|
30306
|
-
scriptHash: scriptHashSchema,
|
|
30307
|
-
verifiedCommits: external_exports.array(commitSchema).max(DEMO_RELEASE_MAX_VERIFIED_COMMITS).optional()
|
|
30308
|
-
})
|
|
30309
|
-
).max(DEMO_RELEASE_MAX_SCRIPTS)
|
|
30310
|
-
}).refine((input2) => input2.dryRun === true || input2.scripts.length > 0, {
|
|
30311
|
-
message: "A release must name at least one script. Only a dry run may name none.",
|
|
30312
|
-
path: ["scripts"]
|
|
30313
|
-
});
|
|
30314
|
-
var createReleaseTokenInputSchema = external_exports.object({
|
|
30315
|
-
name: external_exports.string().trim().min(1).max(RELEASE_TOKEN_NAME_MAX_LENGTH),
|
|
30316
|
-
repository: releaseRepositorySchema,
|
|
30317
|
-
/** 90, 365 or null (never). Omitted means 365. */
|
|
30318
|
-
expiresInDays: external_exports.union([external_exports.literal(90), external_exports.literal(365), external_exports.null()]).optional()
|
|
30319
|
-
});
|
|
30320
|
-
|
|
30321
|
-
// ../../lib/src/input/public-guide-upload.input.ts
|
|
30322
|
-
var MAX_GUIDE_STEPS = 500;
|
|
30323
|
-
var publicGuideStepInputSchema = external_exports.object({
|
|
30324
|
-
/** Zero-based position of this step in the guide. */
|
|
30325
|
-
sequence: external_exports.number().int().nonnegative(),
|
|
30326
|
-
/** What the user did, e.g. `click`, `type`, `navigate`. */
|
|
30327
|
-
actionType: external_exports.string().min(1),
|
|
30328
|
-
/** Whatever identifies the element acted on, as flat string values. */
|
|
30329
|
-
targetInfo: external_exports.record(external_exports.string(), external_exports.string()),
|
|
30330
|
-
pageUrl: external_exports.string(),
|
|
30331
|
-
pageTitle: external_exports.string().optional(),
|
|
30332
|
-
/** Key returned by upload-urls for this step's screenshot. */
|
|
30333
|
-
screenshotKey: external_exports.string().min(1),
|
|
30334
|
-
/** Milliseconds from the start of the audio track, when there is one. */
|
|
30335
|
-
timestamp: external_exports.number().int().nonnegative().optional(),
|
|
30336
|
-
/** Caption to show for the step before anyone edits it. */
|
|
30337
|
-
defaultText: external_exports.string().optional()
|
|
30338
|
-
});
|
|
30339
|
-
var publicGuideUploadUrlsInputSchema = external_exports.object({
|
|
30340
|
-
title: external_exports.string().optional(),
|
|
30341
|
-
/**
|
|
30342
|
-
* How many screenshot URLs to hand back. One per step.
|
|
30343
|
-
*
|
|
30344
|
-
* Capped because each one is a signing operation on an unattended surface, so
|
|
30345
|
-
* an unbounded count is a free way to make the server work. 500 is far above
|
|
30346
|
-
* any real capture session and far below anything worth worrying about.
|
|
30347
|
-
*/
|
|
30348
|
-
screenshotCount: external_exports.number().int().nonnegative().max(MAX_GUIDE_STEPS),
|
|
30349
|
-
/** Ask for an audio upload URL as well, for a narrated guide. */
|
|
30350
|
-
includeAudio: external_exports.boolean().optional(),
|
|
30351
|
-
/**
|
|
30352
|
-
* What this guide was generated from. Send it again to update that guide
|
|
30353
|
-
* instead of creating a second. Then send it to `finalize` as well.
|
|
30354
|
-
*
|
|
30355
|
-
* Someone who cannot publish gets a proposal for an administrator: their first
|
|
30356
|
-
* upload under a key files one, uploading again replaces their own pending
|
|
30357
|
-
* proposal, and uploading over a guide that already exists proposes an update
|
|
30358
|
-
* to it. The published guide stays as it is until the update is approved.
|
|
30359
|
-
*/
|
|
30360
|
-
sourceKey: publicSourceKeySchema.optional(),
|
|
30361
|
-
/**
|
|
30362
|
-
* File another proposal beside the pending one you already have under this
|
|
30363
|
-
* key, instead of replacing it. Only meaningful when you cannot publish;
|
|
30364
|
-
* ignored otherwise. The new one is a separate item that carries no key.
|
|
30365
|
-
*/
|
|
30366
|
-
stack: external_exports.boolean().optional(),
|
|
30367
|
-
/**
|
|
30368
|
-
* Hold the upload for a release instead of publishing it: it is processed so
|
|
30369
|
-
* it can be previewed, and kept out of the library, search and the knowledge
|
|
30370
|
-
* graph until the project's CI publishes it after the change ships, or a
|
|
30371
|
-
* person publishes it from the review queue (docs/DEMO_RELEASE.md).
|
|
30372
|
-
*
|
|
30373
|
-
* Requires `sourceKey`, which is how a release finds it, and cannot be
|
|
30374
|
-
* combined with `stack`. A hold on a guide that is already published holds
|
|
30375
|
-
* the update: the published guide stays as it is until the release, which
|
|
30376
|
-
* then replaces it.
|
|
30377
|
-
*/
|
|
30378
|
-
hold: demoHoldInputSchema.optional(),
|
|
30379
|
-
/**
|
|
30380
|
-
* Who the guide is for, as on a video upload: `public` for everyone in the
|
|
30381
|
-
* organization, or `public: false` with `teamIds` for those teams, or with no
|
|
30382
|
-
* teams for administrators only. Leaving both out means everyone, which is
|
|
30383
|
-
* what this route always did.
|
|
30384
|
-
*
|
|
30385
|
-
* Decided here, at the start, and kept for `finalize`: it is part of what
|
|
30386
|
-
* decides whether the upload publishes or goes to review, so it cannot change
|
|
30387
|
-
* between the two calls. It applies when the upload creates the guide. An
|
|
30388
|
-
* upload that updates a guide that already exists leaves that guide's audience
|
|
30389
|
-
* as it is.
|
|
30390
|
-
*/
|
|
30391
|
-
public: external_exports.boolean().optional(),
|
|
30392
|
-
teamIds: external_exports.array(external_exports.string().min(1).max(200)).max(100).optional()
|
|
30393
|
-
});
|
|
30394
|
-
var publicGuideFinalizeInputSchema = external_exports.object({
|
|
30395
|
-
/** The `id` returned by upload-urls. */
|
|
30396
|
-
id: external_exports.string().min(1),
|
|
30397
|
-
/** Capped to match `screenshotCount`: one step per screenshot. */
|
|
30398
|
-
steps: external_exports.array(publicGuideStepInputSchema).max(MAX_GUIDE_STEPS),
|
|
30399
|
-
/** Key returned by upload-urls for the audio track, if one was uploaded. */
|
|
30400
|
-
audioKey: external_exports.string().optional(),
|
|
30401
|
-
/**
|
|
30402
|
-
* The same `sourceKey` sent to `upload-urls`. Required to finalize an upload
|
|
30403
|
-
* that updates an existing guide, and refused for one that names a different
|
|
30404
|
-
* guide's key, since the `id` alone proves nothing. Ignored when the guide goes
|
|
30405
|
-
* to review.
|
|
30406
|
-
*/
|
|
30407
|
-
sourceKey: publicSourceKeySchema.optional(),
|
|
30408
|
-
/**
|
|
30409
|
-
* Note for the reviewer.
|
|
30410
|
-
*
|
|
30411
|
-
* Sent here rather than with `upload-urls`, because the review request is
|
|
30412
|
-
* created at finalize and there is nowhere to hold a note before it exists.
|
|
30413
|
-
* Ignored when the guide publishes directly, since there is no reviewer to
|
|
30414
|
-
* read it.
|
|
30415
|
-
*/
|
|
30416
|
-
submitterNote: external_exports.string().max(2e3).optional(),
|
|
30417
|
-
/**
|
|
30418
|
-
* Publish as soon as the guide is finalized, instead of leaving a draft for
|
|
30419
|
-
* someone to review and publish in the editor.
|
|
30420
|
-
*
|
|
30421
|
-
* For a client that already has the exact text of every step, such as a tool
|
|
30422
|
-
* that generated the narration itself. Audio is then not transcribed: the
|
|
30423
|
-
* transcript would overwrite the text the client supplied, and a transcript
|
|
30424
|
-
* that arrives after the guide is published lands after the version is cut.
|
|
30425
|
-
* Re-publishing an existing guide asks nobody to retrain unless
|
|
30426
|
-
* `retrainingIntent` says to.
|
|
30427
|
-
*
|
|
30428
|
-
* Only the direct route honours it. A guide going to review is not the
|
|
30429
|
-
* uploader's to publish, so it is ignored there, as `submitterNote` is ignored
|
|
30430
|
-
* when the guide publishes directly. Omitting it leaves a draft, exactly as
|
|
30431
|
-
* before, which is what the browser extension's edit-then-publish flow needs.
|
|
30432
|
-
*/
|
|
30433
|
-
publish: external_exports.boolean().optional(),
|
|
30434
|
-
/**
|
|
30435
|
-
* The audio was synthesized from the steps' own text, so it is not
|
|
30436
|
-
* transcribed and the text stands.
|
|
30437
|
-
*
|
|
30438
|
-
* Without it, audio is transcribed and the transcript replaces each step's
|
|
30439
|
-
* text, which is what a recording of someone speaking needs. Unlike
|
|
30440
|
-
* `publish`, this is honored when the guide goes to review too: a tool that
|
|
30441
|
-
* generated its narration should not have its text rewritten by a reviewer's
|
|
30442
|
-
* queue. `publish: true` implies it.
|
|
30443
|
-
*/
|
|
30444
|
-
scriptedNarration: external_exports.boolean().optional(),
|
|
30445
|
-
/**
|
|
30446
|
-
* Whether people who already learned this guide should be retrained once the
|
|
30447
|
-
* update is live. Only read when the upload updates a guide that exists, and
|
|
30448
|
-
* defaults to `none`.
|
|
30449
|
-
*
|
|
30450
|
-
* `changed_material` gives them a short lesson on what changed;
|
|
30451
|
-
* `full_retake` has them take the original lesson again. An update that
|
|
30452
|
-
* publishes now applies it at once; a held one applies it when it is
|
|
30453
|
-
* released; one that goes to review is offered to the reviewer, who decides.
|
|
30454
|
-
*/
|
|
30455
|
-
retrainingIntent: external_exports.nativeEnum(RetrainingIntent).optional(),
|
|
30456
|
-
/**
|
|
30457
|
-
* Tags to file the guide under, by name. Each has to be one of the
|
|
30458
|
-
* organization's tags already (`GET /v1/tags`): a name it does not have is
|
|
30459
|
-
* refused, and nothing is finalized.
|
|
30460
|
-
*
|
|
30461
|
-
* Tags are added, never removed. A new guide gets them all, a proposal
|
|
30462
|
-
* included, so they are on it when a reviewer approves it. An update adds the
|
|
30463
|
-
* ones the guide does not have, and keeps the ones it does, when it is
|
|
30464
|
-
* applied: at once for one that publishes now, and on approval or release for
|
|
30465
|
-
* one that waits.
|
|
30466
|
-
*
|
|
30467
|
-
* Sent here rather than with `upload-urls`, for the reason `submitterNote` is:
|
|
30468
|
-
* an update that waits is filed at finalize, and there is nowhere to keep its
|
|
30469
|
-
* tags before that.
|
|
30470
|
-
*/
|
|
30471
|
-
tags: tagNamesArraySchema.optional()
|
|
30472
|
-
});
|
|
30473
|
-
|
|
30474
30673
|
// src/script/cues.ts
|
|
30475
30674
|
var MIN_CUE_WORDS = 2;
|
|
30476
30675
|
var MAX_CUE_WORDS = 4;
|
|
30477
30676
|
function normalizeWord(word) {
|
|
30478
30677
|
return word.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "");
|
|
30479
30678
|
}
|
|
30480
|
-
function narrationWords(
|
|
30481
|
-
return
|
|
30679
|
+
function narrationWords(text2) {
|
|
30680
|
+
return text2.split(/\s+/).filter((word) => word !== "");
|
|
30482
30681
|
}
|
|
30483
30682
|
function phraseWords(phrase) {
|
|
30484
30683
|
return narrationWords(phrase).map(normalizeWord).filter((word) => word !== "");
|
|
@@ -30682,14 +30881,14 @@ function recaptureHint(name, env, initialUrl = false) {
|
|
|
30682
30881
|
return `The app's address is still ${INITIAL_URL}, which \`demo init\` writes until someone sets it. If the app answering there is not this project's, the session is not the problem: set the project's address with \`${cliCommand(env)} config set url <address>\`, or in DEMO_URL when another project holds that port only on this machine. If it is this project's app, run ${again}`;
|
|
30683
30882
|
}
|
|
30684
30883
|
async function readSaved(paths, name) {
|
|
30685
|
-
let
|
|
30884
|
+
let text2;
|
|
30686
30885
|
try {
|
|
30687
|
-
|
|
30886
|
+
text2 = await readFile7(profileFile(paths, name), "utf8");
|
|
30688
30887
|
} catch {
|
|
30689
30888
|
return "missing";
|
|
30690
30889
|
}
|
|
30691
30890
|
try {
|
|
30692
|
-
const parsed = savedFileSchema.safeParse(JSON.parse(
|
|
30891
|
+
const parsed = savedFileSchema.safeParse(JSON.parse(text2));
|
|
30693
30892
|
return parsed.success ? parsed.data : "unreadable";
|
|
30694
30893
|
} catch {
|
|
30695
30894
|
return "unreadable";
|
|
@@ -30703,8 +30902,8 @@ function decrypt(saved, key) {
|
|
|
30703
30902
|
const decipher = createDecipheriv("aes-256-gcm", key.key, Buffer.from(saved.iv, "base64"));
|
|
30704
30903
|
decipher.setAAD(ASSOCIATED_DATA);
|
|
30705
30904
|
decipher.setAuthTag(Buffer.from(saved.tag, "base64"));
|
|
30706
|
-
const
|
|
30707
|
-
const parsed = storageStateSchema.safeParse(JSON.parse(
|
|
30905
|
+
const text2 = Buffer.concat([decipher.update(Buffer.from(saved.data, "base64")), decipher.final()]).toString("utf8");
|
|
30906
|
+
const parsed = storageStateSchema.safeParse(JSON.parse(text2));
|
|
30708
30907
|
return parsed.success ? parsed.data : void 0;
|
|
30709
30908
|
} catch {
|
|
30710
30909
|
return void 0;
|
|
@@ -30741,9 +30940,9 @@ import { readFile as readFile8 } from "node:fs/promises";
|
|
|
30741
30940
|
import { resolve as resolve2 } from "node:path";
|
|
30742
30941
|
|
|
30743
30942
|
// src/secrets/dotenv.ts
|
|
30744
|
-
function parseDotenv(
|
|
30943
|
+
function parseDotenv(text2) {
|
|
30745
30944
|
const values = /* @__PURE__ */ new Map();
|
|
30746
|
-
for (const raw of
|
|
30945
|
+
for (const raw of text2.split(/\r?\n/)) {
|
|
30747
30946
|
const line = raw.trim();
|
|
30748
30947
|
if (line === "" || line.startsWith("#")) continue;
|
|
30749
30948
|
const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\s*=\s*(.*)$/.exec(line);
|
|
@@ -30771,18 +30970,18 @@ function opensMultilineValue(line) {
|
|
|
30771
30970
|
const quote2 = rest[0];
|
|
30772
30971
|
return (quote2 === '"' || quote2 === "'") && closingQuote(rest, quote2) === -1;
|
|
30773
30972
|
}
|
|
30774
|
-
function closingQuote(
|
|
30775
|
-
for (let index = 1; index <
|
|
30776
|
-
if (
|
|
30973
|
+
function closingQuote(text2, quote2) {
|
|
30974
|
+
for (let index = 1; index < text2.length; index++) {
|
|
30975
|
+
if (text2[index] === "\\" && quote2 === '"') {
|
|
30777
30976
|
index++;
|
|
30778
30977
|
continue;
|
|
30779
30978
|
}
|
|
30780
|
-
if (
|
|
30979
|
+
if (text2[index] === quote2) return index;
|
|
30781
30980
|
}
|
|
30782
30981
|
return -1;
|
|
30783
30982
|
}
|
|
30784
|
-
function unescapeDouble(
|
|
30785
|
-
return
|
|
30983
|
+
function unescapeDouble(text2) {
|
|
30984
|
+
return text2.replace(
|
|
30786
30985
|
/\\([nrt"\\])/g,
|
|
30787
30986
|
(_, char) => char === "n" ? "\n" : char === "r" ? "\r" : char === "t" ? " " : char
|
|
30788
30987
|
);
|
|
@@ -30799,8 +30998,8 @@ var SecretSet = class _SecretSet {
|
|
|
30799
30998
|
this.values = values;
|
|
30800
30999
|
const needles = [];
|
|
30801
31000
|
for (const [name, value] of values) {
|
|
30802
|
-
const add = (
|
|
30803
|
-
if (
|
|
31001
|
+
const add = (text2, form) => {
|
|
31002
|
+
if (text2 !== "" && !needles.some((needle) => needle.text === text2)) needles.push({ name, text: text2, form });
|
|
30804
31003
|
};
|
|
30805
31004
|
add(value, "value");
|
|
30806
31005
|
add(encodeURIComponent(value), "url-encoded");
|
|
@@ -30834,15 +31033,15 @@ var SecretSet = class _SecretSet {
|
|
|
30834
31033
|
return value;
|
|
30835
31034
|
}
|
|
30836
31035
|
/** The first secret the text shows in any form, or undefined. */
|
|
30837
|
-
findIn(
|
|
31036
|
+
findIn(text2) {
|
|
30838
31037
|
for (const needle of this.needles) {
|
|
30839
|
-
if (
|
|
31038
|
+
if (text2.includes(needle.text)) return { name: needle.name, form: needle.form };
|
|
30840
31039
|
}
|
|
30841
31040
|
return void 0;
|
|
30842
31041
|
}
|
|
30843
31042
|
/** The text with every form of every secret replaced by its name, for logs and errors. */
|
|
30844
|
-
mask(
|
|
30845
|
-
let masked =
|
|
31043
|
+
mask(text2) {
|
|
31044
|
+
let masked = text2;
|
|
30846
31045
|
for (const needle of this.needles) masked = masked.split(needle.text).join(`[${needle.name}]`);
|
|
30847
31046
|
return masked;
|
|
30848
31047
|
}
|
|
@@ -30865,13 +31064,13 @@ function endingHint(match) {
|
|
|
30865
31064
|
async function readSecrets(input2) {
|
|
30866
31065
|
const file2 = resolve2(input2.paths.root, input2.config?.file ?? DEFAULT_SECRETS_FILE);
|
|
30867
31066
|
if (input2.names.length === 0) return { secrets: SecretSet.empty(), missing: [], file: file2 };
|
|
30868
|
-
let
|
|
31067
|
+
let text2 = "";
|
|
30869
31068
|
try {
|
|
30870
|
-
|
|
31069
|
+
text2 = await readFile8(file2, "utf8");
|
|
30871
31070
|
} catch (error62) {
|
|
30872
31071
|
if (!(error62 instanceof Error && "code" in error62 && error62.code === "ENOENT")) throw error62;
|
|
30873
31072
|
}
|
|
30874
|
-
const inFile = parseDotenv(
|
|
31073
|
+
const inFile = parseDotenv(text2);
|
|
30875
31074
|
const values = /* @__PURE__ */ new Map();
|
|
30876
31075
|
const missing = [];
|
|
30877
31076
|
for (const name of input2.names) {
|
|
@@ -31019,6 +31218,7 @@ var scriptSchema = external_exports.object({
|
|
|
31019
31218
|
voice: speaker.optional()
|
|
31020
31219
|
}).strict().optional(),
|
|
31021
31220
|
captions: external_exports.boolean().optional(),
|
|
31221
|
+
checkViews: external_exports.boolean().optional(),
|
|
31022
31222
|
music: external_exports.union([external_exports.string().trim().min(1, "must be a path, or false"), external_exports.literal(false)]).optional(),
|
|
31023
31223
|
loop: external_exports.object({
|
|
31024
31224
|
step: external_exports.number().int().min(1, "counts steps from 1"),
|
|
@@ -31174,16 +31374,16 @@ function precheckScript(script) {
|
|
|
31174
31374
|
});
|
|
31175
31375
|
}
|
|
31176
31376
|
});
|
|
31177
|
-
for (const [where,
|
|
31377
|
+
for (const [where, text2] of [
|
|
31178
31378
|
["The title card", script.intro?.narration],
|
|
31179
31379
|
["The end card", script.outro?.narration],
|
|
31180
31380
|
...script.steps.map((step, index) => [`The card before step ${index + 1}`, step.interlude?.narration])
|
|
31181
31381
|
]) {
|
|
31182
|
-
if (
|
|
31382
|
+
if (text2 !== void 0 && text2.trim().length > NARRATION_MAX_CHARACTERS_PER_REQUEST) {
|
|
31183
31383
|
problems.push({
|
|
31184
31384
|
step: 0,
|
|
31185
31385
|
where,
|
|
31186
|
-
message: `The narration is ${
|
|
31386
|
+
message: `The narration is ${text2.trim().length} characters, and the limit is ${NARRATION_MAX_CHARACTERS_PER_REQUEST}. Shorten it.`
|
|
31187
31387
|
});
|
|
31188
31388
|
}
|
|
31189
31389
|
}
|
|
@@ -31201,7 +31401,7 @@ ${lines.join("\n")}`, {
|
|
|
31201
31401
|
function interludeText(card) {
|
|
31202
31402
|
if (card === void 0) return [];
|
|
31203
31403
|
const shown = card.kind === "section" ? [card.title, card.subtitle] : card.kind === "list" ? [card.title, ...card.items] : [card.title, ...card.items];
|
|
31204
|
-
return [...shown, card.narration].filter((
|
|
31404
|
+
return [...shown, card.narration].filter((text2) => text2 !== void 0);
|
|
31205
31405
|
}
|
|
31206
31406
|
function assertNoSecretsInScript(script, secrets) {
|
|
31207
31407
|
if (secrets.isEmpty) return;
|
|
@@ -31219,7 +31419,7 @@ function assertNoSecretsInScript(script, secrets) {
|
|
|
31219
31419
|
...script.steps.flatMap((step, index) => [
|
|
31220
31420
|
...step.label === void 0 ? [] : [{ where: `step ${index + 1}'s label`, text: step.label }],
|
|
31221
31421
|
{ where: `step ${index + 1}'s narration`, text: step.narration },
|
|
31222
|
-
...interludeText(step.interlude).map((
|
|
31422
|
+
...interludeText(step.interlude).map((text2) => ({ where: `the card before step ${index + 1}`, text: text2 })),
|
|
31223
31423
|
...step.cues.map((cue, cueIndex) => ({ where: `step ${index + 1}, cue ${cueIndex + 1}'s phrase`, text: cue.on }))
|
|
31224
31424
|
])
|
|
31225
31425
|
];
|
|
@@ -31506,7 +31706,7 @@ function announcementApi(client, wording) {
|
|
|
31506
31706
|
}
|
|
31507
31707
|
|
|
31508
31708
|
// src/announce/describe.ts
|
|
31509
|
-
var quote = (
|
|
31709
|
+
var quote = (text2) => text2 === null ? "a claim that has since been deleted" : `"${text2}"`;
|
|
31510
31710
|
var under = (topic) => topic === null ? "" : ` under ${topic}`;
|
|
31511
31711
|
function describeChange(change) {
|
|
31512
31712
|
const sentence = (() => {
|
|
@@ -31645,13 +31845,13 @@ function announcementFile(directory) {
|
|
|
31645
31845
|
}
|
|
31646
31846
|
async function readAnnouncementRecord(directory, owner, projectRoot) {
|
|
31647
31847
|
const path = announcementFile(directory);
|
|
31648
|
-
let
|
|
31848
|
+
let text2;
|
|
31649
31849
|
try {
|
|
31650
|
-
|
|
31850
|
+
text2 = await readFile11(path, "utf8");
|
|
31651
31851
|
} catch {
|
|
31652
31852
|
return void 0;
|
|
31653
31853
|
}
|
|
31654
|
-
const parsed = stateSchema.safeParse(parseJsonObject(
|
|
31854
|
+
const parsed = stateSchema.safeParse(parseJsonObject(text2));
|
|
31655
31855
|
if (!parsed.success) {
|
|
31656
31856
|
throw new CliError(`${relative(projectRoot, path)} cannot be read.`, {
|
|
31657
31857
|
hint: "Tell the user. Deleting it starts the announcement again from the upload, which is refused if the video was already uploaded."
|
|
@@ -31781,7 +31981,7 @@ async function announceCommand(args, context) {
|
|
|
31781
31981
|
hint: `Record it again without --draft: \`demo record ${scriptId} --output video\`.`
|
|
31782
31982
|
});
|
|
31783
31983
|
}
|
|
31784
|
-
const
|
|
31984
|
+
const text2 = values["text-file"] === void 0 ? void 0 : await readAnnouncementText(context.cwd, values["text-file"]);
|
|
31785
31985
|
await checkRedactedRecording({
|
|
31786
31986
|
paths,
|
|
31787
31987
|
config: config2,
|
|
@@ -31790,7 +31990,7 @@ async function announceCommand(args, context) {
|
|
|
31790
31990
|
sending: {
|
|
31791
31991
|
sourceKey: `${config2.source.repo}#${scriptId}`,
|
|
31792
31992
|
...title === void 0 ? {} : { title },
|
|
31793
|
-
...
|
|
31993
|
+
...text2 === void 0 ? {} : { text: text2 }
|
|
31794
31994
|
},
|
|
31795
31995
|
log: (message) => context.output.log(message)
|
|
31796
31996
|
});
|
|
@@ -31837,7 +32037,7 @@ async function announceCommand(args, context) {
|
|
|
31837
32037
|
}
|
|
31838
32038
|
const scriptAudience = chosen.timeline.audience ?? void 0;
|
|
31839
32039
|
if (announcement === null) {
|
|
31840
|
-
if (
|
|
32040
|
+
if (text2 === void 0) {
|
|
31841
32041
|
throw new CliError("An announcement needs its own words: `--text-file <path>`.", {
|
|
31842
32042
|
hint: "Write what changed and what people should do differently, show it to the user, and pass the file."
|
|
31843
32043
|
});
|
|
@@ -31883,7 +32083,7 @@ async function announceCommand(args, context) {
|
|
|
31883
32083
|
...title !== void 0 ? { title } : {},
|
|
31884
32084
|
...visibleTo !== void 0 ? { visibleTo } : {},
|
|
31885
32085
|
...values["pop-quiz"] ? { popQuiz: true } : values["no-pop-quiz"] ? { popQuiz: false } : {},
|
|
31886
|
-
...
|
|
32086
|
+
...text2 !== void 0 ? { text: text2 } : {},
|
|
31887
32087
|
...audience !== void 0 ? { audience } : {}
|
|
31888
32088
|
};
|
|
31889
32089
|
if (announcement?.status === "PLANNING") {
|
|
@@ -32046,19 +32246,19 @@ function parseVisibleTo(value) {
|
|
|
32046
32246
|
throw new CliError(`--visible-to is "everyone" or "admins", and this is "${value}".`);
|
|
32047
32247
|
}
|
|
32048
32248
|
async function readAnnouncementText(cwd, file2) {
|
|
32049
|
-
let
|
|
32249
|
+
let text2;
|
|
32050
32250
|
try {
|
|
32051
|
-
|
|
32251
|
+
text2 = await readFile12(resolve3(cwd, file2), "utf8");
|
|
32052
32252
|
} catch {
|
|
32053
32253
|
throw new CliError(`Could not read the announcement text from ${file2}.`);
|
|
32054
32254
|
}
|
|
32055
|
-
|
|
32056
|
-
if (
|
|
32057
|
-
if (
|
|
32255
|
+
text2 = text2.trim();
|
|
32256
|
+
if (text2 === "") throw new CliError(`${file2} is empty. The announcement needs its own words.`);
|
|
32257
|
+
if (text2.length > ANNOUNCEMENT_TEXT_MAX_LENGTH) {
|
|
32058
32258
|
throw new CliError(`${file2} is longer than the ${ANNOUNCEMENT_TEXT_MAX_LENGTH.toLocaleString("en-US")} characters an announcement can say.`);
|
|
32059
32259
|
}
|
|
32060
|
-
if (!isAnnouncementText(
|
|
32061
|
-
return
|
|
32260
|
+
if (!isAnnouncementText(text2)) throw new CliError(`${file2} is not text.`);
|
|
32261
|
+
return text2;
|
|
32062
32262
|
}
|
|
32063
32263
|
async function uploadForAnnouncement(chosen, paths, repo, owner, client, wording, context, sharing, tags) {
|
|
32064
32264
|
if (await scriptChangedSince(paths, chosen.timeline)) {
|
|
@@ -32130,15 +32330,15 @@ async function keepUntilApproved(directory, record2, scriptId) {
|
|
|
32130
32330
|
{ hint: `Tell the user. Once it is approved, \`demo announce ${scriptId}\` carries on from here.` }
|
|
32131
32331
|
);
|
|
32132
32332
|
}
|
|
32133
|
-
var hashText = (
|
|
32333
|
+
var hashText = (text2) => createHash4("sha256").update(text2).digest("hex");
|
|
32134
32334
|
var audienceKey = (entries) => entries.map((entry) => `${entry.actorType}:${entry.actorId}`).sort();
|
|
32135
32335
|
var sameList = (a, b) => a !== void 0 && a.length === b.length && a.every((value, index) => value === b[index]);
|
|
32136
32336
|
function changesAsked(current, requested, record2) {
|
|
32137
|
-
const
|
|
32337
|
+
const text2 = requested.text !== void 0 && hashText(requested.text) !== record2.applied?.textHash ? requested.text : void 0;
|
|
32138
32338
|
const audience = requested.audience !== void 0 && !sameList(record2.applied?.audience, audienceKey(requested.audience)) ? requested.audience : void 0;
|
|
32139
32339
|
const everyone = requested.visibleTo === void 0 ? void 0 : requested.visibleTo === "everyone";
|
|
32140
32340
|
return {
|
|
32141
|
-
...
|
|
32341
|
+
...text2 !== void 0 ? { text: text2 } : {},
|
|
32142
32342
|
...audience !== void 0 ? { audience } : {},
|
|
32143
32343
|
update: {
|
|
32144
32344
|
...requested.title !== void 0 && requested.title !== current.title ? { title: requested.title } : {},
|
|
@@ -32525,7 +32725,7 @@ async function runSeed(command, cwd, log) {
|
|
|
32525
32725
|
log(`Seeding: ${command}`);
|
|
32526
32726
|
const result = await exec("sh", ["-c", command], { cwd });
|
|
32527
32727
|
if (result.code !== 0) {
|
|
32528
|
-
const lastLine = (
|
|
32728
|
+
const lastLine = (text2) => text2.split("\n").map((line) => line.trim()).filter((line) => line !== "").at(-1);
|
|
32529
32729
|
const said = lastLine(result.stderr) ?? lastLine(result.stdout);
|
|
32530
32730
|
const output2 = `${result.stdout}
|
|
32531
32731
|
${result.stderr}`.trim().split("\n").slice(-8).join("\n");
|
|
@@ -32624,9 +32824,9 @@ async function openSignedIn(page2, baseUrl, path, refused) {
|
|
|
32624
32824
|
const prompt = await signInPrompt(page2, baseUrl);
|
|
32625
32825
|
return prompt === void 0 ? { signedIn: true } : { signedIn: false, reason: prompt };
|
|
32626
32826
|
}
|
|
32627
|
-
function safeUrl(
|
|
32827
|
+
function safeUrl(text2) {
|
|
32628
32828
|
try {
|
|
32629
|
-
return new URL(
|
|
32829
|
+
return new URL(text2);
|
|
32630
32830
|
} catch {
|
|
32631
32831
|
return void 0;
|
|
32632
32832
|
}
|
|
@@ -32885,6 +33085,7 @@ var DEMO_RELEASE_OUTCOMES = [
|
|
|
32885
33085
|
|
|
32886
33086
|
// src/release/client.ts
|
|
32887
33087
|
var RELEASE_TOKEN_ENV = "MEREON_RELEASE_TOKEN";
|
|
33088
|
+
var RELEASE_TOKEN_PREFIX = "mrel_";
|
|
32888
33089
|
function releaseScope(config2, deployedCommit) {
|
|
32889
33090
|
return {
|
|
32890
33091
|
repository: config2.source.repo,
|
|
@@ -32943,17 +33144,19 @@ async function postRelease(options) {
|
|
|
32943
33144
|
}
|
|
32944
33145
|
return parsed.data;
|
|
32945
33146
|
}
|
|
33147
|
+
var ReleaseTokenRefused = class extends CliError {
|
|
33148
|
+
};
|
|
32946
33149
|
async function explainFailure2(response) {
|
|
32947
33150
|
const body = apiErrorSchema2.safeParse(await response.json().catch(() => null));
|
|
32948
33151
|
const code = body.success ? body.data.errorCode : void 0;
|
|
32949
33152
|
const message = body.success ? body.data.message : void 0;
|
|
32950
33153
|
if (code === API_ERROR.releaseOrganizationMismatch || code === API_ERROR.releaseRepositoryMismatch) {
|
|
32951
|
-
return new
|
|
33154
|
+
return new ReleaseTokenRefused(message ?? "This release token is for a different project.", {
|
|
32952
33155
|
hint: "Store the token made for this repository and organization as MEREON_RELEASE_TOKEN."
|
|
32953
33156
|
});
|
|
32954
33157
|
}
|
|
32955
33158
|
if (response.status === 401) {
|
|
32956
|
-
return new
|
|
33159
|
+
return new ReleaseTokenRefused(message ?? "Mereon did not accept the release token.", {
|
|
32957
33160
|
hint: "Create a token under Settings, Release tokens, and store it as the MEREON_RELEASE_TOKEN secret in your CI."
|
|
32958
33161
|
});
|
|
32959
33162
|
}
|
|
@@ -33145,8 +33348,8 @@ function deployedCommitExpression(file2) {
|
|
|
33145
33348
|
return events.includes("workflow_run") ? "${{ github.event.workflow_run.head_sha }}" : "${{ github.sha }}";
|
|
33146
33349
|
}
|
|
33147
33350
|
function releaseJobLines(input2) {
|
|
33148
|
-
const at = (level,
|
|
33149
|
-
const item = (
|
|
33351
|
+
const at = (level, text2) => `${" ".repeat(input2.indent + level * input2.step)}${text2}`;
|
|
33352
|
+
const item = (text2) => at(2, ` ${text2}`);
|
|
33150
33353
|
const token = `\${{ secrets.${RELEASE_TOKEN_ENV} }}`;
|
|
33151
33354
|
const present = `steps.token.outputs.present == 'true'`;
|
|
33152
33355
|
return [
|
|
@@ -33224,8 +33427,8 @@ function planReleaseJob(file2, after, workingDirectory) {
|
|
|
33224
33427
|
const insertAt = last + 1;
|
|
33225
33428
|
const added = ["", ...releaseJobLines({ after, workingDirectory, commit: deployedCommitExpression(file2), indent, step })];
|
|
33226
33429
|
const next = [...lines.slice(0, insertAt), ...added, ...lines.slice(insertAt)];
|
|
33227
|
-
const
|
|
33228
|
-
const result = read({ path: file2.path, text });
|
|
33430
|
+
const text2 = next.join("\n");
|
|
33431
|
+
const result = read({ path: file2.path, text: text2 });
|
|
33229
33432
|
const job = result?.jobs[RELEASE_JOB_ID];
|
|
33230
33433
|
const othersKept = result !== void 0 && isDeepStrictEqual(
|
|
33231
33434
|
Object.fromEntries(Object.entries(result.jobs).filter(([id]) => id !== RELEASE_JOB_ID)),
|
|
@@ -33238,7 +33441,7 @@ function planReleaseJob(file2, after, workingDirectory) {
|
|
|
33238
33441
|
ok: true,
|
|
33239
33442
|
edit: {
|
|
33240
33443
|
path: file2.path,
|
|
33241
|
-
text,
|
|
33444
|
+
text: text2,
|
|
33242
33445
|
at: insertAt + 1,
|
|
33243
33446
|
added,
|
|
33244
33447
|
before: lines.slice(Math.max(jobsLine, insertAt - 3), insertAt)
|
|
@@ -33257,7 +33460,7 @@ function formatDiff(edit) {
|
|
|
33257
33460
|
}
|
|
33258
33461
|
|
|
33259
33462
|
// src/commands/ci.ts
|
|
33260
|
-
var USAGE3 = "demo ci setup [--provider github] [--after <job>] [--workflow <file>] [--yes]";
|
|
33463
|
+
var USAGE3 = "demo ci setup [--provider github] [--after <job>] [--workflow <file>] [--yes] [--paste]";
|
|
33261
33464
|
async function ciCommand(args, context, exec2 = exec) {
|
|
33262
33465
|
const [subcommand, ...rest] = args;
|
|
33263
33466
|
if (subcommand !== "setup") throw new CliError(`Usage: ${USAGE3}`);
|
|
@@ -33270,7 +33473,8 @@ async function ciCommand(args, context, exec2 = exec) {
|
|
|
33270
33473
|
provider: { type: "string", default: "github" },
|
|
33271
33474
|
after: { type: "string" },
|
|
33272
33475
|
workflow: { type: "string" },
|
|
33273
|
-
yes: { type: "boolean", default: false }
|
|
33476
|
+
yes: { type: "boolean", default: false },
|
|
33477
|
+
paste: { type: "boolean", default: false }
|
|
33274
33478
|
}
|
|
33275
33479
|
})
|
|
33276
33480
|
);
|
|
@@ -33296,7 +33500,7 @@ async function ciCommand(args, context, exec2 = exec) {
|
|
|
33296
33500
|
release = "ci";
|
|
33297
33501
|
log("Uploads from this project are now held until the release after their change is deployed (`release: ci` in demo/config.json).");
|
|
33298
33502
|
}
|
|
33299
|
-
const token = await storeToken({ context, config: config2, git, log, cli, exec: exec2 });
|
|
33503
|
+
const token = await storeToken({ context, config: config2, git, log, cli, exec: exec2, paste: values.paste });
|
|
33300
33504
|
context.output.result({ workflow: job, release, token });
|
|
33301
33505
|
}
|
|
33302
33506
|
async function addReleaseJob(input2) {
|
|
@@ -33330,10 +33534,10 @@ async function addReleaseJob(input2) {
|
|
|
33330
33534
|
);
|
|
33331
33535
|
return { state: "not-written", workflow: deploy.workflow, after: deploy.id };
|
|
33332
33536
|
}
|
|
33333
|
-
const
|
|
33334
|
-
await writeFileAtomically(
|
|
33537
|
+
const target2 = join15(input2.root, planned.edit.path);
|
|
33538
|
+
await writeFileAtomically(target2, planned.edit.text);
|
|
33335
33539
|
log(`Added the job release-demos to ${planned.edit.path}. Commit it with the rest of the change.`);
|
|
33336
|
-
const lint = await input2.exec("actionlint", [
|
|
33540
|
+
const lint = await input2.exec("actionlint", [target2], { cwd: input2.root, timeoutMs: 6e4 });
|
|
33337
33541
|
const actionlint = lint.notFound ? "not-installed" : lint.code === 0 ? "passed" : "failed";
|
|
33338
33542
|
if (actionlint === "failed") log(`actionlint found problems in ${planned.edit.path}:
|
|
33339
33543
|
${lint.stdout.trim()}`);
|
|
@@ -33384,40 +33588,72 @@ async function storeToken(input2) {
|
|
|
33384
33588
|
const repository = input2.config.source.repo;
|
|
33385
33589
|
const ghRepository = /^[\w.-]+\/[\w.-]+$/.test(repository) ? repository : void 0;
|
|
33386
33590
|
const gh = ghRepository === void 0 ? void 0 : await ghSecretState(input2.exec, ghRepository);
|
|
33387
|
-
const
|
|
33591
|
+
const exported = input2.paste ? void 0 : context.env[RELEASE_TOKEN_ENV]?.trim();
|
|
33592
|
+
const fromEnvironment = exported === void 0 || exported === "" ? void 0 : exported;
|
|
33388
33593
|
const terminal = context.stdin.isTTY === true;
|
|
33389
|
-
|
|
33390
|
-
|
|
33594
|
+
const environmentName2 = `${RELEASE_TOKEN_ENV} in this shell's environment`;
|
|
33595
|
+
if (gh?.hasSecret === true) {
|
|
33596
|
+
const replace = terminal ? await askYesNo(context.stdin, `${RELEASE_TOKEN_ENV} is already set in ${repository}. Replace it with a new token?`, log) : fromEnvironment !== void 0;
|
|
33597
|
+
if (!replace) {
|
|
33391
33598
|
log(`${RELEASE_TOKEN_ENV} is already set in ${repository}, and was left as it is.`);
|
|
33392
33599
|
return { state: "already-set" };
|
|
33393
33600
|
}
|
|
33394
33601
|
}
|
|
33602
|
+
const ask = async () => {
|
|
33603
|
+
const page2 = context.apiUrl === DEFAULT_API_URL ? " (https://mereon.ai/settings/release-tokens)" : "";
|
|
33604
|
+
log(`Create a release token in Mereon, under Settings, Release tokens${page2}, for the repository ${repository}. Only an administrator can.`);
|
|
33605
|
+
const pasted = (await readHiddenValue(context, "Paste the release token (input is hidden):")).trim();
|
|
33606
|
+
if (pasted === "") throw new CliError("No token was entered, so none was stored.");
|
|
33607
|
+
if (!pasted.startsWith(RELEASE_TOKEN_PREFIX)) {
|
|
33608
|
+
throw new CliError(`That is not a release token: release tokens start with ${RELEASE_TOKEN_PREFIX}. The token was not stored.`, {
|
|
33609
|
+
hint: `Copy the token from Mereon, under Settings, Release tokens, and run \`${cli} ci setup\` again.`
|
|
33610
|
+
});
|
|
33611
|
+
}
|
|
33612
|
+
return pasted;
|
|
33613
|
+
};
|
|
33614
|
+
const unsetHint = `Run \`unset ${RELEASE_TOKEN_ENV}\` and run \`${cli} ci setup\` again in a terminal, or add --paste, to paste the token when asked.`;
|
|
33395
33615
|
let token;
|
|
33396
|
-
|
|
33616
|
+
let fromShell = false;
|
|
33617
|
+
if (fromEnvironment !== void 0 && !fromEnvironment.startsWith(RELEASE_TOKEN_PREFIX)) {
|
|
33618
|
+
const problem = `${environmentName2} is not a release token: release tokens start with ${RELEASE_TOKEN_PREFIX}.`;
|
|
33619
|
+
if (!terminal) throw new CliError(`${problem} The token was not stored.`, { hint: unsetHint });
|
|
33620
|
+
log(`${problem} Asking for one instead.`);
|
|
33621
|
+
token = await ask();
|
|
33622
|
+
} else if (fromEnvironment !== void 0) {
|
|
33397
33623
|
token = fromEnvironment;
|
|
33398
|
-
|
|
33624
|
+
fromShell = true;
|
|
33625
|
+
log(`Using ${environmentName2}, not the GitHub secret.`);
|
|
33399
33626
|
} else if (terminal) {
|
|
33400
|
-
|
|
33401
|
-
log(`Create a release token in Mereon, under Settings, Release tokens${page2}, for the repository ${repository}. Only an administrator can.`);
|
|
33402
|
-
token = (await readHiddenValue(context, "Paste the release token (input is hidden):")).trim();
|
|
33403
|
-
if (token === "") throw new CliError("No token was entered, so none was stored.");
|
|
33627
|
+
token = await ask();
|
|
33404
33628
|
} else {
|
|
33405
33629
|
log(`The release token is pasted by a person: ask the user to run \`${cli} ci setup\` in a terminal, which finishes what is left.`);
|
|
33406
33630
|
return { state: "not-given" };
|
|
33407
33631
|
}
|
|
33408
33632
|
const deployedCommit = await input2.git.headCommit();
|
|
33409
33633
|
if (deployedCommit === null) throw new CliError("`ci setup` needs a git checkout with at least one commit, to check the token.");
|
|
33634
|
+
const checkWithMereon = (candidate) => postRelease({
|
|
33635
|
+
apiUrl: context.apiUrl,
|
|
33636
|
+
token: candidate,
|
|
33637
|
+
fetch: context.fetch,
|
|
33638
|
+
body: { ...releaseScope(input2.config, deployedCommit), dryRun: true, scripts: [] }
|
|
33639
|
+
});
|
|
33410
33640
|
let check2;
|
|
33411
33641
|
try {
|
|
33412
|
-
check2 = await
|
|
33413
|
-
apiUrl: context.apiUrl,
|
|
33414
|
-
token,
|
|
33415
|
-
fetch: context.fetch,
|
|
33416
|
-
body: { ...releaseScope(input2.config, deployedCommit), dryRun: true, scripts: [] }
|
|
33417
|
-
});
|
|
33642
|
+
check2 = await checkWithMereon(token);
|
|
33418
33643
|
} catch (error62) {
|
|
33419
33644
|
if (!(error62 instanceof CliError)) throw error62;
|
|
33420
|
-
|
|
33645
|
+
if (!fromShell || !(error62 instanceof ReleaseTokenRefused)) {
|
|
33646
|
+
throw new CliError(`${error62.message} The token was not stored.`, error62.hint === void 0 ? {} : { hint: error62.hint });
|
|
33647
|
+
}
|
|
33648
|
+
if (!terminal) throw new CliError(`Mereon refused ${environmentName2}: ${error62.message} The token was not stored.`, { hint: unsetHint });
|
|
33649
|
+
log(`Mereon refused ${environmentName2}: ${error62.message} Asking for one instead.`);
|
|
33650
|
+
token = await ask();
|
|
33651
|
+
try {
|
|
33652
|
+
check2 = await checkWithMereon(token);
|
|
33653
|
+
} catch (retryError) {
|
|
33654
|
+
if (!(retryError instanceof CliError)) throw retryError;
|
|
33655
|
+
throw new CliError(`${retryError.message} The token was not stored.`, retryError.hint === void 0 ? {} : { hint: retryError.hint });
|
|
33656
|
+
}
|
|
33421
33657
|
}
|
|
33422
33658
|
const organization = check2.organizationName === void 0 || check2.organizationName === null ? `organization ${check2.organizationId}` : `${check2.organizationName} (organization ${check2.organizationId})`;
|
|
33423
33659
|
log(`The token works: it releases ${check2.repository} into ${organization}.`);
|
|
@@ -33450,9 +33686,9 @@ function formatDotenvValue(value) {
|
|
|
33450
33686
|
return `"${escaped}"`;
|
|
33451
33687
|
}
|
|
33452
33688
|
var ASSIGNMENT = /^(\s*)(export\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\s*=/;
|
|
33453
|
-
function setDotenvValue(
|
|
33689
|
+
function setDotenvValue(text2, key, value) {
|
|
33454
33690
|
const line = (prefix) => `${prefix}${key}=${formatDotenvValue(value)}`;
|
|
33455
|
-
const lines =
|
|
33691
|
+
const lines = text2 === "" ? [] : text2.split("\n");
|
|
33456
33692
|
let last = -1;
|
|
33457
33693
|
lines.forEach((candidate, index) => {
|
|
33458
33694
|
if (ASSIGNMENT.exec(candidate)?.[3] === key) last = index;
|
|
@@ -33475,7 +33711,7 @@ function setDotenvValue(text, key, value) {
|
|
|
33475
33711
|
}
|
|
33476
33712
|
return next;
|
|
33477
33713
|
}
|
|
33478
|
-
async function writeSecretsFile(linkOrPath,
|
|
33714
|
+
async function writeSecretsFile(linkOrPath, text2, ownerOnly) {
|
|
33479
33715
|
const path = await realpath3(linkOrPath).catch(() => linkOrPath);
|
|
33480
33716
|
let mode = 384;
|
|
33481
33717
|
let created = true;
|
|
@@ -33489,7 +33725,7 @@ async function writeSecretsFile(linkOrPath, text, ownerOnly) {
|
|
|
33489
33725
|
const temp = `${path}.${process.pid}.${randomBytes7(4).toString("hex")}.tmp`;
|
|
33490
33726
|
const handle = await open5(temp, "wx", mode);
|
|
33491
33727
|
try {
|
|
33492
|
-
await handle.writeFile(
|
|
33728
|
+
await handle.writeFile(text2, "utf8");
|
|
33493
33729
|
} finally {
|
|
33494
33730
|
await handle.close();
|
|
33495
33731
|
}
|
|
@@ -33721,6 +33957,8 @@ var describeElementInPage = (element) => {
|
|
|
33721
33957
|
put("role", element.getAttribute("role"));
|
|
33722
33958
|
put("name", element.getAttribute("name"));
|
|
33723
33959
|
put("title", element.getAttribute("title"));
|
|
33960
|
+
const marked = typeof element.closest === "function" ? element.closest("[data-mereon-anchor]") : null;
|
|
33961
|
+
put("anchor", marked === null ? void 0 : marked.getAttribute("data-mereon-anchor"));
|
|
33724
33962
|
return out;
|
|
33725
33963
|
};
|
|
33726
33964
|
var inputTypeInPage = (element) => {
|
|
@@ -33733,10 +33971,10 @@ var highlightInPage = (element) => {
|
|
|
33733
33971
|
api.highlight(element);
|
|
33734
33972
|
}
|
|
33735
33973
|
};
|
|
33736
|
-
var calloutInPage = (element,
|
|
33974
|
+
var calloutInPage = (element, text2) => {
|
|
33737
33975
|
const api = Reflect.get(globalThis, "__mereonDemo");
|
|
33738
33976
|
if (typeof api === "object" && api !== null && typeof api.callout === "function") {
|
|
33739
|
-
api.callout(element,
|
|
33977
|
+
api.callout(element, text2);
|
|
33740
33978
|
}
|
|
33741
33979
|
};
|
|
33742
33980
|
var scrollIntoViewInPage = async (element) => {
|
|
@@ -33831,30 +34069,47 @@ var invalidSelectorsInPage = (selectors) => {
|
|
|
33831
34069
|
var frameTextInPage = () => {
|
|
33832
34070
|
const document = Reflect.get(globalThis, "document");
|
|
33833
34071
|
const body = typeof document === "object" && document !== null ? Reflect.get(document, "body") : null;
|
|
33834
|
-
const
|
|
33835
|
-
return typeof
|
|
34072
|
+
const text2 = typeof body === "object" && body !== null ? Reflect.get(body, "innerText") : "";
|
|
34073
|
+
return typeof text2 === "string" ? text2 : "";
|
|
33836
34074
|
};
|
|
33837
34075
|
var alignmentMarkerInPage = (color) => {
|
|
34076
|
+
const FRAME_WAIT_MS = 200;
|
|
33838
34077
|
const document = Reflect.get(globalThis, "document");
|
|
33839
34078
|
const id = "__mereon-alignment-marker";
|
|
33840
34079
|
const existing = document.getElementById(id);
|
|
33841
34080
|
if (color === null) {
|
|
33842
34081
|
existing?.remove();
|
|
33843
|
-
|
|
33844
|
-
|
|
33845
|
-
|
|
33846
|
-
|
|
33847
|
-
|
|
33848
|
-
|
|
33849
|
-
|
|
33850
|
-
|
|
33851
|
-
|
|
33852
|
-
|
|
33853
|
-
|
|
33854
|
-
|
|
33855
|
-
|
|
34082
|
+
} else {
|
|
34083
|
+
const marker = existing ?? document.createElement("div");
|
|
34084
|
+
if (existing === null) {
|
|
34085
|
+
marker.id = id;
|
|
34086
|
+
marker.setAttribute("popover", "manual");
|
|
34087
|
+
marker.setAttribute(
|
|
34088
|
+
"style",
|
|
34089
|
+
"position:fixed;inset:0;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;border:0;"
|
|
34090
|
+
);
|
|
34091
|
+
document.documentElement.appendChild(marker);
|
|
34092
|
+
if (typeof marker.showPopover === "function") marker.showPopover();
|
|
34093
|
+
else marker.style.zIndex = "2147483647";
|
|
34094
|
+
}
|
|
34095
|
+
marker.style.background = color;
|
|
33856
34096
|
}
|
|
33857
|
-
|
|
34097
|
+
return new Promise((resolve8) => {
|
|
34098
|
+
const frame = Reflect.get(globalThis, "requestAnimationFrame");
|
|
34099
|
+
const later = Reflect.get(globalThis, "setTimeout");
|
|
34100
|
+
if (typeof frame !== "function" || typeof later !== "function") {
|
|
34101
|
+
resolve8(Date.now());
|
|
34102
|
+
return;
|
|
34103
|
+
}
|
|
34104
|
+
let answered = false;
|
|
34105
|
+
const answer = () => {
|
|
34106
|
+
if (answered) return;
|
|
34107
|
+
answered = true;
|
|
34108
|
+
resolve8(Date.now());
|
|
34109
|
+
};
|
|
34110
|
+
frame(answer);
|
|
34111
|
+
later(answer, FRAME_WAIT_MS);
|
|
34112
|
+
});
|
|
33858
34113
|
};
|
|
33859
34114
|
var paintedInPage = () => new Promise((resolve8) => {
|
|
33860
34115
|
const frame = Reflect.get(globalThis, "requestAnimationFrame");
|
|
@@ -33912,6 +34167,28 @@ var settleStateInPage = () => {
|
|
|
33912
34167
|
const msSinceShift = observed ? now - (typeof lastShift === "number" ? lastShift : 0) : null;
|
|
33913
34168
|
return { fontsLoaded, busy, msSinceShift };
|
|
33914
34169
|
};
|
|
34170
|
+
var viewInPage = () => {
|
|
34171
|
+
const document = Reflect.get(globalThis, "document");
|
|
34172
|
+
const pageMarked = document.querySelector("[data-mereon-anchor]") !== null;
|
|
34173
|
+
const shown = (element) => typeof element.checkVisibility === "function" ? element.checkVisibility() : element.getClientRects().length > 0;
|
|
34174
|
+
let tab;
|
|
34175
|
+
for (const element of document.querySelectorAll('[role="tab"][aria-selected="true"]')) {
|
|
34176
|
+
if (shown(element)) tab = element;
|
|
34177
|
+
}
|
|
34178
|
+
if (tab === void 0) return { anchor: null, unmarkedTab: null, pageMarked };
|
|
34179
|
+
let marked = typeof tab.closest === "function" ? tab.closest("[data-mereon-anchor]") : null;
|
|
34180
|
+
if (marked !== null && marked !== tab && marked.querySelectorAll('[role="tab"]').length > 1) marked = null;
|
|
34181
|
+
const anchor2 = marked === null ? "" : String(marked.getAttribute("data-mereon-anchor") ?? "").trim();
|
|
34182
|
+
if (anchor2 !== "") return { anchor: anchor2.slice(0, 200), unmarkedTab: null, pageMarked };
|
|
34183
|
+
const name = String(tab.getAttribute("aria-label") ?? tab.textContent ?? "").trim().replace(/\s+/g, " ").slice(0, 60);
|
|
34184
|
+
return { anchor: null, unmarkedTab: name, pageMarked };
|
|
34185
|
+
};
|
|
34186
|
+
var stepViewSchema = external_exports.object({
|
|
34187
|
+
anchor: external_exports.string().min(1).max(200).nullable(),
|
|
34188
|
+
unmarkedTab: external_exports.string().max(60).nullable(),
|
|
34189
|
+
pageMarked: external_exports.boolean()
|
|
34190
|
+
});
|
|
34191
|
+
var UNKNOWN_VIEW = { anchor: null, unmarkedTab: null, pageMarked: false };
|
|
33915
34192
|
|
|
33916
34193
|
// src/record/settle.ts
|
|
33917
34194
|
var SETTLE_QUIET_MS = 300;
|
|
@@ -34155,15 +34432,15 @@ function parseRoleSelector(selector) {
|
|
|
34155
34432
|
return { role: role.toLowerCase(), name: name.replace(/\\(.)/g, "$1") };
|
|
34156
34433
|
}
|
|
34157
34434
|
function rankNames(wanted, names) {
|
|
34158
|
-
const
|
|
34435
|
+
const target2 = wanted.toLowerCase();
|
|
34159
34436
|
const shared = (name) => {
|
|
34160
34437
|
const lower = name.toLowerCase();
|
|
34161
34438
|
let length = 0;
|
|
34162
|
-
while (length < lower.length && length <
|
|
34439
|
+
while (length < lower.length && length < target2.length && lower[length] === target2[length]) length++;
|
|
34163
34440
|
return length;
|
|
34164
34441
|
};
|
|
34165
34442
|
const unique = [...new Set(names.filter((name) => name.trim() !== ""))];
|
|
34166
|
-
return unique.map((name) => ({ name, holds: name.toLowerCase().includes(
|
|
34443
|
+
return unique.map((name) => ({ name, holds: name.toLowerCase().includes(target2), shared: shared(name) })).sort((a, b) => Number(b.holds) - Number(a.holds) || (a.holds ? a.name.length - b.name.length : b.shared - a.shared)).map(({ name }) => name);
|
|
34167
34444
|
}
|
|
34168
34445
|
var roleWords = {
|
|
34169
34446
|
link: ["link", "Links"],
|
|
@@ -34262,14 +34539,14 @@ function createHelpers(options) {
|
|
|
34262
34539
|
const allowRemote = options.allowRemote;
|
|
34263
34540
|
let label = "A step";
|
|
34264
34541
|
let step = 0;
|
|
34265
|
-
let
|
|
34542
|
+
let target2;
|
|
34266
34543
|
const warnings = [];
|
|
34267
34544
|
let pinned = false;
|
|
34268
34545
|
let mouse;
|
|
34269
34546
|
let motion = 0;
|
|
34270
34547
|
let idle = 0;
|
|
34271
|
-
function refuseSecret(what,
|
|
34272
|
-
const match = secrets.findIn(
|
|
34548
|
+
function refuseSecret(what, text2, hint) {
|
|
34549
|
+
const match = secrets.findIn(text2);
|
|
34273
34550
|
if (match !== void 0) throw new CliError(`${label}: ${what} holds ${describeMatch(match)}.`, { hint });
|
|
34274
34551
|
}
|
|
34275
34552
|
async function resolve8(selector, deadline) {
|
|
@@ -34351,7 +34628,7 @@ function createHelpers(options) {
|
|
|
34351
34628
|
if (box !== null) options.onFocus(box);
|
|
34352
34629
|
}
|
|
34353
34630
|
function remember(actionType, selector, info) {
|
|
34354
|
-
|
|
34631
|
+
target2 = { actionType, targetInfo: { selector, ...info } };
|
|
34355
34632
|
}
|
|
34356
34633
|
async function bringIntoView(locator) {
|
|
34357
34634
|
if (animate) {
|
|
@@ -34406,8 +34683,8 @@ function createHelpers(options) {
|
|
|
34406
34683
|
loading.stop();
|
|
34407
34684
|
}
|
|
34408
34685
|
},
|
|
34409
|
-
async type(selector,
|
|
34410
|
-
refuseSecret("the text given to demo.type",
|
|
34686
|
+
async type(selector, text2) {
|
|
34687
|
+
refuseSecret("the text given to demo.type", text2, "Type a secret with demo.typeSecret(selector, NAME), which covers the field first.");
|
|
34411
34688
|
const { locator, value } = await steady(selector, async (found) => {
|
|
34412
34689
|
const inputType = await found.evaluate(inputTypeInPage, void 0, { timeout: timeoutMs });
|
|
34413
34690
|
return { info: await readAndPoint(found), inputType };
|
|
@@ -34416,19 +34693,19 @@ function createHelpers(options) {
|
|
|
34416
34693
|
if (example !== void 0) {
|
|
34417
34694
|
await pace(200);
|
|
34418
34695
|
try {
|
|
34419
|
-
await locator.fill(
|
|
34696
|
+
await locator.fill(text2, { timeout: timeoutMs });
|
|
34420
34697
|
} catch (error62) {
|
|
34421
34698
|
if (!(error62 instanceof Error) || !/malformed value/i.test(error62.message)) throw error62;
|
|
34422
|
-
throw new CliError(`${label}: ${JSON.stringify(selector)} is a ${value.inputType} input, which takes a value such as ${example}, and ${JSON.stringify(
|
|
34699
|
+
throw new CliError(`${label}: ${JSON.stringify(selector)} is a ${value.inputType} input, which takes a value such as ${example}, and ${JSON.stringify(text2)} is not one.`);
|
|
34423
34700
|
}
|
|
34424
34701
|
} else {
|
|
34425
34702
|
await locator.click();
|
|
34426
34703
|
if (animate) {
|
|
34427
34704
|
await locator.fill("");
|
|
34428
|
-
await locator.pressSequentially(
|
|
34705
|
+
await locator.pressSequentially(text2, { delay: keyDelayMs(text2.length) });
|
|
34429
34706
|
} else {
|
|
34430
|
-
await locator.fill(
|
|
34431
|
-
motion +=
|
|
34707
|
+
await locator.fill(text2);
|
|
34708
|
+
motion += text2.length * keyDelayMs(text2.length);
|
|
34432
34709
|
}
|
|
34433
34710
|
}
|
|
34434
34711
|
remember("type", selector, value.info);
|
|
@@ -34468,23 +34745,23 @@ function createHelpers(options) {
|
|
|
34468
34745
|
});
|
|
34469
34746
|
remember("highlight", selector, info);
|
|
34470
34747
|
},
|
|
34471
|
-
async callout(selector,
|
|
34472
|
-
refuseSecret("a callout's text",
|
|
34748
|
+
async callout(selector, text2) {
|
|
34749
|
+
refuseSecret("a callout's text", text2, "A note beside an element is shown as it is. Leave the secret out of it.");
|
|
34473
34750
|
const { locator, value: info } = await steady(selector, async (found) => {
|
|
34474
34751
|
await bringIntoView(found);
|
|
34475
34752
|
const described = await describe5(found);
|
|
34476
34753
|
await focusOn(found);
|
|
34477
|
-
await found.evaluate(calloutInPage,
|
|
34754
|
+
await found.evaluate(calloutInPage, text2, { timeout: timeoutMs });
|
|
34478
34755
|
return described;
|
|
34479
34756
|
});
|
|
34480
34757
|
remember("highlight", selector, info);
|
|
34481
34758
|
if (mode === "dry") {
|
|
34482
|
-
const length =
|
|
34759
|
+
const length = text2.trim().length;
|
|
34483
34760
|
if (length > MAX_CALLOUT_CHARACTERS) {
|
|
34484
34761
|
warnings.push({
|
|
34485
34762
|
kind: "callout-long",
|
|
34486
34763
|
step,
|
|
34487
|
-
message: `${label}: the callout "${
|
|
34764
|
+
message: `${label}: the callout "${text2.trim().slice(0, 40)}..." is ${length} characters, past the ${MAX_CALLOUT_CHARACTERS} a viewer reads at a glance.`,
|
|
34488
34765
|
hint: "Cut it to the one fact worth reading, in a few words that add to the narration rather than repeat it."
|
|
34489
34766
|
});
|
|
34490
34767
|
}
|
|
@@ -34609,11 +34886,11 @@ function createHelpers(options) {
|
|
|
34609
34886
|
};
|
|
34610
34887
|
return {
|
|
34611
34888
|
helpers,
|
|
34612
|
-
lastTarget: () =>
|
|
34889
|
+
lastTarget: () => target2,
|
|
34613
34890
|
beginStep(next, number4) {
|
|
34614
34891
|
label = next;
|
|
34615
34892
|
step = number4;
|
|
34616
|
-
|
|
34893
|
+
target2 = void 0;
|
|
34617
34894
|
},
|
|
34618
34895
|
setLabel(next) {
|
|
34619
34896
|
label = next;
|
|
@@ -34691,8 +34968,8 @@ async function decodeToPcm(audio, ffmpeg = "ffmpeg") {
|
|
|
34691
34968
|
await rm7(directory, { recursive: true, force: true });
|
|
34692
34969
|
}
|
|
34693
34970
|
}
|
|
34694
|
-
function tail(
|
|
34695
|
-
return
|
|
34971
|
+
function tail(text2, lines = 6) {
|
|
34972
|
+
return text2.trim().split("\n").slice(-lines).join("\n");
|
|
34696
34973
|
}
|
|
34697
34974
|
|
|
34698
34975
|
// src/record/encode.ts
|
|
@@ -35054,8 +35331,8 @@ function whole(size) {
|
|
|
35054
35331
|
function clamp(value, low, high) {
|
|
35055
35332
|
return Math.min(high, Math.max(low, value));
|
|
35056
35333
|
}
|
|
35057
|
-
function alreadyShows(view,
|
|
35058
|
-
if (view.zoom <
|
|
35334
|
+
function alreadyShows(view, target2, box, size) {
|
|
35335
|
+
if (view.zoom < target2.zoom * 0.85) return false;
|
|
35059
35336
|
const width = size.width / view.zoom;
|
|
35060
35337
|
const height = size.height / view.zoom;
|
|
35061
35338
|
const left = view.cx - width / 2 + width * 0.08;
|
|
@@ -35785,6 +36062,54 @@ function overlayScript(options) {
|
|
|
35785
36062
|
return `window.__mereonDemoRipple = ${options.ripple ? "true" : "false"};${look}${OVERLAY_BODY}`;
|
|
35786
36063
|
}
|
|
35787
36064
|
|
|
36065
|
+
// ../../lib/src/helpers/embed-screen.ts
|
|
36066
|
+
var SCHEME = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
36067
|
+
function routeOf(raw) {
|
|
36068
|
+
let path = raw.trim();
|
|
36069
|
+
let host = null;
|
|
36070
|
+
if (SCHEME.test(path)) {
|
|
36071
|
+
try {
|
|
36072
|
+
const url2 = new URL(path);
|
|
36073
|
+
host = url2.host.toLowerCase();
|
|
36074
|
+
path = url2.hash.startsWith("#/") ? url2.hash.slice(1) : url2.pathname;
|
|
36075
|
+
} catch {
|
|
36076
|
+
return { path: "", host: null };
|
|
36077
|
+
}
|
|
36078
|
+
} else {
|
|
36079
|
+
const hashRoute = path.indexOf("#/");
|
|
36080
|
+
if (hashRoute >= 0) {
|
|
36081
|
+
path = path.slice(hashRoute + 1);
|
|
36082
|
+
}
|
|
36083
|
+
}
|
|
36084
|
+
path = path.split("#", 1)[0] ?? "";
|
|
36085
|
+
path = path.split("?", 1)[0] ?? "";
|
|
36086
|
+
return { path, host };
|
|
36087
|
+
}
|
|
36088
|
+
function segmentsOf(path) {
|
|
36089
|
+
return path.split("/").map((segment) => segment.trim().toLowerCase()).filter((segment) => segment.length > 0);
|
|
36090
|
+
}
|
|
36091
|
+
function normalizePath(raw, basePath) {
|
|
36092
|
+
const { path, host } = routeOf(raw);
|
|
36093
|
+
let segments = segmentsOf(path);
|
|
36094
|
+
const base = basePath === void 0 ? [] : segmentsOf(basePath);
|
|
36095
|
+
if (base.length > 0 && base.every((segment, i) => segments[i] === segment)) {
|
|
36096
|
+
segments = segments.slice(base.length);
|
|
36097
|
+
}
|
|
36098
|
+
return { segments, host };
|
|
36099
|
+
}
|
|
36100
|
+
function screenKey(raw, basePath) {
|
|
36101
|
+
const { segments, host } = normalizePath(raw, basePath);
|
|
36102
|
+
return `${host ?? ""}/${segments.join("/")}`;
|
|
36103
|
+
}
|
|
36104
|
+
function stepAnchors(target2) {
|
|
36105
|
+
const anchors = [];
|
|
36106
|
+
for (const value of [target2.anchor, target2.id, target2.viewAnchor]) {
|
|
36107
|
+
const trimmed = value?.trim();
|
|
36108
|
+
if (trimmed !== void 0 && trimmed !== "" && !anchors.includes(trimmed)) anchors.push(trimmed);
|
|
36109
|
+
}
|
|
36110
|
+
return anchors;
|
|
36111
|
+
}
|
|
36112
|
+
|
|
35788
36113
|
// src/record/warnings.ts
|
|
35789
36114
|
var RECORD_WARNING_KINDS = [
|
|
35790
36115
|
"flash",
|
|
@@ -35794,7 +36119,8 @@ var RECORD_WARNING_KINDS = [
|
|
|
35794
36119
|
"callout-covers",
|
|
35795
36120
|
"cue-close",
|
|
35796
36121
|
"cue-wait",
|
|
35797
|
-
"narration-waited"
|
|
36122
|
+
"narration-waited",
|
|
36123
|
+
"unmarked-view"
|
|
35798
36124
|
];
|
|
35799
36125
|
var FLASH_MS = 600;
|
|
35800
36126
|
var PASSWORD_INPUT_BINDING = "__mereonPasswordInput";
|
|
@@ -35845,16 +36171,41 @@ function takeWarnings(input2) {
|
|
|
35845
36171
|
}
|
|
35846
36172
|
}
|
|
35847
36173
|
if (input2.navigations !== void 0 && input2.plan !== void 0) warnings.push(...flashes(input2.navigations, input2.plan, input2));
|
|
36174
|
+
if (input2.checkViews !== false) warnings.push(...unmarkedViews(input2));
|
|
35848
36175
|
warnings.push(...input2.fromHelpers ?? []);
|
|
35849
36176
|
return warnings.map((warning) => ({ ...warning, message: input2.mask(warning.message) })).sort((a, b) => a.step - b.step);
|
|
35850
36177
|
}
|
|
36178
|
+
function unmarkedViews(input2) {
|
|
36179
|
+
const out = [];
|
|
36180
|
+
const seen = /* @__PURE__ */ new Set();
|
|
36181
|
+
for (const step of input2.steps) {
|
|
36182
|
+
const view = step.view;
|
|
36183
|
+
if (view === void 0 || !view.pageMarked || view.unmarkedTab === null) continue;
|
|
36184
|
+
const where = step.pageUrl === void 0 ? "its page" : addressOf(step.pageUrl);
|
|
36185
|
+
const key = `${step.pageUrl === void 0 ? "" : screenKey(step.pageUrl)}\0${view.unmarkedTab}`;
|
|
36186
|
+
if (seen.has(key)) continue;
|
|
36187
|
+
seen.add(key);
|
|
36188
|
+
const tab = view.unmarkedTab === "" ? "a selected tab" : `the "${view.unmarkedTab}" tab`;
|
|
36189
|
+
out.push({
|
|
36190
|
+
kind: "unmarked-view",
|
|
36191
|
+
step: step.number,
|
|
36192
|
+
message: `Step ${step.number} ends on ${tab} of ${where}, which has no data-mereon-anchor, so Mereon Embed will list this demo on every tab of that page.`,
|
|
36193
|
+
hint: "Mark each tab with data-mereon-anchor and have the app report the one in view as the screen's anchor, then record again (demo/agent/embed.md). If the app does not show demos with Mereon Embed, set checkViews: false in the script."
|
|
36194
|
+
});
|
|
36195
|
+
}
|
|
36196
|
+
return out;
|
|
36197
|
+
}
|
|
36198
|
+
var ONE_FRAME_MS = 1e3 / EDIT_FPS;
|
|
35851
36199
|
function flashes(navigations, plan2, input2) {
|
|
35852
36200
|
const endMs = Math.max(0, ...input2.steps.map((step) => step.endMs));
|
|
36201
|
+
const screens = navigations.filter(
|
|
36202
|
+
(navigation, index) => index === 0 || screenKey(navigation.url) !== screenKey(navigations[index - 1]?.url ?? "")
|
|
36203
|
+
);
|
|
35853
36204
|
const out = [];
|
|
35854
|
-
for (const [index, navigation] of
|
|
35855
|
-
const untilMs =
|
|
36205
|
+
for (const [index, navigation] of screens.entries()) {
|
|
36206
|
+
const untilMs = screens[index + 1]?.atMs ?? endMs;
|
|
35856
36207
|
const shown = keptMs(plan2, navigation.atMs, untilMs);
|
|
35857
|
-
if (shown
|
|
36208
|
+
if (shown < ONE_FRAME_MS || shown >= FLASH_MS) continue;
|
|
35858
36209
|
const step = input2.steps.find((candidate) => navigation.atMs >= candidate.startMs && navigation.atMs < candidate.endMs) ?? input2.steps.find((candidate) => candidate.startMs >= navigation.atMs);
|
|
35859
36210
|
if (step === void 0) continue;
|
|
35860
36211
|
const where = addressOf(navigation.url);
|
|
@@ -35870,7 +36221,10 @@ function flashes(navigations, plan2, input2) {
|
|
|
35870
36221
|
function addressOf(url2) {
|
|
35871
36222
|
try {
|
|
35872
36223
|
const parsed = new URL(url2);
|
|
35873
|
-
|
|
36224
|
+
if (parsed.protocol === "about:") return url2;
|
|
36225
|
+
if (!parsed.hash.startsWith("#/")) return parsed.pathname;
|
|
36226
|
+
const hashRoute = parsed.hash.split("?", 1)[0] ?? parsed.hash;
|
|
36227
|
+
return `${parsed.pathname === "/" ? "" : parsed.pathname}${hashRoute}`;
|
|
35874
36228
|
} catch {
|
|
35875
36229
|
return url2;
|
|
35876
36230
|
}
|
|
@@ -36270,13 +36624,25 @@ async function layOut(stage, step) {
|
|
|
36270
36624
|
const current = stage.page.viewportSize();
|
|
36271
36625
|
if (current?.width !== wanted.width || current.height !== wanted.height) await stage.page.setViewportSize(wanted);
|
|
36272
36626
|
}
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
36627
|
+
function cueLabel(stepLabel, cueIndex) {
|
|
36628
|
+
return `${stepLabel}, cue ${cueIndex + 1}`;
|
|
36629
|
+
}
|
|
36630
|
+
async function performCue(stage, base, run3, step, cueIndex, progress) {
|
|
36631
|
+
const cue = step.cues[cueIndex];
|
|
36632
|
+
const label = cueLabel(run3.label, cueIndex);
|
|
36633
|
+
if (progress !== void 0) progress.at = { label, step, cue: cueIndex };
|
|
36634
|
+
if (cue !== void 0) {
|
|
36635
|
+
await inCue(
|
|
36636
|
+
stage,
|
|
36637
|
+
run3.number,
|
|
36638
|
+
() => inStep(stage, label, async () => {
|
|
36639
|
+
for (const each of everyStage(stage)) each.session.setLabel(label);
|
|
36640
|
+
await cue.do(run3.context);
|
|
36641
|
+
})
|
|
36642
|
+
);
|
|
36279
36643
|
}
|
|
36644
|
+
await refreshRecordings(stage);
|
|
36645
|
+
return { label, showing: await checkAll(stage, base, label) };
|
|
36280
36646
|
}
|
|
36281
36647
|
async function outcome(stage, run3, step, narration) {
|
|
36282
36648
|
return {
|
|
@@ -36285,11 +36651,20 @@ async function outcome(stage, run3, step, narration) {
|
|
|
36285
36651
|
narration,
|
|
36286
36652
|
pageUrl: stage.page.url(),
|
|
36287
36653
|
pageTitle: await stage.page.title(),
|
|
36654
|
+
view: await readView(stage),
|
|
36288
36655
|
target: stage.session.lastTarget(),
|
|
36289
36656
|
settle: run3.settle,
|
|
36290
36657
|
sideSettle: run3.sideSettle
|
|
36291
36658
|
};
|
|
36292
36659
|
}
|
|
36660
|
+
async function readView(stage) {
|
|
36661
|
+
try {
|
|
36662
|
+
const parsed = stepViewSchema.safeParse(await stage.page.evaluate(viewInPage));
|
|
36663
|
+
return parsed.success ? parsed.data : UNKNOWN_VIEW;
|
|
36664
|
+
} catch {
|
|
36665
|
+
return UNKNOWN_VIEW;
|
|
36666
|
+
}
|
|
36667
|
+
}
|
|
36293
36668
|
async function takeDry(browser, input2) {
|
|
36294
36669
|
const stage = await openStages(browser, input2, { mode: "dry" });
|
|
36295
36670
|
const from = input2.steps?.from ?? 1;
|
|
@@ -36323,12 +36698,10 @@ async function takeDry(browser, input2) {
|
|
|
36323
36698
|
const run3 = await attempt(`Step ${number4}`, () => beginStep(stage, input2, index, step, "Checking"));
|
|
36324
36699
|
if (run3 !== void 0) {
|
|
36325
36700
|
for (const [cueIndex] of step.cues.entries()) {
|
|
36326
|
-
const label = `${run3.label}, cue ${cueIndex + 1}`;
|
|
36327
36701
|
timingSince();
|
|
36328
36702
|
const startedAt = Date.now();
|
|
36329
|
-
const ran = await attempt(label, async () => {
|
|
36330
|
-
await
|
|
36331
|
-
await checkAll(stage, input2, label);
|
|
36703
|
+
const ran = await attempt(cueLabel(run3.label, cueIndex), async () => {
|
|
36704
|
+
await performCue(stage, input2, run3, step, cueIndex, void 0);
|
|
36332
36705
|
return true;
|
|
36333
36706
|
});
|
|
36334
36707
|
if (ran === true) {
|
|
@@ -36374,7 +36747,9 @@ async function takeGuide(browser, input2) {
|
|
|
36374
36747
|
const cues = planCues(step.narration, step.cues, narration.clip);
|
|
36375
36748
|
progress.at = { label: `Step ${index + 1}`, step, cue: void 0 };
|
|
36376
36749
|
const run3 = await asTake(stage, progress, () => beginStep(stage, input2, index, step, "Recording"));
|
|
36377
|
-
|
|
36750
|
+
for (const [cueIndex] of step.cues.entries()) {
|
|
36751
|
+
await asTake(stage, progress, () => performCue(stage, input2, run3, step, cueIndex, progress));
|
|
36752
|
+
}
|
|
36378
36753
|
progress.at = void 0;
|
|
36379
36754
|
const showing = await checkAll(stage, input2, run3.label);
|
|
36380
36755
|
const screenshot = join19(input2.workDir, "steps", `${String(run3.number).padStart(2, "0")}.png`);
|
|
@@ -36421,10 +36796,6 @@ async function takeVideo(browser, input2) {
|
|
|
36421
36796
|
const steps = [];
|
|
36422
36797
|
const redactions = [];
|
|
36423
36798
|
const progress = { at: void 0, earlier: [] };
|
|
36424
|
-
const sample = async (step, label) => {
|
|
36425
|
-
const atMs = clock.now();
|
|
36426
|
-
if (await checkAll(stage, input2, label) > 0) redactions.push({ kind: "video", step, label, atMs });
|
|
36427
|
-
};
|
|
36428
36799
|
const transitions = input2.script.steps.map((each) => each.transition);
|
|
36429
36800
|
for (const [index, step] of input2.script.steps.entries()) {
|
|
36430
36801
|
const narration = nth(input2.narration, index, `narration for step ${index + 1}`);
|
|
@@ -36443,11 +36814,8 @@ async function takeVideo(browser, input2) {
|
|
|
36443
36814
|
audioMs: narration.durationMs,
|
|
36444
36815
|
cues: planned,
|
|
36445
36816
|
runCue: async (cueIndex) => {
|
|
36446
|
-
const
|
|
36447
|
-
|
|
36448
|
-
await inCue(stage, run3.number, () => inStep(stage, label, () => runCue(stage, run3.label, step, cueIndex, run3.context)));
|
|
36449
|
-
await refreshRecordings(stage);
|
|
36450
|
-
await sample(run3.number, label);
|
|
36817
|
+
const cue = await performCue(stage, input2, run3, step, cueIndex, progress);
|
|
36818
|
+
if (cue.showing > 0) redactions.push({ kind: "video", step: run3.number, label: cue.label, atMs: clock.now() });
|
|
36451
36819
|
},
|
|
36452
36820
|
onCue: (cue) => progress.earlier.push(describeCueRun(run3.label, cue))
|
|
36453
36821
|
})
|
|
@@ -36493,19 +36861,12 @@ async function showAlignmentMarker(pages, pageOpenedAt) {
|
|
|
36493
36861
|
const show = (color) => Promise.all(pages.map((page2) => page2.evaluate(alignmentMarkerInPage, color)));
|
|
36494
36862
|
await show(MARKER_LEAD_COLOR);
|
|
36495
36863
|
await wait(300);
|
|
36496
|
-
await show(MARKER_COLOR);
|
|
36497
|
-
const markedAt = Date.now();
|
|
36864
|
+
const [markedAt = Date.now()] = await show(MARKER_COLOR);
|
|
36498
36865
|
await wait(400);
|
|
36499
36866
|
await show(null);
|
|
36500
36867
|
await wait(200);
|
|
36501
36868
|
return { markAtMs: markedAt - pageOpenedAt, zeroAfterMarkMs: Date.now() - markedAt };
|
|
36502
36869
|
}
|
|
36503
|
-
async function runCue(stage, stepLabel, step, cueIndex, context) {
|
|
36504
|
-
const cue = step.cues[cueIndex];
|
|
36505
|
-
if (cue === void 0) return;
|
|
36506
|
-
for (const each of everyStage(stage)) each.session.setLabel(`${stepLabel}, cue ${cueIndex + 1}`);
|
|
36507
|
-
await cue.do(context);
|
|
36508
|
-
}
|
|
36509
36870
|
var seconds2 = (ms) => `${(ms / 1e3).toFixed(1)} s`;
|
|
36510
36871
|
var ON_ITS_WORDS_MS = 1e3 / EDIT_FPS;
|
|
36511
36872
|
function describeCueRun(stepLabel, cue) {
|
|
@@ -36574,8 +36935,8 @@ var ROLES = [
|
|
|
36574
36935
|
];
|
|
36575
36936
|
var attributesSchema = external_exports.object({ testId: external_exports.string().nullable(), text: external_exports.string().nullable(), href: external_exports.string().nullable() });
|
|
36576
36937
|
var attributesInPage = (element) => {
|
|
36577
|
-
const
|
|
36578
|
-
return { testId: element.getAttribute("data-testid"), text:
|
|
36938
|
+
const text2 = (element.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
36939
|
+
return { testId: element.getAttribute("data-testid"), text: text2 === "" ? null : text2.slice(0, 120), href: element.getAttribute("href") };
|
|
36579
36940
|
};
|
|
36580
36941
|
var MAX_TEXT_SELECTOR = 60;
|
|
36581
36942
|
async function inspectPage(page2, options) {
|
|
@@ -36650,8 +37011,8 @@ async function inspectCommand(args, context) {
|
|
|
36650
37011
|
);
|
|
36651
37012
|
const [path, ...extra] = positionals;
|
|
36652
37013
|
if (path === void 0 || extra.length > 0) throw new CliError(`Usage: ${USAGE5}`);
|
|
36653
|
-
const
|
|
36654
|
-
if (!Number.isInteger(
|
|
37014
|
+
const limit2 = values.limit === void 0 ? DEFAULT_LIMIT : Number(values.limit);
|
|
37015
|
+
if (!Number.isInteger(limit2) || limit2 < 1) throw new CliError(`--limit takes a whole number, and ${JSON.stringify(values.limit)} is not one.`);
|
|
36655
37016
|
const paths = projectPaths(context.cwd);
|
|
36656
37017
|
const { config: config2, overridden } = await loadEffectiveConfig(paths, context.env);
|
|
36657
37018
|
const log = (message) => context.output.log(message);
|
|
@@ -36686,8 +37047,8 @@ async function inspectCommand(args, context) {
|
|
|
36686
37047
|
const page2 = await browserContext.newPage();
|
|
36687
37048
|
const requests = new RequestTracker();
|
|
36688
37049
|
requests.attach(page2);
|
|
36689
|
-
const
|
|
36690
|
-
await page2.goto(
|
|
37050
|
+
const target2 = `${baseUrl}${path.startsWith("/") ? "" : "/"}${path}`;
|
|
37051
|
+
await page2.goto(target2, { waitUntil: "load", timeout: 3e4 });
|
|
36691
37052
|
await settlePage(page2, requests, void 0);
|
|
36692
37053
|
const prompt = await signInPrompt(page2, baseUrl);
|
|
36693
37054
|
if (prompt !== void 0) {
|
|
@@ -36695,7 +37056,7 @@ async function inspectCommand(args, context) {
|
|
|
36695
37056
|
values.auth === void 0 ? `The page is asking to sign in (${prompt}). To inspect it signed in, pass --auth <profile>, a session saved with \`demo auth capture\`.` : `The page is asking to sign in (${prompt}), so the session "${values.auth}" may have expired. ${session?.recapture ?? ""}`
|
|
36696
37057
|
);
|
|
36697
37058
|
}
|
|
36698
|
-
const { elements, near } = await inspectPage(page2, { near: values.near, limit });
|
|
37059
|
+
const { elements, near } = await inspectPage(page2, { near: values.near, limit: limit2 });
|
|
36699
37060
|
const url2 = new URL(page2.url());
|
|
36700
37061
|
log(`${url2.pathname}${url2.search}: ${await page2.title()}`);
|
|
36701
37062
|
for (const element of elements) {
|
|
@@ -36731,9 +37092,107 @@ async function configCommand(args, context) {
|
|
|
36731
37092
|
const { overridden } = await loadEffectiveConfig(paths, context.env);
|
|
36732
37093
|
const by = isMachineSetting(key) ? overridden[key] : void 0;
|
|
36733
37094
|
if (by !== void 0) context.output.log(`On this machine, ${by} overrides ${key}, so the value just set applies on other machines and not here.`);
|
|
37095
|
+
if (by === void 0 && isMachineSetting(key)) {
|
|
37096
|
+
const variable = MACHINE_SETTING_ENV[key];
|
|
37097
|
+
context.output.log(
|
|
37098
|
+
`That is in demo/config.json, which the project shares. To change ${key} on this machine alone, put it in demo/config.local.json${variable === void 0 ? "" : ` or ${variable}`} instead.`
|
|
37099
|
+
);
|
|
37100
|
+
}
|
|
36734
37101
|
context.output.result({ key, config: config2 });
|
|
36735
37102
|
}
|
|
36736
37103
|
|
|
37104
|
+
// src/commands/coverage.ts
|
|
37105
|
+
import { readdir as readdir5 } from "node:fs/promises";
|
|
37106
|
+
import { parseArgs as parseArgs5 } from "node:util";
|
|
37107
|
+
var USAGE6 = "demo coverage [<script-id>...]";
|
|
37108
|
+
var textOf = (value) => value === void 0 || value.trim() === "" ? null : value.trim();
|
|
37109
|
+
async function recordings(paths, named) {
|
|
37110
|
+
let ids = [...named];
|
|
37111
|
+
if (ids.length === 0) {
|
|
37112
|
+
try {
|
|
37113
|
+
ids = (await readdir5(paths.out)).filter((name) => SCRIPT_ID_PATTERN.test(name)).sort();
|
|
37114
|
+
} catch {
|
|
37115
|
+
ids = [];
|
|
37116
|
+
}
|
|
37117
|
+
}
|
|
37118
|
+
const found = [];
|
|
37119
|
+
for (const scriptId of ids) {
|
|
37120
|
+
for (const output2 of OUTPUTS) {
|
|
37121
|
+
const timeline = await readTimeline(paths, scriptId, output2);
|
|
37122
|
+
if (timeline !== void 0 && !timeline.draft) found.push({ scriptId, timeline });
|
|
37123
|
+
}
|
|
37124
|
+
}
|
|
37125
|
+
return found;
|
|
37126
|
+
}
|
|
37127
|
+
async function coverageCommand(args, context) {
|
|
37128
|
+
const { positionals } = parseFlags(USAGE6, () => parseArgs5({ args, allowPositionals: true, options: {} }));
|
|
37129
|
+
for (const id of positionals) assertScriptId(id);
|
|
37130
|
+
const found = await recordings(projectPaths(context.cwd), [...new Set(positionals)]);
|
|
37131
|
+
if (found.length === 0) {
|
|
37132
|
+
throw new CliError("There is no recording on this machine to read.", {
|
|
37133
|
+
hint: "Record a script first: `demo record <script-id>`."
|
|
37134
|
+
});
|
|
37135
|
+
}
|
|
37136
|
+
const screens = /* @__PURE__ */ new Map();
|
|
37137
|
+
const warnings = [];
|
|
37138
|
+
for (const { scriptId, timeline } of found) {
|
|
37139
|
+
const steps = [];
|
|
37140
|
+
for (const [index, recorded] of timeline.steps.entries()) {
|
|
37141
|
+
const step = {
|
|
37142
|
+
scriptId,
|
|
37143
|
+
output: timeline.output,
|
|
37144
|
+
step: recorded.number,
|
|
37145
|
+
// As an upload sends it, so a label it sends is never reported missing.
|
|
37146
|
+
label: textOf(labelOf(timeline, index)),
|
|
37147
|
+
pageTitle: recorded.pageTitle,
|
|
37148
|
+
anchor: textOf(recorded.targetInfo["anchor"]),
|
|
37149
|
+
id: textOf(recorded.targetInfo["id"]),
|
|
37150
|
+
viewAnchor: textOf(recorded.targetInfo["viewAnchor"])
|
|
37151
|
+
};
|
|
37152
|
+
steps.push(step);
|
|
37153
|
+
const key = screenKey(recorded.pagePath);
|
|
37154
|
+
const screen = screens.get(key) ?? { path: recorded.pagePath, steps: [], views: [] };
|
|
37155
|
+
screen.steps.push(step);
|
|
37156
|
+
if (step.viewAnchor !== null && !screen.views.includes(step.viewAnchor)) screen.views.push(step.viewAnchor);
|
|
37157
|
+
screens.set(key, screen);
|
|
37158
|
+
}
|
|
37159
|
+
const name = `${scriptId} (${timeline.output})`;
|
|
37160
|
+
if (steps.length > 1 && new Set(steps.map((step) => step.pageTitle)).size === 1) {
|
|
37161
|
+
warnings.push(
|
|
37162
|
+
`${name}: every step has the page title ${JSON.stringify(steps[0]?.pageTitle ?? "")}, which Embed shows beside each step. Give each screen its own document.title and record again.`
|
|
37163
|
+
);
|
|
37164
|
+
}
|
|
37165
|
+
if (timeline.output === "video" && steps.length > 1 && steps.some((step) => step.label === null)) {
|
|
37166
|
+
warnings.push(`${name}: ${steps.filter((step) => step.label === null).length} of its steps have no label, so Embed shows them by number alone.`);
|
|
37167
|
+
}
|
|
37168
|
+
}
|
|
37169
|
+
for (const screen of screens.values()) {
|
|
37170
|
+
if (screen.views.length === 0) continue;
|
|
37171
|
+
const loose = screen.steps.filter((step) => !stepAnchors(step).some((anchor2) => screen.views.includes(anchor2)));
|
|
37172
|
+
for (const step of loose) {
|
|
37173
|
+
warnings.push(
|
|
37174
|
+
`${step.scriptId} step ${step.step} is on ${screen.path}, whose steps name the views ${screen.views.join(", ")}, but is in none of them, so Embed lists it on every view there.`
|
|
37175
|
+
);
|
|
37176
|
+
}
|
|
37177
|
+
}
|
|
37178
|
+
const ordered = [...screens.values()].sort((a, b) => a.path.localeCompare(b.path));
|
|
37179
|
+
for (const screen of ordered) {
|
|
37180
|
+
const scripts = new Set(screen.steps.map((step) => step.scriptId)).size;
|
|
37181
|
+
context.output.log(
|
|
37182
|
+
`${screen.path}: ${screen.steps.length} step${screen.steps.length === 1 ? "" : "s"} from ${scripts} recording${scripts === 1 ? "" : "s"}${screen.views.length > 0 ? `, views ${screen.views.join(", ")}` : ""}.`
|
|
37183
|
+
);
|
|
37184
|
+
}
|
|
37185
|
+
for (const warning of warnings) context.output.log(`Warning: ${warning}`);
|
|
37186
|
+
context.output.result({
|
|
37187
|
+
screens: ordered.map((screen) => ({
|
|
37188
|
+
path: screen.path,
|
|
37189
|
+
views: screen.views,
|
|
37190
|
+
steps: screen.steps
|
|
37191
|
+
})),
|
|
37192
|
+
warnings
|
|
37193
|
+
});
|
|
37194
|
+
}
|
|
37195
|
+
|
|
36737
37196
|
// src/config/mode.ts
|
|
36738
37197
|
function assertValidMode(config2) {
|
|
36739
37198
|
if (config2.voiceProvider === "mereon" && !config2.upload) {
|
|
@@ -37173,7 +37632,7 @@ async function responds(context, url2) {
|
|
|
37173
37632
|
|
|
37174
37633
|
// src/commands/init.ts
|
|
37175
37634
|
import { basename as basename2 } from "node:path";
|
|
37176
|
-
import { parseArgs as
|
|
37635
|
+
import { parseArgs as parseArgs7 } from "node:util";
|
|
37177
37636
|
import { mkdir as mkdir10, writeFile as writeFile5, stat as stat5 } from "node:fs/promises";
|
|
37178
37637
|
|
|
37179
37638
|
// src/agent/install.ts
|
|
@@ -37206,11 +37665,11 @@ ${BLOCK_END}`;
|
|
|
37206
37665
|
hint: `Delete everything from the "BEGIN mereon-demo" line to the "END mereon-demo" line by hand, then run \`demo init\` again.`
|
|
37207
37666
|
});
|
|
37208
37667
|
}
|
|
37209
|
-
const
|
|
37210
|
-
return { text, change:
|
|
37668
|
+
const text2 = `${existing.slice(0, start)}${block}${existing.slice(end + BLOCK_END.length)}`;
|
|
37669
|
+
return { text: text2, change: text2 === existing ? "unchanged" : "updated" };
|
|
37211
37670
|
}
|
|
37212
|
-
function occurrences(
|
|
37213
|
-
return
|
|
37671
|
+
function occurrences(text2, needle) {
|
|
37672
|
+
return text2.split(needle).length - 1;
|
|
37214
37673
|
}
|
|
37215
37674
|
function replaceOwned(existing, content) {
|
|
37216
37675
|
if (existing === void 0) return { text: content, change: "created" };
|
|
@@ -37363,6 +37822,8 @@ One more takes no selector:
|
|
|
37363
37822
|
|
|
37364
37823
|
**Showing more.** To show the screen before the change and wipe to now (\`demo.before\`), cut a loop for the pull request (\`loop\`), or push in slowly on a screen the viewer reads (\`camera: 'drift'\`), read \`demo/agent/showing.md\`.
|
|
37365
37824
|
|
|
37825
|
+
**Mereon Embed.** If the app uses it (\`@mereon/embed\` in its package.json, or \`data-mereon-anchor\` on its pages), read \`demo/agent/embed.md\` before you record: tabs and views need anchors before a recording can be matched to them.
|
|
37826
|
+
|
|
37366
37827
|
**Cues.** \`on\` is ${MIN_CUE_WORDS} to ${MAX_CUE_WORDS} words that appear exactly once in that step's narration. Case and punctuation are ignored. List the cues in the order the phrases are spoken. A phrase that is missing, repeated or out of order fails the run before anything is recorded. A cue's \`do\` should be done before the next cue's words, so wait for what it causes (a dialog, a saved row) at its end, not at the start of the next cue. The check fails a cue the narration gives too little time; where the app is slow, the narration waits for the cue instead, and the wait is cut.
|
|
37367
37828
|
|
|
37368
37829
|
**Shape and length.**
|
|
@@ -37438,7 +37899,7 @@ To tell people about a change by email and text, an administrator can announce a
|
|
|
37438
37899
|
Commands, from the project root: \`${demo} doctor\`, \`${demo} audience\`, \`${demo} tags\`, \`${demo} record <id>\`, \`${demo} upload\`, \`${demo} announce\`, \`${demo} reel\`.
|
|
37439
37900
|
`;
|
|
37440
37901
|
}
|
|
37441
|
-
var INSTRUCTION_SECTIONS = ["audience", "branding", "secrets", "announcing", "pages", "showing"];
|
|
37902
|
+
var INSTRUCTION_SECTIONS = ["audience", "branding", "secrets", "announcing", "pages", "showing", "embed"];
|
|
37442
37903
|
function sectionPath(section) {
|
|
37443
37904
|
return `demo/agent/${section}.md`;
|
|
37444
37905
|
}
|
|
@@ -37463,7 +37924,7 @@ Everyone sees every role, but only administrators see every team. Anyone else se
|
|
|
37463
37924
|
|
|
37464
37925
|
Settle two things:
|
|
37465
37926
|
|
|
37466
|
-
- **Who can see it** in the library: everyone in the organization, some teams, or administrators only. A role cannot limit who sees a demo. If the user wants only a role to see it, say so, and offer a team, administrators only, or telling that role through an announcement while others can see it too.
|
|
37927
|
+
- **Who can see it** in the library: everyone in the organization, some teams, or administrators only. A role cannot limit who sees a demo. If the user wants only a role to see it, say so, and offer a team, administrators only, or telling that role through an announcement while others can see it too. A demo for administrators only never appears in an app that shows demos with Mereon Embed and signs people in from its own server, by design, so when the demo is meant to show inside the app, offer a team instead.
|
|
37467
37928
|
- **Who an announcement would tell**, if one is likely: everyone, teams, roles or named people.
|
|
37468
37929
|
|
|
37469
37930
|
**Record it in the script** as \`audience\`, before you record (the example in "Writing the script" has one):
|
|
@@ -37633,6 +38094,21 @@ Each run carries on from where the last one stopped, and never uploads the video
|
|
|
37633
38094
|
Once sent, it cannot be unsent from here. It can be withdrawn in the app within 48 hours, and that is the user's decision. Do not try to undo it yourself.
|
|
37634
38095
|
|
|
37635
38096
|
In the result, \`sent\` says whether it went, \`plan.changes\` is what it changes in the knowledge base, \`willBeTold\` is how many people it tells, \`notTold\` is who it cannot reach and why, and \`url\` is the announcement in the app.
|
|
38097
|
+
`;
|
|
38098
|
+
case "embed":
|
|
38099
|
+
return `# Mereon demos: showing a demo inside your app
|
|
38100
|
+
|
|
38101
|
+
Read this when the app uses Mereon Embed: \`@mereon/embed\` is in its package.json, or its pages carry \`data-mereon-anchor\`. Embed shows a person the demos recorded on the screen they are on, by matching that screen to each demo's steps. A demo records, uploads and plays the same either way, so a mistake here shows only as a wrong list in the app, after release. Check these before you record.
|
|
38102
|
+
|
|
38103
|
+
**Mark every view a route shows.** A route that shows different things without changing its path (tabs, segmented views, a \`?tab=\` or \`?view=\` parameter) must mark each view's tab or control with \`data-mereon-anchor\`, and the app must report the one in view as the screen's \`anchor\` when it asks Embed what to show. Otherwise Embed lists every demo recorded on the route on every view. The recorder keeps, for each step, the \`data-mereon-anchor\` of what it acted on (or of the nearest element around it) and of the selected tab it ended on, so a recording made before the views were marked cannot be matched to a view. Before recording, list the app's routes that have a tab list or a view parameter and check that each view has an anchor. If one is missing, tell the user and offer to add it: it is a change to the app, so make it only when they agree. A recording warns (\`unmarked-view\`) when a step ends on a selected tab with no anchor on a page that marks other elements; act on it like any other warning. Only if the app does not show demos with Embed, set \`checkViews: false\` in the script.
|
|
38104
|
+
|
|
38105
|
+
**See what Embed will match.** \`${demo} coverage\` lists the screens the recordings here visit, the views seen on each, and the steps Embed could not tell apart or label. Run it after recording a series, and show the user its warnings.
|
|
38106
|
+
|
|
38107
|
+
**Give each screen its own page title, and each step a label.** The recorder keeps the page's title at each step and the step's \`label\`, and Embed shows them beside the step's number. A single-page app that never changes \`document.title\` gives every step the app's name.
|
|
38108
|
+
|
|
38109
|
+
**Who can see it.** People an app's server signs in to Embed never see a demo shared with administrators only. When the demo is meant to show inside the app, offer a team instead (\`demo/agent/audience.md\`).
|
|
38110
|
+
|
|
38111
|
+
**Videos uploaded before steps were sent.** \`${demo} upload\` sends a video's steps with it and says how many. A video uploaded by an earlier version of this tool has none, so Embed never finds it. \`${demo} steps <id>\` gives it the steps of its recording on this machine without uploading it again, and \`${demo} steps\` does every video recorded here. The steps line up only with the recording that was uploaded, so run it before recording the script again.
|
|
37636
38112
|
`;
|
|
37637
38113
|
case "showing":
|
|
37638
38114
|
return `# Mereon demos: showing more than the screen
|
|
@@ -37906,6 +38382,7 @@ ${fullInstructions(version2)}`
|
|
|
37906
38382
|
"agent-announcing": sectionTarget("announcing"),
|
|
37907
38383
|
"agent-pages": sectionTarget("pages"),
|
|
37908
38384
|
"agent-showing": sectionTarget("showing"),
|
|
38385
|
+
"agent-embed": sectionTarget("embed"),
|
|
37909
38386
|
// The research guide in a plain file, beside the demo guide and for the same tools.
|
|
37910
38387
|
"research-doc": {
|
|
37911
38388
|
id: "research-doc",
|
|
@@ -38117,31 +38594,31 @@ async function installInstructions(options) {
|
|
|
38117
38594
|
if (!detected) targets = [TARGETS["agent-doc"], TARGETS["research-doc"], ...SECTION_TARGETS.map((id) => TARGETS[id]), TARGETS[AGENTS_MD_FALLBACK]];
|
|
38118
38595
|
const planned = [];
|
|
38119
38596
|
const skipped = [];
|
|
38120
|
-
for (const
|
|
38121
|
-
const existing = await readOptional2(join21(options.root,
|
|
38122
|
-
if (
|
|
38123
|
-
const result2 = upsertBlock(existing,
|
|
38124
|
-
planned.push({ target, ...result2 });
|
|
38597
|
+
for (const target2 of targets) {
|
|
38598
|
+
const existing = await readOptional2(join21(options.root, target2.path));
|
|
38599
|
+
if (target2.kind === "block") {
|
|
38600
|
+
const result2 = upsertBlock(existing, target2.content(version2), target2.path);
|
|
38601
|
+
planned.push({ target: target2, ...result2 });
|
|
38125
38602
|
continue;
|
|
38126
38603
|
}
|
|
38127
|
-
const result = replaceOwned(existing,
|
|
38604
|
+
const result = replaceOwned(existing, target2.content(version2));
|
|
38128
38605
|
if ("skipped" in result) {
|
|
38129
38606
|
skipped.push({
|
|
38130
|
-
path:
|
|
38607
|
+
path: target2.path,
|
|
38131
38608
|
reason: "It already exists and was not written by `demo init`, so it was left alone."
|
|
38132
38609
|
});
|
|
38133
38610
|
continue;
|
|
38134
38611
|
}
|
|
38135
|
-
planned.push({ target, ...result });
|
|
38612
|
+
planned.push({ target: target2, ...result });
|
|
38136
38613
|
}
|
|
38137
38614
|
const files = [];
|
|
38138
|
-
for (const { target, text, change } of planned) {
|
|
38615
|
+
for (const { target: target2, text: text2, change } of planned) {
|
|
38139
38616
|
if (change !== "unchanged") {
|
|
38140
|
-
const path = join21(options.root,
|
|
38617
|
+
const path = join21(options.root, target2.path);
|
|
38141
38618
|
await mkdir9(dirname8(path), { recursive: true });
|
|
38142
|
-
await writeFileAtomically(path,
|
|
38619
|
+
await writeFileAtomically(path, text2);
|
|
38143
38620
|
}
|
|
38144
|
-
files.push({ path:
|
|
38621
|
+
files.push({ path: target2.path, change });
|
|
38145
38622
|
}
|
|
38146
38623
|
return {
|
|
38147
38624
|
harnesses: harnesses.map(({ id, name }) => ({ id, name })),
|
|
@@ -38153,12 +38630,12 @@ async function installInstructions(options) {
|
|
|
38153
38630
|
}
|
|
38154
38631
|
|
|
38155
38632
|
// src/commands/login.ts
|
|
38156
|
-
import { parseArgs as
|
|
38157
|
-
var
|
|
38633
|
+
import { parseArgs as parseArgs6 } from "node:util";
|
|
38634
|
+
var USAGE7 = "demo login [--organization <id>] [--announcements] | demo login --elevenlabs";
|
|
38158
38635
|
async function loginCommand(args, context) {
|
|
38159
38636
|
const { values } = parseFlags(
|
|
38160
|
-
|
|
38161
|
-
() =>
|
|
38637
|
+
USAGE7,
|
|
38638
|
+
() => parseArgs6({
|
|
38162
38639
|
args,
|
|
38163
38640
|
options: {
|
|
38164
38641
|
elevenlabs: { type: "boolean", default: false },
|
|
@@ -38258,11 +38735,11 @@ async function signedInOrganizationName(context, organizationId) {
|
|
|
38258
38735
|
}
|
|
38259
38736
|
|
|
38260
38737
|
// src/commands/init.ts
|
|
38261
|
-
var
|
|
38738
|
+
var USAGE8 = "demo init [--harness <name>]...";
|
|
38262
38739
|
async function initCommand(args, context) {
|
|
38263
38740
|
const { values } = parseFlags(
|
|
38264
|
-
|
|
38265
|
-
() =>
|
|
38741
|
+
USAGE8,
|
|
38742
|
+
() => parseArgs7({
|
|
38266
38743
|
args,
|
|
38267
38744
|
allowPositionals: false,
|
|
38268
38745
|
options: { harness: { type: "string", multiple: true } }
|
|
@@ -38435,12 +38912,12 @@ async function exists3(path) {
|
|
|
38435
38912
|
}
|
|
38436
38913
|
|
|
38437
38914
|
// src/commands/logout.ts
|
|
38438
|
-
import { parseArgs as
|
|
38439
|
-
var
|
|
38915
|
+
import { parseArgs as parseArgs8 } from "node:util";
|
|
38916
|
+
var USAGE9 = "demo logout [--organization <id>] | demo logout --all | demo logout --elevenlabs";
|
|
38440
38917
|
async function logoutCommand(args, context) {
|
|
38441
38918
|
const { values } = parseFlags(
|
|
38442
|
-
|
|
38443
|
-
() =>
|
|
38919
|
+
USAGE9,
|
|
38920
|
+
() => parseArgs8({
|
|
38444
38921
|
args,
|
|
38445
38922
|
allowPositionals: false,
|
|
38446
38923
|
options: {
|
|
@@ -38544,15 +39021,15 @@ function inWords(parts) {
|
|
|
38544
39021
|
if (parts.length <= 2) return parts.join(" and ");
|
|
38545
39022
|
return `${parts.slice(0, -1).join(", ")}, and ${parts.at(-1)}`;
|
|
38546
39023
|
}
|
|
38547
|
-
function capitalize(
|
|
38548
|
-
return `${
|
|
39024
|
+
function capitalize(text2) {
|
|
39025
|
+
return `${text2.charAt(0).toUpperCase()}${text2.slice(1)}`;
|
|
38549
39026
|
}
|
|
38550
39027
|
|
|
38551
39028
|
// src/commands/record.ts
|
|
38552
39029
|
import { access as access3, cp, readFile as readFile25, rename as rename6, rm as rm14 } from "node:fs/promises";
|
|
38553
39030
|
import { availableParallelism } from "node:os";
|
|
38554
39031
|
import { isAbsolute as isAbsolute2, join as join31, resolve as resolve6 } from "node:path";
|
|
38555
|
-
import { parseArgs as
|
|
39032
|
+
import { parseArgs as parseArgs9 } from "node:util";
|
|
38556
39033
|
|
|
38557
39034
|
// src/record/contact-sheet.ts
|
|
38558
39035
|
import { mkdtemp as mkdtemp4, rm as rm11 } from "node:fs/promises";
|
|
@@ -38658,7 +39135,7 @@ function createByoVoice(options) {
|
|
|
38658
39135
|
const baseUrl = options.baseUrl ?? ELEVENLABS_BASE_URL;
|
|
38659
39136
|
return {
|
|
38660
39137
|
name: "byo",
|
|
38661
|
-
async synthesize(
|
|
39138
|
+
async synthesize(text2, voiceId) {
|
|
38662
39139
|
const url2 = new URL(
|
|
38663
39140
|
`${baseUrl}/v1/text-to-speech/${encodeURIComponent(voiceId)}/with-timestamps`
|
|
38664
39141
|
);
|
|
@@ -38666,7 +39143,7 @@ function createByoVoice(options) {
|
|
|
38666
39143
|
const response = await options.fetch(url2, {
|
|
38667
39144
|
method: "POST",
|
|
38668
39145
|
headers: { "content-type": "application/json", "xi-api-key": options.apiKey },
|
|
38669
|
-
body: JSON.stringify({ text, model_id: NARRATION_MODEL_ID })
|
|
39146
|
+
body: JSON.stringify({ text: text2, model_id: NARRATION_MODEL_ID })
|
|
38670
39147
|
});
|
|
38671
39148
|
if (!response.ok) throw new CliError(failureMessage(response.status));
|
|
38672
39149
|
const parsed = responseSchema2.safeParse(await response.json());
|
|
@@ -38704,18 +39181,18 @@ var entrySchema = external_exports.object({
|
|
|
38704
39181
|
audioBase64: external_exports.string().min(1),
|
|
38705
39182
|
words: external_exports.array(external_exports.object({ word: external_exports.string(), start: external_exports.number(), end: external_exports.number() }))
|
|
38706
39183
|
});
|
|
38707
|
-
function cacheKey(provider,
|
|
38708
|
-
return createHash5("sha256").update(JSON.stringify([provider,
|
|
39184
|
+
function cacheKey(provider, text2, voiceId) {
|
|
39185
|
+
return createHash5("sha256").update(JSON.stringify([provider, text2, voiceId, NARRATION_MODEL_ID, NARRATION_OUTPUT_FORMAT])).digest("hex");
|
|
38709
39186
|
}
|
|
38710
39187
|
var NarrationCache = class {
|
|
38711
39188
|
directory;
|
|
38712
39189
|
constructor(cacheRoot) {
|
|
38713
39190
|
this.directory = join23(cacheRoot, "narration");
|
|
38714
39191
|
}
|
|
38715
|
-
async get(provider,
|
|
39192
|
+
async get(provider, text2, voiceId) {
|
|
38716
39193
|
let contents;
|
|
38717
39194
|
try {
|
|
38718
|
-
contents = await readFile21(join23(this.directory, `${cacheKey(provider,
|
|
39195
|
+
contents = await readFile21(join23(this.directory, `${cacheKey(provider, text2, voiceId)}.json`), "utf8");
|
|
38719
39196
|
} catch {
|
|
38720
39197
|
return void 0;
|
|
38721
39198
|
}
|
|
@@ -38724,11 +39201,11 @@ var NarrationCache = class {
|
|
|
38724
39201
|
if (parsed === void 0 || !parsed.success) return void 0;
|
|
38725
39202
|
return { audio: Buffer.from(parsed.data.audioBase64, "base64"), words: parsed.data.words };
|
|
38726
39203
|
}
|
|
38727
|
-
async put(provider,
|
|
39204
|
+
async put(provider, text2, voiceId, clip) {
|
|
38728
39205
|
await mkdir11(this.directory, { recursive: true });
|
|
38729
39206
|
const entry = { audioBase64: clip.audio.toString("base64"), words: clip.words };
|
|
38730
39207
|
await writeFileAtomically(
|
|
38731
|
-
join23(this.directory, `${cacheKey(provider,
|
|
39208
|
+
join23(this.directory, `${cacheKey(provider, text2, voiceId)}.json`),
|
|
38732
39209
|
JSON.stringify(entry)
|
|
38733
39210
|
);
|
|
38734
39211
|
}
|
|
@@ -38756,7 +39233,7 @@ function createMereonVoice(options) {
|
|
|
38756
39233
|
});
|
|
38757
39234
|
return {
|
|
38758
39235
|
name: "mereon",
|
|
38759
|
-
async synthesize(
|
|
39236
|
+
async synthesize(text2, voiceId) {
|
|
38760
39237
|
for (let attempt = 1; ; attempt += 1) {
|
|
38761
39238
|
const { accessToken } = await token();
|
|
38762
39239
|
const response = await options.fetch(`${options.apiUrl}/v1/narration/synthesize`, {
|
|
@@ -38766,7 +39243,7 @@ function createMereonVoice(options) {
|
|
|
38766
39243
|
authorization: `Bearer ${accessToken}`,
|
|
38767
39244
|
"user-agent": USER_AGENT
|
|
38768
39245
|
},
|
|
38769
|
-
body: JSON.stringify({ text, voiceId })
|
|
39246
|
+
body: JSON.stringify({ text: text2, voiceId })
|
|
38770
39247
|
});
|
|
38771
39248
|
if (response.ok) {
|
|
38772
39249
|
const parsed = responseSchema3.safeParse(await response.json());
|
|
@@ -38839,15 +39316,15 @@ async function synthesizeScript(options) {
|
|
|
38839
39316
|
const clips = [];
|
|
38840
39317
|
let cached2 = 0;
|
|
38841
39318
|
let synthesized = 0;
|
|
38842
|
-
const narrate = async (
|
|
38843
|
-
const hit = await options.cache.get(options.provider.name,
|
|
39319
|
+
const narrate = async (text2, label, voiceId) => {
|
|
39320
|
+
const hit = await options.cache.get(options.provider.name, text2, voiceId);
|
|
38844
39321
|
if (hit !== void 0) {
|
|
38845
39322
|
cached2 += 1;
|
|
38846
39323
|
return hit;
|
|
38847
39324
|
}
|
|
38848
39325
|
options.log(`Narrating ${label}...`);
|
|
38849
|
-
const clip = await options.provider.synthesize(
|
|
38850
|
-
await options.cache.put(options.provider.name,
|
|
39326
|
+
const clip = await options.provider.synthesize(text2, voiceId);
|
|
39327
|
+
await options.cache.put(options.provider.name, text2, voiceId, clip);
|
|
38851
39328
|
synthesized += 1;
|
|
38852
39329
|
return clip;
|
|
38853
39330
|
};
|
|
@@ -39560,8 +40037,8 @@ function accentOn(theme, background) {
|
|
|
39560
40037
|
|
|
39561
40038
|
// src/brand/templates.ts
|
|
39562
40039
|
var SYSTEM_SANS = "system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif";
|
|
39563
|
-
function escape(
|
|
39564
|
-
return
|
|
40040
|
+
function escape(text2) {
|
|
40041
|
+
return text2.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
|
|
39565
40042
|
}
|
|
39566
40043
|
function page(brand, size, css, body, background = "transparent") {
|
|
39567
40044
|
return `<!doctype html><html><head><meta charset="utf-8"><style>
|
|
@@ -39580,7 +40057,7 @@ function mark(brand, drop2, height, extraCss = "") {
|
|
|
39580
40057
|
}
|
|
39581
40058
|
return `<div class="heading" style="font-size:${Math.round(height * 0.7)}px;line-height:${height}px;color:${drop2.ink};${extraCss}">${escape(brand.organizationName)}</div>`;
|
|
39582
40059
|
}
|
|
39583
|
-
function titleCardHtml(brand, layout,
|
|
40060
|
+
function titleCardHtml(brand, layout, text2) {
|
|
39584
40061
|
const { width, height } = layout.canvas;
|
|
39585
40062
|
const drop2 = backdrop(brand, ["primary", "dark", "background"]);
|
|
39586
40063
|
const accent = accentOn(brand.theme, drop2.background);
|
|
@@ -39591,11 +40068,11 @@ function titleCardHtml(brand, layout, text) {
|
|
|
39591
40068
|
`.card{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;padding:0 ${Math.round(width * 0.1)}px;color:${drop2.ink};}
|
|
39592
40069
|
h1{margin:0;font-size:${Math.round(width * 0.05)}px;line-height:1.12;max-width:85%;}
|
|
39593
40070
|
p{margin:0;font-size:${Math.round(width * 0.022)}px;line-height:1.4;opacity:.82;max-width:75%;}`,
|
|
39594
|
-
`<div class="card">${mark(brand, drop2, Math.round(height * 0.08))}${bar}<h1 class="heading">${escape(
|
|
40071
|
+
`<div class="card">${mark(brand, drop2, Math.round(height * 0.08))}${bar}<h1 class="heading">${escape(text2.title)}</h1>${text2.subtitle === void 0 ? "" : `<p style="margin-top:${Math.round(height * 0.03)}px">${escape(text2.subtitle)}</p>`}</div>`,
|
|
39595
40072
|
drop2.background
|
|
39596
40073
|
);
|
|
39597
40074
|
}
|
|
39598
|
-
function endCardHtml(brand, layout,
|
|
40075
|
+
function endCardHtml(brand, layout, text2) {
|
|
39599
40076
|
const { width, height } = layout.canvas;
|
|
39600
40077
|
const drop2 = backdrop(brand, ["primary", "dark", "background"]);
|
|
39601
40078
|
return page(
|
|
@@ -39603,7 +40080,7 @@ function endCardHtml(brand, layout, text) {
|
|
|
39603
40080
|
layout.canvas,
|
|
39604
40081
|
`.card{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:0 ${Math.round(width * 0.12)}px;color:${drop2.ink};}
|
|
39605
40082
|
h2{margin:${Math.round(height * 0.05)}px 0 0;font-size:${Math.round(width * 0.036)}px;line-height:1.2;}`,
|
|
39606
|
-
`<div class="card">${mark(brand, drop2, Math.round(height * 0.12), "margin-left:auto;margin-right:auto;")}${
|
|
40083
|
+
`<div class="card">${mark(brand, drop2, Math.round(height * 0.12), "margin-left:auto;margin-right:auto;")}${text2.text === void 0 ? "" : `<h2 class="heading">${escape(text2.text)}</h2>`}</div>`,
|
|
39607
40084
|
drop2.background
|
|
39608
40085
|
);
|
|
39609
40086
|
}
|
|
@@ -40012,15 +40489,15 @@ function listHtml(brand, size, card) {
|
|
|
40012
40489
|
const { width, height } = size;
|
|
40013
40490
|
const back = drop(brand);
|
|
40014
40491
|
const accent = accentOn(brand.theme, back.background);
|
|
40015
|
-
const
|
|
40016
|
-
const dot = Math.round(
|
|
40492
|
+
const text2 = Math.round(width * 0.02);
|
|
40493
|
+
const dot = Math.round(text2 * 0.55);
|
|
40017
40494
|
return page(
|
|
40018
40495
|
brand,
|
|
40019
40496
|
size,
|
|
40020
40497
|
`.card{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;padding:0 ${Math.round(width * 0.1)}px;color:${back.ink};}
|
|
40021
40498
|
h1{margin:0 0 ${Math.round(height * 0.05)}px;font-size:${Math.round(width * 0.04)}px;line-height:1.15;max-width:85%;}
|
|
40022
40499
|
ul{list-style:none;margin:0;padding:0;}
|
|
40023
|
-
li{display:flex;align-items:baseline;gap:${Math.round(
|
|
40500
|
+
li{display:flex;align-items:baseline;gap:${Math.round(text2 * 0.8)}px;font-size:${text2}px;line-height:1.35;margin:0 0 ${Math.round(height * 0.025)}px;max-width:80%;}
|
|
40024
40501
|
li::before{content:'';flex:none;width:${dot}px;height:${dot}px;border-radius:${controlRadius(brand.theme.shape, dot)}px;background:${accent.fill};transform:translateY(-${Math.round(dot * 0.15)}px);}`,
|
|
40025
40502
|
`<div class="card"><h1 class="heading">${escape(card.title)}</h1><ul>${card.items.map((item) => `<li>${escape(item)}</li>`).join("")}</ul></div>`,
|
|
40026
40503
|
back.background
|
|
@@ -40031,16 +40508,16 @@ function contentsHtml(brand, size, card) {
|
|
|
40031
40508
|
const back = drop(brand);
|
|
40032
40509
|
const accent = accentOn(brand.theme, back.background);
|
|
40033
40510
|
const columns = card.items.length > 6 ? 2 : 1;
|
|
40034
|
-
const
|
|
40035
|
-
const marker = Math.round(
|
|
40511
|
+
const text2 = Math.round(width * (columns === 2 ? 0.017 : 0.02));
|
|
40512
|
+
const marker = Math.round(text2 * 1.6);
|
|
40036
40513
|
return page(
|
|
40037
40514
|
brand,
|
|
40038
40515
|
size,
|
|
40039
40516
|
`.card{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;padding:0 ${Math.round(width * 0.1)}px;color:${back.ink};}
|
|
40040
40517
|
h1{margin:0 0 ${Math.round(height * 0.05)}px;font-size:${Math.round(width * 0.036)}px;line-height:1.15;}
|
|
40041
40518
|
ol{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(${columns},1fr);grid-auto-flow:${columns === 2 ? "column" : "row"};grid-template-rows:repeat(${Math.ceil(card.items.length / columns)},auto);column-gap:${Math.round(width * 0.05)}px;row-gap:${Math.round(height * 0.022)}px;}
|
|
40042
|
-
li{display:flex;align-items:center;gap:${Math.round(
|
|
40043
|
-
.number{flex:none;width:${marker}px;height:${marker}px;border-radius:${controlRadius(brand.theme.shape, marker)}px;background:${accent.fill};color:${accent.ink};display:flex;align-items:center;justify-content:center;font-weight:700;font-size:${Math.round(
|
|
40519
|
+
li{display:flex;align-items:center;gap:${Math.round(text2 * 0.7)}px;font-size:${text2}px;line-height:1.3;}
|
|
40520
|
+
.number{flex:none;width:${marker}px;height:${marker}px;border-radius:${controlRadius(brand.theme.shape, marker)}px;background:${accent.fill};color:${accent.ink};display:flex;align-items:center;justify-content:center;font-weight:700;font-size:${Math.round(text2 * 0.8)}px;}`,
|
|
40044
40521
|
`<div class="card"><h1 class="heading">${CONTENTS_HEADING}</h1><ol>${card.items.map((item, index) => `<li><span class="number">${index + 1}</span><span>${escape(item)}</span></li>`).join("")}</ol></div>`,
|
|
40045
40522
|
back.background
|
|
40046
40523
|
);
|
|
@@ -40179,11 +40656,11 @@ async function renderCaptionTrack(input2) {
|
|
|
40179
40656
|
`);
|
|
40180
40657
|
return path;
|
|
40181
40658
|
}
|
|
40182
|
-
function captionHtml(brand, canvas, area,
|
|
40659
|
+
function captionHtml(brand, canvas, area, text2) {
|
|
40183
40660
|
const size = Math.max(14, Math.round(area.height * 0.036));
|
|
40184
40661
|
const bottom = canvas.height - (area.y + area.height) + Math.round(area.height * 0.1);
|
|
40185
40662
|
const css = `.caption{position:absolute;left:${area.x + area.width / 2}px;bottom:${bottom}px;transform:translateX(-50%);box-sizing:border-box;max-width:${Math.round(area.width * 0.54)}px;width:max-content;padding:${Math.round(size * 0.3)}px ${Math.round(size * 0.65)}px;border-radius:${Math.round(size * 0.3)}px;background:rgba(17,24,39,.8);color:#ffffff;font-size:${size}px;line-height:1.3;text-align:center;font-weight:500;}`;
|
|
40186
|
-
const body =
|
|
40663
|
+
const body = text2 === null ? "" : `<div class="caption">${escape(text2)}</div>`;
|
|
40187
40664
|
return page(brand ?? neutralBrand(), canvas, css, body);
|
|
40188
40665
|
}
|
|
40189
40666
|
|
|
@@ -40314,12 +40791,12 @@ function codeOutsideExportedObject(source) {
|
|
|
40314
40791
|
if (close === void 0) return source;
|
|
40315
40792
|
return source.slice(0, match.index) + source.slice(close + 1);
|
|
40316
40793
|
}
|
|
40317
|
-
function matchingBrace(
|
|
40794
|
+
function matchingBrace(text2, open6) {
|
|
40318
40795
|
const stack = [{ kind: "code", depth: 0 }];
|
|
40319
|
-
for (let index = open6; index <
|
|
40796
|
+
for (let index = open6; index < text2.length; index++) {
|
|
40320
40797
|
const top = stack[stack.length - 1];
|
|
40321
|
-
const char =
|
|
40322
|
-
const next =
|
|
40798
|
+
const char = text2[index];
|
|
40799
|
+
const next = text2[index + 1];
|
|
40323
40800
|
if (top === void 0) return void 0;
|
|
40324
40801
|
if (top.kind === "template") {
|
|
40325
40802
|
if (char === "\\") index++;
|
|
@@ -40331,15 +40808,15 @@ function matchingBrace(text, open6) {
|
|
|
40331
40808
|
continue;
|
|
40332
40809
|
}
|
|
40333
40810
|
if (char === "/" && next === "/") {
|
|
40334
|
-
const end =
|
|
40811
|
+
const end = text2.indexOf("\n", index);
|
|
40335
40812
|
if (end === -1) return void 0;
|
|
40336
40813
|
index = end;
|
|
40337
40814
|
} else if (char === "/" && next === "*") {
|
|
40338
|
-
const end =
|
|
40815
|
+
const end = text2.indexOf("*/", index + 2);
|
|
40339
40816
|
if (end === -1) return void 0;
|
|
40340
40817
|
index = end + 1;
|
|
40341
40818
|
} else if (char === '"' || char === "'") {
|
|
40342
|
-
const end = endOfString(
|
|
40819
|
+
const end = endOfString(text2, index, char);
|
|
40343
40820
|
if (end === void 0) return void 0;
|
|
40344
40821
|
index = end;
|
|
40345
40822
|
} else if (char === "`") {
|
|
@@ -40356,9 +40833,9 @@ function matchingBrace(text, open6) {
|
|
|
40356
40833
|
}
|
|
40357
40834
|
return void 0;
|
|
40358
40835
|
}
|
|
40359
|
-
function endOfString(
|
|
40360
|
-
for (let index = start + 1; index <
|
|
40361
|
-
const char =
|
|
40836
|
+
function endOfString(text2, start, quote2) {
|
|
40837
|
+
for (let index = start + 1; index < text2.length; index++) {
|
|
40838
|
+
const char = text2[index];
|
|
40362
40839
|
if (char === "\\") index++;
|
|
40363
40840
|
else if (char === quote2) return index;
|
|
40364
40841
|
else if (char === "\n") return void 0;
|
|
@@ -40395,6 +40872,8 @@ var keptTakeSchema = external_exports.object({
|
|
|
40395
40872
|
endMs: external_exports.number(),
|
|
40396
40873
|
pageUrl: external_exports.string(),
|
|
40397
40874
|
pageTitle: external_exports.string(),
|
|
40875
|
+
/** The view the step ended in; absent from a take kept before it was, which then claims none. */
|
|
40876
|
+
view: stepViewSchema.default(UNKNOWN_VIEW),
|
|
40398
40877
|
target: external_exports.object({ actionType: external_exports.enum(STEP_ACTION_TYPES), targetInfo: external_exports.record(external_exports.string(), external_exports.string()) }).nullable(),
|
|
40399
40878
|
settle: external_exports.object({ settled: external_exports.boolean(), waitedMs: external_exports.number(), pending: external_exports.array(external_exports.string()) }).nullable(),
|
|
40400
40879
|
/** The page shown beside the app's and how its wait went; absent from a take kept before it was. */
|
|
@@ -40417,21 +40896,21 @@ var keptTakeSchema = external_exports.object({
|
|
|
40417
40896
|
pages: external_exports.array(external_exports.object({ name: external_exports.string(), markInVideoMs: external_exports.number() })).default([])
|
|
40418
40897
|
});
|
|
40419
40898
|
function takeFingerprint(script, source) {
|
|
40420
|
-
const
|
|
40899
|
+
const text2 = (value) => value === void 0 ? null : value.toString();
|
|
40421
40900
|
const outside = source === void 0 ? "" : codeOutsideExportedObject(source).trim();
|
|
40422
40901
|
const parts = {
|
|
40423
40902
|
...outside === "" ? {} : { module: outside },
|
|
40424
|
-
setup:
|
|
40425
|
-
storageState:
|
|
40903
|
+
setup: text2(script.setup),
|
|
40904
|
+
storageState: text2(script.storageState),
|
|
40426
40905
|
auth: script.auth ?? null,
|
|
40427
40906
|
secrets: script.secrets,
|
|
40428
40907
|
redact: script.redact,
|
|
40429
40908
|
// Only when there are any, so a take kept before pages existed still matches its script.
|
|
40430
|
-
...script.pages === void 0 ? {} : { pages: Object.entries(script.pages).map(([name, page2]) => ({ name, auth: page2.auth ?? null, setup:
|
|
40909
|
+
...script.pages === void 0 ? {} : { pages: Object.entries(script.pages).map(([name, page2]) => ({ name, auth: page2.auth ?? null, setup: text2(page2.setup) })) },
|
|
40431
40910
|
steps: script.steps.map((step) => ({
|
|
40432
|
-
action:
|
|
40911
|
+
action: text2(step.action),
|
|
40433
40912
|
settle: step.settle ?? null,
|
|
40434
|
-
cues: step.cues.map((cue) => ({ on: cue.on, do:
|
|
40913
|
+
cues: step.cues.map((cue) => ({ on: cue.on, do: text2(cue.do) })),
|
|
40435
40914
|
...step.side === void 0 ? {} : { side: step.side, layout: step.layout ?? "split" }
|
|
40436
40915
|
}))
|
|
40437
40916
|
};
|
|
@@ -40469,6 +40948,7 @@ function keepTake(input2) {
|
|
|
40469
40948
|
endMs: step.endMs,
|
|
40470
40949
|
pageUrl: step.pageUrl,
|
|
40471
40950
|
pageTitle: step.pageTitle,
|
|
40951
|
+
view: step.view,
|
|
40472
40952
|
target: step.target ?? null,
|
|
40473
40953
|
settle: step.settle,
|
|
40474
40954
|
sideSettle: step.sideSettle,
|
|
@@ -40552,6 +41032,7 @@ function restoreTake(kept, input2) {
|
|
|
40552
41032
|
narration,
|
|
40553
41033
|
pageUrl: step.pageUrl,
|
|
40554
41034
|
pageTitle: step.pageTitle,
|
|
41035
|
+
view: step.view,
|
|
40555
41036
|
target: step.target ?? void 0,
|
|
40556
41037
|
settle: step.settle,
|
|
40557
41038
|
sideSettle: step.sideSettle,
|
|
@@ -40597,12 +41078,12 @@ function overlayLook(brand) {
|
|
|
40597
41078
|
}
|
|
40598
41079
|
|
|
40599
41080
|
// src/commands/record.ts
|
|
40600
|
-
var
|
|
41081
|
+
var USAGE10 = "demo record <script-id>... [--output guide|video] [--draft] [--parallel <n>] [--allow-remote]";
|
|
40601
41082
|
var DEFAULT_PARALLEL = 2;
|
|
40602
41083
|
async function recordCommand(args, context) {
|
|
40603
41084
|
const { values, positionals } = parseFlags(
|
|
40604
|
-
|
|
40605
|
-
() =>
|
|
41085
|
+
USAGE10,
|
|
41086
|
+
() => parseArgs9({
|
|
40606
41087
|
args,
|
|
40607
41088
|
allowPositionals: true,
|
|
40608
41089
|
options: {
|
|
@@ -40614,7 +41095,7 @@ async function recordCommand(args, context) {
|
|
|
40614
41095
|
})
|
|
40615
41096
|
);
|
|
40616
41097
|
const scriptIds = positionals;
|
|
40617
|
-
if (scriptIds.length === 0) throw new CliError(`Usage: ${
|
|
41098
|
+
if (scriptIds.length === 0) throw new CliError(`Usage: ${USAGE10}`);
|
|
40618
41099
|
const repeated = scriptIds.find((id, index) => scriptIds.indexOf(id) !== index);
|
|
40619
41100
|
if (repeated !== void 0) throw new CliError(`${repeated} is named twice. Name each script once.`);
|
|
40620
41101
|
const parallel = parseParallel(values.parallel);
|
|
@@ -40752,13 +41233,13 @@ async function recordMany(input2) {
|
|
|
40752
41233
|
failures.push({ scriptId, message });
|
|
40753
41234
|
}
|
|
40754
41235
|
});
|
|
40755
|
-
const
|
|
41236
|
+
const recordings2 = prepared.flatMap(({ scriptId }) => {
|
|
40756
41237
|
const report2 = reports.get(scriptId);
|
|
40757
41238
|
return report2 === void 0 ? [] : [{ scriptId, ...report2 }];
|
|
40758
41239
|
});
|
|
40759
41240
|
if (failures.length > 0) {
|
|
40760
41241
|
const where = (report2) => typeof report2["mp4"] === "string" ? report2["mp4"] : report2["timeline"];
|
|
40761
|
-
const made =
|
|
41242
|
+
const made = recordings2.map((recording) => ` ${recording.scriptId}: ${String(where(recording))}`);
|
|
40762
41243
|
const failed = prepared.flatMap(({ scriptId }) => failures.filter((f) => f.scriptId === scriptId)).map((f) => ` ${f.scriptId}: ${f.message}`);
|
|
40763
41244
|
throw new CliError(
|
|
40764
41245
|
[
|
|
@@ -40772,9 +41253,9 @@ async function recordMany(input2) {
|
|
|
40772
41253
|
}
|
|
40773
41254
|
);
|
|
40774
41255
|
}
|
|
40775
|
-
context.output.result({ recordings });
|
|
41256
|
+
context.output.result({ recordings: recordings2 });
|
|
40776
41257
|
}
|
|
40777
|
-
async function eachAtMost(items,
|
|
41258
|
+
async function eachAtMost(items, limit2, work) {
|
|
40778
41259
|
let next = 0;
|
|
40779
41260
|
const worker = async () => {
|
|
40780
41261
|
while (next < items.length) {
|
|
@@ -40783,7 +41264,7 @@ async function eachAtMost(items, limit, work) {
|
|
|
40783
41264
|
if (item !== void 0) await work(item);
|
|
40784
41265
|
}
|
|
40785
41266
|
};
|
|
40786
|
-
await Promise.all(Array.from({ length: Math.min(
|
|
41267
|
+
await Promise.all(Array.from({ length: Math.min(limit2, items.length) }, worker));
|
|
40787
41268
|
}
|
|
40788
41269
|
async function recordLoaded(input2) {
|
|
40789
41270
|
const { context, config: config2, paths, loaded, secrets, session, pageSessions, log, connection, output: output2, draft, values, scriptId } = input2;
|
|
@@ -40966,7 +41447,7 @@ var CHECK_USAGE = "demo check <script-id> [--only-step <n> | --from-step <n>] [-
|
|
|
40966
41447
|
async function checkCommand(args, context) {
|
|
40967
41448
|
const { values, positionals } = parseFlags(
|
|
40968
41449
|
CHECK_USAGE,
|
|
40969
|
-
() =>
|
|
41450
|
+
() => parseArgs9({
|
|
40970
41451
|
args,
|
|
40971
41452
|
allowPositionals: true,
|
|
40972
41453
|
options: {
|
|
@@ -41084,7 +41565,7 @@ var RENDER_USAGE = "demo render <script-id> [--brand <level or parts>]";
|
|
|
41084
41565
|
async function renderCommand(args, context) {
|
|
41085
41566
|
const { values, positionals } = parseFlags(
|
|
41086
41567
|
RENDER_USAGE,
|
|
41087
|
-
() =>
|
|
41568
|
+
() => parseArgs9({ args, allowPositionals: true, options: { brand: { type: "string" } } })
|
|
41088
41569
|
);
|
|
41089
41570
|
const [scriptId, ...extra] = positionals;
|
|
41090
41571
|
if (scriptId === void 0 || extra.length > 0) throw new CliError(`Usage: ${RENDER_USAGE}`);
|
|
@@ -41342,10 +41823,10 @@ function cardNarration(loaded, parts, output2) {
|
|
|
41342
41823
|
}
|
|
41343
41824
|
if (output2 === "video") {
|
|
41344
41825
|
loaded.script.steps.forEach((step, index) => {
|
|
41345
|
-
const
|
|
41346
|
-
if (
|
|
41826
|
+
const text2 = step.interlude?.narration;
|
|
41827
|
+
if (text2 === void 0) return;
|
|
41347
41828
|
keys.push(index);
|
|
41348
|
-
lines.push({ label: `the card before step ${index + 1}`, text, voice: step.interlude?.voice });
|
|
41829
|
+
lines.push({ label: `the card before step ${index + 1}`, text: text2, voice: step.interlude?.voice });
|
|
41349
41830
|
});
|
|
41350
41831
|
}
|
|
41351
41832
|
return {
|
|
@@ -41369,8 +41850,9 @@ function brandRecord(branding, video) {
|
|
|
41369
41850
|
thumbnailAt: video?.thumbnailAt ?? null
|
|
41370
41851
|
};
|
|
41371
41852
|
}
|
|
41372
|
-
function timelineStep(step, place, baseUrl) {
|
|
41853
|
+
function timelineStep(step, place, baseUrl, label) {
|
|
41373
41854
|
const isGuide = "screenshot" in step;
|
|
41855
|
+
const targetInfo = step.target?.targetInfo ?? {};
|
|
41374
41856
|
return {
|
|
41375
41857
|
number: step.number,
|
|
41376
41858
|
offsetMs: Math.round(place.offsetMs),
|
|
@@ -41384,8 +41866,9 @@ function timelineStep(step, place, baseUrl) {
|
|
|
41384
41866
|
})),
|
|
41385
41867
|
pagePath: relativePagePath(step.pageUrl, baseUrl),
|
|
41386
41868
|
pageTitle: step.pageTitle,
|
|
41869
|
+
...label !== void 0 && label.trim() !== "" ? { label: label.trim() } : {},
|
|
41387
41870
|
actionType: step.target?.actionType ?? "navigate",
|
|
41388
|
-
targetInfo: step.
|
|
41871
|
+
targetInfo: step.view.anchor === null ? targetInfo : { ...targetInfo, viewAnchor: step.view.anchor },
|
|
41389
41872
|
screenshot: isGuide ? `steps/${String(step.number).padStart(2, "0")}.png` : null
|
|
41390
41873
|
};
|
|
41391
41874
|
}
|
|
@@ -41454,7 +41937,7 @@ async function recordGuide(input2) {
|
|
|
41454
41937
|
draft: false,
|
|
41455
41938
|
viewport: FULL_VIEWPORT,
|
|
41456
41939
|
steps: layout.placed.map(
|
|
41457
|
-
({ item, offsetMs, durationMs }) => timelineStep(item, { offsetMs, durationMs }, input2.baseUrl)
|
|
41940
|
+
({ item, offsetMs, durationMs }) => timelineStep(item, { offsetMs, durationMs }, input2.baseUrl, input2.loaded.script.steps[item.number - 1]?.label)
|
|
41458
41941
|
),
|
|
41459
41942
|
redactions: take.redactions,
|
|
41460
41943
|
redacted: take.redacted,
|
|
@@ -41462,10 +41945,18 @@ async function recordGuide(input2) {
|
|
|
41462
41945
|
}),
|
|
41463
41946
|
warnings: takeWarnings({
|
|
41464
41947
|
// A guide has no clock; its steps are only numbered.
|
|
41465
|
-
steps: take.steps.map((step) => ({
|
|
41948
|
+
steps: take.steps.map((step) => ({
|
|
41949
|
+
number: step.number,
|
|
41950
|
+
startMs: 0,
|
|
41951
|
+
endMs: 0,
|
|
41952
|
+
settle: step.settle,
|
|
41953
|
+
pageUrl: step.pageUrl,
|
|
41954
|
+
view: step.view
|
|
41955
|
+
})),
|
|
41466
41956
|
credentialsInAction: take.credentialsInAction,
|
|
41957
|
+
checkViews: input2.loaded.script.checkViews !== false,
|
|
41467
41958
|
fromHelpers: take.warnings,
|
|
41468
|
-
mask: (
|
|
41959
|
+
mask: (text2) => input2.secrets.mask(text2)
|
|
41469
41960
|
}),
|
|
41470
41961
|
unmatchedRedactSelectors: take.unmatchedRedactSelectors,
|
|
41471
41962
|
uncoveredCanvases: take.uncoveredCanvases
|
|
@@ -41585,10 +42076,11 @@ async function finishVideo(input2) {
|
|
|
41585
42076
|
const warnings = takeWarnings({
|
|
41586
42077
|
steps: rawTake.steps,
|
|
41587
42078
|
credentialsInAction: rawTake.credentialsInAction,
|
|
42079
|
+
checkViews: input2.loaded.script.checkViews !== false,
|
|
41588
42080
|
navigations: rawTake.navigations,
|
|
41589
42081
|
plan: plan2,
|
|
41590
42082
|
fromHelpers: rawTake.warnings,
|
|
41591
|
-
mask: (
|
|
42083
|
+
mask: (text2) => input2.secrets.mask(text2)
|
|
41592
42084
|
});
|
|
41593
42085
|
const lastEnd = plan2.lengthMs;
|
|
41594
42086
|
const branded = input2.branding !== void 0 && changesVideo(input2.branding.parts) ? await makeBrandedVideo({
|
|
@@ -41657,7 +42149,12 @@ async function finishVideo(input2) {
|
|
|
41657
42149
|
draft: input2.draft,
|
|
41658
42150
|
viewport,
|
|
41659
42151
|
steps: take.steps.map(
|
|
41660
|
-
(step) => timelineStep(
|
|
42152
|
+
(step) => timelineStep(
|
|
42153
|
+
step,
|
|
42154
|
+
{ offsetMs: shift + step.narrationStartMs, durationMs: step.endMs - step.narrationStartMs },
|
|
42155
|
+
input2.baseUrl,
|
|
42156
|
+
input2.loaded.script.steps[step.number - 1]?.label
|
|
42157
|
+
)
|
|
41661
42158
|
),
|
|
41662
42159
|
redactions: take.redactions.map((sample) => sample.kind === "video" ? { ...sample, atMs: shift + sample.atMs } : sample),
|
|
41663
42160
|
redacted: take.redacted,
|
|
@@ -41712,7 +42209,7 @@ function scaleFocus(take, scale) {
|
|
|
41712
42209
|
// src/commands/reel.ts
|
|
41713
42210
|
import { mkdir as mkdir16 } from "node:fs/promises";
|
|
41714
42211
|
import { dirname as dirname10, join as join33, resolve as resolve7 } from "node:path";
|
|
41715
|
-
import { parseArgs as
|
|
42212
|
+
import { parseArgs as parseArgs10 } from "node:util";
|
|
41716
42213
|
|
|
41717
42214
|
// src/reel/reel.ts
|
|
41718
42215
|
import { randomBytes as randomBytes8 } from "node:crypto";
|
|
@@ -41722,8 +42219,8 @@ import { join as join32 } from "node:path";
|
|
|
41722
42219
|
var REEL_CARD_SECONDS = 4;
|
|
41723
42220
|
var FPS2 = 25;
|
|
41724
42221
|
var SAMPLE_RATE = 48e3;
|
|
41725
|
-
function escapeHtml(
|
|
41726
|
-
return
|
|
42222
|
+
function escapeHtml(text2) {
|
|
42223
|
+
return text2.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] ?? c);
|
|
41727
42224
|
}
|
|
41728
42225
|
function reelCardHtml(title, demos, size) {
|
|
41729
42226
|
const unit = Math.min(size.width, size.height) / 1080;
|
|
@@ -41810,12 +42307,12 @@ async function makeReel(input2) {
|
|
|
41810
42307
|
}
|
|
41811
42308
|
|
|
41812
42309
|
// src/commands/reel.ts
|
|
41813
|
-
var
|
|
42310
|
+
var USAGE11 = "demo reel <script-id>... [--title <text>] [--output <file>] [--confirm-redacted]";
|
|
41814
42311
|
var probeSchema = external_exports.object({ streams: external_exports.array(external_exports.object({ width: external_exports.number(), height: external_exports.number() })).min(1) });
|
|
41815
42312
|
async function reelCommand(args, context) {
|
|
41816
42313
|
const { values, positionals } = parseFlags(
|
|
41817
|
-
|
|
41818
|
-
() =>
|
|
42314
|
+
USAGE11,
|
|
42315
|
+
() => parseArgs10({
|
|
41819
42316
|
args,
|
|
41820
42317
|
allowPositionals: true,
|
|
41821
42318
|
options: {
|
|
@@ -41825,7 +42322,7 @@ async function reelCommand(args, context) {
|
|
|
41825
42322
|
}
|
|
41826
42323
|
})
|
|
41827
42324
|
);
|
|
41828
|
-
if (positionals.length === 0) throw new CliError(`Usage: ${
|
|
42325
|
+
if (positionals.length === 0) throw new CliError(`Usage: ${USAGE11}`);
|
|
41829
42326
|
const paths = projectPaths(context.cwd);
|
|
41830
42327
|
const ffmpeg = await context.probes.ffmpeg();
|
|
41831
42328
|
if (ffmpeg.h264Encoder === void 0 || !ffmpeg.aac) {
|
|
@@ -41858,7 +42355,7 @@ async function reelCommand(args, context) {
|
|
|
41858
42355
|
});
|
|
41859
42356
|
}
|
|
41860
42357
|
const first = demos[0];
|
|
41861
|
-
if (first === void 0) throw new CliError(`Usage: ${
|
|
42358
|
+
if (first === void 0) throw new CliError(`Usage: ${USAGE11}`);
|
|
41862
42359
|
const probe = await exec("ffprobe", ["-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of", "json", first.video]);
|
|
41863
42360
|
const stream = probeSchema.safeParse(JSON.parse(probe.stdout || "{}"));
|
|
41864
42361
|
if (probe.code !== 0 || !stream.success) throw new CliError(`The video of ${first.id} could not be read.`);
|
|
@@ -41878,9 +42375,9 @@ async function reelCommand(args, context) {
|
|
|
41878
42375
|
}
|
|
41879
42376
|
|
|
41880
42377
|
// src/commands/release.ts
|
|
41881
|
-
import { parseArgs as
|
|
42378
|
+
import { parseArgs as parseArgs11 } from "node:util";
|
|
41882
42379
|
import { relative as relative6 } from "node:path";
|
|
41883
|
-
var
|
|
42380
|
+
var USAGE12 = "demo release [--dry-run] [--strict]";
|
|
41884
42381
|
var QUIET_OUTCOMES = /* @__PURE__ */ new Set(["released", "would-release", "nothing-held"]);
|
|
41885
42382
|
var PULL_REQUEST_SIGNALS = [
|
|
41886
42383
|
{ name: "GITHUB_EVENT_NAME", matches: (value) => value.startsWith("pull_request") },
|
|
@@ -41888,8 +42385,8 @@ var PULL_REQUEST_SIGNALS = [
|
|
|
41888
42385
|
];
|
|
41889
42386
|
async function releaseCommand(args, context) {
|
|
41890
42387
|
const { values, positionals } = parseFlags(
|
|
41891
|
-
|
|
41892
|
-
() =>
|
|
42388
|
+
USAGE12,
|
|
42389
|
+
() => parseArgs11({
|
|
41893
42390
|
args,
|
|
41894
42391
|
allowPositionals: true,
|
|
41895
42392
|
options: {
|
|
@@ -41898,7 +42395,7 @@ async function releaseCommand(args, context) {
|
|
|
41898
42395
|
}
|
|
41899
42396
|
})
|
|
41900
42397
|
);
|
|
41901
|
-
if (positionals.length > 0) throw new CliError(`Usage: ${
|
|
42398
|
+
if (positionals.length > 0) throw new CliError(`Usage: ${USAGE12}`);
|
|
41902
42399
|
const dryRun = values["dry-run"];
|
|
41903
42400
|
const token = context.env[RELEASE_TOKEN_ENV]?.trim();
|
|
41904
42401
|
if (token === void 0 || token.length === 0) {
|
|
@@ -42063,12 +42560,12 @@ function report(context, response) {
|
|
|
42063
42560
|
}
|
|
42064
42561
|
|
|
42065
42562
|
// src/commands/tags.ts
|
|
42066
|
-
var
|
|
42563
|
+
var USAGE13 = "demo tags | demo tags create <name>";
|
|
42067
42564
|
async function tagsCommand(args, context) {
|
|
42068
42565
|
const [subcommand, name, ...extra] = args;
|
|
42069
42566
|
const creating = subcommand === "create";
|
|
42070
42567
|
if (subcommand !== void 0 && !creating || creating && (name === void 0 || name.trim() === "" || extra.length > 0)) {
|
|
42071
|
-
throw new CliError(`Usage: ${
|
|
42568
|
+
throw new CliError(`Usage: ${USAGE13}`);
|
|
42072
42569
|
}
|
|
42073
42570
|
const paths = projectPaths(context.cwd);
|
|
42074
42571
|
const config2 = await loadProjectConfig(paths, context.env);
|
|
@@ -42097,8 +42594,119 @@ async function tagsCommand(args, context) {
|
|
|
42097
42594
|
context.output.result({ organizationId: connection.organizationId, tags });
|
|
42098
42595
|
}
|
|
42099
42596
|
|
|
42597
|
+
// src/commands/steps.ts
|
|
42598
|
+
import { readdir as readdir6 } from "node:fs/promises";
|
|
42599
|
+
import { parseArgs as parseArgs12 } from "node:util";
|
|
42600
|
+
var USAGE14 = "demo steps [<script-id>...]";
|
|
42601
|
+
var stepsSchema = external_exports.object({
|
|
42602
|
+
videoId: external_exports.string().min(1),
|
|
42603
|
+
contentId: external_exports.string().min(1),
|
|
42604
|
+
versionId: external_exports.string().nullable(),
|
|
42605
|
+
stepCount: external_exports.number().int().nonnegative()
|
|
42606
|
+
});
|
|
42607
|
+
var STEPS_WORDING = {
|
|
42608
|
+
action: "set the video's steps",
|
|
42609
|
+
forbidden: "Your account cannot change videos in your organization.",
|
|
42610
|
+
forbiddenHint: "Ask an administrator whether you may add guides and videos.",
|
|
42611
|
+
loginHint: "Run `demo login` to sign in again.",
|
|
42612
|
+
retryHint: "Run `demo steps` again."
|
|
42613
|
+
};
|
|
42614
|
+
async function recordedVideos(paths) {
|
|
42615
|
+
let names;
|
|
42616
|
+
try {
|
|
42617
|
+
names = await readdir6(paths.out);
|
|
42618
|
+
} catch {
|
|
42619
|
+
return [];
|
|
42620
|
+
}
|
|
42621
|
+
const ids = [];
|
|
42622
|
+
for (const name of names.sort()) {
|
|
42623
|
+
if (!SCRIPT_ID_PATTERN.test(name)) continue;
|
|
42624
|
+
if (await readTimeline(paths, name, "video") !== void 0) ids.push(name);
|
|
42625
|
+
}
|
|
42626
|
+
return ids;
|
|
42627
|
+
}
|
|
42628
|
+
async function stepsCommand(args, context) {
|
|
42629
|
+
const { positionals } = parseFlags(
|
|
42630
|
+
USAGE14,
|
|
42631
|
+
() => parseArgs12({ args, allowPositionals: true, options: {} })
|
|
42632
|
+
);
|
|
42633
|
+
for (const id of positionals) assertScriptId(id);
|
|
42634
|
+
const paths = projectPaths(context.cwd);
|
|
42635
|
+
const config2 = await loadProjectConfig(paths, context.env);
|
|
42636
|
+
const named = positionals.length > 0;
|
|
42637
|
+
const scriptIds = named ? [...new Set(positionals)] : await recordedVideos(paths);
|
|
42638
|
+
if (scriptIds.length === 0) {
|
|
42639
|
+
throw new CliError("There is no video recording on this machine to take steps from.", {
|
|
42640
|
+
hint: "Videos are recorded with `demo record <script-id>`. A guide needs no steps of its own: they are its content."
|
|
42641
|
+
});
|
|
42642
|
+
}
|
|
42643
|
+
const connection = await requireLogin(context, config2.organization);
|
|
42644
|
+
context.output.log(`Setting video steps in ${describeConnection(connection)}.`);
|
|
42645
|
+
const client = createMereonClient({
|
|
42646
|
+
apiUrl: context.apiUrl,
|
|
42647
|
+
organizationId: connection.organizationId,
|
|
42648
|
+
credentialsPath: context.credentialsPath,
|
|
42649
|
+
fetch: context.fetch,
|
|
42650
|
+
now: context.now,
|
|
42651
|
+
sleep: context.sleep
|
|
42652
|
+
});
|
|
42653
|
+
const updated = [];
|
|
42654
|
+
const skipped = [];
|
|
42655
|
+
for (const scriptId of scriptIds) {
|
|
42656
|
+
const timeline = await readTimeline(paths, scriptId, "video");
|
|
42657
|
+
if (timeline === void 0) {
|
|
42658
|
+
skipped.push({ scriptId, reason: "there is no video recording of it on this machine" });
|
|
42659
|
+
continue;
|
|
42660
|
+
}
|
|
42661
|
+
if (timeline.draft) {
|
|
42662
|
+
skipped.push({ scriptId, reason: "its recording is a draft, which cannot have been uploaded" });
|
|
42663
|
+
continue;
|
|
42664
|
+
}
|
|
42665
|
+
const outcome2 = videoSteps(timeline);
|
|
42666
|
+
if (outcome2.steps === null) {
|
|
42667
|
+
skipped.push({ scriptId, reason: outcome2.reason });
|
|
42668
|
+
continue;
|
|
42669
|
+
}
|
|
42670
|
+
if (await scriptChangedSince(paths, timeline)) {
|
|
42671
|
+
context.output.log(
|
|
42672
|
+
`Warning: ${scriptId} has changed since it was recorded. Its steps are the recording's, recorded ${timeline.recordedAt}, and line up only if that is the recording you uploaded.`
|
|
42673
|
+
);
|
|
42674
|
+
}
|
|
42675
|
+
const body = {
|
|
42676
|
+
sourceKey: `${config2.source.repo}#${scriptId}`,
|
|
42677
|
+
steps: outcome2.steps
|
|
42678
|
+
};
|
|
42679
|
+
let answer;
|
|
42680
|
+
try {
|
|
42681
|
+
answer = await client.putJsonIfFound("/v1/videos/steps", body, stepsSchema, STEPS_WORDING);
|
|
42682
|
+
} catch (error62) {
|
|
42683
|
+
if (!(error62 instanceof CliError) || error62.code !== API_ERROR.recordingUpdateInProgress) throw error62;
|
|
42684
|
+
skipped.push({ scriptId, reason: "a new recording of it is on its way, and its upload sends its own steps" });
|
|
42685
|
+
continue;
|
|
42686
|
+
}
|
|
42687
|
+
if (answer === void 0) {
|
|
42688
|
+
skipped.push({ scriptId, reason: `no video in your organization was uploaded from it (${body.sourceKey})` });
|
|
42689
|
+
continue;
|
|
42690
|
+
}
|
|
42691
|
+
const anchored = outcome2.steps.filter((step) => step.targetInfo?.anchor !== void 0).length;
|
|
42692
|
+
context.output.log(
|
|
42693
|
+
`${scriptId}: set its ${answer.stepCount} step${answer.stepCount === 1 ? "" : "s"}${anchored > 0 ? `, ${anchored} on an element marked data-mereon-anchor` : ""}.`
|
|
42694
|
+
);
|
|
42695
|
+
updated.push({ scriptId, videoId: answer.videoId, steps: answer.stepCount });
|
|
42696
|
+
}
|
|
42697
|
+
for (const { scriptId, reason } of skipped) context.output.log(`${scriptId}: left as it is, because ${reason}.`);
|
|
42698
|
+
if (named && updated.length === 0) {
|
|
42699
|
+
const [first] = skipped;
|
|
42700
|
+
throw new CliError(
|
|
42701
|
+
scriptIds.length === 1 && first !== void 0 ? `Could not set the steps of ${first.scriptId}: ${first.reason}.` : "Could not set the steps of any of those videos.",
|
|
42702
|
+
{ hint: "Upload a video with `demo upload <script-id>`, which sends its steps with it." }
|
|
42703
|
+
);
|
|
42704
|
+
}
|
|
42705
|
+
context.output.result({ updated, skipped });
|
|
42706
|
+
}
|
|
42707
|
+
|
|
42100
42708
|
// src/commands/upload.ts
|
|
42101
|
-
import { parseArgs as
|
|
42709
|
+
import { parseArgs as parseArgs13 } from "node:util";
|
|
42102
42710
|
|
|
42103
42711
|
// src/upload/guide.ts
|
|
42104
42712
|
import { readFile as readFile26 } from "node:fs/promises";
|
|
@@ -42259,11 +42867,11 @@ async function prepareHold(options) {
|
|
|
42259
42867
|
}
|
|
42260
42868
|
|
|
42261
42869
|
// src/commands/upload.ts
|
|
42262
|
-
var
|
|
42870
|
+
var USAGE15 = "demo upload [<script-id>] [--output guide|video] [--tag <name>]... [--stack] [--hold | --publish-now] [--retraining none|changed-material|full-retake] [--confirm-redacted]";
|
|
42263
42871
|
async function uploadCommand(args, context) {
|
|
42264
42872
|
const { values, positionals } = parseFlags(
|
|
42265
|
-
|
|
42266
|
-
() =>
|
|
42873
|
+
USAGE15,
|
|
42874
|
+
() => parseArgs13({
|
|
42267
42875
|
args,
|
|
42268
42876
|
allowPositionals: true,
|
|
42269
42877
|
options: {
|
|
@@ -42278,7 +42886,7 @@ async function uploadCommand(args, context) {
|
|
|
42278
42886
|
})
|
|
42279
42887
|
);
|
|
42280
42888
|
const [scriptId, ...extra] = positionals;
|
|
42281
|
-
if (extra.length > 0) throw new CliError(`Usage: ${
|
|
42889
|
+
if (extra.length > 0) throw new CliError(`Usage: ${USAGE15}`);
|
|
42282
42890
|
const requestedOutput = parseOutputFlag(values.output);
|
|
42283
42891
|
const retrainingIntent = parseRetrainingFlag(values.retraining);
|
|
42284
42892
|
const paths = projectPaths(context.cwd);
|
|
@@ -42447,6 +43055,8 @@ var COMMANDS = {
|
|
|
42447
43055
|
record: recordCommand,
|
|
42448
43056
|
render: renderCommand,
|
|
42449
43057
|
upload: uploadCommand,
|
|
43058
|
+
steps: stepsCommand,
|
|
43059
|
+
coverage: coverageCommand,
|
|
42450
43060
|
announce: announceCommand,
|
|
42451
43061
|
audience: audienceCommand,
|
|
42452
43062
|
tags: tagsCommand,
|
|
@@ -42515,6 +43125,14 @@ Commands:
|
|
|
42515
43125
|
--confirm-redacted is needed for a recording that
|
|
42516
43126
|
used secrets, once someone has looked at its
|
|
42517
43127
|
redaction sheet.
|
|
43128
|
+
steps [<script-id>...] Give videos already in Mereon the steps of their
|
|
43129
|
+
recordings here, so Mereon Embed can match them to
|
|
43130
|
+
your app's screens. Every video recorded here, when
|
|
43131
|
+
none is named. Uploads send steps themselves.
|
|
43132
|
+
coverage [<script-id>...]
|
|
43133
|
+
List the screens the recordings here visit, the
|
|
43134
|
+
views seen on each, and what Mereon Embed will not be
|
|
43135
|
+
able to tell apart or label.
|
|
42518
43136
|
announce [<script-id>] --text-file <path> [--tell <who>] [--send]
|
|
42519
43137
|
Upload a video and announce it: work out what it
|
|
42520
43138
|
changes and who it tells, and print that. Sends
|