Erster Docker-Stand

This commit is contained in:
Ali
2026-02-20 16:06:40 +09:00
commit f31e2e8ed3
8818 changed files with 1605323 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import { asyncToStringMethod, hasAsyncToStringMethod, hasToStringMethod, toStringMethod, } from '../../../utils/stringify.js';
import { cloneMethod, hasCloneMethod } from '../../symbols.js';
export class CommandWrapper {
constructor(cmd) {
this.cmd = cmd;
this.hasRan = false;
if (hasToStringMethod(cmd)) {
const method = cmd[toStringMethod];
this[toStringMethod] = function toStringMethod() {
return method.call(cmd);
};
}
if (hasAsyncToStringMethod(cmd)) {
const method = cmd[asyncToStringMethod];
this[asyncToStringMethod] = function asyncToStringMethod() {
return method.call(cmd);
};
}
}
check(m) {
return this.cmd.check(m);
}
run(m, r) {
this.hasRan = true;
return this.cmd.run(m, r);
}
clone() {
if (hasCloneMethod(this.cmd))
return new CommandWrapper(this.cmd[cloneMethod]());
return new CommandWrapper(this.cmd);
}
toString() {
return this.cmd.toString();
}
}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,21 @@
import { cloneMethod } from '../../symbols.js';
export class CommandsIterable {
constructor(commands, metadataForReplay) {
this.commands = commands;
this.metadataForReplay = metadataForReplay;
}
[Symbol.iterator]() {
return this.commands[Symbol.iterator]();
}
[cloneMethod]() {
return new CommandsIterable(this.commands.map((c) => c.clone()), this.metadataForReplay);
}
toString() {
const serializedCommands = this.commands
.filter((c) => c.hasRan)
.map((c) => c.toString())
.join(',');
const metadata = this.metadataForReplay();
return metadata.length !== 0 ? `${serializedCommands} /*${metadata}*/` : serializedCommands;
}
}

View File

@@ -0,0 +1,53 @@
export class ScheduledCommand {
constructor(s, cmd) {
this.s = s;
this.cmd = cmd;
}
async check(m) {
let error = null;
let checkPassed = false;
const status = await this.s.scheduleSequence([
{
label: `check@${this.cmd.toString()}`,
builder: async () => {
try {
checkPassed = await Promise.resolve(this.cmd.check(m));
}
catch (err) {
error = err;
throw err;
}
},
},
]).task;
if (status.faulty) {
throw error;
}
return checkPassed;
}
async run(m, r) {
let error = null;
const status = await this.s.scheduleSequence([
{
label: `run@${this.cmd.toString()}`,
builder: async () => {
try {
await this.cmd.run(m, r);
}
catch (err) {
error = err;
throw err;
}
},
},
]).task;
if (status.faulty) {
throw error;
}
}
}
export const scheduleCommands = function* (s, cmds) {
for (const cmd of cmds) {
yield new ScheduledCommand(s, cmd);
}
};