@ancha-labs/cli 0.4.28 → 0.4.29
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/lib/ancha.mjs +3051 -2494
- package/lib/assets/docs/cloud.md +4 -2
- package/lib/assets/docs/company.md +41 -0
- package/lib/assets/docs/run.md +3 -1
- package/lib/assets/docs/setup.md +1 -1
- package/lib/assets/docs/traces.md +5 -1
- package/lib/assets/harbor/companion.mjs +777 -762
- package/lib/mcp-entry.mjs +105 -90
- package/lib/worker.mjs +922 -871
- package/lib/world-server.mjs +772 -757
- package/package.json +1 -1
package/lib/mcp-entry.mjs
CHANGED
|
@@ -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(text13, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
1010
1010
|
if (!lineWidth || lineWidth < 0)
|
|
1011
|
-
return
|
|
1011
|
+
return text13;
|
|
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 (text13.length <= endStep)
|
|
1016
|
+
return text13;
|
|
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(text13, 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 = text13[i += 1]; ) {
|
|
1038
1038
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
1039
1039
|
escStart = i;
|
|
1040
|
-
switch (
|
|
1040
|
+
switch (text13[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(text13, 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 = text13[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 = text13[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 text13;
|
|
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 text13;
|
|
1095
1095
|
if (onFold)
|
|
1096
1096
|
onFold();
|
|
1097
|
-
let res =
|
|
1097
|
+
let res = text13.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] || text13.length;
|
|
1101
1101
|
if (fold === 0)
|
|
1102
1102
|
res = `
|
|
1103
|
-
${indent}${
|
|
1103
|
+
${indent}${text13.slice(0, end2)}`;
|
|
1104
1104
|
else {
|
|
1105
1105
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
1106
|
-
res += `${
|
|
1106
|
+
res += `${text13[fold]}\\`;
|
|
1107
1107
|
res += `
|
|
1108
|
-
${indent}${
|
|
1108
|
+
${indent}${text13.slice(fold + 1, end2)}`;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
return res;
|
|
1112
1112
|
}
|
|
1113
|
-
function consumeMoreIndentedLines(
|
|
1113
|
+
function consumeMoreIndentedLines(text13, i, indent) {
|
|
1114
1114
|
let end = i;
|
|
1115
1115
|
let start = i + 1;
|
|
1116
|
-
let ch =
|
|
1116
|
+
let ch = text13[start];
|
|
1117
1117
|
while (ch === " " || ch === " ") {
|
|
1118
1118
|
if (i < start + indent) {
|
|
1119
|
-
ch =
|
|
1119
|
+
ch = text13[++i];
|
|
1120
1120
|
} else {
|
|
1121
1121
|
do {
|
|
1122
|
-
ch =
|
|
1122
|
+
ch = text13[++i];
|
|
1123
1123
|
} while (ch && ch !== "\n");
|
|
1124
1124
|
end = i;
|
|
1125
1125
|
start = i + 1;
|
|
1126
|
-
ch =
|
|
1126
|
+
ch = text13[start];
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
1129
|
return end;
|
|
@@ -16776,8 +16776,8 @@ function ko_default() {
|
|
|
16776
16776
|
}
|
|
16777
16777
|
|
|
16778
16778
|
// node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
|
|
16779
|
-
var capitalizeFirstCharacter = (
|
|
16780
|
-
return
|
|
16779
|
+
var capitalizeFirstCharacter = (text13) => {
|
|
16780
|
+
return text13.charAt(0).toUpperCase() + text13.slice(1);
|
|
16781
16781
|
};
|
|
16782
16782
|
function getUnitTypeFromNumber(number6) {
|
|
16783
16783
|
const abs = Math.abs(number6);
|
|
@@ -36838,7 +36838,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36838
36838
|
}
|
|
36839
36839
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
36840
36840
|
if (!errors || errors.length === 0) return "No errors";
|
|
36841
|
-
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
36841
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text13, msg) => text13 + separator + msg);
|
|
36842
36842
|
}
|
|
36843
36843
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
36844
36844
|
const rules = this.RULES.all;
|
|
@@ -41910,11 +41910,11 @@ function normalizeReply(reply2, timeoutMs) {
|
|
|
41910
41910
|
error: error62
|
|
41911
41911
|
};
|
|
41912
41912
|
if (error62 instanceof SdkHttpError) {
|
|
41913
|
-
const
|
|
41913
|
+
const text13 = error62.data?.text;
|
|
41914
41914
|
return {
|
|
41915
41915
|
kind: "http-error",
|
|
41916
41916
|
status: error62.data.status,
|
|
41917
|
-
body: typeof
|
|
41917
|
+
body: typeof text13 === "string" ? text13 : void 0,
|
|
41918
41918
|
statusText: error62.data.statusText
|
|
41919
41919
|
};
|
|
41920
41920
|
}
|
|
@@ -43892,8 +43892,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
43892
43892
|
}
|
|
43893
43893
|
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
43894
43894
|
_unfollowedRedirect(url3, response) {
|
|
43895
|
-
const
|
|
43896
|
-
return
|
|
43895
|
+
const text13 = this._redirectPolicy === "follow" ? void 0 : unfollowedRedirect(url3, response);
|
|
43896
|
+
return text13 && `${text13} (redirectPolicy: 'same-origin')`;
|
|
43897
43897
|
}
|
|
43898
43898
|
async _commonHeaders() {
|
|
43899
43899
|
const headers = new Headers(this._requestInit?.headers || void 0);
|
|
@@ -43984,13 +43984,13 @@ var StreamableHTTPClientTransport = class {
|
|
|
43984
43984
|
if (response.status === 403) {
|
|
43985
43985
|
const { resourceMetadataUrl, scope: scope2, error: error62, errorDescription } = extractWWWAuthenticateParams(response);
|
|
43986
43986
|
if (error62 === "insufficient_scope") {
|
|
43987
|
-
const
|
|
43987
|
+
const text13 = await response.text?.().catch(() => null);
|
|
43988
43988
|
if (await this._stepUpAuthorize({
|
|
43989
43989
|
scope: scope2,
|
|
43990
43990
|
resourceMetadataUrl,
|
|
43991
43991
|
errorDescription,
|
|
43992
43992
|
statusText: response.statusText,
|
|
43993
|
-
text:
|
|
43993
|
+
text: text13
|
|
43994
43994
|
}, stepUpRetries) !== "AUTHORIZED") throw markAuthSeamEscape(new UnauthorizedError());
|
|
43995
43995
|
return this._startOrAuthSse(options, isAuthRetry, stepUpRetries + 1);
|
|
43996
43996
|
}
|
|
@@ -44222,7 +44222,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
44222
44222
|
}));
|
|
44223
44223
|
throw markAuthSeamEscape(new UnauthorizedError());
|
|
44224
44224
|
}
|
|
44225
|
-
const
|
|
44225
|
+
const text13 = await response.text?.().catch(() => null);
|
|
44226
44226
|
if (response.status === 403) {
|
|
44227
44227
|
const { resourceMetadataUrl, scope: scope2, error: error62, errorDescription } = extractWWWAuthenticateParams(response);
|
|
44228
44228
|
if (error62 === "insufficient_scope") {
|
|
@@ -44231,13 +44231,13 @@ var StreamableHTTPClientTransport = class {
|
|
|
44231
44231
|
resourceMetadataUrl,
|
|
44232
44232
|
errorDescription,
|
|
44233
44233
|
statusText: response.statusText,
|
|
44234
|
-
text:
|
|
44234
|
+
text: text13
|
|
44235
44235
|
}, stepUpRetries) !== "AUTHORIZED") throw markAuthSeamEscape(new UnauthorizedError());
|
|
44236
44236
|
return this._send(message4, options, isAuthRetry, stepUpRetries + 1);
|
|
44237
44237
|
}
|
|
44238
44238
|
}
|
|
44239
|
-
if (response.status === 400 && typeof
|
|
44240
|
-
const parsed2 = JSONRPCMessageSchema.parse(JSON.parse(
|
|
44239
|
+
if (response.status === 400 && typeof text13 === "string" && this._isModernEnvelopedRequest(message4)) try {
|
|
44240
|
+
const parsed2 = JSONRPCMessageSchema.parse(JSON.parse(text13));
|
|
44241
44241
|
const requests = (Array.isArray(message4) ? message4 : [message4]).filter((m) => isJSONRPCRequest(m));
|
|
44242
44242
|
if (isJSONRPCErrorResponse(parsed2) && requests.some((r) => r.id === parsed2.id)) {
|
|
44243
44243
|
this.onmessage?.(parsed2);
|
|
@@ -44245,11 +44245,11 @@ var StreamableHTTPClientTransport = class {
|
|
|
44245
44245
|
}
|
|
44246
44246
|
} catch {
|
|
44247
44247
|
}
|
|
44248
|
-
const reason = this._unfollowedRedirect(this._url, response) ??
|
|
44248
|
+
const reason = this._unfollowedRedirect(this._url, response) ?? text13;
|
|
44249
44249
|
throw new SdkHttpError(SdkErrorCode.ClientHttpNotImplemented, `Error POSTing to endpoint: ${reason}`, {
|
|
44250
44250
|
status: response.status,
|
|
44251
44251
|
statusText: response.statusText,
|
|
44252
|
-
text:
|
|
44252
|
+
text: text13
|
|
44253
44253
|
});
|
|
44254
44254
|
}
|
|
44255
44255
|
if (response.status === 202) {
|
|
@@ -52810,7 +52810,7 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
52810
52810
|
}
|
|
52811
52811
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
52812
52812
|
if (!errors || errors.length === 0) return "No errors";
|
|
52813
|
-
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
52813
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text13, msg) => text13 + separator + msg);
|
|
52814
52814
|
}
|
|
52815
52815
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
52816
52816
|
const rules = this.RULES.all;
|
|
@@ -57375,6 +57375,7 @@ var EXECUTION_SUPPORT = {
|
|
|
57375
57375
|
"--compare": sceneOnly,
|
|
57376
57376
|
"--min-pass-rate": sceneOnly,
|
|
57377
57377
|
"--strict": sceneOnly,
|
|
57378
|
+
"--allow-simulated": sceneOnly,
|
|
57378
57379
|
"--seed": sceneOnly,
|
|
57379
57380
|
"--out": thisComputer,
|
|
57380
57381
|
"--detach": sceneOnly,
|
|
@@ -57448,9 +57449,9 @@ var NUMBER = new RegExp(
|
|
|
57448
57449
|
String.raw`(?<![\p{L}\p{N}_.,]|\p{L}[-−–+/_])(?<open>\()?(?<sign>[-−–+])?(?:(?<before>${CURRENCY})[ \u00A0]?)?(?<minus>[-−–])?(?<inner>\()?` + String.raw`(?<digits>\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)(?!\p{N}|[eE][-+]?\d|,\d{3}|\.\d)` + String.raw`(?:[ \u00A0]?(?<after>${CODES.join("|")}|[${SYMBOLS}]))?(?<close>\))?`,
|
|
57449
57450
|
"gu"
|
|
57450
57451
|
);
|
|
57451
|
-
function readNumbers(
|
|
57452
|
+
function readNumbers(text13) {
|
|
57452
57453
|
const numbers2 = [];
|
|
57453
|
-
for (const match of
|
|
57454
|
+
for (const match of text13.normalize("NFKC").matchAll(NUMBER)) {
|
|
57454
57455
|
const { open: open2, sign, before, minus, inner, digits, after, close } = match.groups;
|
|
57455
57456
|
const parenthesized = (open2 !== void 0 || inner !== void 0) && close !== void 0;
|
|
57456
57457
|
const amount2 = before !== void 0 || after !== void 0 || /[,.]/.test(digits);
|
|
@@ -57466,7 +57467,7 @@ function readNumbers(text12) {
|
|
|
57466
57467
|
return numbers2;
|
|
57467
57468
|
}
|
|
57468
57469
|
var AnswerNumberSchema = external_exports.strictObject({
|
|
57469
|
-
value: external_exports.union([external_exports.number(), external_exports.string().refine((
|
|
57470
|
+
value: external_exports.union([external_exports.number(), external_exports.string().refine((text13) => readNumbers(text13).length === 1, 'a number, or one number written as text, e.g. "1,240.00" or "(300.00)"')]).describe('The number the answer must state: a number, or one number as text ("1,240.00") to keep its decimal places'),
|
|
57470
57471
|
tolerance: external_exports.number().nonnegative().optional().describe("How far the stated number may be from value; default: half the last decimal place of value (1200.00 \u2192 0.005, 1240.5 \u2192 0.05, 1200 \u2192 0.5)")
|
|
57471
57472
|
});
|
|
57472
57473
|
var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]);
|
|
@@ -57963,20 +57964,20 @@ var RANGE_HINT = "use <min>..<max> of simulated time, such as 3m..12m, or one du
|
|
|
57963
57964
|
var RATE_RE = /^(\d+(?:\.\d+)?)(?:\.\.(\d+(?:\.\d+)?))?\/(m|h|d)$/;
|
|
57964
57965
|
var RATE_HINT = "use <min>..<max>/<unit> or <n>/<unit> with unit m, h or d, such as 0..2/h";
|
|
57965
57966
|
var MAX_NOISE_PER_HOUR = 60;
|
|
57966
|
-
function parseDurationRange(
|
|
57967
|
-
const parts =
|
|
57968
|
-
if (parts.length > 2 || parts.some((part) => part === "")) throw new AnchaError("SCENE_INVALID", `invalid duration range "${
|
|
57967
|
+
function parseDurationRange(text13) {
|
|
57968
|
+
const parts = text13.split("..");
|
|
57969
|
+
if (parts.length > 2 || parts.some((part) => part === "")) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text13}"`, { hint: RANGE_HINT });
|
|
57969
57970
|
const minMs = parseDuration(parts[0]), maxMs = parseDuration(parts[1] ?? parts[0]);
|
|
57970
|
-
if (minMs < 0 || maxMs < minMs) throw new AnchaError("SCENE_INVALID", `invalid duration range "${
|
|
57971
|
+
if (minMs < 0 || maxMs < minMs) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text13}": need 0 <= min <= max`, { hint: RANGE_HINT });
|
|
57971
57972
|
return { minMs, maxMs };
|
|
57972
57973
|
}
|
|
57973
|
-
function parseRate(
|
|
57974
|
-
const match = RATE_RE.exec(
|
|
57975
|
-
if (!match) throw new AnchaError("SCENE_INVALID", `invalid rate "${
|
|
57974
|
+
function parseRate(text13) {
|
|
57975
|
+
const match = RATE_RE.exec(text13);
|
|
57976
|
+
if (!match) throw new AnchaError("SCENE_INVALID", `invalid rate "${text13}"`, { hint: RATE_HINT });
|
|
57976
57977
|
const perHour = { m: 60, h: 1, d: 1 / 24 }[match[3]];
|
|
57977
57978
|
const minPerHour = Number(match[1]) * perHour, maxPerHour = Number(match[2] ?? match[1]) * perHour;
|
|
57978
|
-
if (maxPerHour < minPerHour) throw new AnchaError("SCENE_INVALID", `invalid rate "${
|
|
57979
|
-
if (maxPerHour > MAX_NOISE_PER_HOUR) throw new AnchaError("SCENE_INVALID", `invalid rate "${
|
|
57979
|
+
if (maxPerHour < minPerHour) throw new AnchaError("SCENE_INVALID", `invalid rate "${text13}": min is above max`, { hint: RATE_HINT });
|
|
57980
|
+
if (maxPerHour > MAX_NOISE_PER_HOUR) throw new AnchaError("SCENE_INVALID", `invalid rate "${text13}": at most ${MAX_NOISE_PER_HOUR} per hour`, { hint: RATE_HINT });
|
|
57980
57981
|
return { minPerHour, maxPerHour };
|
|
57981
57982
|
}
|
|
57982
57983
|
function parsed(parse3, description2) {
|
|
@@ -59083,9 +59084,9 @@ var GMAIL_SCOPES = {
|
|
|
59083
59084
|
var scopeValues = Object.values(GMAIL_SCOPES);
|
|
59084
59085
|
var EMAIL = /^[^\s<>@",;:()[\]\\]+@[^\s<>@",;:()[\]\\]+\.[^\s<>@",;:()[\]\\]+$/;
|
|
59085
59086
|
function parseGmailAddress(value2) {
|
|
59086
|
-
const
|
|
59087
|
-
if (EMAIL.test(
|
|
59088
|
-
const match = /^(.*?)\s*<([^<>]+)>$/.exec(
|
|
59087
|
+
const text13 = value2.trim();
|
|
59088
|
+
if (EMAIL.test(text13)) return { name: "", email: text13 };
|
|
59089
|
+
const match = /^(.*?)\s*<([^<>]+)>$/.exec(text13);
|
|
59089
59090
|
if (!match || !EMAIL.test(match[2].trim())) return void 0;
|
|
59090
59091
|
let name3 = match[1].trim();
|
|
59091
59092
|
if (name3.startsWith('"') && name3.endsWith('"') && name3.length >= 2) name3 = name3.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
@@ -64605,16 +64606,16 @@ var FormulaSyntaxError = class extends Error {
|
|
|
64605
64606
|
};
|
|
64606
64607
|
var FormulaGap = class extends Error {
|
|
64607
64608
|
};
|
|
64608
|
-
function tokenize(
|
|
64609
|
+
function tokenize(text13) {
|
|
64609
64610
|
const out = [];
|
|
64610
64611
|
let i = 0;
|
|
64611
64612
|
const quoted = (close, what) => {
|
|
64612
64613
|
let j = i + 1, value2 = "";
|
|
64613
64614
|
for (; ; ) {
|
|
64614
|
-
if (j >=
|
|
64615
|
-
const c =
|
|
64616
|
-
if (c === "\\" && j + 1 <
|
|
64617
|
-
const e =
|
|
64615
|
+
if (j >= text13.length) throw new FormulaSyntaxError(`unterminated ${what}`);
|
|
64616
|
+
const c = text13[j];
|
|
64617
|
+
if (c === "\\" && j + 1 < text13.length) {
|
|
64618
|
+
const e = text13[j + 1];
|
|
64618
64619
|
value2 += e === "n" ? "\n" : e === "t" ? " " : e;
|
|
64619
64620
|
j += 2;
|
|
64620
64621
|
continue;
|
|
@@ -64626,8 +64627,8 @@ function tokenize(text12) {
|
|
|
64626
64627
|
i = j + 1;
|
|
64627
64628
|
return value2;
|
|
64628
64629
|
};
|
|
64629
|
-
while (i <
|
|
64630
|
-
const c =
|
|
64630
|
+
while (i < text13.length) {
|
|
64631
|
+
const c = text13[i], rest = text13.slice(i);
|
|
64631
64632
|
if (/\s/.test(c)) {
|
|
64632
64633
|
i++;
|
|
64633
64634
|
continue;
|
|
@@ -64668,8 +64669,8 @@ function tokenize(text12) {
|
|
|
64668
64669
|
out.push({ kind: "end" });
|
|
64669
64670
|
return out;
|
|
64670
64671
|
}
|
|
64671
|
-
function parseFormula(
|
|
64672
|
-
const tokens = tokenize(
|
|
64672
|
+
function parseFormula(text13) {
|
|
64673
|
+
const tokens = tokenize(text13);
|
|
64673
64674
|
let at = 0;
|
|
64674
64675
|
const isOp = (value2) => {
|
|
64675
64676
|
const token = tokens[at];
|
|
@@ -64787,8 +64788,8 @@ function num(value2) {
|
|
|
64787
64788
|
if (typeof value2 === "number") return value2;
|
|
64788
64789
|
if (typeof value2 === "boolean") return value2 ? 1 : 0;
|
|
64789
64790
|
if (typeof value2 === "string") {
|
|
64790
|
-
const
|
|
64791
|
-
return !
|
|
64791
|
+
const text13 = value2.trim();
|
|
64792
|
+
return !text13 ? 0 : NUMERIC.test(text13) ? Number(text13) : NaN;
|
|
64792
64793
|
}
|
|
64793
64794
|
return NaN;
|
|
64794
64795
|
}
|
|
@@ -64808,8 +64809,8 @@ function validDay(y, m, d) {
|
|
|
64808
64809
|
const ms = utc(y, m, d), date9 = new Date(ms);
|
|
64809
64810
|
return date9.getUTCFullYear() === y && date9.getUTCMonth() === m && date9.getUTCDate() === d ? ms : null;
|
|
64810
64811
|
}
|
|
64811
|
-
function parseFormulaDate(
|
|
64812
|
-
const value2 =
|
|
64812
|
+
function parseFormulaDate(text13) {
|
|
64813
|
+
const value2 = text13.trim();
|
|
64813
64814
|
let match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value2);
|
|
64814
64815
|
if (match) {
|
|
64815
64816
|
const ms = validDay(+match[1], +match[2] - 1, +match[3]);
|
|
@@ -64886,8 +64887,8 @@ var UNITS = {
|
|
|
64886
64887
|
};
|
|
64887
64888
|
var FIXED = { milliseconds: 1, seconds: 1e3, minutes: 6e4, hours: 36e5, days: 864e5, weeks: 6048e5 };
|
|
64888
64889
|
var unitOf = (value2) => {
|
|
64889
|
-
const
|
|
64890
|
-
return UNITS[
|
|
64890
|
+
const text13 = formulaText(value2).trim();
|
|
64891
|
+
return UNITS[text13] ?? UNITS[text13.toLowerCase()] ?? null;
|
|
64891
64892
|
};
|
|
64892
64893
|
function addMonths(ms, months) {
|
|
64893
64894
|
const date9 = new Date(ms), day7 = date9.getUTCDate();
|
|
@@ -64995,7 +64996,7 @@ function formatFormulaDate(ms, format) {
|
|
|
64995
64996
|
};
|
|
64996
64997
|
return format.replace(FORMAT_TOKENS, (part, literal2) => literal2 ?? token(part));
|
|
64997
64998
|
}
|
|
64998
|
-
function parseWithFormat(
|
|
64999
|
+
function parseWithFormat(text13, format) {
|
|
64999
65000
|
const parts = [];
|
|
65000
65001
|
let pattern = "";
|
|
65001
65002
|
let last = 0;
|
|
@@ -65013,7 +65014,7 @@ function parseWithFormat(text12, format) {
|
|
|
65013
65014
|
parts.push(token);
|
|
65014
65015
|
}
|
|
65015
65016
|
pattern += format.slice(last).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
65016
|
-
const match = new RegExp(`^${pattern}$`).exec(
|
|
65017
|
+
const match = new RegExp(`^${pattern}$`).exec(text13.trim());
|
|
65017
65018
|
if (!match) return null;
|
|
65018
65019
|
let y = 1970, mo = 0, d = 1, h = 0, mi = 0, s = 0, pm = null;
|
|
65019
65020
|
parts.forEach((token, i) => {
|
|
@@ -65077,16 +65078,16 @@ var FUNCTIONS = {
|
|
|
65077
65078
|
ISERROR: { min: 1, max: 1, run: (args) => isFormulaError(args[0]) || typeof args[0] === "number" && Number.isNaN(args[0]) },
|
|
65078
65079
|
// text
|
|
65079
65080
|
CONCATENATE: { min: 1, max: Infinity, run: (args) => args.map(formulaText).join("") },
|
|
65080
|
-
LEN: text1((
|
|
65081
|
-
LOWER: text1((
|
|
65082
|
-
UPPER: text1((
|
|
65083
|
-
TRIM: text1((
|
|
65081
|
+
LEN: text1((text13) => [...text13].length),
|
|
65082
|
+
LOWER: text1((text13) => text13.toLowerCase()),
|
|
65083
|
+
UPPER: text1((text13) => text13.toUpperCase()),
|
|
65084
|
+
TRIM: text1((text13) => text13.trim()),
|
|
65084
65085
|
T: { min: 1, max: 1, run: (args) => typeof single(args[0]) === "string" ? single(args[0]) : "" },
|
|
65085
|
-
ENCODE_URL_COMPONENT: text1((
|
|
65086
|
+
ENCODE_URL_COMPONENT: text1((text13) => encodeURIComponent(text13)),
|
|
65086
65087
|
LEFT: { min: 2, max: 2, run: (args) => formulaText(args[0]).slice(0, Math.max(0, num(args[1]))) },
|
|
65087
65088
|
RIGHT: { min: 2, max: 2, run: (args) => {
|
|
65088
|
-
const
|
|
65089
|
-
return n ?
|
|
65089
|
+
const text13 = formulaText(args[0]), n = Math.max(0, num(args[1]));
|
|
65090
|
+
return n ? text13.slice(-n) : "";
|
|
65090
65091
|
} },
|
|
65091
65092
|
MID: { min: 3, max: 3, run: (args) => {
|
|
65092
65093
|
const start = Math.max(1, num(args[1]));
|
|
@@ -65101,20 +65102,20 @@ var FUNCTIONS = {
|
|
|
65101
65102
|
return at < 0 ? null : at + 1;
|
|
65102
65103
|
} },
|
|
65103
65104
|
SUBSTITUTE: { min: 3, max: 4, run: (args) => {
|
|
65104
|
-
const
|
|
65105
|
-
if (!old) return
|
|
65106
|
-
if (args[3] === void 0) return
|
|
65105
|
+
const text13 = formulaText(args[0]), old = formulaText(args[1]), replacement = formulaText(args[2]);
|
|
65106
|
+
if (!old) return text13;
|
|
65107
|
+
if (args[3] === void 0) return text13.split(old).join(replacement);
|
|
65107
65108
|
const index = num(args[3]);
|
|
65108
65109
|
let at = -1;
|
|
65109
65110
|
for (let i = 0; i < index; i++) {
|
|
65110
|
-
at =
|
|
65111
|
-
if (at < 0) return
|
|
65111
|
+
at = text13.indexOf(old, at + 1);
|
|
65112
|
+
if (at < 0) return text13;
|
|
65112
65113
|
}
|
|
65113
|
-
return
|
|
65114
|
+
return text13.slice(0, at) + replacement + text13.slice(at + old.length);
|
|
65114
65115
|
} },
|
|
65115
65116
|
REPLACE: { min: 4, max: 4, run: (args) => {
|
|
65116
|
-
const
|
|
65117
|
-
return
|
|
65117
|
+
const text13 = formulaText(args[0]), start = Math.max(1, num(args[1])) - 1;
|
|
65118
|
+
return text13.slice(0, start) + formulaText(args[3]) + text13.slice(start + Math.max(0, num(args[2])));
|
|
65118
65119
|
} },
|
|
65119
65120
|
REPT: { min: 2, max: 2, run: (args) => formulaText(args[0]).repeat(Math.max(0, Math.floor(num(args[1])) || 0)) },
|
|
65120
65121
|
REGEX_MATCH: { min: 2, max: 2, run: (args) => {
|
|
@@ -65216,9 +65217,9 @@ var FUNCTIONS = {
|
|
|
65216
65217
|
} },
|
|
65217
65218
|
DATETIME_PARSE: { min: 1, max: 3, run: (args) => {
|
|
65218
65219
|
if (args[2] !== void 0) throw new FormulaGap("DATETIME_PARSE() with a locale");
|
|
65219
|
-
const
|
|
65220
|
-
if (!
|
|
65221
|
-
return (args[1] === void 0 ? parseFormulaDate(
|
|
65220
|
+
const text13 = formulaText(args[0]);
|
|
65221
|
+
if (!text13) return null;
|
|
65222
|
+
return (args[1] === void 0 ? parseFormulaDate(text13) : parseWithFormat(text13, formulaText(args[1]))) ?? err();
|
|
65222
65223
|
} },
|
|
65223
65224
|
DATESTR: { min: 1, max: 1, run: (args) => {
|
|
65224
65225
|
const date9 = dateArg(args[0]);
|
|
@@ -65397,9 +65398,9 @@ var AirtableSeedSchema = external_exports.strictObject({
|
|
|
65397
65398
|
if (new Set(entry2.fields.map((item2) => lower(item2.name))).size !== entry2.fields.length) issue2([...at, "fields"], "duplicate field name");
|
|
65398
65399
|
if (!PRIMARY_TYPES.has(entry2.fields[0].type)) issue2([...at, "fields", 0, "type"], `a ${entry2.fields[0].type} field cannot be the primary field`);
|
|
65399
65400
|
const has = (fieldName) => fields3.has(fieldName);
|
|
65400
|
-
const formula = (
|
|
65401
|
+
const formula = (text13, path2, vars = [], hasField = has) => {
|
|
65401
65402
|
try {
|
|
65402
|
-
checkFormula(parseFormula(
|
|
65403
|
+
checkFormula(parseFormula(text13), hasField, vars);
|
|
65403
65404
|
} catch (error62) {
|
|
65404
65405
|
if (error62 instanceof FormulaSyntaxError || error62 instanceof FormulaGap) issue2(path2, `invalid formula: ${error62.message}`);
|
|
65405
65406
|
else throw error62;
|
|
@@ -67430,6 +67431,20 @@ var WorldFileSchema = external_exports.strictObject({ version: external_exports.
|
|
|
67430
67431
|
var BODY_KEYS = Object.keys(body2);
|
|
67431
67432
|
var FILE_KEYS = ["version", "id", ...BODY_KEYS];
|
|
67432
67433
|
|
|
67434
|
+
// packages/core/src/company/profile.ts
|
|
67435
|
+
var text12 = (max) => external_exports.string().min(1).max(max).regex(/^[^\u0000-\u001f\u007f-\u009f]+$/u);
|
|
67436
|
+
var countries = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
|
|
67437
|
+
var CompanyProfileSchema = external_exports.strictObject({
|
|
67438
|
+
schemaVersion: external_exports.literal(1),
|
|
67439
|
+
name: text12(100),
|
|
67440
|
+
businessModel: external_exports.enum(["goods", "services", "mixed"]).nullable(),
|
|
67441
|
+
scale: external_exports.enum(["small", "medium", "large"]).nullable(),
|
|
67442
|
+
customerKinds: external_exports.array(text12(60)).max(8),
|
|
67443
|
+
vendorKinds: external_exports.array(text12(60)).max(8),
|
|
67444
|
+
offerings: external_exports.array(external_exports.strictObject({ name: text12(100), kind: external_exports.enum(["goods", "service"]) })).max(8),
|
|
67445
|
+
country: external_exports.enum([...countries]).nullable()
|
|
67446
|
+
});
|
|
67447
|
+
|
|
67433
67448
|
// packages/core/src/datasets/netsuite-pe/generate.ts
|
|
67434
67449
|
var ACCOUNTS = [
|
|
67435
67450
|
{ id: 1, number: "1000", name: "Operating Checking", type: "Bank" },
|