ente-cli 0.4.130 → 0.4.132
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 +10 -4
- package/dist/SKILL.md +13 -29
- package/dist/cli.mjs +643 -673
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -86,8 +86,8 @@ var require_lib = __commonJS({
|
|
|
86
86
|
var base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
87
87
|
var uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
88
88
|
var iso8601RegExp = /^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;
|
|
89
|
-
function pushError({ errors, p } = {},
|
|
90
|
-
errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${
|
|
89
|
+
function pushError({ errors, p } = {}, message4) {
|
|
90
|
+
errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message4}`);
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
function makeSetter(target3, key) {
|
|
@@ -3265,7 +3265,7 @@ var init_query_impl = __esm({
|
|
|
3265
3265
|
version: version4
|
|
3266
3266
|
});
|
|
3267
3267
|
return {
|
|
3268
|
-
page: page3.map((
|
|
3268
|
+
page: page3.map((json3) => jsonToConvex2(json3)),
|
|
3269
3269
|
isDone,
|
|
3270
3270
|
continueCursor,
|
|
3271
3271
|
splitCursor,
|
|
@@ -5242,8 +5242,8 @@ var IS_DEBUG = process.env.DEBUG_CLI === `1`;
|
|
|
5242
5242
|
|
|
5243
5243
|
// node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/errors.mjs
|
|
5244
5244
|
var UsageError = class extends Error {
|
|
5245
|
-
constructor(
|
|
5246
|
-
super(
|
|
5245
|
+
constructor(message4) {
|
|
5246
|
+
super(message4);
|
|
5247
5247
|
this.clipanion = { type: `usage` };
|
|
5248
5248
|
this.name = `UsageError`;
|
|
5249
5249
|
}
|
|
@@ -5301,9 +5301,9 @@ ${whileRunning(input2)}`;
|
|
|
5301
5301
|
var whileRunning = (input2) => `While running ${input2.filter((token) => {
|
|
5302
5302
|
return token !== SpecialToken.EndOfInput && token !== SpecialToken.EndOfPartialInput;
|
|
5303
5303
|
}).map((token) => {
|
|
5304
|
-
const
|
|
5305
|
-
if (token.match(/\s/) || token.length === 0 ||
|
|
5306
|
-
return
|
|
5304
|
+
const json3 = JSON.stringify(token);
|
|
5305
|
+
if (token.match(/\s/) || token.length === 0 || json3 !== `"${token}"`) {
|
|
5306
|
+
return json3;
|
|
5307
5307
|
} else {
|
|
5308
5308
|
return token;
|
|
5309
5309
|
}
|
|
@@ -5323,8 +5323,8 @@ function rerouteArguments(a, b) {
|
|
|
5323
5323
|
return [a, b];
|
|
5324
5324
|
}
|
|
5325
5325
|
}
|
|
5326
|
-
function cleanValidationError(
|
|
5327
|
-
const match =
|
|
5326
|
+
function cleanValidationError(message4, { mergeName = false } = {}) {
|
|
5327
|
+
const match = message4.match(/^([^:]+): (.*)$/m);
|
|
5328
5328
|
if (!match)
|
|
5329
5329
|
return `validation failed`;
|
|
5330
5330
|
let [, path11, line] = match;
|
|
@@ -5333,11 +5333,11 @@ function cleanValidationError(message3, { mergeName = false } = {}) {
|
|
|
5333
5333
|
line = path11 !== `.` || !mergeName ? `${path11.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
5334
5334
|
return line;
|
|
5335
5335
|
}
|
|
5336
|
-
function formatError(
|
|
5336
|
+
function formatError(message4, errors) {
|
|
5337
5337
|
if (errors.length === 1) {
|
|
5338
|
-
return new UsageError(`${
|
|
5338
|
+
return new UsageError(`${message4}${cleanValidationError(errors[0], { mergeName: true })}`);
|
|
5339
5339
|
} else {
|
|
5340
|
-
return new UsageError(`${
|
|
5340
|
+
return new UsageError(`${message4}:
|
|
5341
5341
|
${errors.map((error62) => `
|
|
5342
5342
|
- ${cleanValidationError(error62)}`).join(``)}`);
|
|
5343
5343
|
}
|
|
@@ -9266,8 +9266,8 @@ function prefixIssues(path11, issues) {
|
|
|
9266
9266
|
return iss;
|
|
9267
9267
|
});
|
|
9268
9268
|
}
|
|
9269
|
-
function unwrapMessage(
|
|
9270
|
-
return typeof
|
|
9269
|
+
function unwrapMessage(message4) {
|
|
9270
|
+
return typeof message4 === "string" ? message4 : message4?.message;
|
|
9271
9271
|
}
|
|
9272
9272
|
function sizeCaps(defChecks) {
|
|
9273
9273
|
const caps = [];
|
|
@@ -9297,7 +9297,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
9297
9297
|
iss.schema = iss.inst;
|
|
9298
9298
|
}
|
|
9299
9299
|
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
9300
|
-
const
|
|
9300
|
+
const message4 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
9301
9301
|
const full = {};
|
|
9302
9302
|
for (const k of Object.keys(iss)) {
|
|
9303
9303
|
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
|
|
@@ -9305,7 +9305,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
9305
9305
|
full[k] = iss[k];
|
|
9306
9306
|
}
|
|
9307
9307
|
full.path ?? (full.path = []);
|
|
9308
|
-
full.message =
|
|
9308
|
+
full.message = message4;
|
|
9309
9309
|
if (ctx?.reportInput) {
|
|
9310
9310
|
full.input = iss.input;
|
|
9311
9311
|
}
|
|
@@ -21044,8 +21044,8 @@ var globalRegistry = globalThis.__zod_globalRegistry;
|
|
|
21044
21044
|
var INVALID = Symbol.for("zod.compile.invalid");
|
|
21045
21045
|
var FALLBACK_FLAG = Symbol.for("zod.compile.fallback");
|
|
21046
21046
|
var ZodCompileAsyncError = class extends Error {
|
|
21047
|
-
constructor(
|
|
21048
|
-
super(
|
|
21047
|
+
constructor(message4 = "z.compile does not support async refinements, transforms, or checks") {
|
|
21048
|
+
super(message4);
|
|
21049
21049
|
this.name = "ZodCompileAsyncError";
|
|
21050
21050
|
}
|
|
21051
21051
|
};
|
|
@@ -23745,13 +23745,13 @@ function initializeContext(params) {
|
|
|
23745
23745
|
external: params?.external ?? void 0
|
|
23746
23746
|
};
|
|
23747
23747
|
}
|
|
23748
|
-
function handleUnrepresentable(schema, ctx,
|
|
23749
|
-
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message:
|
|
23748
|
+
function handleUnrepresentable(schema, ctx, json3, params, message4) {
|
|
23749
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message4 }) : ctx.unrepresentable;
|
|
23750
23750
|
if (result === "any")
|
|
23751
23751
|
return false;
|
|
23752
23752
|
if (result === void 0 || result === "throw")
|
|
23753
|
-
throw new Error(
|
|
23754
|
-
Object.assign(
|
|
23753
|
+
throw new Error(message4);
|
|
23754
|
+
Object.assign(json3, result);
|
|
23755
23755
|
return true;
|
|
23756
23756
|
}
|
|
23757
23757
|
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
@@ -23987,12 +23987,12 @@ function foldObjects(members2) {
|
|
|
23987
23987
|
}
|
|
23988
23988
|
return folded;
|
|
23989
23989
|
}
|
|
23990
|
-
function foldIntersection(
|
|
23991
|
-
const allOf =
|
|
23990
|
+
function foldIntersection(json3) {
|
|
23991
|
+
const allOf = json3.allOf;
|
|
23992
23992
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
23993
23993
|
return;
|
|
23994
23994
|
for (const key of FOLDABLE_KEYS)
|
|
23995
|
-
if (key in
|
|
23995
|
+
if (key in json3)
|
|
23996
23996
|
return;
|
|
23997
23997
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
23998
23998
|
let folded = null;
|
|
@@ -24011,8 +24011,8 @@ function foldIntersection(json4) {
|
|
|
24011
24011
|
}
|
|
24012
24012
|
if (!folded)
|
|
24013
24013
|
return;
|
|
24014
|
-
delete
|
|
24015
|
-
assignProps(
|
|
24014
|
+
delete json3.allOf;
|
|
24015
|
+
assignProps(json3, folded);
|
|
24016
24016
|
}
|
|
24017
24017
|
function finalize(ctx, schema) {
|
|
24018
24018
|
const root = ctx.seen.get(schema);
|
|
@@ -24094,20 +24094,20 @@ function finalize(ctx, schema) {
|
|
|
24094
24094
|
if (ctx.intersections.length) {
|
|
24095
24095
|
const carriers = /* @__PURE__ */ new Map();
|
|
24096
24096
|
for (const seen of ctx.seen.values()) {
|
|
24097
|
-
for (const
|
|
24098
|
-
const allOf =
|
|
24097
|
+
for (const json3 of [seen.schema, seen.def]) {
|
|
24098
|
+
const allOf = json3?.allOf;
|
|
24099
24099
|
if (!Array.isArray(allOf))
|
|
24100
24100
|
continue;
|
|
24101
24101
|
const existing = carriers.get(allOf);
|
|
24102
24102
|
if (existing)
|
|
24103
|
-
existing.push(
|
|
24103
|
+
existing.push(json3);
|
|
24104
24104
|
else
|
|
24105
|
-
carriers.set(allOf, [
|
|
24105
|
+
carriers.set(allOf, [json3]);
|
|
24106
24106
|
}
|
|
24107
24107
|
}
|
|
24108
24108
|
for (const allOf of ctx.intersections) {
|
|
24109
|
-
for (const
|
|
24110
|
-
foldIntersection(
|
|
24109
|
+
for (const json3 of carriers.get(allOf) ?? [])
|
|
24110
|
+
foldIntersection(json3);
|
|
24111
24111
|
}
|
|
24112
24112
|
}
|
|
24113
24113
|
}
|
|
@@ -24342,29 +24342,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
|
|
|
24342
24342
|
]);
|
|
24343
24343
|
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
24344
24344
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
24345
|
-
const
|
|
24346
|
-
|
|
24345
|
+
const json3 = _json;
|
|
24346
|
+
json3.type = "string";
|
|
24347
24347
|
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
24348
24348
|
if (typeof minimum === "number")
|
|
24349
|
-
|
|
24349
|
+
json3.minLength = minimum;
|
|
24350
24350
|
if (typeof maximum === "number")
|
|
24351
|
-
|
|
24351
|
+
json3.maxLength = maximum;
|
|
24352
24352
|
if (format) {
|
|
24353
|
-
|
|
24354
|
-
if (
|
|
24355
|
-
delete
|
|
24353
|
+
json3.format = formatMap[format] ?? format;
|
|
24354
|
+
if (json3.format === "")
|
|
24355
|
+
delete json3.format;
|
|
24356
24356
|
if (format === "time" || laxFormat) {
|
|
24357
|
-
delete
|
|
24357
|
+
delete json3.format;
|
|
24358
24358
|
}
|
|
24359
24359
|
}
|
|
24360
24360
|
if (contentEncoding)
|
|
24361
|
-
|
|
24361
|
+
json3.contentEncoding = contentEncoding;
|
|
24362
24362
|
if (patterns && patterns.size > 0) {
|
|
24363
24363
|
const patternList = [...patterns].map(exactPattern);
|
|
24364
24364
|
if (patternList.length === 1)
|
|
24365
|
-
|
|
24365
|
+
json3.pattern = patternList[0].source;
|
|
24366
24366
|
else if (patternList.length > 1) {
|
|
24367
|
-
|
|
24367
|
+
json3.allOf = [
|
|
24368
24368
|
...patternList.map((regex) => ({
|
|
24369
24369
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
24370
24370
|
pattern: regex.source
|
|
@@ -24374,31 +24374,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
24374
24374
|
}
|
|
24375
24375
|
};
|
|
24376
24376
|
var numberProcessor = (schema, ctx, _json, params) => {
|
|
24377
|
-
const
|
|
24377
|
+
const json3 = _json;
|
|
24378
24378
|
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
24379
|
-
|
|
24379
|
+
json3.type = isInt ? "integer" : "number";
|
|
24380
24380
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
24381
24381
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
24382
24382
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
24383
24383
|
if (exMin) {
|
|
24384
24384
|
if (legacy) {
|
|
24385
|
-
|
|
24386
|
-
|
|
24385
|
+
json3.minimum = exclusiveMinimum;
|
|
24386
|
+
json3.exclusiveMinimum = true;
|
|
24387
24387
|
} else {
|
|
24388
|
-
|
|
24388
|
+
json3.exclusiveMinimum = exclusiveMinimum;
|
|
24389
24389
|
}
|
|
24390
24390
|
} else if (typeof minimum === "number") {
|
|
24391
|
-
|
|
24391
|
+
json3.minimum = minimum;
|
|
24392
24392
|
}
|
|
24393
24393
|
if (exMax) {
|
|
24394
24394
|
if (legacy) {
|
|
24395
|
-
|
|
24396
|
-
|
|
24395
|
+
json3.maximum = exclusiveMaximum;
|
|
24396
|
+
json3.exclusiveMaximum = true;
|
|
24397
24397
|
} else {
|
|
24398
|
-
|
|
24398
|
+
json3.exclusiveMaximum = exclusiveMaximum;
|
|
24399
24399
|
}
|
|
24400
24400
|
} else if (typeof maximum === "number") {
|
|
24401
|
-
|
|
24401
|
+
json3.maximum = maximum;
|
|
24402
24402
|
}
|
|
24403
24403
|
if (multipleOf) {
|
|
24404
24404
|
const divisors = /* @__PURE__ */ new Set();
|
|
@@ -24406,75 +24406,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
|
|
|
24406
24406
|
if (Number.isFinite(divisor) && divisor !== 0)
|
|
24407
24407
|
divisors.add(Math.abs(divisor));
|
|
24408
24408
|
else
|
|
24409
|
-
handleUnrepresentable(schema, ctx,
|
|
24409
|
+
handleUnrepresentable(schema, ctx, json3, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
24410
24410
|
}
|
|
24411
24411
|
const [first, ...rest] = divisors;
|
|
24412
24412
|
if (first !== void 0)
|
|
24413
|
-
|
|
24413
|
+
json3.multipleOf = first;
|
|
24414
24414
|
if (rest.length)
|
|
24415
|
-
|
|
24415
|
+
json3.allOf = [...json3.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
24416
24416
|
}
|
|
24417
24417
|
};
|
|
24418
|
-
var booleanProcessor = (_schema2, _ctx,
|
|
24419
|
-
|
|
24418
|
+
var booleanProcessor = (_schema2, _ctx, json3, _params) => {
|
|
24419
|
+
json3.type = "boolean";
|
|
24420
24420
|
};
|
|
24421
|
-
var bigintProcessor = (schema, ctx,
|
|
24422
|
-
handleUnrepresentable(schema, ctx,
|
|
24421
|
+
var bigintProcessor = (schema, ctx, json3, params) => {
|
|
24422
|
+
handleUnrepresentable(schema, ctx, json3, params, "BigInt cannot be represented in JSON Schema");
|
|
24423
24423
|
};
|
|
24424
|
-
var symbolProcessor = (schema, ctx,
|
|
24425
|
-
handleUnrepresentable(schema, ctx,
|
|
24424
|
+
var symbolProcessor = (schema, ctx, json3, params) => {
|
|
24425
|
+
handleUnrepresentable(schema, ctx, json3, params, "Symbols cannot be represented in JSON Schema");
|
|
24426
24426
|
};
|
|
24427
|
-
var nullProcessor = (_schema2, ctx,
|
|
24427
|
+
var nullProcessor = (_schema2, ctx, json3, _params) => {
|
|
24428
24428
|
if (ctx.target === "openapi-3.0") {
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24429
|
+
json3.type = "string";
|
|
24430
|
+
json3.nullable = true;
|
|
24431
|
+
json3.enum = [null];
|
|
24432
24432
|
} else {
|
|
24433
|
-
|
|
24433
|
+
json3.type = "null";
|
|
24434
24434
|
}
|
|
24435
24435
|
};
|
|
24436
|
-
var undefinedProcessor = (schema, ctx,
|
|
24437
|
-
handleUnrepresentable(schema, ctx,
|
|
24436
|
+
var undefinedProcessor = (schema, ctx, json3, params) => {
|
|
24437
|
+
handleUnrepresentable(schema, ctx, json3, params, "Undefined cannot be represented in JSON Schema");
|
|
24438
24438
|
};
|
|
24439
|
-
var voidProcessor = (schema, ctx,
|
|
24440
|
-
handleUnrepresentable(schema, ctx,
|
|
24439
|
+
var voidProcessor = (schema, ctx, json3, params) => {
|
|
24440
|
+
handleUnrepresentable(schema, ctx, json3, params, "Void cannot be represented in JSON Schema");
|
|
24441
24441
|
};
|
|
24442
|
-
var neverProcessor = (_schema2, _ctx,
|
|
24443
|
-
|
|
24442
|
+
var neverProcessor = (_schema2, _ctx, json3, _params) => {
|
|
24443
|
+
json3.not = {};
|
|
24444
24444
|
};
|
|
24445
24445
|
var anyProcessor = (_schema2, _ctx, _json, _params) => {
|
|
24446
24446
|
};
|
|
24447
24447
|
var unknownProcessor = (_schema2, _ctx, _json, _params) => {
|
|
24448
24448
|
};
|
|
24449
|
-
var dateProcessor = (schema, ctx,
|
|
24450
|
-
handleUnrepresentable(schema, ctx,
|
|
24449
|
+
var dateProcessor = (schema, ctx, json3, params) => {
|
|
24450
|
+
handleUnrepresentable(schema, ctx, json3, params, "Date cannot be represented in JSON Schema");
|
|
24451
24451
|
};
|
|
24452
|
-
var enumProcessor = (schema, _ctx,
|
|
24452
|
+
var enumProcessor = (schema, _ctx, json3, _params) => {
|
|
24453
24453
|
const def = schema._zod.def;
|
|
24454
24454
|
const values = getEnumValues(def.entries);
|
|
24455
24455
|
if (values.length === 0) {
|
|
24456
|
-
|
|
24456
|
+
json3.not = {};
|
|
24457
24457
|
return;
|
|
24458
24458
|
}
|
|
24459
24459
|
if (values.every((v3) => typeof v3 === "number"))
|
|
24460
|
-
|
|
24460
|
+
json3.type = "number";
|
|
24461
24461
|
if (values.every((v3) => typeof v3 === "string"))
|
|
24462
|
-
|
|
24463
|
-
|
|
24462
|
+
json3.type = "string";
|
|
24463
|
+
json3.enum = values;
|
|
24464
24464
|
};
|
|
24465
|
-
var literalProcessor = (schema, ctx,
|
|
24465
|
+
var literalProcessor = (schema, ctx, json3, params) => {
|
|
24466
24466
|
const def = schema._zod.def;
|
|
24467
24467
|
if (def.values.length === 0) {
|
|
24468
|
-
|
|
24468
|
+
json3.not = {};
|
|
24469
24469
|
return;
|
|
24470
24470
|
}
|
|
24471
24471
|
const vals = [];
|
|
24472
24472
|
for (const val of def.values) {
|
|
24473
24473
|
if (val === void 0) {
|
|
24474
|
-
if (handleUnrepresentable(schema, ctx,
|
|
24474
|
+
if (handleUnrepresentable(schema, ctx, json3, params, "Literal `undefined` cannot be represented in JSON Schema"))
|
|
24475
24475
|
return;
|
|
24476
24476
|
} else if (typeof val === "bigint") {
|
|
24477
|
-
if (handleUnrepresentable(schema, ctx,
|
|
24477
|
+
if (handleUnrepresentable(schema, ctx, json3, params, "BigInt literals cannot be represented in JSON Schema"))
|
|
24478
24478
|
return;
|
|
24479
24479
|
vals.push(Number(val));
|
|
24480
24480
|
} else {
|
|
@@ -24484,37 +24484,37 @@ var literalProcessor = (schema, ctx, json4, params) => {
|
|
|
24484
24484
|
if (vals.length === 0) {
|
|
24485
24485
|
} else if (vals.length === 1) {
|
|
24486
24486
|
const val = vals[0];
|
|
24487
|
-
|
|
24487
|
+
json3.type = val === null ? "null" : typeof val;
|
|
24488
24488
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
24489
|
-
|
|
24489
|
+
json3.enum = [val];
|
|
24490
24490
|
} else {
|
|
24491
|
-
|
|
24491
|
+
json3.const = val;
|
|
24492
24492
|
}
|
|
24493
24493
|
} else {
|
|
24494
24494
|
if (vals.every((v3) => typeof v3 === "number"))
|
|
24495
|
-
|
|
24495
|
+
json3.type = "number";
|
|
24496
24496
|
if (vals.every((v3) => typeof v3 === "string"))
|
|
24497
|
-
|
|
24497
|
+
json3.type = "string";
|
|
24498
24498
|
if (vals.every((v3) => typeof v3 === "boolean"))
|
|
24499
|
-
|
|
24499
|
+
json3.type = "boolean";
|
|
24500
24500
|
if (vals.every((v3) => v3 === null))
|
|
24501
|
-
|
|
24502
|
-
|
|
24501
|
+
json3.type = "null";
|
|
24502
|
+
json3.enum = vals;
|
|
24503
24503
|
}
|
|
24504
24504
|
};
|
|
24505
|
-
var nanProcessor = (schema, ctx,
|
|
24506
|
-
handleUnrepresentable(schema, ctx,
|
|
24505
|
+
var nanProcessor = (schema, ctx, json3, params) => {
|
|
24506
|
+
handleUnrepresentable(schema, ctx, json3, params, "NaN cannot be represented in JSON Schema");
|
|
24507
24507
|
};
|
|
24508
|
-
var templateLiteralProcessor = (schema, _ctx,
|
|
24509
|
-
const _json =
|
|
24508
|
+
var templateLiteralProcessor = (schema, _ctx, json3, _params) => {
|
|
24509
|
+
const _json = json3;
|
|
24510
24510
|
const pattern = schema._zod.pattern;
|
|
24511
24511
|
if (!pattern)
|
|
24512
24512
|
throw new Error("Pattern not found in template literal");
|
|
24513
24513
|
_json.type = "string";
|
|
24514
24514
|
_json.pattern = pattern.source;
|
|
24515
24515
|
};
|
|
24516
|
-
var fileProcessor = (schema, _ctx,
|
|
24517
|
-
const _json =
|
|
24516
|
+
var fileProcessor = (schema, _ctx, json3, _params) => {
|
|
24517
|
+
const _json = json3;
|
|
24518
24518
|
_json.type = "string";
|
|
24519
24519
|
_json.format = "binary";
|
|
24520
24520
|
_json.contentEncoding = "binary";
|
|
@@ -24532,34 +24532,34 @@ var fileProcessor = (schema, _ctx, json4, _params) => {
|
|
|
24532
24532
|
else
|
|
24533
24533
|
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
24534
24534
|
};
|
|
24535
|
-
var successProcessor = (_schema2, _ctx,
|
|
24536
|
-
|
|
24535
|
+
var successProcessor = (_schema2, _ctx, json3, _params) => {
|
|
24536
|
+
json3.type = "boolean";
|
|
24537
24537
|
};
|
|
24538
|
-
var customProcessor = (schema, ctx,
|
|
24539
|
-
handleUnrepresentable(schema, ctx,
|
|
24538
|
+
var customProcessor = (schema, ctx, json3, params) => {
|
|
24539
|
+
handleUnrepresentable(schema, ctx, json3, params, "Custom types cannot be represented in JSON Schema");
|
|
24540
24540
|
};
|
|
24541
|
-
var functionProcessor = (schema, ctx,
|
|
24542
|
-
handleUnrepresentable(schema, ctx,
|
|
24541
|
+
var functionProcessor = (schema, ctx, json3, params) => {
|
|
24542
|
+
handleUnrepresentable(schema, ctx, json3, params, "Function types cannot be represented in JSON Schema");
|
|
24543
24543
|
};
|
|
24544
|
-
var transformProcessor = (schema, ctx,
|
|
24545
|
-
handleUnrepresentable(schema, ctx,
|
|
24544
|
+
var transformProcessor = (schema, ctx, json3, params) => {
|
|
24545
|
+
handleUnrepresentable(schema, ctx, json3, params, "Transforms cannot be represented in JSON Schema");
|
|
24546
24546
|
};
|
|
24547
|
-
var mapProcessor = (schema, ctx,
|
|
24548
|
-
handleUnrepresentable(schema, ctx,
|
|
24547
|
+
var mapProcessor = (schema, ctx, json3, params) => {
|
|
24548
|
+
handleUnrepresentable(schema, ctx, json3, params, "Map cannot be represented in JSON Schema");
|
|
24549
24549
|
};
|
|
24550
|
-
var setProcessor = (schema, ctx,
|
|
24551
|
-
handleUnrepresentable(schema, ctx,
|
|
24550
|
+
var setProcessor = (schema, ctx, json3, params) => {
|
|
24551
|
+
handleUnrepresentable(schema, ctx, json3, params, "Set cannot be represented in JSON Schema");
|
|
24552
24552
|
};
|
|
24553
24553
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
24554
|
-
const
|
|
24554
|
+
const json3 = _json;
|
|
24555
24555
|
const def = schema._zod.def;
|
|
24556
24556
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
24557
24557
|
if (typeof minimum === "number")
|
|
24558
|
-
|
|
24558
|
+
json3.minItems = minimum;
|
|
24559
24559
|
if (typeof maximum === "number")
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24560
|
+
json3.maxItems = maximum;
|
|
24561
|
+
json3.type = "array";
|
|
24562
|
+
json3.items = processSchema(def.element, ctx, {
|
|
24563
24563
|
...params,
|
|
24564
24564
|
path: [...params.path, "items"]
|
|
24565
24565
|
});
|
|
@@ -24575,17 +24575,17 @@ function inputOptin(schema) {
|
|
|
24575
24575
|
return schema._zod.optin;
|
|
24576
24576
|
}
|
|
24577
24577
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
24578
|
-
const
|
|
24578
|
+
const json3 = _json;
|
|
24579
24579
|
const def = schema._zod.def;
|
|
24580
24580
|
const shape = def.shape;
|
|
24581
24581
|
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
24582
|
-
if (symbolKeys.length && handleUnrepresentable(schema, ctx,
|
|
24582
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json3, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
24583
24583
|
return;
|
|
24584
24584
|
}
|
|
24585
|
-
|
|
24586
|
-
|
|
24585
|
+
json3.type = "object";
|
|
24586
|
+
json3.properties = {};
|
|
24587
24587
|
for (const key in shape) {
|
|
24588
|
-
assignProp(
|
|
24588
|
+
assignProp(json3.properties, key, processSchema(shape[key], ctx, {
|
|
24589
24589
|
...params,
|
|
24590
24590
|
path: [...params.path, "properties", key]
|
|
24591
24591
|
}));
|
|
@@ -24598,21 +24598,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
24598
24598
|
}
|
|
24599
24599
|
}
|
|
24600
24600
|
if (requiredKeys.length > 0) {
|
|
24601
|
-
|
|
24601
|
+
json3.required = requiredKeys;
|
|
24602
24602
|
}
|
|
24603
24603
|
if (def.catchall?._zod.def.type === "never") {
|
|
24604
|
-
|
|
24604
|
+
json3.additionalProperties = false;
|
|
24605
24605
|
} else if (!def.catchall) {
|
|
24606
24606
|
if (ctx.io === "output")
|
|
24607
|
-
|
|
24607
|
+
json3.additionalProperties = false;
|
|
24608
24608
|
} else if (def.catchall) {
|
|
24609
|
-
|
|
24609
|
+
json3.additionalProperties = processSchema(def.catchall, ctx, {
|
|
24610
24610
|
...params,
|
|
24611
24611
|
path: [...params.path, "additionalProperties"]
|
|
24612
24612
|
});
|
|
24613
24613
|
}
|
|
24614
24614
|
};
|
|
24615
|
-
var unionProcessor = (schema, ctx,
|
|
24615
|
+
var unionProcessor = (schema, ctx, json3, params) => {
|
|
24616
24616
|
const def = schema._zod.def;
|
|
24617
24617
|
const isExclusive = def.inclusive === false;
|
|
24618
24618
|
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
@@ -24620,12 +24620,12 @@ var unionProcessor = (schema, ctx, json4, params) => {
|
|
|
24620
24620
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
24621
24621
|
}));
|
|
24622
24622
|
if (isExclusive) {
|
|
24623
|
-
|
|
24623
|
+
json3.oneOf = options;
|
|
24624
24624
|
} else {
|
|
24625
|
-
|
|
24625
|
+
json3.anyOf = options;
|
|
24626
24626
|
}
|
|
24627
24627
|
};
|
|
24628
|
-
var intersectionProcessor = (schema, ctx,
|
|
24628
|
+
var intersectionProcessor = (schema, ctx, json3, params) => {
|
|
24629
24629
|
const def = schema._zod.def;
|
|
24630
24630
|
const a = processSchema(def.left, ctx, {
|
|
24631
24631
|
...params,
|
|
@@ -24640,13 +24640,13 @@ var intersectionProcessor = (schema, ctx, json4, params) => {
|
|
|
24640
24640
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
24641
24641
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
24642
24642
|
];
|
|
24643
|
-
|
|
24643
|
+
json3.allOf = allOf;
|
|
24644
24644
|
ctx.intersections.push(allOf);
|
|
24645
24645
|
};
|
|
24646
24646
|
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
24647
|
-
const
|
|
24647
|
+
const json3 = _json;
|
|
24648
24648
|
const def = schema._zod.def;
|
|
24649
|
-
|
|
24649
|
+
json3.type = "array";
|
|
24650
24650
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
24651
24651
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
24652
24652
|
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
@@ -24668,70 +24668,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
24668
24668
|
const maxItems = def.items.length;
|
|
24669
24669
|
const isClosed = !def.rest;
|
|
24670
24670
|
if (ctx.target === "draft-2020-12") {
|
|
24671
|
-
|
|
24671
|
+
json3.prefixItems = prefixItems;
|
|
24672
24672
|
if (isClosed) {
|
|
24673
|
-
|
|
24673
|
+
json3.items = false;
|
|
24674
24674
|
} else if (rest) {
|
|
24675
|
-
|
|
24675
|
+
json3.items = rest;
|
|
24676
24676
|
}
|
|
24677
24677
|
if (minItems > 0)
|
|
24678
|
-
|
|
24678
|
+
json3.minItems = minItems;
|
|
24679
24679
|
if (isClosed)
|
|
24680
|
-
|
|
24680
|
+
json3.maxItems = maxItems;
|
|
24681
24681
|
} else if (ctx.target === "openapi-3.0") {
|
|
24682
|
-
|
|
24682
|
+
json3.items = {
|
|
24683
24683
|
anyOf: prefixItems
|
|
24684
24684
|
};
|
|
24685
24685
|
if (rest) {
|
|
24686
|
-
|
|
24686
|
+
json3.items.anyOf.push(rest);
|
|
24687
24687
|
}
|
|
24688
24688
|
if (minItems > 0)
|
|
24689
|
-
|
|
24689
|
+
json3.minItems = minItems;
|
|
24690
24690
|
if (isClosed)
|
|
24691
|
-
|
|
24691
|
+
json3.maxItems = maxItems;
|
|
24692
24692
|
} else {
|
|
24693
|
-
|
|
24693
|
+
json3.items = prefixItems;
|
|
24694
24694
|
if (isClosed) {
|
|
24695
|
-
|
|
24695
|
+
json3.additionalItems = false;
|
|
24696
24696
|
} else if (rest) {
|
|
24697
|
-
|
|
24697
|
+
json3.additionalItems = rest;
|
|
24698
24698
|
}
|
|
24699
24699
|
if (minItems > 0)
|
|
24700
|
-
|
|
24700
|
+
json3.minItems = minItems;
|
|
24701
24701
|
if (isClosed)
|
|
24702
|
-
|
|
24702
|
+
json3.maxItems = maxItems;
|
|
24703
24703
|
}
|
|
24704
24704
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
24705
24705
|
if (typeof minimum === "number")
|
|
24706
|
-
|
|
24706
|
+
json3.minItems = minimum;
|
|
24707
24707
|
if (typeof maximum === "number")
|
|
24708
|
-
|
|
24709
|
-
};
|
|
24710
|
-
function stringifyKeyNames(bySchema,
|
|
24711
|
-
if (
|
|
24712
|
-
if (visited.has(
|
|
24713
|
-
return
|
|
24714
|
-
visited.add(
|
|
24715
|
-
const def = bySchema.get(
|
|
24708
|
+
json3.maxItems = maximum;
|
|
24709
|
+
};
|
|
24710
|
+
function stringifyKeyNames(bySchema, json3, visited) {
|
|
24711
|
+
if (json3.$ref) {
|
|
24712
|
+
if (visited.has(json3))
|
|
24713
|
+
return json3;
|
|
24714
|
+
visited.add(json3);
|
|
24715
|
+
const def = bySchema.get(json3)?.def;
|
|
24716
24716
|
if (!def)
|
|
24717
|
-
return
|
|
24717
|
+
return json3;
|
|
24718
24718
|
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
24719
|
-
return inlined === def ?
|
|
24719
|
+
return inlined === def ? json3 : inlined;
|
|
24720
24720
|
}
|
|
24721
24721
|
for (const keyword of ["anyOf", "oneOf"]) {
|
|
24722
|
-
const branches =
|
|
24722
|
+
const branches = json3[keyword];
|
|
24723
24723
|
if (!Array.isArray(branches))
|
|
24724
24724
|
continue;
|
|
24725
24725
|
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
24726
24726
|
if (mapped.some((branch, i) => branch !== branches[i]))
|
|
24727
|
-
|
|
24727
|
+
json3 = { ...json3, [keyword]: mapped };
|
|
24728
24728
|
}
|
|
24729
|
-
const types = Array.isArray(
|
|
24729
|
+
const types = Array.isArray(json3.type) ? json3.type : [json3.type];
|
|
24730
24730
|
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
24731
|
-
const values =
|
|
24731
|
+
const values = json3.enum ?? (json3.const !== void 0 ? [json3.const] : void 0);
|
|
24732
24732
|
if (!numericType && !values?.some((v3) => typeof v3 === "number"))
|
|
24733
|
-
return
|
|
24734
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id21, ...rest } =
|
|
24733
|
+
return json3;
|
|
24734
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id21, ...rest } = json3;
|
|
24735
24735
|
if (rest.enum)
|
|
24736
24736
|
rest.enum = rest.enum.map((v3) => typeof v3 === "number" ? String(v3) : v3);
|
|
24737
24737
|
else if (typeof rest.const === "number")
|
|
@@ -24771,9 +24771,9 @@ function rewriteKeyNames(ctx) {
|
|
|
24771
24771
|
}
|
|
24772
24772
|
}
|
|
24773
24773
|
var recordProcessor = (schema, ctx, _json, params) => {
|
|
24774
|
-
const
|
|
24774
|
+
const json3 = _json;
|
|
24775
24775
|
const def = schema._zod.def;
|
|
24776
|
-
|
|
24776
|
+
json3.type = "object";
|
|
24777
24777
|
const keyType = def.keyType;
|
|
24778
24778
|
const patterns = aggregateChecks(keyType).patterns;
|
|
24779
24779
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
@@ -24781,13 +24781,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
24781
24781
|
...params,
|
|
24782
24782
|
path: [...params.path, "patternProperties", "*"]
|
|
24783
24783
|
});
|
|
24784
|
-
|
|
24784
|
+
json3.patternProperties = {};
|
|
24785
24785
|
for (const pattern of patterns) {
|
|
24786
|
-
assignProp(
|
|
24786
|
+
assignProp(json3.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
24787
24787
|
}
|
|
24788
24788
|
} else {
|
|
24789
24789
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
24790
|
-
|
|
24790
|
+
json3.propertyNames = processSchema(def.keyType, ctx, {
|
|
24791
24791
|
...params,
|
|
24792
24792
|
path: [...params.path, "propertyNames"]
|
|
24793
24793
|
});
|
|
@@ -24799,7 +24799,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
24799
24799
|
}
|
|
24800
24800
|
pending.push(schema);
|
|
24801
24801
|
}
|
|
24802
|
-
|
|
24802
|
+
json3.additionalProperties = processSchema(def.valueType, ctx, {
|
|
24803
24803
|
...params,
|
|
24804
24804
|
path: [...params.path, "additionalProperties"]
|
|
24805
24805
|
});
|
|
@@ -24809,19 +24809,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
24809
24809
|
if (keyValues && !def.partial && !omittableOnInput) {
|
|
24810
24810
|
const validKeyValues = [...keyValues].filter((v3) => typeof v3 === "string" || typeof v3 === "number");
|
|
24811
24811
|
if (validKeyValues.length > 0) {
|
|
24812
|
-
|
|
24812
|
+
json3.required = validKeyValues.map(String);
|
|
24813
24813
|
}
|
|
24814
24814
|
}
|
|
24815
24815
|
};
|
|
24816
|
-
var nullableProcessor = (schema, ctx,
|
|
24816
|
+
var nullableProcessor = (schema, ctx, json3, params) => {
|
|
24817
24817
|
const def = schema._zod.def;
|
|
24818
24818
|
const inner = processSchema(def.innerType, ctx, params);
|
|
24819
24819
|
const seen = ctx.seen.get(schema);
|
|
24820
24820
|
if (ctx.target === "openapi-3.0") {
|
|
24821
24821
|
seen.ref = def.innerType;
|
|
24822
|
-
|
|
24822
|
+
json3.nullable = true;
|
|
24823
24823
|
} else {
|
|
24824
|
-
|
|
24824
|
+
json3.anyOf = [inner, { type: "null" }];
|
|
24825
24825
|
}
|
|
24826
24826
|
};
|
|
24827
24827
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
@@ -24831,7 +24831,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
24831
24831
|
seen.ref = def.innerType;
|
|
24832
24832
|
};
|
|
24833
24833
|
var UNREPRESENTABLE_DEFAULT = Symbol();
|
|
24834
|
-
function serializeDefaultValue(value, schema, ctx,
|
|
24834
|
+
function serializeDefaultValue(value, schema, ctx, json3, params) {
|
|
24835
24835
|
let unrepresentable = false;
|
|
24836
24836
|
const serialized = JSON.stringify(value, (_, val) => {
|
|
24837
24837
|
if (typeof val !== "bigint")
|
|
@@ -24841,30 +24841,30 @@ function serializeDefaultValue(value, schema, ctx, json4, params) {
|
|
|
24841
24841
|
});
|
|
24842
24842
|
if (!unrepresentable)
|
|
24843
24843
|
return JSON.parse(serialized);
|
|
24844
|
-
handleUnrepresentable(schema, ctx,
|
|
24844
|
+
handleUnrepresentable(schema, ctx, json3, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
24845
24845
|
return UNREPRESENTABLE_DEFAULT;
|
|
24846
24846
|
}
|
|
24847
|
-
var defaultProcessor = (schema, ctx,
|
|
24847
|
+
var defaultProcessor = (schema, ctx, json3, params) => {
|
|
24848
24848
|
const def = schema._zod.def;
|
|
24849
24849
|
processSchema(def.innerType, ctx, params);
|
|
24850
24850
|
const seen = ctx.seen.get(schema);
|
|
24851
24851
|
seen.ref = def.innerType;
|
|
24852
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
24852
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
|
|
24853
24853
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
24854
|
-
|
|
24854
|
+
json3.default = value;
|
|
24855
24855
|
};
|
|
24856
|
-
var prefaultProcessor = (schema, ctx,
|
|
24856
|
+
var prefaultProcessor = (schema, ctx, json3, params) => {
|
|
24857
24857
|
const def = schema._zod.def;
|
|
24858
24858
|
processSchema(def.innerType, ctx, params);
|
|
24859
24859
|
const seen = ctx.seen.get(schema);
|
|
24860
24860
|
seen.ref = def.innerType;
|
|
24861
24861
|
if (ctx.io !== "input")
|
|
24862
24862
|
return;
|
|
24863
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
24863
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
|
|
24864
24864
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
24865
|
-
|
|
24865
|
+
json3._prefault = value;
|
|
24866
24866
|
};
|
|
24867
|
-
var catchProcessor = (schema, ctx,
|
|
24867
|
+
var catchProcessor = (schema, ctx, json3, params) => {
|
|
24868
24868
|
const def = schema._zod.def;
|
|
24869
24869
|
processSchema(def.innerType, ctx, params);
|
|
24870
24870
|
const seen = ctx.seen.get(schema);
|
|
@@ -24873,10 +24873,10 @@ var catchProcessor = (schema, ctx, json4, params) => {
|
|
|
24873
24873
|
try {
|
|
24874
24874
|
catchValue = def.catchValue(void 0);
|
|
24875
24875
|
} catch {
|
|
24876
|
-
handleUnrepresentable(schema, ctx,
|
|
24876
|
+
handleUnrepresentable(schema, ctx, json3, params, "Dynamic catch values are not supported in JSON Schema");
|
|
24877
24877
|
return;
|
|
24878
24878
|
}
|
|
24879
|
-
|
|
24879
|
+
json3.default = catchValue;
|
|
24880
24880
|
};
|
|
24881
24881
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
24882
24882
|
const def = schema._zod.def;
|
|
@@ -24886,12 +24886,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
24886
24886
|
const seen = ctx.seen.get(schema);
|
|
24887
24887
|
seen.ref = innerType;
|
|
24888
24888
|
};
|
|
24889
|
-
var readonlyProcessor = (schema, ctx,
|
|
24889
|
+
var readonlyProcessor = (schema, ctx, json3, params) => {
|
|
24890
24890
|
const def = schema._zod.def;
|
|
24891
24891
|
processSchema(def.innerType, ctx, params);
|
|
24892
24892
|
const seen = ctx.seen.get(schema);
|
|
24893
24893
|
seen.ref = def.innerType;
|
|
24894
|
-
|
|
24894
|
+
json3.readOnly = true;
|
|
24895
24895
|
};
|
|
24896
24896
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
24897
24897
|
const def = schema._zod.def;
|
|
@@ -25533,7 +25533,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
|
|
|
25533
25533
|
(inst, def) => {
|
|
25534
25534
|
$ZodString.init(inst, def);
|
|
25535
25535
|
ZodType.init(inst, def);
|
|
25536
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25536
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => stringProcessor(inst, ctx, json3, params);
|
|
25537
25537
|
},
|
|
25538
25538
|
/* @__PURE__ */ util_exports.derived({
|
|
25539
25539
|
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
@@ -25892,7 +25892,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
|
|
|
25892
25892
|
(inst, def) => {
|
|
25893
25893
|
$ZodNumber.init(inst, def);
|
|
25894
25894
|
ZodType.init(inst, def);
|
|
25895
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25895
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => numberProcessor(inst, ctx, json3, params);
|
|
25896
25896
|
inst.isFinite = true;
|
|
25897
25897
|
},
|
|
25898
25898
|
/* @__PURE__ */ util_exports.derived({
|
|
@@ -25982,7 +25982,7 @@ function uint32(params) {
|
|
|
25982
25982
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
25983
25983
|
$ZodBoolean.init(inst, def);
|
|
25984
25984
|
ZodType.init(inst, def);
|
|
25985
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25985
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => booleanProcessor(inst, ctx, json3, params);
|
|
25986
25986
|
});
|
|
25987
25987
|
function boolean2(params) {
|
|
25988
25988
|
return _boolean(ZodBoolean, params);
|
|
@@ -25992,7 +25992,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
|
|
|
25992
25992
|
(inst, def) => {
|
|
25993
25993
|
$ZodBigInt.init(inst, def);
|
|
25994
25994
|
ZodType.init(inst, def);
|
|
25995
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25995
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => bigintProcessor(inst, ctx, json3, params);
|
|
25996
25996
|
},
|
|
25997
25997
|
/* @__PURE__ */ util_exports.derived({
|
|
25998
25998
|
minValue: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
@@ -26050,7 +26050,7 @@ function uint64(params) {
|
|
|
26050
26050
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
26051
26051
|
$ZodSymbol.init(inst, def);
|
|
26052
26052
|
ZodType.init(inst, def);
|
|
26053
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26053
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => symbolProcessor(inst, ctx, json3, params);
|
|
26054
26054
|
});
|
|
26055
26055
|
function symbol(params) {
|
|
26056
26056
|
return _symbol(ZodSymbol, params);
|
|
@@ -26058,7 +26058,7 @@ function symbol(params) {
|
|
|
26058
26058
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
26059
26059
|
$ZodUndefined.init(inst, def);
|
|
26060
26060
|
ZodType.init(inst, def);
|
|
26061
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26061
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => undefinedProcessor(inst, ctx, json3, params);
|
|
26062
26062
|
});
|
|
26063
26063
|
function _undefined3(params) {
|
|
26064
26064
|
return _undefined2(ZodUndefined, params);
|
|
@@ -26066,7 +26066,7 @@ function _undefined3(params) {
|
|
|
26066
26066
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
26067
26067
|
$ZodNull.init(inst, def);
|
|
26068
26068
|
ZodType.init(inst, def);
|
|
26069
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26069
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullProcessor(inst, ctx, json3, params);
|
|
26070
26070
|
});
|
|
26071
26071
|
function _null3(params) {
|
|
26072
26072
|
return _null2(ZodNull, params);
|
|
@@ -26074,7 +26074,7 @@ function _null3(params) {
|
|
|
26074
26074
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
26075
26075
|
$ZodAny.init(inst, def);
|
|
26076
26076
|
ZodType.init(inst, def);
|
|
26077
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26077
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => anyProcessor(inst, ctx, json3, params);
|
|
26078
26078
|
});
|
|
26079
26079
|
function any() {
|
|
26080
26080
|
return _any(ZodAny);
|
|
@@ -26082,7 +26082,7 @@ function any() {
|
|
|
26082
26082
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
26083
26083
|
$ZodUnknown.init(inst, def);
|
|
26084
26084
|
ZodType.init(inst, def);
|
|
26085
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26085
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unknownProcessor(inst, ctx, json3, params);
|
|
26086
26086
|
});
|
|
26087
26087
|
function unknown() {
|
|
26088
26088
|
return _unknown(ZodUnknown);
|
|
@@ -26090,7 +26090,7 @@ function unknown() {
|
|
|
26090
26090
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
26091
26091
|
$ZodNever.init(inst, def);
|
|
26092
26092
|
ZodType.init(inst, def);
|
|
26093
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26093
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => neverProcessor(inst, ctx, json3, params);
|
|
26094
26094
|
});
|
|
26095
26095
|
function never(params) {
|
|
26096
26096
|
return _never(ZodNever, params);
|
|
@@ -26098,7 +26098,7 @@ function never(params) {
|
|
|
26098
26098
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
26099
26099
|
$ZodVoid.init(inst, def);
|
|
26100
26100
|
ZodType.init(inst, def);
|
|
26101
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26101
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => voidProcessor(inst, ctx, json3, params);
|
|
26102
26102
|
});
|
|
26103
26103
|
function _void2(params) {
|
|
26104
26104
|
return _void(ZodVoid, params);
|
|
@@ -26108,7 +26108,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
|
|
|
26108
26108
|
(inst, def) => {
|
|
26109
26109
|
$ZodDate.init(inst, def);
|
|
26110
26110
|
ZodType.init(inst, def);
|
|
26111
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26111
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => dateProcessor(inst, ctx, json3, params);
|
|
26112
26112
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
26113
26113
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
26114
26114
|
},
|
|
@@ -26130,7 +26130,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
26130
26130
|
_ensureDefaultMemoizer();
|
|
26131
26131
|
$ZodArray.init(inst, def);
|
|
26132
26132
|
ZodType.init(inst, def);
|
|
26133
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26133
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => arrayProcessor(inst, ctx, json3, params);
|
|
26134
26134
|
inst.element = def.element;
|
|
26135
26135
|
}, {
|
|
26136
26136
|
min(n, params) {
|
|
@@ -26160,7 +26160,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
26160
26160
|
_ensureDefaultMemoizer();
|
|
26161
26161
|
$ZodObjectJIT.init(inst, def);
|
|
26162
26162
|
ZodType.init(inst, def);
|
|
26163
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26163
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => objectProcessor(inst, ctx, json3, params);
|
|
26164
26164
|
util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
26165
26165
|
}, {
|
|
26166
26166
|
keyof() {
|
|
@@ -26233,7 +26233,7 @@ function looseObject(shape, params) {
|
|
|
26233
26233
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
26234
26234
|
$ZodUnion.init(inst, def);
|
|
26235
26235
|
ZodType.init(inst, def);
|
|
26236
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26236
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
26237
26237
|
inst.options = def.options;
|
|
26238
26238
|
});
|
|
26239
26239
|
function union(options, params) {
|
|
@@ -26246,7 +26246,7 @@ function union(options, params) {
|
|
|
26246
26246
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
26247
26247
|
ZodUnion.init(inst, def);
|
|
26248
26248
|
$ZodXor.init(inst, def);
|
|
26249
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26249
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
26250
26250
|
inst.options = def.options;
|
|
26251
26251
|
});
|
|
26252
26252
|
function xor(options, params) {
|
|
@@ -26272,7 +26272,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
26272
26272
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
26273
26273
|
$ZodIntersection.init(inst, def);
|
|
26274
26274
|
ZodType.init(inst, def);
|
|
26275
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26275
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor(inst, ctx, json3, params);
|
|
26276
26276
|
});
|
|
26277
26277
|
function intersection(left, right) {
|
|
26278
26278
|
return new ZodIntersection({
|
|
@@ -26285,7 +26285,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
26285
26285
|
_ensureDefaultMemoizer();
|
|
26286
26286
|
$ZodTuple.init(inst, def);
|
|
26287
26287
|
ZodType.init(inst, def);
|
|
26288
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26288
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => tupleProcessor(inst, ctx, json3, params);
|
|
26289
26289
|
}, {
|
|
26290
26290
|
rest(rest) {
|
|
26291
26291
|
return this.clone({
|
|
@@ -26318,7 +26318,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
26318
26318
|
_ensureDefaultMemoizer();
|
|
26319
26319
|
$ZodRecord.init(inst, def);
|
|
26320
26320
|
ZodType.init(inst, def);
|
|
26321
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26321
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => recordProcessor(inst, ctx, json3, params);
|
|
26322
26322
|
inst.keyType = def.keyType;
|
|
26323
26323
|
inst.valueType = def.valueType;
|
|
26324
26324
|
});
|
|
@@ -26360,7 +26360,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
|
26360
26360
|
_ensureDefaultMemoizer();
|
|
26361
26361
|
$ZodMap.init(inst, def);
|
|
26362
26362
|
ZodType.init(inst, def);
|
|
26363
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26363
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => mapProcessor(inst, ctx, json3, params);
|
|
26364
26364
|
inst.keyType = def.keyType;
|
|
26365
26365
|
inst.valueType = def.valueType;
|
|
26366
26366
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
@@ -26380,7 +26380,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
|
26380
26380
|
_ensureDefaultMemoizer();
|
|
26381
26381
|
$ZodSet.init(inst, def);
|
|
26382
26382
|
ZodType.init(inst, def);
|
|
26383
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26383
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => setProcessor(inst, ctx, json3, params);
|
|
26384
26384
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
26385
26385
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
26386
26386
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
@@ -26396,7 +26396,7 @@ function set(valueType, params) {
|
|
|
26396
26396
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
26397
26397
|
$ZodEnum.init(inst, def);
|
|
26398
26398
|
ZodType.init(inst, def);
|
|
26399
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26399
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => enumProcessor(inst, ctx, json3, params);
|
|
26400
26400
|
inst.enum = def.entries;
|
|
26401
26401
|
inst.options = [...inst._zod.values];
|
|
26402
26402
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -26449,7 +26449,7 @@ function nativeEnum(entries, params) {
|
|
|
26449
26449
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
26450
26450
|
$ZodLiteral.init(inst, def);
|
|
26451
26451
|
ZodType.init(inst, def);
|
|
26452
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26452
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => literalProcessor(inst, ctx, json3, params);
|
|
26453
26453
|
inst.values = new Set(def.values);
|
|
26454
26454
|
Object.defineProperty(inst, "value", {
|
|
26455
26455
|
get() {
|
|
@@ -26470,7 +26470,7 @@ function literal(value, params) {
|
|
|
26470
26470
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
26471
26471
|
$ZodFile.init(inst, def);
|
|
26472
26472
|
ZodType.init(inst, def);
|
|
26473
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26473
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
|
|
26474
26474
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
26475
26475
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
26476
26476
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
@@ -26482,7 +26482,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
26482
26482
|
_ensureDefaultMemoizer();
|
|
26483
26483
|
$ZodTransform.init(inst, def);
|
|
26484
26484
|
ZodType.init(inst, def);
|
|
26485
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26485
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => transformProcessor(inst, ctx, json3, params);
|
|
26486
26486
|
inst._zod.parse = (payload, _ctx) => {
|
|
26487
26487
|
if (_ctx.direction === "backward") {
|
|
26488
26488
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -26521,7 +26521,7 @@ function transform(fn) {
|
|
|
26521
26521
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
26522
26522
|
$ZodOptional.init(inst, def);
|
|
26523
26523
|
ZodType.init(inst, def);
|
|
26524
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26524
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
26525
26525
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26526
26526
|
});
|
|
26527
26527
|
function optional(innerType) {
|
|
@@ -26533,7 +26533,7 @@ function optional(innerType) {
|
|
|
26533
26533
|
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
26534
26534
|
$ZodExactOptional.init(inst, def);
|
|
26535
26535
|
ZodType.init(inst, def);
|
|
26536
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26536
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
26537
26537
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26538
26538
|
});
|
|
26539
26539
|
function exactOptional(innerType) {
|
|
@@ -26545,7 +26545,7 @@ function exactOptional(innerType) {
|
|
|
26545
26545
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
26546
26546
|
$ZodNullable.init(inst, def);
|
|
26547
26547
|
ZodType.init(inst, def);
|
|
26548
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26548
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullableProcessor(inst, ctx, json3, params);
|
|
26549
26549
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26550
26550
|
});
|
|
26551
26551
|
function nullable(innerType) {
|
|
@@ -26560,7 +26560,7 @@ function nullish2(innerType) {
|
|
|
26560
26560
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
26561
26561
|
$ZodDefault.init(inst, def);
|
|
26562
26562
|
ZodType.init(inst, def);
|
|
26563
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26563
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => defaultProcessor(inst, ctx, json3, params);
|
|
26564
26564
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26565
26565
|
inst.removeDefault = inst.unwrap;
|
|
26566
26566
|
});
|
|
@@ -26576,7 +26576,7 @@ function _default2(innerType, defaultValue) {
|
|
|
26576
26576
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
26577
26577
|
$ZodPrefault.init(inst, def);
|
|
26578
26578
|
ZodType.init(inst, def);
|
|
26579
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26579
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => prefaultProcessor(inst, ctx, json3, params);
|
|
26580
26580
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26581
26581
|
});
|
|
26582
26582
|
function prefault(innerType, defaultValue) {
|
|
@@ -26591,7 +26591,7 @@ function prefault(innerType, defaultValue) {
|
|
|
26591
26591
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
26592
26592
|
$ZodNonOptional.init(inst, def);
|
|
26593
26593
|
ZodType.init(inst, def);
|
|
26594
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26594
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nonoptionalProcessor(inst, ctx, json3, params);
|
|
26595
26595
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26596
26596
|
});
|
|
26597
26597
|
function nonoptional(innerType, params) {
|
|
@@ -26604,7 +26604,7 @@ function nonoptional(innerType, params) {
|
|
|
26604
26604
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
26605
26605
|
$ZodSuccess.init(inst, def);
|
|
26606
26606
|
ZodType.init(inst, def);
|
|
26607
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26607
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => successProcessor(inst, ctx, json3, params);
|
|
26608
26608
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26609
26609
|
});
|
|
26610
26610
|
function success(innerType) {
|
|
@@ -26616,7 +26616,7 @@ function success(innerType) {
|
|
|
26616
26616
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
26617
26617
|
$ZodCatch.init(inst, def);
|
|
26618
26618
|
ZodType.init(inst, def);
|
|
26619
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26619
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => catchProcessor(inst, ctx, json3, params);
|
|
26620
26620
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26621
26621
|
inst.removeCatch = inst.unwrap;
|
|
26622
26622
|
});
|
|
@@ -26630,7 +26630,7 @@ function _catch2(innerType, catchValue) {
|
|
|
26630
26630
|
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
26631
26631
|
$ZodNaN.init(inst, def);
|
|
26632
26632
|
ZodType.init(inst, def);
|
|
26633
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26633
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nanProcessor(inst, ctx, json3, params);
|
|
26634
26634
|
});
|
|
26635
26635
|
function nan(params) {
|
|
26636
26636
|
return _nan(ZodNaN, params);
|
|
@@ -26638,7 +26638,7 @@ function nan(params) {
|
|
|
26638
26638
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
26639
26639
|
$ZodPipe.init(inst, def);
|
|
26640
26640
|
ZodType.init(inst, def);
|
|
26641
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26641
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => pipeProcessor(inst, ctx, json3, params);
|
|
26642
26642
|
inst.in = def.in;
|
|
26643
26643
|
inst.out = def.out;
|
|
26644
26644
|
});
|
|
@@ -26680,7 +26680,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
|
|
|
26680
26680
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
26681
26681
|
$ZodReadonly.init(inst, def);
|
|
26682
26682
|
ZodType.init(inst, def);
|
|
26683
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26683
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => readonlyProcessor(inst, ctx, json3, params);
|
|
26684
26684
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26685
26685
|
});
|
|
26686
26686
|
function readonly(innerType) {
|
|
@@ -26692,7 +26692,7 @@ function readonly(innerType) {
|
|
|
26692
26692
|
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
26693
26693
|
$ZodTemplateLiteral.init(inst, def);
|
|
26694
26694
|
ZodType.init(inst, def);
|
|
26695
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26695
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => templateLiteralProcessor(inst, ctx, json3, params);
|
|
26696
26696
|
});
|
|
26697
26697
|
function templateLiteral(parts, params) {
|
|
26698
26698
|
return new ZodTemplateLiteral({
|
|
@@ -26704,7 +26704,7 @@ function templateLiteral(parts, params) {
|
|
|
26704
26704
|
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
26705
26705
|
$ZodLazy.init(inst, def);
|
|
26706
26706
|
ZodType.init(inst, def);
|
|
26707
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26707
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => lazyProcessor(inst, ctx, json3, params);
|
|
26708
26708
|
inst.unwrap = () => inst._zod.def.getter();
|
|
26709
26709
|
});
|
|
26710
26710
|
function lazy(getter) {
|
|
@@ -26716,7 +26716,7 @@ function lazy(getter) {
|
|
|
26716
26716
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
26717
26717
|
$ZodPromise.init(inst, def);
|
|
26718
26718
|
ZodType.init(inst, def);
|
|
26719
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26719
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => promiseProcessor(inst, ctx, json3, params);
|
|
26720
26720
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
26721
26721
|
});
|
|
26722
26722
|
function promise(innerType) {
|
|
@@ -26728,7 +26728,7 @@ function promise(innerType) {
|
|
|
26728
26728
|
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
26729
26729
|
$ZodFunction.init(inst, def);
|
|
26730
26730
|
ZodType.init(inst, def);
|
|
26731
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26731
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => functionProcessor(inst, ctx, json3, params);
|
|
26732
26732
|
});
|
|
26733
26733
|
function _function(params) {
|
|
26734
26734
|
return new ZodFunction({
|
|
@@ -26740,7 +26740,7 @@ function _function(params) {
|
|
|
26740
26740
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
26741
26741
|
$ZodCustom.init(inst, def);
|
|
26742
26742
|
ZodType.init(inst, def);
|
|
26743
|
-
inst._zod.processJSONSchema = (ctx,
|
|
26743
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => customProcessor(inst, ctx, json3, params);
|
|
26744
26744
|
});
|
|
26745
26745
|
function check(fn) {
|
|
26746
26746
|
const ch = new $ZodCheck({
|
|
@@ -27848,44 +27848,32 @@ var ACTIVITY_FIELD_TYPE_VALUES = [...FIELD_TYPE_VALUES, "number", "boolean", "si
|
|
|
27848
27848
|
var activityFieldTypeValidator = v.union(...ACTIVITY_FIELD_TYPE_VALUES.map((type) => v.literal(type)));
|
|
27849
27849
|
var activityFieldTypeSchema = external_exports.enum(ACTIVITY_FIELD_TYPE_VALUES);
|
|
27850
27850
|
var activityFieldOptionValidator = v.object({ value: v.string(), label: v.optional(v.string()), color: v.optional(v.string()) });
|
|
27851
|
+
var ACTIVITY_LIST_FIELD_TYPES = ["text", "email", "phone", "url", "postal-address", "salutation", "job-title", "multi-select"];
|
|
27852
|
+
function isActivityListFieldType(type) {
|
|
27853
|
+
return ACTIVITY_LIST_FIELD_TYPES.includes(type);
|
|
27854
|
+
}
|
|
27851
27855
|
var MAX_ACTIVITY_FIELD_VALUES = 1e3;
|
|
27852
27856
|
var externalActivityFieldValueSchema = external_exports.strictObject({ valueId: external_exports.string(), fieldId: external_exports.string(), label: external_exports.string(), type: activityFieldTypeSchema, value: external_exports.string() });
|
|
27853
27857
|
function activityFieldDisplayEntries(source2) {
|
|
27854
|
-
if (source2.fields === void 0) return Object.entries(source2.attributes ?? {}).map(([label, value]) => ({ id: label, label, value, type: void 0 }));
|
|
27855
27858
|
const groups = /* @__PURE__ */ new Map();
|
|
27856
|
-
for (const field of source2.fields) {
|
|
27859
|
+
for (const field of source2.fields ?? []) {
|
|
27857
27860
|
const group = groups.get(field.fieldId) ?? { fieldId: field.fieldId, label: field.label, type: field.type, values: [] };
|
|
27858
27861
|
group.values.push(field);
|
|
27859
27862
|
groups.set(field.fieldId, group);
|
|
27860
27863
|
}
|
|
27861
|
-
return [...groups.values()].flatMap(({ values, ...field }) => field.type === "multi-select" ? [{ ...field, id: field.fieldId, value:
|
|
27864
|
+
return [...groups.values()].flatMap(({ values, ...field }) => field.type === "multi-select" ? [{ ...field, id: field.fieldId, value: activityFieldValue(field.type, values.map((row) => row.value)) }] : values.map((row) => ({ ...field, id: row.valueId, value: activityFieldValue(field.type, [row.value]) })));
|
|
27862
27865
|
}
|
|
27863
27866
|
var externalActivityFieldValueValidator = v.object({ valueId: v.string(), fieldId: v.string(), label: v.string(), type: activityFieldTypeValidator, value: v.string() });
|
|
27864
27867
|
var activityFieldFilterSchema = external_exports.strictObject({ label: external_exports.string().trim().min(1).max(100), value: external_exports.string().min(1).max(16384) });
|
|
27865
27868
|
var activityFieldFiltersSchema = external_exports.union([activityFieldFilterSchema, external_exports.array(activityFieldFilterSchema).min(1).max(10)]);
|
|
27866
27869
|
var activityFieldFilterValidator = v.object({ label: v.string(), value: v.string() });
|
|
27867
27870
|
var activityFieldFiltersValidator = v.union(activityFieldFilterValidator, v.array(activityFieldFilterValidator));
|
|
27868
|
-
var activityFieldReadFields = { fields: v.
|
|
27869
|
-
var labelEvidenceValidator = v.object({ label: v.string(), count: v.number(), at: v.number(), id: v.string() });
|
|
27870
|
-
var activityFieldPlanSummaryValidator = v.object({
|
|
27871
|
-
variants: v.array(labelEvidenceValidator),
|
|
27872
|
-
types: v.array(activityFieldTypeValidator),
|
|
27873
|
-
textBoolean: v.boolean(),
|
|
27874
|
-
textNumeric: v.boolean(),
|
|
27875
|
-
// Retained for saved pre-v3 planning rows; new generations use the separate votes below.
|
|
27876
|
-
configured: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator, at: v.number(), id: v.string() })),
|
|
27877
|
-
configuredLabels: v.optional(v.array(labelEvidenceValidator)),
|
|
27878
|
-
configuredTypes: v.optional(v.array(activityFieldTypeValidator)),
|
|
27879
|
-
canonical: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
|
|
27880
|
-
existing: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
|
|
27881
|
-
options: v.optional(v.array(activityFieldOptionValidator)),
|
|
27882
|
-
resolvedLabel: v.optional(v.string())
|
|
27883
|
-
});
|
|
27871
|
+
var activityFieldReadFields = { fields: v.array(externalActivityFieldValueValidator) };
|
|
27884
27872
|
var MAX_ACTIVITY_FIELD_DEFINITION_READ_BYTES = 6 * 1024 * 1024;
|
|
27885
|
-
function
|
|
27873
|
+
function activityFieldValue(type, values) {
|
|
27886
27874
|
const first = values[0];
|
|
27887
27875
|
if (first === void 0) return void 0;
|
|
27888
|
-
return type === "multi-select" ? values : type === "number" ? Number(first) : type === "boolean" ? first.trim().toLowerCase() === "true" : type === "json" ? JSON.parse(first) : first;
|
|
27876
|
+
return type === "multi-select" || values.length > 1 && isActivityListFieldType(type) ? values : type === "number" ? Number(first) : type === "boolean" ? first.trim().toLowerCase() === "true" : type === "json" ? JSON.parse(first) : first;
|
|
27889
27877
|
}
|
|
27890
27878
|
|
|
27891
27879
|
// ../packages/shared/src/activity-dates.ts
|
|
@@ -28017,6 +28005,36 @@ function isSourceCreatedAtInput(value) {
|
|
|
28017
28005
|
return true;
|
|
28018
28006
|
}
|
|
28019
28007
|
|
|
28008
|
+
// ../packages/shared/src/activity-contracts.ts
|
|
28009
|
+
var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
|
|
28010
|
+
var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
|
|
28011
|
+
var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
|
|
28012
|
+
var ACTIVITY_BODY_MARKDOWN_DESCRIPTION = "Activity body in Markdown. Mention an entity with [entity](ente://entity/<entityId>) using an exact ID returned by searchEntities; this creates a body reference and does not change activity ownership. Mention another activity with [activity](ente://activity/<activityId>?display=inline) or display=card using an exact activity ID returned by Ente. Newly introduced malformed or wrong-table activity mention IDs are rejected with INVALID_INPUT; copy IDs unchanged, never retype or infer them. Self-contained ente-html fences with JSON title/height metadata are also supported.";
|
|
28013
|
+
|
|
28014
|
+
// ../packages/shared/src/operation-errors.ts
|
|
28015
|
+
var APP_ERROR_CODES = {
|
|
28016
|
+
unauthenticated: "UNAUTHENTICATED",
|
|
28017
|
+
userNotFound: "USER_NOT_FOUND",
|
|
28018
|
+
invalidInput: "INVALID_INPUT",
|
|
28019
|
+
notFound: "NOT_FOUND",
|
|
28020
|
+
forbidden: "FORBIDDEN",
|
|
28021
|
+
failedPrecondition: "FAILED_PRECONDITION",
|
|
28022
|
+
limitExceeded: "LIMIT_EXCEEDED",
|
|
28023
|
+
paymentRequired: "PAYMENT_REQUIRED",
|
|
28024
|
+
ownModelRequired: "OWN_MODEL_REQUIRED",
|
|
28025
|
+
internal: "INTERNAL",
|
|
28026
|
+
spaceEntityMismatch: "SPACE_ENTITY_MISMATCH",
|
|
28027
|
+
invalidAssignee: "INVALID_ASSIGNEE",
|
|
28028
|
+
activityChangedDuringSummary: "ACTIVITY_CHANGED_DURING_SUMMARY",
|
|
28029
|
+
contentVersionConflict: "CONTENT_VERSION_CONFLICT",
|
|
28030
|
+
missingEntitySpaceAccessConfirmationRequired: "MISSING_ENTITY_SPACE_ACCESS_CONFIRMATION_REQUIRED",
|
|
28031
|
+
missingParentSpaceAccessConfirmationRequired: "MISSING_PARENT_SPACE_ACCESS_CONFIRMATION_REQUIRED",
|
|
28032
|
+
parentSpaceRequiredByChildren: "PARENT_SPACE_REQUIRED_BY_CHILDREN",
|
|
28033
|
+
entitySpaceRequiredByActivities: "ENTITY_SPACE_REQUIRED_BY_ACTIVITIES",
|
|
28034
|
+
agentAuthAccountMismatch: "AGENT_AUTH_ACCOUNT_MISMATCH"
|
|
28035
|
+
};
|
|
28036
|
+
var OPERATION_ERROR_CODES = { ...APP_ERROR_CODES, notAvailableHere: "NOT_AVAILABLE_HERE" };
|
|
28037
|
+
|
|
28020
28038
|
// ../packages/shared/src/attribute-names.ts
|
|
28021
28039
|
var STORABLE_ATTRIBUTE_KEY = /^[\x20-\x23\x25-\x7E][\x20-\x7E]{0,1023}$/;
|
|
28022
28040
|
var ENCODED_PREFIX = "~";
|
|
@@ -28078,80 +28096,6 @@ var attributeStringPatch = external_exports.record(external_exports.string(), ex
|
|
|
28078
28096
|
if (!isStorableAttributeKey(key)) ctx.addIssue({ code: "custom", path: [key], message: attributeKeyError(key) });
|
|
28079
28097
|
}).meta({ patternProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.patternProperties, additionalProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.additionalProperties });
|
|
28080
28098
|
|
|
28081
|
-
// ../packages/shared/src/activity-contracts.ts
|
|
28082
|
-
var ACTIVITY_FIELD_TYPE_VALUES2 = ["text", "email", "phone", "url", "postal-address", "date", "salutation", "job-title", "json", "number", "boolean", "single-select", "multi-select"];
|
|
28083
|
-
var fieldsJsonSchema = { type: "array", maxItems: 1e3, items: {
|
|
28084
|
-
type: "object",
|
|
28085
|
-
additionalProperties: false,
|
|
28086
|
-
required: ["value"],
|
|
28087
|
-
properties: {
|
|
28088
|
-
label: { type: "string", minLength: 1, maxLength: 100 },
|
|
28089
|
-
fieldId: { type: "string", minLength: 1, maxLength: 128 },
|
|
28090
|
-
type: { type: "string", enum: ACTIVITY_FIELD_TYPE_VALUES2 },
|
|
28091
|
-
value: { anyOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }, { type: "array", maxItems: 1e3, items: { type: "string" } }, { type: "null" }] }
|
|
28092
|
-
},
|
|
28093
|
-
oneOf: [{ required: ["label"] }, { required: ["fieldId"] }]
|
|
28094
|
-
} };
|
|
28095
|
-
var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
|
|
28096
|
-
var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
|
|
28097
|
-
var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
|
|
28098
|
-
var ACTIVITY_BODY_MARKDOWN_DESCRIPTION = "Activity body in Markdown. Mention an entity with [entity](ente://entity/<entityId>) using an exact ID returned by searchEntities; this creates a body reference and does not change activity ownership. Mention another activity with [activity](ente://activity/<activityId>?display=inline) or display=card using an exact activity ID returned by Ente. Newly introduced malformed or wrong-table activity mention IDs are rejected with INVALID_INPUT; copy IDs unchanged, never retype or infer them. Self-contained ente-html fences with JSON title/height metadata are also supported.";
|
|
28099
|
-
var activityUpdateInputProperties = {
|
|
28100
|
-
title: { type: "string", description: "Optional headline." },
|
|
28101
|
-
content: {
|
|
28102
|
-
type: "string",
|
|
28103
|
-
description: ACTIVITY_BODY_MARKDOWN_DESCRIPTION
|
|
28104
|
-
},
|
|
28105
|
-
completed: { type: "boolean", description: "Task completion state." },
|
|
28106
|
-
deadline: nullableDeadlineJsonSchema,
|
|
28107
|
-
entityIds: {
|
|
28108
|
-
type: "array",
|
|
28109
|
-
items: { type: "string" },
|
|
28110
|
-
description: "Replace linked entities with this non-empty set."
|
|
28111
|
-
},
|
|
28112
|
-
type: { type: "string", enum: ACTIVITY_TYPE_VALUES },
|
|
28113
|
-
fields: fieldsJsonSchema,
|
|
28114
|
-
attributes: {
|
|
28115
|
-
...ATTRIBUTE_STRING_PATCH_JSON_SCHEMA,
|
|
28116
|
-
description: "Activity attributes. Set a value to null to remove it."
|
|
28117
|
-
},
|
|
28118
|
-
assigneeIds: {
|
|
28119
|
-
type: "array",
|
|
28120
|
-
items: { type: "string" },
|
|
28121
|
-
description: "Task assignee user IDs."
|
|
28122
|
-
},
|
|
28123
|
-
agentAssigneeIds: { type: "array", items: { type: "string" }, maxItems: MAX_ACTIVITY_AGENT_ASSIGNEES, description: "Task assignee agent IDs. Agents must have write access to the target space; assignment grants no access." },
|
|
28124
|
-
assigneeEmails: {
|
|
28125
|
-
type: "array",
|
|
28126
|
-
items: { type: "string" },
|
|
28127
|
-
description: "Task assignee emails resolved in the target space."
|
|
28128
|
-
}
|
|
28129
|
-
};
|
|
28130
|
-
|
|
28131
|
-
// ../packages/shared/src/operation-errors.ts
|
|
28132
|
-
var APP_ERROR_CODES = {
|
|
28133
|
-
unauthenticated: "UNAUTHENTICATED",
|
|
28134
|
-
userNotFound: "USER_NOT_FOUND",
|
|
28135
|
-
invalidInput: "INVALID_INPUT",
|
|
28136
|
-
notFound: "NOT_FOUND",
|
|
28137
|
-
forbidden: "FORBIDDEN",
|
|
28138
|
-
failedPrecondition: "FAILED_PRECONDITION",
|
|
28139
|
-
limitExceeded: "LIMIT_EXCEEDED",
|
|
28140
|
-
paymentRequired: "PAYMENT_REQUIRED",
|
|
28141
|
-
ownModelRequired: "OWN_MODEL_REQUIRED",
|
|
28142
|
-
internal: "INTERNAL",
|
|
28143
|
-
spaceEntityMismatch: "SPACE_ENTITY_MISMATCH",
|
|
28144
|
-
invalidAssignee: "INVALID_ASSIGNEE",
|
|
28145
|
-
activityChangedDuringSummary: "ACTIVITY_CHANGED_DURING_SUMMARY",
|
|
28146
|
-
contentVersionConflict: "CONTENT_VERSION_CONFLICT",
|
|
28147
|
-
missingEntitySpaceAccessConfirmationRequired: "MISSING_ENTITY_SPACE_ACCESS_CONFIRMATION_REQUIRED",
|
|
28148
|
-
missingParentSpaceAccessConfirmationRequired: "MISSING_PARENT_SPACE_ACCESS_CONFIRMATION_REQUIRED",
|
|
28149
|
-
parentSpaceRequiredByChildren: "PARENT_SPACE_REQUIRED_BY_CHILDREN",
|
|
28150
|
-
entitySpaceRequiredByActivities: "ENTITY_SPACE_REQUIRED_BY_ACTIVITIES",
|
|
28151
|
-
agentAuthAccountMismatch: "AGENT_AUTH_ACCOUNT_MISMATCH"
|
|
28152
|
-
};
|
|
28153
|
-
var OPERATION_ERROR_CODES = { ...APP_ERROR_CODES, notAvailableHere: "NOT_AVAILABLE_HERE" };
|
|
28154
|
-
|
|
28155
28099
|
// ../node_modules/.pnpm/convex-helpers@0.1.120_@standard-schema+spec@1.1.0_convex@1.46.0_react@19.2.8__react@19.2.8_typescript@5.9.3_zod@4.6.7/node_modules/convex-helpers/index.js
|
|
28156
28100
|
var _error = Symbol();
|
|
28157
28101
|
|
|
@@ -28172,8 +28116,8 @@ var ValidationError = class extends Error {
|
|
|
28172
28116
|
got;
|
|
28173
28117
|
path;
|
|
28174
28118
|
constructor(expected, got, path11) {
|
|
28175
|
-
const
|
|
28176
|
-
super(
|
|
28119
|
+
const message4 = `Validator error${path11 ? ` for ${path11}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
28120
|
+
super(message4);
|
|
28177
28121
|
this.expected = expected;
|
|
28178
28122
|
this.got = got;
|
|
28179
28123
|
this.path = path11;
|
|
@@ -28500,8 +28444,8 @@ function validateOperationResult(validator, raw) {
|
|
|
28500
28444
|
return isJsonOperationValue(raw, /* @__PURE__ */ new Set()) && matchesResultShape(validator, raw);
|
|
28501
28445
|
}
|
|
28502
28446
|
var OperationResultError = class extends Error {
|
|
28503
|
-
constructor(operation,
|
|
28504
|
-
super(
|
|
28447
|
+
constructor(operation, message4 = `Invalid result for ${operation}`) {
|
|
28448
|
+
super(message4);
|
|
28505
28449
|
this.operation = operation;
|
|
28506
28450
|
this.name = "OperationResultError";
|
|
28507
28451
|
}
|
|
@@ -28510,14 +28454,14 @@ var OperationResultError = class extends Error {
|
|
|
28510
28454
|
return { code: this.code, operation: this.operation, message: this.message };
|
|
28511
28455
|
}
|
|
28512
28456
|
};
|
|
28513
|
-
function parseOperationResult(operation, validator, raw,
|
|
28457
|
+
function parseOperationResult(operation, validator, raw, message4) {
|
|
28514
28458
|
const candidate = forResult(validator, raw, describeConvex);
|
|
28515
|
-
if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation,
|
|
28459
|
+
if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message4);
|
|
28516
28460
|
return candidate;
|
|
28517
28461
|
}
|
|
28518
|
-
function parseZodOperationResult(operation, schema, raw,
|
|
28462
|
+
function parseZodOperationResult(operation, schema, raw, message4) {
|
|
28519
28463
|
const parsed = schema.safeParse(forResult(schema, raw, describeZod));
|
|
28520
|
-
if (!parsed.success) throw new OperationResultError(operation,
|
|
28464
|
+
if (!parsed.success) throw new OperationResultError(operation, message4);
|
|
28521
28465
|
return parsed.data;
|
|
28522
28466
|
}
|
|
28523
28467
|
|
|
@@ -28603,11 +28547,11 @@ function parseEntityReadRequest(operation, raw) {
|
|
|
28603
28547
|
var ApiError = class extends Error {
|
|
28604
28548
|
statusCode;
|
|
28605
28549
|
error;
|
|
28606
|
-
constructor(statusCode,
|
|
28607
|
-
super(`HTTP ${statusCode}: ${
|
|
28550
|
+
constructor(statusCode, message4, error62) {
|
|
28551
|
+
super(`HTTP ${statusCode}: ${message4}`);
|
|
28608
28552
|
this.name = "ApiError";
|
|
28609
28553
|
this.statusCode = statusCode;
|
|
28610
|
-
this.detail =
|
|
28554
|
+
this.detail = message4;
|
|
28611
28555
|
this.error = error62 ?? {};
|
|
28612
28556
|
}
|
|
28613
28557
|
/** The backend's human message, without the `HTTP <code>:` prefix. */
|
|
@@ -28624,8 +28568,8 @@ var ExitWithCode = class extends Error {
|
|
|
28624
28568
|
var UPGRADE_REQUIRED_EXIT_CODE = 3;
|
|
28625
28569
|
var UpgradeRequiredError = class extends Error {
|
|
28626
28570
|
data;
|
|
28627
|
-
constructor(
|
|
28628
|
-
super(
|
|
28571
|
+
constructor(message4, data = {}) {
|
|
28572
|
+
super(message4);
|
|
28629
28573
|
this.name = "UpgradeRequiredError";
|
|
28630
28574
|
this.data = data;
|
|
28631
28575
|
}
|
|
@@ -28640,13 +28584,13 @@ async function upgradeRequiredFromResponse(resp, path11) {
|
|
|
28640
28584
|
if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
|
|
28641
28585
|
} catch {
|
|
28642
28586
|
}
|
|
28643
|
-
const
|
|
28644
|
-
return new UpgradeRequiredError(
|
|
28587
|
+
const message4 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path11} (426 Upgrade Required). Install the latest version.`;
|
|
28588
|
+
return new UpgradeRequiredError(message4, data);
|
|
28645
28589
|
}
|
|
28646
28590
|
|
|
28647
28591
|
// core/output.ts
|
|
28648
|
-
function emit(stdout, data,
|
|
28649
|
-
if (
|
|
28592
|
+
function emit(stdout, data, json3, rowsFn, headers) {
|
|
28593
|
+
if (json3 || !rowsFn) {
|
|
28650
28594
|
stdout.write(`${JSON.stringify(data, null, 2)}
|
|
28651
28595
|
`);
|
|
28652
28596
|
return;
|
|
@@ -28656,12 +28600,13 @@ function emit(stdout, data, json4, rowsFn, headers) {
|
|
|
28656
28600
|
}
|
|
28657
28601
|
function errorMessage(err) {
|
|
28658
28602
|
if (!(err instanceof Error)) return String(err);
|
|
28603
|
+
if ("messageIsComplete" in err && err.messageIsComplete === true) return err.message;
|
|
28659
28604
|
const data = err.data;
|
|
28660
28605
|
if (typeof data === "string" && data.length > 0) return data;
|
|
28661
28606
|
if (data && typeof data === "object") {
|
|
28662
|
-
const { message:
|
|
28663
|
-
if (typeof
|
|
28664
|
-
return typeof code3 === "string" ? `${
|
|
28607
|
+
const { message: message4, code: code3 } = data;
|
|
28608
|
+
if (typeof message4 === "string" && message4.length > 0) {
|
|
28609
|
+
return typeof code3 === "string" ? `${message4} (${code3})` : message4;
|
|
28665
28610
|
}
|
|
28666
28611
|
return `${err.message}: ${JSON.stringify(data)}`;
|
|
28667
28612
|
}
|
|
@@ -28678,10 +28623,10 @@ function renderTable(rows, headers) {
|
|
|
28678
28623
|
}
|
|
28679
28624
|
|
|
28680
28625
|
// core/errorOutput.ts
|
|
28681
|
-
function writeCommandError(stdout, stderr,
|
|
28682
|
-
const
|
|
28683
|
-
if (!
|
|
28684
|
-
stderr.write(`Error: ${
|
|
28626
|
+
function writeCommandError(stdout, stderr, json3, error62) {
|
|
28627
|
+
const message4 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
|
|
28628
|
+
if (!json3) {
|
|
28629
|
+
stderr.write(`Error: ${message4}
|
|
28685
28630
|
`);
|
|
28686
28631
|
return;
|
|
28687
28632
|
}
|
|
@@ -28689,7 +28634,7 @@ function writeCommandError(stdout, stderr, json4, error62) {
|
|
|
28689
28634
|
const details = data && typeof data === "object" && !Array.isArray(data) ? data : {};
|
|
28690
28635
|
stdout.write(`${JSON.stringify({ error: {
|
|
28691
28636
|
...details,
|
|
28692
|
-
message:
|
|
28637
|
+
message: message4,
|
|
28693
28638
|
...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
|
|
28694
28639
|
} }, null, 2)}
|
|
28695
28640
|
`);
|
|
@@ -28742,27 +28687,34 @@ var BaseCommand = class extends Command {
|
|
|
28742
28687
|
}
|
|
28743
28688
|
};
|
|
28744
28689
|
|
|
28745
|
-
// ente/
|
|
28746
|
-
function
|
|
28690
|
+
// ente/field-pairs.ts
|
|
28691
|
+
function parseFieldPairs(pairs) {
|
|
28747
28692
|
const result = {};
|
|
28748
28693
|
if (!pairs) return result;
|
|
28749
28694
|
for (const pair2 of pairs) {
|
|
28750
28695
|
const eq = pair2.indexOf("=");
|
|
28751
|
-
if (eq === -1) throw new Error(`Invalid
|
|
28696
|
+
if (eq === -1) throw new Error(`Invalid field format: '${pair2}'. Use key=value.`);
|
|
28752
28697
|
result[pair2.slice(0, eq)] = pair2.slice(eq + 1);
|
|
28753
28698
|
}
|
|
28754
28699
|
return result;
|
|
28755
28700
|
}
|
|
28756
|
-
function
|
|
28701
|
+
function parseFieldPairList(pairs) {
|
|
28702
|
+
return (pairs ?? []).map((pair2) => {
|
|
28703
|
+
const eq = pair2.indexOf("=");
|
|
28704
|
+
if (eq === -1) throw new Error(`Invalid field format: '${pair2}'. Use key=value.`);
|
|
28705
|
+
return [pair2.slice(0, eq), pair2.slice(eq + 1)];
|
|
28706
|
+
});
|
|
28707
|
+
}
|
|
28708
|
+
function parseOperationFieldPairs(operation, pairs) {
|
|
28757
28709
|
try {
|
|
28758
|
-
return
|
|
28710
|
+
return parseFieldPairs(pairs);
|
|
28759
28711
|
} catch {
|
|
28760
|
-
throw new OperationInputError(operation, [{ path: ["
|
|
28712
|
+
throw new OperationInputError(operation, [{ path: ["field"], reason: "custom" }]);
|
|
28761
28713
|
}
|
|
28762
28714
|
}
|
|
28763
28715
|
|
|
28764
28716
|
// ente/version.ts
|
|
28765
|
-
var VERSION = "0.4.
|
|
28717
|
+
var VERSION = "0.4.132";
|
|
28766
28718
|
|
|
28767
28719
|
// ente/branding.ts
|
|
28768
28720
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -28791,7 +28743,7 @@ var PLATFORM_CREDENTIAL = {
|
|
|
28791
28743
|
};
|
|
28792
28744
|
|
|
28793
28745
|
// ../packages/shared/src/cli-compatibility.ts
|
|
28794
|
-
var CLI_COMPATIBILITY_LEVEL =
|
|
28746
|
+
var CLI_COMPATIBILITY_LEVEL = 2;
|
|
28795
28747
|
var CLI_VERSION_HEADER = "X-Ente-CLI-Version";
|
|
28796
28748
|
var CLI_COMPATIBILITY_HEADER = "X-Ente-CLI-Compatibility";
|
|
28797
28749
|
function cliCompatibilityHeaders(version5) {
|
|
@@ -28819,10 +28771,16 @@ var activityFieldInputValidator = v.object({
|
|
|
28819
28771
|
value: v.union(v.string(), v.number(), v.boolean(), v.array(v.string()), v.null())
|
|
28820
28772
|
});
|
|
28821
28773
|
|
|
28822
|
-
// ../packages/shared/src/
|
|
28823
|
-
|
|
28824
|
-
|
|
28774
|
+
// ../packages/shared/src/activity-field-errors.ts
|
|
28775
|
+
var ACTIVITY_ATTRIBUTES_RETIRED = 'ACTIVITY_ATTRIBUTES_RETIRED: Activity attributes are now typed fields. REST/MCP: replace "attributes": {"<key>": "\u2026"} with "fields": [{"label": "<key>", "value": "\u2026"}]. Native callers: use activityFields.setValues or activityFields.setCell; value: null removes a value. CLI: run ente update, then use --field key=value. See docs/activity-fields.md for examples.';
|
|
28776
|
+
function hasRetiredActivityAttributes(operation, input2) {
|
|
28777
|
+
if (!input2 || typeof input2 !== "object" || Array.isArray(input2)) return false;
|
|
28778
|
+
if (Object.hasOwn(input2, "attributes")) return true;
|
|
28779
|
+
if (operation !== "batchUpdateTasks" || !("updates" in input2) || !Array.isArray(input2.updates)) return false;
|
|
28780
|
+
return input2.updates.slice(0, 8192).some((item) => item && typeof item === "object" && Object.hasOwn(item, "attributes"));
|
|
28825
28781
|
}
|
|
28782
|
+
|
|
28783
|
+
// ../packages/shared/src/input-fields.ts
|
|
28826
28784
|
function optionalStringArray(value) {
|
|
28827
28785
|
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
|
|
28828
28786
|
}
|
|
@@ -28837,24 +28795,9 @@ function optionalBoolean(value) {
|
|
|
28837
28795
|
function isActivityType(value) {
|
|
28838
28796
|
return typeof value === "string" && ACTIVITY_TYPE_VALUES.some((type) => type === value);
|
|
28839
28797
|
}
|
|
28840
|
-
|
|
28841
|
-
const result = {};
|
|
28842
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
28843
|
-
if (typeof entry !== "string") return void 0;
|
|
28844
|
-
result[key] = entry;
|
|
28845
|
-
}
|
|
28846
|
-
return result;
|
|
28847
|
-
}
|
|
28848
|
-
function updateAttributes(value) {
|
|
28849
|
-
const result = {};
|
|
28850
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
28851
|
-
if (typeof entry !== "string" && entry !== null) return void 0;
|
|
28852
|
-
result[key] = entry;
|
|
28853
|
-
}
|
|
28854
|
-
return result;
|
|
28855
|
-
}
|
|
28856
|
-
var invalid = (message3) => ({ ok: false, message: message3 });
|
|
28798
|
+
var invalid = (message4) => ({ ok: false, message: message4 });
|
|
28857
28799
|
function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
28800
|
+
if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
|
|
28858
28801
|
if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
|
|
28859
28802
|
if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
|
|
28860
28803
|
return invalid(`${name4} sourceCreatedAt must be an object: { date: "YYYY-MM-DD", time?: "HH:mm" | null, timezone?: string }`);
|
|
@@ -28867,9 +28810,6 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28867
28810
|
return invalid(`${name4} deadline must be a readable deadline object or number`);
|
|
28868
28811
|
if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
|
|
28869
28812
|
return invalid(`${name4} agentAssigneeIds must be an array of at most ${MAX_ACTIVITY_AGENT_ASSIGNEES} non-empty IDs`);
|
|
28870
|
-
const attributes2 = isInputRecord(args.attributes) ? stringAttributes(args.attributes) : void 0;
|
|
28871
|
-
if (args.attributes === null || isInputRecord(args.attributes) && attributes2 === void 0)
|
|
28872
|
-
return invalid(`${name4} attributes must contain string values`);
|
|
28873
28813
|
return { ok: true, value: {
|
|
28874
28814
|
entityIds,
|
|
28875
28815
|
type: args.type,
|
|
@@ -28879,7 +28819,6 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28879
28819
|
spaceId: typeof args.spaceId === "string" ? args.spaceId : void 0,
|
|
28880
28820
|
deadline: isDeadlineInput(args.deadline) ? args.deadline : void 0,
|
|
28881
28821
|
completed: optionalBoolean(args.completed),
|
|
28882
|
-
attributes: attributes2,
|
|
28883
28822
|
fields: fields4,
|
|
28884
28823
|
sourceCreatedAt: isSourceCreatedAtInput(args.sourceCreatedAt) ? args.sourceCreatedAt : void 0,
|
|
28885
28824
|
tags: optionalStringArray(args.tags),
|
|
@@ -28890,6 +28829,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28890
28829
|
} };
|
|
28891
28830
|
}
|
|
28892
28831
|
function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
28832
|
+
if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
|
|
28893
28833
|
if (typeof args.activityId !== "string") return invalid(`${name4} requires string activityId`);
|
|
28894
28834
|
if ("deadline" in args && !isNullableDeadlineInput(args.deadline))
|
|
28895
28835
|
return invalid(`${name4} deadline must be a readable deadline object, number, or null`);
|
|
@@ -28899,9 +28839,6 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28899
28839
|
const fields4 = args.fields === void 0 ? void 0 : activityFieldInputsSchema.parse(args.fields);
|
|
28900
28840
|
const entityIds = optionalStringArray(args.entityIds);
|
|
28901
28841
|
if (args.entityIds !== void 0 && !entityIds?.length) return invalid(`${name4} entityIds must be a non-empty string array`);
|
|
28902
|
-
if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid(`${name4} attributes must be an object`);
|
|
28903
|
-
const attributes2 = isInputRecord(args.attributes) ? updateAttributes(args.attributes) : void 0;
|
|
28904
|
-
if (isInputRecord(args.attributes) && attributes2 === void 0) return invalid(`${name4} attributes must contain string or null values`);
|
|
28905
28842
|
for (const key of ["assigneeIds", "assigneeEmails"])
|
|
28906
28843
|
if (args[key] !== void 0 && !optionalStringArray(args[key])) return invalid(`${name4} ${key} must be an array of strings`);
|
|
28907
28844
|
if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
|
|
@@ -28914,7 +28851,6 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28914
28851
|
deadline: isNullableDeadlineInput(args.deadline) ? args.deadline : void 0,
|
|
28915
28852
|
entityIds,
|
|
28916
28853
|
type: isActivityType(args.type) ? args.type : void 0,
|
|
28917
|
-
attributes: attributes2,
|
|
28918
28854
|
fields: fields4,
|
|
28919
28855
|
assigneeIds: optionalStringArray(args.assigneeIds),
|
|
28920
28856
|
assigneeEmails: optionalStringArray(args.assigneeEmails),
|
|
@@ -28939,25 +28875,21 @@ function validDate(value) {
|
|
|
28939
28875
|
var activityWriteDeadline = external_exports.union([external_exports.number(), readableActivityDate]);
|
|
28940
28876
|
var nullableDeadline = activityWriteDeadline.nullable();
|
|
28941
28877
|
var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
|
|
28942
|
-
var
|
|
28943
|
-
var patchAttributes = attributeStringPatch.describe("Legacy input: ACTIVITY_ATTRIBUTES_RETIRED when server retirement is on (default off); use fields.");
|
|
28944
|
-
var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
|
|
28878
|
+
var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
|
|
28945
28879
|
var assignment = external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, action: external_exports.enum(["replace", "add", "remove", "clear"]), assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.describe("At most 20 IDs for replace. Add/remove/clear retain the installed bounded wire array; add deduplicates before enforcing at most 20 assigned agents in the resulting task. Assignment grants no access.").optional() }).refine((value) => value.action !== "replace" || value.agentAssigneeIds === void 0 || value.agentAssigneeIds.length <= MAX_ACTIVITY_AGENT_ASSIGNEES, { path: ["agentAssigneeIds"], message: "Too many replacement agent assignees" });
|
|
28946
|
-
var attributes = external_exports.strictObject({ activityId: id4, action: external_exports.enum(["set", "remove", "replace", "clear"]), attributes: stringAttributes2.optional(), keys: strings.optional() }).refine((value) => value.action !== "set" || value.attributes !== void 0 && Object.keys(value.attributes).length > 0, { path: ["attributes"], message: "set requires attributes" }).refine((value) => value.action !== "remove" || value.keys !== void 0 && value.keys.length > 0, { path: ["keys"], message: "remove requires keys" });
|
|
28947
28880
|
var activityWriteInputs = {
|
|
28948
|
-
createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(),
|
|
28881
|
+
createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), fields: activityFieldInputsSchema.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
|
|
28949
28882
|
updateActivity: external_exports.strictObject(updateFields),
|
|
28950
28883
|
updateActivityTitle: external_exports.strictObject({ activityId: id4, title: external_exports.string() }),
|
|
28951
28884
|
updateActivityDeadline: external_exports.strictObject({ activityId: id4, deadline: nullableDeadline.optional() }),
|
|
28952
28885
|
updateActivityContent: external_exports.strictObject({ activityId: id4, markdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION) }),
|
|
28953
|
-
updateActivityAttributes: attributes,
|
|
28954
28886
|
updateActivityAssignees: assignment,
|
|
28955
28887
|
toggleActivityCompleted: external_exports.strictObject({ activityId: id4 }),
|
|
28956
28888
|
addActivityMessage: external_exports.strictObject({ activityId: id4, content: external_exports.string().regex(/\S/, "Message content is required") }),
|
|
28957
28889
|
deleteActivityMessage: external_exports.strictObject({ messageId: id4 }),
|
|
28958
28890
|
deleteActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28959
28891
|
restoreActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28960
|
-
batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(),
|
|
28892
|
+
batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), fields: activityFieldInputsSchema.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
|
|
28961
28893
|
};
|
|
28962
28894
|
var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
|
|
28963
28895
|
function isActivityWriteOperationName(name4) {
|
|
@@ -28967,6 +28899,7 @@ function parserMismatch(operation) {
|
|
|
28967
28899
|
throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
|
|
28968
28900
|
}
|
|
28969
28901
|
function parseActivityWriteRequest(operation, raw) {
|
|
28902
|
+
rejectActivityAttributesInput(operation, raw);
|
|
28970
28903
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) raw = Object.fromEntries(Object.entries(raw).filter(([key, value]) => value !== void 0 || !Object.hasOwn(activityWriteInputs[operation].shape, key)));
|
|
28971
28904
|
switch (operation) {
|
|
28972
28905
|
case "createActivity": {
|
|
@@ -28985,8 +28918,6 @@ function parseActivityWriteRequest(operation, raw) {
|
|
|
28985
28918
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityDeadline, raw) };
|
|
28986
28919
|
case "updateActivityContent":
|
|
28987
28920
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityContent, raw) };
|
|
28988
|
-
case "updateActivityAttributes":
|
|
28989
|
-
return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityAttributes, raw) };
|
|
28990
28921
|
case "updateActivityAssignees":
|
|
28991
28922
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityAssignees, raw) };
|
|
28992
28923
|
case "toggleActivityCompleted":
|
|
@@ -29003,6 +28934,13 @@ function parseActivityWriteRequest(operation, raw) {
|
|
|
29003
28934
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.batchUpdateTasks, raw) };
|
|
29004
28935
|
}
|
|
29005
28936
|
}
|
|
28937
|
+
function rejectActivityAttributesInput(operation, raw) {
|
|
28938
|
+
if (!hasRetiredActivityAttributes(operation, raw)) return;
|
|
28939
|
+
const error62 = new OperationInputError(operation, [{ path: ["attributes"], reason: "unrecognized_keys" }]);
|
|
28940
|
+
error62.message = ACTIVITY_ATTRIBUTES_RETIRED;
|
|
28941
|
+
Object.assign(error62, { messageIsComplete: true });
|
|
28942
|
+
throw error62;
|
|
28943
|
+
}
|
|
29006
28944
|
|
|
29007
28945
|
// ../packages/shared/src/activity-write-operation-results.ts
|
|
29008
28946
|
var id5 = external_exports.string().min(1);
|
|
@@ -29013,7 +28951,6 @@ var activityWriteResults = {
|
|
|
29013
28951
|
updateActivityTitle: ack,
|
|
29014
28952
|
updateActivityDeadline: ack,
|
|
29015
28953
|
updateActivityContent: ack,
|
|
29016
|
-
updateActivityAttributes: ack,
|
|
29017
28954
|
updateActivityAssignees: ack,
|
|
29018
28955
|
toggleActivityCompleted: external_exports.strictObject({ completed: external_exports.boolean() }),
|
|
29019
28956
|
addActivityMessage: external_exports.strictObject({ messageId: id5 }),
|
|
@@ -29109,15 +29046,14 @@ function operationResultSchema(validator) {
|
|
|
29109
29046
|
}
|
|
29110
29047
|
|
|
29111
29048
|
// ../packages/shared/src/activity-write-catalog.ts
|
|
29112
|
-
var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "
|
|
29049
|
+
var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "toggleActivityCompleted", "batchUpdateTasks"]);
|
|
29113
29050
|
var descriptions = {
|
|
29114
|
-
createActivity: "Create in an explicit space with existing owners. externalKey reserves an agent-and-space task key atomically; retries return the first ID without applying changed fields, including completed/deleted tasks. sourceCreatedAt is for imports. fields use label or fieldId, optional type and typed value; null clears. JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
|
|
29115
|
-
updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears,
|
|
29051
|
+
createActivity: "Create in an explicit space with existing owners. externalKey reserves an agent-and-space task key atomically; retries return the first ID without applying changed fields, including completed/deleted tasks. sourceCreatedAt is for imports. fields use label or fieldId, optional type and typed value; null clears. A string list replaces a list field (text, url, email, phone, address, multi-select). JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
|
|
29052
|
+
updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, a string list replaces a list field (text, url, email, phone, postal-address, salutation, job-title, multi-select); give type when a new label holds a list, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped. The removed attributes input is rejected; use fields. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
|
|
29116
29053
|
updateActivityTitle: "Set or clear an activity title. Existing revision and verified updater bookkeeping stay in the same transaction.",
|
|
29117
29054
|
updateActivityDeadline: "Set a readable or finite epoch deadline; null clears it and omission leaves it unchanged in this profile.",
|
|
29118
29055
|
updateActivityContent: "Replace the ordinary activity body with markdown, preserving revisions and read-only provider-email policy. Version-window editing is a separate operation family.",
|
|
29119
|
-
|
|
29120
|
-
updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports commit; legacy enrichment is later.",
|
|
29056
|
+
updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports the committed mutation.",
|
|
29121
29057
|
toggleActivityCompleted: "Toggle using the native read-then-set profile. The inverse is selected before the write, so concurrent toggles are not serialized as repeated atomic flips. Receipt reports the completed value committed by this write. Explicit updateActivity.completed remains idempotent.",
|
|
29122
29058
|
addActivityMessage: "Append an ordinary activity discussion message with verified author and agent identity. This is separate from human-only Native Messenger and from edits to the parent activity body.",
|
|
29123
29059
|
deleteActivityMessage: "Permanently delete an activity message you authored. Agents delete only their own agent's messages.",
|
|
@@ -29141,10 +29077,6 @@ function definition(name4) {
|
|
|
29141
29077
|
const conditions = name4 === "updateActivityAssignees" ? [{ anyOf: [
|
|
29142
29078
|
{ type: "object", properties: { action: { enum: ["add", "remove", "clear"] } } },
|
|
29143
29079
|
{ type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
|
|
29144
|
-
] }] : name4 === "updateActivityAttributes" ? [{ anyOf: [
|
|
29145
|
-
{ type: "object", properties: { ...properties, action: { enum: ["replace", "clear"] } }, additionalProperties: false },
|
|
29146
|
-
{ type: "object", properties: { ...properties, action: { const: "set" }, attributes: { ...propertySchema(properties.attributes), minProperties: 1 } }, required: ["attributes"], additionalProperties: false },
|
|
29147
|
-
{ type: "object", properties: { ...properties, action: { const: "remove" }, keys: { ...propertySchema(properties.keys), minItems: 1 } }, required: ["keys"], additionalProperties: false }
|
|
29148
29080
|
] }] : void 0;
|
|
29149
29081
|
const resultSchema3 = external_exports.toJSONSchema(activityWriteResults[name4]);
|
|
29150
29082
|
return {
|
|
@@ -29160,14 +29092,12 @@ function definition(name4) {
|
|
|
29160
29092
|
environment: "content",
|
|
29161
29093
|
executionProfile: "full",
|
|
29162
29094
|
resultProjection: "commit-receipt",
|
|
29163
|
-
availability: { hosted:
|
|
29095
|
+
availability: { hosted: true, external: Object.values(activityWriteAliases).some((operation) => operation === name4), browserHuman: false, agentConnection: Object.values(activityWriteAliases).some((operation) => operation === name4), executionProfiles: ["full", "public-cli"], runtime: composite.has(name4) ? "action" : "mutation" },
|
|
29164
29096
|
limits: ACTIVITY_WRITE_LIMITS,
|
|
29165
29097
|
profiles: {
|
|
29166
29098
|
rest: { available: ["createActivity", "updateActivity", "updateActivityAssignees", "deleteActivity", "restoreActivity"].includes(name4), result: "commit-receipt" },
|
|
29167
29099
|
canonical: { result: "commit-receipt", wholeActionRollback: !composite.has(name4), concurrency: composite.has(name4) ? "existing-native-stages" : "protected-transaction" },
|
|
29168
|
-
|
|
29169
|
-
legacyMcp: { primary: false, result: "installed-alias-wrapper", createEmptyAutoLinks: "omitted", messageSuccessFlag: false },
|
|
29170
|
-
publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedDatabaseAttributes: name4 === "updateActivity" || name4 === "updateActivityAttributes" },
|
|
29100
|
+
publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedFields: name4 === "updateActivity" },
|
|
29171
29101
|
realtime: { primary: false, available: name4 === "createActivity", source: "verified-session-createTask", speechAndLeaseRequired: true, finishAndResultValidation: "same-transaction" }
|
|
29172
29102
|
},
|
|
29173
29103
|
compatibilityAliases: Object.entries(activityWriteAliases).filter(([, operation]) => operation === name4).map(([alias]) => alias),
|
|
@@ -29999,11 +29929,11 @@ function mapPayloads(operation, raw, transform2) {
|
|
|
29999
29929
|
if (operation !== "agent_thread_get") return raw;
|
|
30000
29930
|
if (!matchesResultShape(operatorThreadDetailValidator, raw)) throw new OperationResultError(operation);
|
|
30001
29931
|
if (!raw) return null;
|
|
30002
|
-
return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((
|
|
30003
|
-
...
|
|
30004
|
-
...
|
|
30005
|
-
...
|
|
30006
|
-
...
|
|
29932
|
+
return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message4) => ({
|
|
29933
|
+
...message4,
|
|
29934
|
+
...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
|
|
29935
|
+
...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
|
|
29936
|
+
...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
|
|
30007
29937
|
})) } };
|
|
30008
29938
|
}
|
|
30009
29939
|
function checkPageBounds(operation, data) {
|
|
@@ -30017,9 +29947,9 @@ function checkPageBounds(operation, data) {
|
|
|
30017
29947
|
}
|
|
30018
29948
|
function parseAgentContextResult(operation, raw) {
|
|
30019
29949
|
if (!matchesResultShape(agentContextResults[operation], raw)) throw new OperationResultError(operation);
|
|
30020
|
-
const
|
|
30021
|
-
parseOperationResult(operation, agentContextResults[operation],
|
|
30022
|
-
checkPageBounds(operation,
|
|
29950
|
+
const json3 = mapPayloads(operation, raw, encodeAgentContextPayload);
|
|
29951
|
+
parseOperationResult(operation, agentContextResults[operation], json3);
|
|
29952
|
+
checkPageBounds(operation, json3);
|
|
30023
29953
|
return raw;
|
|
30024
29954
|
}
|
|
30025
29955
|
function parseAgentContextJsonResult(operation, raw) {
|
|
@@ -33252,9 +33182,7 @@ var activityReadFields = {
|
|
|
33252
33182
|
tags: external_exports.array(external_exports.string()).optional(),
|
|
33253
33183
|
assigneeIds: external_exports.array(id10).optional(),
|
|
33254
33184
|
agentAssigneeIds: external_exports.array(id10).optional(),
|
|
33255
|
-
|
|
33256
|
-
fields: external_exports.array(externalActivityFieldValueSchema).optional(),
|
|
33257
|
-
fieldIndexReady: external_exports.boolean().optional(),
|
|
33185
|
+
fields: external_exports.array(externalActivityFieldValueSchema),
|
|
33258
33186
|
createdAt: external_exports.number(),
|
|
33259
33187
|
updatedAt: external_exports.number(),
|
|
33260
33188
|
spaceId: id10,
|
|
@@ -33289,7 +33217,7 @@ var selectRichEntity = external_exports.object({ ...selectPublicEntityRead.shape
|
|
|
33289
33217
|
var selectSearch = external_exports.object({ ...entityReadFullSearch.shape, entities: external_exports.array(external_exports.object({ entity: selectRichEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), selectSpace) });
|
|
33290
33218
|
var selectDetail = external_exports.object({ ...entityReadFullDetail.unwrap().shape, entity: selectRichEntity, activities: external_exports.array(selectPublicActivityRead), spaces: external_exports.array(selectSpace) }).nullable();
|
|
33291
33219
|
var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
|
|
33292
|
-
var compactActivity = entityReadActivity.pick({ fields: true,
|
|
33220
|
+
var compactActivity = entityReadActivity.pick({ fields: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true });
|
|
33293
33221
|
var compactList = entityReadFullList.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
33294
33222
|
var compactSearch = entityReadFullSearch.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
33295
33223
|
var compactDetail = entityReadFullDetail.unwrap().extend({ entity: compactEntity, activities: external_exports.array(compactActivity), spaces: external_exports.array(compactSpace) }).nullable();
|
|
@@ -33364,7 +33292,7 @@ var ENTITY_CREATE_INPUT_SCHEMA = {
|
|
|
33364
33292
|
function isEntityType(value) {
|
|
33365
33293
|
return typeof value === "string" && ENTITY_TYPE_VALUES.some((type) => type === value);
|
|
33366
33294
|
}
|
|
33367
|
-
var invalid2 = (
|
|
33295
|
+
var invalid2 = (message4) => ({ ok: false, message: message4 });
|
|
33368
33296
|
function parseEntityCreateInput(args, name4 = "entities_create") {
|
|
33369
33297
|
if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
|
|
33370
33298
|
if (args.parentEntityId !== void 0 && (typeof args.parentEntityId !== "string" || !args.parentEntityId.trim()))
|
|
@@ -33573,8 +33501,8 @@ var selectDetail2 = external_exports.object({
|
|
|
33573
33501
|
agendaPoints: external_exports.array(external_exports.object(agenda.shape)),
|
|
33574
33502
|
messages: external_exports.array(external_exports.object({ ...message.shape, createdByUser: selectUser.nullable(), createdByAgent: selectAgent.nullable().optional(), updatedByAgent: selectAgent.nullable().optional() }))
|
|
33575
33503
|
}).nullable();
|
|
33576
|
-
var compactActivity2 = publicActivityRecordDto.pick({ fields: true,
|
|
33577
|
-
var compactDetail2 = publicActivityDetailDto.omit({
|
|
33504
|
+
var compactActivity2 = publicActivityRecordDto.pick({ fields: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true, createdBy: true, deletedAt: true });
|
|
33505
|
+
var compactDetail2 = publicActivityDetailDto.omit({ attachments: true }).extend({
|
|
33578
33506
|
entityDetails: external_exports.array(external_exports.strictObject(publicEntityReadDto.shape).pick({ _id: true, name: true, type: true, displayName: true, parentNames: true, parentDetails: true }).nullable())
|
|
33579
33507
|
});
|
|
33580
33508
|
var pageFields = { hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional() };
|
|
@@ -33644,7 +33572,7 @@ var fields2 = {
|
|
|
33644
33572
|
release: ["assignmentId", "claimToken"]
|
|
33645
33573
|
};
|
|
33646
33574
|
function validateAgentTaskInput(raw) {
|
|
33647
|
-
const invalid4 = (
|
|
33575
|
+
const invalid4 = (message4) => ({ ok: false, message: message4 });
|
|
33648
33576
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return invalid4("Task input must be an object");
|
|
33649
33577
|
const input2 = raw;
|
|
33650
33578
|
if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return invalid4("Unknown task operation");
|
|
@@ -33832,8 +33760,7 @@ var queueItemValidator = v.object({
|
|
|
33832
33760
|
assignmentId: v.id("taskAgentAssignments"),
|
|
33833
33761
|
activityId: v.id("activities"),
|
|
33834
33762
|
spaceId: v.id("spaces"),
|
|
33835
|
-
fields: v.
|
|
33836
|
-
fieldIndexReady: v.optional(v.boolean()),
|
|
33763
|
+
fields: v.array(externalActivityFieldValueValidator),
|
|
33837
33764
|
title: v.optional(v.string()),
|
|
33838
33765
|
deadline: v.optional(v.number()),
|
|
33839
33766
|
completed: v.boolean(),
|
|
@@ -34267,7 +34194,7 @@ var RestClient = class {
|
|
|
34267
34194
|
}
|
|
34268
34195
|
};
|
|
34269
34196
|
function toApiError(status2, statusText, text3) {
|
|
34270
|
-
let
|
|
34197
|
+
let message4 = statusText || "Unknown error";
|
|
34271
34198
|
let structured = {};
|
|
34272
34199
|
if (text3) {
|
|
34273
34200
|
try {
|
|
@@ -34276,14 +34203,14 @@ function toApiError(status2, statusText, text3) {
|
|
|
34276
34203
|
if (raw && typeof raw === "object") {
|
|
34277
34204
|
structured = raw;
|
|
34278
34205
|
const m = raw.message;
|
|
34279
|
-
if (typeof m === "string")
|
|
34206
|
+
if (typeof m === "string") message4 = m;
|
|
34280
34207
|
} else if (typeof raw === "string") {
|
|
34281
|
-
|
|
34208
|
+
message4 = raw;
|
|
34282
34209
|
}
|
|
34283
34210
|
} catch {
|
|
34284
34211
|
}
|
|
34285
34212
|
}
|
|
34286
|
-
return new ApiError(status2,
|
|
34213
|
+
return new ApiError(status2, message4, structured);
|
|
34287
34214
|
}
|
|
34288
34215
|
|
|
34289
34216
|
// core/config.ts
|
|
@@ -34331,10 +34258,10 @@ var TomlError = class _TomlError extends Error {
|
|
|
34331
34258
|
line;
|
|
34332
34259
|
column;
|
|
34333
34260
|
codeblock;
|
|
34334
|
-
constructor(
|
|
34261
|
+
constructor(message4, options) {
|
|
34335
34262
|
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
34336
34263
|
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
34337
|
-
super(`Invalid TOML document: ${
|
|
34264
|
+
super(`Invalid TOML document: ${message4}
|
|
34338
34265
|
|
|
34339
34266
|
${codeblock}`, options);
|
|
34340
34267
|
this.line = line;
|
|
@@ -34342,8 +34269,8 @@ ${codeblock}`, options);
|
|
|
34342
34269
|
this.codeblock = codeblock;
|
|
34343
34270
|
}
|
|
34344
34271
|
/** @internal */
|
|
34345
|
-
static x(
|
|
34346
|
-
throw new _TomlError(
|
|
34272
|
+
static x(message4, ctx, ptr) {
|
|
34273
|
+
throw new _TomlError(message4, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
34347
34274
|
}
|
|
34348
34275
|
};
|
|
34349
34276
|
|
|
@@ -35303,7 +35230,10 @@ var EnteClient = class _EnteClient {
|
|
|
35303
35230
|
const request = parseActivityWriteRequest(operation, input2);
|
|
35304
35231
|
const binding = activityWriteRestBindings.find((item) => item.operation === operation);
|
|
35305
35232
|
if (!binding) throw new Error("Operation has no REST binding");
|
|
35306
|
-
const response = await this.rest.sendJson(binding.method, binding.path, request.input)
|
|
35233
|
+
const response = await this.rest.sendJson(binding.method, binding.path, request.input).catch((error62) => {
|
|
35234
|
+
if (error62 instanceof ApiError && error62.detail.startsWith("ACTIVITY_ATTRIBUTES_RETIRED:")) error62.message = error62.detail;
|
|
35235
|
+
throw error62;
|
|
35236
|
+
});
|
|
35307
35237
|
return { data: parseZodOperationResult(operation, activityWriteResults[operation], response.data) };
|
|
35308
35238
|
}
|
|
35309
35239
|
async activityRead(operation, input2) {
|
|
@@ -35832,11 +35762,11 @@ function formatActivityDetail(a) {
|
|
|
35832
35762
|
if (a.messages?.length) {
|
|
35833
35763
|
lines.push("");
|
|
35834
35764
|
lines.push(`Messages (${a.messages.length}):`);
|
|
35835
|
-
for (const
|
|
35836
|
-
const indent = " ".repeat(
|
|
35837
|
-
const author =
|
|
35838
|
-
const contentLines =
|
|
35839
|
-
const replyTarget =
|
|
35765
|
+
for (const message4 of a.messages) {
|
|
35766
|
+
const indent = " ".repeat(message4.depth ?? 0);
|
|
35767
|
+
const author = message4.createdByUser?.name || message4.createdByUser?.email || message4.createdBy;
|
|
35768
|
+
const contentLines = message4.contentPlainText.split("\n");
|
|
35769
|
+
const replyTarget = message4.parentMessageId ? ` [reply to ${message4.parentMessageId}]` : "";
|
|
35840
35770
|
lines.push(`${indent}${author}: ${contentLines[0] ?? ""}${replyTarget}`);
|
|
35841
35771
|
for (const contentLine of contentLines.slice(1))
|
|
35842
35772
|
lines.push(`${indent} ${contentLine}`);
|
|
@@ -35975,7 +35905,7 @@ ${footer}` : body;
|
|
|
35975
35905
|
}
|
|
35976
35906
|
// --- shared: activity list (used by `activity list` and `tasks`) --------
|
|
35977
35907
|
async runActivityList(opts) {
|
|
35978
|
-
const attrDict =
|
|
35908
|
+
const attrDict = parseOperationFieldPairs("listActivities", opts.attrFilter);
|
|
35979
35909
|
if (Object.keys(attrDict).length) {
|
|
35980
35910
|
if (opts.compact || opts.cursor !== void 0 || opts.minCount !== void 0) throw new Error("Indexed field filters do not accept history cursors or minimum counts");
|
|
35981
35911
|
const filters = (opts.attrFilter ?? []).map((raw) => {
|
|
@@ -36440,8 +36370,8 @@ var AgentPermissions = class extends ClientCommand {
|
|
|
36440
36370
|
if (matches.length !== 1) throw new Error(matches.length ? `Space '${query}' is ambiguous; use its ID.` : `Space '${query}' was not found in this account; check its ID and account membership.`);
|
|
36441
36371
|
const space3 = matches[0];
|
|
36442
36372
|
const allowed = this.action === "write" ? space3.canWrite : space3.canRead;
|
|
36443
|
-
const
|
|
36444
|
-
this.emitText({ ...selection2, allowed, action: this.action, ...space3, message:
|
|
36373
|
+
const message4 = allowed ? `${this.action} allowed in '${space3.name}' for agent '${identity2.name}'.` : `${this.action} denied in '${space3.name}' for agent '${identity2.name}' (effective access: ${space3.access}). In the web app, check this agent's per-space 'Agent actions' setting and this key's read/write scopes in Connections. Connection and OAuth consent limits also apply.`;
|
|
36374
|
+
this.emitText({ ...selection2, allowed, action: this.action, ...space3, message: message4 }, () => message4);
|
|
36445
36375
|
return allowed ? 0 : 1;
|
|
36446
36376
|
}
|
|
36447
36377
|
this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((space3) => ({
|
|
@@ -36549,24 +36479,24 @@ function instantiateDefaultLogger(options) {
|
|
|
36549
36479
|
function instantiateNoopLogger(options) {
|
|
36550
36480
|
return new DefaultLogger(options);
|
|
36551
36481
|
}
|
|
36552
|
-
function logForFunction(logger, type, source2, udfPath,
|
|
36482
|
+
function logForFunction(logger, type, source2, udfPath, message4) {
|
|
36553
36483
|
const prefix = prefix_for_source(source2);
|
|
36554
|
-
if (typeof
|
|
36555
|
-
|
|
36484
|
+
if (typeof message4 === "object") {
|
|
36485
|
+
message4 = `ConvexError ${JSON.stringify(message4.errorData, null, 2)}`;
|
|
36556
36486
|
}
|
|
36557
36487
|
if (type === "info") {
|
|
36558
|
-
const match =
|
|
36488
|
+
const match = message4.match(/^\[.*?\] /);
|
|
36559
36489
|
if (match === null) {
|
|
36560
36490
|
logger.error(
|
|
36561
36491
|
`[CONVEX ${prefix}(${udfPath})] Could not parse console.log`
|
|
36562
36492
|
);
|
|
36563
36493
|
return;
|
|
36564
36494
|
}
|
|
36565
|
-
const level =
|
|
36566
|
-
const args =
|
|
36495
|
+
const level = message4.slice(1, match[0].length - 2);
|
|
36496
|
+
const args = message4.slice(match[0].length);
|
|
36567
36497
|
logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
|
|
36568
36498
|
} else {
|
|
36569
|
-
logger.error(`[CONVEX ${prefix}(${udfPath})] ${
|
|
36499
|
+
logger.error(`[CONVEX ${prefix}(${udfPath})] ${message4}`);
|
|
36570
36500
|
}
|
|
36571
36501
|
}
|
|
36572
36502
|
|
|
@@ -38265,11 +38195,11 @@ var require_receiver = __commonJS2({
|
|
|
38265
38195
|
* @return {(Error|RangeError)} The error
|
|
38266
38196
|
* @private
|
|
38267
38197
|
*/
|
|
38268
|
-
createError(ErrorCtor,
|
|
38198
|
+
createError(ErrorCtor, message4, prefix, statusCode, errorCode) {
|
|
38269
38199
|
this._loop = false;
|
|
38270
38200
|
this._errored = true;
|
|
38271
38201
|
const err = new ErrorCtor(
|
|
38272
|
-
prefix ? `Invalid WebSocket frame: ${
|
|
38202
|
+
prefix ? `Invalid WebSocket frame: ${message4}` : message4
|
|
38273
38203
|
);
|
|
38274
38204
|
Error.captureStackTrace(err, this.createError);
|
|
38275
38205
|
err.code = errorCode;
|
|
@@ -38931,10 +38861,10 @@ var require_event_target = __commonJS2({
|
|
|
38931
38861
|
callListener(handler, this, event);
|
|
38932
38862
|
};
|
|
38933
38863
|
} else if (type === "close") {
|
|
38934
|
-
wrapper = function onClose(code3,
|
|
38864
|
+
wrapper = function onClose(code3, message4) {
|
|
38935
38865
|
const event = new CloseEvent("close", {
|
|
38936
38866
|
code: code3,
|
|
38937
|
-
reason:
|
|
38867
|
+
reason: message4.toString(),
|
|
38938
38868
|
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
38939
38869
|
});
|
|
38940
38870
|
event[kTarget] = this;
|
|
@@ -39849,29 +39779,29 @@ var require_websocket = __commonJS2({
|
|
|
39849
39779
|
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
39850
39780
|
if (secWebSocketExtensions !== void 0) {
|
|
39851
39781
|
if (!perMessageDeflate) {
|
|
39852
|
-
const
|
|
39853
|
-
abortHandshake(websocket, socket,
|
|
39782
|
+
const message4 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
|
|
39783
|
+
abortHandshake(websocket, socket, message4);
|
|
39854
39784
|
return;
|
|
39855
39785
|
}
|
|
39856
39786
|
let extensions;
|
|
39857
39787
|
try {
|
|
39858
39788
|
extensions = parse4(secWebSocketExtensions);
|
|
39859
39789
|
} catch (err) {
|
|
39860
|
-
const
|
|
39861
|
-
abortHandshake(websocket, socket,
|
|
39790
|
+
const message4 = "Invalid Sec-WebSocket-Extensions header";
|
|
39791
|
+
abortHandshake(websocket, socket, message4);
|
|
39862
39792
|
return;
|
|
39863
39793
|
}
|
|
39864
39794
|
const extensionNames = Object.keys(extensions);
|
|
39865
39795
|
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
39866
|
-
const
|
|
39867
|
-
abortHandshake(websocket, socket,
|
|
39796
|
+
const message4 = "Server indicated an extension that was not requested";
|
|
39797
|
+
abortHandshake(websocket, socket, message4);
|
|
39868
39798
|
return;
|
|
39869
39799
|
}
|
|
39870
39800
|
try {
|
|
39871
39801
|
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
39872
39802
|
} catch (err) {
|
|
39873
|
-
const
|
|
39874
|
-
abortHandshake(websocket, socket,
|
|
39803
|
+
const message4 = "Invalid Sec-WebSocket-Extensions header";
|
|
39804
|
+
abortHandshake(websocket, socket, message4);
|
|
39875
39805
|
return;
|
|
39876
39806
|
}
|
|
39877
39807
|
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
@@ -39908,9 +39838,9 @@ var require_websocket = __commonJS2({
|
|
|
39908
39838
|
}
|
|
39909
39839
|
return tls.connect(options);
|
|
39910
39840
|
}
|
|
39911
|
-
function abortHandshake(websocket, stream,
|
|
39841
|
+
function abortHandshake(websocket, stream, message4) {
|
|
39912
39842
|
websocket._readyState = WebSocket2.CLOSING;
|
|
39913
|
-
const err = new Error(
|
|
39843
|
+
const err = new Error(message4);
|
|
39914
39844
|
Error.captureStackTrace(err, abortHandshake);
|
|
39915
39845
|
if (stream.setHeader) {
|
|
39916
39846
|
stream[kAborted] = true;
|
|
@@ -40072,7 +40002,7 @@ var require_stream = __commonJS2({
|
|
|
40072
40002
|
objectMode: false,
|
|
40073
40003
|
writableObjectMode: false
|
|
40074
40004
|
});
|
|
40075
|
-
ws.on("message", function
|
|
40005
|
+
ws.on("message", function message4(msg, isBinary) {
|
|
40076
40006
|
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
40077
40007
|
if (!duplex.push(data)) ws.pause();
|
|
40078
40008
|
});
|
|
@@ -40391,23 +40321,23 @@ var require_websocket_server = __commonJS2({
|
|
|
40391
40321
|
const upgrade = req.headers.upgrade;
|
|
40392
40322
|
const version5 = +req.headers["sec-websocket-version"];
|
|
40393
40323
|
if (req.method !== "GET") {
|
|
40394
|
-
const
|
|
40395
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405,
|
|
40324
|
+
const message4 = "Invalid HTTP method";
|
|
40325
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message4);
|
|
40396
40326
|
return;
|
|
40397
40327
|
}
|
|
40398
40328
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
40399
|
-
const
|
|
40400
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40329
|
+
const message4 = "Invalid Upgrade header";
|
|
40330
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
|
|
40401
40331
|
return;
|
|
40402
40332
|
}
|
|
40403
40333
|
if (key === void 0 || !keyRegex.test(key)) {
|
|
40404
|
-
const
|
|
40405
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40334
|
+
const message4 = "Missing or invalid Sec-WebSocket-Key header";
|
|
40335
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
|
|
40406
40336
|
return;
|
|
40407
40337
|
}
|
|
40408
40338
|
if (version5 !== 13 && version5 !== 8) {
|
|
40409
|
-
const
|
|
40410
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40339
|
+
const message4 = "Missing or invalid Sec-WebSocket-Version header";
|
|
40340
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4, {
|
|
40411
40341
|
"Sec-WebSocket-Version": "13, 8"
|
|
40412
40342
|
});
|
|
40413
40343
|
return;
|
|
@@ -40422,8 +40352,8 @@ var require_websocket_server = __commonJS2({
|
|
|
40422
40352
|
try {
|
|
40423
40353
|
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
40424
40354
|
} catch (err) {
|
|
40425
|
-
const
|
|
40426
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40355
|
+
const message4 = "Invalid Sec-WebSocket-Protocol header";
|
|
40356
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
|
|
40427
40357
|
return;
|
|
40428
40358
|
}
|
|
40429
40359
|
}
|
|
@@ -40442,8 +40372,8 @@ var require_websocket_server = __commonJS2({
|
|
|
40442
40372
|
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
40443
40373
|
}
|
|
40444
40374
|
} catch (err) {
|
|
40445
|
-
const
|
|
40446
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40375
|
+
const message4 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
40376
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
|
|
40447
40377
|
return;
|
|
40448
40378
|
}
|
|
40449
40379
|
}
|
|
@@ -40454,9 +40384,9 @@ var require_websocket_server = __commonJS2({
|
|
|
40454
40384
|
req
|
|
40455
40385
|
};
|
|
40456
40386
|
if (this.options.verifyClient.length === 2) {
|
|
40457
|
-
this.options.verifyClient(info, (verified, code3,
|
|
40387
|
+
this.options.verifyClient(info, (verified, code3, message4, headers) => {
|
|
40458
40388
|
if (!verified) {
|
|
40459
|
-
return abortHandshake(socket, code3 || 401,
|
|
40389
|
+
return abortHandshake(socket, code3 || 401, message4, headers);
|
|
40460
40390
|
}
|
|
40461
40391
|
this.completeUpgrade(
|
|
40462
40392
|
extensions,
|
|
@@ -40556,27 +40486,27 @@ var require_websocket_server = __commonJS2({
|
|
|
40556
40486
|
function socketOnError() {
|
|
40557
40487
|
this.destroy();
|
|
40558
40488
|
}
|
|
40559
|
-
function abortHandshake(socket, code3,
|
|
40560
|
-
|
|
40489
|
+
function abortHandshake(socket, code3, message4, headers) {
|
|
40490
|
+
message4 = message4 || http.STATUS_CODES[code3];
|
|
40561
40491
|
headers = {
|
|
40562
40492
|
Connection: "close",
|
|
40563
40493
|
"Content-Type": "text/html",
|
|
40564
|
-
"Content-Length": Buffer.byteLength(
|
|
40494
|
+
"Content-Length": Buffer.byteLength(message4),
|
|
40565
40495
|
...headers
|
|
40566
40496
|
};
|
|
40567
40497
|
socket.once("finish", socket.destroy);
|
|
40568
40498
|
socket.end(
|
|
40569
40499
|
`HTTP/1.1 ${code3} ${http.STATUS_CODES[code3]}\r
|
|
40570
|
-
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" +
|
|
40500
|
+
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message4
|
|
40571
40501
|
);
|
|
40572
40502
|
}
|
|
40573
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code3,
|
|
40503
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message4, headers) {
|
|
40574
40504
|
if (server.listenerCount("wsClientError")) {
|
|
40575
|
-
const err = new Error(
|
|
40505
|
+
const err = new Error(message4);
|
|
40576
40506
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
40577
40507
|
server.emit("wsClientError", err, socket, req);
|
|
40578
40508
|
} else {
|
|
40579
|
-
abortHandshake(socket, code3,
|
|
40509
|
+
abortHandshake(socket, code3, message4, headers);
|
|
40580
40510
|
}
|
|
40581
40511
|
}
|
|
40582
40512
|
}
|
|
@@ -41118,9 +41048,9 @@ function isAuthError(err, structuredOnly = false) {
|
|
|
41118
41048
|
if (structuredOnly) return false;
|
|
41119
41049
|
return /\b(401|403|unauthenticated|unauthorized|not authenticated)\b/i.test(msg);
|
|
41120
41050
|
}
|
|
41121
|
-
function convexHttpErrorCode(
|
|
41051
|
+
function convexHttpErrorCode(message4) {
|
|
41122
41052
|
try {
|
|
41123
|
-
const body = JSON.parse(
|
|
41053
|
+
const body = JSON.parse(message4);
|
|
41124
41054
|
return body && typeof body === "object" && "code" in body && typeof body.code === "string" ? body.code : null;
|
|
41125
41055
|
} catch {
|
|
41126
41056
|
return null;
|
|
@@ -41245,9 +41175,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41245
41175
|
const creds = allowAgentReads && selected ? void 0 : loadPlatformCredentials();
|
|
41246
41176
|
if (!creds) {
|
|
41247
41177
|
if (!allowAgentReads) throw new Error("These admin commands need a platform key. Agent Platform access covers tables, get and page only.");
|
|
41248
|
-
const
|
|
41178
|
+
const agent3 = await resolveCaller();
|
|
41249
41179
|
return {
|
|
41250
|
-
...
|
|
41180
|
+
...agent3,
|
|
41251
41181
|
query: async (reference, args) => {
|
|
41252
41182
|
const { getFunctionName: getFunctionName3 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
41253
41183
|
const name4 = getFunctionName3(reference);
|
|
@@ -41255,9 +41185,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41255
41185
|
if (!name4.startsWith("admin/inspect:") || !["tables", "get", "page"].includes(operation)) {
|
|
41256
41186
|
throw new Error("Agent Platform access covers admin tables, get and page only");
|
|
41257
41187
|
}
|
|
41258
|
-
if (operation === "tables") return
|
|
41259
|
-
if (operation === "get") return
|
|
41260
|
-
return
|
|
41188
|
+
if (operation === "tables") return agent3.mutation(makeFunctionReference2("admin/inspect:agentTables"), {});
|
|
41189
|
+
if (operation === "get") return agent3.mutation(makeFunctionReference2("admin/inspect:agentGet"), args);
|
|
41190
|
+
return agent3.mutation(makeFunctionReference2("admin/inspect:agentPage"), args);
|
|
41261
41191
|
}
|
|
41262
41192
|
};
|
|
41263
41193
|
}
|
|
@@ -41777,41 +41707,65 @@ var taskReadInputs = {
|
|
|
41777
41707
|
listOpenTasksForEntity: external_exports.strictObject({ entityId: id16 })
|
|
41778
41708
|
};
|
|
41779
41709
|
|
|
41780
|
-
// ../packages/shared/src/activity-read-
|
|
41781
|
-
var
|
|
41782
|
-
var
|
|
41783
|
-
var
|
|
41710
|
+
// ../packages/shared/src/activity-read-transport-results.ts
|
|
41711
|
+
var attachment2 = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
|
|
41712
|
+
var user2 = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
|
|
41713
|
+
var agent2 = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
|
|
41714
|
+
var agentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
|
|
41715
|
+
var agenda2 = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
|
|
41716
|
+
var message2 = external_exports.object({
|
|
41717
|
+
...publicActivityDetailDto.shape.messages.element.shape,
|
|
41718
|
+
createdByUser: user2.nullable(),
|
|
41719
|
+
createdByAgent: agent2.nullable().optional(),
|
|
41720
|
+
updatedByAgent: agent2.nullable().optional()
|
|
41721
|
+
});
|
|
41722
|
+
var activityReadRecord = external_exports.object({
|
|
41723
|
+
...publicActivityReadDto.shape,
|
|
41724
|
+
attachments: external_exports.array(attachment2).optional(),
|
|
41725
|
+
entityIds: external_exports.array(external_exports.string()).optional(),
|
|
41726
|
+
entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
|
|
41727
|
+
agendaPoints: external_exports.array(agenda2).optional(),
|
|
41728
|
+
messages: external_exports.array(message2).optional(),
|
|
41729
|
+
createdByUser: user2.nullable().optional(),
|
|
41730
|
+
createdViaAgent: agent2.nullable().optional(),
|
|
41731
|
+
updatedViaAgent: agent2.nullable().optional(),
|
|
41732
|
+
createdByPersonalAgent: external_exports.boolean().optional(),
|
|
41733
|
+
createdByAgent: agent2.nullable().optional(),
|
|
41734
|
+
updatedByAgent: agent2.nullable().optional(),
|
|
41735
|
+
createdByAgentCreatorUser: agentCreator.nullable().optional(),
|
|
41736
|
+
assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
|
|
41737
|
+
});
|
|
41784
41738
|
var compactMetadata = external_exports.strictObject({ mode: external_exports.literal("compact"), contentExcerptChars: external_exports.number(), omittedFields: external_exports.array(external_exports.string()), fullDetail: external_exports.strictObject({ cli: external_exports.string(), mcp: external_exports.string(), agent: external_exports.string() }) });
|
|
41785
41739
|
var space2 = external_exports.strictObject({ spaceId: external_exports.string(), spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
|
|
41786
|
-
var page2 = external_exports.strictObject({ activities: external_exports.array(
|
|
41787
|
-
var
|
|
41740
|
+
var page2 = external_exports.strictObject({ activities: external_exports.array(activityReadRecord), hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional(), projection: compactMetadata.optional(), spaces: external_exports.record(external_exports.string(), space2).optional() });
|
|
41741
|
+
var activityReadTransportResults = { getActivity: activityReadRecord.nullable(), listActivities: page2, searchActivities: external_exports.array(activityReadRecord), listRecentActivities: page2 };
|
|
41788
41742
|
var historyFields = { hasMore: page2.shape.hasMore, nextCursor: page2.shape.nextCursor, projection: page2.shape.projection, spaces: page2.shape.spaces };
|
|
41789
|
-
var
|
|
41790
|
-
getActivity: external_exports.strictObject({ data:
|
|
41791
|
-
listActivities: external_exports.strictObject({ data: external_exports.array(
|
|
41792
|
-
searchActivities: external_exports.strictObject({ data: external_exports.array(
|
|
41793
|
-
listRecentActivities: external_exports.strictObject({ activities: external_exports.array(
|
|
41743
|
+
var activityMcpEnvelopes = {
|
|
41744
|
+
getActivity: external_exports.strictObject({ data: activityReadRecord }),
|
|
41745
|
+
listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), hasMore: external_exports.boolean() }),
|
|
41746
|
+
searchActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord) }),
|
|
41747
|
+
listRecentActivities: external_exports.strictObject({ activities: external_exports.array(activityReadRecord), ...historyFields })
|
|
41794
41748
|
};
|
|
41795
|
-
var
|
|
41796
|
-
getActivity:
|
|
41797
|
-
listActivities: external_exports.strictObject({ data: external_exports.array(
|
|
41798
|
-
listRecentActivities: external_exports.strictObject({ data: external_exports.array(
|
|
41749
|
+
var activityRestEnvelopes = {
|
|
41750
|
+
getActivity: activityMcpEnvelopes.getActivity,
|
|
41751
|
+
listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields }),
|
|
41752
|
+
listRecentActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields })
|
|
41799
41753
|
};
|
|
41800
|
-
var publicCliActivityListEnvelope =
|
|
41754
|
+
var publicCliActivityListEnvelope = activityRestEnvelopes.listActivities.partial({ hasMore: true });
|
|
41801
41755
|
|
|
41802
41756
|
// ../packages/shared/src/task-read-operation-results.ts
|
|
41803
41757
|
var entity2 = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
|
|
41804
41758
|
var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
|
|
41805
41759
|
var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
|
|
41806
41760
|
var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(entity2.shape)) });
|
|
41807
|
-
var
|
|
41761
|
+
var taskReadTransportItem = external_exports.strictObject({ activity: activityReadRecord.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
|
|
41808
41762
|
var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
|
|
41809
|
-
var
|
|
41763
|
+
var transportTasks = external_exports.array(taskReadTransportItem).max(TASK_READ_LIMITS.results);
|
|
41810
41764
|
var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
|
|
41811
|
-
var
|
|
41812
|
-
var
|
|
41813
|
-
var
|
|
41814
|
-
var
|
|
41765
|
+
var taskReadTransportResults = { listTasks: transportTasks, getTaskByNumber: taskReadTransportItem.nullable(), listOpenTasks: transportTasks, listTasksDueBy: transportTasks, listOpenTasksForEntity: transportTasks };
|
|
41766
|
+
var user3 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
|
|
41767
|
+
var taskReadEnrichedItem = taskReadTransportItem.extend({ activity: taskReadTransportItem.shape.activity.extend({ assignees: external_exports.array(user3) }) });
|
|
41768
|
+
var taskReadUsers = external_exports.record(external_exports.string(), user3);
|
|
41815
41769
|
|
|
41816
41770
|
// ../packages/shared/src/activity-content-operations.ts
|
|
41817
41771
|
var ACTIVITY_CONTENT_LIMITS = { defaultBlocks: 20, maxBlocks: 50, defaultCharacters: 12e3, maxCharacters: 5e4, maxEditOperations: 20, maxEditCharacters: 1e5 };
|
|
@@ -41904,14 +41858,14 @@ function graphAck(raw) {
|
|
|
41904
41858
|
var graphContextAck = activityWriteResults.updateActivity.extend({ activityId: graphId2, assigneeIds: external_exports.array(graphId2).optional(), changed: external_exports.literal(false).optional() });
|
|
41905
41859
|
var graphCreated = external_exports.strictObject({ activityId: graphId2 });
|
|
41906
41860
|
var graphMessage = activityWriteResults.addActivityMessage.extend({ activityId: graphId2 });
|
|
41907
|
-
var entity3 = external_exports.object({ _id: graphId2, name:
|
|
41908
|
-
var graphPublicRich =
|
|
41861
|
+
var entity3 = external_exports.object({ _id: graphId2, name: taskReadTransportItem.shape.entities.element.shape.name, type: taskReadTransportItem.shape.entities.element.shape.type }).catchall(external_exports.json().optional());
|
|
41862
|
+
var graphPublicRich = taskReadTransportItem.shape.activity.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity3.nullable()) });
|
|
41909
41863
|
var graphMembers = external_exports.array(external_exports.object({
|
|
41910
41864
|
membership: external_exports.object({ _id: graphId2, userId: graphId2, spaceId: graphId2, role: external_exports.enum(["owner", "admin", "member"]) }).catchall(external_exports.json().optional()),
|
|
41911
41865
|
user: external_exports.object({ _id: graphId2, name: external_exports.string().optional(), email: external_exports.string().optional() }).catchall(external_exports.json().optional()).nullable()
|
|
41912
41866
|
}).catchall(external_exports.json().optional()));
|
|
41913
|
-
var
|
|
41914
|
-
var graphTaskItem = external_exports.strictObject({ activity:
|
|
41867
|
+
var taskActivity = graphPublicRich.pick({ _id: true, type: true, title: true, contentPlainText: true, createdAt: true, deadline: true, completed: true, shortId: true, fields: true, tags: true, assigneeIds: true }).extend({ type: external_exports.literal("task"), entityIds: external_exports.array(graphId2) });
|
|
41868
|
+
var graphTaskItem = external_exports.strictObject({ activity: taskActivity.strict(), entities: external_exports.array(external_exports.strictObject({ _id: graphId2, name: external_exports.string() })) });
|
|
41915
41869
|
var spacesSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()).optional() }));
|
|
41916
41870
|
var usersSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ name: external_exports.string().optional(), email: external_exports.string().optional() }));
|
|
41917
41871
|
function graphEnvelope(schema, data, spaces, users) {
|
|
@@ -42966,17 +42920,41 @@ function requireEntitySelector(operation, value, field) {
|
|
|
42966
42920
|
}
|
|
42967
42921
|
|
|
42968
42922
|
// ente/activity-fields.ts
|
|
42969
|
-
|
|
42970
|
-
|
|
42971
|
-
|
|
42972
|
-
const
|
|
42923
|
+
function parseActivityFields(flags, pairs = []) {
|
|
42924
|
+
if (flags === void 0 && !pairs.length) return void 0;
|
|
42925
|
+
const inputs = [];
|
|
42926
|
+
const lists = /* @__PURE__ */ new Map();
|
|
42927
|
+
const shorthand = (label, value) => {
|
|
42928
|
+
const key = fieldLabelKey(label);
|
|
42929
|
+
const list2 = lists.get(key);
|
|
42930
|
+
if (list2) {
|
|
42931
|
+
list2.values.push(value);
|
|
42932
|
+
return;
|
|
42933
|
+
}
|
|
42934
|
+
const entry = { label, values: [value] };
|
|
42935
|
+
lists.set(key, entry);
|
|
42936
|
+
inputs.push(entry);
|
|
42937
|
+
};
|
|
42938
|
+
(flags ?? []).forEach((flag, index) => {
|
|
42973
42939
|
try {
|
|
42974
|
-
|
|
42940
|
+
const first = flag.trimStart()[0];
|
|
42941
|
+
if (first !== "{" && first !== "[" && first !== '"') {
|
|
42942
|
+
const equals = flag.indexOf("=");
|
|
42943
|
+
if (equals <= 0) throw Error("Invalid field shorthand");
|
|
42944
|
+
shorthand(flag.slice(0, equals), flag.slice(equals + 1));
|
|
42945
|
+
} else inputs.push(JSON.parse(flag));
|
|
42975
42946
|
} catch {
|
|
42976
42947
|
throw new OperationInputError("activityFields", [{ path: ["fields", String(index)], reason: "invalid_type" }]);
|
|
42977
42948
|
}
|
|
42978
42949
|
});
|
|
42979
|
-
|
|
42950
|
+
for (const [label, value] of pairs) shorthand(label, value);
|
|
42951
|
+
const resolved = inputs.map((input2) => {
|
|
42952
|
+
if (!input2 || typeof input2 !== "object" || !("values" in input2)) return input2;
|
|
42953
|
+
const { label, values } = input2;
|
|
42954
|
+
const present = values.filter((value) => value);
|
|
42955
|
+
return { label, value: !present.length ? null : values.length === 1 ? present[0] : present };
|
|
42956
|
+
});
|
|
42957
|
+
return parseOperationInput("activityFields", activityFieldInputsSchema, resolved);
|
|
42980
42958
|
}
|
|
42981
42959
|
var created = external_exports.strictObject({ data: activityWriteResults.createActivity });
|
|
42982
42960
|
var updated = external_exports.strictObject({ data: activityWriteResults.updateActivity });
|
|
@@ -42986,10 +42964,6 @@ function fieldCreateReceipt(raw) {
|
|
|
42986
42964
|
function fieldUpdateReceipt(raw) {
|
|
42987
42965
|
return parseZodOperationResult("updateActivity", updated, raw, "Invalid activity update receipt").data;
|
|
42988
42966
|
}
|
|
42989
|
-
var legacyWritePreflight = makeFunctionReference2("activityFields:assertLegacyWriteAllowed");
|
|
42990
|
-
async function assertLegacyActivityWriteAllowed(caller) {
|
|
42991
|
-
await caller.mutation(legacyWritePreflight, {});
|
|
42992
|
-
}
|
|
42993
42967
|
|
|
42994
42968
|
// ../packages/shared/src/cli-protocol-dtos.ts
|
|
42995
42969
|
var agentIdentity = v.object({ agentId: v.id("agents"), icon: v.optional(v.string()), name: v.string(), color: v.string(), archived: v.boolean() });
|
|
@@ -43478,13 +43452,13 @@ var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
|
43478
43452
|
return response;
|
|
43479
43453
|
}, async (raw) => {
|
|
43480
43454
|
if (!(raw instanceof Response)) throw new OperationResultError("activityUpload");
|
|
43481
|
-
let
|
|
43455
|
+
let json3;
|
|
43482
43456
|
try {
|
|
43483
|
-
|
|
43457
|
+
json3 = await raw.json();
|
|
43484
43458
|
} catch {
|
|
43485
43459
|
throw new OperationResultError("activityUpload");
|
|
43486
43460
|
}
|
|
43487
|
-
return uploadedFileResult(
|
|
43461
|
+
return uploadedFileResult(json3);
|
|
43488
43462
|
});
|
|
43489
43463
|
progress.identifyStorage(storageId);
|
|
43490
43464
|
await progress.write("attach", () => caller.mutation(activitiesAddAttachment, { activityId: this.id, storageId, name: name4, mimeType }), (raw) => {
|
|
@@ -43850,7 +43824,7 @@ var ActivityCreate = class extends ClientCommand {
|
|
|
43850
43824
|
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
43851
43825
|
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
43852
43826
|
});
|
|
43853
|
-
field = options_exports.Array("--field", { description: "
|
|
43827
|
+
field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeat a label for a list (replaces the field), empty/null removes" });
|
|
43854
43828
|
async run() {
|
|
43855
43829
|
const fields4 = parseActivityFields(this.field);
|
|
43856
43830
|
if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
@@ -43952,7 +43926,7 @@ var ActivityUpdate = class extends ClientCommand {
|
|
|
43952
43926
|
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
43953
43927
|
entityAdd = options_exports.Array("--entity-add", { description: "Link additional entities" });
|
|
43954
43928
|
entityRemove = options_exports.Array("--entity-remove", { description: "Unlink entities" });
|
|
43955
|
-
field = options_exports.Array("--field", { description: "
|
|
43929
|
+
field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeat a label for a list (replaces the field), empty/null removes" });
|
|
43956
43930
|
async run() {
|
|
43957
43931
|
const fields4 = parseActivityFields(this.field);
|
|
43958
43932
|
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
@@ -44192,9 +44166,7 @@ function toTaskItem(rich) {
|
|
|
44192
44166
|
deadline: rich.deadline,
|
|
44193
44167
|
completed: rich.completed,
|
|
44194
44168
|
shortId: rich.shortId,
|
|
44195
|
-
attributes: rich.attributes,
|
|
44196
44169
|
fields: rich.fields,
|
|
44197
|
-
fieldIndexReady: rich.fieldIndexReady,
|
|
44198
44170
|
tags: rich.tags,
|
|
44199
44171
|
entityIds: rich.entityDetails.map((e) => e?._id).filter((id21) => !!id21),
|
|
44200
44172
|
assigneeIds: rich.assigneeIds
|
|
@@ -44216,7 +44188,6 @@ var activitiesFindTaskByShortId = makeFunctionReference2(
|
|
|
44216
44188
|
);
|
|
44217
44189
|
var activitiesGetByIdRich2 = makeFunctionReference2("activities:getByIdRich");
|
|
44218
44190
|
var activitiesCreate2 = makeFunctionReference2("activities:create");
|
|
44219
|
-
var activitiesSetAttribute = makeFunctionReference2("activities:setAttribute");
|
|
44220
44191
|
var activitiesUpdateCreatedAt2 = makeFunctionReference2("activities:updateCreatedAt");
|
|
44221
44192
|
var activitiesUpdateTitle2 = makeFunctionReference2("activities:updateTitle");
|
|
44222
44193
|
var activitiesSetContentFromMarkdown2 = makeFunctionReference2("activities:setContentFromMarkdown");
|
|
@@ -44311,7 +44282,7 @@ var TaskCreate = class extends ClientCommand {
|
|
|
44311
44282
|
description: "Create the task with no deadline (skip the default of tomorrow 22:00)"
|
|
44312
44283
|
});
|
|
44313
44284
|
tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
|
|
44314
|
-
attr = options_exports.Array("--attr", { description: "
|
|
44285
|
+
attr = options_exports.Array("--attr", { description: "Canonical key=value shorthand for --field" });
|
|
44315
44286
|
content = options_exports.String("--content", { description: "Task content/description" });
|
|
44316
44287
|
sourceCreatedAt = options_exports.String("--source-created-at", {
|
|
44317
44288
|
description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
|
|
@@ -44325,28 +44296,26 @@ var TaskCreate = class extends ClientCommand {
|
|
|
44325
44296
|
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
44326
44297
|
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
44327
44298
|
});
|
|
44328
|
-
field = options_exports.Array("--field", { description: "
|
|
44299
|
+
field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeat a label for a list (replaces the field), empty/null removes" });
|
|
44329
44300
|
async run() {
|
|
44330
|
-
const
|
|
44301
|
+
const aliases = graphConvert("fields", () => parseFieldPairList(this.attr));
|
|
44302
|
+
const fields4 = parseActivityFields(this.field, aliases);
|
|
44331
44303
|
if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
44332
44304
|
if (this.noDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --no-deadline, not both.");
|
|
44333
44305
|
const deadline = this.noDeadline ? void 0 : graphConvert("deadline", () => this.deadline === void 0 ? defaultDeadline() : parseDeadline(this.deadline));
|
|
44334
|
-
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44335
44306
|
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
44336
44307
|
const directAssigneeIds = (this.assignee ?? []).filter((value) => !value.includes("@"));
|
|
44337
44308
|
const emailAssignees = [...(this.assignee ?? []).filter((value) => value.includes("@")), ...this.assigneeEmail ?? []];
|
|
44338
|
-
const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline,
|
|
44339
|
-
const
|
|
44340
|
-
const progress = graphProgress(this, "task.create", ["create", ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : [], ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
44309
|
+
const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline, fields: fields4, content: this.content, tags: this.tag, assigneeIds: directAssigneeIds, assigneeEmails: emailAssignees, sourceCreatedAt, autoLinkPersonalSpace: this.autoLink, entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint });
|
|
44310
|
+
const progress = graphProgress(this, "task.create", ["create", ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
44341
44311
|
return progress.run(async () => {
|
|
44342
44312
|
const caller = await resolveCaller();
|
|
44343
|
-
if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
|
|
44344
44313
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
44345
44314
|
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
44346
44315
|
const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
|
|
44347
44316
|
const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
|
|
44348
44317
|
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
|
|
44349
|
-
const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline,
|
|
44318
|
+
const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
|
|
44350
44319
|
entityId: entityIds[0],
|
|
44351
44320
|
additionalEntities: entityIds.slice(1),
|
|
44352
44321
|
ownerSpaceId: spaceId2,
|
|
@@ -44359,7 +44328,6 @@ var TaskCreate = class extends ClientCommand {
|
|
|
44359
44328
|
...this.tag?.length ? { tags: this.tag } : {},
|
|
44360
44329
|
...this.content !== void 0 ? { contentMarkdown: this.content } : {}
|
|
44361
44330
|
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
44362
|
-
if (fields4 === void 0) for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44363
44331
|
if (sourceCreatedAt && fields4 === void 0) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt2, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
44364
44332
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44365
44333
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created task '${this.title}' (${activityId2})`, spaces)));
|
|
@@ -44372,32 +44340,29 @@ var TaskUpdate = class extends ClientCommand {
|
|
|
44372
44340
|
id = options_exports.String();
|
|
44373
44341
|
title = options_exports.String("--title", { description: "Update title" });
|
|
44374
44342
|
content = options_exports.String("--content", { description: "Update content" });
|
|
44375
|
-
attr = options_exports.Array("--attr", { description: "
|
|
44343
|
+
attr = options_exports.Array("--attr", { description: "Canonical key=value shorthand for --field" });
|
|
44376
44344
|
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
44377
44345
|
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
44378
|
-
field = options_exports.Array("--field", { description: "
|
|
44346
|
+
field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeat a label for a list (replaces the field), empty/null removes" });
|
|
44379
44347
|
async run() {
|
|
44380
|
-
const
|
|
44348
|
+
const aliases = graphConvert("fields", () => parseFieldPairList(this.attr));
|
|
44349
|
+
const fields4 = parseActivityFields(this.field, aliases);
|
|
44381
44350
|
graphTaskNumber(this.id);
|
|
44382
|
-
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44383
44351
|
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
44384
44352
|
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
44385
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {},
|
|
44386
|
-
if (this.title === void 0 && this.content === void 0 && deadline === null &&
|
|
44387
|
-
const
|
|
44388
|
-
const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : [], ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : []]);
|
|
44353
|
+
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, fields: fields4 });
|
|
44354
|
+
if (this.title === void 0 && this.content === void 0 && deadline === null && fields4 === void 0) throw new Error("Nothing to update. Specify --title, --content, --attr, --field, --deadline, or --clear-deadline.");
|
|
44355
|
+
const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : []]);
|
|
44389
44356
|
return progress.run(async () => {
|
|
44390
44357
|
const caller = await resolveCaller();
|
|
44391
|
-
if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
|
|
44392
44358
|
const activityId2 = await resolveTaskIdC(caller, this.id);
|
|
44393
44359
|
progress.identify(activityId2);
|
|
44394
44360
|
if (fields4 !== void 0) {
|
|
44395
|
-
await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {},
|
|
44361
|
+
await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, fields: fields4 }), fieldUpdateReceipt);
|
|
44396
44362
|
} else {
|
|
44397
44363
|
if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle2, { activityId: activityId2, title: this.title }), graphAck);
|
|
44398
44364
|
if (this.content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown2, { activityId: activityId2, markdown: this.content }), graphAck);
|
|
44399
44365
|
if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline2, { activityId: activityId2, ...deadline }), graphAck);
|
|
44400
|
-
for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44401
44366
|
}
|
|
44402
44367
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44403
44368
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2 }, spaces), () => withFooter(`Updated task ${this.id}`, spaces)));
|
|
@@ -44705,15 +44670,15 @@ function parseDatabaseProtocolInput(name4, validator, raw) {
|
|
|
44705
44670
|
}
|
|
44706
44671
|
|
|
44707
44672
|
// ../packages/shared/src/entity-read-legacy-results.ts
|
|
44708
|
-
var
|
|
44673
|
+
var json2 = external_exports.json().optional();
|
|
44709
44674
|
function legacyEntityRecord(raw) {
|
|
44710
44675
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
44711
44676
|
const { fieldValues: _fieldValues, layout: _layout, actingSpaceId: _acting, ...value } = raw;
|
|
44712
44677
|
return value;
|
|
44713
44678
|
}
|
|
44714
|
-
var legacyEntityObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(
|
|
44679
|
+
var legacyEntityObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json2);
|
|
44715
44680
|
var entity4 = external_exports.preprocess(legacyEntityRecord, legacyEntityObject);
|
|
44716
|
-
var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(
|
|
44681
|
+
var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(json2);
|
|
44717
44682
|
var searchRow = entityReadFullSearch.shape.entities.element;
|
|
44718
44683
|
var listRow = entityReadFullList.shape.entities.element;
|
|
44719
44684
|
var legacyEntityReadResults = {
|
|
@@ -44861,7 +44826,7 @@ function columnFor(columns, key, listName) {
|
|
|
44861
44826
|
);
|
|
44862
44827
|
return col;
|
|
44863
44828
|
}
|
|
44864
|
-
function
|
|
44829
|
+
function coerceFields(columns, raw, listName) {
|
|
44865
44830
|
const out = {};
|
|
44866
44831
|
for (const [key, value] of Object.entries(raw)) out[key] = coerceValue(columnFor(columns, key, listName), value);
|
|
44867
44832
|
return out;
|
|
@@ -44887,7 +44852,7 @@ function parseWhere(columns, specs, listName) {
|
|
|
44887
44852
|
function planUpsert(existing, inputs, keyColumn) {
|
|
44888
44853
|
const byKey = /* @__PURE__ */ new Map();
|
|
44889
44854
|
for (const row of existing) {
|
|
44890
|
-
const raw = row.
|
|
44855
|
+
const raw = row.fields?.[keyColumn];
|
|
44891
44856
|
if (typeof raw !== "string" || raw === "") continue;
|
|
44892
44857
|
const other = byKey.get(raw);
|
|
44893
44858
|
if (other)
|
|
@@ -44898,12 +44863,12 @@ function planUpsert(existing, inputs, keyColumn) {
|
|
|
44898
44863
|
}
|
|
44899
44864
|
const keyless = /* @__PURE__ */ new Map();
|
|
44900
44865
|
for (const row of existing) {
|
|
44901
|
-
const raw = row.
|
|
44866
|
+
const raw = row.fields?.[keyColumn];
|
|
44902
44867
|
if ((typeof raw !== "string" || raw === "") && row.title) keyless.set(row.title, row.rowId);
|
|
44903
44868
|
}
|
|
44904
44869
|
const seen = /* @__PURE__ */ new Map();
|
|
44905
44870
|
const steps = inputs.map((input2) => {
|
|
44906
|
-
const key = input2.
|
|
44871
|
+
const key = input2.fields[keyColumn];
|
|
44907
44872
|
if (typeof key !== "string" || key.trim() === "")
|
|
44908
44873
|
throw new Error(`Line ${input2.line}: missing a text value for key column '${keyColumn}'.`);
|
|
44909
44874
|
const firstLine = seen.get(key);
|
|
@@ -44912,9 +44877,9 @@ function planUpsert(existing, inputs, keyColumn) {
|
|
|
44912
44877
|
seen.set(key, input2.line);
|
|
44913
44878
|
const row = byKey.get(key);
|
|
44914
44879
|
if (!row) return { action: "create", input: input2, key };
|
|
44915
|
-
const stored = row.
|
|
44880
|
+
const stored = row.fields ?? {};
|
|
44916
44881
|
const changes = {};
|
|
44917
|
-
for (const [k, v3] of Object.entries(input2.
|
|
44882
|
+
for (const [k, v3] of Object.entries(input2.fields)) {
|
|
44918
44883
|
if (!sameValue(stored[k], v3)) changes[k] = v3;
|
|
44919
44884
|
}
|
|
44920
44885
|
const title4 = input2.title !== void 0 && input2.title !== (row.title ?? "") ? input2.title : void 0;
|
|
@@ -44933,36 +44898,42 @@ function planUpsert(existing, inputs, keyColumn) {
|
|
|
44933
44898
|
}
|
|
44934
44899
|
function parseImportLines(text3) {
|
|
44935
44900
|
const rows = [];
|
|
44936
|
-
const
|
|
44937
|
-
|
|
44938
|
-
const
|
|
44939
|
-
if (!source2) continue;
|
|
44940
|
-
const line = i + 1;
|
|
44901
|
+
for (const [index, source2] of text3.split(/\r?\n/).entries()) {
|
|
44902
|
+
if (!source2.trim()) continue;
|
|
44903
|
+
const line = index + 1;
|
|
44941
44904
|
let parsed;
|
|
44942
44905
|
try {
|
|
44943
44906
|
parsed = JSON.parse(source2);
|
|
44944
|
-
} catch (
|
|
44945
|
-
throw new Error(`Line ${line}: not valid JSON (${
|
|
44907
|
+
} catch (error62) {
|
|
44908
|
+
throw new Error(`Line ${line}: not valid JSON (${error62 instanceof Error ? error62.message : String(error62)}).`);
|
|
44946
44909
|
}
|
|
44947
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
44948
|
-
throw new Error(`Line ${line}: expected a JSON object.`);
|
|
44910
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`Line ${line}: expected a JSON object.`);
|
|
44949
44911
|
const obj = parsed;
|
|
44950
|
-
|
|
44951
|
-
|
|
44952
|
-
|
|
44912
|
+
if (Object.hasOwn(obj, "attributes")) throw new Error(ACTIVITY_ATTRIBUTES_RETIRED);
|
|
44913
|
+
const unknownKeys = Object.keys(obj).filter((key) => !["title", "fields", "content"].includes(key));
|
|
44914
|
+
if (unknownKeys.length) throw new Error(`Line ${line}: unknown field(s) ${unknownKeys.join(", ")}; allowed: title, fields, content.`);
|
|
44953
44915
|
if (obj.title !== void 0 && typeof obj.title !== "string") throw new Error(`Line ${line}: "title" must be a string.`);
|
|
44954
44916
|
if (obj.content !== void 0 && typeof obj.content !== "string") throw new Error(`Line ${line}: "content" must be a string.`);
|
|
44955
|
-
const
|
|
44956
|
-
if (!
|
|
44957
|
-
rows.push({
|
|
44958
|
-
line,
|
|
44959
|
-
attrs,
|
|
44960
|
-
...obj.title !== void 0 ? { title: obj.title } : {},
|
|
44961
|
-
...obj.content !== void 0 ? { content: obj.content } : {}
|
|
44962
|
-
});
|
|
44917
|
+
const fields4 = activityFieldInputsSchema.safeParse(obj.fields ?? []);
|
|
44918
|
+
if (!fields4.success) throw new Error(`Line ${line}: "fields" must be typed field inputs with exactly one label or fieldId and a value.`);
|
|
44919
|
+
rows.push({ line, fields: fields4.data, ...obj.title !== void 0 ? { title: obj.title } : {}, ...obj.content !== void 0 ? { content: obj.content } : {} });
|
|
44963
44920
|
}
|
|
44964
44921
|
return rows;
|
|
44965
44922
|
}
|
|
44923
|
+
function coerceImportFields(columns, inputs, listName) {
|
|
44924
|
+
const cells = {};
|
|
44925
|
+
for (const input2 of inputs) {
|
|
44926
|
+
const labelKey = input2.label === void 0 ? void 0 : fieldLabelKey(input2.label);
|
|
44927
|
+
const keyMatches = labelKey === void 0 ? [] : columns.filter((column2) => fieldLabelKey(column2.key) === labelKey);
|
|
44928
|
+
const matches = input2.fieldId ? columns.filter((column2) => column2.fieldIds?.some((fieldId) => fieldId === input2.fieldId)) : keyMatches.length ? keyMatches : columns.filter((column2) => fieldLabelKey(column2.label ?? column2.key) === labelKey);
|
|
44929
|
+
if (matches.length !== 1) throw new Error(`Field '${input2.fieldId ?? input2.label}' must match exactly one column of list '${listName}'.`);
|
|
44930
|
+
const column = matches[0];
|
|
44931
|
+
if (Object.hasOwn(cells, column.key)) throw new Error(`Field '${column.key}' is repeated in one import row.`);
|
|
44932
|
+
if (input2.type !== void 0 && input2.type !== column.type) throw new Error(`Field '${column.key}' has column type '${column.type}', not '${input2.type}'.`);
|
|
44933
|
+
cells[column.key] = coerceValue(column, input2.value);
|
|
44934
|
+
}
|
|
44935
|
+
return cells;
|
|
44936
|
+
}
|
|
44966
44937
|
async function runPool(items2, limit3, work) {
|
|
44967
44938
|
let next = 0;
|
|
44968
44939
|
const failures = [];
|
|
@@ -45062,7 +45033,7 @@ function titleArgs(activityId2, title4) {
|
|
|
45062
45033
|
function orderedCells(ctx, step) {
|
|
45063
45034
|
if (step.action === "unchanged") return [];
|
|
45064
45035
|
if (step.action === "update") return Object.entries(step.changes);
|
|
45065
|
-
return Object.entries(step.input.
|
|
45036
|
+
return Object.entries(step.input.fields).sort(([a], [b]) => a === ctx.keyColumn ? -1 : b === ctx.keyColumn ? 1 : 0).filter(([, value]) => value !== null && !(Array.isArray(value) && value.length === 0));
|
|
45066
45037
|
}
|
|
45067
45038
|
function rowStages(ctx, step) {
|
|
45068
45039
|
return [...step.action === "create" ? ["create"] : step.action === "update" && step.title !== void 0 ? ["title"] : [], ...orderedCells(ctx, step).map((_, index) => `cell:${index + 1}`)];
|
|
@@ -45102,7 +45073,7 @@ async function fetchMatchingRows(caller, entityId2, where) {
|
|
|
45102
45073
|
async function fetchRowsForKeys(caller, entityId2, inputs, key) {
|
|
45103
45074
|
const rows = /* @__PURE__ */ new Map();
|
|
45104
45075
|
const matchedKeys = /* @__PURE__ */ new Map();
|
|
45105
|
-
const values = new Map(inputs.map((input2) => [JSON.stringify(input2.
|
|
45076
|
+
const values = new Map(inputs.map((input2) => [JSON.stringify(input2.fields[key]), input2.fields[key]]));
|
|
45106
45077
|
for (const value of values.values()) {
|
|
45107
45078
|
if (typeof value !== "string" || !value.trim()) continue;
|
|
45108
45079
|
const matches = await fetchMatchingRows(caller, entityId2, [{ key, value }]);
|
|
@@ -45112,7 +45083,7 @@ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
|
|
|
45112
45083
|
rows.set(row._id, { row, match: { key, value } });
|
|
45113
45084
|
}
|
|
45114
45085
|
if (!matches.length) {
|
|
45115
|
-
const titles = new Set(inputs.filter((input2) => input2.
|
|
45086
|
+
const titles = new Set(inputs.filter((input2) => input2.fields[key] === value && input2.title !== void 0).map((input2) => input2.title));
|
|
45116
45087
|
for (const title4 of titles) for (const row of await fetchMatchingRows(caller, entityId2, [{ key, value: null }, { key: "title", value: title4 }])) rows.set(row._id, { row });
|
|
45117
45088
|
}
|
|
45118
45089
|
}
|
|
@@ -45129,7 +45100,7 @@ function rowJson(row) {
|
|
|
45129
45100
|
type: row.type,
|
|
45130
45101
|
completed: row.completed ?? false,
|
|
45131
45102
|
createdAt: row._creationTime,
|
|
45132
|
-
|
|
45103
|
+
fields: row.fields,
|
|
45133
45104
|
entities: (row.entityDetails ?? []).filter((e) => e !== null).map((e) => ({ entityId: e._id, name: e.name }))
|
|
45134
45105
|
};
|
|
45135
45106
|
}
|
|
@@ -45186,13 +45157,12 @@ function columnOrThrow(columns, key, listName) {
|
|
|
45186
45157
|
return col;
|
|
45187
45158
|
}
|
|
45188
45159
|
function toExisting(row, columns = [], match) {
|
|
45189
|
-
if (row.fields === void 0) return { rowId: row._id, title: row.title ?? null, attributes: { ...row.attributes, ...match ? { [match.key]: match.value } : {} } };
|
|
45190
45160
|
const cells = {};
|
|
45191
45161
|
for (const column of columns) {
|
|
45192
45162
|
const values = row.fields.filter((field) => column.fieldIds?.length ? column.fieldIds.some((id21) => id21 === field.fieldId) : fieldLabelKey(field.label) === fieldLabelKey(column.key));
|
|
45193
|
-
if (values.length) cells[column.key] =
|
|
45163
|
+
if (values.length) cells[column.key] = activityFieldValue(values[0].type, values.map((field) => field.value));
|
|
45194
45164
|
}
|
|
45195
|
-
return { rowId: row._id, title: row.title ?? null,
|
|
45165
|
+
return { rowId: row._id, title: row.title ?? null, fields: { ...cells, ...match ? { [match.key]: match.value } : {} } };
|
|
45196
45166
|
}
|
|
45197
45167
|
|
|
45198
45168
|
// ente/commands/listColumns.ts
|
|
@@ -45284,7 +45254,7 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45284
45254
|
list = options_exports.String();
|
|
45285
45255
|
title = options_exports.String("--title", { description: "Row title" });
|
|
45286
45256
|
type = options_exports.String("--type", "note", { description: "Row activity type: note (default) or task" });
|
|
45287
|
-
attr = options_exports.Array("--attr", { description: "Column values as key=value (coerced to the column type)" });
|
|
45257
|
+
attr = options_exports.Array("--field,--attr", { description: "Column values as key=value (coerced to the column type)" });
|
|
45288
45258
|
key = options_exports.String("--key", {
|
|
45289
45259
|
description: "Upsert: update the row whose <key> cell equals this row's --attr <key>=\u2026 instead of adding one"
|
|
45290
45260
|
});
|
|
@@ -45299,11 +45269,11 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45299
45269
|
if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
|
|
45300
45270
|
const caller = await resolveCaller();
|
|
45301
45271
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45302
|
-
const
|
|
45272
|
+
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
|
|
45303
45273
|
const content = readContentOption(this.content, this.contentFile);
|
|
45304
45274
|
const input2 = {
|
|
45305
45275
|
line: 1,
|
|
45306
|
-
|
|
45276
|
+
fields: fields4,
|
|
45307
45277
|
...this.title !== void 0 ? { title: this.title } : {},
|
|
45308
45278
|
...content !== void 0 ? { content } : {}
|
|
45309
45279
|
};
|
|
@@ -45318,7 +45288,7 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45318
45288
|
const rowId = await applyStep(ctx, step, progress);
|
|
45319
45289
|
const result = stepResult(step, rowId);
|
|
45320
45290
|
this.emitText(
|
|
45321
|
-
{ data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null,
|
|
45291
|
+
{ data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null, fields: fields4 } },
|
|
45322
45292
|
() => result.action === "created" ? `Added row '${this.title ?? "(untitled)"}' (${rowId}) to '${entity5.name}'.` : result.action === "updated" ? `Updated row ${rowId} in '${entity5.name}': ${(result.changed ?? []).join(", ")}.${result.contentIgnored ? " (body left unchanged)" : ""}` : `Row ${rowId} in '${entity5.name}' is unchanged.`
|
|
45323
45293
|
);
|
|
45324
45294
|
}
|
|
@@ -45335,35 +45305,35 @@ var ListUpdate = class extends ProfileCommand {
|
|
|
45335
45305
|
});
|
|
45336
45306
|
list = options_exports.String();
|
|
45337
45307
|
rowId = options_exports.String();
|
|
45338
|
-
attr = options_exports.Array("--attr", { description: "Column values as key=value (coerced; empty value clears the cell)" });
|
|
45308
|
+
attr = options_exports.Array("--field,--attr", { description: "Column values as key=value (coerced; empty value clears the cell)" });
|
|
45339
45309
|
title = options_exports.String("--title", { description: "New row title" });
|
|
45340
45310
|
async run() {
|
|
45341
45311
|
if (!this.attr?.length && this.title === void 0) throw new Error("Nothing to update. Pass --attr and/or --title.");
|
|
45342
45312
|
const caller = await resolveCaller();
|
|
45343
45313
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45344
|
-
const
|
|
45314
|
+
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
|
|
45345
45315
|
const row = graphResult(databaseListRow.nullable(), await caller.query(activitiesGetByIdRich3, { activityId: graphInput(graphId2, this.rowId) }));
|
|
45346
45316
|
if (!row) throw new Error(`Row ${this.rowId} not found or not accessible.`);
|
|
45347
45317
|
if (row._id !== this.rowId) throw new OperationResultError("database row", "Invalid row result context");
|
|
45348
45318
|
if (!(row.entityDetails ?? []).some((e) => e?._id === entityId2))
|
|
45349
45319
|
throw new Error(`Activity ${this.rowId} is not a row of list '${entity5.name}'.`);
|
|
45350
|
-
const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(
|
|
45320
|
+
const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(fields4).map((_, i) => `cell:${i + 1}`)];
|
|
45351
45321
|
const progress = graphProgress(this, "list update", stages, { entityId: entityId2, activityId: row._id });
|
|
45352
45322
|
await progress.run(async () => {
|
|
45353
45323
|
if (this.title !== void 0) {
|
|
45354
45324
|
const args = titleArgs(row._id, this.title);
|
|
45355
45325
|
await progress.write("title", () => databaseWrite(() => caller.mutation(activitiesUpdateTitle3, args)), graphAck);
|
|
45356
45326
|
}
|
|
45357
|
-
for (const [index, [key, value]] of Object.entries(
|
|
45327
|
+
for (const [index, [key, value]] of Object.entries(fields4).entries()) {
|
|
45358
45328
|
const args = cellArgs(row._id, key, value, view.columns.find((column) => column.key === key));
|
|
45359
45329
|
await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutation(setFieldCell, args)), (raw) => parseOperationResult("activityFields:setCell", databaseCellWriteContract.result, raw));
|
|
45360
45330
|
}
|
|
45361
45331
|
});
|
|
45362
45332
|
this.emitText(
|
|
45363
|
-
{ data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {},
|
|
45333
|
+
{ data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {}, fields: fields4 } },
|
|
45364
45334
|
() => `Updated row ${this.rowId} in '${entity5.name}': ${[
|
|
45365
45335
|
...this.title !== void 0 ? ["title"] : [],
|
|
45366
|
-
...Object.keys(
|
|
45336
|
+
...Object.keys(fields4)
|
|
45367
45337
|
].join(", ")}.`
|
|
45368
45338
|
);
|
|
45369
45339
|
}
|
|
@@ -45374,7 +45344,7 @@ var ListImport = class extends ProfileCommand {
|
|
|
45374
45344
|
category: "List",
|
|
45375
45345
|
description: "Upsert rows from a JSONL file by a key column (created / updated / unchanged per row)",
|
|
45376
45346
|
details: `
|
|
45377
|
-
One JSON object per line: {"title": "\u2026", "
|
|
45347
|
+
One JSON object per line: {"title": "\u2026", "fields": [{"label": "<key>", "value": "\u2026"}], "content": "\u2026markdown\u2026"}.
|
|
45378
45348
|
Values are coerced to each column's type like --attr. The whole file is checked before the
|
|
45379
45349
|
first write: an unknown column, a bad value, a missing key or a key repeated in the file (or
|
|
45380
45350
|
held by two existing rows) fails the run. "content" is only written when a row is created.
|
|
@@ -45404,7 +45374,7 @@ var ListImport = class extends ProfileCommand {
|
|
|
45404
45374
|
try {
|
|
45405
45375
|
return {
|
|
45406
45376
|
line: l.line,
|
|
45407
|
-
|
|
45377
|
+
fields: coerceImportFields(view.columns, l.fields, entity5.name),
|
|
45408
45378
|
...l.title !== void 0 ? { title: l.title } : {},
|
|
45409
45379
|
...l.content !== void 0 ? { content: l.content } : {}
|
|
45410
45380
|
};
|
|
@@ -45626,9 +45596,9 @@ var CostPreview = class extends ProfileCommand {
|
|
|
45626
45596
|
static usage = Command.Usage({ category: "Admin", description: "Validate a cost JSON file with the authenticated admin importer" });
|
|
45627
45597
|
file = options_exports.String("--file", { required: true });
|
|
45628
45598
|
async run() {
|
|
45629
|
-
const
|
|
45630
|
-
if (Buffer.byteLength(
|
|
45631
|
-
const result = await (await resolveAdminCaller()).query(previewCostImport, { json:
|
|
45599
|
+
const json3 = await readFile(this.file, "utf8");
|
|
45600
|
+
if (Buffer.byteLength(json3) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
|
|
45601
|
+
const result = await (await resolveAdminCaller()).query(previewCostImport, { json: json3 });
|
|
45632
45602
|
this.emitText(result, () => JSON.stringify(result));
|
|
45633
45603
|
return ["ready", "unchanged"].includes(result.status) ? 0 : 1;
|
|
45634
45604
|
}
|
|
@@ -45639,9 +45609,9 @@ var CostImport = class extends ProfileCommand {
|
|
|
45639
45609
|
file = options_exports.String("--file", { required: true });
|
|
45640
45610
|
expected = options_exports.String("--expected-current-id", { required: true, description: "Exact preview currentId, or none for a new stream" });
|
|
45641
45611
|
async run() {
|
|
45642
|
-
const
|
|
45643
|
-
if (Buffer.byteLength(
|
|
45644
|
-
const result = await (await resolveAdminCaller()).mutation(importCostSnapshot, { json:
|
|
45612
|
+
const json3 = await readFile(this.file, "utf8");
|
|
45613
|
+
if (Buffer.byteLength(json3) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
|
|
45614
|
+
const result = await (await resolveAdminCaller()).mutation(importCostSnapshot, { json: json3, expectedCurrentId: this.expected === "none" ? null : this.expected });
|
|
45645
45615
|
this.emitText(result, () => JSON.stringify(result));
|
|
45646
45616
|
return ["imported", "unchanged"].includes(result.status) ? 0 : 1;
|
|
45647
45617
|
}
|
|
@@ -45821,12 +45791,12 @@ var UsersSetAdminCommand = class extends BaseCommand {
|
|
|
45821
45791
|
off = options_exports.Boolean("--off", { description: "Revoke admin instead of granting it" });
|
|
45822
45792
|
async run() {
|
|
45823
45793
|
const caller = await resolveAdminCaller();
|
|
45824
|
-
const
|
|
45794
|
+
const user4 = await resolveUserByEmail(caller, this.email);
|
|
45825
45795
|
const isAdmin = !this.off;
|
|
45826
|
-
await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId:
|
|
45796
|
+
await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId: user4.id, isAdmin })).then((raw) => parseOperationResult("admin/users:setAdmin", adminUserContracts.setAdmin.result, raw));
|
|
45827
45797
|
this.emitText(
|
|
45828
|
-
{ data: { id:
|
|
45829
|
-
() => `${isAdmin ? "Granted" : "Revoked"} admin for ${
|
|
45798
|
+
{ data: { id: user4.id, email: user4.email, isAdmin } },
|
|
45799
|
+
() => `${isAdmin ? "Granted" : "Revoked"} admin for ${user4.email}.`
|
|
45830
45800
|
);
|
|
45831
45801
|
}
|
|
45832
45802
|
};
|
|
@@ -45842,14 +45812,14 @@ var UsersResetPasswordCommand = class extends BaseCommand {
|
|
|
45842
45812
|
});
|
|
45843
45813
|
async run() {
|
|
45844
45814
|
const caller = await resolveAdminCaller();
|
|
45845
|
-
const
|
|
45815
|
+
const user4 = await resolveUserByEmail(caller, this.email);
|
|
45846
45816
|
const res = await caller.action(resetPassword, parseHumanInput("admin/users:resetPassword", adminUserContracts.resetPassword.args, {
|
|
45847
|
-
userId:
|
|
45817
|
+
userId: user4.id,
|
|
45848
45818
|
...this.password !== void 0 ? { newPassword: this.password } : {}
|
|
45849
45819
|
})).then((raw) => parseOperationResult("admin/users:resetPassword", adminUserContracts.resetPassword.result, raw));
|
|
45850
45820
|
this.emitText(
|
|
45851
|
-
{ data: { id:
|
|
45852
|
-
() => `Reset password for ${
|
|
45821
|
+
{ data: { id: user4.id, email: user4.email, password: res.password } },
|
|
45822
|
+
() => `Reset password for ${user4.email}.
|
|
45853
45823
|
New password: ${res.password}`
|
|
45854
45824
|
);
|
|
45855
45825
|
}
|
|
@@ -45880,15 +45850,15 @@ var UsersSetPlanCommand = class extends BaseCommand {
|
|
|
45880
45850
|
throw new Error("company_managed needs --company <billing account id>.");
|
|
45881
45851
|
}
|
|
45882
45852
|
const caller = await resolveAdminCaller();
|
|
45883
|
-
const
|
|
45853
|
+
const user4 = await resolveUserByEmail(caller, this.email);
|
|
45884
45854
|
const res = await caller.mutation(changeUserPlan, parseHumanInput("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.args, {
|
|
45885
|
-
userId:
|
|
45855
|
+
userId: user4.id,
|
|
45886
45856
|
planKey,
|
|
45887
45857
|
...planKey === "company_managed" ? { companyBillingAccountId: this.company } : {}
|
|
45888
45858
|
})).then((raw) => parseOperationResult("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.result, raw));
|
|
45889
45859
|
this.emitText(
|
|
45890
|
-
{ data: { id:
|
|
45891
|
-
() => res.changed ? `Set plan for ${
|
|
45860
|
+
{ data: { id: user4.id, email: user4.email, ...res } },
|
|
45861
|
+
() => res.changed ? `Set plan for ${user4.email} to ${res.planKey}.` : `${user4.email} already has plan ${res.planKey}.`
|
|
45892
45862
|
);
|
|
45893
45863
|
}
|
|
45894
45864
|
};
|
|
@@ -47150,7 +47120,7 @@ var RecordingRerunCommand = class extends BaseCommand {
|
|
|
47150
47120
|
rawReceipt = await caller.mutation(rerunRecording, args);
|
|
47151
47121
|
} catch (error62) {
|
|
47152
47122
|
if (error62 instanceof ConvexError2) throw error62;
|
|
47153
|
-
const
|
|
47123
|
+
const message4 = errorMessage(error62);
|
|
47154
47124
|
const checkStatusCommand = `ente recording show ${before.id}`;
|
|
47155
47125
|
this.emitText(
|
|
47156
47126
|
{
|
|
@@ -47159,9 +47129,9 @@ var RecordingRerunCommand = class extends BaseCommand {
|
|
|
47159
47129
|
rerunStarted: null,
|
|
47160
47130
|
outcome: "unknown",
|
|
47161
47131
|
checkStatusCommand,
|
|
47162
|
-
error: { message:
|
|
47132
|
+
error: { message: message4 }
|
|
47163
47133
|
},
|
|
47164
|
-
() => `Re-run attempted for ${before.id}; start and final outcome unknown: ${
|
|
47134
|
+
() => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message4}
|
|
47165
47135
|
Check with: ${checkStatusCommand}. No rerun was retried.`
|
|
47166
47136
|
);
|
|
47167
47137
|
return 1;
|
|
@@ -47184,11 +47154,11 @@ Check with: ${checkStatusCommand}. No rerun was retried.`
|
|
|
47184
47154
|
}
|
|
47185
47155
|
});
|
|
47186
47156
|
} catch (error62) {
|
|
47187
|
-
const
|
|
47157
|
+
const message4 = errorMessage(error62);
|
|
47188
47158
|
const details = error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" ? error62.data : {};
|
|
47189
47159
|
this.emitText(
|
|
47190
|
-
{ id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message:
|
|
47191
|
-
() => `Re-run started for ${before.id}; final outcome unknown: ${
|
|
47160
|
+
{ id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message4 } },
|
|
47161
|
+
() => `Re-run started for ${before.id}; final outcome unknown: ${message4}
|
|
47192
47162
|
Check with: ente recording show ${before.id}. No rerun was retried.`
|
|
47193
47163
|
);
|
|
47194
47164
|
return 1;
|
|
@@ -47450,7 +47420,7 @@ var AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS = 200;
|
|
|
47450
47420
|
var id17 = external_exports.string().min(1).regex(/\S/);
|
|
47451
47421
|
var capped = (maximum) => external_exports.string().max(maximum).refine((value) => value.length <= maximum);
|
|
47452
47422
|
var optionalTrimmed = (maximum) => capped(maximum).transform((value) => value.trim() || void 0).optional();
|
|
47453
|
-
var
|
|
47423
|
+
var message3 = {
|
|
47454
47424
|
text: external_exports.string().trim().min(1).max(AGENT_THREAD_MESSAGE_MAX_CHARACTERS).refine((value) => value.length <= AGENT_THREAD_MESSAGE_MAX_CHARACTERS),
|
|
47455
47425
|
html: capped(AGENT_THREAD_HTML_MAX_CHARACTERS).optional(),
|
|
47456
47426
|
requestKind: external_exports.enum(["ack", "text"]).optional(),
|
|
@@ -47458,9 +47428,9 @@ var message2 = {
|
|
|
47458
47428
|
idempotencyKey: capped(AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS).refine((value) => value.length >= AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS).meta({ minLength: AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS, "x-ente-length-unit": "utf16-code-units" })
|
|
47459
47429
|
};
|
|
47460
47430
|
var agentConversationInputs = {
|
|
47461
|
-
agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...
|
|
47431
|
+
agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message3 }),
|
|
47462
47432
|
agent_thread_claim: external_exports.strictObject({ threadId: id17, attentionVersion: external_exports.number().int().nonnegative() }),
|
|
47463
|
-
agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...
|
|
47433
|
+
agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message3 })
|
|
47464
47434
|
};
|
|
47465
47435
|
function parseAgentConversationInput(operation, raw) {
|
|
47466
47436
|
switch (operation) {
|
|
@@ -47473,11 +47443,11 @@ function parseAgentConversationInput(operation, raw) {
|
|
|
47473
47443
|
}
|
|
47474
47444
|
}
|
|
47475
47445
|
var browserMessage = {
|
|
47476
|
-
text:
|
|
47477
|
-
html:
|
|
47478
|
-
request_kind:
|
|
47479
|
-
request_prompt:
|
|
47480
|
-
idempotency_key:
|
|
47446
|
+
text: message3.text,
|
|
47447
|
+
html: message3.html,
|
|
47448
|
+
request_kind: message3.requestKind,
|
|
47449
|
+
request_prompt: message3.requestPrompt,
|
|
47450
|
+
idempotency_key: message3.idempotencyKey
|
|
47481
47451
|
};
|
|
47482
47452
|
var agentConversationBrowserInputs = {
|
|
47483
47453
|
agent_thread_create: external_exports.strictObject({ agent_id: id17, title: agentConversationInputs.agent_thread_create.shape.title, ...browserMessage }),
|
|
@@ -47498,12 +47468,12 @@ var agentConversationResponseValidator = v.union(
|
|
|
47498
47468
|
);
|
|
47499
47469
|
function mapPayloads2(operation, raw, transform2) {
|
|
47500
47470
|
if (operation === "agent_thread_claim" || !raw || !("message" in raw)) return raw;
|
|
47501
|
-
const
|
|
47471
|
+
const message4 = raw.message;
|
|
47502
47472
|
return { ...raw, message: {
|
|
47503
|
-
...
|
|
47504
|
-
...
|
|
47505
|
-
...
|
|
47506
|
-
...
|
|
47473
|
+
...message4,
|
|
47474
|
+
...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
|
|
47475
|
+
...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
|
|
47476
|
+
...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
|
|
47507
47477
|
} };
|
|
47508
47478
|
}
|
|
47509
47479
|
function parseAgentConversationResult(operation, raw) {
|
|
@@ -47513,9 +47483,9 @@ function parseAgentConversationResult(operation, raw) {
|
|
|
47513
47483
|
}
|
|
47514
47484
|
function encodeAgentConversationResult(operation, raw) {
|
|
47515
47485
|
const data = parseAgentConversationResult(operation, raw);
|
|
47516
|
-
const
|
|
47517
|
-
mapPayloads2(operation,
|
|
47518
|
-
return
|
|
47486
|
+
const json3 = parseOperationResult(operation, agentConversationResults[operation], mapPayloads2(operation, data, encodeAgentContextPayload));
|
|
47487
|
+
mapPayloads2(operation, json3, decodeAgentContextPayload);
|
|
47488
|
+
return json3;
|
|
47519
47489
|
}
|
|
47520
47490
|
|
|
47521
47491
|
// ../packages/shared/src/agent-cli-results.ts
|
|
@@ -47638,12 +47608,12 @@ function normalizeOperatorThread(thread2, agentId = "") {
|
|
|
47638
47608
|
agentId
|
|
47639
47609
|
};
|
|
47640
47610
|
}
|
|
47641
|
-
function normalizeOperatorMessage(
|
|
47611
|
+
function normalizeOperatorMessage(message4) {
|
|
47642
47612
|
return {
|
|
47643
|
-
...
|
|
47644
|
-
_id:
|
|
47645
|
-
toolCalls:
|
|
47646
|
-
toolResults:
|
|
47613
|
+
...message4,
|
|
47614
|
+
_id: message4.messageId,
|
|
47615
|
+
toolCalls: message4.toolCalls,
|
|
47616
|
+
toolResults: message4.toolResults
|
|
47647
47617
|
};
|
|
47648
47618
|
}
|
|
47649
47619
|
async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
@@ -47658,18 +47628,18 @@ async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
|
47658
47628
|
} while (cursor3);
|
|
47659
47629
|
return thread2 ? { thread: thread2, messages } : null;
|
|
47660
47630
|
}
|
|
47661
|
-
function renderAgentConfiguration(
|
|
47631
|
+
function renderAgentConfiguration(agent3) {
|
|
47662
47632
|
const lines = [
|
|
47663
|
-
`${
|
|
47664
|
-
`Space: ${
|
|
47665
|
-
`Mailbox: ${
|
|
47633
|
+
`${agent3.name} ${agent3.agentId}`,
|
|
47634
|
+
`Space: ${agent3.spaceId}`,
|
|
47635
|
+
`Mailbox: ${agent3.mailbox?.status === "active" ? agent3.mailbox.address : "not active"}`,
|
|
47666
47636
|
"",
|
|
47667
47637
|
"Ente prompt configuration:",
|
|
47668
|
-
|
|
47638
|
+
agent3.prompt || "(empty)",
|
|
47669
47639
|
"",
|
|
47670
|
-
`Ente scheduled runs: ${
|
|
47640
|
+
`Ente scheduled runs: ${agent3.schedules.length}`
|
|
47671
47641
|
];
|
|
47672
|
-
for (const schedule of
|
|
47642
|
+
for (const schedule of agent3.schedules) {
|
|
47673
47643
|
const time3 = schedule.timeMinutes === void 0 ? schedule.scheduleType : `${String(Math.floor(schedule.timeMinutes / 60)).padStart(2, "0")}:${String(schedule.timeMinutes % 60).padStart(2, "0")} ${schedule.timezone ?? ""}`.trim();
|
|
47674
47644
|
const condition = schedule.runCondition ?? schedule.mailPurpose;
|
|
47675
47645
|
lines.push(
|
|
@@ -47683,8 +47653,8 @@ var AgentList = class extends ClientCommand {
|
|
|
47683
47653
|
static usage = Command.Usage({ category: "Agent", description: "Show the agent bound to this key" });
|
|
47684
47654
|
async run() {
|
|
47685
47655
|
const context = await this.client().getAuthContext();
|
|
47686
|
-
const
|
|
47687
|
-
this.emitText({ data: [
|
|
47656
|
+
const agent3 = await boundAgentIdentity(this.client(), context);
|
|
47657
|
+
this.emitText({ data: [agent3] }, () => `${agent3.name} (bound agent) ${agent3.agentId}`);
|
|
47688
47658
|
}
|
|
47689
47659
|
};
|
|
47690
47660
|
var AgentThreads = class extends ClientCommand {
|
|
@@ -51032,16 +51002,16 @@ function renderThread(thread2) {
|
|
|
51032
51002
|
const unread = thread2.hasUnread ? ` unread:${thread2.unreadCount}` : "";
|
|
51033
51003
|
return `${fmtTime2(thread2.latestAt)} [${thread2.state}]${unread} ${thread2.subject} ${thread2.threadId}`;
|
|
51034
51004
|
}
|
|
51035
|
-
function renderMessage2(
|
|
51036
|
-
const direction =
|
|
51037
|
-
const date5 =
|
|
51038
|
-
const body =
|
|
51039
|
-
${
|
|
51040
|
-
const cc =
|
|
51041
|
-
CC: ${
|
|
51042
|
-
const files = (
|
|
51005
|
+
function renderMessage2(message4) {
|
|
51006
|
+
const direction = message4.direction === "inbound" ? "\u2190" : "\u2192";
|
|
51007
|
+
const date5 = message4.receivedAt ?? message4.sentAt;
|
|
51008
|
+
const body = message4.text ? `
|
|
51009
|
+
${message4.text}` : "";
|
|
51010
|
+
const cc = message4.cc?.length ? `
|
|
51011
|
+
CC: ${message4.cc.join(", ")}` : "";
|
|
51012
|
+
const files = (message4.attachments ?? []).map((file2) => `
|
|
51043
51013
|
Attachment: ${JSON.stringify(file2.filename)} ${file2.mimeType} ${file2.size} bytes ${file2.attachmentId}`).join("");
|
|
51044
|
-
return `${direction} ${fmtTime2(date5)} ${
|
|
51014
|
+
return `${direction} ${fmtTime2(date5)} ${message4.from ?? "unknown"} [${message4.deliveryStatus}] ${message4.messageId}${cc}${files}${body}`;
|
|
51045
51015
|
}
|
|
51046
51016
|
var AgentMailAddress = class extends ClientCommand {
|
|
51047
51017
|
static paths = [["agent", "mail", "address"]];
|
|
@@ -51448,9 +51418,9 @@ function updateCommandArgs() {
|
|
|
51448
51418
|
var UPDATE_SHELL_COMMAND = ["npm", ...updateCommandArgs()].join(" ");
|
|
51449
51419
|
var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from Ivo's Gitea registry; installing it from npm (registry.npmjs.org) instead.";
|
|
51450
51420
|
var updateRunner = {
|
|
51451
|
-
run(command, args,
|
|
51421
|
+
run(command, args, json3) {
|
|
51452
51422
|
return spawnSync2(command, args, {
|
|
51453
|
-
stdio:
|
|
51423
|
+
stdio: json3 ? ["ignore", 2, 2] : "inherit",
|
|
51454
51424
|
shell: process.platform === "win32"
|
|
51455
51425
|
});
|
|
51456
51426
|
},
|
|
@@ -51483,13 +51453,13 @@ var updateRunner = {
|
|
|
51483
51453
|
}
|
|
51484
51454
|
}
|
|
51485
51455
|
};
|
|
51486
|
-
function installLatestFromNpm(stderr,
|
|
51456
|
+
function installLatestFromNpm(stderr, json3, options = {}) {
|
|
51487
51457
|
const installSource = updateRunner.installSource();
|
|
51488
51458
|
if (installSource === "gitea" && options.announceMove !== false) stderr.write(`${MOVING_TO_NPM_NOTICE}
|
|
51489
51459
|
`);
|
|
51490
|
-
if (!
|
|
51460
|
+
if (!json3) stderr.write(`Running: ${UPDATE_SHELL_COMMAND}
|
|
51491
51461
|
`);
|
|
51492
|
-
const result = updateRunner.run("npm", updateCommandArgs(),
|
|
51462
|
+
const result = updateRunner.run("npm", updateCommandArgs(), json3);
|
|
51493
51463
|
if (result.error || result.status !== 0) {
|
|
51494
51464
|
const reason = result.error ? result.error.message : `npm exited with ${result.status ?? "a signal"}`;
|
|
51495
51465
|
throw new Error(`Could not update ente-cli (${reason}). Run it yourself: ${UPDATE_SHELL_COMMAND}`);
|