ente-cli 0.4.135 → 0.4.137
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 +1 -1
- package/dist/SKILL.md +17 -13
- package/dist/cli.mjs +185 -217
- package/dist/cli.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3988,12 +3988,12 @@ function createApi(pathParts = []) {
|
|
|
3988
3988
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
3989
3989
|
);
|
|
3990
3990
|
}
|
|
3991
|
-
const
|
|
3991
|
+
const path12 = pathParts.slice(0, -1).join("/");
|
|
3992
3992
|
const exportName = pathParts[pathParts.length - 1];
|
|
3993
3993
|
if (exportName === "default") {
|
|
3994
|
-
return
|
|
3994
|
+
return path12;
|
|
3995
3995
|
} else {
|
|
3996
|
-
return
|
|
3996
|
+
return path12 + ":" + exportName;
|
|
3997
3997
|
}
|
|
3998
3998
|
} else if (prop === Symbol.toStringTag) {
|
|
3999
3999
|
return "FunctionReference";
|
|
@@ -4384,8 +4384,8 @@ var init_router = __esm({
|
|
|
4384
4384
|
__publicField13(this, "getRoutes", () => {
|
|
4385
4385
|
const exactPaths = [...this.exactRoutes.keys()].sort();
|
|
4386
4386
|
const exact = exactPaths.flatMap(
|
|
4387
|
-
(
|
|
4388
|
-
(method) => [
|
|
4387
|
+
(path12) => [...this.exactRoutes.get(path12).keys()].sort().map(
|
|
4388
|
+
(method) => [path12, method, this.exactRoutes.get(path12).get(method)]
|
|
4389
4389
|
)
|
|
4390
4390
|
);
|
|
4391
4391
|
const prefixPathMethods = [...this.prefixRoutes.keys()].sort();
|
|
@@ -4400,16 +4400,16 @@ var init_router = __esm({
|
|
|
4400
4400
|
);
|
|
4401
4401
|
return [...exact, ...prefixes];
|
|
4402
4402
|
});
|
|
4403
|
-
__publicField13(this, "lookup", (
|
|
4403
|
+
__publicField13(this, "lookup", (path12, method) => {
|
|
4404
4404
|
method = normalizeMethod(method);
|
|
4405
|
-
const exactMatch = this.exactRoutes.get(
|
|
4406
|
-
if (exactMatch) return [exactMatch, method,
|
|
4405
|
+
const exactMatch = this.exactRoutes.get(path12)?.get(method);
|
|
4406
|
+
if (exactMatch) return [exactMatch, method, path12];
|
|
4407
4407
|
const prefixes = this.prefixRoutes.get(method) || /* @__PURE__ */ new Map();
|
|
4408
4408
|
const prefixesSorted = [...prefixes.entries()].sort(
|
|
4409
4409
|
([prefixA, _a5], [prefixB, _b3]) => prefixB.length - prefixA.length
|
|
4410
4410
|
);
|
|
4411
4411
|
for (const [pathPrefix, endpoint] of prefixesSorted) {
|
|
4412
|
-
if (
|
|
4412
|
+
if (path12.startsWith(pathPrefix)) {
|
|
4413
4413
|
return [endpoint, method, `${pathPrefix}*`];
|
|
4414
4414
|
}
|
|
4415
4415
|
}
|
|
@@ -4601,14 +4601,14 @@ function serializeChildComponents(childComponents) {
|
|
|
4601
4601
|
}
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
4604
|
-
const
|
|
4605
|
-
if (!
|
|
4604
|
+
const path12 = definition6.componentDefinitionPath;
|
|
4605
|
+
if (!path12)
|
|
4606
4606
|
throw new Error(
|
|
4607
4607
|
"no .componentPath for component definition " + JSON.stringify(definition6, null, 2)
|
|
4608
4608
|
);
|
|
4609
4609
|
return {
|
|
4610
4610
|
name: name4,
|
|
4611
|
-
path:
|
|
4611
|
+
path: path12,
|
|
4612
4612
|
args: [],
|
|
4613
4613
|
env
|
|
4614
4614
|
};
|
|
@@ -5327,10 +5327,10 @@ function cleanValidationError(message4, { mergeName = false } = {}) {
|
|
|
5327
5327
|
const match = message4.match(/^([^:]+): (.*)$/m);
|
|
5328
5328
|
if (!match)
|
|
5329
5329
|
return `validation failed`;
|
|
5330
|
-
let [,
|
|
5330
|
+
let [, path12, line] = match;
|
|
5331
5331
|
if (mergeName)
|
|
5332
5332
|
line = line[0].toLowerCase() + line.slice(1);
|
|
5333
|
-
line =
|
|
5333
|
+
line = path12 !== `.` || !mergeName ? `${path12.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
5334
5334
|
return line;
|
|
5335
5335
|
}
|
|
5336
5336
|
function formatError(message4, errors) {
|
|
@@ -5834,9 +5834,9 @@ var reducers = {
|
|
|
5834
5834
|
return { ...state, options, tokens };
|
|
5835
5835
|
},
|
|
5836
5836
|
pushPath: (state, segment, segmentIndex) => {
|
|
5837
|
-
const
|
|
5837
|
+
const path12 = state.path.concat(segment);
|
|
5838
5838
|
const tokens = state.tokens.concat({ segmentIndex, type: `path` });
|
|
5839
|
-
return { ...state, path:
|
|
5839
|
+
return { ...state, path: path12, tokens };
|
|
5840
5840
|
},
|
|
5841
5841
|
pushPositional: (state, segment, segmentIndex) => {
|
|
5842
5842
|
const positionals = state.positionals.concat({ value: segment, extra: false });
|
|
@@ -5921,8 +5921,8 @@ var CommandBuilder = class {
|
|
|
5921
5921
|
this.cliIndex = cliIndex;
|
|
5922
5922
|
this.cliOpts = cliOpts;
|
|
5923
5923
|
}
|
|
5924
|
-
addPath(
|
|
5925
|
-
this.paths.push(
|
|
5924
|
+
addPath(path12) {
|
|
5925
|
+
this.paths.push(path12);
|
|
5926
5926
|
}
|
|
5927
5927
|
setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) {
|
|
5928
5928
|
Object.assign(this.arity, { leading, trailing, extra, proxy });
|
|
@@ -6010,19 +6010,19 @@ var CommandBuilder = class {
|
|
|
6010
6010
|
registerStatic(machine, NodeType.InitialNode, SpecialToken.StartOfInput, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]);
|
|
6011
6011
|
const positionalArgument = this.arity.proxy ? `always` : `isNotOptionLike`;
|
|
6012
6012
|
const paths = this.paths.length > 0 ? this.paths : [[]];
|
|
6013
|
-
for (const
|
|
6013
|
+
for (const path12 of paths) {
|
|
6014
6014
|
let lastPathNode = firstNode;
|
|
6015
|
-
if (
|
|
6015
|
+
if (path12.length > 0) {
|
|
6016
6016
|
const optionPathNode = injectNode(machine, makeNode());
|
|
6017
6017
|
registerShortcut(machine, lastPathNode, optionPathNode);
|
|
6018
6018
|
this.registerOptions(machine, optionPathNode);
|
|
6019
6019
|
lastPathNode = optionPathNode;
|
|
6020
6020
|
}
|
|
6021
|
-
for (let t = 0; t <
|
|
6021
|
+
for (let t = 0; t < path12.length; ++t) {
|
|
6022
6022
|
const nextPathNode = injectNode(machine, makeNode());
|
|
6023
|
-
registerStatic(machine, lastPathNode,
|
|
6023
|
+
registerStatic(machine, lastPathNode, path12[t], nextPathNode, `pushPath`);
|
|
6024
6024
|
lastPathNode = nextPathNode;
|
|
6025
|
-
if (t + 1 <
|
|
6025
|
+
if (t + 1 < path12.length) {
|
|
6026
6026
|
const helpNode = injectNode(machine, makeNode());
|
|
6027
6027
|
registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);
|
|
6028
6028
|
registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);
|
|
@@ -6328,8 +6328,8 @@ var Cli = class _Cli {
|
|
|
6328
6328
|
const index = builder.cliIndex;
|
|
6329
6329
|
const paths = (_a5 = commandClass.paths) !== null && _a5 !== void 0 ? _a5 : command.paths;
|
|
6330
6330
|
if (typeof paths !== `undefined`)
|
|
6331
|
-
for (const
|
|
6332
|
-
builder.addPath(
|
|
6331
|
+
for (const path12 of paths)
|
|
6332
|
+
builder.addPath(path12);
|
|
6333
6333
|
this.registrations.set(commandClass, { specs, builder, index });
|
|
6334
6334
|
for (const [key, { definition: definition6 }] of specs.entries())
|
|
6335
6335
|
definition6(builder, key);
|
|
@@ -6427,13 +6427,13 @@ var Cli = class _Cli {
|
|
|
6427
6427
|
definition(commandClass, { colored = false } = {}) {
|
|
6428
6428
|
if (!commandClass.usage)
|
|
6429
6429
|
return null;
|
|
6430
|
-
const { usage:
|
|
6430
|
+
const { usage: path12 } = this.getUsageByRegistration(commandClass, { detailed: false });
|
|
6431
6431
|
const { usage, options } = this.getUsageByRegistration(commandClass, { detailed: true, inlineOptions: false });
|
|
6432
6432
|
const category = typeof commandClass.usage.category !== `undefined` ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
6433
6433
|
const description = typeof commandClass.usage.description !== `undefined` ? formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
6434
6434
|
const details = typeof commandClass.usage.details !== `undefined` ? formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true }) : void 0;
|
|
6435
6435
|
const examples = typeof commandClass.usage.examples !== `undefined` ? commandClass.usage.examples.map(([label, cli2]) => [formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli2.replace(/\$0/g, this.binaryName)]) : void 0;
|
|
6436
|
-
return { path:
|
|
6436
|
+
return { path: path12, usage, category, description, details, examples, options };
|
|
6437
6437
|
}
|
|
6438
6438
|
definitions({ colored = false } = {}) {
|
|
6439
6439
|
const data = [];
|
|
@@ -6452,7 +6452,7 @@ var Cli = class _Cli {
|
|
|
6452
6452
|
const paths = commandClass2.paths;
|
|
6453
6453
|
const isDocumented = typeof commandClass2.usage !== `undefined`;
|
|
6454
6454
|
const isExclusivelyDefault = !paths || paths.length === 0 || paths.length === 1 && paths[0].length === 0;
|
|
6455
|
-
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((
|
|
6455
|
+
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((path12) => path12.length === 0)) !== null && _a5 !== void 0 ? _a5 : false);
|
|
6456
6456
|
if (isDefault) {
|
|
6457
6457
|
if (command) {
|
|
6458
6458
|
command = null;
|
|
@@ -8918,10 +8918,10 @@ function mergeDefs(...defs) {
|
|
|
8918
8918
|
function cloneDef(schema) {
|
|
8919
8919
|
return mergeDefs(schema._zod.def);
|
|
8920
8920
|
}
|
|
8921
|
-
function getElementAtPath(obj,
|
|
8922
|
-
if (!
|
|
8921
|
+
function getElementAtPath(obj, path12) {
|
|
8922
|
+
if (!path12)
|
|
8923
8923
|
return obj;
|
|
8924
|
-
return
|
|
8924
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
8925
8925
|
}
|
|
8926
8926
|
function promiseAllObject(promisesObj) {
|
|
8927
8927
|
const keys = Object.keys(promisesObj);
|
|
@@ -9261,11 +9261,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9261
9261
|
}
|
|
9262
9262
|
return false;
|
|
9263
9263
|
}
|
|
9264
|
-
function prefixIssues(
|
|
9264
|
+
function prefixIssues(path12, issues) {
|
|
9265
9265
|
return issues.map((iss) => {
|
|
9266
9266
|
var _a5;
|
|
9267
9267
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
9268
|
-
iss.path.unshift(
|
|
9268
|
+
iss.path.unshift(path12);
|
|
9269
9269
|
return iss;
|
|
9270
9270
|
});
|
|
9271
9271
|
}
|
|
@@ -9727,16 +9727,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
9727
9727
|
}
|
|
9728
9728
|
function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
9729
9729
|
const fieldErrors = { _errors: [] };
|
|
9730
|
-
const processError = (error63,
|
|
9730
|
+
const processError = (error63, path12 = []) => {
|
|
9731
9731
|
for (const issue2 of error63.issues) {
|
|
9732
9732
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
9733
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
9733
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
9734
9734
|
} else if (issue2.code === "invalid_key") {
|
|
9735
|
-
processError({ issues: issue2.issues }, [...
|
|
9735
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
9736
9736
|
} else if (issue2.code === "invalid_element") {
|
|
9737
|
-
processError({ issues: issue2.issues }, [...
|
|
9737
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
9738
9738
|
} else {
|
|
9739
|
-
const fullpath = [...
|
|
9739
|
+
const fullpath = [...path12, ...issue2.path];
|
|
9740
9740
|
if (fullpath.length === 0) {
|
|
9741
9741
|
fieldErrors._errors.push(mapper(issue2));
|
|
9742
9742
|
} else {
|
|
@@ -9775,17 +9775,17 @@ function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
|
9775
9775
|
}
|
|
9776
9776
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
9777
9777
|
const result = { errors: [] };
|
|
9778
|
-
const processError = (error63,
|
|
9778
|
+
const processError = (error63, path12 = []) => {
|
|
9779
9779
|
var _a5;
|
|
9780
9780
|
for (const issue2 of error63.issues) {
|
|
9781
9781
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
9782
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
9782
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
9783
9783
|
} else if (issue2.code === "invalid_key") {
|
|
9784
|
-
processError({ issues: issue2.issues }, [...
|
|
9784
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
9785
9785
|
} else if (issue2.code === "invalid_element") {
|
|
9786
|
-
processError({ issues: issue2.issues }, [...
|
|
9786
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
9787
9787
|
} else {
|
|
9788
|
-
const fullpath = [...
|
|
9788
|
+
const fullpath = [...path12, ...issue2.path];
|
|
9789
9789
|
if (fullpath.length === 0) {
|
|
9790
9790
|
result.errors.push(mapper(issue2));
|
|
9791
9791
|
continue;
|
|
@@ -9824,8 +9824,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
9824
9824
|
}
|
|
9825
9825
|
function toDotPath(_path) {
|
|
9826
9826
|
const segs = [];
|
|
9827
|
-
const
|
|
9828
|
-
for (const seg of
|
|
9827
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
9828
|
+
for (const seg of path12) {
|
|
9829
9829
|
if (typeof seg === "number")
|
|
9830
9830
|
segs.push(`[${seg}]`);
|
|
9831
9831
|
else if (typeof seg === "symbol")
|
|
@@ -26963,13 +26963,13 @@ function resolveRef(ref, ctx) {
|
|
|
26963
26963
|
if (!ref.startsWith("#")) {
|
|
26964
26964
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
26965
26965
|
}
|
|
26966
|
-
const
|
|
26967
|
-
if (
|
|
26966
|
+
const path12 = ref.slice(1).split("/").filter(Boolean);
|
|
26967
|
+
if (path12.length === 0) {
|
|
26968
26968
|
return ctx.rootSchema;
|
|
26969
26969
|
}
|
|
26970
26970
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
26971
|
-
if (
|
|
26972
|
-
const key =
|
|
26971
|
+
if (path12[0] === defsKey) {
|
|
26972
|
+
const key = path12[1] === void 0 ? void 0 : decodeJSONPointerSegment(path12[1]);
|
|
26973
26973
|
if (!key || !ctx.defs[key]) {
|
|
26974
26974
|
throw new Error(`Reference not found: ${ref}`);
|
|
26975
26975
|
}
|
|
@@ -28120,12 +28120,12 @@ var ValidationError = class extends Error {
|
|
|
28120
28120
|
expected;
|
|
28121
28121
|
got;
|
|
28122
28122
|
path;
|
|
28123
|
-
constructor(expected, got,
|
|
28124
|
-
const message4 = `Validator error${
|
|
28123
|
+
constructor(expected, got, path12) {
|
|
28124
|
+
const message4 = `Validator error${path12 ? ` for ${path12}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
28125
28125
|
super(message4);
|
|
28126
28126
|
this.expected = expected;
|
|
28127
28127
|
this.got = got;
|
|
28128
|
-
this.path =
|
|
28128
|
+
this.path = path12;
|
|
28129
28129
|
this.name = "ValidationError";
|
|
28130
28130
|
}
|
|
28131
28131
|
};
|
|
@@ -28208,10 +28208,10 @@ function validate2(validator, value, opts) {
|
|
|
28208
28208
|
break;
|
|
28209
28209
|
}
|
|
28210
28210
|
for (const [index, v3] of value.entries()) {
|
|
28211
|
-
const
|
|
28211
|
+
const path12 = `${opts?._pathPrefix ?? ""}[${index}]`;
|
|
28212
28212
|
valid2 = validate2(validator.element, v3, {
|
|
28213
28213
|
...opts,
|
|
28214
|
-
_pathPrefix:
|
|
28214
|
+
_pathPrefix: path12
|
|
28215
28215
|
});
|
|
28216
28216
|
if (!valid2) {
|
|
28217
28217
|
expected = validator.element.kind;
|
|
@@ -28309,8 +28309,8 @@ function validate2(validator, value, opts) {
|
|
|
28309
28309
|
}
|
|
28310
28310
|
return valid2;
|
|
28311
28311
|
}
|
|
28312
|
-
function appendPath(opts,
|
|
28313
|
-
return opts?._pathPrefix ? `${opts._pathPrefix}.${
|
|
28312
|
+
function appendPath(opts, path12) {
|
|
28313
|
+
return opts?._pathPrefix ? `${opts._pathPrefix}.${path12}` : path12;
|
|
28314
28314
|
}
|
|
28315
28315
|
|
|
28316
28316
|
// ../packages/shared/src/operation-validation.ts
|
|
@@ -28582,14 +28582,14 @@ var UpgradeRequiredError = class extends Error {
|
|
|
28582
28582
|
function isUpgradeRequired(err) {
|
|
28583
28583
|
return err instanceof UpgradeRequiredError || err instanceof ApiError && err.statusCode === 426;
|
|
28584
28584
|
}
|
|
28585
|
-
async function upgradeRequiredFromResponse(resp,
|
|
28585
|
+
async function upgradeRequiredFromResponse(resp, path12) {
|
|
28586
28586
|
let data = {};
|
|
28587
28587
|
try {
|
|
28588
28588
|
const body = await resp.json();
|
|
28589
28589
|
if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
|
|
28590
28590
|
} catch {
|
|
28591
28591
|
}
|
|
28592
|
-
const message4 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${
|
|
28592
|
+
const message4 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path12} (426 Upgrade Required). Install the latest version.`;
|
|
28593
28593
|
return new UpgradeRequiredError(message4, data);
|
|
28594
28594
|
}
|
|
28595
28595
|
|
|
@@ -28636,7 +28636,7 @@ function writeCommandError(stdout, stderr, json3, error62) {
|
|
|
28636
28636
|
return;
|
|
28637
28637
|
}
|
|
28638
28638
|
const data = error62 instanceof ApiError ? error62.error : error62 instanceof Error && "data" in error62 ? error62.data : void 0;
|
|
28639
|
-
const details = data && typeof data === "object" && !Array.isArray(data) ? data : {};
|
|
28639
|
+
const details = data && typeof data === "object" && !Array.isArray(data) ? withoutAgentFingerprint(data) : {};
|
|
28640
28640
|
stdout.write(`${JSON.stringify({ error: {
|
|
28641
28641
|
...details,
|
|
28642
28642
|
message: message4,
|
|
@@ -28644,6 +28644,11 @@ function writeCommandError(stdout, stderr, json3, error62) {
|
|
|
28644
28644
|
} }, null, 2)}
|
|
28645
28645
|
`);
|
|
28646
28646
|
}
|
|
28647
|
+
function withoutAgentFingerprint(data) {
|
|
28648
|
+
if (!("grantFingerprint" in data)) return data;
|
|
28649
|
+
const { grantFingerprint: _unusable, ...rest } = data;
|
|
28650
|
+
return rest;
|
|
28651
|
+
}
|
|
28647
28652
|
function commandErrorExitCode(error62) {
|
|
28648
28653
|
return isUpgradeRequired(error62) ? UPGRADE_REQUIRED_EXIT_CODE : 1;
|
|
28649
28654
|
}
|
|
@@ -28719,7 +28724,7 @@ function parseOperationFieldPairs(operation, pairs) {
|
|
|
28719
28724
|
}
|
|
28720
28725
|
|
|
28721
28726
|
// ente/version.ts
|
|
28722
|
-
var VERSION = "0.4.
|
|
28727
|
+
var VERSION = "0.4.137";
|
|
28723
28728
|
|
|
28724
28729
|
// ente/branding.ts
|
|
28725
28730
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -29395,12 +29400,12 @@ function createApi2(pathParts = []) {
|
|
|
29395
29400
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
29396
29401
|
);
|
|
29397
29402
|
}
|
|
29398
|
-
const
|
|
29403
|
+
const path12 = pathParts.slice(0, -1).join("/");
|
|
29399
29404
|
const exportName = pathParts[pathParts.length - 1];
|
|
29400
29405
|
if (exportName === "default") {
|
|
29401
|
-
return
|
|
29406
|
+
return path12;
|
|
29402
29407
|
} else {
|
|
29403
|
-
return
|
|
29408
|
+
return path12 + ":" + exportName;
|
|
29404
29409
|
}
|
|
29405
29410
|
} else if (prop === Symbol.toStringTag) {
|
|
29406
29411
|
return "FunctionReference";
|
|
@@ -34078,58 +34083,58 @@ var RestClient = class {
|
|
|
34078
34083
|
this.timeoutMs = opts.timeoutMs ?? 15e3;
|
|
34079
34084
|
this.defaultHeaders = opts.defaultHeaders ?? {};
|
|
34080
34085
|
}
|
|
34081
|
-
sendJson(method,
|
|
34082
|
-
return this.request(method,
|
|
34086
|
+
sendJson(method, path12, body) {
|
|
34087
|
+
return this.request(method, path12, body);
|
|
34083
34088
|
}
|
|
34084
|
-
get(
|
|
34085
|
-
return this.request("GET",
|
|
34089
|
+
get(path12, params, opts) {
|
|
34090
|
+
return this.request("GET", path12, void 0, params, opts);
|
|
34086
34091
|
}
|
|
34087
|
-
post(
|
|
34088
|
-
return this.request("POST",
|
|
34092
|
+
post(path12, body, params, opts) {
|
|
34093
|
+
return this.request("POST", path12, body, params, opts);
|
|
34089
34094
|
}
|
|
34090
|
-
patch(
|
|
34091
|
-
return this.request("PATCH",
|
|
34095
|
+
patch(path12, body, params, opts) {
|
|
34096
|
+
return this.request("PATCH", path12, body, params, opts);
|
|
34092
34097
|
}
|
|
34093
|
-
put(
|
|
34094
|
-
return this.request("PUT",
|
|
34098
|
+
put(path12, body, params, opts) {
|
|
34099
|
+
return this.request("PUT", path12, body, params, opts);
|
|
34095
34100
|
}
|
|
34096
|
-
delete(
|
|
34097
|
-
return this.request("DELETE",
|
|
34101
|
+
delete(path12, params, opts) {
|
|
34102
|
+
return this.request("DELETE", path12, void 0, params, opts);
|
|
34098
34103
|
}
|
|
34099
34104
|
/**
|
|
34100
34105
|
* POST raw bytes with an explicit Content-Type (not JSON). Used for binary
|
|
34101
34106
|
* uploads where the request body is the file itself, not a JSON envelope.
|
|
34102
34107
|
*/
|
|
34103
|
-
postRaw(
|
|
34104
|
-
return this.request("POST",
|
|
34108
|
+
postRaw(path12, bytes2, contentType, params, opts) {
|
|
34109
|
+
return this.request("POST", path12, void 0, params, opts, { bytes: bytes2, contentType });
|
|
34105
34110
|
}
|
|
34106
34111
|
/**
|
|
34107
34112
|
* GET a raw byte body, aborting once it exceeds `maxBytes`. Errors still
|
|
34108
34113
|
* parse the structured JSON error envelope.
|
|
34109
34114
|
*/
|
|
34110
|
-
async getBytes(
|
|
34115
|
+
async getBytes(path12, params, opts) {
|
|
34111
34116
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
34112
34117
|
const controller = new AbortController();
|
|
34113
34118
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34114
34119
|
try {
|
|
34115
34120
|
let resp;
|
|
34116
34121
|
try {
|
|
34117
|
-
resp = await fetch(this.buildUrl(
|
|
34122
|
+
resp = await fetch(this.buildUrl(path12, params), {
|
|
34118
34123
|
method: "GET",
|
|
34119
34124
|
headers: { ...this.defaultHeaders, Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
34120
34125
|
signal: controller.signal
|
|
34121
34126
|
});
|
|
34122
34127
|
} catch (err) {
|
|
34123
34128
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34124
|
-
throw new Error(`Request to ${
|
|
34129
|
+
throw new Error(`Request to ${path12} timed out after ${timeoutMs}ms.`);
|
|
34125
34130
|
}
|
|
34126
|
-
throw new Error(`Could not reach the ente API (${
|
|
34131
|
+
throw new Error(`Could not reach the ente API (${path12}): ${String(err)}`);
|
|
34127
34132
|
}
|
|
34128
34133
|
const bodyLimit = resp.status >= 400 ? 64 * 1024 : opts.maxBytes;
|
|
34129
34134
|
const declared = Number(resp.headers.get("Content-Length") ?? "0");
|
|
34130
34135
|
if (declared > bodyLimit) {
|
|
34131
34136
|
await resp.body?.cancel();
|
|
34132
|
-
throw new Error(`Response from ${
|
|
34137
|
+
throw new Error(`Response from ${path12} exceeds ${bodyLimit} bytes.`);
|
|
34133
34138
|
}
|
|
34134
34139
|
const chunks = [];
|
|
34135
34140
|
let total = 0;
|
|
@@ -34141,7 +34146,7 @@ var RestClient = class {
|
|
|
34141
34146
|
total += value.byteLength;
|
|
34142
34147
|
if (total > bodyLimit) {
|
|
34143
34148
|
await reader.cancel();
|
|
34144
|
-
throw new Error(`Response from ${
|
|
34149
|
+
throw new Error(`Response from ${path12} exceeds ${bodyLimit} bytes.`);
|
|
34145
34150
|
}
|
|
34146
34151
|
chunks.push(value);
|
|
34147
34152
|
}
|
|
@@ -34158,15 +34163,15 @@ var RestClient = class {
|
|
|
34158
34163
|
return { bytes: bytes2, headers: resp.headers };
|
|
34159
34164
|
} catch (err) {
|
|
34160
34165
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34161
|
-
throw new Error(`Request to ${
|
|
34166
|
+
throw new Error(`Request to ${path12} timed out after ${timeoutMs}ms.`);
|
|
34162
34167
|
}
|
|
34163
34168
|
throw err;
|
|
34164
34169
|
} finally {
|
|
34165
34170
|
clearTimeout(timer);
|
|
34166
34171
|
}
|
|
34167
34172
|
}
|
|
34168
|
-
buildUrl(
|
|
34169
|
-
const url2 = new URL(this.baseUrl +
|
|
34173
|
+
buildUrl(path12, params) {
|
|
34174
|
+
const url2 = new URL(this.baseUrl + path12);
|
|
34170
34175
|
if (params) {
|
|
34171
34176
|
for (const [k, v3] of Object.entries(params)) {
|
|
34172
34177
|
if (v3 !== void 0) url2.searchParams.set(k, v3);
|
|
@@ -34174,13 +34179,13 @@ var RestClient = class {
|
|
|
34174
34179
|
}
|
|
34175
34180
|
return url2.toString();
|
|
34176
34181
|
}
|
|
34177
|
-
async request(method,
|
|
34182
|
+
async request(method, path12, body, params, opts, raw) {
|
|
34178
34183
|
const timeoutMs = opts?.timeoutMs ?? this.timeoutMs;
|
|
34179
34184
|
const controller = new AbortController();
|
|
34180
34185
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34181
34186
|
let resp;
|
|
34182
34187
|
try {
|
|
34183
|
-
resp = await fetch(this.buildUrl(
|
|
34188
|
+
resp = await fetch(this.buildUrl(path12, params), {
|
|
34184
34189
|
method,
|
|
34185
34190
|
headers: {
|
|
34186
34191
|
...this.defaultHeaders,
|
|
@@ -34199,9 +34204,9 @@ var RestClient = class {
|
|
|
34199
34204
|
} catch (err) {
|
|
34200
34205
|
clearTimeout(timer);
|
|
34201
34206
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34202
|
-
throw new Error(`Request to ${
|
|
34207
|
+
throw new Error(`Request to ${path12} timed out after ${timeoutMs}ms.`);
|
|
34203
34208
|
}
|
|
34204
|
-
throw new Error(`Could not reach the ente API (${
|
|
34209
|
+
throw new Error(`Could not reach the ente API (${path12}): ${String(err)}`);
|
|
34205
34210
|
}
|
|
34206
34211
|
clearTimeout(timer);
|
|
34207
34212
|
const text3 = await resp.text();
|
|
@@ -36412,7 +36417,7 @@ var require_constants = __commonJS2({
|
|
|
36412
36417
|
var require_node_gyp_build = __commonJS2({
|
|
36413
36418
|
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
36414
36419
|
var fs = __require2("fs");
|
|
36415
|
-
var
|
|
36420
|
+
var path12 = __require2("path");
|
|
36416
36421
|
var os4 = __require2("os");
|
|
36417
36422
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
36418
36423
|
var vars3 = process.config && process.config.variables || {};
|
|
@@ -36429,21 +36434,21 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36429
36434
|
return runtimeRequire(load.resolve(dir));
|
|
36430
36435
|
}
|
|
36431
36436
|
load.resolve = load.path = function(dir) {
|
|
36432
|
-
dir =
|
|
36437
|
+
dir = path12.resolve(dir || ".");
|
|
36433
36438
|
try {
|
|
36434
|
-
var name4 = runtimeRequire(
|
|
36439
|
+
var name4 = runtimeRequire(path12.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
36435
36440
|
if (process.env[name4 + "_PREBUILD"]) dir = process.env[name4 + "_PREBUILD"];
|
|
36436
36441
|
} catch (err) {
|
|
36437
36442
|
}
|
|
36438
36443
|
if (!prebuildsOnly) {
|
|
36439
|
-
var release = getFirst(
|
|
36444
|
+
var release = getFirst(path12.join(dir, "build/Release"), matchBuild);
|
|
36440
36445
|
if (release) return release;
|
|
36441
|
-
var debug2 = getFirst(
|
|
36446
|
+
var debug2 = getFirst(path12.join(dir, "build/Debug"), matchBuild);
|
|
36442
36447
|
if (debug2) return debug2;
|
|
36443
36448
|
}
|
|
36444
36449
|
var prebuild = resolve2(dir);
|
|
36445
36450
|
if (prebuild) return prebuild;
|
|
36446
|
-
var nearby = resolve2(
|
|
36451
|
+
var nearby = resolve2(path12.dirname(process.execPath));
|
|
36447
36452
|
if (nearby) return nearby;
|
|
36448
36453
|
var target3 = [
|
|
36449
36454
|
"platform=" + platform,
|
|
@@ -36460,14 +36465,14 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36460
36465
|
].filter(Boolean).join(" ");
|
|
36461
36466
|
throw new Error("No native build was found for " + target3 + "\n loaded from: " + dir + "\n");
|
|
36462
36467
|
function resolve2(dir2) {
|
|
36463
|
-
var tuples = readdirSync2(
|
|
36468
|
+
var tuples = readdirSync2(path12.join(dir2, "prebuilds")).map(parseTuple);
|
|
36464
36469
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
36465
36470
|
if (!tuple2) return;
|
|
36466
|
-
var prebuilds =
|
|
36471
|
+
var prebuilds = path12.join(dir2, "prebuilds", tuple2.name);
|
|
36467
36472
|
var parsed = readdirSync2(prebuilds).map(parseTags);
|
|
36468
36473
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
36469
36474
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
36470
|
-
if (winner) return
|
|
36475
|
+
if (winner) return path12.join(prebuilds, winner.file);
|
|
36471
36476
|
}
|
|
36472
36477
|
};
|
|
36473
36478
|
function readdirSync2(dir) {
|
|
@@ -36479,7 +36484,7 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36479
36484
|
}
|
|
36480
36485
|
function getFirst(dir, filter) {
|
|
36481
36486
|
var files = readdirSync2(dir).filter(filter);
|
|
36482
|
-
return files[0] &&
|
|
36487
|
+
return files[0] && path12.join(dir, files[0]);
|
|
36483
36488
|
}
|
|
36484
36489
|
function matchBuild(name4) {
|
|
36485
36490
|
return /\.node$/.test(name4);
|
|
@@ -42068,8 +42073,7 @@ var selector2 = external_exports.string().refine((value) => value.trim().length
|
|
|
42068
42073
|
var graphSelectors = external_exports.array(selector2).min(1).max(8192);
|
|
42069
42074
|
var graphCreateIntent = activityWriteInputs.createActivity.omit({ spaceId: true, entityIds: true }).extend({
|
|
42070
42075
|
space: selector2,
|
|
42071
|
-
entities: graphSelectors
|
|
42072
|
-
entitySpaceGrantFingerprint: external_exports.string().optional()
|
|
42076
|
+
entities: graphSelectors
|
|
42073
42077
|
});
|
|
42074
42078
|
function graphConvert(field, convert) {
|
|
42075
42079
|
try {
|
|
@@ -42419,13 +42423,13 @@ function safePinError(error62) {
|
|
|
42419
42423
|
if (error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" && "code" in error62.data && typeof error62.data.code === "string") return errorMessage(error62);
|
|
42420
42424
|
return "Relationship operation could not be confirmed; inspect it before retrying";
|
|
42421
42425
|
}
|
|
42422
|
-
async function pinToTargets(caller, entityId2, targets
|
|
42426
|
+
async function pinToTargets(caller, entityId2, targets) {
|
|
42423
42427
|
const result = { succeeded: [], failures: [] };
|
|
42424
42428
|
if (targets.length === 0) return result;
|
|
42425
42429
|
let ids2 = [];
|
|
42426
42430
|
try {
|
|
42427
42431
|
graphInput(graphSelectors, targets);
|
|
42428
|
-
graphInput(relationshipAddInput.pick({ sourceEntityId: true
|
|
42432
|
+
graphInput(relationshipAddInput.pick({ sourceEntityId: true }), { sourceEntityId: entityId2 });
|
|
42429
42433
|
ids2 = await resolveEntitiesC(caller, targets);
|
|
42430
42434
|
} catch (exc) {
|
|
42431
42435
|
for (const target3 of targets) result.failures.push({ target: target3, error: `could not resolve target: ${safePinError(exc)}` });
|
|
@@ -42435,14 +42439,7 @@ async function pinToTargets(caller, entityId2, targets, opts) {
|
|
|
42435
42439
|
const target3 = targets[i];
|
|
42436
42440
|
let returned = false;
|
|
42437
42441
|
try {
|
|
42438
|
-
const input2 = {
|
|
42439
|
-
sourceEntityId: entityId2,
|
|
42440
|
-
targetEntityId: ids2[i],
|
|
42441
|
-
...opts.shareParents ? {
|
|
42442
|
-
grantMissingParentAccess: true,
|
|
42443
|
-
...opts.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: opts.parentSpaceGrantFingerprint } : {}
|
|
42444
|
-
} : {}
|
|
42445
|
-
};
|
|
42442
|
+
const input2 = { sourceEntityId: entityId2, targetEntityId: ids2[i] };
|
|
42446
42443
|
parseRelationshipRequest("managePins", { action: "add", ...input2 });
|
|
42447
42444
|
const raw = await caller.mutation(pinsCreate, input2);
|
|
42448
42445
|
returned = true;
|
|
@@ -42557,12 +42554,6 @@ var EntityCreate = class extends ClientCommand {
|
|
|
42557
42554
|
allowNonExclusiveChildren = options_exports.Boolean("--allow-non-exclusive-children", false, { description: "Allow this entity alongside a child\u2019s regular parent" });
|
|
42558
42555
|
exclusiveParent = options_exports.Boolean("--exclusive-parent", false, { description: "Deprecated compatibility option; ignored after parent-policy activation" });
|
|
42559
42556
|
pin = options_exports.Array("--pin", { description: "Pin to other entities (resolved by name)" });
|
|
42560
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
42561
|
-
description: "Share pinned parents and ancestors into this entity's space when required"
|
|
42562
|
-
});
|
|
42563
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
42564
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
42565
|
-
});
|
|
42566
42557
|
alias = options_exports.Array("--alias", { description: "Alternative names" });
|
|
42567
42558
|
attr = options_exports.Array("--attr", { description: "Legacy; use --field instead" });
|
|
42568
42559
|
field = options_exports.Array("--field", { description: 'Repeat JSON {"label":"E-Mail","type":"email","value":"a@example.com"}' });
|
|
@@ -42592,10 +42583,7 @@ var EntityCreate = class extends ClientCommand {
|
|
|
42592
42583
|
if (this.description) {
|
|
42593
42584
|
await caller.mutation(entitiesSetDescriptionFromMarkdown, { entityId: entityId2, markdown: this.description });
|
|
42594
42585
|
}
|
|
42595
|
-
const pins = await pinToTargets(caller, entityId2, this.pin ?? []
|
|
42596
|
-
shareParents: this.shareParents,
|
|
42597
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
42598
|
-
});
|
|
42586
|
+
const pins = await pinToTargets(caller, entityId2, this.pin ?? []);
|
|
42599
42587
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
42600
42588
|
const jsonOut = { data: { entityId: entityId2 } };
|
|
42601
42589
|
if (pins.failures.length) {
|
|
@@ -42772,24 +42760,12 @@ var EntityRestore = class extends ProfileCommand {
|
|
|
42772
42760
|
description: "Restore an entity (and its cascade-trashed activities) from the trash"
|
|
42773
42761
|
});
|
|
42774
42762
|
nameOrId = options_exports.String();
|
|
42775
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
42776
|
-
description: "Confirm parent and ancestor grants required to reactivate the entity"
|
|
42777
|
-
});
|
|
42778
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
42779
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
42780
|
-
});
|
|
42781
42763
|
async run() {
|
|
42782
42764
|
requireEntitySelector("restoreEntity", this.nameOrId, "entityId");
|
|
42783
|
-
parseEntityWriteRequest("restoreEntity", { entityId: "pending-entity-resolution"
|
|
42765
|
+
parseEntityWriteRequest("restoreEntity", { entityId: "pending-entity-resolution" });
|
|
42784
42766
|
const caller = await resolveCaller();
|
|
42785
42767
|
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
42786
|
-
projectEntityWriteResult("restoreEntity", await caller.mutation(entitiesRestoreEntity, {
|
|
42787
|
-
entityId: entityId2,
|
|
42788
|
-
...this.shareParents ? {
|
|
42789
|
-
grantMissingParentAccess: true,
|
|
42790
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
42791
|
-
} : {}
|
|
42792
|
-
}));
|
|
42768
|
+
projectEntityWriteResult("restoreEntity", await caller.mutation(entitiesRestoreEntity, { entityId: entityId2 }));
|
|
42793
42769
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
42794
42770
|
this.emitText(
|
|
42795
42771
|
jsonWithSpaces({ data: parsePublicCliEntityWriteResult("restoreEntity", { success: true, entityId: entityId2 }) }, spaces),
|
|
@@ -42805,12 +42781,6 @@ var EntityPin = class extends ProfileCommand {
|
|
|
42805
42781
|
role = options_exports.String("--role", {
|
|
42806
42782
|
description: "Optional child role at the parent (for example: student)"
|
|
42807
42783
|
});
|
|
42808
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
42809
|
-
description: "Confirm sharing the parent and its ancestors into missing child spaces"
|
|
42810
|
-
});
|
|
42811
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
42812
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
42813
|
-
});
|
|
42814
42784
|
async run() {
|
|
42815
42785
|
graphInput(selector2, this.source);
|
|
42816
42786
|
graphInput(selector2, this.target);
|
|
@@ -42821,7 +42791,7 @@ var EntityPin = class extends ProfileCommand {
|
|
|
42821
42791
|
const sourceId = await resolveEntityC(caller, this.source);
|
|
42822
42792
|
const targetId = await resolveEntityC(caller, this.target);
|
|
42823
42793
|
progress.identifyEntity(sourceId);
|
|
42824
|
-
const payload = { sourceEntityId: sourceId, targetEntityId: targetId, ...this.role !== void 0 ? { role: normalizedRole ?? "" } : {}
|
|
42794
|
+
const payload = { sourceEntityId: sourceId, targetEntityId: targetId, ...this.role !== void 0 ? { role: normalizedRole ?? "" } : {} };
|
|
42825
42795
|
parseRelationshipRequest("managePins", { action: "add", ...payload });
|
|
42826
42796
|
const existing = graphResult(relationshipPublicList, await caller.query(pinsListBySource, { sourceEntityId: sourceId }));
|
|
42827
42797
|
const alreadyExists = existing.some((pin2) => pin2.targetEntityId === targetId);
|
|
@@ -42892,24 +42862,11 @@ var EntityAddToSpace = class extends ProfileCommand {
|
|
|
42892
42862
|
});
|
|
42893
42863
|
nameOrId = options_exports.String();
|
|
42894
42864
|
space = options_exports.String("--space", { required: true, description: "Space to add to (name or ID)" });
|
|
42895
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
42896
|
-
description: "Confirm sharing this entity's parents and ancestors into the target space"
|
|
42897
|
-
});
|
|
42898
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
42899
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
42900
|
-
});
|
|
42901
42865
|
async run() {
|
|
42902
42866
|
const caller = await resolveCaller();
|
|
42903
42867
|
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
42904
42868
|
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
42905
|
-
await caller.mutation(entitiesCreateEntitySpaceLink, {
|
|
42906
|
-
entityId: entityId2,
|
|
42907
|
-
spaceId: spaceId2,
|
|
42908
|
-
...this.shareParents ? {
|
|
42909
|
-
grantMissingParentAccess: true,
|
|
42910
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
42911
|
-
} : {}
|
|
42912
|
-
});
|
|
42869
|
+
await caller.mutation(entitiesCreateEntitySpaceLink, { entityId: entityId2, spaceId: spaceId2 });
|
|
42913
42870
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
42914
42871
|
this.emitText(
|
|
42915
42872
|
jsonWithSpaces({ data: { success: true } }, spaces),
|
|
@@ -43438,26 +43395,26 @@ function parseInlineImageSpecs(specs, options) {
|
|
|
43438
43395
|
return { contentId, path: spec.slice(separator + 1) };
|
|
43439
43396
|
});
|
|
43440
43397
|
}
|
|
43441
|
-
function readOutgoingEmailAttachment(
|
|
43398
|
+
function readOutgoingEmailAttachment(path12, options) {
|
|
43442
43399
|
let bytes2;
|
|
43443
43400
|
try {
|
|
43444
|
-
bytes2 = readFileSync8(
|
|
43401
|
+
bytes2 = readFileSync8(path12);
|
|
43445
43402
|
} catch (error62) {
|
|
43446
43403
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
43447
|
-
throw new Error(`${options.commandLabel}: could not read attachment '${
|
|
43404
|
+
throw new Error(`${options.commandLabel}: could not read attachment '${path12}': ${detail}`);
|
|
43448
43405
|
}
|
|
43449
43406
|
if (bytes2.byteLength > options.maxBytes) {
|
|
43450
43407
|
throw new Error(
|
|
43451
|
-
`${options.commandLabel}: attachment '${
|
|
43408
|
+
`${options.commandLabel}: attachment '${path12}' must be ${options.maxBytes} bytes or smaller.`
|
|
43452
43409
|
);
|
|
43453
43410
|
}
|
|
43454
43411
|
const detectedImageMimeType = detectImageMimeType(bytes2);
|
|
43455
43412
|
if (options.requireImage && !detectedImageMimeType) {
|
|
43456
43413
|
throw new Error(
|
|
43457
|
-
`${options.commandLabel}: image '${
|
|
43414
|
+
`${options.commandLabel}: image '${path12}' must be PNG, JPEG, GIF, or WebP.`
|
|
43458
43415
|
);
|
|
43459
43416
|
}
|
|
43460
|
-
const filename = basename(
|
|
43417
|
+
const filename = basename(path12);
|
|
43461
43418
|
if (!filename || filename.length > options.maxFilenameLength) {
|
|
43462
43419
|
throw new Error(
|
|
43463
43420
|
`${options.commandLabel}: attachment filename must be 1-${options.maxFilenameLength} characters.`
|
|
@@ -43474,7 +43431,7 @@ function readOutgoingEmailAttachment(path11, options) {
|
|
|
43474
43431
|
}
|
|
43475
43432
|
return {
|
|
43476
43433
|
filename,
|
|
43477
|
-
mimeType: detectedImageMimeType ?? mimeTypeForPath(
|
|
43434
|
+
mimeType: detectedImageMimeType ?? mimeTypeForPath(path12),
|
|
43478
43435
|
data: bytes2.toString("base64"),
|
|
43479
43436
|
...options.contentId ? { contentId: options.contentId } : {}
|
|
43480
43437
|
};
|
|
@@ -43978,13 +43935,10 @@ var ActivityCreate = class extends ClientCommand {
|
|
|
43978
43935
|
tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
|
|
43979
43936
|
agentAssignee = options_exports.Array("--agent-assignee", { description: "Agent ID to assign to this task (repeatable; requires write access)" });
|
|
43980
43937
|
autoLink = options_exports.Boolean("--auto-link", false, { description: "Auto-link entities not in target space" });
|
|
43981
|
-
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
43982
|
-
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
43983
|
-
});
|
|
43984
43938
|
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" });
|
|
43985
43939
|
async run() {
|
|
43986
43940
|
const fields4 = parseActivityFields(this.field);
|
|
43987
|
-
if (fields4 !== void 0 &&
|
|
43941
|
+
if (fields4 !== void 0 && this.autoLink) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
43988
43942
|
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43989
43943
|
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
43990
43944
|
const intent = graphInput(graphCreateIntent, {
|
|
@@ -43997,21 +43951,19 @@ var ActivityCreate = class extends ClientCommand {
|
|
|
43997
43951
|
tags: this.tag,
|
|
43998
43952
|
agentAssigneeIds: this.agentAssignee,
|
|
43999
43953
|
sourceCreatedAt,
|
|
44000
|
-
autoLinkPersonalSpace: this.autoLink
|
|
44001
|
-
entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint
|
|
43954
|
+
autoLinkPersonalSpace: this.autoLink
|
|
44002
43955
|
});
|
|
44003
43956
|
const progress = graphProgress(this, "activity.create", ["create", ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
44004
43957
|
return progress.run(async () => {
|
|
44005
43958
|
const caller = await resolveCaller();
|
|
44006
43959
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
44007
43960
|
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
44008
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities"
|
|
43961
|
+
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities"].includes(key))), spaceId: spaceId2, entityIds });
|
|
44009
43962
|
const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: intent.type, title: intent.title, content, tags: intent.tags, agentAssigneeIds: intent.agentAssigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace, fields: fields4 }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate, {
|
|
44010
43963
|
entityId: entityIds[0],
|
|
44011
43964
|
additionalEntities: entityIds.slice(1),
|
|
44012
43965
|
ownerSpaceId: spaceId2,
|
|
44013
43966
|
grantMissingEntityAccess: this.autoLink,
|
|
44014
|
-
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
44015
43967
|
type: intent.type,
|
|
44016
43968
|
title: intent.title,
|
|
44017
43969
|
...intent.agentAssigneeIds?.length ? { agentAssigneeIds: intent.agentAssigneeIds } : {},
|
|
@@ -44450,20 +44402,17 @@ var TaskCreate = class extends ClientCommand {
|
|
|
44450
44402
|
assignee = options_exports.Array("--assignee", { description: "Assignee user IDs or emails" });
|
|
44451
44403
|
assigneeEmail = options_exports.Array("--assignee-email", { description: "Assignee emails" });
|
|
44452
44404
|
autoLink = options_exports.Boolean("--auto-link", false, { description: "Auto-link entities not in target space" });
|
|
44453
|
-
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
44454
|
-
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
44455
|
-
});
|
|
44456
44405
|
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" });
|
|
44457
44406
|
async run() {
|
|
44458
44407
|
const aliases = graphConvert("fields", () => parseFieldPairList(this.attr));
|
|
44459
44408
|
const fields4 = parseActivityFields(this.field, aliases);
|
|
44460
|
-
if (fields4 !== void 0 &&
|
|
44409
|
+
if (fields4 !== void 0 && this.autoLink) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
44461
44410
|
if (this.noDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --no-deadline, not both.");
|
|
44462
44411
|
const deadline = this.noDeadline ? void 0 : graphConvert("deadline", () => this.deadline === void 0 ? defaultDeadline() : parseDeadline(this.deadline));
|
|
44463
44412
|
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
44464
44413
|
const directAssigneeIds = (this.assignee ?? []).filter((value) => !value.includes("@"));
|
|
44465
44414
|
const emailAssignees = [...(this.assignee ?? []).filter((value) => value.includes("@")), ...this.assigneeEmail ?? []];
|
|
44466
|
-
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
|
|
44415
|
+
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 });
|
|
44467
44416
|
const progress = graphProgress(this, "task.create", ["create", ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
44468
44417
|
return progress.run(async () => {
|
|
44469
44418
|
const caller = await resolveCaller();
|
|
@@ -44471,13 +44420,12 @@ var TaskCreate = class extends ClientCommand {
|
|
|
44471
44420
|
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
44472
44421
|
const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
|
|
44473
44422
|
const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
|
|
44474
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities"
|
|
44423
|
+
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
|
|
44475
44424
|
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, {
|
|
44476
44425
|
entityId: entityIds[0],
|
|
44477
44426
|
additionalEntities: entityIds.slice(1),
|
|
44478
44427
|
ownerSpaceId: spaceId2,
|
|
44479
44428
|
grantMissingEntityAccess: this.autoLink,
|
|
44480
|
-
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
44481
44429
|
type: "task",
|
|
44482
44430
|
title: this.title,
|
|
44483
44431
|
...deadline !== void 0 ? { deadline } : {},
|
|
@@ -45632,12 +45580,6 @@ var ListCreate = class extends ProfileCommand {
|
|
|
45632
45580
|
description: `Topic icon from the web icon picker: ${entityCustomIconIds.join(", ")}`
|
|
45633
45581
|
});
|
|
45634
45582
|
pin = options_exports.Array("--pin", { description: "Pin the list under parent entities (resolved by name)" });
|
|
45635
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
45636
|
-
description: "Share pinned parents and ancestors into the list's space when required"
|
|
45637
|
-
});
|
|
45638
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
45639
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
45640
|
-
});
|
|
45641
45583
|
async run() {
|
|
45642
45584
|
if (this.type !== "topic" && this.type !== "project") {
|
|
45643
45585
|
throw new Error(`--type must be 'topic' or 'project' (got '${this.type}').`);
|
|
@@ -45670,10 +45612,7 @@ var ListCreate = class extends ProfileCommand {
|
|
|
45670
45612
|
const args = parseDatabaseProtocolInput("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.args, { id: entityId3, icon: icon2 });
|
|
45671
45613
|
await progress.write("icon", () => databaseWrite(() => caller.mutation(setCustomIcon, args)), (raw) => parseOperationResult("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.result, raw));
|
|
45672
45614
|
}
|
|
45673
|
-
const pins2 = await progress.observe("pins", () => pinToTargets(caller, entityId3, this.pin ?? []
|
|
45674
|
-
shareParents: this.shareParents,
|
|
45675
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
45676
|
-
}));
|
|
45615
|
+
const pins2 = await progress.observe("pins", () => pinToTargets(caller, entityId3, this.pin ?? []));
|
|
45677
45616
|
const data = { entityId: entityId3, name: this.name, type: this.type, columns, enabledTabs: DATABASE_LIST_TABS };
|
|
45678
45617
|
this.emitText(
|
|
45679
45618
|
pins2.failures.length ? {
|
|
@@ -49291,7 +49230,7 @@ Creating entities:
|
|
|
49291
49230
|
Copies shells, enabled bottom-bar tabs and their order, database columns/filters/sorts, grouping rules and calendar-sidebar preference.
|
|
49292
49231
|
Selected-child groups point to copied aggregation-enabled direct children; activities are excluded (maximum 100 entities).
|
|
49293
49232
|
ente entity create "Jane Doe" --type person --pin "Acme Corp" --alias "JD"
|
|
49294
|
-
#
|
|
49233
|
+
# If the parent is not yet in the new entity's space, a person must share it in the app.
|
|
49295
49234
|
|
|
49296
49235
|
\u26A0 ALWAYS search before creating:
|
|
49297
49236
|
ente search "Jane Doe"
|
|
@@ -49311,8 +49250,9 @@ Pins (relationships):
|
|
|
49311
49250
|
ente entity pin "Jane Doe" "Acme Corp" --role "student"
|
|
49312
49251
|
# optional role; displays as Acme Corp \xB7 student
|
|
49313
49252
|
|
|
49314
|
-
|
|
49315
|
-
|
|
49253
|
+
If the parent is missing from a space of the child, the command fails and lists the
|
|
49254
|
+
grants (parent -> space). Only a person can approve them, in the Ente app: open the
|
|
49255
|
+
parent, "Add child" -> "Add existing", pick the child, confirm "Share and continue".
|
|
49316
49256
|
|
|
49317
49257
|
Pins are structural, not generic related-to links. When a durable direct
|
|
49318
49258
|
parent is known, pin the child to that parent (for example person -> org or
|
|
@@ -49326,7 +49266,7 @@ Attributes:
|
|
|
49326
49266
|
Archiving (trash):
|
|
49327
49267
|
ente entity archive "Old Project" # move to trash (soft delete)
|
|
49328
49268
|
ente entity list --archived # list trashed entities
|
|
49329
|
-
ente entity restore <entity-id>
|
|
49269
|
+
ente entity restore <entity-id> # restore from trash`
|
|
49330
49270
|
},
|
|
49331
49271
|
tasks: {
|
|
49332
49272
|
title: "Tasks \u2014 Deadlines, Assignments",
|
|
@@ -49477,17 +49417,17 @@ Rename \u2014 SUPPORTED:
|
|
|
49477
49417
|
Relationships are spaceless:
|
|
49478
49418
|
A parent relationship is visible when your key can access both entities,
|
|
49479
49419
|
even through different spaces. Every active parent and ancestor must also belong to
|
|
49480
|
-
every space of its active children.
|
|
49481
|
-
|
|
49420
|
+
every space of its active children. Pinning or sharing that would add a parent to
|
|
49421
|
+
another space fails with the grant list; only a person can approve it, in the Ente
|
|
49422
|
+
app (agent credentials never can). A parent cannot leave a space
|
|
49482
49423
|
while an active child remains there. An entity also cannot leave a space while
|
|
49483
49424
|
it owns activities there. Use --remove-from-activities to remove those links in
|
|
49484
49425
|
one operation when every affected activity has another owner.
|
|
49485
49426
|
|
|
49486
49427
|
Cross-space activity linking \u2014 BOUNDED:
|
|
49487
49428
|
An activity can only link entities that are already in its target space.
|
|
49488
|
-
A failed write
|
|
49489
|
-
|
|
49490
|
-
those grants. A changed hierarchy requires a new confirmation.
|
|
49429
|
+
A failed write lists the missing entities. Only a person can share them into the
|
|
49430
|
+
space, in the Ente app; agent credentials (every CLI key) are refused, --auto-link too.
|
|
49491
49431
|
|
|
49492
49432
|
Merging duplicates \u2014 UI ONLY:
|
|
49493
49433
|
The external API has no merge endpoint. To merge two entities, do it in the web
|
|
@@ -50470,20 +50410,20 @@ function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = []
|
|
|
50470
50410
|
commandLabel: "notification send"
|
|
50471
50411
|
});
|
|
50472
50412
|
const attachments = [
|
|
50473
|
-
...imagePaths.map((
|
|
50413
|
+
...imagePaths.map((path12) => readOutgoingEmailAttachment(path12, {
|
|
50474
50414
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
50475
50415
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
50476
50416
|
requireImage: true,
|
|
50477
50417
|
commandLabel: "notification send"
|
|
50478
50418
|
})),
|
|
50479
|
-
...inlineImages.map(({ contentId, path:
|
|
50419
|
+
...inlineImages.map(({ contentId, path: path12 }) => readOutgoingEmailAttachment(path12, {
|
|
50480
50420
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
50481
50421
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
50482
50422
|
contentId,
|
|
50483
50423
|
requireImage: true,
|
|
50484
50424
|
commandLabel: "notification send"
|
|
50485
50425
|
})),
|
|
50486
|
-
...attachmentPaths.map((
|
|
50426
|
+
...attachmentPaths.map((path12) => readOutgoingEmailAttachment(path12, {
|
|
50487
50427
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
50488
50428
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
50489
50429
|
commandLabel: "notification send"
|
|
@@ -51105,14 +51045,14 @@ function readAgentMailBodies(options) {
|
|
|
51105
51045
|
);
|
|
51106
51046
|
}
|
|
51107
51047
|
const attachments = [
|
|
51108
|
-
...inlineImages.map(({ path:
|
|
51048
|
+
...inlineImages.map(({ path: path12, contentId }) => readOutgoingEmailAttachment(path12, {
|
|
51109
51049
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
51110
51050
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
51111
51051
|
contentId,
|
|
51112
51052
|
requireImage: true,
|
|
51113
51053
|
commandLabel: "agent mail"
|
|
51114
51054
|
})),
|
|
51115
|
-
...paths.map((
|
|
51055
|
+
...paths.map((path12) => readOutgoingEmailAttachment(path12, {
|
|
51116
51056
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
51117
51057
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
51118
51058
|
commandLabel: "agent mail"
|
|
@@ -51398,7 +51338,8 @@ var AGENT_MAIL_COMMANDS = [
|
|
|
51398
51338
|
|
|
51399
51339
|
// ente/commands/update.ts
|
|
51400
51340
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
51401
|
-
import { existsSync as existsSync8, readFileSync as readFileSync19 } from "node:fs";
|
|
51341
|
+
import { existsSync as existsSync8, readFileSync as readFileSync19, realpathSync as realpathSync2 } from "node:fs";
|
|
51342
|
+
import path11 from "node:path";
|
|
51402
51343
|
|
|
51403
51344
|
// ente/migrationState.ts
|
|
51404
51345
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync8 } from "node:fs";
|
|
@@ -51569,17 +51510,41 @@ function giteaNpmrcHint(effectiveRegistry, userNpmrcText) {
|
|
|
51569
51510
|
}
|
|
51570
51511
|
|
|
51571
51512
|
// ente/commands/update.ts
|
|
51572
|
-
function updateCommandArgs() {
|
|
51573
|
-
return ["i", "-g", `${ENTE_BRANDING.packageName}@latest`, "--registry", NPM_REGISTRY_URL];
|
|
51513
|
+
function updateCommandArgs(prefix = null) {
|
|
51514
|
+
return ["i", "-g", `${ENTE_BRANDING.packageName}@latest`, "--registry", NPM_REGISTRY_URL, ...prefix ? ["--prefix", prefix] : []];
|
|
51574
51515
|
}
|
|
51575
|
-
|
|
51516
|
+
function updateShellCommand(prefix = null) {
|
|
51517
|
+
return ["npm", ...updateCommandArgs(prefix)].map((arg) => /^[\w@./:=-]+$/.test(arg) ? arg : JSON.stringify(arg)).join(" ");
|
|
51518
|
+
}
|
|
51519
|
+
function installPrefixOf(scriptPath) {
|
|
51520
|
+
const parts = scriptPath.split(path11.sep);
|
|
51521
|
+
const at = parts.lastIndexOf(ENTE_BRANDING.packageName);
|
|
51522
|
+
if (at < 3 || parts[at - 1] !== "node_modules" || parts[at - 2] !== "lib") return null;
|
|
51523
|
+
return parts.slice(0, at - 2).join(path11.sep) || path11.sep;
|
|
51524
|
+
}
|
|
51525
|
+
var SHARED_INSTALL_UMASK = 18;
|
|
51576
51526
|
var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from Ivo's Gitea registry; installing it from npm (registry.npmjs.org) instead.";
|
|
51577
51527
|
var updateRunner = {
|
|
51578
51528
|
run(command, args, json3) {
|
|
51579
|
-
|
|
51580
|
-
|
|
51581
|
-
|
|
51582
|
-
|
|
51529
|
+
const previousUmask = process.platform === "win32" ? void 0 : process.umask(SHARED_INSTALL_UMASK);
|
|
51530
|
+
try {
|
|
51531
|
+
return spawnSync2(command, args, {
|
|
51532
|
+
stdio: json3 ? ["ignore", 2, 2] : "inherit",
|
|
51533
|
+
shell: process.platform === "win32"
|
|
51534
|
+
});
|
|
51535
|
+
} finally {
|
|
51536
|
+
if (previousUmask !== void 0) process.umask(previousUmask);
|
|
51537
|
+
}
|
|
51538
|
+
},
|
|
51539
|
+
/** Prefix of the running install, so `ente update` never lands in a second tree. */
|
|
51540
|
+
installPrefix() {
|
|
51541
|
+
const script = process.argv[1];
|
|
51542
|
+
if (!script) return null;
|
|
51543
|
+
try {
|
|
51544
|
+
return installPrefixOf(realpathSync2(script));
|
|
51545
|
+
} catch {
|
|
51546
|
+
return null;
|
|
51547
|
+
}
|
|
51583
51548
|
},
|
|
51584
51549
|
installSource() {
|
|
51585
51550
|
return detectInstallSource({ npmInstalledAt: readMigrationState(configDir(ENTE_BRANDING), "npm_installed_at") });
|
|
@@ -51614,25 +51579,27 @@ function installLatestFromNpm(stderr, json3, options = {}) {
|
|
|
51614
51579
|
const installSource = updateRunner.installSource();
|
|
51615
51580
|
if (installSource === "gitea" && options.announceMove !== false) stderr.write(`${MOVING_TO_NPM_NOTICE}
|
|
51616
51581
|
`);
|
|
51617
|
-
|
|
51582
|
+
const prefix = updateRunner.installPrefix();
|
|
51583
|
+
const command = updateShellCommand(prefix);
|
|
51584
|
+
if (!json3) stderr.write(`Running: ${command}
|
|
51618
51585
|
`);
|
|
51619
|
-
const result = updateRunner.run("npm", updateCommandArgs(), json3);
|
|
51586
|
+
const result = updateRunner.run("npm", updateCommandArgs(prefix), json3);
|
|
51620
51587
|
if (result.error || result.status !== 0) {
|
|
51621
51588
|
const reason = result.error ? result.error.message : `npm exited with ${result.status ?? "a signal"}`;
|
|
51622
|
-
throw new Error(`Could not update ente-cli (${reason}). Run it yourself: ${
|
|
51589
|
+
throw new Error(`Could not update ente-cli (${reason}). Run it yourself: (umask 022; ${command})`);
|
|
51623
51590
|
}
|
|
51624
51591
|
updateRunner.recordNpmInstall(Date.now());
|
|
51625
51592
|
const npmrcHint = giteaNpmrcHint(updateRunner.npmRegistry(), updateRunner.userNpmrc());
|
|
51626
51593
|
if (npmrcHint) stderr.write(`${npmrcHint}
|
|
51627
51594
|
`);
|
|
51628
|
-
return { command
|
|
51595
|
+
return { command, installSource, npmrcHint };
|
|
51629
51596
|
}
|
|
51630
51597
|
var Update = class extends BaseCommand {
|
|
51631
51598
|
static paths = [["update"]];
|
|
51632
51599
|
static usage = Command.Usage({
|
|
51633
51600
|
category: "Help",
|
|
51634
51601
|
description: "Install the latest ente-cli globally from npm",
|
|
51635
|
-
details: `Runs \`${
|
|
51602
|
+
details: `Runs \`${updateShellCommand()}\`, plus \`--prefix\` for the tree this CLI runs from, with umask 022 so a shared install stays readable for other users. The explicit registry means an npmrc pointing elsewhere (such as Ivo's legacy Gitea registry) cannot redirect it; a CLI installed from Gitea moves to npm. Use \`--dry-run\` to print the command instead. Does not contact the ente server.`,
|
|
51636
51603
|
examples: [["Update from npm", "ente update"], ["Print the install command", "ente update --dry-run"]]
|
|
51637
51604
|
});
|
|
51638
51605
|
registry = options_exports.String("--registry", "npm", { description: "Always npm; kept so existing scripts keep working" });
|
|
@@ -51643,7 +51610,8 @@ var Update = class extends BaseCommand {
|
|
|
51643
51610
|
}
|
|
51644
51611
|
const previousVersion = ENTE_BRANDING.version;
|
|
51645
51612
|
if (this.dryRun) {
|
|
51646
|
-
|
|
51613
|
+
const command = updateShellCommand(updateRunner.installPrefix());
|
|
51614
|
+
this.emitText({ command, previousVersion, ran: false }, () => command);
|
|
51647
51615
|
return;
|
|
51648
51616
|
}
|
|
51649
51617
|
const result = installLatestFromNpm(this.context.stderr, this.json);
|