@amerged/ohmyhost-cli 0.1.74 → 0.1.76
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/bin.js +1 -1
- package/dist/{chunk-PTRLVTTT.js → chunk-N6LDQC3B.js} +1188 -496
- package/dist/index.js +26 -140
- package/package.json +1 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +180 -60
- package/src/apps/product-cli/src/composition.ts +132 -48
- package/src/apps/product-cli/src/credential-refresh.ts +65 -0
- package/src/apps/product-cli/src/file-credential-store.ts +131 -57
- package/src/apps/product-cli/src/index.ts +2 -0
- package/src/apps/product-cli/src/login-ownership.ts +291 -0
- package/src/apps/product-cli/src/profile-store.ts +303 -39
- package/src/apps/product-cli/src/runtime-contract.ts +12 -1
- package/src/apps/product-cli/src/workspace.ts +41 -27
- package/src/packages/contracts/package.json +5 -0
- package/src/packages/contracts/src/chat-guidance.ts +102 -0
- package/src/packages/contracts/src/preview-view.ts +7 -3
- package/src/packages/contracts/src/problem-policy.ts +6 -6
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/index.ts +1 -0
- package/src/packages/sdk-ts/src/generated/mcp-remote.gen.ts +138 -14
- package/src/packages/sdk-ts/src/generated/types.gen.ts +17 -4
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
__commonJS,
|
|
8
8
|
__require,
|
|
9
9
|
__toESM,
|
|
10
|
-
createNativeEntryFactory
|
|
10
|
+
createNativeEntryFactory,
|
|
11
|
+
parseCredential,
|
|
12
|
+
serializeCredential
|
|
11
13
|
} from "./chunk-7D2RFLWM.js";
|
|
12
14
|
|
|
13
15
|
// node_modules/.pnpm/ignore@7.0.12/node_modules/ignore/index.js
|
|
@@ -3773,9 +3775,9 @@ var require_deflate = __commonJS({
|
|
|
3773
3775
|
var BS_FINISH_STARTED = 3;
|
|
3774
3776
|
var BS_FINISH_DONE = 4;
|
|
3775
3777
|
var OS_CODE = 3;
|
|
3776
|
-
function err(strm,
|
|
3777
|
-
strm.msg = msg[
|
|
3778
|
-
return
|
|
3778
|
+
function err(strm, errorCode3) {
|
|
3779
|
+
strm.msg = msg[errorCode3];
|
|
3780
|
+
return errorCode3;
|
|
3779
3781
|
}
|
|
3780
3782
|
function rank(f) {
|
|
3781
3783
|
return (f << 1) - (f > 4 ? 9 : 0);
|
|
@@ -7126,9 +7128,9 @@ var require_pako = __commonJS({
|
|
|
7126
7128
|
var assign = require_common().assign;
|
|
7127
7129
|
var deflate = require_deflate2();
|
|
7128
7130
|
var inflate = require_inflate2();
|
|
7129
|
-
var
|
|
7131
|
+
var constants6 = require_constants();
|
|
7130
7132
|
var pako = {};
|
|
7131
|
-
assign(pako, deflate, inflate,
|
|
7133
|
+
assign(pako, deflate, inflate, constants6);
|
|
7132
7134
|
module.exports = pako;
|
|
7133
7135
|
}
|
|
7134
7136
|
});
|
|
@@ -8516,7 +8518,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8516
8518
|
}
|
|
8517
8519
|
return path2;
|
|
8518
8520
|
}
|
|
8519
|
-
function
|
|
8521
|
+
function dirname5(path2) {
|
|
8520
8522
|
const last = Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\"));
|
|
8521
8523
|
if (last === -1) return ".";
|
|
8522
8524
|
if (last === 0) return "/";
|
|
@@ -8524,7 +8526,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8524
8526
|
}
|
|
8525
8527
|
function flatFileListToDirectoryStructure(files) {
|
|
8526
8528
|
const inodes = /* @__PURE__ */ new Map();
|
|
8527
|
-
const
|
|
8529
|
+
const mkdir5 = function(name) {
|
|
8528
8530
|
if (!inodes.has(name)) {
|
|
8529
8531
|
const dir = {
|
|
8530
8532
|
type: "tree",
|
|
@@ -8534,7 +8536,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8534
8536
|
children: []
|
|
8535
8537
|
};
|
|
8536
8538
|
inodes.set(name, dir);
|
|
8537
|
-
dir.parent =
|
|
8539
|
+
dir.parent = mkdir5(dirname5(name));
|
|
8538
8540
|
if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir);
|
|
8539
8541
|
}
|
|
8540
8542
|
return inodes.get(name);
|
|
@@ -8547,7 +8549,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8547
8549
|
basename: basename2(name),
|
|
8548
8550
|
metadata,
|
|
8549
8551
|
// This recursively generates any missing parent folders.
|
|
8550
|
-
parent:
|
|
8552
|
+
parent: mkdir5(dirname5(name)),
|
|
8551
8553
|
children: []
|
|
8552
8554
|
};
|
|
8553
8555
|
if (file.parent) file.parent.children.push(file);
|
|
@@ -8555,7 +8557,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8555
8557
|
}
|
|
8556
8558
|
return inodes.get(name);
|
|
8557
8559
|
};
|
|
8558
|
-
|
|
8560
|
+
mkdir5(".");
|
|
8559
8561
|
for (const file of files) {
|
|
8560
8562
|
mkfile(file.path, file);
|
|
8561
8563
|
}
|
|
@@ -8958,7 +8960,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
8958
8960
|
}
|
|
8959
8961
|
return isAbsolute4 ? `/${normalized}` : normalized;
|
|
8960
8962
|
}
|
|
8961
|
-
function
|
|
8963
|
+
function join9(...args) {
|
|
8962
8964
|
if (args.length === 0) return ".";
|
|
8963
8965
|
let joined;
|
|
8964
8966
|
for (let i = 0; i < args.length; ++i) {
|
|
@@ -9360,7 +9362,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
9360
9362
|
for (const [key, value] of actualRefsToWrite) {
|
|
9361
9363
|
await acquireLock(
|
|
9362
9364
|
key,
|
|
9363
|
-
async () => fs3.write(
|
|
9365
|
+
async () => fs3.write(join9(gitdir, key), `${value.trim()}
|
|
9364
9366
|
`, "utf8")
|
|
9365
9367
|
);
|
|
9366
9368
|
}
|
|
@@ -9384,7 +9386,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
9384
9386
|
}
|
|
9385
9387
|
await acquireLock(
|
|
9386
9388
|
ref,
|
|
9387
|
-
async () => fs3.write(
|
|
9389
|
+
async () => fs3.write(join9(gitdir, ref), `${value.trim()}
|
|
9388
9390
|
`, "utf8")
|
|
9389
9391
|
);
|
|
9390
9392
|
}
|
|
@@ -9402,7 +9404,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
9402
9404
|
assertWritableRef(ref);
|
|
9403
9405
|
await acquireLock(
|
|
9404
9406
|
ref,
|
|
9405
|
-
async () => fs3.write(
|
|
9407
|
+
async () => fs3.write(join9(gitdir, ref), `ref: ${value.trim()}
|
|
9406
9408
|
`, "utf8")
|
|
9407
9409
|
);
|
|
9408
9410
|
}
|
|
@@ -9429,7 +9431,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
9429
9431
|
*/
|
|
9430
9432
|
static async deleteRefs({ fs: fs3, gitdir, refs }) {
|
|
9431
9433
|
refs.forEach(assertWritableRef);
|
|
9432
|
-
await Promise.all(refs.map((ref) => fs3.rm(
|
|
9434
|
+
await Promise.all(refs.map((ref) => fs3.rm(join9(gitdir, ref))));
|
|
9433
9435
|
let text = await acquireLock(
|
|
9434
9436
|
"packed-refs",
|
|
9435
9437
|
async () => fs3.read(`${gitdir}/packed-refs`, { encoding: "utf8" })
|
|
@@ -10516,7 +10518,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
10516
10518
|
format = "content",
|
|
10517
10519
|
getExternalRefDelta
|
|
10518
10520
|
}) {
|
|
10519
|
-
let list = await fs3.readdir(
|
|
10521
|
+
let list = await fs3.readdir(join9(gitdir, "objects/pack"));
|
|
10520
10522
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
10521
10523
|
for (const filename of list) {
|
|
10522
10524
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -11389,9 +11391,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
11389
11391
|
}
|
|
11390
11392
|
const tree = GitTree.from(object4);
|
|
11391
11393
|
for (const entry2 of tree) {
|
|
11392
|
-
map.set(
|
|
11394
|
+
map.set(join9(filepath, entry2.path), entry2);
|
|
11393
11395
|
}
|
|
11394
|
-
return tree.entries().map((entry2) =>
|
|
11396
|
+
return tree.entries().map((entry2) => join9(filepath, entry2.path));
|
|
11395
11397
|
}
|
|
11396
11398
|
async type(entry) {
|
|
11397
11399
|
if (entry._type === false) {
|
|
@@ -11486,9 +11488,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
11486
11488
|
if (await entry.type() !== "tree") return null;
|
|
11487
11489
|
const filepath = entry._fullpath;
|
|
11488
11490
|
const { fs: fs3, dir } = this;
|
|
11489
|
-
const names = await fs3.readdir(
|
|
11491
|
+
const names = await fs3.readdir(join9(dir, filepath));
|
|
11490
11492
|
if (names === null) return null;
|
|
11491
|
-
return names.map((name) =>
|
|
11493
|
+
return names.map((name) => join9(filepath, name));
|
|
11492
11494
|
}
|
|
11493
11495
|
async type(entry) {
|
|
11494
11496
|
if (entry._type === false) {
|
|
@@ -11736,23 +11738,23 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
11736
11738
|
}
|
|
11737
11739
|
return result;
|
|
11738
11740
|
}
|
|
11739
|
-
async function mkdirp(
|
|
11741
|
+
async function mkdirp(mkdir5, filepath, retries = 10) {
|
|
11740
11742
|
try {
|
|
11741
|
-
await
|
|
11743
|
+
await mkdir5(filepath);
|
|
11742
11744
|
} catch (err) {
|
|
11743
11745
|
if (err === null) return;
|
|
11744
11746
|
if (err.code === "EEXIST") return;
|
|
11745
11747
|
if (err.code !== "ENOENT") throw err;
|
|
11746
|
-
const parent =
|
|
11748
|
+
const parent = dirname5(filepath);
|
|
11747
11749
|
if (parent === "." || parent === "/" || parent === filepath) throw err;
|
|
11748
|
-
await mkdirp(
|
|
11749
|
-
for (let
|
|
11750
|
+
await mkdirp(mkdir5, parent, retries);
|
|
11751
|
+
for (let attempt2 = 0; ; attempt2++) {
|
|
11750
11752
|
try {
|
|
11751
|
-
await
|
|
11753
|
+
await mkdir5(filepath);
|
|
11752
11754
|
return;
|
|
11753
11755
|
} catch (err2) {
|
|
11754
11756
|
if (err2 === null || err2.code === "EEXIST") return;
|
|
11755
|
-
if (err2.code === "ENOENT" &&
|
|
11757
|
+
if (err2.code === "ENOENT" && attempt2 < retries) {
|
|
11756
11758
|
await new Promise((resolve7) => setTimeout(resolve7, 0));
|
|
11757
11759
|
continue;
|
|
11758
11760
|
}
|
|
@@ -11768,7 +11770,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
11768
11770
|
} else if (entries.length) {
|
|
11769
11771
|
await Promise.all(
|
|
11770
11772
|
entries.map((entry) => {
|
|
11771
|
-
const subpath =
|
|
11773
|
+
const subpath = join9(filepath, entry);
|
|
11772
11774
|
return fs3.lstat(subpath).then((stat3) => {
|
|
11773
11775
|
if (!stat3) return;
|
|
11774
11776
|
return stat3.isDirectory() ? rmRecursive(fs3, subpath) : fs3.rm(subpath);
|
|
@@ -11907,7 +11909,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
11907
11909
|
try {
|
|
11908
11910
|
await this._writeFile(filepath, contents, options);
|
|
11909
11911
|
} catch (err) {
|
|
11910
|
-
await this.mkdir(
|
|
11912
|
+
await this.mkdir(dirname5(filepath));
|
|
11911
11913
|
await this._writeFile(filepath, contents, options);
|
|
11912
11914
|
}
|
|
11913
11915
|
}
|
|
@@ -12014,8 +12016,8 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12014
12016
|
*/
|
|
12015
12017
|
async readlink(filename, opts = { encoding: "buffer" }) {
|
|
12016
12018
|
try {
|
|
12017
|
-
const
|
|
12018
|
-
return Buffer.isBuffer(
|
|
12019
|
+
const link3 = await this._readlink(filename, opts);
|
|
12020
|
+
return Buffer.isBuffer(link3) ? link3 : Buffer.from(link3);
|
|
12019
12021
|
} catch (err) {
|
|
12020
12022
|
if (err.code === "ENOENT" || (err.code || "").includes("ENS")) {
|
|
12021
12023
|
return null;
|
|
@@ -12053,7 +12055,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12053
12055
|
if (isAbsolute3(submoduleGitdir)) {
|
|
12054
12056
|
return submoduleGitdir;
|
|
12055
12057
|
}
|
|
12056
|
-
const gitdir =
|
|
12058
|
+
const gitdir = join9(dirname5(dotgit), submoduleGitdir);
|
|
12057
12059
|
return gitdir;
|
|
12058
12060
|
});
|
|
12059
12061
|
} else {
|
|
@@ -12075,7 +12077,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12075
12077
|
async function abortMerge({
|
|
12076
12078
|
fs: _fs,
|
|
12077
12079
|
dir,
|
|
12078
|
-
gitdir =
|
|
12080
|
+
gitdir = join9(dir, ".git"),
|
|
12079
12081
|
commit: commit3 = "HEAD",
|
|
12080
12082
|
cache = {}
|
|
12081
12083
|
}) {
|
|
@@ -12156,17 +12158,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12156
12158
|
* @param {string} args.filepath - The path of the file to check.
|
|
12157
12159
|
* @returns {Promise<boolean>} - `true` if the file is ignored, `false` otherwise.
|
|
12158
12160
|
*/
|
|
12159
|
-
static async isIgnored({ fs: fs3, dir, gitdir =
|
|
12161
|
+
static async isIgnored({ fs: fs3, dir, gitdir = join9(dir, ".git"), filepath }) {
|
|
12160
12162
|
if (basename2(filepath) === ".git") return true;
|
|
12161
12163
|
if (filepath === ".") return false;
|
|
12162
12164
|
let excludes = "";
|
|
12163
|
-
const excludesFile =
|
|
12165
|
+
const excludesFile = join9(gitdir, "info", "exclude");
|
|
12164
12166
|
if (await fs3.exists(excludesFile)) {
|
|
12165
12167
|
excludes = await fs3.read(excludesFile, "utf8");
|
|
12166
12168
|
}
|
|
12167
12169
|
const pairs = [
|
|
12168
12170
|
{
|
|
12169
|
-
gitignore:
|
|
12171
|
+
gitignore: join9(dir, ".gitignore"),
|
|
12170
12172
|
filepath
|
|
12171
12173
|
}
|
|
12172
12174
|
];
|
|
@@ -12175,7 +12177,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12175
12177
|
const folder = pieces.slice(0, i).join("/");
|
|
12176
12178
|
const file = pieces.slice(i).join("/");
|
|
12177
12179
|
pairs.push({
|
|
12178
|
-
gitignore:
|
|
12180
|
+
gitignore: join9(dir, folder, ".gitignore"),
|
|
12179
12181
|
filepath: file
|
|
12180
12182
|
});
|
|
12181
12183
|
}
|
|
@@ -12190,7 +12192,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12190
12192
|
const ign = ignore2();
|
|
12191
12193
|
if (index2 === 0) ign.add(excludes);
|
|
12192
12194
|
ign.add(file);
|
|
12193
|
-
const parentdir =
|
|
12195
|
+
const parentdir = dirname5(p.filepath);
|
|
12194
12196
|
if (parentdir !== "." && ign.ignores(parentdir)) return true;
|
|
12195
12197
|
if (ignoredStatus) {
|
|
12196
12198
|
ignoredStatus = !ign.test(p.filepath).unignored;
|
|
@@ -12263,7 +12265,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12263
12265
|
async function add({
|
|
12264
12266
|
fs: _fs,
|
|
12265
12267
|
dir,
|
|
12266
|
-
gitdir =
|
|
12268
|
+
gitdir = join9(dir, ".git"),
|
|
12267
12269
|
filepath,
|
|
12268
12270
|
cache = {},
|
|
12269
12271
|
force = false,
|
|
@@ -12327,17 +12329,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12327
12329
|
});
|
|
12328
12330
|
if (ignored2) return;
|
|
12329
12331
|
}
|
|
12330
|
-
const stats = await fs3.lstat(
|
|
12332
|
+
const stats = await fs3.lstat(join9(dir, currentFilepath));
|
|
12331
12333
|
if (!stats) throw new NotFoundError(currentFilepath);
|
|
12332
12334
|
if (stats.isDirectory()) {
|
|
12333
|
-
const children = await fs3.readdir(
|
|
12335
|
+
const children = await fs3.readdir(join9(dir, currentFilepath));
|
|
12334
12336
|
if (parallel) {
|
|
12335
12337
|
const promises2 = children.map(
|
|
12336
12338
|
(child) => addToIndex({
|
|
12337
12339
|
dir,
|
|
12338
12340
|
gitdir,
|
|
12339
12341
|
fs: fs3,
|
|
12340
|
-
filepath: [
|
|
12342
|
+
filepath: [join9(currentFilepath, child)],
|
|
12341
12343
|
index: index2,
|
|
12342
12344
|
force,
|
|
12343
12345
|
parallel,
|
|
@@ -12351,7 +12353,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12351
12353
|
dir,
|
|
12352
12354
|
gitdir,
|
|
12353
12355
|
fs: fs3,
|
|
12354
|
-
filepath: [
|
|
12356
|
+
filepath: [join9(currentFilepath, child)],
|
|
12355
12357
|
index: index2,
|
|
12356
12358
|
force,
|
|
12357
12359
|
parallel,
|
|
@@ -12360,7 +12362,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12360
12362
|
}
|
|
12361
12363
|
}
|
|
12362
12364
|
} else {
|
|
12363
|
-
const object4 = stats.isSymbolicLink() ? await fs3.readlink(
|
|
12365
|
+
const object4 = stats.isSymbolicLink() ? await fs3.readlink(join9(dir, currentFilepath)).then(posixifyPathBuffer) : await fs3.read(join9(dir, currentFilepath), { autocrlf });
|
|
12364
12366
|
if (object4 === null) throw new NotFoundError(currentFilepath);
|
|
12365
12367
|
const oid = await _writeObject({ fs: fs3, gitdir, type: "blob", object: object4 });
|
|
12366
12368
|
index2.insert({ filepath: currentFilepath, stats, oid });
|
|
@@ -12796,7 +12798,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12796
12798
|
fs: _fs,
|
|
12797
12799
|
onSign,
|
|
12798
12800
|
dir,
|
|
12799
|
-
gitdir =
|
|
12801
|
+
gitdir = join9(dir, ".git"),
|
|
12800
12802
|
ref = "refs/notes/commits",
|
|
12801
12803
|
oid,
|
|
12802
12804
|
note,
|
|
@@ -12866,7 +12868,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12866
12868
|
async function addRemote({
|
|
12867
12869
|
fs: fs3,
|
|
12868
12870
|
dir,
|
|
12869
|
-
gitdir =
|
|
12871
|
+
gitdir = join9(dir, ".git"),
|
|
12870
12872
|
remote,
|
|
12871
12873
|
url,
|
|
12872
12874
|
force = false
|
|
@@ -12936,7 +12938,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12936
12938
|
fs: _fs,
|
|
12937
12939
|
onSign,
|
|
12938
12940
|
dir,
|
|
12939
|
-
gitdir =
|
|
12941
|
+
gitdir = join9(dir, ".git"),
|
|
12940
12942
|
ref,
|
|
12941
12943
|
tagger: _tagger,
|
|
12942
12944
|
message = ref,
|
|
@@ -13017,7 +13019,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13017
13019
|
async function branch({
|
|
13018
13020
|
fs: fs3,
|
|
13019
13021
|
dir,
|
|
13020
|
-
gitdir =
|
|
13022
|
+
gitdir = join9(dir, ".git"),
|
|
13021
13023
|
ref,
|
|
13022
13024
|
object: object4,
|
|
13023
13025
|
checkout: checkout2 = false,
|
|
@@ -13235,12 +13237,12 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13235
13237
|
const updateWorkingDirResults = await batchAllSettled(
|
|
13236
13238
|
"Update Working Dir",
|
|
13237
13239
|
eligibleOps.map(
|
|
13238
|
-
([method, fullpath, oid2, mode,
|
|
13240
|
+
([method, fullpath, oid2, mode, chmod3]) => () => updateWorkingDir({ fs: fs3, cache, gitdir, dir }, [
|
|
13239
13241
|
method,
|
|
13240
13242
|
fullpath,
|
|
13241
13243
|
oid2,
|
|
13242
13244
|
mode,
|
|
13243
|
-
|
|
13245
|
+
chmod3
|
|
13244
13246
|
])
|
|
13245
13247
|
),
|
|
13246
13248
|
onProgress,
|
|
@@ -13266,7 +13268,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13266
13268
|
const settled = await Promise.allSettled(
|
|
13267
13269
|
ops.filter(
|
|
13268
13270
|
([method]) => method === "create" || method === "create-index" || method === "update" || method === "mkdir-index"
|
|
13269
|
-
).map(async function([method, fullpath, oid2, mode,
|
|
13271
|
+
).map(async function([method, fullpath, oid2, mode, chmod3]) {
|
|
13270
13272
|
const filepath = `${dir}/${fullpath}`;
|
|
13271
13273
|
if (method !== "create-index" && method !== "mkdir-index") {
|
|
13272
13274
|
await assertNoSymlinkInLeadingPath(fs3, dir, fullpath);
|
|
@@ -13276,7 +13278,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13276
13278
|
gitdir,
|
|
13277
13279
|
oid: oid2
|
|
13278
13280
|
});
|
|
13279
|
-
if (
|
|
13281
|
+
if (chmod3) {
|
|
13280
13282
|
await fs3.rm(filepath);
|
|
13281
13283
|
}
|
|
13282
13284
|
if (mode === 33188) {
|
|
@@ -13617,12 +13619,12 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13617
13619
|
console.warn(`Error inserting ${fullpath} into index:`, e);
|
|
13618
13620
|
}
|
|
13619
13621
|
}
|
|
13620
|
-
async function updateWorkingDir({ fs: fs3, cache, gitdir, dir }, [method, fullpath, oid, mode,
|
|
13622
|
+
async function updateWorkingDir({ fs: fs3, cache, gitdir, dir }, [method, fullpath, oid, mode, chmod3]) {
|
|
13621
13623
|
const filepath = `${dir}/${fullpath}`;
|
|
13622
13624
|
if (method !== "create-index" && method !== "mkdir-index") {
|
|
13623
13625
|
await assertNoSymlinkInLeadingPath(fs3, dir, fullpath);
|
|
13624
13626
|
const { object: object4 } = await _readObject({ fs: fs3, cache, gitdir, oid });
|
|
13625
|
-
if (
|
|
13627
|
+
if (chmod3) {
|
|
13626
13628
|
await fs3.rm(filepath);
|
|
13627
13629
|
}
|
|
13628
13630
|
if (mode === 33188) {
|
|
@@ -13681,7 +13683,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13681
13683
|
onProgress,
|
|
13682
13684
|
onPostCheckout,
|
|
13683
13685
|
dir,
|
|
13684
|
-
gitdir =
|
|
13686
|
+
gitdir = join9(dir, ".git"),
|
|
13685
13687
|
remote = "origin",
|
|
13686
13688
|
ref: _ref,
|
|
13687
13689
|
filepaths,
|
|
@@ -13762,7 +13764,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
13762
13764
|
fs: fs3,
|
|
13763
13765
|
cache,
|
|
13764
13766
|
dir,
|
|
13765
|
-
gitdir =
|
|
13767
|
+
gitdir = join9(dir, ".git"),
|
|
13766
13768
|
index: index2,
|
|
13767
13769
|
ourOid,
|
|
13768
13770
|
baseOid,
|
|
@@ -14032,7 +14034,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14032
14034
|
workdir: WORKDIR
|
|
14033
14035
|
};
|
|
14034
14036
|
async function checkAndWriteBlob(fs3, gitdir, dir, filepath, oid = null) {
|
|
14035
|
-
const currentFilepath =
|
|
14037
|
+
const currentFilepath = join9(dir, filepath);
|
|
14036
14038
|
const stats = await fs3.lstat(currentFilepath);
|
|
14037
14039
|
if (!stats) throw new NotFoundError(currentFilepath);
|
|
14038
14040
|
if (stats.isDirectory())
|
|
@@ -14201,7 +14203,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14201
14203
|
stageUpdated.push({
|
|
14202
14204
|
filepath,
|
|
14203
14205
|
oid,
|
|
14204
|
-
stats: await fs3.lstat(
|
|
14206
|
+
stats: await fs3.lstat(join9(dir, filepath))
|
|
14205
14207
|
});
|
|
14206
14208
|
return {
|
|
14207
14209
|
method: "write",
|
|
@@ -14214,7 +14216,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14214
14216
|
});
|
|
14215
14217
|
await acquireLock(gitdir, async () => {
|
|
14216
14218
|
for (const op of ops) {
|
|
14217
|
-
const currentFilepath =
|
|
14219
|
+
const currentFilepath = join9(dir, op.filepath);
|
|
14218
14220
|
switch (op.method) {
|
|
14219
14221
|
case "rmdir":
|
|
14220
14222
|
await fs3.rmdir(currentFilepath);
|
|
@@ -14414,7 +14416,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14414
14416
|
async function cherryPick({
|
|
14415
14417
|
fs: _fs,
|
|
14416
14418
|
dir,
|
|
14417
|
-
gitdir =
|
|
14419
|
+
gitdir = join9(dir, ".git"),
|
|
14418
14420
|
oid,
|
|
14419
14421
|
cache = {},
|
|
14420
14422
|
committer,
|
|
@@ -14681,8 +14683,8 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14681
14683
|
}
|
|
14682
14684
|
return { protocolVersion: 1, capabilities, refs, symrefs };
|
|
14683
14685
|
}
|
|
14684
|
-
function splitAndAssert(line,
|
|
14685
|
-
const split = line.trim().split(
|
|
14686
|
+
function splitAndAssert(line, sep4, expected) {
|
|
14687
|
+
const split = line.trim().split(sep4);
|
|
14686
14688
|
if (split.length !== 2) {
|
|
14687
14689
|
throw new ParseError(
|
|
14688
14690
|
`Two strings separated by '${expected}'`,
|
|
@@ -14919,7 +14921,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14919
14921
|
* @returns {Promise<Set<string>>} - A set of shallow object IDs.
|
|
14920
14922
|
*/
|
|
14921
14923
|
static async read({ fs: fs3, gitdir }) {
|
|
14922
|
-
const filepath =
|
|
14924
|
+
const filepath = join9(gitdir, "shallow");
|
|
14923
14925
|
const oids = /* @__PURE__ */ new Set();
|
|
14924
14926
|
await acquireLock(filepath, async function() {
|
|
14925
14927
|
const text = await fs3.read(filepath, { encoding: "utf8" });
|
|
@@ -14940,7 +14942,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14940
14942
|
* @returns {Promise<void>}
|
|
14941
14943
|
*/
|
|
14942
14944
|
static async write({ fs: fs3, gitdir, oids }) {
|
|
14943
|
-
const filepath =
|
|
14945
|
+
const filepath = join9(gitdir, "shallow");
|
|
14944
14946
|
if (oids.size > 0) {
|
|
14945
14947
|
const text = [...oids].join("\n") + "\n";
|
|
14946
14948
|
await acquireLock(filepath, async function() {
|
|
@@ -14966,7 +14968,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14966
14968
|
oid,
|
|
14967
14969
|
getExternalRefDelta
|
|
14968
14970
|
}) {
|
|
14969
|
-
let list = await fs3.readdir(
|
|
14971
|
+
let list = await fs3.readdir(join9(gitdir, "objects/pack"));
|
|
14970
14972
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
14971
14973
|
for (const filename of list) {
|
|
14972
14974
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -15323,7 +15325,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15323
15325
|
depth = null,
|
|
15324
15326
|
since = null,
|
|
15325
15327
|
exclude = [],
|
|
15326
|
-
relative:
|
|
15328
|
+
relative: relative4 = false,
|
|
15327
15329
|
tags = false,
|
|
15328
15330
|
singleBranch = false,
|
|
15329
15331
|
headers = {},
|
|
@@ -15371,7 +15373,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15371
15373
|
if (exclude.length > 0 && !remoteHTTP.capabilities.has("deepen-not")) {
|
|
15372
15374
|
throw new RemoteCapabilityError("deepen-not", "exclude");
|
|
15373
15375
|
}
|
|
15374
|
-
if (
|
|
15376
|
+
if (relative4 === true && !remoteHTTP.capabilities.has("deepen-relative")) {
|
|
15375
15377
|
throw new RemoteCapabilityError("deepen-relative", "relative");
|
|
15376
15378
|
}
|
|
15377
15379
|
const { oid, fullref } = GitRefManager.resolveAgainstMap({
|
|
@@ -15399,7 +15401,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15399
15401
|
`agent=${pkg.agent}`
|
|
15400
15402
|
]
|
|
15401
15403
|
);
|
|
15402
|
-
if (
|
|
15404
|
+
if (relative4) capabilities.push("deepen-relative");
|
|
15403
15405
|
const wants = singleBranch ? [oid] : remoteRefs.values();
|
|
15404
15406
|
const haveRefs = singleBranch ? [ref] : await GitRefManager.listRefs({
|
|
15405
15407
|
fs: fs3,
|
|
@@ -15557,7 +15559,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15557
15559
|
}
|
|
15558
15560
|
if (packfileSha !== "" && !emptyPackfile(packfile)) {
|
|
15559
15561
|
res.packfile = `objects/pack/pack-${packfileSha}.pack`;
|
|
15560
|
-
const fullpath =
|
|
15562
|
+
const fullpath = join9(gitdir, res.packfile);
|
|
15561
15563
|
await fs3.write(fullpath, packfile);
|
|
15562
15564
|
const getExternalRefDelta = (oid2) => _readObject({ fs: fs3, cache, gitdir, oid: oid2 });
|
|
15563
15565
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -15573,7 +15575,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15573
15575
|
fs: fs3,
|
|
15574
15576
|
bare = false,
|
|
15575
15577
|
dir,
|
|
15576
|
-
gitdir = bare ? dir :
|
|
15578
|
+
gitdir = bare ? dir : join9(dir, ".git"),
|
|
15577
15579
|
defaultBranch = "master"
|
|
15578
15580
|
}) {
|
|
15579
15581
|
if (await fs3.exists(gitdir + "/config")) return;
|
|
@@ -15619,7 +15621,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15619
15621
|
depth,
|
|
15620
15622
|
since,
|
|
15621
15623
|
exclude,
|
|
15622
|
-
relative:
|
|
15624
|
+
relative: relative4,
|
|
15623
15625
|
singleBranch,
|
|
15624
15626
|
noCheckout,
|
|
15625
15627
|
noTags,
|
|
@@ -15651,7 +15653,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15651
15653
|
depth,
|
|
15652
15654
|
since,
|
|
15653
15655
|
exclude,
|
|
15654
|
-
relative:
|
|
15656
|
+
relative: relative4,
|
|
15655
15657
|
singleBranch,
|
|
15656
15658
|
headers,
|
|
15657
15659
|
tags: !noTags
|
|
@@ -15687,7 +15689,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15687
15689
|
onAuthFailure,
|
|
15688
15690
|
onPostCheckout,
|
|
15689
15691
|
dir,
|
|
15690
|
-
gitdir =
|
|
15692
|
+
gitdir = join9(dir, ".git"),
|
|
15691
15693
|
url,
|
|
15692
15694
|
corsProxy = void 0,
|
|
15693
15695
|
ref = void 0,
|
|
@@ -15695,7 +15697,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15695
15697
|
depth = void 0,
|
|
15696
15698
|
since = void 0,
|
|
15697
15699
|
exclude = [],
|
|
15698
|
-
relative:
|
|
15700
|
+
relative: relative4 = false,
|
|
15699
15701
|
singleBranch = false,
|
|
15700
15702
|
noCheckout = false,
|
|
15701
15703
|
noTags = false,
|
|
@@ -15733,7 +15735,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15733
15735
|
depth,
|
|
15734
15736
|
since,
|
|
15735
15737
|
exclude,
|
|
15736
|
-
relative:
|
|
15738
|
+
relative: relative4,
|
|
15737
15739
|
singleBranch,
|
|
15738
15740
|
noCheckout,
|
|
15739
15741
|
noTags,
|
|
@@ -15750,7 +15752,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15750
15752
|
fs: _fs,
|
|
15751
15753
|
onSign,
|
|
15752
15754
|
dir,
|
|
15753
|
-
gitdir =
|
|
15755
|
+
gitdir = join9(dir, ".git"),
|
|
15754
15756
|
message,
|
|
15755
15757
|
author,
|
|
15756
15758
|
committer,
|
|
@@ -15799,7 +15801,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15799
15801
|
async function currentBranch({
|
|
15800
15802
|
fs: fs3,
|
|
15801
15803
|
dir,
|
|
15802
|
-
gitdir =
|
|
15804
|
+
gitdir = join9(dir, ".git"),
|
|
15803
15805
|
fullname = false,
|
|
15804
15806
|
test = false
|
|
15805
15807
|
}) {
|
|
@@ -15840,7 +15842,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15840
15842
|
async function deleteBranch({
|
|
15841
15843
|
fs: fs3,
|
|
15842
15844
|
dir,
|
|
15843
|
-
gitdir =
|
|
15845
|
+
gitdir = join9(dir, ".git"),
|
|
15844
15846
|
ref
|
|
15845
15847
|
}) {
|
|
15846
15848
|
try {
|
|
@@ -15858,7 +15860,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15858
15860
|
throw err;
|
|
15859
15861
|
}
|
|
15860
15862
|
}
|
|
15861
|
-
async function deleteRef({ fs: fs3, dir, gitdir =
|
|
15863
|
+
async function deleteRef({ fs: fs3, dir, gitdir = join9(dir, ".git"), ref }) {
|
|
15862
15864
|
try {
|
|
15863
15865
|
assertParameter("fs", fs3);
|
|
15864
15866
|
assertParameter("ref", ref);
|
|
@@ -15878,7 +15880,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15878
15880
|
async function deleteRemote({
|
|
15879
15881
|
fs: fs3,
|
|
15880
15882
|
dir,
|
|
15881
|
-
gitdir =
|
|
15883
|
+
gitdir = join9(dir, ".git"),
|
|
15882
15884
|
remote
|
|
15883
15885
|
}) {
|
|
15884
15886
|
try {
|
|
@@ -15900,7 +15902,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15900
15902
|
ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`;
|
|
15901
15903
|
await GitRefManager.deleteRef({ fs: fs3, gitdir, ref });
|
|
15902
15904
|
}
|
|
15903
|
-
async function deleteTag({ fs: fs3, dir, gitdir =
|
|
15905
|
+
async function deleteTag({ fs: fs3, dir, gitdir = join9(dir, ".git"), ref }) {
|
|
15904
15906
|
try {
|
|
15905
15907
|
assertParameter("fs", fs3);
|
|
15906
15908
|
assertParameter("ref", ref);
|
|
@@ -15929,7 +15931,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15929
15931
|
getExternalRefDelta
|
|
15930
15932
|
}) {
|
|
15931
15933
|
const results = [];
|
|
15932
|
-
let list = await fs3.readdir(
|
|
15934
|
+
let list = await fs3.readdir(join9(gitdir, "objects/pack"));
|
|
15933
15935
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
15934
15936
|
for (const filename of list) {
|
|
15935
15937
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -15972,7 +15974,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15972
15974
|
async function expandOid({
|
|
15973
15975
|
fs: fs3,
|
|
15974
15976
|
dir,
|
|
15975
|
-
gitdir =
|
|
15977
|
+
gitdir = join9(dir, ".git"),
|
|
15976
15978
|
oid,
|
|
15977
15979
|
cache = {}
|
|
15978
15980
|
}) {
|
|
@@ -15993,7 +15995,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15993
15995
|
throw err;
|
|
15994
15996
|
}
|
|
15995
15997
|
}
|
|
15996
|
-
async function expandRef({ fs: fs3, dir, gitdir =
|
|
15998
|
+
async function expandRef({ fs: fs3, dir, gitdir = join9(dir, ".git"), ref }) {
|
|
15997
15999
|
try {
|
|
15998
16000
|
assertParameter("fs", fs3);
|
|
15999
16001
|
assertParameter("gitdir", gitdir);
|
|
@@ -16284,7 +16286,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16284
16286
|
onAuthSuccess,
|
|
16285
16287
|
onAuthFailure,
|
|
16286
16288
|
dir,
|
|
16287
|
-
gitdir =
|
|
16289
|
+
gitdir = join9(dir, ".git"),
|
|
16288
16290
|
ref,
|
|
16289
16291
|
url,
|
|
16290
16292
|
remote,
|
|
@@ -16342,7 +16344,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16342
16344
|
onAuthSuccess,
|
|
16343
16345
|
onAuthFailure,
|
|
16344
16346
|
dir,
|
|
16345
|
-
gitdir =
|
|
16347
|
+
gitdir = join9(dir, ".git"),
|
|
16346
16348
|
ref,
|
|
16347
16349
|
remote,
|
|
16348
16350
|
remoteRef,
|
|
@@ -16351,7 +16353,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16351
16353
|
depth = null,
|
|
16352
16354
|
since = null,
|
|
16353
16355
|
exclude = [],
|
|
16354
|
-
relative:
|
|
16356
|
+
relative: relative4 = false,
|
|
16355
16357
|
tags = false,
|
|
16356
16358
|
singleBranch = false,
|
|
16357
16359
|
headers = {},
|
|
@@ -16383,7 +16385,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16383
16385
|
depth,
|
|
16384
16386
|
since,
|
|
16385
16387
|
exclude,
|
|
16386
|
-
relative:
|
|
16388
|
+
relative: relative4,
|
|
16387
16389
|
tags,
|
|
16388
16390
|
singleBranch,
|
|
16389
16391
|
headers,
|
|
@@ -16398,7 +16400,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16398
16400
|
async function findMergeBase({
|
|
16399
16401
|
fs: fs3,
|
|
16400
16402
|
dir,
|
|
16401
|
-
gitdir =
|
|
16403
|
+
gitdir = join9(dir, ".git"),
|
|
16402
16404
|
oids,
|
|
16403
16405
|
cache = {}
|
|
16404
16406
|
}) {
|
|
@@ -16420,10 +16422,10 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16420
16422
|
}
|
|
16421
16423
|
}
|
|
16422
16424
|
async function _findRoot({ fs: fs3, filepath }) {
|
|
16423
|
-
if (await fs3.exists(
|
|
16425
|
+
if (await fs3.exists(join9(filepath, ".git"))) {
|
|
16424
16426
|
return filepath;
|
|
16425
16427
|
} else {
|
|
16426
|
-
const parent =
|
|
16428
|
+
const parent = dirname5(filepath);
|
|
16427
16429
|
if (parent === filepath) {
|
|
16428
16430
|
throw new NotFoundError(`git root for ${filepath}`);
|
|
16429
16431
|
}
|
|
@@ -16440,7 +16442,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16440
16442
|
throw err;
|
|
16441
16443
|
}
|
|
16442
16444
|
}
|
|
16443
|
-
async function getConfig({ fs: fs3, dir, gitdir =
|
|
16445
|
+
async function getConfig({ fs: fs3, dir, gitdir = join9(dir, ".git"), path: path2 }) {
|
|
16444
16446
|
try {
|
|
16445
16447
|
assertParameter("fs", fs3);
|
|
16446
16448
|
assertParameter("gitdir", gitdir);
|
|
@@ -16464,7 +16466,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16464
16466
|
async function getConfigAll({
|
|
16465
16467
|
fs: fs3,
|
|
16466
16468
|
dir,
|
|
16467
|
-
gitdir =
|
|
16469
|
+
gitdir = join9(dir, ".git"),
|
|
16468
16470
|
path: path2
|
|
16469
16471
|
}) {
|
|
16470
16472
|
try {
|
|
@@ -16653,7 +16655,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16653
16655
|
filepath
|
|
16654
16656
|
}) {
|
|
16655
16657
|
try {
|
|
16656
|
-
filepath =
|
|
16658
|
+
filepath = join9(dir, filepath);
|
|
16657
16659
|
const pack = await fs3.read(filepath);
|
|
16658
16660
|
const getExternalRefDelta = (oid) => _readObject({ fs: fs3, cache, gitdir, oid });
|
|
16659
16661
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -16674,7 +16676,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16674
16676
|
fs: fs3,
|
|
16675
16677
|
onProgress,
|
|
16676
16678
|
dir,
|
|
16677
|
-
gitdir =
|
|
16679
|
+
gitdir = join9(dir, ".git"),
|
|
16678
16680
|
filepath,
|
|
16679
16681
|
cache = {}
|
|
16680
16682
|
}) {
|
|
@@ -16702,7 +16704,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16702
16704
|
fs: fs3,
|
|
16703
16705
|
bare = false,
|
|
16704
16706
|
dir,
|
|
16705
|
-
gitdir = bare ? dir :
|
|
16707
|
+
gitdir = bare ? dir : join9(dir, ".git"),
|
|
16706
16708
|
defaultBranch = "master"
|
|
16707
16709
|
}) {
|
|
16708
16710
|
try {
|
|
@@ -16776,7 +16778,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16776
16778
|
async function isDescendent({
|
|
16777
16779
|
fs: fs3,
|
|
16778
16780
|
dir,
|
|
16779
|
-
gitdir =
|
|
16781
|
+
gitdir = join9(dir, ".git"),
|
|
16780
16782
|
oid,
|
|
16781
16783
|
ancestor,
|
|
16782
16784
|
depth = -1,
|
|
@@ -16805,7 +16807,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16805
16807
|
async function isIgnored({
|
|
16806
16808
|
fs: fs3,
|
|
16807
16809
|
dir,
|
|
16808
|
-
gitdir =
|
|
16810
|
+
gitdir = join9(dir, ".git"),
|
|
16809
16811
|
filepath
|
|
16810
16812
|
}) {
|
|
16811
16813
|
try {
|
|
@@ -16829,7 +16831,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16829
16831
|
async function listBranches({
|
|
16830
16832
|
fs: fs3,
|
|
16831
16833
|
dir,
|
|
16832
|
-
gitdir =
|
|
16834
|
+
gitdir = join9(dir, ".git"),
|
|
16833
16835
|
remote
|
|
16834
16836
|
}) {
|
|
16835
16837
|
try {
|
|
@@ -16886,17 +16888,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16886
16888
|
gitdir,
|
|
16887
16889
|
oid: entry.oid,
|
|
16888
16890
|
filenames,
|
|
16889
|
-
prefix:
|
|
16891
|
+
prefix: join9(prefix, entry.path)
|
|
16890
16892
|
});
|
|
16891
16893
|
} else {
|
|
16892
|
-
filenames.push(
|
|
16894
|
+
filenames.push(join9(prefix, entry.path));
|
|
16893
16895
|
}
|
|
16894
16896
|
}
|
|
16895
16897
|
}
|
|
16896
16898
|
async function listFiles({
|
|
16897
16899
|
fs: fs3,
|
|
16898
16900
|
dir,
|
|
16899
|
-
gitdir =
|
|
16901
|
+
gitdir = join9(dir, ".git"),
|
|
16900
16902
|
ref,
|
|
16901
16903
|
cache = {}
|
|
16902
16904
|
}) {
|
|
@@ -16940,7 +16942,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16940
16942
|
async function listNotes({
|
|
16941
16943
|
fs: fs3,
|
|
16942
16944
|
dir,
|
|
16943
|
-
gitdir =
|
|
16945
|
+
gitdir = join9(dir, ".git"),
|
|
16944
16946
|
ref = "refs/notes/commits",
|
|
16945
16947
|
cache = {}
|
|
16946
16948
|
}) {
|
|
@@ -16964,7 +16966,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16964
16966
|
async function listRefs({
|
|
16965
16967
|
fs: fs3,
|
|
16966
16968
|
dir,
|
|
16967
|
-
gitdir =
|
|
16969
|
+
gitdir = join9(dir, ".git"),
|
|
16968
16970
|
filepath
|
|
16969
16971
|
}) {
|
|
16970
16972
|
try {
|
|
@@ -16989,7 +16991,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
16989
16991
|
);
|
|
16990
16992
|
return remotes;
|
|
16991
16993
|
}
|
|
16992
|
-
async function listRemotes({ fs: fs3, dir, gitdir =
|
|
16994
|
+
async function listRemotes({ fs: fs3, dir, gitdir = join9(dir, ".git") }) {
|
|
16993
16995
|
try {
|
|
16994
16996
|
assertParameter("fs", fs3);
|
|
16995
16997
|
assertParameter("gitdir", gitdir);
|
|
@@ -17088,7 +17090,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17088
17090
|
throw err;
|
|
17089
17091
|
}
|
|
17090
17092
|
}
|
|
17091
|
-
async function listTags({ fs: fs3, dir, gitdir =
|
|
17093
|
+
async function listTags({ fs: fs3, dir, gitdir = join9(dir, ".git") }) {
|
|
17092
17094
|
try {
|
|
17093
17095
|
assertParameter("fs", fs3);
|
|
17094
17096
|
assertParameter("gitdir", gitdir);
|
|
@@ -17141,7 +17143,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17141
17143
|
const walks = tree.entries().map(function(entry) {
|
|
17142
17144
|
let result;
|
|
17143
17145
|
if (entry.oid === fileId) {
|
|
17144
|
-
result =
|
|
17146
|
+
result = join9(parentPath, entry.path);
|
|
17145
17147
|
filepaths.push(result);
|
|
17146
17148
|
} else if (entry.type === "tree") {
|
|
17147
17149
|
result = _readObject({
|
|
@@ -17158,7 +17160,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17158
17160
|
fileId,
|
|
17159
17161
|
oid,
|
|
17160
17162
|
filepaths,
|
|
17161
|
-
parentPath:
|
|
17163
|
+
parentPath: join9(parentPath, entry.path)
|
|
17162
17164
|
});
|
|
17163
17165
|
});
|
|
17164
17166
|
}
|
|
@@ -17333,7 +17335,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17333
17335
|
async function log({
|
|
17334
17336
|
fs: fs3,
|
|
17335
17337
|
dir,
|
|
17336
|
-
gitdir =
|
|
17338
|
+
gitdir = join9(dir, ".git"),
|
|
17337
17339
|
filepath,
|
|
17338
17340
|
ref = "HEAD",
|
|
17339
17341
|
depth,
|
|
@@ -17371,7 +17373,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17371
17373
|
fs: _fs,
|
|
17372
17374
|
onSign,
|
|
17373
17375
|
dir,
|
|
17374
|
-
gitdir =
|
|
17376
|
+
gitdir = join9(dir, ".git"),
|
|
17375
17377
|
ours,
|
|
17376
17378
|
theirs,
|
|
17377
17379
|
fastForward: fastForward2 = true,
|
|
@@ -17448,7 +17450,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17448
17450
|
fs: fs3,
|
|
17449
17451
|
cache,
|
|
17450
17452
|
dir,
|
|
17451
|
-
gitdir =
|
|
17453
|
+
gitdir = join9(dir, ".git"),
|
|
17452
17454
|
oids
|
|
17453
17455
|
}) {
|
|
17454
17456
|
const hash = new Hash();
|
|
@@ -17491,7 +17493,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17491
17493
|
const packfileSha = packfile.slice(-20).toString("hex");
|
|
17492
17494
|
const filename = `pack-${packfileSha}.pack`;
|
|
17493
17495
|
if (write) {
|
|
17494
|
-
await fs3.write(
|
|
17496
|
+
await fs3.write(join9(gitdir, `objects/pack/${filename}`), packfile);
|
|
17495
17497
|
return { filename };
|
|
17496
17498
|
}
|
|
17497
17499
|
return {
|
|
@@ -17502,7 +17504,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17502
17504
|
async function packObjects({
|
|
17503
17505
|
fs: fs3,
|
|
17504
17506
|
dir,
|
|
17505
|
-
gitdir =
|
|
17507
|
+
gitdir = join9(dir, ".git"),
|
|
17506
17508
|
oids,
|
|
17507
17509
|
write = false,
|
|
17508
17510
|
cache = {}
|
|
@@ -17534,7 +17536,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17534
17536
|
onAuthSuccess,
|
|
17535
17537
|
onAuthFailure,
|
|
17536
17538
|
dir,
|
|
17537
|
-
gitdir =
|
|
17539
|
+
gitdir = join9(dir, ".git"),
|
|
17538
17540
|
ref,
|
|
17539
17541
|
url,
|
|
17540
17542
|
remote,
|
|
@@ -17604,7 +17606,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17604
17606
|
fs: fs3,
|
|
17605
17607
|
cache,
|
|
17606
17608
|
dir,
|
|
17607
|
-
gitdir =
|
|
17609
|
+
gitdir = join9(dir, ".git"),
|
|
17608
17610
|
start,
|
|
17609
17611
|
finish
|
|
17610
17612
|
}) {
|
|
@@ -17652,7 +17654,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17652
17654
|
fs: fs3,
|
|
17653
17655
|
cache,
|
|
17654
17656
|
dir,
|
|
17655
|
-
gitdir =
|
|
17657
|
+
gitdir = join9(dir, ".git"),
|
|
17656
17658
|
oids
|
|
17657
17659
|
}) {
|
|
17658
17660
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -17955,7 +17957,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
17955
17957
|
onAuthFailure,
|
|
17956
17958
|
onPrePush,
|
|
17957
17959
|
dir,
|
|
17958
|
-
gitdir =
|
|
17960
|
+
gitdir = join9(dir, ".git"),
|
|
17959
17961
|
ref,
|
|
17960
17962
|
remoteRef,
|
|
17961
17963
|
remote = "origin",
|
|
@@ -18031,7 +18033,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18031
18033
|
async function readBlob({
|
|
18032
18034
|
fs: fs3,
|
|
18033
18035
|
dir,
|
|
18034
|
-
gitdir =
|
|
18036
|
+
gitdir = join9(dir, ".git"),
|
|
18035
18037
|
oid,
|
|
18036
18038
|
filepath,
|
|
18037
18039
|
cache = {}
|
|
@@ -18057,7 +18059,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18057
18059
|
async function readCommit({
|
|
18058
18060
|
fs: fs3,
|
|
18059
18061
|
dir,
|
|
18060
|
-
gitdir =
|
|
18062
|
+
gitdir = join9(dir, ".git"),
|
|
18061
18063
|
oid,
|
|
18062
18064
|
cache = {}
|
|
18063
18065
|
}) {
|
|
@@ -18098,7 +18100,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18098
18100
|
async function readNote({
|
|
18099
18101
|
fs: fs3,
|
|
18100
18102
|
dir,
|
|
18101
|
-
gitdir =
|
|
18103
|
+
gitdir = join9(dir, ".git"),
|
|
18102
18104
|
ref = "refs/notes/commits",
|
|
18103
18105
|
oid,
|
|
18104
18106
|
cache = {}
|
|
@@ -18125,7 +18127,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18125
18127
|
async function readObject({
|
|
18126
18128
|
fs: _fs,
|
|
18127
18129
|
dir,
|
|
18128
|
-
gitdir =
|
|
18130
|
+
gitdir = join9(dir, ".git"),
|
|
18129
18131
|
oid,
|
|
18130
18132
|
format = "parsed",
|
|
18131
18133
|
filepath = void 0,
|
|
@@ -18214,7 +18216,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18214
18216
|
async function readTag({
|
|
18215
18217
|
fs: fs3,
|
|
18216
18218
|
dir,
|
|
18217
|
-
gitdir =
|
|
18219
|
+
gitdir = join9(dir, ".git"),
|
|
18218
18220
|
oid,
|
|
18219
18221
|
cache = {}
|
|
18220
18222
|
}) {
|
|
@@ -18238,7 +18240,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18238
18240
|
async function readTree({
|
|
18239
18241
|
fs: fs3,
|
|
18240
18242
|
dir,
|
|
18241
|
-
gitdir =
|
|
18243
|
+
gitdir = join9(dir, ".git"),
|
|
18242
18244
|
oid,
|
|
18243
18245
|
filepath = void 0,
|
|
18244
18246
|
cache = {}
|
|
@@ -18264,7 +18266,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18264
18266
|
async function remove({
|
|
18265
18267
|
fs: _fs,
|
|
18266
18268
|
dir,
|
|
18267
|
-
gitdir =
|
|
18269
|
+
gitdir = join9(dir, ".git"),
|
|
18268
18270
|
filepath,
|
|
18269
18271
|
cache = {}
|
|
18270
18272
|
}) {
|
|
@@ -18340,7 +18342,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18340
18342
|
fs: _fs,
|
|
18341
18343
|
onSign,
|
|
18342
18344
|
dir,
|
|
18343
|
-
gitdir =
|
|
18345
|
+
gitdir = join9(dir, ".git"),
|
|
18344
18346
|
ref = "refs/notes/commits",
|
|
18345
18347
|
oid,
|
|
18346
18348
|
author: _author,
|
|
@@ -18428,7 +18430,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18428
18430
|
async function renameBranch({
|
|
18429
18431
|
fs: fs3,
|
|
18430
18432
|
dir,
|
|
18431
|
-
gitdir =
|
|
18433
|
+
gitdir = join9(dir, ".git"),
|
|
18432
18434
|
ref,
|
|
18433
18435
|
oldref,
|
|
18434
18436
|
checkout: checkout2 = false
|
|
@@ -18458,7 +18460,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18458
18460
|
async function resetIndex({
|
|
18459
18461
|
fs: _fs,
|
|
18460
18462
|
dir,
|
|
18461
|
-
gitdir =
|
|
18463
|
+
gitdir = join9(dir, ".git"),
|
|
18462
18464
|
filepath,
|
|
18463
18465
|
ref,
|
|
18464
18466
|
cache = {}
|
|
@@ -18505,7 +18507,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18505
18507
|
gid: 0,
|
|
18506
18508
|
size: 0
|
|
18507
18509
|
};
|
|
18508
|
-
const object4 = dir && await fs3.read(
|
|
18510
|
+
const object4 = dir && await fs3.read(join9(dir, filepath));
|
|
18509
18511
|
if (object4) {
|
|
18510
18512
|
workdirOid = await hashObject$1({
|
|
18511
18513
|
gitdir: updatedGitdir,
|
|
@@ -18513,7 +18515,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18513
18515
|
object: object4
|
|
18514
18516
|
});
|
|
18515
18517
|
if (oid === workdirOid) {
|
|
18516
|
-
stats = await fs3.lstat(
|
|
18518
|
+
stats = await fs3.lstat(join9(dir, filepath));
|
|
18517
18519
|
}
|
|
18518
18520
|
}
|
|
18519
18521
|
await GitIndexManager.acquire(
|
|
@@ -18533,7 +18535,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18533
18535
|
async function resolveRef({
|
|
18534
18536
|
fs: fs3,
|
|
18535
18537
|
dir,
|
|
18536
|
-
gitdir =
|
|
18538
|
+
gitdir = join9(dir, ".git"),
|
|
18537
18539
|
ref,
|
|
18538
18540
|
depth
|
|
18539
18541
|
}) {
|
|
@@ -18558,7 +18560,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18558
18560
|
async function setConfig({
|
|
18559
18561
|
fs: _fs,
|
|
18560
18562
|
dir,
|
|
18561
|
-
gitdir =
|
|
18563
|
+
gitdir = join9(dir, ".git"),
|
|
18562
18564
|
path: path2,
|
|
18563
18565
|
value,
|
|
18564
18566
|
append = false
|
|
@@ -18626,7 +18628,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18626
18628
|
* @param {string} args.dir - The working directory.
|
|
18627
18629
|
* @param {string}[args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
18628
18630
|
*/
|
|
18629
|
-
constructor({ fs: fs3, dir, gitdir =
|
|
18631
|
+
constructor({ fs: fs3, dir, gitdir = join9(dir, ".git") }) {
|
|
18630
18632
|
Object.assign(this, {
|
|
18631
18633
|
fs: fs3,
|
|
18632
18634
|
dir,
|
|
@@ -18656,7 +18658,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18656
18658
|
* @returns {string} - The file path for the stash reference.
|
|
18657
18659
|
*/
|
|
18658
18660
|
get refStashPath() {
|
|
18659
|
-
return
|
|
18661
|
+
return join9(this.gitdir, _GitStashManager.refStash);
|
|
18660
18662
|
}
|
|
18661
18663
|
/**
|
|
18662
18664
|
* Gets the file path for the stash reflogs.
|
|
@@ -18664,7 +18666,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18664
18666
|
* @returns {string} - The file path for the stash reflogs.
|
|
18665
18667
|
*/
|
|
18666
18668
|
get refLogsStashPath() {
|
|
18667
|
-
return
|
|
18669
|
+
return join9(this.gitdir, _GitStashManager.refLogsStash);
|
|
18668
18670
|
}
|
|
18669
18671
|
/**
|
|
18670
18672
|
* Retrieves the author information for the stash.
|
|
@@ -18970,7 +18972,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18970
18972
|
async function stash({
|
|
18971
18973
|
fs: fs3,
|
|
18972
18974
|
dir,
|
|
18973
|
-
gitdir =
|
|
18975
|
+
gitdir = join9(dir, ".git"),
|
|
18974
18976
|
op = "push",
|
|
18975
18977
|
message = "",
|
|
18976
18978
|
refIdx = 0
|
|
@@ -18993,7 +18995,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18993
18995
|
const _fs = new FileSystem(fs3);
|
|
18994
18996
|
const updatedGitdir = await discoverGitdir({ fsp: _fs, dotgit: gitdir });
|
|
18995
18997
|
const folders = ["refs", "logs", "logs/refs"];
|
|
18996
|
-
folders.map((f) =>
|
|
18998
|
+
folders.map((f) => join9(updatedGitdir, f)).forEach(async (folder) => {
|
|
18997
18999
|
if (!await _fs.exists(folder)) {
|
|
18998
19000
|
await _fs.mkdir(folder);
|
|
18999
19001
|
}
|
|
@@ -19023,7 +19025,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19023
19025
|
async function status({
|
|
19024
19026
|
fs: _fs,
|
|
19025
19027
|
dir,
|
|
19026
|
-
gitdir =
|
|
19028
|
+
gitdir = join9(dir, ".git"),
|
|
19027
19029
|
filepath,
|
|
19028
19030
|
cache = {},
|
|
19029
19031
|
refresh = true
|
|
@@ -19062,7 +19064,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19062
19064
|
return "ignored";
|
|
19063
19065
|
}
|
|
19064
19066
|
}
|
|
19065
|
-
const stats = await fs3.lstat(
|
|
19067
|
+
const stats = await fs3.lstat(join9(dir, filepath));
|
|
19066
19068
|
const H = treeOid !== null;
|
|
19067
19069
|
const I = indexEntry !== null;
|
|
19068
19070
|
const W = stats !== null;
|
|
@@ -19072,7 +19074,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19072
19074
|
} else {
|
|
19073
19075
|
const config = await GitConfigManager.get({ fs: fs3, gitdir: updatedGitdir });
|
|
19074
19076
|
const autocrlf = await config.get("core.autocrlf");
|
|
19075
|
-
const object4 = await fs3.read(
|
|
19077
|
+
const object4 = await fs3.read(join9(dir, filepath), { autocrlf });
|
|
19076
19078
|
const workdirOid = await hashObject$1({
|
|
19077
19079
|
gitdir: updatedGitdir,
|
|
19078
19080
|
type: "blob",
|
|
@@ -19121,9 +19123,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19121
19123
|
}
|
|
19122
19124
|
async function getOidAtPath({ fs: fs3, cache, gitdir: updatedGitdir, tree, path: path2 }) {
|
|
19123
19125
|
if (typeof path2 === "string") path2 = path2.split("/");
|
|
19124
|
-
const
|
|
19126
|
+
const dirname6 = path2.shift();
|
|
19125
19127
|
for (const entry of tree) {
|
|
19126
|
-
if (entry.path ===
|
|
19128
|
+
if (entry.path === dirname6) {
|
|
19127
19129
|
if (path2.length === 0) {
|
|
19128
19130
|
return entry.oid;
|
|
19129
19131
|
}
|
|
@@ -19163,7 +19165,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19163
19165
|
async function statusMatrix({
|
|
19164
19166
|
fs: _fs,
|
|
19165
19167
|
dir,
|
|
19166
|
-
gitdir =
|
|
19168
|
+
gitdir = join9(dir, ".git"),
|
|
19167
19169
|
ref = "HEAD",
|
|
19168
19170
|
filepaths = ["."],
|
|
19169
19171
|
filter,
|
|
@@ -19236,7 +19238,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19236
19238
|
async function tag({
|
|
19237
19239
|
fs: _fs,
|
|
19238
19240
|
dir,
|
|
19239
|
-
gitdir =
|
|
19241
|
+
gitdir = join9(dir, ".git"),
|
|
19240
19242
|
ref,
|
|
19241
19243
|
object: object4,
|
|
19242
19244
|
force = false
|
|
@@ -19268,7 +19270,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19268
19270
|
async function updateIndex$1({
|
|
19269
19271
|
fs: _fs,
|
|
19270
19272
|
dir,
|
|
19271
|
-
gitdir =
|
|
19273
|
+
gitdir = join9(dir, ".git"),
|
|
19272
19274
|
cache = {},
|
|
19273
19275
|
filepath,
|
|
19274
19276
|
oid,
|
|
@@ -19288,7 +19290,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19288
19290
|
{ fs: fs3, gitdir: updatedGitdir, cache },
|
|
19289
19291
|
async function(index2) {
|
|
19290
19292
|
if (!force) {
|
|
19291
|
-
const fileStats2 = await fs3.lstat(
|
|
19293
|
+
const fileStats2 = await fs3.lstat(join9(dir, filepath));
|
|
19292
19294
|
if (fileStats2) {
|
|
19293
19295
|
if (fileStats2.isDirectory()) {
|
|
19294
19296
|
throw new InvalidFilepathError("directory");
|
|
@@ -19306,7 +19308,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19306
19308
|
}
|
|
19307
19309
|
let fileStats;
|
|
19308
19310
|
if (!oid) {
|
|
19309
|
-
fileStats = await fs3.lstat(
|
|
19311
|
+
fileStats = await fs3.lstat(join9(dir, filepath));
|
|
19310
19312
|
if (!fileStats) {
|
|
19311
19313
|
throw new NotFoundError(
|
|
19312
19314
|
`file at "${filepath}" on disk and "remove" not set`
|
|
@@ -19327,7 +19329,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19327
19329
|
let stats;
|
|
19328
19330
|
if (!oid) {
|
|
19329
19331
|
stats = fileStats;
|
|
19330
|
-
const object4 = stats.isSymbolicLink() ? await fs3.readlink(
|
|
19332
|
+
const object4 = stats.isSymbolicLink() ? await fs3.readlink(join9(dir, filepath)) : await fs3.read(join9(dir, filepath));
|
|
19331
19333
|
oid = await _writeObject({
|
|
19332
19334
|
fs: fs3,
|
|
19333
19335
|
gitdir: updatedGitdir,
|
|
@@ -19371,7 +19373,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19371
19373
|
async function walk({
|
|
19372
19374
|
fs: fs3,
|
|
19373
19375
|
dir,
|
|
19374
|
-
gitdir =
|
|
19376
|
+
gitdir = join9(dir, ".git"),
|
|
19375
19377
|
trees,
|
|
19376
19378
|
map,
|
|
19377
19379
|
reduce,
|
|
@@ -19399,7 +19401,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19399
19401
|
throw err;
|
|
19400
19402
|
}
|
|
19401
19403
|
}
|
|
19402
|
-
async function writeBlob({ fs: fs3, dir, gitdir =
|
|
19404
|
+
async function writeBlob({ fs: fs3, dir, gitdir = join9(dir, ".git"), blob }) {
|
|
19403
19405
|
try {
|
|
19404
19406
|
assertParameter("fs", fs3);
|
|
19405
19407
|
assertParameter("gitdir", gitdir);
|
|
@@ -19421,7 +19423,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19421
19423
|
async function writeCommit({
|
|
19422
19424
|
fs: fs3,
|
|
19423
19425
|
dir,
|
|
19424
|
-
gitdir =
|
|
19426
|
+
gitdir = join9(dir, ".git"),
|
|
19425
19427
|
commit: commit3
|
|
19426
19428
|
}) {
|
|
19427
19429
|
try {
|
|
@@ -19443,7 +19445,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19443
19445
|
async function writeObject({
|
|
19444
19446
|
fs: _fs,
|
|
19445
19447
|
dir,
|
|
19446
|
-
gitdir =
|
|
19448
|
+
gitdir = join9(dir, ".git"),
|
|
19447
19449
|
type,
|
|
19448
19450
|
object: object4,
|
|
19449
19451
|
format = "parsed",
|
|
@@ -19489,7 +19491,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19489
19491
|
async function writeRef({
|
|
19490
19492
|
fs: _fs,
|
|
19491
19493
|
dir,
|
|
19492
|
-
gitdir =
|
|
19494
|
+
gitdir = join9(dir, ".git"),
|
|
19493
19495
|
ref,
|
|
19494
19496
|
value,
|
|
19495
19497
|
force = false,
|
|
@@ -19544,7 +19546,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19544
19546
|
});
|
|
19545
19547
|
return oid;
|
|
19546
19548
|
}
|
|
19547
|
-
async function writeTag({ fs: fs3, dir, gitdir =
|
|
19549
|
+
async function writeTag({ fs: fs3, dir, gitdir = join9(dir, ".git"), tag: tag2 }) {
|
|
19548
19550
|
try {
|
|
19549
19551
|
assertParameter("fs", fs3);
|
|
19550
19552
|
assertParameter("gitdir", gitdir);
|
|
@@ -19561,7 +19563,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
19561
19563
|
throw err;
|
|
19562
19564
|
}
|
|
19563
19565
|
}
|
|
19564
|
-
async function writeTree({ fs: fs3, dir, gitdir =
|
|
19566
|
+
async function writeTree({ fs: fs3, dir, gitdir = join9(dir, ".git"), tree }) {
|
|
19565
19567
|
try {
|
|
19566
19568
|
assertParameter("fs", fs3);
|
|
19567
19569
|
assertParameter("gitdir", gitdir);
|
|
@@ -20103,11 +20105,11 @@ var require_codegen = __commonJS({
|
|
|
20103
20105
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
20104
20106
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
20105
20107
|
}
|
|
20106
|
-
optimizeNames(names,
|
|
20108
|
+
optimizeNames(names, constants6) {
|
|
20107
20109
|
if (!names[this.name.str])
|
|
20108
20110
|
return;
|
|
20109
20111
|
if (this.rhs)
|
|
20110
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
20112
|
+
this.rhs = optimizeExpr(this.rhs, names, constants6);
|
|
20111
20113
|
return this;
|
|
20112
20114
|
}
|
|
20113
20115
|
get names() {
|
|
@@ -20124,10 +20126,10 @@ var require_codegen = __commonJS({
|
|
|
20124
20126
|
render({ _n }) {
|
|
20125
20127
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
20126
20128
|
}
|
|
20127
|
-
optimizeNames(names,
|
|
20129
|
+
optimizeNames(names, constants6) {
|
|
20128
20130
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
20129
20131
|
return;
|
|
20130
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
20132
|
+
this.rhs = optimizeExpr(this.rhs, names, constants6);
|
|
20131
20133
|
return this;
|
|
20132
20134
|
}
|
|
20133
20135
|
get names() {
|
|
@@ -20188,8 +20190,8 @@ var require_codegen = __commonJS({
|
|
|
20188
20190
|
optimizeNodes() {
|
|
20189
20191
|
return `${this.code}` ? this : void 0;
|
|
20190
20192
|
}
|
|
20191
|
-
optimizeNames(names,
|
|
20192
|
-
this.code = optimizeExpr(this.code, names,
|
|
20193
|
+
optimizeNames(names, constants6) {
|
|
20194
|
+
this.code = optimizeExpr(this.code, names, constants6);
|
|
20193
20195
|
return this;
|
|
20194
20196
|
}
|
|
20195
20197
|
get names() {
|
|
@@ -20218,12 +20220,12 @@ var require_codegen = __commonJS({
|
|
|
20218
20220
|
}
|
|
20219
20221
|
return nodes.length > 0 ? this : void 0;
|
|
20220
20222
|
}
|
|
20221
|
-
optimizeNames(names,
|
|
20223
|
+
optimizeNames(names, constants6) {
|
|
20222
20224
|
const { nodes } = this;
|
|
20223
20225
|
let i = nodes.length;
|
|
20224
20226
|
while (i--) {
|
|
20225
20227
|
const n = nodes[i];
|
|
20226
|
-
if (n.optimizeNames(names,
|
|
20228
|
+
if (n.optimizeNames(names, constants6))
|
|
20227
20229
|
continue;
|
|
20228
20230
|
subtractNames(names, n.names);
|
|
20229
20231
|
nodes.splice(i, 1);
|
|
@@ -20276,12 +20278,12 @@ var require_codegen = __commonJS({
|
|
|
20276
20278
|
return void 0;
|
|
20277
20279
|
return this;
|
|
20278
20280
|
}
|
|
20279
|
-
optimizeNames(names,
|
|
20281
|
+
optimizeNames(names, constants6) {
|
|
20280
20282
|
var _a;
|
|
20281
|
-
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
20282
|
-
if (!(super.optimizeNames(names,
|
|
20283
|
+
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants6);
|
|
20284
|
+
if (!(super.optimizeNames(names, constants6) || this.else))
|
|
20283
20285
|
return;
|
|
20284
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
20286
|
+
this.condition = optimizeExpr(this.condition, names, constants6);
|
|
20285
20287
|
return this;
|
|
20286
20288
|
}
|
|
20287
20289
|
get names() {
|
|
@@ -20304,10 +20306,10 @@ var require_codegen = __commonJS({
|
|
|
20304
20306
|
render(opts) {
|
|
20305
20307
|
return `for(${this.iteration})` + super.render(opts);
|
|
20306
20308
|
}
|
|
20307
|
-
optimizeNames(names,
|
|
20308
|
-
if (!super.optimizeNames(names,
|
|
20309
|
+
optimizeNames(names, constants6) {
|
|
20310
|
+
if (!super.optimizeNames(names, constants6))
|
|
20309
20311
|
return;
|
|
20310
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
20312
|
+
this.iteration = optimizeExpr(this.iteration, names, constants6);
|
|
20311
20313
|
return this;
|
|
20312
20314
|
}
|
|
20313
20315
|
get names() {
|
|
@@ -20343,10 +20345,10 @@ var require_codegen = __commonJS({
|
|
|
20343
20345
|
render(opts) {
|
|
20344
20346
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
20345
20347
|
}
|
|
20346
|
-
optimizeNames(names,
|
|
20347
|
-
if (!super.optimizeNames(names,
|
|
20348
|
+
optimizeNames(names, constants6) {
|
|
20349
|
+
if (!super.optimizeNames(names, constants6))
|
|
20348
20350
|
return;
|
|
20349
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
20351
|
+
this.iterable = optimizeExpr(this.iterable, names, constants6);
|
|
20350
20352
|
return this;
|
|
20351
20353
|
}
|
|
20352
20354
|
get names() {
|
|
@@ -20388,11 +20390,11 @@ var require_codegen = __commonJS({
|
|
|
20388
20390
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
20389
20391
|
return this;
|
|
20390
20392
|
}
|
|
20391
|
-
optimizeNames(names,
|
|
20393
|
+
optimizeNames(names, constants6) {
|
|
20392
20394
|
var _a, _b;
|
|
20393
|
-
super.optimizeNames(names,
|
|
20394
|
-
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
20395
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
20395
|
+
super.optimizeNames(names, constants6);
|
|
20396
|
+
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants6);
|
|
20397
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants6);
|
|
20396
20398
|
return this;
|
|
20397
20399
|
}
|
|
20398
20400
|
get names() {
|
|
@@ -20693,7 +20695,7 @@ var require_codegen = __commonJS({
|
|
|
20693
20695
|
function addExprNames(names, from) {
|
|
20694
20696
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
20695
20697
|
}
|
|
20696
|
-
function optimizeExpr(expr, names,
|
|
20698
|
+
function optimizeExpr(expr, names, constants6) {
|
|
20697
20699
|
if (expr instanceof code_1.Name)
|
|
20698
20700
|
return replaceName(expr);
|
|
20699
20701
|
if (!canOptimize(expr))
|
|
@@ -20708,14 +20710,14 @@ var require_codegen = __commonJS({
|
|
|
20708
20710
|
return items2;
|
|
20709
20711
|
}, []));
|
|
20710
20712
|
function replaceName(n) {
|
|
20711
|
-
const c =
|
|
20713
|
+
const c = constants6[n.str];
|
|
20712
20714
|
if (c === void 0 || names[n.str] !== 1)
|
|
20713
20715
|
return n;
|
|
20714
20716
|
delete names[n.str];
|
|
20715
20717
|
return c;
|
|
20716
20718
|
}
|
|
20717
20719
|
function canOptimize(e) {
|
|
20718
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
20720
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants6[c.str] !== void 0);
|
|
20719
20721
|
}
|
|
20720
20722
|
}
|
|
20721
20723
|
function subtractNames(names, from) {
|
|
@@ -23604,50 +23606,50 @@ var require_fast_uri = __commonJS({
|
|
|
23604
23606
|
schemelessOptions.skipEscape = true;
|
|
23605
23607
|
return serialize(resolved, schemelessOptions);
|
|
23606
23608
|
}
|
|
23607
|
-
function resolveComponent(base,
|
|
23609
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
23608
23610
|
const target = {};
|
|
23609
23611
|
if (!skipNormalization) {
|
|
23610
23612
|
base = parse(serialize(base, options), options);
|
|
23611
|
-
|
|
23613
|
+
relative4 = parse(serialize(relative4, options), options);
|
|
23612
23614
|
}
|
|
23613
23615
|
options = options || {};
|
|
23614
|
-
if (!options.tolerant &&
|
|
23615
|
-
target.scheme =
|
|
23616
|
-
target.userinfo =
|
|
23617
|
-
target.host =
|
|
23618
|
-
target.port =
|
|
23619
|
-
target.path = removeDotSegments(
|
|
23620
|
-
target.query =
|
|
23616
|
+
if (!options.tolerant && relative4.scheme) {
|
|
23617
|
+
target.scheme = relative4.scheme;
|
|
23618
|
+
target.userinfo = relative4.userinfo;
|
|
23619
|
+
target.host = relative4.host;
|
|
23620
|
+
target.port = relative4.port;
|
|
23621
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
23622
|
+
target.query = relative4.query;
|
|
23621
23623
|
} else {
|
|
23622
|
-
if (
|
|
23623
|
-
target.userinfo =
|
|
23624
|
-
target.host =
|
|
23625
|
-
target.port =
|
|
23626
|
-
target.path = removeDotSegments(
|
|
23627
|
-
target.query =
|
|
23624
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
23625
|
+
target.userinfo = relative4.userinfo;
|
|
23626
|
+
target.host = relative4.host;
|
|
23627
|
+
target.port = relative4.port;
|
|
23628
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
23629
|
+
target.query = relative4.query;
|
|
23628
23630
|
} else {
|
|
23629
|
-
if (!
|
|
23631
|
+
if (!relative4.path) {
|
|
23630
23632
|
target.path = base.path;
|
|
23631
|
-
if (
|
|
23632
|
-
target.query =
|
|
23633
|
+
if (relative4.query !== void 0) {
|
|
23634
|
+
target.query = relative4.query;
|
|
23633
23635
|
} else {
|
|
23634
23636
|
target.query = base.query;
|
|
23635
23637
|
}
|
|
23636
23638
|
} else {
|
|
23637
|
-
if (
|
|
23638
|
-
target.path = removeDotSegments(
|
|
23639
|
+
if (relative4.path[0] === "/") {
|
|
23640
|
+
target.path = removeDotSegments(relative4.path);
|
|
23639
23641
|
} else {
|
|
23640
23642
|
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
23641
23643
|
if (baseHasAuthority && !base.path) {
|
|
23642
|
-
target.path = "/" +
|
|
23644
|
+
target.path = "/" + relative4.path;
|
|
23643
23645
|
} else if (!base.path) {
|
|
23644
|
-
target.path =
|
|
23646
|
+
target.path = relative4.path;
|
|
23645
23647
|
} else {
|
|
23646
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
23648
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
23647
23649
|
}
|
|
23648
23650
|
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
23649
23651
|
}
|
|
23650
|
-
target.query =
|
|
23652
|
+
target.query = relative4.query;
|
|
23651
23653
|
}
|
|
23652
23654
|
target.userinfo = base.userinfo;
|
|
23653
23655
|
target.host = base.host;
|
|
@@ -23655,7 +23657,7 @@ var require_fast_uri = __commonJS({
|
|
|
23655
23657
|
}
|
|
23656
23658
|
target.scheme = base.scheme;
|
|
23657
23659
|
}
|
|
23658
|
-
target.fragment =
|
|
23660
|
+
target.fragment = relative4.fragment;
|
|
23659
23661
|
return target;
|
|
23660
23662
|
}
|
|
23661
23663
|
function equal(uriA, uriB, options) {
|
|
@@ -31162,10 +31164,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
31162
31164
|
let offset = bm.offset;
|
|
31163
31165
|
let commentEnd = null;
|
|
31164
31166
|
for (const collItem of bm.items) {
|
|
31165
|
-
const { start, key, sep:
|
|
31167
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
31166
31168
|
const keyProps = resolveProps.resolveProps(start, {
|
|
31167
31169
|
indicator: "explicit-key-ind",
|
|
31168
|
-
next: key ??
|
|
31170
|
+
next: key ?? sep4?.[0],
|
|
31169
31171
|
offset,
|
|
31170
31172
|
onError,
|
|
31171
31173
|
parentIndent: bm.indent,
|
|
@@ -31179,7 +31181,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
31179
31181
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
31180
31182
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
31181
31183
|
}
|
|
31182
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
31184
|
+
if (!keyProps.anchor && !keyProps.tag && !sep4) {
|
|
31183
31185
|
commentEnd = keyProps.end;
|
|
31184
31186
|
if (keyProps.comment) {
|
|
31185
31187
|
if (map.comment)
|
|
@@ -31203,7 +31205,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
31203
31205
|
ctx.atKey = false;
|
|
31204
31206
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
31205
31207
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
31206
|
-
const valueProps = resolveProps.resolveProps(
|
|
31208
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
31207
31209
|
indicator: "map-value-ind",
|
|
31208
31210
|
next: value,
|
|
31209
31211
|
offset: keyNode.range[2],
|
|
@@ -31219,7 +31221,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
31219
31221
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
31220
31222
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
31221
31223
|
}
|
|
31222
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
31224
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep4, null, valueProps, onError);
|
|
31223
31225
|
if (ctx.schema.compat)
|
|
31224
31226
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
31225
31227
|
offset = valueNode.range[2];
|
|
@@ -31310,7 +31312,7 @@ var require_resolve_end = __commonJS({
|
|
|
31310
31312
|
let comment = "";
|
|
31311
31313
|
if (end) {
|
|
31312
31314
|
let hasSpace = false;
|
|
31313
|
-
let
|
|
31315
|
+
let sep4 = "";
|
|
31314
31316
|
for (const token of end) {
|
|
31315
31317
|
const { source, type } = token;
|
|
31316
31318
|
switch (type) {
|
|
@@ -31324,13 +31326,13 @@ var require_resolve_end = __commonJS({
|
|
|
31324
31326
|
if (!comment)
|
|
31325
31327
|
comment = cb;
|
|
31326
31328
|
else
|
|
31327
|
-
comment +=
|
|
31328
|
-
|
|
31329
|
+
comment += sep4 + cb;
|
|
31330
|
+
sep4 = "";
|
|
31329
31331
|
break;
|
|
31330
31332
|
}
|
|
31331
31333
|
case "newline":
|
|
31332
31334
|
if (comment)
|
|
31333
|
-
|
|
31335
|
+
sep4 += source;
|
|
31334
31336
|
hasSpace = true;
|
|
31335
31337
|
break;
|
|
31336
31338
|
default:
|
|
@@ -31373,18 +31375,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
31373
31375
|
let offset = fc.offset + fc.start.source.length;
|
|
31374
31376
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
31375
31377
|
const collItem = fc.items[i];
|
|
31376
|
-
const { start, key, sep:
|
|
31378
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
31377
31379
|
const props = resolveProps.resolveProps(start, {
|
|
31378
31380
|
flow: fcName,
|
|
31379
31381
|
indicator: "explicit-key-ind",
|
|
31380
|
-
next: key ??
|
|
31382
|
+
next: key ?? sep4?.[0],
|
|
31381
31383
|
offset,
|
|
31382
31384
|
onError,
|
|
31383
31385
|
parentIndent: fc.indent,
|
|
31384
31386
|
startOnNewline: false
|
|
31385
31387
|
});
|
|
31386
31388
|
if (!props.found) {
|
|
31387
|
-
if (!props.anchor && !props.tag && !
|
|
31389
|
+
if (!props.anchor && !props.tag && !sep4 && !value) {
|
|
31388
31390
|
if (i === 0 && props.comma)
|
|
31389
31391
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
31390
31392
|
else if (i < fc.items.length - 1)
|
|
@@ -31438,8 +31440,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
31438
31440
|
}
|
|
31439
31441
|
}
|
|
31440
31442
|
}
|
|
31441
|
-
if (!isMap && !
|
|
31442
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
31443
|
+
if (!isMap && !sep4 && !props.found) {
|
|
31444
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep4, null, props, onError);
|
|
31443
31445
|
coll.items.push(valueNode);
|
|
31444
31446
|
offset = valueNode.range[2];
|
|
31445
31447
|
if (isBlock(value))
|
|
@@ -31451,7 +31453,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
31451
31453
|
if (isBlock(key))
|
|
31452
31454
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
31453
31455
|
ctx.atKey = false;
|
|
31454
|
-
const valueProps = resolveProps.resolveProps(
|
|
31456
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
31455
31457
|
flow: fcName,
|
|
31456
31458
|
indicator: "map-value-ind",
|
|
31457
31459
|
next: value,
|
|
@@ -31462,8 +31464,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
31462
31464
|
});
|
|
31463
31465
|
if (valueProps.found) {
|
|
31464
31466
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
31465
|
-
if (
|
|
31466
|
-
for (const st of
|
|
31467
|
+
if (sep4)
|
|
31468
|
+
for (const st of sep4) {
|
|
31467
31469
|
if (st === valueProps.found)
|
|
31468
31470
|
break;
|
|
31469
31471
|
if (st.type === "newline") {
|
|
@@ -31480,7 +31482,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
31480
31482
|
else
|
|
31481
31483
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
31482
31484
|
}
|
|
31483
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
31485
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep4, null, valueProps, onError) : null;
|
|
31484
31486
|
if (valueNode) {
|
|
31485
31487
|
if (isBlock(value))
|
|
31486
31488
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -31660,7 +31662,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
31660
31662
|
chompStart = i + 1;
|
|
31661
31663
|
}
|
|
31662
31664
|
let value = "";
|
|
31663
|
-
let
|
|
31665
|
+
let sep4 = "";
|
|
31664
31666
|
let prevMoreIndented = false;
|
|
31665
31667
|
for (let i = 0; i < contentStart; ++i)
|
|
31666
31668
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -31677,24 +31679,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
31677
31679
|
indent = "";
|
|
31678
31680
|
}
|
|
31679
31681
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
31680
|
-
value +=
|
|
31681
|
-
|
|
31682
|
+
value += sep4 + indent.slice(trimIndent) + content;
|
|
31683
|
+
sep4 = "\n";
|
|
31682
31684
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
31683
|
-
if (
|
|
31684
|
-
|
|
31685
|
-
else if (!prevMoreIndented &&
|
|
31686
|
-
|
|
31687
|
-
value +=
|
|
31688
|
-
|
|
31685
|
+
if (sep4 === " ")
|
|
31686
|
+
sep4 = "\n";
|
|
31687
|
+
else if (!prevMoreIndented && sep4 === "\n")
|
|
31688
|
+
sep4 = "\n\n";
|
|
31689
|
+
value += sep4 + indent.slice(trimIndent) + content;
|
|
31690
|
+
sep4 = "\n";
|
|
31689
31691
|
prevMoreIndented = true;
|
|
31690
31692
|
} else if (content === "") {
|
|
31691
|
-
if (
|
|
31693
|
+
if (sep4 === "\n")
|
|
31692
31694
|
value += "\n";
|
|
31693
31695
|
else
|
|
31694
|
-
|
|
31696
|
+
sep4 = "\n";
|
|
31695
31697
|
} else {
|
|
31696
|
-
value +=
|
|
31697
|
-
|
|
31698
|
+
value += sep4 + content;
|
|
31699
|
+
sep4 = " ";
|
|
31698
31700
|
prevMoreIndented = false;
|
|
31699
31701
|
}
|
|
31700
31702
|
}
|
|
@@ -31876,25 +31878,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
31876
31878
|
if (!match)
|
|
31877
31879
|
return source;
|
|
31878
31880
|
let res = match[1];
|
|
31879
|
-
let
|
|
31881
|
+
let sep4 = " ";
|
|
31880
31882
|
let pos = first.lastIndex;
|
|
31881
31883
|
line.lastIndex = pos;
|
|
31882
31884
|
while (match = line.exec(source)) {
|
|
31883
31885
|
if (match[1] === "") {
|
|
31884
|
-
if (
|
|
31885
|
-
res +=
|
|
31886
|
+
if (sep4 === "\n")
|
|
31887
|
+
res += sep4;
|
|
31886
31888
|
else
|
|
31887
|
-
|
|
31889
|
+
sep4 = "\n";
|
|
31888
31890
|
} else {
|
|
31889
|
-
res +=
|
|
31890
|
-
|
|
31891
|
+
res += sep4 + match[1];
|
|
31892
|
+
sep4 = " ";
|
|
31891
31893
|
}
|
|
31892
31894
|
pos = line.lastIndex;
|
|
31893
31895
|
}
|
|
31894
31896
|
const last = /[ \t]*(.*)/sy;
|
|
31895
31897
|
last.lastIndex = pos;
|
|
31896
31898
|
match = last.exec(source);
|
|
31897
|
-
return res +
|
|
31899
|
+
return res + sep4 + (match?.[1] ?? "");
|
|
31898
31900
|
}
|
|
31899
31901
|
function doubleQuotedValue(source, onError) {
|
|
31900
31902
|
let res = "";
|
|
@@ -32701,14 +32703,14 @@ var require_cst_stringify = __commonJS({
|
|
|
32701
32703
|
}
|
|
32702
32704
|
}
|
|
32703
32705
|
}
|
|
32704
|
-
function stringifyItem({ start, key, sep:
|
|
32706
|
+
function stringifyItem({ start, key, sep: sep4, value }) {
|
|
32705
32707
|
let res = "";
|
|
32706
32708
|
for (const st of start)
|
|
32707
32709
|
res += st.source;
|
|
32708
32710
|
if (key)
|
|
32709
32711
|
res += stringifyToken(key);
|
|
32710
|
-
if (
|
|
32711
|
-
for (const st of
|
|
32712
|
+
if (sep4)
|
|
32713
|
+
for (const st of sep4)
|
|
32712
32714
|
res += st.source;
|
|
32713
32715
|
if (value)
|
|
32714
32716
|
res += stringifyToken(value);
|
|
@@ -33858,18 +33860,18 @@ var require_parser = __commonJS({
|
|
|
33858
33860
|
if (this.type === "map-value-ind") {
|
|
33859
33861
|
const prev = getPrevProps(this.peek(2));
|
|
33860
33862
|
const start = getFirstKeyStartProps(prev);
|
|
33861
|
-
let
|
|
33863
|
+
let sep4;
|
|
33862
33864
|
if (scalar.end) {
|
|
33863
|
-
|
|
33864
|
-
|
|
33865
|
+
sep4 = scalar.end;
|
|
33866
|
+
sep4.push(this.sourceToken);
|
|
33865
33867
|
delete scalar.end;
|
|
33866
33868
|
} else
|
|
33867
|
-
|
|
33869
|
+
sep4 = [this.sourceToken];
|
|
33868
33870
|
const map = {
|
|
33869
33871
|
type: "block-map",
|
|
33870
33872
|
offset: scalar.offset,
|
|
33871
33873
|
indent: scalar.indent,
|
|
33872
|
-
items: [{ start, key: scalar, sep:
|
|
33874
|
+
items: [{ start, key: scalar, sep: sep4 }]
|
|
33873
33875
|
};
|
|
33874
33876
|
this.onKeyLine = true;
|
|
33875
33877
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -34022,15 +34024,15 @@ var require_parser = __commonJS({
|
|
|
34022
34024
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
34023
34025
|
const start2 = getFirstKeyStartProps(it.start);
|
|
34024
34026
|
const key = it.key;
|
|
34025
|
-
const
|
|
34026
|
-
|
|
34027
|
+
const sep4 = it.sep;
|
|
34028
|
+
sep4.push(this.sourceToken);
|
|
34027
34029
|
delete it.key;
|
|
34028
34030
|
delete it.sep;
|
|
34029
34031
|
this.stack.push({
|
|
34030
34032
|
type: "block-map",
|
|
34031
34033
|
offset: this.offset,
|
|
34032
34034
|
indent: this.indent,
|
|
34033
|
-
items: [{ start: start2, key, sep:
|
|
34035
|
+
items: [{ start: start2, key, sep: sep4 }]
|
|
34034
34036
|
});
|
|
34035
34037
|
} else if (start.length > 0) {
|
|
34036
34038
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -34224,13 +34226,13 @@ var require_parser = __commonJS({
|
|
|
34224
34226
|
const prev = getPrevProps(parent);
|
|
34225
34227
|
const start = getFirstKeyStartProps(prev);
|
|
34226
34228
|
fixFlowSeqItems(fc);
|
|
34227
|
-
const
|
|
34228
|
-
|
|
34229
|
+
const sep4 = fc.end.splice(1, fc.end.length);
|
|
34230
|
+
sep4.push(this.sourceToken);
|
|
34229
34231
|
const map = {
|
|
34230
34232
|
type: "block-map",
|
|
34231
34233
|
offset: fc.offset,
|
|
34232
34234
|
indent: fc.indent,
|
|
34233
|
-
items: [{ start, key: fc, sep:
|
|
34235
|
+
items: [{ start, key: fc, sep: sep4 }]
|
|
34234
34236
|
};
|
|
34235
34237
|
this.onKeyLine = true;
|
|
34236
34238
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -35847,14 +35849,14 @@ var require_receiver = __commonJS({
|
|
|
35847
35849
|
* @return {(Error|RangeError)} The error
|
|
35848
35850
|
* @private
|
|
35849
35851
|
*/
|
|
35850
|
-
createError(ErrorCtor, message, prefix, statusCode,
|
|
35852
|
+
createError(ErrorCtor, message, prefix, statusCode, errorCode3) {
|
|
35851
35853
|
this._loop = false;
|
|
35852
35854
|
this._errored = true;
|
|
35853
35855
|
const err = new ErrorCtor(
|
|
35854
35856
|
prefix ? `Invalid WebSocket frame: ${message}` : message
|
|
35855
35857
|
);
|
|
35856
35858
|
Error.captureStackTrace(err, this.createError);
|
|
35857
|
-
err.code =
|
|
35859
|
+
err.code = errorCode3;
|
|
35858
35860
|
err[kStatusCode] = statusCode;
|
|
35859
35861
|
return err;
|
|
35860
35862
|
}
|
|
@@ -37709,7 +37711,7 @@ var require_stream = __commonJS({
|
|
|
37709
37711
|
};
|
|
37710
37712
|
duplex._final = function(callback) {
|
|
37711
37713
|
if (ws.readyState === ws.CONNECTING) {
|
|
37712
|
-
ws.once("open", function
|
|
37714
|
+
ws.once("open", function open7() {
|
|
37713
37715
|
duplex._final(callback);
|
|
37714
37716
|
});
|
|
37715
37717
|
return;
|
|
@@ -37730,7 +37732,7 @@ var require_stream = __commonJS({
|
|
|
37730
37732
|
};
|
|
37731
37733
|
duplex._write = function(chunk, encoding, callback) {
|
|
37732
37734
|
if (ws.readyState === ws.CONNECTING) {
|
|
37733
|
-
ws.once("open", function
|
|
37735
|
+
ws.once("open", function open7() {
|
|
37734
37736
|
duplex._write(chunk, encoding, callback);
|
|
37735
37737
|
});
|
|
37736
37738
|
return;
|
|
@@ -39797,20 +39799,20 @@ async function readProjectLinks(directory, apiOrigin) {
|
|
|
39797
39799
|
const organizationId = /^([0-7][0-9A-HJKMNP-TV-Z]{25})\.json$/u.exec(name)?.[1];
|
|
39798
39800
|
if (organizationId === void 0)
|
|
39799
39801
|
continue;
|
|
39800
|
-
const
|
|
39801
|
-
if (isCurrentLink(
|
|
39802
|
-
links.push(
|
|
39802
|
+
const link3 = await readJson(join2(directory, LINKS, name));
|
|
39803
|
+
if (isCurrentLink(link3, apiOrigin, organizationId)) {
|
|
39804
|
+
links.push(link3);
|
|
39803
39805
|
continue;
|
|
39804
39806
|
}
|
|
39805
|
-
if (isRecord(
|
|
39807
|
+
if (isRecord(link3, [
|
|
39806
39808
|
"version",
|
|
39807
39809
|
"api_origin",
|
|
39808
39810
|
"organization_id",
|
|
39809
39811
|
"project_id",
|
|
39810
39812
|
"installation_id",
|
|
39811
39813
|
"repository_full_name"
|
|
39812
|
-
]) &&
|
|
39813
|
-
links.push(
|
|
39814
|
+
]) && link3["version"] === 2 && link3["api_origin"] === apiOrigin && link3["organization_id"] === organizationId && typeof link3["project_id"] === "string" && ULID.test(link3["project_id"]) && typeof link3["installation_id"] === "string" && typeof link3["repository_full_name"] === "string")
|
|
39815
|
+
links.push(link3);
|
|
39814
39816
|
}
|
|
39815
39817
|
const legacy = await readJson(join2(directory, LEGACY_LINK));
|
|
39816
39818
|
return {
|
|
@@ -39850,15 +39852,15 @@ function isCurrentLink(value, apiOrigin, organizationId) {
|
|
|
39850
39852
|
}
|
|
39851
39853
|
function chooseLinkedProject(directory, organizationId) {
|
|
39852
39854
|
if (organizationId !== void 0) {
|
|
39853
|
-
const
|
|
39854
|
-
if (
|
|
39855
|
-
return { outcome: "linked", projectId:
|
|
39855
|
+
const link3 = directory.links.find((candidate) => candidate.organization_id === organizationId);
|
|
39856
|
+
if (link3 !== void 0)
|
|
39857
|
+
return { outcome: "linked", projectId: link3.project_id, organizationId };
|
|
39856
39858
|
return directory.legacy === null ? { outcome: "none" } : { outcome: "linked", projectId: directory.legacy.project_id, organizationId: null };
|
|
39857
39859
|
}
|
|
39858
39860
|
const candidates = [
|
|
39859
|
-
...directory.links.map((
|
|
39860
|
-
projectId:
|
|
39861
|
-
organizationId:
|
|
39861
|
+
...directory.links.map((link3) => ({
|
|
39862
|
+
projectId: link3.project_id,
|
|
39863
|
+
organizationId: link3.organization_id
|
|
39862
39864
|
})),
|
|
39863
39865
|
...directory.legacy === null ? [] : [{ projectId: directory.legacy.project_id, organizationId: null }]
|
|
39864
39866
|
];
|
|
@@ -39869,11 +39871,11 @@ function chooseLinkedProject(directory, organizationId) {
|
|
|
39869
39871
|
return { outcome: "none" };
|
|
39870
39872
|
return {
|
|
39871
39873
|
outcome: "ambiguous",
|
|
39872
|
-
organizationIds: directory.links.map((
|
|
39874
|
+
organizationIds: directory.links.map((link3) => link3.organization_id)
|
|
39873
39875
|
};
|
|
39874
39876
|
}
|
|
39875
39877
|
function linkedOrganization(directory, projectId) {
|
|
39876
|
-
const organizations = new Set(directory.links.filter((
|
|
39878
|
+
const organizations = new Set(directory.links.filter((link3) => link3.project_id === projectId).map((link3) => link3.organization_id));
|
|
39877
39879
|
const [organizationId] = organizations;
|
|
39878
39880
|
return organizations.size === 1 ? organizationId : void 0;
|
|
39879
39881
|
}
|
|
@@ -40709,15 +40711,15 @@ var PROBLEM_POLICY = {
|
|
|
40709
40711
|
domain_hostname_taken: {
|
|
40710
40712
|
status: 409,
|
|
40711
40713
|
retryable: false,
|
|
40712
|
-
action: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
|
|
40713
|
-
restAction: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
|
|
40714
|
+
action: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --idempotency-key KEY --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --yes --json.",
|
|
40715
|
+
restAction: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --idempotency-key KEY --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --yes --json.",
|
|
40714
40716
|
title: "Domain hostname is already connected"
|
|
40715
40717
|
},
|
|
40716
40718
|
domain_ownership_required: {
|
|
40717
40719
|
status: 409,
|
|
40718
40720
|
retryable: false,
|
|
40719
|
-
action: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
|
|
40720
|
-
restAction: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
|
|
40721
|
+
action: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --yes --json. Repeating before the record is published cannot work.",
|
|
40722
|
+
restAction: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --yes --json. Repeating before the record is published cannot work.",
|
|
40721
40723
|
title: "Verify the domain before connecting it"
|
|
40722
40724
|
},
|
|
40723
40725
|
domain_dns_conflict: {
|
|
@@ -40729,7 +40731,7 @@ var PROBLEM_POLICY = {
|
|
|
40729
40731
|
domain_already_configured: {
|
|
40730
40732
|
status: 409,
|
|
40731
40733
|
retryable: false,
|
|
40732
|
-
action: "This project already has one Paid domain connection, for another hostname or one a different member configured. Read it with 'ohmyhost domain paid status --project ULID --json'. Delete it with 'ohmyhost domain paid delete --project ULID --hostname CURRENT_HOST --yes --json' only to replace it, then repeat this request with a new idempotency key. Repeating it unchanged cannot work.",
|
|
40734
|
+
action: "This project already has one Paid domain connection, for another hostname or one a different member configured. Read it with 'ohmyhost domain paid status --project ULID --json'. Delete it with 'ohmyhost domain paid delete --project ULID --hostname CURRENT_HOST --idempotency-key KEY --yes --json' only to replace it, then repeat this request with a new idempotency key. Repeating it unchanged cannot work.",
|
|
40733
40735
|
title: "Project already has a domain connection"
|
|
40734
40736
|
},
|
|
40735
40737
|
domain_deleting: {
|
|
@@ -40770,7 +40772,7 @@ var PROBLEM_POLICY = {
|
|
|
40770
40772
|
status: 409,
|
|
40771
40773
|
retryable: false,
|
|
40772
40774
|
title: "Remove the project domain first",
|
|
40773
|
-
action: "This project still has a live or pending custom-domain connection. Read 'ohmyhost domain paid status --project ULID --json', remove that connection with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then create a fresh project deletion plan. Repeating while it remains connected cannot work."
|
|
40775
|
+
action: "This project still has a live or pending custom-domain connection. Read 'ohmyhost domain paid status --project ULID --json', remove that connection with 'ohmyhost domain paid delete --project ULID --hostname HOST --idempotency-key KEY --yes --json', then create a fresh project deletion plan. Repeating while it remains connected cannot work."
|
|
40774
40776
|
},
|
|
40775
40777
|
native_domain_sync_pending: {
|
|
40776
40778
|
status: 409,
|
|
@@ -40881,7 +40883,7 @@ var parsePaidDomain = (value) => {
|
|
|
40881
40883
|
"validation_records"
|
|
40882
40884
|
]);
|
|
40883
40885
|
const status = input["status"];
|
|
40884
|
-
const
|
|
40886
|
+
const hostname2 = input["hostname"];
|
|
40885
40887
|
const records2 = input["validation_records"];
|
|
40886
40888
|
if (![
|
|
40887
40889
|
"not_configured",
|
|
@@ -40896,7 +40898,7 @@ var parsePaidDomain = (value) => {
|
|
|
40896
40898
|
"paid_plan_required",
|
|
40897
40899
|
"insufficient_organization_credits",
|
|
40898
40900
|
"project_budget_exceeded"
|
|
40899
|
-
].includes(input["suspension_reason"]) || status === "suspended" !== (input["suspension_reason"] !== null) || status === "suspended" && input["url"] !== null || input["environment"] !== "prod" || !isSaasCnameTarget(input["cname_target"]) ||
|
|
40901
|
+
].includes(input["suspension_reason"]) || status === "suspended" !== (input["suspension_reason"] !== null) || status === "suspended" && input["url"] !== null || input["environment"] !== "prod" || !isSaasCnameTarget(input["cname_target"]) || hostname2 !== null && !isPaidHostname(hostname2) || input["custom_hostname_status"] !== null && typeof input["custom_hostname_status"] !== "string" || input["ssl_status"] !== null && typeof input["ssl_status"] !== "string" || !Array.isArray(records2) || records2.length > 16 || !records2.every(isPaidValidationRecord) || input["url"] !== null && input["url"] !== `https://${String(hostname2)}` || status === "awaiting_deployment" && (hostname2 === null || input["custom_hostname_status"] !== null || input["ssl_status"] !== null || input["url"] !== null || records2.length !== 0)) {
|
|
40900
40902
|
throw new ResponseContractError();
|
|
40901
40903
|
}
|
|
40902
40904
|
return input;
|
|
@@ -41183,7 +41185,7 @@ var parseAccountProfile = (value) => {
|
|
|
41183
41185
|
]);
|
|
41184
41186
|
const organizations = input["organizations"];
|
|
41185
41187
|
const organizationIds = input["organization_ids"];
|
|
41186
|
-
if (!boundedString(input["user_id"], 1, 128) || !Array.isArray(organizations) || !Array.isArray(organizationIds) || organizationIds.some((organizationId) => !isUlid(organizationId)) || new Set(organizationIds).size !== organizationIds.length) {
|
|
41188
|
+
if (!boundedString(input["user_id"], 1, 128) || typeof input["email_verified"] !== "boolean" || !(input["signup_source"] === null || boundedString(input["signup_source"], 1, 64)) || !Array.isArray(organizations) || !Array.isArray(organizationIds) || organizationIds.some((organizationId) => !isUlid(organizationId)) || new Set(organizationIds).size !== organizationIds.length) {
|
|
41187
41189
|
throw new ResponseContractError();
|
|
41188
41190
|
}
|
|
41189
41191
|
const workspaces = organizations.map((organization) => {
|
|
@@ -41195,7 +41197,12 @@ var parseAccountProfile = (value) => {
|
|
|
41195
41197
|
});
|
|
41196
41198
|
if (new Set(workspaces.map((workspace) => workspace.id)).size !== organizationIds.length)
|
|
41197
41199
|
throw new ResponseContractError();
|
|
41198
|
-
return {
|
|
41200
|
+
return {
|
|
41201
|
+
userId: input["user_id"],
|
|
41202
|
+
emailVerified: input["email_verified"],
|
|
41203
|
+
signupSource: input["signup_source"],
|
|
41204
|
+
organizations: workspaces
|
|
41205
|
+
};
|
|
41199
41206
|
};
|
|
41200
41207
|
var parseProject = (value) => {
|
|
41201
41208
|
const input = exactRecord2(value, [
|
|
@@ -41860,10 +41867,10 @@ async function prepareLocalSourcePublication(input) {
|
|
|
41860
41867
|
if (original !== null && request.mode === "commit" && !input.explicitExpectedCommit)
|
|
41861
41868
|
request = { ...request, expected_commit_sha: original.request.expected_commit_sha };
|
|
41862
41869
|
else if (original === null && request.mode === "commit" && !input.explicitExpectedCommit) {
|
|
41863
|
-
const
|
|
41864
|
-
if (
|
|
41870
|
+
const link3 = (await readProjectLinks(scope.metadata_directory, scope.api_origin)).links.find((link4) => link4.organization_id === scope.organization_id && link4.project_id === scope.project_id);
|
|
41871
|
+
if (link3?.version !== 3 || link3.source.provider !== "managed" || link3.source.source_connection_id !== request.expected_source_connection_id || link3.source.source_generation !== request.expected_source_generation)
|
|
41865
41872
|
throw new LocalSourcePublicationError("source_binding_required");
|
|
41866
|
-
request = { ...request, expected_commit_sha:
|
|
41873
|
+
request = { ...request, expected_commit_sha: link3.source.last_confirmed_commit_sha };
|
|
41867
41874
|
}
|
|
41868
41875
|
parseManagedSourceRequest("upload", request);
|
|
41869
41876
|
const record9 = {
|
|
@@ -41970,7 +41977,7 @@ async function completeLocalSourcePublication(input) {
|
|
|
41970
41977
|
const snapshot = `sha256:${createHash3("sha256").update(JSON.stringify([...manifest2].sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0).map(({ path: path2, sha256: sha2562, executable }) => [path2, sha2562, executable]))).digest("hex")}`;
|
|
41971
41978
|
if (snapshot !== pending.snapshot_sha256)
|
|
41972
41979
|
throw new LocalSourcePublicationError("source_publication_scope_mismatch");
|
|
41973
|
-
const binding = (await readProjectLinks(scope.metadata_directory, scope.api_origin)).links.find((
|
|
41980
|
+
const binding = (await readProjectLinks(scope.metadata_directory, scope.api_origin)).links.find((link3) => link3.organization_id === scope.organization_id);
|
|
41974
41981
|
if (binding !== void 0 && binding.project_id !== scope.project_id)
|
|
41975
41982
|
throw new LocalSourcePublicationError("source_publication_scope_mismatch");
|
|
41976
41983
|
if (replay) {
|
|
@@ -42163,9 +42170,456 @@ function existing(error) {
|
|
|
42163
42170
|
return typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST";
|
|
42164
42171
|
}
|
|
42165
42172
|
|
|
42173
|
+
// apps/product-cli/dist/credential-refresh.js
|
|
42174
|
+
var LoginGoneError = class extends Error {
|
|
42175
|
+
constructor() {
|
|
42176
|
+
super("The saved login has no credential any more");
|
|
42177
|
+
this.name = "LoginGoneError";
|
|
42178
|
+
}
|
|
42179
|
+
};
|
|
42180
|
+
var DIRECT_OWNERSHIP = {
|
|
42181
|
+
owning: (_logins, operation) => operation()
|
|
42182
|
+
};
|
|
42183
|
+
var renewLogin = async (input) => await input.registry.owning([input.login], async () => {
|
|
42184
|
+
const current = input.current ?? await input.store.read();
|
|
42185
|
+
if (current === void 0)
|
|
42186
|
+
throw new LoginGoneError();
|
|
42187
|
+
if (input.usable(current))
|
|
42188
|
+
return { credential: current, refreshed: false };
|
|
42189
|
+
let renewed;
|
|
42190
|
+
try {
|
|
42191
|
+
renewed = await input.renew(current);
|
|
42192
|
+
} catch (error) {
|
|
42193
|
+
if (input.rejected(error))
|
|
42194
|
+
await input.forget();
|
|
42195
|
+
throw error;
|
|
42196
|
+
}
|
|
42197
|
+
await input.store.replace(renewed);
|
|
42198
|
+
return { credential: renewed, refreshed: true };
|
|
42199
|
+
}, input.signal);
|
|
42200
|
+
|
|
42201
|
+
// apps/product-cli/dist/login-ownership.js
|
|
42202
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
42203
|
+
import { link, open, readFile as readFile2, readdir as readdir2, readlink, unlink as unlink2 } from "node:fs/promises";
|
|
42204
|
+
import { hostname } from "node:os";
|
|
42205
|
+
import { join as join4 } from "node:path";
|
|
42206
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
42207
|
+
var LoginOwnershipTimeoutError = class extends Error {
|
|
42208
|
+
record;
|
|
42209
|
+
constructor(record9) {
|
|
42210
|
+
super("The login is held by another process");
|
|
42211
|
+
this.record = record9;
|
|
42212
|
+
this.name = "LoginOwnershipTimeoutError";
|
|
42213
|
+
}
|
|
42214
|
+
};
|
|
42215
|
+
var quietly = async (operation) => {
|
|
42216
|
+
try {
|
|
42217
|
+
await operation;
|
|
42218
|
+
} catch {
|
|
42219
|
+
}
|
|
42220
|
+
};
|
|
42221
|
+
var attempt = async (operation) => {
|
|
42222
|
+
try {
|
|
42223
|
+
return await operation;
|
|
42224
|
+
} catch {
|
|
42225
|
+
return void 0;
|
|
42226
|
+
}
|
|
42227
|
+
};
|
|
42228
|
+
var RECORD = /^owner-([1-9][0-9]{0,14})\.json$/u;
|
|
42229
|
+
var RELEASED = /^owner-([1-9][0-9]{0,14})\.released$/u;
|
|
42230
|
+
var DEFAULT_POLL_MS = 100;
|
|
42231
|
+
var recordName = (number) => `owner-${String(number)}.json`;
|
|
42232
|
+
var releasedName = (number) => `owner-${String(number)}.released`;
|
|
42233
|
+
var linuxStartTime = async (pid) => {
|
|
42234
|
+
let stat3;
|
|
42235
|
+
try {
|
|
42236
|
+
stat3 = await readFile2(`/proc/${String(pid)}/stat`, "utf8");
|
|
42237
|
+
} catch (error) {
|
|
42238
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ESRCH")
|
|
42239
|
+
return void 0;
|
|
42240
|
+
throw error;
|
|
42241
|
+
}
|
|
42242
|
+
const fields = stat3.slice(stat3.lastIndexOf(")") + 2).split(" ");
|
|
42243
|
+
const start = fields[19];
|
|
42244
|
+
if (start === void 0 || !/^[0-9]+$/u.test(start))
|
|
42245
|
+
throw new Error("Unreadable process stat");
|
|
42246
|
+
return start;
|
|
42247
|
+
};
|
|
42248
|
+
var linuxProcessProbe = () => {
|
|
42249
|
+
const self = async () => {
|
|
42250
|
+
const namespace = await attempt(readlink("/proc/self/ns/pid"));
|
|
42251
|
+
const start = await attempt(linuxStartTime(process.pid));
|
|
42252
|
+
return { host: hostname(), namespace, pid: process.pid, start };
|
|
42253
|
+
};
|
|
42254
|
+
return {
|
|
42255
|
+
self,
|
|
42256
|
+
state: async (owner) => {
|
|
42257
|
+
const own = await self();
|
|
42258
|
+
if (owner.host !== own.host || owner.namespace === void 0 || owner.namespace !== own.namespace || owner.start === void 0)
|
|
42259
|
+
return "unknown";
|
|
42260
|
+
try {
|
|
42261
|
+
const start = await linuxStartTime(owner.pid);
|
|
42262
|
+
return start === owner.start ? "alive" : "gone";
|
|
42263
|
+
} catch {
|
|
42264
|
+
return "unknown";
|
|
42265
|
+
}
|
|
42266
|
+
}
|
|
42267
|
+
};
|
|
42268
|
+
};
|
|
42269
|
+
var LoginOwnership = class {
|
|
42270
|
+
directory;
|
|
42271
|
+
#probe;
|
|
42272
|
+
#waitMs;
|
|
42273
|
+
#pollMs;
|
|
42274
|
+
constructor(directory, options) {
|
|
42275
|
+
this.directory = directory;
|
|
42276
|
+
this.#probe = options.probe ?? linuxProcessProbe();
|
|
42277
|
+
this.#waitMs = options.waitMs;
|
|
42278
|
+
this.#pollMs = options.pollMs ?? DEFAULT_POLL_MS;
|
|
42279
|
+
}
|
|
42280
|
+
async acquire(signal) {
|
|
42281
|
+
const self = await this.#probe.self();
|
|
42282
|
+
const deadline = Date.now() + this.#waitMs;
|
|
42283
|
+
for (; ; ) {
|
|
42284
|
+
signal?.throwIfAborted();
|
|
42285
|
+
const newest = await this.#newest();
|
|
42286
|
+
if (newest > 0) {
|
|
42287
|
+
const state = await this.#state(newest);
|
|
42288
|
+
if (state === "missing" && await this.#listed(newest)) {
|
|
42289
|
+
if (Date.now() >= deadline)
|
|
42290
|
+
throw new LoginOwnershipTimeoutError(recordName(newest));
|
|
42291
|
+
await sleep(this.#pollMs);
|
|
42292
|
+
continue;
|
|
42293
|
+
}
|
|
42294
|
+
if (state === "missing")
|
|
42295
|
+
continue;
|
|
42296
|
+
if (state !== "released" && state !== "gone") {
|
|
42297
|
+
if (Date.now() >= deadline)
|
|
42298
|
+
throw new LoginOwnershipTimeoutError(recordName(newest));
|
|
42299
|
+
await sleep(this.#pollMs);
|
|
42300
|
+
continue;
|
|
42301
|
+
}
|
|
42302
|
+
}
|
|
42303
|
+
const candidate = newest + 1;
|
|
42304
|
+
if (await this.#claim(candidate, self)) {
|
|
42305
|
+
await this.#prune(candidate);
|
|
42306
|
+
return { record: recordName(candidate), release: () => this.#release(candidate) };
|
|
42307
|
+
}
|
|
42308
|
+
if (Date.now() >= deadline)
|
|
42309
|
+
throw new LoginOwnershipTimeoutError(recordName(candidate));
|
|
42310
|
+
}
|
|
42311
|
+
}
|
|
42312
|
+
/** Whether the current record is released, held by a gone process, or still held. */
|
|
42313
|
+
async #state(number) {
|
|
42314
|
+
let serialized;
|
|
42315
|
+
try {
|
|
42316
|
+
serialized = await readFile2(join4(this.directory, recordName(number)), "utf8");
|
|
42317
|
+
} catch (error) {
|
|
42318
|
+
return errorCode(error) === "ENOENT" ? "missing" : "unknown";
|
|
42319
|
+
}
|
|
42320
|
+
const owner = parseOwner(serialized);
|
|
42321
|
+
if (owner === void 0)
|
|
42322
|
+
return "unknown";
|
|
42323
|
+
try {
|
|
42324
|
+
await readFile2(join4(this.directory, releasedName(number)));
|
|
42325
|
+
return "released";
|
|
42326
|
+
} catch (error) {
|
|
42327
|
+
if (errorCode(error) !== "ENOENT")
|
|
42328
|
+
return "unknown";
|
|
42329
|
+
}
|
|
42330
|
+
return await this.#probe.state(owner);
|
|
42331
|
+
}
|
|
42332
|
+
/** Links the next number; losing the race, or finding a newer record, means nothing was taken. */
|
|
42333
|
+
async #claim(number, self) {
|
|
42334
|
+
const temporary = join4(this.directory, `.owner-${randomUUID2()}.tmp`);
|
|
42335
|
+
const target = join4(this.directory, recordName(number));
|
|
42336
|
+
try {
|
|
42337
|
+
const handle = await open(temporary, "wx", 384);
|
|
42338
|
+
try {
|
|
42339
|
+
await handle.writeFile(JSON.stringify({ version: 1, number, ...self }), "utf8");
|
|
42340
|
+
await handle.sync();
|
|
42341
|
+
} finally {
|
|
42342
|
+
await handle.close();
|
|
42343
|
+
}
|
|
42344
|
+
await link(temporary, target);
|
|
42345
|
+
} catch (error) {
|
|
42346
|
+
if (errorCode(error) === "EEXIST")
|
|
42347
|
+
return false;
|
|
42348
|
+
throw error;
|
|
42349
|
+
} finally {
|
|
42350
|
+
await quietly(unlink2(temporary));
|
|
42351
|
+
}
|
|
42352
|
+
if (await this.#newest() === number)
|
|
42353
|
+
return true;
|
|
42354
|
+
await quietly(unlink2(target));
|
|
42355
|
+
return false;
|
|
42356
|
+
}
|
|
42357
|
+
/** The owner of the highest number removes the lower ones; a failure leaves harmless leftovers. */
|
|
42358
|
+
async #prune(current) {
|
|
42359
|
+
let names;
|
|
42360
|
+
try {
|
|
42361
|
+
names = await readdir2(this.directory);
|
|
42362
|
+
} catch {
|
|
42363
|
+
return;
|
|
42364
|
+
}
|
|
42365
|
+
for (const name of names) {
|
|
42366
|
+
const number = Number((RECORD.exec(name) ?? RELEASED.exec(name))?.[1] ?? 0);
|
|
42367
|
+
if (number === 0 || number >= current)
|
|
42368
|
+
continue;
|
|
42369
|
+
await quietly(unlink2(join4(this.directory, name)));
|
|
42370
|
+
}
|
|
42371
|
+
}
|
|
42372
|
+
/** Whether the record's file is still listed although it could not be read. */
|
|
42373
|
+
async #listed(number) {
|
|
42374
|
+
try {
|
|
42375
|
+
return (await readdir2(this.directory)).includes(recordName(number));
|
|
42376
|
+
} catch {
|
|
42377
|
+
return false;
|
|
42378
|
+
}
|
|
42379
|
+
}
|
|
42380
|
+
async #release(number) {
|
|
42381
|
+
for (let attempt2 = 0; attempt2 < 3; attempt2 += 1) {
|
|
42382
|
+
try {
|
|
42383
|
+
const handle = await open(join4(this.directory, releasedName(number)), "wx", 384);
|
|
42384
|
+
await handle.close();
|
|
42385
|
+
return;
|
|
42386
|
+
} catch (error) {
|
|
42387
|
+
if (errorCode(error) === "EEXIST")
|
|
42388
|
+
return;
|
|
42389
|
+
await sleep(this.#pollMs);
|
|
42390
|
+
}
|
|
42391
|
+
}
|
|
42392
|
+
}
|
|
42393
|
+
async #newest() {
|
|
42394
|
+
let names;
|
|
42395
|
+
try {
|
|
42396
|
+
names = await readdir2(this.directory);
|
|
42397
|
+
} catch {
|
|
42398
|
+
return 0;
|
|
42399
|
+
}
|
|
42400
|
+
return names.reduce((newest, name) => Math.max(newest, Number(RECORD.exec(name)?.[1] ?? 0)), 0);
|
|
42401
|
+
}
|
|
42402
|
+
};
|
|
42403
|
+
var parseOwner = (serialized) => {
|
|
42404
|
+
try {
|
|
42405
|
+
const value = JSON.parse(serialized);
|
|
42406
|
+
if (typeof value !== "object" || value === null || !("host" in value) || !("pid" in value) || typeof value.host !== "string" || typeof value.pid !== "number")
|
|
42407
|
+
return void 0;
|
|
42408
|
+
const namespace = "namespace" in value ? value.namespace : void 0;
|
|
42409
|
+
const start = "start" in value ? value.start : void 0;
|
|
42410
|
+
return {
|
|
42411
|
+
host: value.host,
|
|
42412
|
+
namespace: typeof namespace === "string" ? namespace : void 0,
|
|
42413
|
+
pid: value.pid,
|
|
42414
|
+
start: typeof start === "string" ? start : void 0
|
|
42415
|
+
};
|
|
42416
|
+
} catch {
|
|
42417
|
+
return void 0;
|
|
42418
|
+
}
|
|
42419
|
+
};
|
|
42420
|
+
var errorCode = (error) => typeof error === "object" && error !== null && "code" in error ? String(error.code) : void 0;
|
|
42421
|
+
|
|
42422
|
+
// apps/product-cli/dist/file-credential-store.js
|
|
42423
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
42424
|
+
import { chmod as chmod2, constants as constants3, lstat, mkdir as mkdir2, open as open2, readdir as readdir3, rename as rename2, unlink as unlink3 } from "node:fs/promises";
|
|
42425
|
+
import { dirname as dirname2, join as join5, relative as relative2, sep as sep2 } from "node:path";
|
|
42426
|
+
var DIRECTORY_MODE = 448;
|
|
42427
|
+
var FILE_MODE = 384;
|
|
42428
|
+
var ARTIFACT = /^(?:credentials\.json|\.credentials(?:\..+)?\.next)$/u;
|
|
42429
|
+
var FileCredentialStoreRefusedError = class extends CredentialStoreUnavailableError {
|
|
42430
|
+
path;
|
|
42431
|
+
reason;
|
|
42432
|
+
constructor(path2, reason) {
|
|
42433
|
+
super();
|
|
42434
|
+
this.path = path2;
|
|
42435
|
+
this.reason = reason;
|
|
42436
|
+
this.name = "FileCredentialStoreRefusedError";
|
|
42437
|
+
}
|
|
42438
|
+
};
|
|
42439
|
+
var OwnerOnlyFileCredentialStore = class {
|
|
42440
|
+
directory;
|
|
42441
|
+
ownerId;
|
|
42442
|
+
#credentialPath;
|
|
42443
|
+
#ancestors;
|
|
42444
|
+
#owned;
|
|
42445
|
+
#home;
|
|
42446
|
+
constructor(directory, ownerId, location = {}) {
|
|
42447
|
+
this.directory = directory;
|
|
42448
|
+
this.ownerId = ownerId;
|
|
42449
|
+
this.#credentialPath = join5(directory, "credentials.json");
|
|
42450
|
+
this.#ancestors = location.ancestors ?? [];
|
|
42451
|
+
this.#home = location.home;
|
|
42452
|
+
const root = location.root ?? directory;
|
|
42453
|
+
const below = relative2(root, directory).split(sep2).filter(Boolean);
|
|
42454
|
+
this.#owned = below.reduce((paths, segment) => [...paths, join5(paths.at(-1) ?? root, segment)], [root]);
|
|
42455
|
+
}
|
|
42456
|
+
/** Creates the store's directories with their exact modes; refuses any that already differ. */
|
|
42457
|
+
async prepare() {
|
|
42458
|
+
try {
|
|
42459
|
+
await this.checkDirectories(true);
|
|
42460
|
+
} catch (error) {
|
|
42461
|
+
throw this.refused(error);
|
|
42462
|
+
}
|
|
42463
|
+
}
|
|
42464
|
+
async read() {
|
|
42465
|
+
try {
|
|
42466
|
+
if (!await this.checkDirectories(false))
|
|
42467
|
+
return void 0;
|
|
42468
|
+
if (!await this.validateFile())
|
|
42469
|
+
return void 0;
|
|
42470
|
+
const handle = await open2(this.#credentialPath, constants3.O_RDONLY | constants3.O_NOFOLLOW);
|
|
42471
|
+
try {
|
|
42472
|
+
const status = await handle.stat();
|
|
42473
|
+
this.assertOwnedStatus(this.#credentialPath, status, FILE_MODE, false);
|
|
42474
|
+
return parseCredential(await handle.readFile("utf8"));
|
|
42475
|
+
} finally {
|
|
42476
|
+
await handle.close();
|
|
42477
|
+
}
|
|
42478
|
+
} catch (error) {
|
|
42479
|
+
throw this.refused(error);
|
|
42480
|
+
}
|
|
42481
|
+
}
|
|
42482
|
+
async replace(credential) {
|
|
42483
|
+
const temporaryPath = join5(this.directory, `.credentials.${randomUUID3()}.next`);
|
|
42484
|
+
try {
|
|
42485
|
+
await this.checkDirectories(true);
|
|
42486
|
+
await this.validateFile();
|
|
42487
|
+
const handle = await open2(temporaryPath, constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW, FILE_MODE);
|
|
42488
|
+
try {
|
|
42489
|
+
await handle.writeFile(serializeCredential(credential), "utf8");
|
|
42490
|
+
await handle.sync();
|
|
42491
|
+
} finally {
|
|
42492
|
+
await handle.close();
|
|
42493
|
+
}
|
|
42494
|
+
await this.validateOwnedPath(temporaryPath, FILE_MODE, false);
|
|
42495
|
+
await rename2(temporaryPath, this.#credentialPath);
|
|
42496
|
+
await this.syncDirectory();
|
|
42497
|
+
await this.validateOwnedPath(this.#credentialPath, FILE_MODE, false);
|
|
42498
|
+
} catch (error) {
|
|
42499
|
+
await quietly(unlink3(temporaryPath));
|
|
42500
|
+
throw this.refused(error);
|
|
42501
|
+
}
|
|
42502
|
+
}
|
|
42503
|
+
async clear() {
|
|
42504
|
+
try {
|
|
42505
|
+
if (!await this.checkDirectories(false))
|
|
42506
|
+
return;
|
|
42507
|
+
let failed = false;
|
|
42508
|
+
for (const name of await readdir3(this.directory)) {
|
|
42509
|
+
if (!ARTIFACT.test(name))
|
|
42510
|
+
continue;
|
|
42511
|
+
try {
|
|
42512
|
+
await unlink3(join5(this.directory, name));
|
|
42513
|
+
} catch (error) {
|
|
42514
|
+
if (!isMissing(error))
|
|
42515
|
+
failed = true;
|
|
42516
|
+
}
|
|
42517
|
+
}
|
|
42518
|
+
try {
|
|
42519
|
+
await this.syncDirectory();
|
|
42520
|
+
} catch {
|
|
42521
|
+
failed = true;
|
|
42522
|
+
}
|
|
42523
|
+
if ((await readdir3(this.directory)).some((name) => ARTIFACT.test(name)))
|
|
42524
|
+
failed = true;
|
|
42525
|
+
if (failed)
|
|
42526
|
+
throw new Error("Credential artifact cleanup failed");
|
|
42527
|
+
} catch (error) {
|
|
42528
|
+
throw this.refused(error);
|
|
42529
|
+
}
|
|
42530
|
+
}
|
|
42531
|
+
/** `false` when a directory is missing and none may be created. */
|
|
42532
|
+
async checkDirectories(create) {
|
|
42533
|
+
for (const path2 of this.#ancestors) {
|
|
42534
|
+
const status = await this.statDirectory(path2, create);
|
|
42535
|
+
if (status === void 0)
|
|
42536
|
+
return false;
|
|
42537
|
+
if (status.isSymbolicLink())
|
|
42538
|
+
throw this.refusal(path2, "symbolic_link");
|
|
42539
|
+
if (!status.isDirectory())
|
|
42540
|
+
throw this.refusal(path2, "wrong_mode");
|
|
42541
|
+
if (status.uid !== this.ownerId)
|
|
42542
|
+
throw this.refusal(path2, "another_owner");
|
|
42543
|
+
if ((status.mode & 18) !== 0)
|
|
42544
|
+
throw this.refusal(path2, "wrong_mode");
|
|
42545
|
+
}
|
|
42546
|
+
for (const path2 of this.#owned) {
|
|
42547
|
+
const status = await this.statDirectory(path2, create, true);
|
|
42548
|
+
if (status === void 0)
|
|
42549
|
+
return false;
|
|
42550
|
+
this.assertOwnedStatus(path2, status, DIRECTORY_MODE, true);
|
|
42551
|
+
}
|
|
42552
|
+
return true;
|
|
42553
|
+
}
|
|
42554
|
+
async statDirectory(path2, create, exact7 = false) {
|
|
42555
|
+
try {
|
|
42556
|
+
return await lstat(path2);
|
|
42557
|
+
} catch (error) {
|
|
42558
|
+
if (!isMissing(error))
|
|
42559
|
+
throw error;
|
|
42560
|
+
if (!create)
|
|
42561
|
+
return void 0;
|
|
42562
|
+
}
|
|
42563
|
+
try {
|
|
42564
|
+
await mkdir2(path2, { mode: DIRECTORY_MODE });
|
|
42565
|
+
if (exact7)
|
|
42566
|
+
await chmod2(path2, DIRECTORY_MODE);
|
|
42567
|
+
} catch (error) {
|
|
42568
|
+
if (errorCode2(error) !== "EEXIST")
|
|
42569
|
+
throw error;
|
|
42570
|
+
}
|
|
42571
|
+
return await lstat(path2);
|
|
42572
|
+
}
|
|
42573
|
+
async validateFile() {
|
|
42574
|
+
try {
|
|
42575
|
+
await this.validateOwnedPath(this.#credentialPath, FILE_MODE, false);
|
|
42576
|
+
return true;
|
|
42577
|
+
} catch (error) {
|
|
42578
|
+
if (isMissing(error))
|
|
42579
|
+
return false;
|
|
42580
|
+
throw error;
|
|
42581
|
+
}
|
|
42582
|
+
}
|
|
42583
|
+
async validateOwnedPath(path2, mode, directory) {
|
|
42584
|
+
this.assertOwnedStatus(path2, await lstat(path2), mode, directory);
|
|
42585
|
+
}
|
|
42586
|
+
assertOwnedStatus(path2, status, mode, directory) {
|
|
42587
|
+
if (status.isSymbolicLink())
|
|
42588
|
+
throw this.refusal(path2, "symbolic_link");
|
|
42589
|
+
if (directory ? !status.isDirectory() : !status.isFile())
|
|
42590
|
+
throw this.refusal(path2, "wrong_mode");
|
|
42591
|
+
if (status.uid !== this.ownerId)
|
|
42592
|
+
throw this.refusal(path2, "another_owner");
|
|
42593
|
+
if ((Number(status.mode) & 511) !== mode)
|
|
42594
|
+
throw this.refusal(path2, "wrong_mode");
|
|
42595
|
+
}
|
|
42596
|
+
refusal(path2, reason) {
|
|
42597
|
+
return new FileCredentialStoreRefusedError(this.#home === void 0 ? path2 : relative2(this.#home, path2), reason);
|
|
42598
|
+
}
|
|
42599
|
+
/** A refusal keeps its path and reason; a denied write names the directory it could not use. */
|
|
42600
|
+
refused(error) {
|
|
42601
|
+
if (error instanceof CredentialStoreUnavailableError)
|
|
42602
|
+
return error;
|
|
42603
|
+
const code = errorCode2(error);
|
|
42604
|
+
if (code === "EACCES" || code === "EPERM" || code === "EROFS")
|
|
42605
|
+
return this.refusal(this.directory, "not_writable");
|
|
42606
|
+
return new CredentialStoreUnavailableError();
|
|
42607
|
+
}
|
|
42608
|
+
async syncDirectory() {
|
|
42609
|
+
const handle = await open2(dirname2(this.#credentialPath), constants3.O_RDONLY);
|
|
42610
|
+
try {
|
|
42611
|
+
await handle.sync();
|
|
42612
|
+
} finally {
|
|
42613
|
+
await handle.close();
|
|
42614
|
+
}
|
|
42615
|
+
}
|
|
42616
|
+
};
|
|
42617
|
+
var errorCode2 = (error) => typeof error === "object" && error !== null && "code" in error ? String(error.code) : void 0;
|
|
42618
|
+
var isMissing = (error) => errorCode2(error) === "ENOENT";
|
|
42619
|
+
|
|
42166
42620
|
// apps/product-cli/dist/user-token-file.js
|
|
42167
|
-
import { constants as
|
|
42168
|
-
import { basename, dirname as
|
|
42621
|
+
import { constants as constants4, lstat as lstat2, mkdir as mkdir3, open as open3, realpath } from "node:fs/promises";
|
|
42622
|
+
import { basename, dirname as dirname3, resolve as resolve3 } from "node:path";
|
|
42169
42623
|
import { execFile } from "node:child_process";
|
|
42170
42624
|
import { parseEnv, promisify } from "node:util";
|
|
42171
42625
|
|
|
@@ -42224,7 +42678,7 @@ async function preparePrivateSecretFile(output) {
|
|
|
42224
42678
|
let file;
|
|
42225
42679
|
try {
|
|
42226
42680
|
await requireIgnoredTokenFile(path2);
|
|
42227
|
-
file = await
|
|
42681
|
+
file = await open3(path2, constants4.O_RDWR | constants4.O_CREAT | constants4.O_EXCL | (constants4.O_NOFOLLOW ?? 0), 384);
|
|
42228
42682
|
const handle = file;
|
|
42229
42683
|
await secureTokenFile(path2, handle);
|
|
42230
42684
|
const identity = await handle.stat();
|
|
@@ -42236,12 +42690,12 @@ async function preparePrivateSecretFile(output) {
|
|
|
42236
42690
|
try {
|
|
42237
42691
|
if (!/^[\x21-\x7e]{16,512}$/u.test(value))
|
|
42238
42692
|
throw new PrivateSecretFileError();
|
|
42239
|
-
const current = await
|
|
42693
|
+
const current = await lstat2(path2), before = await handle.stat();
|
|
42240
42694
|
if (!current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || current.ino !== identity.ino || current.dev !== identity.dev || before.size !== 0)
|
|
42241
42695
|
throw new PrivateSecretFileError();
|
|
42242
42696
|
await handle.writeFile(value, "utf8");
|
|
42243
42697
|
await handle.sync();
|
|
42244
|
-
const after = await
|
|
42698
|
+
const after = await lstat2(path2), stored = Buffer.alloc(Buffer.byteLength(value));
|
|
42245
42699
|
try {
|
|
42246
42700
|
const read = await handle.read(stored, 0, stored.length, 0);
|
|
42247
42701
|
if (!after.isFile() || after.isSymbolicLink() || after.nlink !== 1 || after.ino !== identity.ino || after.dev !== identity.dev || after.size !== stored.length || read.bytesRead !== stored.length || stored.toString("utf8") !== value)
|
|
@@ -42280,16 +42734,16 @@ async function prepareUserTokenFile(output) {
|
|
|
42280
42734
|
throw new UserTokenFileError("token_file_unsafe");
|
|
42281
42735
|
let file;
|
|
42282
42736
|
try {
|
|
42283
|
-
await
|
|
42737
|
+
await mkdir3(dirname3(path2), { recursive: true, mode: 448 });
|
|
42284
42738
|
await requireIgnoredTokenFile(path2);
|
|
42285
|
-
const existing2 = await
|
|
42739
|
+
const existing2 = await lstat2(path2).catch((error) => {
|
|
42286
42740
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
42287
42741
|
return null;
|
|
42288
42742
|
throw error;
|
|
42289
42743
|
});
|
|
42290
42744
|
if (existing2 && (!existing2.isFile() || existing2.isSymbolicLink() || existing2.nlink !== 1))
|
|
42291
42745
|
throw new UserTokenFileError("token_file_unsafe");
|
|
42292
|
-
file = await
|
|
42746
|
+
file = await open3(path2, constants4.O_RDWR | constants4.O_APPEND | (constants4.O_NOFOLLOW ?? 0) | (existing2 ? 0 : constants4.O_CREAT | constants4.O_EXCL), 384);
|
|
42293
42747
|
const handle = file;
|
|
42294
42748
|
await secureTokenFile(path2, handle);
|
|
42295
42749
|
const initial = await tokenFileText(handle);
|
|
@@ -42307,7 +42761,7 @@ OHMYHOST_TOKEN=${preview}
|
|
|
42307
42761
|
if (result.value === null)
|
|
42308
42762
|
throw new UserTokenFileError("token_value_unavailable", result.key.id);
|
|
42309
42763
|
try {
|
|
42310
|
-
const current = await
|
|
42764
|
+
const current = await lstat2(path2);
|
|
42311
42765
|
if (!current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || current.ino !== identity.ino || current.dev !== identity.dev || await tokenFileText(handle) !== initial)
|
|
42312
42766
|
throw new UserTokenFileError("token_file_changed");
|
|
42313
42767
|
await handle.appendFile(`
|
|
@@ -42316,7 +42770,7 @@ OHMYHOST_TOKEN=${result.value}
|
|
|
42316
42770
|
await handle.sync();
|
|
42317
42771
|
if (parseEnv(await tokenFileText(handle))["OHMYHOST_TOKEN"] !== result.value)
|
|
42318
42772
|
throw new UserTokenFileError("token_file_changed");
|
|
42319
|
-
const saved = await
|
|
42773
|
+
const saved = await lstat2(path2);
|
|
42320
42774
|
if (!saved.isFile() || saved.isSymbolicLink() || saved.ino !== identity.ino || saved.dev !== identity.dev)
|
|
42321
42775
|
throw new UserTokenFileError("token_file_changed");
|
|
42322
42776
|
} catch {
|
|
@@ -42388,15 +42842,15 @@ async function secureTokenFile(path2, file) {
|
|
|
42388
42842
|
if (((await file.stat()).mode & 511) !== 384)
|
|
42389
42843
|
throw new UserTokenFileError("token_file_unsafe");
|
|
42390
42844
|
}
|
|
42391
|
-
const observed = await
|
|
42845
|
+
const observed = await lstat2(path2);
|
|
42392
42846
|
if (observed.isSymbolicLink() || observed.ino !== status.ino || observed.dev !== status.dev)
|
|
42393
42847
|
throw new UserTokenFileError("token_file_unsafe");
|
|
42394
42848
|
}
|
|
42395
42849
|
async function requireIgnoredTokenFile(path2) {
|
|
42396
|
-
const parent = await realpath(
|
|
42850
|
+
const parent = await realpath(dirname3(path2));
|
|
42397
42851
|
let directory = parent;
|
|
42398
42852
|
while (true) {
|
|
42399
|
-
const marker = await
|
|
42853
|
+
const marker = await lstat2(resolve3(directory, ".git")).catch((error) => {
|
|
42400
42854
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
42401
42855
|
return null;
|
|
42402
42856
|
throw error;
|
|
@@ -42424,7 +42878,7 @@ async function requireIgnoredTokenFile(path2) {
|
|
|
42424
42878
|
}
|
|
42425
42879
|
return;
|
|
42426
42880
|
}
|
|
42427
|
-
const next =
|
|
42881
|
+
const next = dirname3(directory);
|
|
42428
42882
|
if (next === directory)
|
|
42429
42883
|
return;
|
|
42430
42884
|
directory = next;
|
|
@@ -42432,10 +42886,11 @@ async function requireIgnoredTokenFile(path2) {
|
|
|
42432
42886
|
}
|
|
42433
42887
|
|
|
42434
42888
|
// apps/product-cli/dist/profile-store.js
|
|
42435
|
-
import {
|
|
42436
|
-
import {
|
|
42889
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
42890
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
42891
|
+
import { link as link2, mkdir as mkdir4, open as open4, readFile as readFile3, readdir as readdir4, rmdir, unlink as unlink4 } from "node:fs/promises";
|
|
42437
42892
|
import { homedir } from "node:os";
|
|
42438
|
-
import { join as
|
|
42893
|
+
import { join as join6, relative as relative3, sep as sep3 } from "node:path";
|
|
42439
42894
|
var ProfileNameConflictError = class extends Error {
|
|
42440
42895
|
profile;
|
|
42441
42896
|
constructor(profile) {
|
|
@@ -42452,6 +42907,11 @@ var ProfileLimitError = class extends Error {
|
|
|
42452
42907
|
this.name = "ProfileLimitError";
|
|
42453
42908
|
}
|
|
42454
42909
|
};
|
|
42910
|
+
var PROBE_CREDENTIAL = () => ({
|
|
42911
|
+
accessToken: "probe",
|
|
42912
|
+
refreshToken: "probe",
|
|
42913
|
+
expiresAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
42914
|
+
});
|
|
42455
42915
|
var MAX_PROFILES = 64;
|
|
42456
42916
|
var MAX_INDEX_ATTEMPTS = 64;
|
|
42457
42917
|
var INDEX_FILE = /^index-([1-9][0-9]{0,14})\.json$/u;
|
|
@@ -42463,7 +42923,7 @@ var isProfileName = (value) => PROFILE_NAME.test(value);
|
|
|
42463
42923
|
var isProfileUserId = (value) => USER_ID.test(value);
|
|
42464
42924
|
var profileAccount = (profile) => `profile:${profile.userId}:${profile.organizationId ?? "none"}`;
|
|
42465
42925
|
var sameLogin = (left, right) => profileAccount(left) === profileAccount(right);
|
|
42466
|
-
var profileIndexDirectory = (serviceName) =>
|
|
42926
|
+
var profileIndexDirectory = (serviceName) => join6(homedir(), ".ohmyhost", "profiles", serviceName);
|
|
42467
42927
|
var nextProfileIndex = (current, profile, replaces) => [
|
|
42468
42928
|
...current.filter((saved) => !sameLogin(saved, profile) && (replaces === void 0 || !sameLogin(saved, replaces))),
|
|
42469
42929
|
profile
|
|
@@ -42475,19 +42935,56 @@ var admitProfile = (next, profile) => {
|
|
|
42475
42935
|
if (next.length > MAX_PROFILES)
|
|
42476
42936
|
throw new ProfileLimitError(next.length - 1);
|
|
42477
42937
|
};
|
|
42478
|
-
var
|
|
42938
|
+
var IndexedProfileRegistry = class {
|
|
42939
|
+
#index;
|
|
42940
|
+
constructor(indexDirectory) {
|
|
42941
|
+
this.#index = new ProfileIndexFiles(indexDirectory);
|
|
42942
|
+
}
|
|
42943
|
+
async prove() {
|
|
42944
|
+
await this.#index.probe();
|
|
42945
|
+
await this.proveCredential();
|
|
42946
|
+
}
|
|
42947
|
+
async list() {
|
|
42948
|
+
return (await this.#index.read()).profiles;
|
|
42949
|
+
}
|
|
42950
|
+
async save(profile, credential, replaces) {
|
|
42951
|
+
assertProfile(profile);
|
|
42952
|
+
await this.owning(replaces === void 0 ? [profile] : [profile, replaces], async () => {
|
|
42953
|
+
const before = await this.list();
|
|
42954
|
+
admitProfile(nextProfileIndex(before, profile, replaces), profile);
|
|
42955
|
+
await this.credential(profile).replace(credential);
|
|
42956
|
+
try {
|
|
42957
|
+
await this.#index.update((current) => {
|
|
42958
|
+
const next = nextProfileIndex(current, profile, replaces);
|
|
42959
|
+
admitProfile(next, profile);
|
|
42960
|
+
return next;
|
|
42961
|
+
});
|
|
42962
|
+
} catch (error) {
|
|
42963
|
+
if (!before.some((saved) => sameLogin(saved, profile)))
|
|
42964
|
+
await this.credential(profile).clear();
|
|
42965
|
+
throw error;
|
|
42966
|
+
}
|
|
42967
|
+
if (replaces !== void 0 && !sameLogin(replaces, profile))
|
|
42968
|
+
await this.credential(replaces).clear();
|
|
42969
|
+
});
|
|
42970
|
+
}
|
|
42971
|
+
async remove(profile) {
|
|
42972
|
+
await this.owning([profile], async () => {
|
|
42973
|
+
await this.credential(profile).clear();
|
|
42974
|
+
await this.#index.update((current) => current.some((saved) => sameLogin(saved, profile)) ? current.filter((saved) => !sameLogin(saved, profile)) : void 0);
|
|
42975
|
+
});
|
|
42976
|
+
}
|
|
42977
|
+
};
|
|
42978
|
+
var NativeKeyringProfileRegistry = class extends IndexedProfileRegistry {
|
|
42479
42979
|
serviceName;
|
|
42980
|
+
kind = "native";
|
|
42480
42981
|
#createEntry;
|
|
42481
|
-
#index;
|
|
42482
42982
|
constructor(createEntry = void 0, serviceName = "ohmyhost", indexDirectory) {
|
|
42483
|
-
this.serviceName = serviceName;
|
|
42484
42983
|
if (!SERVICE_NAME.test(serviceName))
|
|
42485
42984
|
throw new CredentialStoreUnavailableError();
|
|
42985
|
+
super(indexDirectory ?? profileIndexDirectory(serviceName));
|
|
42986
|
+
this.serviceName = serviceName;
|
|
42486
42987
|
this.#createEntry = createEntry ?? createNativeEntryFactory(serviceName);
|
|
42487
|
-
this.#index = new ProfileIndexFiles(indexDirectory ?? profileIndexDirectory(serviceName));
|
|
42488
|
-
}
|
|
42489
|
-
async list() {
|
|
42490
|
-
return (await this.#index.read()).profiles;
|
|
42491
42988
|
}
|
|
42492
42989
|
credential(profile) {
|
|
42493
42990
|
return new NativeNapiKeyringCredentialStore(this.#createEntry, this.serviceName, profileAccount(profile));
|
|
@@ -42495,43 +42992,128 @@ var NativeKeyringProfileRegistry = class {
|
|
|
42495
42992
|
legacy() {
|
|
42496
42993
|
return new NativeNapiKeyringCredentialStore(this.#createEntry, this.serviceName, LEGACY_CREDENTIAL_ACCOUNT);
|
|
42497
42994
|
}
|
|
42498
|
-
async
|
|
42499
|
-
|
|
42500
|
-
const before = await this.list();
|
|
42501
|
-
admitProfile(nextProfileIndex(before, profile, replaces), profile);
|
|
42502
|
-
await this.credential(profile).replace(credential);
|
|
42995
|
+
async proveCredential() {
|
|
42996
|
+
const probe = new NativeNapiKeyringCredentialStore(this.#createEntry, this.serviceName, `probe:${randomUUID4()}`);
|
|
42503
42997
|
try {
|
|
42504
|
-
await
|
|
42505
|
-
const next = nextProfileIndex(current, profile, replaces);
|
|
42506
|
-
admitProfile(next, profile);
|
|
42507
|
-
return next;
|
|
42508
|
-
});
|
|
42998
|
+
await probe.replace(PROBE_CREDENTIAL());
|
|
42509
42999
|
} catch (error) {
|
|
42510
|
-
|
|
42511
|
-
await this.credential(profile).clear();
|
|
43000
|
+
await quietly(probe.clear());
|
|
42512
43001
|
throw error;
|
|
42513
43002
|
}
|
|
42514
|
-
|
|
42515
|
-
|
|
43003
|
+
await probe.clear();
|
|
43004
|
+
}
|
|
43005
|
+
/** The operating system serializes access to one entry; nothing else is coordinated here. */
|
|
43006
|
+
owning(_logins, operation) {
|
|
43007
|
+
return operation();
|
|
43008
|
+
}
|
|
43009
|
+
};
|
|
43010
|
+
var OWNERSHIP_WAIT_MS = 3e4;
|
|
43011
|
+
var heldLogins = new AsyncLocalStorage();
|
|
43012
|
+
var loginKey = (login) => login === "legacy" ? "legacy" : profileAccount(login).replaceAll(":", ".");
|
|
43013
|
+
var FileProfileRegistry = class extends IndexedProfileRegistry {
|
|
43014
|
+
kind = "file";
|
|
43015
|
+
#root;
|
|
43016
|
+
#home;
|
|
43017
|
+
#ancestors;
|
|
43018
|
+
#ownerId;
|
|
43019
|
+
#probe;
|
|
43020
|
+
#waitMs;
|
|
43021
|
+
#pollMs;
|
|
43022
|
+
constructor(serviceName = "ohmyhost", options = {}) {
|
|
43023
|
+
if (!SERVICE_NAME.test(serviceName))
|
|
43024
|
+
throw new CredentialStoreUnavailableError();
|
|
43025
|
+
const home = options.home ?? homedir();
|
|
43026
|
+
const indexDirectory = options.indexDirectory ?? profileIndexDirectory(serviceName);
|
|
43027
|
+
super(indexDirectory);
|
|
43028
|
+
const ownerId = options.ownerId ?? process.getuid?.();
|
|
43029
|
+
if (ownerId === void 0)
|
|
43030
|
+
throw new CredentialStoreUnavailableError();
|
|
43031
|
+
const anchor = join6(home, ".ohmyhost");
|
|
43032
|
+
this.#home = home;
|
|
43033
|
+
this.#root = join6(indexDirectory, "credentials");
|
|
43034
|
+
this.#ancestors = indexDirectory.startsWith(anchor + sep3) ? [anchor, ...directoriesBelow(anchor, indexDirectory)] : [indexDirectory];
|
|
43035
|
+
this.#ownerId = ownerId;
|
|
43036
|
+
this.#probe = options.probe ?? linuxProcessProbe();
|
|
43037
|
+
this.#waitMs = options.waitMs ?? OWNERSHIP_WAIT_MS;
|
|
43038
|
+
this.#pollMs = options.pollMs;
|
|
43039
|
+
}
|
|
43040
|
+
credential(profile) {
|
|
43041
|
+
return this.#storeAt(join6(this.#root, loginKey(profile)));
|
|
43042
|
+
}
|
|
43043
|
+
legacy() {
|
|
43044
|
+
return this.#storeAt(join6(this.#root, loginKey("legacy")));
|
|
43045
|
+
}
|
|
43046
|
+
async owning(logins, operation, signal) {
|
|
43047
|
+
const outer = heldLogins.getStore();
|
|
43048
|
+
const wanted = [...new Set(logins.map((login) => join6(this.#root, loginKey(login))))].sort().filter((directory) => outer?.has(directory) !== true);
|
|
43049
|
+
if (wanted.length === 0)
|
|
43050
|
+
return await operation();
|
|
43051
|
+
const holds = [];
|
|
43052
|
+
try {
|
|
43053
|
+
for (const directory of wanted) {
|
|
43054
|
+
await this.#storeAt(directory).prepare();
|
|
43055
|
+
try {
|
|
43056
|
+
holds.push(await new LoginOwnership(directory, {
|
|
43057
|
+
probe: this.#probe,
|
|
43058
|
+
waitMs: this.#waitMs,
|
|
43059
|
+
...this.#pollMs === void 0 ? {} : { pollMs: this.#pollMs }
|
|
43060
|
+
}).acquire(signal));
|
|
43061
|
+
} catch (error) {
|
|
43062
|
+
if (error instanceof LoginOwnershipTimeoutError)
|
|
43063
|
+
throw new LoginOwnershipTimeoutError(relative3(this.#home, join6(directory, error.record)));
|
|
43064
|
+
if (signal?.aborted === true)
|
|
43065
|
+
throw error;
|
|
43066
|
+
throw new CredentialStoreUnavailableError();
|
|
43067
|
+
}
|
|
43068
|
+
}
|
|
43069
|
+
return await heldLogins.run(/* @__PURE__ */ new Set([...outer ?? [], ...wanted]), operation);
|
|
43070
|
+
} finally {
|
|
43071
|
+
for (const hold of holds.reverse())
|
|
43072
|
+
await hold.release();
|
|
43073
|
+
}
|
|
42516
43074
|
}
|
|
42517
|
-
async
|
|
42518
|
-
|
|
42519
|
-
|
|
43075
|
+
async proveCredential() {
|
|
43076
|
+
const directory = join6(this.#root, `probe.${randomUUID4()}`);
|
|
43077
|
+
const probe = this.#storeAt(directory);
|
|
43078
|
+
try {
|
|
43079
|
+
await probe.replace(PROBE_CREDENTIAL());
|
|
43080
|
+
await probe.clear();
|
|
43081
|
+
} finally {
|
|
43082
|
+
await quietly(probe.clear());
|
|
43083
|
+
await quietly(rmdir(directory));
|
|
43084
|
+
}
|
|
43085
|
+
}
|
|
43086
|
+
#storeAt(directory) {
|
|
43087
|
+
return new OwnerOnlyFileCredentialStore(directory, this.#ownerId, {
|
|
43088
|
+
ancestors: this.#ancestors,
|
|
43089
|
+
root: this.#root,
|
|
43090
|
+
home: this.#home
|
|
43091
|
+
});
|
|
43092
|
+
}
|
|
43093
|
+
};
|
|
43094
|
+
var directoriesBelow = (anchor, target) => {
|
|
43095
|
+
const result = [];
|
|
43096
|
+
let current = anchor;
|
|
43097
|
+
for (const segment of target.slice(anchor.length).split(sep3).filter(Boolean)) {
|
|
43098
|
+
current = join6(current, segment);
|
|
43099
|
+
result.push(current);
|
|
42520
43100
|
}
|
|
43101
|
+
return result;
|
|
42521
43102
|
};
|
|
43103
|
+
var createProfileRegistry = (serviceName, platform = process.platform) => platform === "linux" ? new FileProfileRegistry(serviceName) : new NativeKeyringProfileRegistry(void 0, serviceName);
|
|
42522
43104
|
var ProfileIndexFiles = class {
|
|
42523
43105
|
directory;
|
|
42524
43106
|
constructor(directory) {
|
|
42525
43107
|
this.directory = directory;
|
|
42526
43108
|
}
|
|
42527
43109
|
async read() {
|
|
42528
|
-
for (let
|
|
43110
|
+
for (let attempt2 = 0; attempt2 < MAX_INDEX_ATTEMPTS; attempt2 += 1) {
|
|
42529
43111
|
const version2 = await this.#newest();
|
|
42530
43112
|
if (version2 === 0)
|
|
42531
43113
|
return { version: version2, profiles: [] };
|
|
42532
43114
|
let serialized;
|
|
42533
43115
|
try {
|
|
42534
|
-
serialized = await
|
|
43116
|
+
serialized = await readFile3(this.#file(version2), "utf8");
|
|
42535
43117
|
} catch (error) {
|
|
42536
43118
|
if (fileErrorCode(error) === "ENOENT")
|
|
42537
43119
|
continue;
|
|
@@ -42541,22 +43123,41 @@ var ProfileIndexFiles = class {
|
|
|
42541
43123
|
}
|
|
42542
43124
|
throw new CredentialStoreUnavailableError();
|
|
42543
43125
|
}
|
|
43126
|
+
/**
|
|
43127
|
+
* Writes and removes one temporary file beside the index, and links it to a second name the way
|
|
43128
|
+
* every index change and every ownership record is made, so a login could be listed and owned.
|
|
43129
|
+
*/
|
|
43130
|
+
async probe() {
|
|
43131
|
+
const temporary = join6(this.directory, `.index-${randomUUID4()}.tmp`);
|
|
43132
|
+
const linked = join6(this.directory, `.index-${randomUUID4()}.tmp`);
|
|
43133
|
+
try {
|
|
43134
|
+
await mkdir4(this.directory, { recursive: true, mode: 448 });
|
|
43135
|
+
await writeDurably(temporary, "probe");
|
|
43136
|
+
await link2(temporary, linked);
|
|
43137
|
+
await unlink4(linked);
|
|
43138
|
+
await unlink4(temporary);
|
|
43139
|
+
} catch {
|
|
43140
|
+
await removeTemporary(linked);
|
|
43141
|
+
await removeTemporary(temporary);
|
|
43142
|
+
throw new CredentialStoreUnavailableError();
|
|
43143
|
+
}
|
|
43144
|
+
}
|
|
42544
43145
|
/** Applies `change` to the newest index; `undefined` means nothing to change. */
|
|
42545
43146
|
async update(change) {
|
|
42546
43147
|
try {
|
|
42547
|
-
await
|
|
43148
|
+
await mkdir4(this.directory, { recursive: true, mode: 448 });
|
|
42548
43149
|
} catch {
|
|
42549
43150
|
throw new CredentialStoreUnavailableError();
|
|
42550
43151
|
}
|
|
42551
|
-
for (let
|
|
43152
|
+
for (let attempt2 = 0; attempt2 < MAX_INDEX_ATTEMPTS; attempt2 += 1) {
|
|
42552
43153
|
const { version: version2, profiles } = await this.read();
|
|
42553
43154
|
const next = change(profiles);
|
|
42554
43155
|
if (next === void 0)
|
|
42555
43156
|
return;
|
|
42556
|
-
const temporary =
|
|
43157
|
+
const temporary = join6(this.directory, `.index-${randomUUID4()}.tmp`);
|
|
42557
43158
|
try {
|
|
42558
43159
|
await writeDurably(temporary, serializeProfileIndex(next));
|
|
42559
|
-
await
|
|
43160
|
+
await link2(temporary, this.#file(version2 + 1));
|
|
42560
43161
|
} catch (error) {
|
|
42561
43162
|
if (fileErrorCode(error) === "EEXIST")
|
|
42562
43163
|
continue;
|
|
@@ -42574,7 +43175,7 @@ var ProfileIndexFiles = class {
|
|
|
42574
43175
|
async #newest() {
|
|
42575
43176
|
let names;
|
|
42576
43177
|
try {
|
|
42577
|
-
names = await
|
|
43178
|
+
names = await readdir4(this.directory);
|
|
42578
43179
|
} catch (error) {
|
|
42579
43180
|
if (fileErrorCode(error) === "ENOENT")
|
|
42580
43181
|
return 0;
|
|
@@ -42590,7 +43191,7 @@ var ProfileIndexFiles = class {
|
|
|
42590
43191
|
async #prune(superseded) {
|
|
42591
43192
|
let names;
|
|
42592
43193
|
try {
|
|
42593
|
-
names = await
|
|
43194
|
+
names = await readdir4(this.directory);
|
|
42594
43195
|
} catch {
|
|
42595
43196
|
return;
|
|
42596
43197
|
}
|
|
@@ -42599,25 +43200,25 @@ var ProfileIndexFiles = class {
|
|
|
42599
43200
|
if (version2 === 0 || version2 >= superseded)
|
|
42600
43201
|
continue;
|
|
42601
43202
|
try {
|
|
42602
|
-
await
|
|
43203
|
+
await unlink4(join6(this.directory, name));
|
|
42603
43204
|
} catch {
|
|
42604
43205
|
}
|
|
42605
43206
|
}
|
|
42606
43207
|
}
|
|
42607
43208
|
#file(version2) {
|
|
42608
|
-
return
|
|
43209
|
+
return join6(this.directory, `index-${String(version2)}.json`);
|
|
42609
43210
|
}
|
|
42610
43211
|
};
|
|
42611
43212
|
var indexVersion = (name) => Number(INDEX_FILE.exec(name)?.[1] ?? 0);
|
|
42612
43213
|
var removeTemporary = async (path2) => {
|
|
42613
43214
|
try {
|
|
42614
|
-
await
|
|
43215
|
+
await unlink4(path2);
|
|
42615
43216
|
} catch {
|
|
42616
43217
|
}
|
|
42617
43218
|
};
|
|
42618
43219
|
var fileErrorCode = (error) => typeof error === "object" && error !== null && "code" in error ? String(error.code) : void 0;
|
|
42619
43220
|
var writeDurably = async (path2, text) => {
|
|
42620
|
-
const handle = await
|
|
43221
|
+
const handle = await open4(path2, "wx", 384);
|
|
42621
43222
|
try {
|
|
42622
43223
|
await handle.writeFile(text, "utf8");
|
|
42623
43224
|
await handle.sync();
|
|
@@ -42704,9 +43305,9 @@ var selectProfileForOrganization = (profiles, request) => {
|
|
|
42704
43305
|
const [member2] = inOrganization;
|
|
42705
43306
|
if (member2 !== void 0)
|
|
42706
43307
|
return { outcome: "selected", profile: member2 };
|
|
42707
|
-
const [
|
|
42708
|
-
if (unscoped.length === 1 &&
|
|
42709
|
-
return { outcome: "selected", profile:
|
|
43308
|
+
const [open7] = unscoped;
|
|
43309
|
+
if (unscoped.length === 1 && open7 !== void 0)
|
|
43310
|
+
return { outcome: "selected", profile: open7 };
|
|
42710
43311
|
return selectProfile(profiles, user);
|
|
42711
43312
|
};
|
|
42712
43313
|
var defaultProfileName = (profiles, login) => {
|
|
@@ -42718,8 +43319,8 @@ var defaultProfileName = (profiles, login) => {
|
|
|
42718
43319
|
if (free(base))
|
|
42719
43320
|
return base;
|
|
42720
43321
|
const suffix = (login.organizationId ?? login.userId).replace(/[^A-Za-z0-9]/gu, "").slice(-6).toLowerCase();
|
|
42721
|
-
for (let
|
|
42722
|
-
const candidate = `${base.slice(0, 48)}-${suffix}${
|
|
43322
|
+
for (let attempt2 = 1; attempt2 <= profiles.length + 1; attempt2 += 1) {
|
|
43323
|
+
const candidate = `${base.slice(0, 48)}-${suffix}${attempt2 === 1 ? "" : `-${String(attempt2)}`}`;
|
|
42723
43324
|
if (free(candidate))
|
|
42724
43325
|
return candidate;
|
|
42725
43326
|
}
|
|
@@ -46573,20 +47174,27 @@ var selectWorkspace = async (session, organization, signal, identity) => {
|
|
|
46573
47174
|
return session.profile;
|
|
46574
47175
|
if (session.profile.organizationId !== null)
|
|
46575
47176
|
throw new ProfileOrganizationFixedError(session.profile, organization);
|
|
46576
|
-
const
|
|
46577
|
-
|
|
46578
|
-
|
|
46579
|
-
|
|
46580
|
-
|
|
46581
|
-
|
|
46582
|
-
|
|
46583
|
-
|
|
46584
|
-
|
|
46585
|
-
|
|
46586
|
-
|
|
46587
|
-
|
|
46588
|
-
|
|
46589
|
-
|
|
47177
|
+
const becomes = { ...session.profile, organizationId: organization.id };
|
|
47178
|
+
return await session.profiles.owning([session.profile, becomes], async () => {
|
|
47179
|
+
const stored = await session.store.read();
|
|
47180
|
+
if (stored === void 0)
|
|
47181
|
+
throw new InteractiveSessionRequiredError();
|
|
47182
|
+
const refreshed = await session.refresher.refresh(stored.refreshToken, signal, organization.workos_id);
|
|
47183
|
+
assertVerifiedLogin(await identity(refreshed.accessToken), session.profile.userId, organization.id);
|
|
47184
|
+
const existing2 = (await session.profiles.list()).find((saved) => saved.userId === session.profile.userId && saved.organizationId === organization.id);
|
|
47185
|
+
const bound = {
|
|
47186
|
+
...session.profile,
|
|
47187
|
+
name: existing2?.name ?? session.profile.name,
|
|
47188
|
+
organizationId: organization.id,
|
|
47189
|
+
organizationName: organization.name
|
|
47190
|
+
};
|
|
47191
|
+
await session.profiles.save(bound, {
|
|
47192
|
+
...refreshed,
|
|
47193
|
+
workosOrganizationId: organization.workos_id,
|
|
47194
|
+
organizationId: organization.id
|
|
47195
|
+
}, session.profile);
|
|
47196
|
+
return bound;
|
|
47197
|
+
}, signal);
|
|
46590
47198
|
};
|
|
46591
47199
|
var workspaceOf = (credential) => ({
|
|
46592
47200
|
...credential.workosOrganizationId === void 0 ? {} : { workosOrganizationId: credential.workosOrganizationId },
|
|
@@ -46598,9 +47206,9 @@ var publicWorkspace = (organization) => ({
|
|
|
46598
47206
|
});
|
|
46599
47207
|
|
|
46600
47208
|
// apps/product-cli/dist/cli.js
|
|
46601
|
-
import { constants as
|
|
46602
|
-
import { lstat as
|
|
46603
|
-
import { isAbsolute as isAbsolute2, join as
|
|
47209
|
+
import { constants as constants5 } from "node:fs";
|
|
47210
|
+
import { lstat as lstat3, open as open5 } from "node:fs/promises";
|
|
47211
|
+
import { isAbsolute as isAbsolute2, join as join7, resolve as resolve4 } from "node:path";
|
|
46604
47212
|
|
|
46605
47213
|
// packages/contracts/dist/database-access.js
|
|
46606
47214
|
function parseProjectDatabaseWrite(value) {
|
|
@@ -46830,7 +47438,7 @@ function exact4(v, keys) {
|
|
|
46830
47438
|
// apps/product-cli/package.json
|
|
46831
47439
|
var package_default = {
|
|
46832
47440
|
name: "@ohmyhost/product-cli",
|
|
46833
|
-
version: "0.1.
|
|
47441
|
+
version: "0.1.76",
|
|
46834
47442
|
private: true,
|
|
46835
47443
|
ohmyhost: {
|
|
46836
47444
|
deployment: "production",
|
|
@@ -47351,7 +47959,14 @@ var retryAdvice = (command, keyed = true) => {
|
|
|
47351
47959
|
return "run the same command again; this command has no idempotency key, so check its current state first if it may have changed anything";
|
|
47352
47960
|
};
|
|
47353
47961
|
var internalErrorAction = (command, keyed = true) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command, keyed)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
|
|
47354
|
-
var
|
|
47962
|
+
var FILE_STORE_REFUSAL = {
|
|
47963
|
+
symbolic_link: "it is a symbolic link",
|
|
47964
|
+
another_owner: "it belongs to another user",
|
|
47965
|
+
wrong_mode: "its mode is not allowed",
|
|
47966
|
+
not_writable: "it could not be written"
|
|
47967
|
+
};
|
|
47968
|
+
var describeFileStoreRefusal = (error) => error instanceof FileCredentialStoreRefusedError ? `The saved-login files at ~/${error.path} were refused (${FILE_STORE_REFUSAL[error.reason]}). Their directories must be yours with mode 700 and the ones above them neither symbolic links nor writable by others.` : void 0;
|
|
47969
|
+
var credentialStoreUnavailableAction = (error) => `${describeFileStoreRefusal(error) ?? "This computer's credential store (the macOS Keychain, the Windows Credential Manager) or the saved-login files in ~/.ohmyhost/profiles could not be read or written."} Nothing was changed. If the agent runs in a sandbox, run the command with access to them before asking the customer to sign in again. If a desktop store is locked, ask the customer to unlock it. Then run the command again.`;
|
|
47355
47970
|
var responseContractAction = (command, keyed = true) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command, keyed)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
|
|
47356
47971
|
var requestTimeoutAction = (command, keyed = true) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command, keyed)}.`;
|
|
47357
47972
|
var LOGOUT_UNCONFIRMED_ACTION = "The saved login was removed from this computer, but ohmyho.st did not confirm that its session ended. Running logout again cannot retry this, because the login is gone; do not sign in again just to revoke it. Tell the customer the session end was not confirmed.";
|
|
@@ -47362,7 +47977,7 @@ var COLUMNS_FILE_INVALID_ACTION = "Put one JSON array of 1 to 64 column objects
|
|
|
47362
47977
|
var STATEMENT_FILE_INVALID_ACTION = "Put one INSERT, UPDATE or DELETE statement that starts with that keyword (no leading comment or WITH), UTF-8, at most 64 KiB, in the file named by --statement-file, then rerun with the same --idempotency-key.";
|
|
47363
47978
|
var signInCommand = (commandPrefix, profile) => profile === void 0 ? `${commandPrefix} login --json` : `${commandPrefix} login${profile.organizationId === null ? "" : ` --organization ${profile.organizationId}`} --user ${profile.userId} --profile-name ${profile.name} --json`;
|
|
47364
47979
|
var endedLoginAction = (commandPrefix, profile) => `The sign-in of ${profile === void 0 ? "this computer's saved login" : `saved login ${profile.name} (user ${profile.userId}${profile.organizationId === null ? "" : `, organization ${profile.organizationId}`})`} ended and it was removed. Run '${signInCommand(commandPrefix, profile)}' to sign it in again.`;
|
|
47365
|
-
var refreshFailedAction = (commandPrefix, profile) => `Renewing the saved login${profile === void 0 ? "" : ` ${profile.name}`} at the sign-in service failed
|
|
47980
|
+
var refreshFailedAction = (commandPrefix, profile, record9) => `Renewing the saved login${profile === void 0 ? "" : ` ${profile.name}`} at the sign-in service failed.${record9 === void 0 ? "" : ` Another process on this computer holds this login (record ${record9}) and did not finish in time; nothing was sent to the sign-in service.`} Run the same command again in a minute, with the same --idempotency-key if it has one. If it fails again, run '${signInCommand(commandPrefix, profile)}' and send the customer the link and code.`;
|
|
47366
47981
|
var ProductCliFailure = class extends Error {
|
|
47367
47982
|
exitCode;
|
|
47368
47983
|
code;
|
|
@@ -47655,12 +48270,12 @@ var ProductCli = class {
|
|
|
47655
48270
|
}
|
|
47656
48271
|
if (command.kind === "export-download-link") {
|
|
47657
48272
|
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
47658
|
-
const
|
|
48273
|
+
const link3 = await api.createProjectExportDownloadLink({
|
|
47659
48274
|
projectId: command.projectId,
|
|
47660
48275
|
exportId: command.exportId
|
|
47661
48276
|
});
|
|
47662
|
-
assertProjectExportDownloadLink(
|
|
47663
|
-
return success("export download-link", { status: "succeeded", download_link:
|
|
48277
|
+
assertProjectExportDownloadLink(link3);
|
|
48278
|
+
return success("export download-link", { status: "succeeded", download_link: link3 });
|
|
47664
48279
|
}
|
|
47665
48280
|
if (command.kind === "feedback-status") {
|
|
47666
48281
|
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
@@ -47921,6 +48536,8 @@ var ProductCli = class {
|
|
|
47921
48536
|
return failure(name, 2, "interactive_login_required", false, `A user API token cannot create, list or select a workspace. Run '${this.dependencies.commandPrefix} login --json' in a process without OHMYHOST_TOKEN.`);
|
|
47922
48537
|
if (error instanceof ProfileLimitError)
|
|
47923
48538
|
return failure(name, 2, "profile_limit_reached", false, profileLimitAction(this.dependencies.commandPrefix));
|
|
48539
|
+
if (error instanceof LoginOwnershipTimeoutError)
|
|
48540
|
+
return failure(name, 5, "token_refresh_failed", true, refreshFailedAction(this.dependencies.commandPrefix, this.#profile, error.record));
|
|
47924
48541
|
this.recordDiagnostic(diagnosticDescriptor(error, signal));
|
|
47925
48542
|
return classifyFailure(
|
|
47926
48543
|
name,
|
|
@@ -47935,26 +48552,33 @@ var ProductCli = class {
|
|
|
47935
48552
|
githubConnectAction(organizationId) {
|
|
47936
48553
|
return `Run '${this.dependencies.commandPrefix} github connect --organization ${organizationId} --idempotency-key KEY --json' once, then link repositories covered by the installation.`;
|
|
47937
48554
|
}
|
|
48555
|
+
/**
|
|
48556
|
+
* The first deployment of a checkout that no project is saved for publishes the working
|
|
48557
|
+
* directory as it is, whether or not it has a GitHub remote and whether or not the workspace has
|
|
48558
|
+
* a GitHub installation; GitHub is the later step for deployment on every push.
|
|
48559
|
+
*/
|
|
48560
|
+
publishAction(organizationId, projectId) {
|
|
48561
|
+
const prefix = this.dependencies.commandPrefix;
|
|
48562
|
+
const publish = `'${prefix} source publish --project ${projectId ?? "ULID"} --mode initialize --expected-source-generation 0 --message "Initial version" --idempotency-key KEY --wait --json'`;
|
|
48563
|
+
const first = projectId === void 0 ? `This checkout has no saved project link here, which a new container never has even for an app that exists. First run '${prefix} project status --json' and '${prefix} project list --json' as the deploy Skill says, and create a project only if none of them is this app. Then publish this directory as it is, without GitHub: create the project with '${prefix} project create --organization ${organizationId} --name NAME --region eu --idempotency-key KEY --json' (EU or US is the customer's one answer), read its operation until it succeeds, then run ${publish}` : `This checkout is linked to project ${projectId}, which has no source yet. Publish this directory as it is, without GitHub: run ${publish}`;
|
|
48564
|
+
return `${first} and deploy the commit it returns; the deploy Skill lists every step. Deployment on every push is the later step: ${this.githubConnectAction(organizationId)}`;
|
|
48565
|
+
}
|
|
47938
48566
|
async githubNextAction(api, organizationId) {
|
|
47939
48567
|
try {
|
|
47940
48568
|
let provider = this.dependencies.linkedSourceProvider;
|
|
47941
|
-
|
|
48569
|
+
const linked = this.dependencies.linkedProjectId;
|
|
48570
|
+
if (linked !== void 0) {
|
|
47942
48571
|
if (api.managedSource === void 0)
|
|
47943
48572
|
return {};
|
|
47944
|
-
const binding = await api.managedSource.getSource(
|
|
48573
|
+
const binding = await api.managedSource.getSource(linked);
|
|
47945
48574
|
if (binding !== null)
|
|
47946
48575
|
parseProjectSourceBinding(binding);
|
|
47947
48576
|
provider = binding === null ? void 0 : binding.provider;
|
|
47948
48577
|
}
|
|
47949
48578
|
if (provider === "managed")
|
|
47950
48579
|
return {};
|
|
47951
|
-
if (provider !== "github"
|
|
47952
|
-
|
|
47953
|
-
if (!workspace.git?.remotes.some((remote) => remote.githubRepository !== null))
|
|
47954
|
-
return {
|
|
47955
|
-
next_action: "Ask once whether to deploy directly with ohmyho.st storing the versions or set up GitHub for this project. Inspect current source first; a missing GitHub connection does not require GitHub."
|
|
47956
|
-
};
|
|
47957
|
-
}
|
|
48580
|
+
if (provider !== "github")
|
|
48581
|
+
return { next_action: this.publishAction(organizationId, linked) };
|
|
47958
48582
|
const github = parseGithubOrganizationConnectionStatus(await api.getGithubConnection(organizationId));
|
|
47959
48583
|
if (github.connection !== null && github.connection.organization_id !== organizationId)
|
|
47960
48584
|
throw new ResponseContractError();
|
|
@@ -48003,9 +48627,11 @@ var ProductCli = class {
|
|
|
48003
48627
|
};
|
|
48004
48628
|
}
|
|
48005
48629
|
/** The next step for a login that has no organization yet. */
|
|
48006
|
-
workspaceAction(selection) {
|
|
48630
|
+
workspaceAction(selection, unconfirmed) {
|
|
48007
48631
|
const prefix = this.dependencies.commandPrefix;
|
|
48008
48632
|
const named = this.#profile === void 0 ? "" : ` --profile-name ${this.#profile.name}`;
|
|
48633
|
+
if (unconfirmed !== void 0 && selection.outcome === "no_workspace")
|
|
48634
|
+
return `The first workspace was not confirmed. Run '${prefix} organization create --name "My workspace" --idempotency-key initial-workspace:${unconfirmed.userId}${unconfirmed.signupSource === null ? "" : ` --source ${unconfirmed.signupSource}`}${named} --json' to repeat the identical request: it returns the workspace or creates it once. Do not create another.`;
|
|
48009
48635
|
return selection.outcome === "choice_required" ? `Ask the customer which workspace to use, then run '${prefix} organization use --organization ULID${named} --json'.` : `Run '${prefix} organization create --name NAME --idempotency-key KEY${named} --json' to create the first workspace.`;
|
|
48010
48636
|
}
|
|
48011
48637
|
async listProfiles() {
|
|
@@ -48034,6 +48660,7 @@ var ProductCli = class {
|
|
|
48034
48660
|
const readIdentity = this.dependencies.currentIdentity;
|
|
48035
48661
|
if (profiles === void 0 || readIdentity === void 0)
|
|
48036
48662
|
throw new ProviderCapabilityBlockedError();
|
|
48663
|
+
await profiles.prove();
|
|
48037
48664
|
const signInDeadline = this.dependencies.now().getTime() + SIGN_IN_WINDOW_MS;
|
|
48038
48665
|
let session = await this.dependencies.deviceFlow.authorize();
|
|
48039
48666
|
await presentAuthorization(this.dependencies.deviceAuthorizationPresenter, session.authorization);
|
|
@@ -48075,7 +48702,7 @@ var ProductCli = class {
|
|
|
48075
48702
|
refreshToken: result.tokens.refreshToken,
|
|
48076
48703
|
expiresAt
|
|
48077
48704
|
};
|
|
48078
|
-
|
|
48705
|
+
let account = await this.dependencies.accountProfile(async () => signedIn.accessToken);
|
|
48079
48706
|
const loginFlags = {
|
|
48080
48707
|
organizationId,
|
|
48081
48708
|
userId: expectedUserId,
|
|
@@ -48085,6 +48712,18 @@ var ProductCli = class {
|
|
|
48085
48712
|
throw this.unverifiedLogin(loginFlags);
|
|
48086
48713
|
if (expectedUserId !== void 0 && account.userId !== expectedUserId)
|
|
48087
48714
|
throw new ProductCliFailure(4, "login_account_mismatch", false, `The browser signed in as user ${account.userId}, not ${expectedUserId}. Nothing was saved and every saved login is unchanged. Sign out of ohmyho.st in that browser or use the browser profile of ${expectedUserId}, then run '${this.dependencies.commandPrefix} login${organizationId === void 0 ? "" : ` --organization ${organizationId}`} --user ${expectedUserId} --json' again.`);
|
|
48715
|
+
let creation;
|
|
48716
|
+
if (this.dependencies.firstWorkspace !== void 0 && organizationId === void 0 && account.emailVerified && account.organizations.length === 0) {
|
|
48717
|
+
creation = await this.dependencies.firstWorkspace(async () => signedIn.accessToken, account.userId, account.signupSource);
|
|
48718
|
+
try {
|
|
48719
|
+
account = await this.dependencies.accountProfile(async () => signedIn.accessToken);
|
|
48720
|
+
} catch (error) {
|
|
48721
|
+
throwIfAborted(signal);
|
|
48722
|
+
if (creation === "refused")
|
|
48723
|
+
throw error;
|
|
48724
|
+
creation = "uncertain";
|
|
48725
|
+
}
|
|
48726
|
+
}
|
|
48088
48727
|
const selection = chooseWorkspace(account.organizations, organizationId);
|
|
48089
48728
|
if (selection.outcome === "not_a_member")
|
|
48090
48729
|
throw this.unknownWorkspace(selection);
|
|
@@ -48127,6 +48766,7 @@ var ProductCli = class {
|
|
|
48127
48766
|
if (organization !== null)
|
|
48128
48767
|
return success("login", {
|
|
48129
48768
|
status: "authenticated",
|
|
48769
|
+
credential_store: profiles.kind,
|
|
48130
48770
|
organization: publicWorkspace(organization),
|
|
48131
48771
|
profile: publicProfile(profile),
|
|
48132
48772
|
...readGithubConnection === void 0 ? {} : await this.githubNextAction({
|
|
@@ -48140,10 +48780,11 @@ var ProductCli = class {
|
|
|
48140
48780
|
});
|
|
48141
48781
|
return success("login", {
|
|
48142
48782
|
status: "authenticated",
|
|
48783
|
+
credential_store: profiles.kind,
|
|
48143
48784
|
organization: null,
|
|
48144
48785
|
profile: publicProfile(profile),
|
|
48145
48786
|
organizations: selection.outcome === "choice_required" ? selection.organizations.map(publicWorkspace) : [],
|
|
48146
|
-
next_action: this.workspaceAction(selection)
|
|
48787
|
+
next_action: this.workspaceAction(selection, creation === "uncertain" || creation === "created" ? { userId: account.userId, signupSource: account.signupSource } : void 0)
|
|
48147
48788
|
});
|
|
48148
48789
|
}
|
|
48149
48790
|
}
|
|
@@ -48162,12 +48803,12 @@ var ProductCli = class {
|
|
|
48162
48803
|
throw new InteractiveSessionRequiredError();
|
|
48163
48804
|
let bound;
|
|
48164
48805
|
try {
|
|
48165
|
-
bound = await runBounded((bounded2) => selectWorkspace({
|
|
48806
|
+
bound = await profiles.owning([profile, { ...profile, organizationId: organization.id }], () => runBounded((bounded2) => selectWorkspace({
|
|
48166
48807
|
store: profiles.credential(profile),
|
|
48167
48808
|
refresher: this.dependencies.tokenRefresher,
|
|
48168
48809
|
profiles,
|
|
48169
48810
|
profile
|
|
48170
|
-
}, organization, bounded2, (accessToken) => this.dependencies.productApi(async () => accessToken).getCurrentIdentity()), signal, this.dependencies.lifecycleTimeoutMs);
|
|
48811
|
+
}, organization, bounded2, (accessToken) => this.dependencies.productApi(async () => accessToken).getCurrentIdentity()), signal, this.dependencies.lifecycleTimeoutMs), signal);
|
|
48171
48812
|
} catch (error) {
|
|
48172
48813
|
if (error instanceof AccountVerificationError)
|
|
48173
48814
|
throw this.unverifiedLogin({
|
|
@@ -48847,7 +49488,7 @@ var ProductCli = class {
|
|
|
48847
49488
|
const [organizationId, ...others] = parseCurrentIdentity(await api.getCurrentIdentity()).organization_ids;
|
|
48848
49489
|
if (organizationId === void 0 || others.length > 0)
|
|
48849
49490
|
throw new ResponseContractError();
|
|
48850
|
-
const prior = (await readProjectLinks(
|
|
49491
|
+
const prior = (await readProjectLinks(join7(this.dependencies.sourceDirectory ?? process.cwd(), this.dependencies.sourceMetadataDirectory ?? ".ohmyhost"), this.dependencies.productApiOrigin)).links.find((link3) => link3.organization_id === organizationId && link3.project_id === command.projectId);
|
|
48851
49492
|
const confirmed = prior?.version === 3 && prior.source.provider === "managed" && prior.source.source_connection_id === managed.source_connection_id && prior.source.source_generation === managed.source_generation ? prior.source.last_confirmed_commit_sha : null;
|
|
48852
49493
|
await this.dependencies.projectLinkStore.save({
|
|
48853
49494
|
version: 3,
|
|
@@ -49115,7 +49756,7 @@ var ProductCli = class {
|
|
|
49115
49756
|
}
|
|
49116
49757
|
async waitForSecretDelivery(api, projectId, environmentId, stored, signal) {
|
|
49117
49758
|
const desiredGeneration = stored.desired_generation;
|
|
49118
|
-
for (let
|
|
49759
|
+
for (let attempt2 = 0; attempt2 < 120; attempt2 += 1) {
|
|
49119
49760
|
const page = parseEnvironmentSecretPage(await api.listEnvironmentSecrets({ projectId, environmentId }));
|
|
49120
49761
|
if (page.last_error !== null || page.delivery_state === "failed") {
|
|
49121
49762
|
throw new ProductCliFailure(10, "secret_delivery_failed", true, `The secret is saved, but delivering it to the running app failed (last_error in 'ohmyhost secret list --project ${projectId} --environment ${environmentId} --json'). Do not set the value again: ohmyho.st retries delivery automatically, and the next deployment of this environment also delivers it. Read secret list again in a few minutes; if delivery_state stays failed, report last_error with feedback submit (kind bug, error code secret_delivery_failed).`);
|
|
@@ -49136,7 +49777,7 @@ var ProductCli = class {
|
|
|
49136
49777
|
}
|
|
49137
49778
|
async waitForOperation(api, initial, signal) {
|
|
49138
49779
|
let operation = initial;
|
|
49139
|
-
for (let
|
|
49780
|
+
for (let attempt2 = 0; attempt2 < 120 && (operation.state === "queued" || operation.state === "running") && operation.reconciliation?.state !== "required"; attempt2 += 1) {
|
|
49140
49781
|
await this.dependencies.waitUntil(new Date(this.dependencies.now().getTime() + 1e3), signal);
|
|
49141
49782
|
operation = parseOperation(await api.getOperation(operation.id));
|
|
49142
49783
|
}
|
|
@@ -49162,40 +49803,45 @@ var ProductCli = class {
|
|
|
49162
49803
|
if (stored === void 0) {
|
|
49163
49804
|
throw new ProductCliFailure(5, "authentication_required", false, this.loginAction());
|
|
49164
49805
|
}
|
|
49165
|
-
|
|
49806
|
+
if (this.credentialUsable(stored))
|
|
49807
|
+
return stored.accessToken;
|
|
49808
|
+
const profiles = this.dependencies.profiles;
|
|
49166
49809
|
try {
|
|
49167
|
-
|
|
49810
|
+
const renewal = await renewLogin({
|
|
49811
|
+
// A shared file store reads the credential again as the owner; a native store need not.
|
|
49812
|
+
...profiles?.kind === "file" ? {} : { current: stored },
|
|
49813
|
+
registry: profiles !== void 0 && this.#profile !== void 0 ? profiles : DIRECT_OWNERSHIP,
|
|
49814
|
+
login: this.#profile ?? "legacy",
|
|
49815
|
+
store,
|
|
49816
|
+
usable: (credential) => this.credentialUsable(credential),
|
|
49817
|
+
renew: (credential) => this.renewCredential(credential, signal),
|
|
49818
|
+
rejected: (error) => error instanceof TokenRefreshRejectedError,
|
|
49819
|
+
forget: () => this.forgetLogin(store),
|
|
49820
|
+
signal
|
|
49821
|
+
});
|
|
49822
|
+
return renewal.credential.accessToken;
|
|
49168
49823
|
} catch (error) {
|
|
49824
|
+
if (error instanceof LoginGoneError)
|
|
49825
|
+
throw new ProductCliFailure(5, "authentication_required", false, this.loginAction());
|
|
49826
|
+
if (error instanceof LoginOwnershipTimeoutError)
|
|
49827
|
+
throw new ProductCliFailure(5, "token_refresh_failed", true, refreshFailedAction(this.dependencies.commandPrefix, this.#profile, error.record));
|
|
49169
49828
|
if (!(error instanceof TokenRefreshRejectedError))
|
|
49170
49829
|
throw error;
|
|
49171
|
-
|
|
49172
|
-
await this.forgetLogin(store);
|
|
49173
|
-
throw new ProductCliFailure(5, "authentication_required", false, endedLoginAction(this.dependencies.commandPrefix, ended));
|
|
49830
|
+
throw new ProductCliFailure(5, "authentication_required", false, endedLoginAction(this.dependencies.commandPrefix, this.#profile));
|
|
49174
49831
|
}
|
|
49175
|
-
if (refresh.refreshed)
|
|
49176
|
-
await store.replace(refresh.credential);
|
|
49177
|
-
return refresh.credential.accessToken;
|
|
49178
49832
|
}
|
|
49179
|
-
|
|
49833
|
+
credentialUsable(credential) {
|
|
49180
49834
|
const expiresAt = credential.expiresAt === void 0 ? NaN : Date.parse(credential.expiresAt);
|
|
49181
|
-
|
|
49182
|
-
|
|
49183
|
-
|
|
49184
|
-
accessToken: credential.accessToken,
|
|
49185
|
-
refreshToken: credential.refreshToken,
|
|
49186
|
-
expiresAt: credential.expiresAt,
|
|
49187
|
-
...workspaceOf(credential)
|
|
49188
|
-
},
|
|
49189
|
-
refreshed: false
|
|
49190
|
-
};
|
|
49191
|
-
}
|
|
49835
|
+
return Number.isFinite(expiresAt) && expiresAt > this.dependencies.now().getTime() + this.dependencies.lifecycleTimeoutMs;
|
|
49836
|
+
}
|
|
49837
|
+
async renewCredential(credential, signal) {
|
|
49192
49838
|
try {
|
|
49193
49839
|
const refreshed = await runBounded((bounded2) => this.dependencies.tokenRefresher.refresh(credential.refreshToken, bounded2, credential.workosOrganizationId), signal, this.dependencies.lifecycleTimeoutMs);
|
|
49194
49840
|
const refreshedExpiry = Date.parse(refreshed.expiresAt);
|
|
49195
49841
|
if (!Number.isFinite(refreshedExpiry) || refreshedExpiry <= this.dependencies.now().getTime()) {
|
|
49196
49842
|
throw new Error("invalid refreshed expiry");
|
|
49197
49843
|
}
|
|
49198
|
-
return {
|
|
49844
|
+
return { ...refreshed, ...workspaceOf(credential) };
|
|
49199
49845
|
} catch (error) {
|
|
49200
49846
|
if (isCancellation(error) && signal.aborted)
|
|
49201
49847
|
throw error;
|
|
@@ -49275,7 +49921,7 @@ var classifyFailure = (command, error, signal, actingAs, keyed = true) => {
|
|
|
49275
49921
|
return failure(command, 4, "device_authorization_failed", true, "The sign-in service answered unexpectedly; nothing was saved. Run the same login command again; if it fails twice more, ask the customer to try again later.");
|
|
49276
49922
|
}
|
|
49277
49923
|
if (error instanceof CredentialStoreUnavailableError) {
|
|
49278
|
-
return failure(command, 3, "credential_store_unavailable", false,
|
|
49924
|
+
return failure(command, 3, "credential_store_unavailable", false, credentialStoreUnavailableAction(error));
|
|
49279
49925
|
}
|
|
49280
49926
|
if (error instanceof ResponseContractError) {
|
|
49281
49927
|
return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
|
|
@@ -49320,11 +49966,11 @@ var readBoundedUtf8File = async (path2, maxBytes, refusal, privateFile = false)
|
|
|
49320
49966
|
if (privateFile) {
|
|
49321
49967
|
if (!isAbsolute2(path2))
|
|
49322
49968
|
throw refusal();
|
|
49323
|
-
before = await
|
|
49969
|
+
before = await lstat3(path2);
|
|
49324
49970
|
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1 || process.platform !== "win32" && (before.uid !== process.getuid?.() || (before.mode & 63) !== 0))
|
|
49325
49971
|
throw refusal();
|
|
49326
49972
|
}
|
|
49327
|
-
file = await
|
|
49973
|
+
file = await open5(path2, privateFile ? constants5.O_RDONLY | (constants5.O_NOFOLLOW ?? 0) : "r");
|
|
49328
49974
|
} catch {
|
|
49329
49975
|
throw refusal();
|
|
49330
49976
|
}
|
|
@@ -49921,15 +50567,15 @@ function buildClientParams(args, fields) {
|
|
|
49921
50567
|
// packages/sdk-ts/dist/generated/core/serverSentEvents.gen.js
|
|
49922
50568
|
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
49923
50569
|
let lastEventId;
|
|
49924
|
-
const
|
|
50570
|
+
const sleep2 = sseSleepFn ?? ((ms) => new Promise((resolve7) => setTimeout(resolve7, ms)));
|
|
49925
50571
|
const createStream = async function* () {
|
|
49926
50572
|
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
49927
|
-
let
|
|
50573
|
+
let attempt2 = 0;
|
|
49928
50574
|
const signal = options.signal ?? new AbortController().signal;
|
|
49929
50575
|
while (true) {
|
|
49930
50576
|
if (signal.aborted)
|
|
49931
50577
|
break;
|
|
49932
|
-
|
|
50578
|
+
attempt2++;
|
|
49933
50579
|
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
49934
50580
|
if (lastEventId !== void 0) {
|
|
49935
50581
|
headers.set("Last-Event-ID", lastEventId);
|
|
@@ -50025,11 +50671,11 @@ function createSseClient({ onRequest, onSseError, onSseEvent, responseTransforme
|
|
|
50025
50671
|
break;
|
|
50026
50672
|
} catch (error) {
|
|
50027
50673
|
onSseError?.(error);
|
|
50028
|
-
if (sseMaxRetryAttempts !== void 0 &&
|
|
50674
|
+
if (sseMaxRetryAttempts !== void 0 && attempt2 >= sseMaxRetryAttempts) {
|
|
50029
50675
|
break;
|
|
50030
50676
|
}
|
|
50031
|
-
const backoff = Math.min(retryDelay * 2 ** (
|
|
50032
|
-
await
|
|
50677
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt2 - 1), sseMaxRetryDelay ?? 3e4);
|
|
50678
|
+
await sleep2(backoff);
|
|
50033
50679
|
}
|
|
50034
50680
|
}
|
|
50035
50681
|
};
|
|
@@ -55761,7 +56407,7 @@ function checkedResponse(kind, value) {
|
|
|
55761
56407
|
}
|
|
55762
56408
|
|
|
55763
56409
|
// apps/product-cli/dist/product-api.js
|
|
55764
|
-
import { randomUUID as
|
|
56410
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
55765
56411
|
|
|
55766
56412
|
// packages/contracts/dist/index.js
|
|
55767
56413
|
var import__ = __toESM(require__(), 1);
|
|
@@ -56361,14 +57007,14 @@ function isDnsEgressOrigin(value) {
|
|
|
56361
57007
|
} catch {
|
|
56362
57008
|
return false;
|
|
56363
57009
|
}
|
|
56364
|
-
const { hostname } = url;
|
|
56365
|
-
return url.protocol === "https:" && url.origin === value && url.port === "" &&
|
|
57010
|
+
const { hostname: hostname2 } = url;
|
|
57011
|
+
return url.protocol === "https:" && url.origin === value && url.port === "" && hostname2.length <= 253 && hostname2.includes(".") && hostname2.split(".").every((label) => DNS_LABEL.test(label)) && !LOCAL_NAME.test(hostname2) && !IPV4_LITERAL.test(hostname2);
|
|
56366
57012
|
}
|
|
56367
57013
|
function isCustomerEgressOrigin(value) {
|
|
56368
57014
|
if (!isDnsEgressOrigin(value))
|
|
56369
57015
|
return false;
|
|
56370
|
-
const { hostname } = new URL(value);
|
|
56371
|
-
return !PLATFORM_GATEWAY_NAME.test(
|
|
57016
|
+
const { hostname: hostname2 } = new URL(value);
|
|
57017
|
+
return !PLATFORM_GATEWAY_NAME.test(hostname2) && hostname2 !== "connect.ohmyho.st" && !hostname2.endsWith(".connect.ohmyho.st");
|
|
56372
57018
|
}
|
|
56373
57019
|
|
|
56374
57020
|
// packages/contracts/dist/preview-view.js
|
|
@@ -56377,10 +57023,11 @@ function parsePreviewView(value, scope) {
|
|
|
56377
57023
|
throw new TypeError("Invalid preview response");
|
|
56378
57024
|
const row = value;
|
|
56379
57025
|
const ulid6 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
|
|
56380
|
-
if (Object.keys(row).sort().join(",") !== "environment,id,project_id,source,status,url" || typeof row["id"] !== "string" || !ulid6.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid6.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
|
|
57026
|
+
if (Object.keys(row).sort().join(",") !== "applied_source,environment,id,project_id,ready_to_show,source,status,url" || typeof row["id"] !== "string" || !ulid6.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid6.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["ready_to_show"] !== "boolean" || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
|
|
56381
57027
|
throw new TypeError("Invalid preview response");
|
|
56382
|
-
|
|
56383
|
-
|
|
57028
|
+
for (const source of [row["source"], row["applied_source"]]) {
|
|
57029
|
+
if (source === null)
|
|
57030
|
+
continue;
|
|
56384
57031
|
if (!source || typeof source !== "object" || Array.isArray(source))
|
|
56385
57032
|
throw new TypeError("Invalid preview response");
|
|
56386
57033
|
const item = source;
|
|
@@ -56904,7 +57551,7 @@ var GeneratedSdkProductApi = class {
|
|
|
56904
57551
|
}
|
|
56905
57552
|
async deleteProjectDatabaseWebhook(input) {
|
|
56906
57553
|
const value = await deleteProjectDatabaseWebhook({
|
|
56907
|
-
"Idempotency-Key": input.idempotencyKey ??
|
|
57554
|
+
"Idempotency-Key": input.idempotencyKey ?? randomUUID5(),
|
|
56908
57555
|
project_id: input.projectId,
|
|
56909
57556
|
environment: input.environment,
|
|
56910
57557
|
webhook_id: input.webhookId
|
|
@@ -56916,7 +57563,7 @@ var GeneratedSdkProductApi = class {
|
|
|
56916
57563
|
}
|
|
56917
57564
|
async testProjectDatabaseWebhook(input) {
|
|
56918
57565
|
const value = await testProjectDatabaseWebhook({
|
|
56919
|
-
"Idempotency-Key": input.idempotencyKey ??
|
|
57566
|
+
"Idempotency-Key": input.idempotencyKey ?? randomUUID5(),
|
|
56920
57567
|
project_id: input.projectId,
|
|
56921
57568
|
environment: input.environment,
|
|
56922
57569
|
webhook_id: input.webhookId
|
|
@@ -56939,7 +57586,7 @@ var GeneratedSdkProductApi = class {
|
|
|
56939
57586
|
}
|
|
56940
57587
|
async replayProjectDatabaseWebhookDelivery(input) {
|
|
56941
57588
|
const value = await replayProjectDatabaseWebhookDelivery({
|
|
56942
|
-
"Idempotency-Key": input.idempotencyKey ??
|
|
57589
|
+
"Idempotency-Key": input.idempotencyKey ?? randomUUID5(),
|
|
56943
57590
|
project_id: input.projectId,
|
|
56944
57591
|
environment: input.environment,
|
|
56945
57592
|
delivery_id: input.deliveryId
|
|
@@ -57005,7 +57652,7 @@ var GeneratedSdkProductApi = class {
|
|
|
57005
57652
|
}
|
|
57006
57653
|
async runProjectDatabaseSchedule(input) {
|
|
57007
57654
|
const value = await runProjectDatabaseSchedule({
|
|
57008
|
-
"Idempotency-Key": input.idempotencyKey ??
|
|
57655
|
+
"Idempotency-Key": input.idempotencyKey ?? randomUUID5(),
|
|
57009
57656
|
project_id: input.projectId,
|
|
57010
57657
|
environment: input.environment,
|
|
57011
57658
|
name: input.name
|
|
@@ -57296,8 +57943,8 @@ var GeneratedSdkProductApi = class {
|
|
|
57296
57943
|
|
|
57297
57944
|
// apps/product-cli/dist/repository-init.js
|
|
57298
57945
|
import { createHash as createHash4 } from "node:crypto";
|
|
57299
|
-
import { lstat as
|
|
57300
|
-
import { dirname as
|
|
57946
|
+
import { lstat as lstat4, open as open6, readFile as readFile4, readdir as readdir5, stat as stat2 } from "node:fs/promises";
|
|
57947
|
+
import { dirname as dirname4, posix, resolve as resolve5 } from "node:path";
|
|
57301
57948
|
|
|
57302
57949
|
// packages/contracts/dist/framework-source-rules.js
|
|
57303
57950
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
@@ -58046,13 +58693,13 @@ function tanStackPluginContract(tokens, runtime) {
|
|
|
58046
58693
|
}
|
|
58047
58694
|
function closingBraces(tokens) {
|
|
58048
58695
|
const closing = tokens.map(() => -1);
|
|
58049
|
-
const
|
|
58696
|
+
const open7 = [];
|
|
58050
58697
|
tokens.forEach((token, index) => {
|
|
58051
58698
|
if (token.value === "{")
|
|
58052
|
-
|
|
58699
|
+
open7.push(index);
|
|
58053
58700
|
if (token.value !== "}")
|
|
58054
58701
|
return;
|
|
58055
|
-
const start =
|
|
58702
|
+
const start = open7.pop();
|
|
58056
58703
|
if (start !== void 0)
|
|
58057
58704
|
closing[start] = index;
|
|
58058
58705
|
});
|
|
@@ -59050,7 +59697,7 @@ async function workerModuleBlockers(context) {
|
|
|
59050
59697
|
const path2 = framework === "vite" ? VITE_COMPANION_ENTRY_PATH : WORKER_MODULE_PATH;
|
|
59051
59698
|
if (framework !== "functions" && !scheduled || !files.includes(path2))
|
|
59052
59699
|
return [];
|
|
59053
|
-
const source = await
|
|
59700
|
+
const source = await readFile4(resolve5(context.applicationDirectory, path2), "utf8");
|
|
59054
59701
|
return workerModuleFindings({ path: path2, source, fetch: framework === "functions", scheduled }).map((finding) => requiredCatalogBlocker(finding, context.applicationRoot));
|
|
59055
59702
|
}
|
|
59056
59703
|
function gatewaySourceTokens(source) {
|
|
@@ -59184,7 +59831,7 @@ async function gatewayBindingBlockers(context) {
|
|
|
59184
59831
|
const information = await stat2(absolute);
|
|
59185
59832
|
if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
|
|
59186
59833
|
continue;
|
|
59187
|
-
if (!usesGatewayBinding(await
|
|
59834
|
+
if (!usesGatewayBinding(await readFile4(absolute, "utf8")))
|
|
59188
59835
|
continue;
|
|
59189
59836
|
blockers.push({
|
|
59190
59837
|
code: "gateway_binding_unsupported",
|
|
@@ -59204,7 +59851,7 @@ async function storageClientBlockers(context) {
|
|
|
59204
59851
|
const information = await stat2(absolute);
|
|
59205
59852
|
if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
|
|
59206
59853
|
continue;
|
|
59207
|
-
if (callsStorageClient(await
|
|
59854
|
+
if (callsStorageClient(await readFile4(absolute, "utf8")))
|
|
59208
59855
|
return [];
|
|
59209
59856
|
}
|
|
59210
59857
|
return [
|
|
@@ -59226,7 +59873,7 @@ async function databaseContractBlockers(context, provider) {
|
|
|
59226
59873
|
const information = await stat2(absolute);
|
|
59227
59874
|
if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
|
|
59228
59875
|
continue;
|
|
59229
|
-
for (const code of databaseContractCodes(await
|
|
59876
|
+
for (const code of databaseContractCodes(await readFile4(absolute, "utf8")))
|
|
59230
59877
|
blockers.push(moduleBlocker(code, path2, context.applicationRoot));
|
|
59231
59878
|
}
|
|
59232
59879
|
return blockers;
|
|
@@ -59247,7 +59894,7 @@ async function socketPrimitiveBlockers(context) {
|
|
|
59247
59894
|
const information = await stat2(absolute);
|
|
59248
59895
|
if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
|
|
59249
59896
|
continue;
|
|
59250
|
-
if (importsSocketPrimitive(await
|
|
59897
|
+
if (importsSocketPrimitive(await readFile4(absolute, "utf8")))
|
|
59251
59898
|
blockers.push(moduleBlocker("socket_primitive_unsupported", path2, context.applicationRoot));
|
|
59252
59899
|
}
|
|
59253
59900
|
return blockers;
|
|
@@ -59283,7 +59930,7 @@ async function migrationSqlBlockers(context, provider) {
|
|
|
59283
59930
|
}
|
|
59284
59931
|
const migrations = await Promise.all(migrationPaths.map(async (path2) => Object.freeze({
|
|
59285
59932
|
path: path2,
|
|
59286
|
-
body: new Uint8Array(await
|
|
59933
|
+
body: new Uint8Array(await readFile4(resolve5(context.applicationDirectory, root, path2)))
|
|
59287
59934
|
})));
|
|
59288
59935
|
const blockers = [];
|
|
59289
59936
|
for (const migration of migrations) {
|
|
@@ -59334,7 +59981,7 @@ async function readExistingConfiguration(repositoryRoot, repositoryFiles, applic
|
|
|
59334
59981
|
if (!information.isFile() || information.size > MAXIMUM_CONFIGURATION_BYTES) {
|
|
59335
59982
|
throw new RepositoryInitError("repository_configuration_invalid", "ohmyhost.yaml must be one regular file of at most 64 KiB");
|
|
59336
59983
|
}
|
|
59337
|
-
const bytes = await
|
|
59984
|
+
const bytes = await readFile4(configurationPath);
|
|
59338
59985
|
const text = utf8(bytes);
|
|
59339
59986
|
const yaml = text ?? new TextDecoder().decode(bytes);
|
|
59340
59987
|
let parsed;
|
|
@@ -59454,7 +60101,7 @@ async function hasDirectApplicationShape(repositoryRoot, repositoryFiles, applic
|
|
|
59454
60101
|
}
|
|
59455
60102
|
async function isRealDirectory(path2) {
|
|
59456
60103
|
try {
|
|
59457
|
-
const information = await
|
|
60104
|
+
const information = await lstat4(path2);
|
|
59458
60105
|
return information.isDirectory() && !information.isSymbolicLink();
|
|
59459
60106
|
} catch {
|
|
59460
60107
|
return false;
|
|
@@ -59482,7 +60129,7 @@ function hasDirectSafeBuildCommand(manifest2, framework) {
|
|
|
59482
60129
|
async function assertRepositoryRoot(root) {
|
|
59483
60130
|
let information;
|
|
59484
60131
|
try {
|
|
59485
|
-
information = await
|
|
60132
|
+
information = await lstat4(root);
|
|
59486
60133
|
} catch {
|
|
59487
60134
|
throw new RepositoryInitError("repository_not_found", "Repository directory does not exist");
|
|
59488
60135
|
}
|
|
@@ -59492,10 +60139,10 @@ async function assertRepositoryRoot(root) {
|
|
|
59492
60139
|
if (!information.isDirectory()) {
|
|
59493
60140
|
throw new RepositoryInitError("repository_not_directory", "Repository path is not a directory");
|
|
59494
60141
|
}
|
|
59495
|
-
for (let ancestor = root; ; ancestor =
|
|
60142
|
+
for (let ancestor = root; ; ancestor = dirname4(ancestor)) {
|
|
59496
60143
|
let marker;
|
|
59497
60144
|
try {
|
|
59498
|
-
marker = await
|
|
60145
|
+
marker = await lstat4(resolve5(ancestor, ".git"));
|
|
59499
60146
|
} catch (error) {
|
|
59500
60147
|
if (error.code !== "ENOENT") {
|
|
59501
60148
|
throw new RepositoryInitError("repository_unreadable", "Could not determine the Git repository root");
|
|
@@ -59507,7 +60154,7 @@ async function assertRepositoryRoot(root) {
|
|
|
59507
60154
|
}
|
|
59508
60155
|
return;
|
|
59509
60156
|
}
|
|
59510
|
-
if (
|
|
60157
|
+
if (dirname4(ancestor) === ancestor)
|
|
59511
60158
|
return;
|
|
59512
60159
|
}
|
|
59513
60160
|
}
|
|
@@ -59518,20 +60165,20 @@ async function collectRepositoryFiles(root) {
|
|
|
59518
60165
|
const directory = directories.pop();
|
|
59519
60166
|
if (directory === void 0)
|
|
59520
60167
|
break;
|
|
59521
|
-
for (const entry of await
|
|
59522
|
-
const
|
|
60168
|
+
for (const entry of await readdir5(resolve5(root, directory), { withFileTypes: true })) {
|
|
60169
|
+
const relative4 = directory === "" ? entry.name : posix.join(directory, entry.name);
|
|
59523
60170
|
if (entry.isSymbolicLink()) {
|
|
59524
60171
|
throw new RepositoryInitError("repository_symlink_forbidden", "Repository symlinks are forbidden");
|
|
59525
60172
|
}
|
|
59526
60173
|
if (entry.isDirectory()) {
|
|
59527
60174
|
if (!IGNORED_DIRECTORIES.has(entry.name))
|
|
59528
|
-
directories.push(
|
|
60175
|
+
directories.push(relative4);
|
|
59529
60176
|
continue;
|
|
59530
60177
|
}
|
|
59531
60178
|
if (!entry.isFile()) {
|
|
59532
60179
|
throw new RepositoryInitError("repository_entry_unsafe", "Repository entry is unsafe");
|
|
59533
60180
|
}
|
|
59534
|
-
files.push(
|
|
60181
|
+
files.push(relative4);
|
|
59535
60182
|
if (files.length > MAXIMUM_REPOSITORY_FILES) {
|
|
59536
60183
|
throw new RepositoryInitError("repository_too_large", "Repository file limit exceeded");
|
|
59537
60184
|
}
|
|
@@ -59550,7 +60197,7 @@ async function readPackageJson(root) {
|
|
|
59550
60197
|
if (!information.isFile() || information.size > MAXIMUM_PACKAGE_BYTES) {
|
|
59551
60198
|
throw new RepositoryInitError("package_manifest_invalid", "package.json is invalid");
|
|
59552
60199
|
}
|
|
59553
|
-
const text = utf8(await
|
|
60200
|
+
const text = utf8(await readFile4(path2));
|
|
59554
60201
|
const manifest2 = text === null ? null : parsePackageManifest(text);
|
|
59555
60202
|
if (text === null || manifest2 === null) {
|
|
59556
60203
|
throw new RepositoryInitError("package_manifest_invalid", "package.json is invalid");
|
|
@@ -59565,7 +60212,7 @@ function utf8(bytes) {
|
|
|
59565
60212
|
}
|
|
59566
60213
|
}
|
|
59567
60214
|
async function readLeadingBytes(path2) {
|
|
59568
|
-
const handle = await
|
|
60215
|
+
const handle = await open6(path2, "r");
|
|
59569
60216
|
try {
|
|
59570
60217
|
const { size } = await handle.stat();
|
|
59571
60218
|
const bytes = new Uint8Array(Math.min(size, MAXIMUM_INSPECTED_FILE_BYTES));
|
|
@@ -59734,7 +60381,7 @@ async function detectR2Storage(root, files) {
|
|
|
59734
60381
|
const information = await stat2(path2);
|
|
59735
60382
|
if (!information.isFile() || information.size > MAXIMUM_CONFIGURATION_BYTES)
|
|
59736
60383
|
continue;
|
|
59737
|
-
const source = await
|
|
60384
|
+
const source = await readFile4(path2, "utf8");
|
|
59738
60385
|
if (/\br2_buckets\b/u.test(source))
|
|
59739
60386
|
return true;
|
|
59740
60387
|
}
|
|
@@ -59780,7 +60427,7 @@ function viteCompanionScaffold(files, capabilities) {
|
|
|
59780
60427
|
async function createConfiguration(root, configuration) {
|
|
59781
60428
|
let handle;
|
|
59782
60429
|
try {
|
|
59783
|
-
handle = await
|
|
60430
|
+
handle = await open6(resolve5(root, "ohmyhost.yaml"), "wx", 384);
|
|
59784
60431
|
await handle.writeFile(configuration, "utf8");
|
|
59785
60432
|
await handle.sync();
|
|
59786
60433
|
} catch (error) {
|
|
@@ -59801,8 +60448,8 @@ function isNodeError(value) {
|
|
|
59801
60448
|
}
|
|
59802
60449
|
|
|
59803
60450
|
// apps/product-cli/dist/composition.js
|
|
59804
|
-
import { randomUUID as
|
|
59805
|
-
import { join as
|
|
60451
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
60452
|
+
import { join as join8, resolve as resolve6 } from "node:path";
|
|
59806
60453
|
|
|
59807
60454
|
// packages/workos-auth-contracts/dist/device-flow.js
|
|
59808
60455
|
var WORKOS_AUTHKIT_DEVICE_AUTHORIZATION_ENDPOINT = "https://api.workos.com/user_management/authorize/device";
|
|
@@ -60379,9 +61026,11 @@ var runLocalPsql = async (input) => {
|
|
|
60379
61026
|
// apps/product-cli/dist/composition.js
|
|
60380
61027
|
var ProductApiAuthenticationError = class extends Error {
|
|
60381
61028
|
code;
|
|
60382
|
-
|
|
61029
|
+
record;
|
|
61030
|
+
constructor(code, record9) {
|
|
60383
61031
|
super(code);
|
|
60384
61032
|
this.code = code;
|
|
61033
|
+
this.record = record9;
|
|
60385
61034
|
this.name = "ProductApiAuthenticationError";
|
|
60386
61035
|
}
|
|
60387
61036
|
};
|
|
@@ -60441,7 +61090,7 @@ var createAuthenticatedProductTransport = async (signal, overrides = {}) => {
|
|
|
60441
61090
|
const bound = environmentProfile(overrides.environment);
|
|
60442
61091
|
const baseUrl = overrides.productApiOrigin ?? platform.apiOrigin;
|
|
60443
61092
|
const boundedFetch = createBoundedFetch(overrides.fetch ?? fetch, signal, REQUEST_TIMEOUT_MS, MAX_PUBLIC_RESPONSE_BYTES);
|
|
60444
|
-
const registry = overrides.profiles ??
|
|
61093
|
+
const registry = overrides.profiles ?? createProfileRegistry(platform.credentialService, overrides.platform);
|
|
60445
61094
|
const binding = overrides.request?.bindOrganization === true;
|
|
60446
61095
|
const request = profileRequest(overrides.request, bound);
|
|
60447
61096
|
if (apiToken !== void 0) {
|
|
@@ -60480,7 +61129,7 @@ var createAuthenticatedProductTransport = async (signal, overrides = {}) => {
|
|
|
60480
61129
|
const stored = await store.read();
|
|
60481
61130
|
if (stored === void 0)
|
|
60482
61131
|
throw missingLogin(profile, platform.commandPrefix);
|
|
60483
|
-
const credential = await currentCredential(stored, store, signal, now, refresher, () => registry.remove(profile));
|
|
61132
|
+
const credential = await currentCredential(stored, store, signal, now, refresher, registry, profile, () => registry.remove(profile));
|
|
60484
61133
|
return {
|
|
60485
61134
|
baseUrl,
|
|
60486
61135
|
accessToken: credential.accessToken,
|
|
@@ -60493,7 +61142,7 @@ var listSavedProfiles = async (signal, overrides = {}) => {
|
|
|
60493
61142
|
const platform = resolveProductCliEnvironment(overrides.environment);
|
|
60494
61143
|
const apiToken = environmentToken(overrides.environment);
|
|
60495
61144
|
const bound = environmentProfile(overrides.environment);
|
|
60496
|
-
const registry = overrides.profiles ??
|
|
61145
|
+
const registry = overrides.profiles ?? createProfileRegistry(platform.credentialService, overrides.platform);
|
|
60497
61146
|
const now = overrides.now ?? (() => /* @__PURE__ */ new Date());
|
|
60498
61147
|
const profiles = apiToken === void 0 ? await loadProfiles(registry, {
|
|
60499
61148
|
baseUrl: overrides.productApiOrigin ?? platform.apiOrigin,
|
|
@@ -60509,25 +61158,39 @@ var listSavedProfiles = async (signal, overrides = {}) => {
|
|
|
60509
61158
|
};
|
|
60510
61159
|
};
|
|
60511
61160
|
var missingLogin = (profile, commandPrefix) => new ProfileSelectionError("authentication_required", 5, `The saved login ${profile.name} has no credential on this computer. Run '${commandPrefix} login${profile.organizationId === null ? "" : ` --organization ${profile.organizationId}`} --profile-name ${profile.name} --json'.`);
|
|
60512
|
-
var currentCredential = async (stored, store, signal, now, tokenRefresher, forget) => {
|
|
60513
|
-
const
|
|
60514
|
-
|
|
61161
|
+
var currentCredential = async (stored, store, signal, now, tokenRefresher, registry, login, forget) => {
|
|
61162
|
+
const usable = (credential) => {
|
|
61163
|
+
const expiresAt = credential.expiresAt === void 0 ? NaN : Date.parse(credential.expiresAt);
|
|
61164
|
+
return Number.isFinite(expiresAt) && expiresAt > now().getTime() + REQUEST_TIMEOUT_MS;
|
|
61165
|
+
};
|
|
61166
|
+
if (usable(stored))
|
|
60515
61167
|
return stored;
|
|
60516
|
-
}
|
|
60517
61168
|
try {
|
|
60518
|
-
const
|
|
60519
|
-
|
|
60520
|
-
|
|
60521
|
-
|
|
60522
|
-
|
|
60523
|
-
|
|
60524
|
-
|
|
60525
|
-
|
|
61169
|
+
const renewal = await renewLogin({
|
|
61170
|
+
// A shared file store reads the credential again as the owner; a native store need not.
|
|
61171
|
+
...registry.kind === "file" ? {} : { current: stored },
|
|
61172
|
+
registry,
|
|
61173
|
+
login,
|
|
61174
|
+
store,
|
|
61175
|
+
usable,
|
|
61176
|
+
renew: async (credential) => {
|
|
61177
|
+
const refreshed = await tokenRefresher.refresh(credential.refreshToken, boundedSignal2(signal, REQUEST_TIMEOUT_MS), credential.workosOrganizationId);
|
|
61178
|
+
const refreshedExpiry = Date.parse(refreshed.expiresAt);
|
|
61179
|
+
if (refreshed.accessToken.length === 0 || refreshed.refreshToken.length === 0 || !Number.isFinite(refreshedExpiry) || refreshedExpiry <= now().getTime()) {
|
|
61180
|
+
throw new Error("invalid refreshed credential");
|
|
61181
|
+
}
|
|
61182
|
+
return { ...refreshed, ...workspaceOf(credential) };
|
|
61183
|
+
},
|
|
61184
|
+
rejected: (error) => error instanceof TokenRefreshRejectedError,
|
|
61185
|
+
forget,
|
|
61186
|
+
signal
|
|
61187
|
+
});
|
|
61188
|
+
return renewal.credential;
|
|
60526
61189
|
} catch (error) {
|
|
60527
|
-
if (error instanceof TokenRefreshRejectedError)
|
|
60528
|
-
await forget();
|
|
61190
|
+
if (error instanceof TokenRefreshRejectedError || error instanceof LoginGoneError)
|
|
60529
61191
|
throw new ProductApiAuthenticationError("authentication_required");
|
|
60530
|
-
|
|
61192
|
+
if (error instanceof LoginOwnershipTimeoutError)
|
|
61193
|
+
throw new ProductApiAuthenticationError("token_refresh_failed", error.record);
|
|
60531
61194
|
throw new ProductApiAuthenticationError("token_refresh_failed");
|
|
60532
61195
|
}
|
|
60533
61196
|
};
|
|
@@ -60541,7 +61204,7 @@ var loadProfiles = async (registry, context) => {
|
|
|
60541
61204
|
var migrateLegacyLogin = async (registry, legacy, stored, context) => {
|
|
60542
61205
|
let credential;
|
|
60543
61206
|
try {
|
|
60544
|
-
credential = await currentCredential(stored, legacy, context.signal, context.now, context.refresher, () => legacy.clear());
|
|
61207
|
+
credential = await currentCredential(stored, legacy, context.signal, context.now, context.refresher, registry, "legacy", () => legacy.clear());
|
|
60545
61208
|
} catch (error) {
|
|
60546
61209
|
if (error instanceof ProductApiAuthenticationError && error.code === "authentication_required")
|
|
60547
61210
|
return;
|
|
@@ -60561,8 +61224,9 @@ var migrateLegacyLogin = async (registry, legacy, stored, context) => {
|
|
|
60561
61224
|
const organizationName = organizationId === null ? null : (await api.getAccountProfile()).organizations.find((organization) => organization.id === organizationId)?.name ?? null;
|
|
60562
61225
|
const login = { userId, organizationId, organizationName };
|
|
60563
61226
|
await registry.save({ name: defaultProfileName(await registry.list(), login), ...login }, credential);
|
|
60564
|
-
await legacy.clear();
|
|
61227
|
+
await registry.owning(["legacy"], () => legacy.clear());
|
|
60565
61228
|
};
|
|
61229
|
+
var httpStatusOf = (error) => typeof error === "object" && error !== null && "status" in error && typeof error.status === "number" ? error.status : void 0;
|
|
60566
61230
|
var isProblem = (error, code) => typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
60567
61231
|
var verifyEnvironmentTokenContext = async (input) => {
|
|
60568
61232
|
const { request } = input;
|
|
@@ -60639,13 +61303,13 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60639
61303
|
} catch {
|
|
60640
61304
|
return { outcome: "none" };
|
|
60641
61305
|
}
|
|
60642
|
-
links = await readProjectLinks(
|
|
61306
|
+
links = await readProjectLinks(join8(selectedSourceDirectory, platform2.linkDirectory), platform2.apiOrigin);
|
|
60643
61307
|
let named = profileName;
|
|
60644
61308
|
try {
|
|
60645
61309
|
named ??= environmentProfile(environment);
|
|
60646
61310
|
} catch {
|
|
60647
61311
|
}
|
|
60648
|
-
const profiles = named === void 0 ? [] : await (overrides.profiles ??
|
|
61312
|
+
const profiles = named === void 0 ? [] : await (overrides.profiles ?? createProfileRegistry(platform2.credentialService, overrides.platform)).list();
|
|
60649
61313
|
return chooseLinkedProject(links, profiles.find((profile2) => profile2.name === named)?.organizationId ?? void 0);
|
|
60650
61314
|
});
|
|
60651
61315
|
command = parsed.command;
|
|
@@ -60657,11 +61321,11 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60657
61321
|
if (error instanceof LinkedProjectAmbiguousError)
|
|
60658
61322
|
return written(errorDocument(recognizedCommandLabel(args), 2, "linked_project_selection_required", false, `This directory is linked to projects of several organizations (${error.organizationIds.join(", ")}). Pass --project ULID, or choose the login with --profile-name NAME; '${resolveProductCliEnvironment(environment).commandPrefix} profile list --json' shows the saved logins.`));
|
|
60659
61323
|
if (error instanceof CredentialStoreUnavailableError)
|
|
60660
|
-
return written(errorDocument(recognizedCommandLabel(args), 3, "credential_store_unavailable", false,
|
|
61324
|
+
return written(errorDocument(recognizedCommandLabel(args), 3, "credential_store_unavailable", false, credentialStoreUnavailableAction(error)));
|
|
60661
61325
|
const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(args)));
|
|
60662
61326
|
if (!(error instanceof InvalidCommandError)) {
|
|
60663
61327
|
diagnostics.record({
|
|
60664
|
-
correlationId:
|
|
61328
|
+
correlationId: randomUUID6(),
|
|
60665
61329
|
category: "internal",
|
|
60666
61330
|
subsystem: "parser",
|
|
60667
61331
|
errorKind: "unexpected"
|
|
@@ -60717,8 +61381,8 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60717
61381
|
const handedAccount2 = command.kind === "secret-set" || command.kind === "native-auth" ? requiredToken ?? command.profileAccount : void 0;
|
|
60718
61382
|
if (requiredToken !== void 0 && apiToken === void 0)
|
|
60719
61383
|
return written(errorDocument(recognizedCommandLabel(args), 2, "environment_token_required", false, `This command runs only with OHMYHOST_TOKEN holding a key of user ${requiredToken.userId} in organization ${requiredToken.organizationId}; a saved login cannot run it. Load that key from its private env file into this process and retry. Nothing was sent.`));
|
|
60720
|
-
const registry = overrides.profiles ??
|
|
60721
|
-
const linkDirectory =
|
|
61384
|
+
const registry = overrides.profiles ?? createProfileRegistry(platform.credentialService, overrides.platform);
|
|
61385
|
+
const linkDirectory = join8(selectedSourceDirectory, platform.linkDirectory);
|
|
60722
61386
|
const projectId = commandProjectId(command);
|
|
60723
61387
|
if (projectId !== void 0 && linked === null)
|
|
60724
61388
|
links = await readProjectLinks(linkDirectory, platform.apiOrigin);
|
|
@@ -60803,7 +61467,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60803
61467
|
const result = compositionFailure(recognizedCommandLabel(args), error, signal, platform.commandPrefix, profile);
|
|
60804
61468
|
if (result.exitCode === 1)
|
|
60805
61469
|
diagnostics.record({
|
|
60806
|
-
correlationId:
|
|
61470
|
+
correlationId: randomUUID6(),
|
|
60807
61471
|
category: "internal",
|
|
60808
61472
|
subsystem: "authentication",
|
|
60809
61473
|
errorKind: "unexpected"
|
|
@@ -60814,7 +61478,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60814
61478
|
if (command.kind === "whoami" || command.kind === "login")
|
|
60815
61479
|
links = await readProjectLinks(linkDirectory, platform.apiOrigin);
|
|
60816
61480
|
const sourceOrganizationId = selected?.organizationId ?? (command.kind === "login" ? command.organizationId : void 0);
|
|
60817
|
-
const boundSource = sourceOrganizationId === null || sourceOrganizationId === void 0 ? links.links.length === 1 ? links.links[0] : void 0 : links.links.find((
|
|
61481
|
+
const boundSource = sourceOrganizationId === null || sourceOrganizationId === void 0 ? links.links.length === 1 ? links.links[0] : void 0 : links.links.find((link3) => link3.organization_id === sourceOrganizationId);
|
|
60818
61482
|
const productApiOrigin = platform.apiOrigin;
|
|
60819
61483
|
const lifecycle = new GeneratedSdkSessionRevoker({
|
|
60820
61484
|
environment,
|
|
@@ -60824,7 +61488,6 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60824
61488
|
const cli = new ProductCli({
|
|
60825
61489
|
sourceDirectory: workingDirectory,
|
|
60826
61490
|
sourceMetadataDirectory: platform.linkDirectory,
|
|
60827
|
-
sourceWorkspace: () => inspectSourceWorkspace(workingDirectory),
|
|
60828
61491
|
...boundSource === void 0 ? {} : {
|
|
60829
61492
|
linkedSourceProvider: boundSource.version === 3 ? boundSource.source.provider : "github",
|
|
60830
61493
|
linkedProjectId: boundSource.project_id
|
|
@@ -60845,6 +61508,21 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60845
61508
|
productApi: (accessToken, parentSignal) => new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch(parentSignal)),
|
|
60846
61509
|
// Login receives read-only identity, workspace and GitHub queries instead of the product surface.
|
|
60847
61510
|
accountProfile: async (accessToken) => await new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()).getAccountProfile(),
|
|
61511
|
+
firstWorkspace: async (accessToken, userId, signupSource) => {
|
|
61512
|
+
try {
|
|
61513
|
+
await new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()).createOrganization({
|
|
61514
|
+
name: "My workspace",
|
|
61515
|
+
idempotencyKey: `initial-workspace:${userId}`,
|
|
61516
|
+
...signupSource === null ? {} : { signupSource }
|
|
61517
|
+
});
|
|
61518
|
+
return "created";
|
|
61519
|
+
} catch (error) {
|
|
61520
|
+
if (signal.aborted)
|
|
61521
|
+
throw error;
|
|
61522
|
+
const status = httpStatusOf(error);
|
|
61523
|
+
return status !== void 0 && status >= 400 && status < 500 && status !== 408 && status !== 429 ? "refused" : "uncertain";
|
|
61524
|
+
}
|
|
61525
|
+
},
|
|
60848
61526
|
currentIdentity: async (accessToken) => await new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()).getCurrentIdentity(),
|
|
60849
61527
|
githubConnectionStatus: (accessToken, organizationId2) => getGithubOrganizationConnection({ organization_id: organizationId2 }, {
|
|
60850
61528
|
client: createClient({
|
|
@@ -60871,7 +61549,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
60871
61549
|
now,
|
|
60872
61550
|
waitUntil,
|
|
60873
61551
|
lifecycleTimeoutMs: REQUEST_TIMEOUT_MS,
|
|
60874
|
-
createCorrelationId:
|
|
61552
|
+
createCorrelationId: randomUUID6,
|
|
60875
61553
|
diagnosticSink: diagnostics,
|
|
60876
61554
|
operationEventSink: { write: (value) => io.writeStdout(value) },
|
|
60877
61555
|
readSecretValue: overrides.readSecretValue ?? ((readSignal) => readSecretValueFromStandardInput(process.stdin, readSignal)),
|
|
@@ -60917,8 +61595,10 @@ var compositionFailure = (command, error, signal, commandPrefix, profile) => {
|
|
|
60917
61595
|
return errorDocument(command, error.exitCode, error.code, false, error.suggestedAction);
|
|
60918
61596
|
if (error instanceof ProfileLimitError)
|
|
60919
61597
|
return errorDocument(command, 2, "profile_limit_reached", false, profileLimitAction(commandPrefix));
|
|
61598
|
+
if (error instanceof LoginOwnershipTimeoutError)
|
|
61599
|
+
return errorDocument(command, 5, "token_refresh_failed", true, refreshFailedAction(commandPrefix, profile, error.record));
|
|
60920
61600
|
if (error instanceof ProductApiAuthenticationError)
|
|
60921
|
-
return error.code === "authentication_required" ? errorDocument(command, 5, "authentication_required", false, endedLoginAction(commandPrefix, profile)) : errorDocument(command, 5, "token_refresh_failed", true, refreshFailedAction(commandPrefix, profile));
|
|
61601
|
+
return error.code === "authentication_required" ? errorDocument(command, 5, "authentication_required", false, endedLoginAction(commandPrefix, profile)) : errorDocument(command, 5, "token_refresh_failed", true, refreshFailedAction(commandPrefix, profile, error.record));
|
|
60922
61602
|
return classifyCliFailure(command, error, signal);
|
|
60923
61603
|
};
|
|
60924
61604
|
var runOfflineInit = async (command, io, diagnostics) => {
|
|
@@ -60959,7 +61639,7 @@ var runOfflineInit = async (command, io, diagnostics) => {
|
|
|
60959
61639
|
} catch (error) {
|
|
60960
61640
|
const known = error instanceof RepositoryInitError;
|
|
60961
61641
|
diagnostics.record({
|
|
60962
|
-
correlationId:
|
|
61642
|
+
correlationId: randomUUID6(),
|
|
60963
61643
|
category: known ? "configuration" : "internal",
|
|
60964
61644
|
subsystem: "runtime",
|
|
60965
61645
|
errorKind: known ? "invalid_response" : "unexpected"
|
|
@@ -61107,7 +61787,7 @@ var GeneratedSdkSessionRevoker = class {
|
|
|
61107
61787
|
fetch: transport.fetch,
|
|
61108
61788
|
throwOnError: true
|
|
61109
61789
|
});
|
|
61110
|
-
const result = await revokeCurrentSession({ "Idempotency-Key":
|
|
61790
|
+
const result = await revokeCurrentSession({ "Idempotency-Key": randomUUID6() }, { client: client2, signal });
|
|
61111
61791
|
if (result.revoked !== true)
|
|
61112
61792
|
throw new LifecycleTransportError();
|
|
61113
61793
|
} catch (error) {
|
|
@@ -61278,20 +61958,20 @@ var runOfflineLogout = async (registry, request, commandPrefix, io, diagnostics)
|
|
|
61278
61958
|
profile: publicProfile(selection.profile)
|
|
61279
61959
|
});
|
|
61280
61960
|
} else if (selection.outcome === "none" && request.name === void 0 && request.bound === void 0) {
|
|
61281
|
-
await registry.legacy().clear();
|
|
61961
|
+
await registry.owning(["legacy"], () => registry.legacy().clear());
|
|
61282
61962
|
result = resultDocument("logout", 0, "logged_out");
|
|
61283
61963
|
} else {
|
|
61284
61964
|
const failure2 = profileSelectionError(selection, request, commandPrefix, "cli");
|
|
61285
61965
|
result = errorDocument("logout", failure2.exitCode, failure2.code, false, failure2.suggestedAction);
|
|
61286
61966
|
}
|
|
61287
|
-
} catch {
|
|
61967
|
+
} catch (error) {
|
|
61288
61968
|
diagnostics.record({
|
|
61289
|
-
correlationId:
|
|
61969
|
+
correlationId: randomUUID6(),
|
|
61290
61970
|
category: "credential_store",
|
|
61291
61971
|
subsystem: "credential_store",
|
|
61292
61972
|
errorKind: "unavailable"
|
|
61293
61973
|
});
|
|
61294
|
-
result = errorDocument("logout", 3, "credential_store_unavailable", false,
|
|
61974
|
+
result = error instanceof LoginOwnershipTimeoutError ? errorDocument("logout", 5, "token_refresh_failed", true, `Another process on this computer holds this login (record ${error.record}) and did not finish in time; nothing was removed. Run the same command again in a minute.`) : errorDocument("logout", 3, "credential_store_unavailable", false, credentialStoreUnavailableAction(error));
|
|
61295
61975
|
}
|
|
61296
61976
|
io.writeStdout(result.stdout);
|
|
61297
61977
|
return result.exitCode;
|
|
@@ -61389,6 +62069,15 @@ export {
|
|
|
61389
62069
|
prepareLocalSourcePublication,
|
|
61390
62070
|
completeLocalSourcePublication,
|
|
61391
62071
|
inspectLocalSourcePublications,
|
|
62072
|
+
LoginGoneError,
|
|
62073
|
+
DIRECT_OWNERSHIP,
|
|
62074
|
+
renewLogin,
|
|
62075
|
+
LoginOwnershipTimeoutError,
|
|
62076
|
+
quietly,
|
|
62077
|
+
linuxProcessProbe,
|
|
62078
|
+
LoginOwnership,
|
|
62079
|
+
FileCredentialStoreRefusedError,
|
|
62080
|
+
OwnerOnlyFileCredentialStore,
|
|
61392
62081
|
UserTokenFileError,
|
|
61393
62082
|
PrivateSecretFileError,
|
|
61394
62083
|
preparePrivateSecretFile,
|
|
@@ -61400,6 +62089,8 @@ export {
|
|
|
61400
62089
|
sameLogin,
|
|
61401
62090
|
profileIndexDirectory,
|
|
61402
62091
|
NativeKeyringProfileRegistry,
|
|
62092
|
+
FileProfileRegistry,
|
|
62093
|
+
createProfileRegistry,
|
|
61403
62094
|
ProfileIndexFiles,
|
|
61404
62095
|
selectProfile,
|
|
61405
62096
|
selectProfileForOrganization,
|
|
@@ -61433,7 +62124,8 @@ export {
|
|
|
61433
62124
|
cliMetadataResult,
|
|
61434
62125
|
invalidCommandAction,
|
|
61435
62126
|
internalErrorAction,
|
|
61436
|
-
|
|
62127
|
+
describeFileStoreRefusal,
|
|
62128
|
+
credentialStoreUnavailableAction,
|
|
61437
62129
|
endedLoginAction,
|
|
61438
62130
|
refreshFailedAction,
|
|
61439
62131
|
ProductCli,
|