@duplojs/server 0.0.0-stage → 0.1.0-beta.1
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 +9 -0
- package/dist/_virtual/_rolldown/runtime.cjs +33 -0
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/command/argument.cjs +27 -0
- package/dist/command/argument.d.ts +18 -0
- package/dist/command/argument.mjs +24 -0
- package/dist/command/create.cjs +94 -0
- package/dist/command/create.d.ts +47 -0
- package/dist/command/create.mjs +88 -0
- package/dist/command/error.cjs +153 -0
- package/dist/command/error.d.ts +53 -0
- package/dist/command/error.mjs +140 -0
- package/dist/command/exec.cjs +19 -0
- package/dist/command/exec.d.ts +13 -0
- package/dist/command/exec.mjs +17 -0
- package/dist/command/execOptions.cjs +41 -0
- package/dist/command/execOptions.d.ts +14 -0
- package/dist/command/execOptions.mjs +37 -0
- package/dist/command/help.cjs +257 -0
- package/dist/command/help.d.ts +10 -0
- package/dist/command/help.mjs +244 -0
- package/dist/command/index.cjs +78 -0
- package/dist/command/index.d.ts +8 -0
- package/dist/command/index.mjs +45 -0
- package/dist/command/kind.cjs +7 -0
- package/dist/command/kind.d.ts +2 -0
- package/dist/command/kind.mjs +5 -0
- package/dist/command/options/base.cjs +68 -0
- package/dist/command/options/base.d.ts +24 -0
- package/dist/command/options/base.mjs +63 -0
- package/dist/command/options/defaults/array.cjs +35 -0
- package/dist/command/options/defaults/array.d.ts +24 -0
- package/dist/command/options/defaults/array.mjs +29 -0
- package/dist/command/options/defaults/boolean.cjs +14 -0
- package/dist/command/options/defaults/boolean.d.ts +11 -0
- package/dist/command/options/defaults/boolean.mjs +13 -0
- package/dist/command/options/defaults/index.d.ts +3 -0
- package/dist/command/options/defaults/simple.cjs +25 -0
- package/dist/command/options/defaults/simple.d.ts +16 -0
- package/dist/command/options/defaults/simple.mjs +22 -0
- package/dist/command/options/identifier.cjs +7 -0
- package/dist/command/options/identifier.d.ts +4 -0
- package/dist/command/options/identifier.mjs +5 -0
- package/dist/command/options/index.d.ts +4 -0
- package/dist/command/options/types/index.d.ts +1 -0
- package/dist/command/options/types/options.d.ts +9 -0
- package/dist/command/types/eligibleType.d.ts +4 -0
- package/dist/command/types/forbiddenDuplicateName.d.ts +11 -0
- package/dist/command/types/index.d.ts +2 -0
- package/dist/common/environmentVariable/expandEnvironmentVariables.cjs +27 -0
- package/dist/common/environmentVariable/expandEnvironmentVariables.d.ts +2 -0
- package/dist/common/environmentVariable/expandEnvironmentVariables.mjs +22 -0
- package/dist/common/environmentVariable/index.cjs +47 -0
- package/dist/common/environmentVariable/index.d.ts +16 -0
- package/dist/common/environmentVariable/index.mjs +41 -0
- package/dist/common/environmentVariable/overrideEnvironmentVariables.cjs +13 -0
- package/dist/common/environmentVariable/overrideEnvironmentVariables.d.ts +3 -0
- package/dist/common/environmentVariable/overrideEnvironmentVariables.mjs +9 -0
- package/dist/common/environmentVariable/parseEnvironmentFiles.cjs +32 -0
- package/dist/common/environmentVariable/parseEnvironmentFiles.d.ts +4 -0
- package/dist/common/environmentVariable/parseEnvironmentFiles.mjs +26 -0
- package/dist/common/environmentVariableOrThrow.cjs +23 -0
- package/dist/common/environmentVariableOrThrow.d.ts +12 -0
- package/dist/common/environmentVariableOrThrow.mjs +19 -0
- package/dist/common/exitProcess.cjs +7 -0
- package/dist/common/exitProcess.d.ts +6 -0
- package/dist/common/exitProcess.mjs +8 -0
- package/dist/common/getCurrentWorkDirectory.cjs +15 -0
- package/dist/common/getCurrentWorkDirectory.d.ts +8 -0
- package/dist/common/getCurrentWorkDirectory.mjs +11 -0
- package/dist/common/getCurrentWorkDirectoryOrThrow.cjs +25 -0
- package/dist/common/getCurrentWorkDirectoryOrThrow.d.ts +8 -0
- package/dist/common/getCurrentWorkDirectoryOrThrow.mjs +20 -0
- package/dist/common/getProcessArguments.cjs +18 -0
- package/dist/common/getProcessArguments.d.ts +6 -0
- package/dist/common/getProcessArguments.mjs +18 -0
- package/dist/common/index.cjs +41 -0
- package/dist/common/index.d.ts +8 -0
- package/dist/common/index.mjs +25 -0
- package/dist/common/setCurrentWorkingDirectory.cjs +11 -0
- package/dist/common/setCurrentWorkingDirectory.d.ts +8 -0
- package/dist/common/setCurrentWorkingDirectory.mjs +9 -0
- package/dist/common/setCurrentWorkingDirectoryOrThrow.cjs +23 -0
- package/dist/common/setCurrentWorkingDirectoryOrThrow.d.ts +8 -0
- package/dist/common/setCurrentWorkingDirectoryOrThrow.mjs +18 -0
- package/dist/dataStructure/common/codec/defaults/index.d.ts +2 -0
- package/dist/dataStructure/common/codec/defaults/json.cjs +14 -0
- package/dist/dataStructure/common/codec/defaults/json.d.ts +9 -0
- package/dist/dataStructure/common/codec/defaults/json.mjs +11 -0
- package/dist/dataStructure/common/codec/defaults/string.cjs +14 -0
- package/dist/dataStructure/common/codec/defaults/string.d.ts +13 -0
- package/dist/dataStructure/common/codec/defaults/string.mjs +11 -0
- package/dist/dataStructure/common/codec/index.d.ts +1 -0
- package/dist/dataStructure/common/error/defaultInterpreter.cjs +27 -0
- package/dist/dataStructure/common/error/defaultInterpreter.d.ts +64 -0
- package/dist/dataStructure/common/error/defaultInterpreter.mjs +24 -0
- package/dist/dataStructure/common/error/index.d.ts +1 -0
- package/dist/dataStructure/common/index.d.ts +2 -0
- package/dist/dataStructure/constraint/exist.cjs +19 -0
- package/dist/dataStructure/constraint/exist.d.ts +10 -0
- package/dist/dataStructure/constraint/exist.mjs +15 -0
- package/dist/dataStructure/constraint/index.d.ts +4 -0
- package/dist/dataStructure/constraint/mimeType.cjs +18 -0
- package/dist/dataStructure/constraint/mimeType.d.ts +11 -0
- package/dist/dataStructure/constraint/mimeType.mjs +14 -0
- package/dist/dataStructure/constraint/size.cjs +29 -0
- package/dist/dataStructure/constraint/size.d.ts +16 -0
- package/dist/dataStructure/constraint/size.mjs +24 -0
- package/dist/dataStructure/constraint/types/constraints.d.ts +10 -0
- package/dist/dataStructure/constraint/types/index.d.ts +1 -0
- package/dist/dataStructure/fundamentalType/file.cjs +11 -0
- package/dist/dataStructure/fundamentalType/file.d.ts +8 -0
- package/dist/dataStructure/fundamentalType/file.mjs +8 -0
- package/dist/dataStructure/fundamentalType/index.d.ts +2 -0
- package/dist/dataStructure/fundamentalType/types/fundamentalTypes.d.ts +6 -0
- package/dist/dataStructure/fundamentalType/types/index.d.ts +1 -0
- package/dist/dataStructure/helper/exist.cjs +7 -0
- package/dist/dataStructure/helper/exist.d.ts +2 -0
- package/dist/dataStructure/helper/exist.mjs +7 -0
- package/dist/dataStructure/helper/file.cjs +10 -0
- package/dist/dataStructure/helper/file.d.ts +3 -0
- package/dist/dataStructure/helper/file.mjs +8 -0
- package/dist/dataStructure/helper/index.d.ts +4 -0
- package/dist/dataStructure/helper/mimeType.cjs +7 -0
- package/dist/dataStructure/helper/mimeType.d.ts +2 -0
- package/dist/dataStructure/helper/mimeType.mjs +7 -0
- package/dist/dataStructure/helper/size.cjs +7 -0
- package/dist/dataStructure/helper/size.d.ts +2 -0
- package/dist/dataStructure/helper/size.mjs +7 -0
- package/dist/dataStructure/index.cjs +62 -0
- package/dist/dataStructure/index.d.ts +6 -0
- package/dist/dataStructure/index.mjs +38 -0
- package/dist/dataStructure/kind.cjs +7 -0
- package/dist/dataStructure/kind.d.ts +2 -0
- package/dist/dataStructure/kind.mjs +5 -0
- package/dist/dataStructure/type/file.cjs +14 -0
- package/dist/dataStructure/type/file.d.ts +11 -0
- package/dist/dataStructure/type/file.mjs +11 -0
- package/dist/dataStructure/type/index.d.ts +2 -0
- package/dist/dataStructure/type/types/index.d.ts +1 -0
- package/dist/dataStructure/type/types/types.d.ts +6 -0
- package/dist/file/appendFile.cjs +43 -0
- package/dist/file/appendFile.d.ts +11 -0
- package/dist/file/appendFile.mjs +41 -0
- package/dist/file/appendTextFile.cjs +43 -0
- package/dist/file/appendTextFile.d.ts +11 -0
- package/dist/file/appendTextFile.mjs +41 -0
- package/dist/file/copy.cjs +31 -0
- package/dist/file/copy.d.ts +11 -0
- package/dist/file/copy.mjs +29 -0
- package/dist/file/createEntryInterface.cjs +16 -0
- package/dist/file/createEntryInterface.d.ts +3 -0
- package/dist/file/createEntryInterface.mjs +13 -0
- package/dist/file/ensureDirectory.cjs +32 -0
- package/dist/file/ensureDirectory.d.ts +10 -0
- package/dist/file/ensureDirectory.mjs +30 -0
- package/dist/file/ensureFile.cjs +38 -0
- package/dist/file/ensureFile.d.ts +10 -0
- package/dist/file/ensureFile.mjs +36 -0
- package/dist/file/exists.cjs +29 -0
- package/dist/file/exists.d.ts +10 -0
- package/dist/file/exists.mjs +27 -0
- package/dist/file/fileInterface.cjs +74 -0
- package/dist/file/fileInterface.d.ts +30 -0
- package/dist/file/fileInterface.mjs +69 -0
- package/dist/file/folderInterface.cjs +74 -0
- package/dist/file/folderInterface.d.ts +32 -0
- package/dist/file/folderInterface.mjs +69 -0
- package/dist/file/index.cjs +122 -0
- package/dist/file/index.d.ts +36 -0
- package/dist/file/index.mjs +79 -0
- package/dist/file/link.cjs +44 -0
- package/dist/file/link.d.ts +11 -0
- package/dist/file/link.mjs +42 -0
- package/dist/file/linkStat.cjs +84 -0
- package/dist/file/linkStat.d.ts +11 -0
- package/dist/file/linkStat.mjs +80 -0
- package/dist/file/makeDirectory.cjs +36 -0
- package/dist/file/makeDirectory.d.ts +14 -0
- package/dist/file/makeDirectory.mjs +34 -0
- package/dist/file/makeTemporaryDirectory.cjs +30 -0
- package/dist/file/makeTemporaryDirectory.d.ts +9 -0
- package/dist/file/makeTemporaryDirectory.mjs +28 -0
- package/dist/file/makeTemporaryFile.cjs +45 -0
- package/dist/file/makeTemporaryFile.d.ts +10 -0
- package/dist/file/makeTemporaryFile.mjs +41 -0
- package/dist/file/move.cjs +45 -0
- package/dist/file/move.d.ts +11 -0
- package/dist/file/move.mjs +43 -0
- package/dist/file/readDirectory.cjs +20 -0
- package/dist/file/readDirectory.d.ts +14 -0
- package/dist/file/readDirectory.mjs +18 -0
- package/dist/file/readFile.cjs +33 -0
- package/dist/file/readFile.d.ts +10 -0
- package/dist/file/readFile.mjs +31 -0
- package/dist/file/readJsonFile.cjs +33 -0
- package/dist/file/readJsonFile.d.ts +11 -0
- package/dist/file/readJsonFile.mjs +31 -0
- package/dist/file/readLink.cjs +30 -0
- package/dist/file/readLink.d.ts +10 -0
- package/dist/file/readLink.mjs +28 -0
- package/dist/file/readTextFile.cjs +33 -0
- package/dist/file/readTextFile.d.ts +10 -0
- package/dist/file/readTextFile.mjs +31 -0
- package/dist/file/realPath.cjs +28 -0
- package/dist/file/realPath.d.ts +10 -0
- package/dist/file/realPath.mjs +26 -0
- package/dist/file/relocate.cjs +56 -0
- package/dist/file/relocate.d.ts +11 -0
- package/dist/file/relocate.mjs +53 -0
- package/dist/file/remove.cjs +38 -0
- package/dist/file/remove.d.ts +14 -0
- package/dist/file/remove.mjs +36 -0
- package/dist/file/rename.cjs +56 -0
- package/dist/file/rename.d.ts +11 -0
- package/dist/file/rename.mjs +53 -0
- package/dist/file/setMode.cjs +51 -0
- package/dist/file/setMode.d.ts +26 -0
- package/dist/file/setMode.mjs +48 -0
- package/dist/file/setOwner.cjs +37 -0
- package/dist/file/setOwner.d.ts +15 -0
- package/dist/file/setOwner.mjs +35 -0
- package/dist/file/setTime.cjs +39 -0
- package/dist/file/setTime.d.ts +17 -0
- package/dist/file/setTime.mjs +36 -0
- package/dist/file/stat.cjs +85 -0
- package/dist/file/stat.d.ts +42 -0
- package/dist/file/stat.mjs +81 -0
- package/dist/file/symlink.cjs +42 -0
- package/dist/file/symlink.d.ts +19 -0
- package/dist/file/symlink.mjs +40 -0
- package/dist/file/truncate.cjs +38 -0
- package/dist/file/truncate.d.ts +10 -0
- package/dist/file/truncate.mjs +35 -0
- package/dist/file/types/fileSystemEither.d.ts +2 -0
- package/dist/file/types/index.d.ts +1 -0
- package/dist/file/unknownEntryInterface.cjs +36 -0
- package/dist/file/unknownEntryInterface.d.ts +15 -0
- package/dist/file/unknownEntryInterface.mjs +33 -0
- package/dist/file/walkDirectory.cjs +34 -0
- package/dist/file/walkDirectory.d.ts +16 -0
- package/dist/file/walkDirectory.mjs +28 -0
- package/dist/file/writeFile.cjs +44 -0
- package/dist/file/writeFile.d.ts +11 -0
- package/dist/file/writeFile.mjs +42 -0
- package/dist/file/writeJsonFile.cjs +56 -0
- package/dist/file/writeJsonFile.d.ts +15 -0
- package/dist/file/writeJsonFile.mjs +53 -0
- package/dist/file/writeTextFile.cjs +44 -0
- package/dist/file/writeTextFile.d.ts +11 -0
- package/dist/file/writeTextFile.mjs +42 -0
- package/dist/implementor.cjs +64 -0
- package/dist/implementor.d.ts +35 -0
- package/dist/implementor.mjs +52 -0
- package/dist/index.cjs +74 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +14 -0
- package/dist/kind.cjs +7 -0
- package/dist/kind.d.ts +2 -0
- package/dist/kind.mjs +5 -0
- package/package.json +81 -3
- package/README.md +0 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_getCurrentWorkDirectory = require("./getCurrentWorkDirectory.cjs");
|
|
3
|
+
const require_kind = require("../kind.cjs");
|
|
4
|
+
let _duplojs_lang_common = require("@duplojs/lang/common");
|
|
5
|
+
_duplojs_lang_common = require_runtime.__toESM(_duplojs_lang_common, 1);
|
|
6
|
+
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
7
|
+
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
8
|
+
let _duplojs_lang_kind = require("@duplojs/lang/kind");
|
|
9
|
+
_duplojs_lang_kind = require_runtime.__toESM(_duplojs_lang_kind, 1);
|
|
10
|
+
//#region scripts/common/getCurrentWorkDirectoryOrThrow.ts
|
|
11
|
+
var GetCurrentWorkDirectoryError = class extends _duplojs_lang_kind.parentClass(require_kind.createKind("environment-variable-error"), Error) {
|
|
12
|
+
error;
|
|
13
|
+
constructor(error) {
|
|
14
|
+
super(null, "Failed to retrieve the current directory path.");
|
|
15
|
+
this.error = error;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function getCurrentWorkDirectoryOrThrow() {
|
|
19
|
+
return _duplojs_lang_either.whenIsRightOtherwise(require_getCurrentWorkDirectory.getCurrentWorkDirectory(), _duplojs_lang_common.forward, (result) => {
|
|
20
|
+
throw new GetCurrentWorkDirectoryError(_duplojs_lang_either.unwrapLeft(result));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.GetCurrentWorkDirectoryError = GetCurrentWorkDirectoryError;
|
|
25
|
+
exports.getCurrentWorkDirectoryOrThrow = getCurrentWorkDirectoryOrThrow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DKind from "@duplojs/lang/kind";
|
|
2
|
+
declare const GetCurrentWorkDirectoryError_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsServer/environment-variable-error", unknown>>, ErrorConstructor>;
|
|
3
|
+
export declare class GetCurrentWorkDirectoryError extends GetCurrentWorkDirectoryError_base {
|
|
4
|
+
error: unknown;
|
|
5
|
+
constructor(error: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare function getCurrentWorkDirectoryOrThrow(): string & import('@duplojs/lang/path').Absolute;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getCurrentWorkDirectory } from "./getCurrentWorkDirectory.mjs";
|
|
2
|
+
import { createKind } from "../kind.mjs";
|
|
3
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
4
|
+
import * as DEither from "@duplojs/lang/either";
|
|
5
|
+
import * as DKind from "@duplojs/lang/kind";
|
|
6
|
+
//#region scripts/common/getCurrentWorkDirectoryOrThrow.ts
|
|
7
|
+
var GetCurrentWorkDirectoryError = class extends DKind.parentClass(createKind("environment-variable-error"), Error) {
|
|
8
|
+
error;
|
|
9
|
+
constructor(error) {
|
|
10
|
+
super(null, "Failed to retrieve the current directory path.");
|
|
11
|
+
this.error = error;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function getCurrentWorkDirectoryOrThrow() {
|
|
15
|
+
return DEither.whenIsRightOtherwise(getCurrentWorkDirectory(), DCommon.forward, (result) => {
|
|
16
|
+
throw new GetCurrentWorkDirectoryError(DEither.unwrapLeft(result));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { GetCurrentWorkDirectoryError, getCurrentWorkDirectoryOrThrow };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_implementor = require("../implementor.cjs");
|
|
2
|
+
//#region scripts/common/getProcessArguments.ts
|
|
3
|
+
let args = void 0;
|
|
4
|
+
const getProcessArguments = require_implementor.implementFunction("getProcessArguments", {
|
|
5
|
+
NODE: () => {
|
|
6
|
+
if (args) return args;
|
|
7
|
+
args = process.argv.slice(2);
|
|
8
|
+
return args;
|
|
9
|
+
},
|
|
10
|
+
DENO: () => Deno.args,
|
|
11
|
+
BUN: () => {
|
|
12
|
+
if (args) return args;
|
|
13
|
+
args = Bun.argv.slice(2);
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.getProcessArguments = getProcessArguments;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { implementFunction } from "../implementor.mjs";
|
|
2
|
+
//#region scripts/common/getProcessArguments.ts
|
|
3
|
+
let args = void 0;
|
|
4
|
+
const getProcessArguments = implementFunction("getProcessArguments", {
|
|
5
|
+
NODE: () => {
|
|
6
|
+
if (args) return args;
|
|
7
|
+
args = process.argv.slice(2);
|
|
8
|
+
return args;
|
|
9
|
+
},
|
|
10
|
+
DENO: () => Deno.args,
|
|
11
|
+
BUN: () => {
|
|
12
|
+
if (args) return args;
|
|
13
|
+
args = Bun.argv.slice(2);
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { getProcessArguments };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_getCurrentWorkDirectory = require("./getCurrentWorkDirectory.cjs");
|
|
3
|
+
const require_getCurrentWorkDirectoryOrThrow = require("./getCurrentWorkDirectoryOrThrow.cjs");
|
|
4
|
+
const require_setCurrentWorkingDirectory = require("./setCurrentWorkingDirectory.cjs");
|
|
5
|
+
const require_setCurrentWorkingDirectoryOrThrow = require("./setCurrentWorkingDirectoryOrThrow.cjs");
|
|
6
|
+
const require_index = require("./environmentVariable/index.cjs");
|
|
7
|
+
const require_environmentVariableOrThrow = require("./environmentVariableOrThrow.cjs");
|
|
8
|
+
const require_exitProcess = require("./exitProcess.cjs");
|
|
9
|
+
const require_getProcessArguments = require("./getProcessArguments.cjs");
|
|
10
|
+
//#region scripts/common/index.ts
|
|
11
|
+
var common_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
12
|
+
EnvironmentVariableError: () => require_environmentVariableOrThrow.EnvironmentVariableError,
|
|
13
|
+
GetCurrentWorkDirectoryError: () => require_getCurrentWorkDirectoryOrThrow.GetCurrentWorkDirectoryError,
|
|
14
|
+
SetCurrentWorkingDirectoryError: () => require_setCurrentWorkingDirectoryOrThrow.SetCurrentWorkingDirectoryError,
|
|
15
|
+
environmentVariable: () => require_index.environmentVariable,
|
|
16
|
+
environmentVariableOrThrow: () => require_environmentVariableOrThrow.environmentVariableOrThrow,
|
|
17
|
+
exitProcess: () => require_exitProcess.exitProcess,
|
|
18
|
+
getCurrentWorkDirectory: () => require_getCurrentWorkDirectory.getCurrentWorkDirectory,
|
|
19
|
+
getCurrentWorkDirectoryOrThrow: () => require_getCurrentWorkDirectoryOrThrow.getCurrentWorkDirectoryOrThrow,
|
|
20
|
+
getProcessArguments: () => require_getProcessArguments.getProcessArguments,
|
|
21
|
+
setCurrentWorkingDirectory: () => require_setCurrentWorkingDirectory.setCurrentWorkingDirectory,
|
|
22
|
+
setCurrentWorkingDirectoryOrThrow: () => require_setCurrentWorkingDirectoryOrThrow.setCurrentWorkingDirectoryOrThrow
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.EnvironmentVariableError = require_environmentVariableOrThrow.EnvironmentVariableError;
|
|
26
|
+
exports.GetCurrentWorkDirectoryError = require_getCurrentWorkDirectoryOrThrow.GetCurrentWorkDirectoryError;
|
|
27
|
+
exports.SetCurrentWorkingDirectoryError = require_setCurrentWorkingDirectoryOrThrow.SetCurrentWorkingDirectoryError;
|
|
28
|
+
Object.defineProperty(exports, "common_exports", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function() {
|
|
31
|
+
return common_exports;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.environmentVariable = require_index.environmentVariable;
|
|
35
|
+
exports.environmentVariableOrThrow = require_environmentVariableOrThrow.environmentVariableOrThrow;
|
|
36
|
+
exports.exitProcess = require_exitProcess.exitProcess;
|
|
37
|
+
exports.getCurrentWorkDirectory = require_getCurrentWorkDirectory.getCurrentWorkDirectory;
|
|
38
|
+
exports.getCurrentWorkDirectoryOrThrow = require_getCurrentWorkDirectoryOrThrow.getCurrentWorkDirectoryOrThrow;
|
|
39
|
+
exports.getProcessArguments = require_getProcessArguments.getProcessArguments;
|
|
40
|
+
exports.setCurrentWorkingDirectory = require_setCurrentWorkingDirectory.setCurrentWorkingDirectory;
|
|
41
|
+
exports.setCurrentWorkingDirectoryOrThrow = require_setCurrentWorkingDirectoryOrThrow.setCurrentWorkingDirectoryOrThrow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './getCurrentWorkDirectory';
|
|
2
|
+
export * from './getCurrentWorkDirectoryOrThrow';
|
|
3
|
+
export * from './setCurrentWorkingDirectory';
|
|
4
|
+
export * from './setCurrentWorkingDirectoryOrThrow';
|
|
5
|
+
export * from './environmentVariable';
|
|
6
|
+
export * from './environmentVariableOrThrow';
|
|
7
|
+
export * from './exitProcess';
|
|
8
|
+
export * from './getProcessArguments';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { getCurrentWorkDirectory } from "./getCurrentWorkDirectory.mjs";
|
|
3
|
+
import { GetCurrentWorkDirectoryError, getCurrentWorkDirectoryOrThrow } from "./getCurrentWorkDirectoryOrThrow.mjs";
|
|
4
|
+
import { setCurrentWorkingDirectory } from "./setCurrentWorkingDirectory.mjs";
|
|
5
|
+
import { SetCurrentWorkingDirectoryError, setCurrentWorkingDirectoryOrThrow } from "./setCurrentWorkingDirectoryOrThrow.mjs";
|
|
6
|
+
import { environmentVariable } from "./environmentVariable/index.mjs";
|
|
7
|
+
import { EnvironmentVariableError, environmentVariableOrThrow } from "./environmentVariableOrThrow.mjs";
|
|
8
|
+
import { exitProcess } from "./exitProcess.mjs";
|
|
9
|
+
import { getProcessArguments } from "./getProcessArguments.mjs";
|
|
10
|
+
//#region scripts/common/index.ts
|
|
11
|
+
var common_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
EnvironmentVariableError: () => EnvironmentVariableError,
|
|
13
|
+
GetCurrentWorkDirectoryError: () => GetCurrentWorkDirectoryError,
|
|
14
|
+
SetCurrentWorkingDirectoryError: () => SetCurrentWorkingDirectoryError,
|
|
15
|
+
environmentVariable: () => environmentVariable,
|
|
16
|
+
environmentVariableOrThrow: () => environmentVariableOrThrow,
|
|
17
|
+
exitProcess: () => exitProcess,
|
|
18
|
+
getCurrentWorkDirectory: () => getCurrentWorkDirectory,
|
|
19
|
+
getCurrentWorkDirectoryOrThrow: () => getCurrentWorkDirectoryOrThrow,
|
|
20
|
+
getProcessArguments: () => getProcessArguments,
|
|
21
|
+
setCurrentWorkingDirectory: () => setCurrentWorkingDirectory,
|
|
22
|
+
setCurrentWorkingDirectoryOrThrow: () => setCurrentWorkingDirectoryOrThrow
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { EnvironmentVariableError, GetCurrentWorkDirectoryError, SetCurrentWorkingDirectoryError, common_exports, environmentVariable, environmentVariableOrThrow, exitProcess, getCurrentWorkDirectory, getCurrentWorkDirectoryOrThrow, getProcessArguments, setCurrentWorkingDirectory, setCurrentWorkingDirectoryOrThrow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_implementor = require("../implementor.cjs");
|
|
3
|
+
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
4
|
+
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
5
|
+
//#region scripts/common/setCurrentWorkingDirectory.ts
|
|
6
|
+
const setCurrentWorkingDirectory = require_implementor.implementFunction("setCurrentWorkingDirectory", {
|
|
7
|
+
NODE: (path) => _duplojs_lang_either.whenIsRightOtherwise(_duplojs_lang_either.safeCallback(() => void process.chdir(path)), _duplojs_lang_either.ok, _duplojs_lang_either.fail),
|
|
8
|
+
DENO: (path) => _duplojs_lang_either.whenIsRightOtherwise(_duplojs_lang_either.safeCallback(() => void Deno.chdir(path)), _duplojs_lang_either.ok, _duplojs_lang_either.fail)
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.setCurrentWorkingDirectory = setCurrentWorkingDirectory;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DEither from "@duplojs/lang/either";
|
|
2
|
+
import type * as DPath from "@duplojs/lang/path";
|
|
3
|
+
declare module '../implementor' {
|
|
4
|
+
interface ServerFunction {
|
|
5
|
+
setCurrentWorkingDirectory(path: string & DPath.Absolute): DEither.Fail | DEither.Ok;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare const setCurrentWorkingDirectory: (path: string & DPath.Absolute) => DEither.Fail | DEither.Ok;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { implementFunction } from "../implementor.mjs";
|
|
2
|
+
import * as DEither from "@duplojs/lang/either";
|
|
3
|
+
//#region scripts/common/setCurrentWorkingDirectory.ts
|
|
4
|
+
const setCurrentWorkingDirectory = implementFunction("setCurrentWorkingDirectory", {
|
|
5
|
+
NODE: (path) => DEither.whenIsRightOtherwise(DEither.safeCallback(() => void process.chdir(path)), DEither.ok, DEither.fail),
|
|
6
|
+
DENO: (path) => DEither.whenIsRightOtherwise(DEither.safeCallback(() => void Deno.chdir(path)), DEither.ok, DEither.fail)
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { setCurrentWorkingDirectory };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_kind = require("../kind.cjs");
|
|
3
|
+
const require_setCurrentWorkingDirectory = require("./setCurrentWorkingDirectory.cjs");
|
|
4
|
+
let _duplojs_lang_common = require("@duplojs/lang/common");
|
|
5
|
+
_duplojs_lang_common = require_runtime.__toESM(_duplojs_lang_common, 1);
|
|
6
|
+
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
7
|
+
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
8
|
+
let _duplojs_lang_kind = require("@duplojs/lang/kind");
|
|
9
|
+
_duplojs_lang_kind = require_runtime.__toESM(_duplojs_lang_kind, 1);
|
|
10
|
+
//#region scripts/common/setCurrentWorkingDirectoryOrThrow.ts
|
|
11
|
+
var SetCurrentWorkingDirectoryError = class extends _duplojs_lang_kind.parentClass(require_kind.createKind("set-working-directory-error"), Error) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super({}, "Failed to set current working directory");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function setCurrentWorkingDirectoryOrThrow(path) {
|
|
17
|
+
_duplojs_lang_either.whenIsRightOtherwise(require_setCurrentWorkingDirectory.setCurrentWorkingDirectory(path), _duplojs_lang_common.forward, () => {
|
|
18
|
+
throw new SetCurrentWorkingDirectoryError();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.SetCurrentWorkingDirectoryError = SetCurrentWorkingDirectoryError;
|
|
23
|
+
exports.setCurrentWorkingDirectoryOrThrow = setCurrentWorkingDirectoryOrThrow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DKind from "@duplojs/lang/kind";
|
|
2
|
+
import type * as DPath from "@duplojs/lang/path";
|
|
3
|
+
declare const SetCurrentWorkingDirectoryError_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsServer/set-working-directory-error", unknown>>, ErrorConstructor>;
|
|
4
|
+
export declare class SetCurrentWorkingDirectoryError extends SetCurrentWorkingDirectoryError_base {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare function setCurrentWorkingDirectoryOrThrow(path: string & DPath.Absolute): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createKind } from "../kind.mjs";
|
|
2
|
+
import { setCurrentWorkingDirectory } from "./setCurrentWorkingDirectory.mjs";
|
|
3
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
4
|
+
import * as DEither from "@duplojs/lang/either";
|
|
5
|
+
import * as DKind from "@duplojs/lang/kind";
|
|
6
|
+
//#region scripts/common/setCurrentWorkingDirectoryOrThrow.ts
|
|
7
|
+
var SetCurrentWorkingDirectoryError = class extends DKind.parentClass(createKind("set-working-directory-error"), Error) {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({}, "Failed to set current working directory");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function setCurrentWorkingDirectoryOrThrow(path) {
|
|
13
|
+
DEither.whenIsRightOtherwise(setCurrentWorkingDirectory(path), DCommon.forward, () => {
|
|
14
|
+
throw new SetCurrentWorkingDirectoryError();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { SetCurrentWorkingDirectoryError, setCurrentWorkingDirectoryOrThrow };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_fileInterface = require("../../../../file/fileInterface.cjs");
|
|
3
|
+
const require_file = require("../../../fundamentalType/file.cjs");
|
|
4
|
+
let _duplojs_lang_path = require("@duplojs/lang/path");
|
|
5
|
+
_duplojs_lang_path = require_runtime.__toESM(_duplojs_lang_path, 1);
|
|
6
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
7
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
8
|
+
//#region scripts/dataStructure/common/codec/defaults/json.ts
|
|
9
|
+
const codecsJson = _duplojs_lang_dataStructure.createCodecs({
|
|
10
|
+
..._duplojs_lang_dataStructure.codecsJson.definition,
|
|
11
|
+
file: _duplojs_lang_dataStructure.createCodec(require_file.TheFile, (data) => typeof data === "string" && _duplojs_lang_path.is(data), (data) => data.path, (data) => require_fileInterface.createFileInterface(data))
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.codecsJson = codecsJson;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as DPath from "@duplojs/lang/path";
|
|
2
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
3
|
+
import * as FundamentalType from "../../../fundamentalType";
|
|
4
|
+
export declare const codecsJson: DDataStructure.Codecs<{
|
|
5
|
+
file: DDataStructure.Codec<FundamentalType.TheFile, string & DPath.Path>;
|
|
6
|
+
bigint: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheBigint, string>;
|
|
7
|
+
date: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheDate, string>;
|
|
8
|
+
time: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheTime, string>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFileInterface } from "../../../../file/fileInterface.mjs";
|
|
2
|
+
import { TheFile } from "../../../fundamentalType/file.mjs";
|
|
3
|
+
import * as DPath from "@duplojs/lang/path";
|
|
4
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
5
|
+
//#region scripts/dataStructure/common/codec/defaults/json.ts
|
|
6
|
+
const codecsJson = DDataStructure.createCodecs({
|
|
7
|
+
...DDataStructure.codecsJson.definition,
|
|
8
|
+
file: DDataStructure.createCodec(TheFile, (data) => typeof data === "string" && DPath.is(data), (data) => data.path, (data) => createFileInterface(data))
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { codecsJson };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_fileInterface = require("../../../../file/fileInterface.cjs");
|
|
3
|
+
const require_file = require("../../../fundamentalType/file.cjs");
|
|
4
|
+
let _duplojs_lang_path = require("@duplojs/lang/path");
|
|
5
|
+
_duplojs_lang_path = require_runtime.__toESM(_duplojs_lang_path, 1);
|
|
6
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
7
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
8
|
+
//#region scripts/dataStructure/common/codec/defaults/string.ts
|
|
9
|
+
const codecsString = _duplojs_lang_dataStructure.createCodecs({
|
|
10
|
+
..._duplojs_lang_dataStructure.codecsString.definition,
|
|
11
|
+
file: _duplojs_lang_dataStructure.createCodec(require_file.TheFile, (data) => typeof data === "string" && _duplojs_lang_path.is(data), (data) => data.path, (data) => require_fileInterface.createFileInterface(data))
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.codecsString = codecsString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as DPath from "@duplojs/lang/path";
|
|
2
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
3
|
+
import * as FundamentalType from "../../../fundamentalType";
|
|
4
|
+
export declare const codecsString: DDataStructure.Codecs<{
|
|
5
|
+
file: DDataStructure.Codec<FundamentalType.TheFile, string & DPath.Path>;
|
|
6
|
+
bigint: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheBigint, string>;
|
|
7
|
+
boolean: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheBoolean, "true" | "false">;
|
|
8
|
+
date: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheDate, string>;
|
|
9
|
+
null: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheNull, "null">;
|
|
10
|
+
number: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheNumber, string & import('@duplojs/lang/string').Number>;
|
|
11
|
+
time: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheTime, string>;
|
|
12
|
+
undefined: import('@duplojs/lang/dataStructure').Codec<DDataStructure.TheUndefined, "undefined" | undefined>;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFileInterface } from "../../../../file/fileInterface.mjs";
|
|
2
|
+
import { TheFile } from "../../../fundamentalType/file.mjs";
|
|
3
|
+
import * as DPath from "@duplojs/lang/path";
|
|
4
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
5
|
+
//#region scripts/dataStructure/common/codec/defaults/string.ts
|
|
6
|
+
const codecsString = DDataStructure.createCodecs({
|
|
7
|
+
...DDataStructure.codecsString.definition,
|
|
8
|
+
file: DDataStructure.createCodec(TheFile, (data) => typeof data === "string" && DPath.is(data), (data) => data.path, (data) => createFileInterface(data))
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { codecsString };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defaults';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_json = require("../codec/defaults/json.cjs");
|
|
3
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
4
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
5
|
+
//#region scripts/dataStructure/common/error/defaultInterpreter.ts
|
|
6
|
+
const defaultErrorInterpreterDataStructureDictionary = {
|
|
7
|
+
..._duplojs_lang_dataStructure.defaultErrorInterpreterDataStructureDictionary,
|
|
8
|
+
"@DuplojsServerDataStructure/file-type": () => "Expected a valid file.",
|
|
9
|
+
"@DuplojsServerDataStructure/size-constraint": (source) => {
|
|
10
|
+
const { min, max } = source.definition;
|
|
11
|
+
if (min !== void 0 && max !== void 0) return `Expected a file size between ${min} and ${max} bytes.`;
|
|
12
|
+
if (min !== void 0) return `Expected a file size of at least ${min} bytes.`;
|
|
13
|
+
if (max !== void 0) return `Expected a file size of at most ${max} bytes.`;
|
|
14
|
+
return "Expected a valid file size.";
|
|
15
|
+
},
|
|
16
|
+
"@DuplojsServerDataStructure/mime-type-constraint": (source) => `Expected a file with a MIME type matching ${source.definition.regex.toString()}.`,
|
|
17
|
+
"@DuplojsServerDataStructure/exist-constraint": () => "Expected the file to exist."
|
|
18
|
+
};
|
|
19
|
+
const defaultErrorInterpreterCodecDictionary = [..._duplojs_lang_dataStructure.defaultErrorInterpreterCodecDictionary, [require_json.codecsJson.definition.file, (_codec, issue) => {
|
|
20
|
+
if (issue.from === "predicate") return _duplojs_lang_dataStructure.encodeIssueKind.has(issue) ? "The JSON file codec must produce a valid file path string." : "Expected a valid file path string for the JSON file codec.";
|
|
21
|
+
if (issue.from === "encoding") return "The JSON file codec could not encode the file.";
|
|
22
|
+
if (issue.from === "decoding") return "The JSON file codec could not decode the value as a file.";
|
|
23
|
+
return `The JSON file codec encountered an external error while ${_duplojs_lang_dataStructure.encodeIssueKind.has(issue) ? "encoding" : "decoding"}.`;
|
|
24
|
+
}]];
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.defaultErrorInterpreterCodecDictionary = defaultErrorInterpreterCodecDictionary;
|
|
27
|
+
exports.defaultErrorInterpreterDataStructureDictionary = defaultErrorInterpreterDataStructureDictionary;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
2
|
+
export declare const defaultErrorInterpreterDataStructureDictionary: {
|
|
3
|
+
readonly "@DuplojsServerDataStructure/file-type": () => string;
|
|
4
|
+
readonly "@DuplojsServerDataStructure/size-constraint": (source: import('../..').SizeConstraint) => string;
|
|
5
|
+
readonly "@DuplojsServerDataStructure/mime-type-constraint": (source: import('../..').MimeTypeConstraint) => string;
|
|
6
|
+
readonly "@DuplojsServerDataStructure/exist-constraint": () => string;
|
|
7
|
+
readonly "@DuplojsLangDataStructure/array-structure": () => string;
|
|
8
|
+
readonly "@DuplojsLangDataStructure/lazy-structure": () => string;
|
|
9
|
+
readonly "@DuplojsLangDataStructure/non-encodable-string-structure": (source: import('@duplojs/lang/dataStructure').NonEncodableStringStructure) => string;
|
|
10
|
+
readonly "@DuplojsLangDataStructure/object-structure": () => string;
|
|
11
|
+
readonly "@DuplojsLangDataStructure/record-structure": () => string;
|
|
12
|
+
readonly "@DuplojsLangDataStructure/type-structure": () => string;
|
|
13
|
+
readonly "@DuplojsLangDataStructure/union-structure": () => string;
|
|
14
|
+
readonly "@DuplojsLangDataStructure/bigint-type": () => string;
|
|
15
|
+
readonly "@DuplojsLangDataStructure/bigint-literal-type": (source: import('@duplojs/lang/dataStructure').BigintLiteralType<bigint>) => string;
|
|
16
|
+
readonly "@DuplojsLangDataStructure/boolean-type": () => string;
|
|
17
|
+
readonly "@DuplojsLangDataStructure/boolean-literal-type": (source: import('@duplojs/lang/dataStructure').BooleanLiteralType<boolean>) => string;
|
|
18
|
+
readonly "@DuplojsLangDataStructure/date-type": () => string;
|
|
19
|
+
readonly "@DuplojsLangDataStructure/null-type": () => string;
|
|
20
|
+
readonly "@DuplojsLangDataStructure/number-type": () => string;
|
|
21
|
+
readonly "@DuplojsLangDataStructure/number-literal-type": (source: import('@duplojs/lang/dataStructure').NumberLiteralType<number>) => string;
|
|
22
|
+
readonly "@DuplojsLangDataStructure/string-type": () => string;
|
|
23
|
+
readonly "@DuplojsLangDataStructure/string-literal-type": (source: import('@duplojs/lang/dataStructure').StringLiteralType<string>) => string;
|
|
24
|
+
readonly "@DuplojsLangDataStructure/time-type": () => string;
|
|
25
|
+
readonly "@DuplojsLangDataStructure/undefined-type": () => string;
|
|
26
|
+
readonly "@DuplojsLangDataStructure/absolute-path-constraint": () => string;
|
|
27
|
+
readonly "@DuplojsLangDataStructure/allowed-characters-constraint": (source: import('@duplojs/lang/dataStructure').AllowedCharactersConstraint<import('@duplojs/lang/string').CharactersRange>) => string;
|
|
28
|
+
readonly "@DuplojsLangDataStructure/array-length-equal-constraint": (source: import('@duplojs/lang/dataStructure').ArrayLengthEqualConstraint<number>) => string;
|
|
29
|
+
readonly "@DuplojsLangDataStructure/between-than-constraint": (source: import('@duplojs/lang/dataStructure').BetweenThanConstraint<number, number>) => string;
|
|
30
|
+
readonly "@DuplojsLangDataStructure/between-than-or-equal-constraint": (source: import('@duplojs/lang/dataStructure').BetweenThanOrEqualConstraint<number, number>) => string;
|
|
31
|
+
readonly "@DuplojsLangDataStructure/email-constraint": () => string;
|
|
32
|
+
readonly "@DuplojsLangDataStructure/even-constraint": () => string;
|
|
33
|
+
readonly "@DuplojsLangDataStructure/greater-than-constraint": (source: import('@duplojs/lang/dataStructure').GreaterThanConstraint<number>) => string;
|
|
34
|
+
readonly "@DuplojsLangDataStructure/greater-than-or-equal-constraint": (source: import('@duplojs/lang/dataStructure').GreaterThanOrEqualConstraint<number>) => string;
|
|
35
|
+
readonly "@DuplojsLangDataStructure/integer-constraint": () => string;
|
|
36
|
+
readonly "@DuplojsLangDataStructure/less-than-constraint": (source: import('@duplojs/lang/dataStructure').LessThanConstraint<number>) => string;
|
|
37
|
+
readonly "@DuplojsLangDataStructure/less-than-or-equal-constraint": (source: import('@duplojs/lang/dataStructure').LessThanOrEqualConstraint<number>) => string;
|
|
38
|
+
readonly "@DuplojsLangDataStructure/max-characters-constraint": (source: import('@duplojs/lang/dataStructure').MaxCharactersConstraint<number>) => string;
|
|
39
|
+
readonly "@DuplojsLangDataStructure/max-elements-constraint": (source: import('@duplojs/lang/dataStructure').MaxElementsConstraint<number>) => string;
|
|
40
|
+
readonly "@DuplojsLangDataStructure/min-characters-constraint": (source: import('@duplojs/lang/dataStructure').MinCharactersConstraint<number>) => string;
|
|
41
|
+
readonly "@DuplojsLangDataStructure/min-elements-constraint": (source: import('@duplojs/lang/dataStructure').MinElementsConstraint<number>) => string;
|
|
42
|
+
readonly "@DuplojsLangDataStructure/multiple-of-constraint": (source: import('@duplojs/lang/dataStructure').MultipleOfConstraint<number>) => string;
|
|
43
|
+
readonly "@DuplojsLangDataStructure/negative-constraint": () => string;
|
|
44
|
+
readonly "@DuplojsLangDataStructure/not-empty-constraint": () => string;
|
|
45
|
+
readonly "@DuplojsLangDataStructure/not-zero-constraint": () => string;
|
|
46
|
+
readonly "@DuplojsLangDataStructure/number-in-string-constraint": () => string;
|
|
47
|
+
readonly "@DuplojsLangDataStructure/odd-constraint": () => string;
|
|
48
|
+
readonly "@DuplojsLangDataStructure/path-constraint": () => string;
|
|
49
|
+
readonly "@DuplojsLangDataStructure/positive-constraint": () => string;
|
|
50
|
+
readonly "@DuplojsLangDataStructure/refine-constraint": () => string;
|
|
51
|
+
readonly "@DuplojsLangDataStructure/regex-constraint": (source: import('@duplojs/lang/dataStructure').RegexConstraint) => string;
|
|
52
|
+
readonly "@DuplojsLangDataStructure/safe-constraint": () => string;
|
|
53
|
+
readonly "@DuplojsLangDataStructure/segment-path-constraint": () => string;
|
|
54
|
+
readonly "@DuplojsLangDataStructure/strict-negative-constraint": () => string;
|
|
55
|
+
readonly "@DuplojsLangDataStructure/strict-positive-constraint": () => string;
|
|
56
|
+
readonly "@DuplojsLangDataStructure/string-length-equal-constraint": (source: import('@duplojs/lang/dataStructure').StringLengthEqualConstraint<number>) => string;
|
|
57
|
+
readonly "@DuplojsLangDataStructure/trimmed-constraint": () => string;
|
|
58
|
+
readonly "@DuplojsLangDataStructure/url-constraint": () => string;
|
|
59
|
+
readonly "@DuplojsLangDataStructure/uuid-constraint": () => string;
|
|
60
|
+
readonly "@DuplojsLangModeling/entity-structure": () => string;
|
|
61
|
+
readonly "@DuplojsLangModeling/new-type-structure": () => string;
|
|
62
|
+
readonly "@DuplojsLangModeling/tagged-object-structure": (source: import('@duplojs/lang/modeling').TaggedObjectStructure<import('@duplojs/lang/modeling').ObjectTag<string>>) => string;
|
|
63
|
+
};
|
|
64
|
+
export declare const defaultErrorInterpreterCodecDictionary: [[DDataStructure.Codec<DDataStructure.TheBigint, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheDate, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheTime, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheBigint, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheBoolean, "true" | "false">, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheDate, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheNull, "null">, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheNumber, string & import('@duplojs/lang/string').Number>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheTime, string>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<DDataStructure.TheUndefined, "undefined" | undefined>, (codec: import('@duplojs/lang/dataStructure').Codec, issue: import('@duplojs/lang/dataStructure').EncodeIssue | import('@duplojs/lang/dataStructure').DecodeIssue) => string], [DDataStructure.Codec<import('../..').TheFile, string & import('@duplojs/lang/path').Path>, (_codec: DDataStructure.Codec<DDataStructure.FundamentalType<unknown>, unknown>, issue: DDataStructure.EncodeIssue | DDataStructure.DecodeIssue) => string]];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { codecsJson } from "../codec/defaults/json.mjs";
|
|
2
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
3
|
+
//#region scripts/dataStructure/common/error/defaultInterpreter.ts
|
|
4
|
+
const defaultErrorInterpreterDataStructureDictionary = {
|
|
5
|
+
...DDataStructure.defaultErrorInterpreterDataStructureDictionary,
|
|
6
|
+
"@DuplojsServerDataStructure/file-type": () => "Expected a valid file.",
|
|
7
|
+
"@DuplojsServerDataStructure/size-constraint": (source) => {
|
|
8
|
+
const { min, max } = source.definition;
|
|
9
|
+
if (min !== void 0 && max !== void 0) return `Expected a file size between ${min} and ${max} bytes.`;
|
|
10
|
+
if (min !== void 0) return `Expected a file size of at least ${min} bytes.`;
|
|
11
|
+
if (max !== void 0) return `Expected a file size of at most ${max} bytes.`;
|
|
12
|
+
return "Expected a valid file size.";
|
|
13
|
+
},
|
|
14
|
+
"@DuplojsServerDataStructure/mime-type-constraint": (source) => `Expected a file with a MIME type matching ${source.definition.regex.toString()}.`,
|
|
15
|
+
"@DuplojsServerDataStructure/exist-constraint": () => "Expected the file to exist."
|
|
16
|
+
};
|
|
17
|
+
const defaultErrorInterpreterCodecDictionary = [...DDataStructure.defaultErrorInterpreterCodecDictionary, [codecsJson.definition.file, (_codec, issue) => {
|
|
18
|
+
if (issue.from === "predicate") return DDataStructure.encodeIssueKind.has(issue) ? "The JSON file codec must produce a valid file path string." : "Expected a valid file path string for the JSON file codec.";
|
|
19
|
+
if (issue.from === "encoding") return "The JSON file codec could not encode the file.";
|
|
20
|
+
if (issue.from === "decoding") return "The JSON file codec could not decode the value as a file.";
|
|
21
|
+
return `The JSON file codec encountered an external error while ${DDataStructure.encodeIssueKind.has(issue) ? "encoding" : "decoding"}.`;
|
|
22
|
+
}]];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { defaultErrorInterpreterCodecDictionary, defaultErrorInterpreterDataStructureDictionary };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defaultInterpreter';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_kind = require("../kind.cjs");
|
|
3
|
+
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
4
|
+
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
5
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
6
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
7
|
+
//#region scripts/dataStructure/constraint/exist.ts
|
|
8
|
+
const existConstraintKind = require_kind.createKind("exist-constraint");
|
|
9
|
+
const ExistConstraint = _duplojs_lang_dataStructure.createConstraint(existConstraintKind, ({ init }) => () => init({}, {
|
|
10
|
+
executeCheck: async (_self, data) => {
|
|
11
|
+
const result = _duplojs_lang_either.rightPipe(await data.stat(), (stat) => stat.isFile ? stat : _duplojs_lang_either.fail());
|
|
12
|
+
if (_duplojs_lang_either.isLeft(result)) return _duplojs_lang_dataStructure.ErrorSymbol;
|
|
13
|
+
return _duplojs_lang_dataStructure.SuccessSymbol;
|
|
14
|
+
},
|
|
15
|
+
isAsynchronous: () => true
|
|
16
|
+
}));
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ExistConstraint = ExistConstraint;
|
|
19
|
+
exports.existConstraintKind = existConstraintKind;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as DCommon from "@duplojs/lang/common";
|
|
2
|
+
import type * as DKind from "@duplojs/lang/kind";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
import type * as DSFile from '../../file';
|
|
5
|
+
export declare const existConstraintKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/exist-constraint", unknown>>;
|
|
6
|
+
export interface ExistConstraintDefinition extends DDataStructure.ConstraintDefinition {
|
|
7
|
+
}
|
|
8
|
+
export interface ExistConstraint extends DCommon.UnionToIntersection<DDataStructure.Constraint<DSFile.FileInterface, DSFile.FileInterface, ExistConstraintDefinition> & DKind.Kind<typeof existConstraintKind>> {
|
|
9
|
+
}
|
|
10
|
+
export declare const ExistConstraint: () => ExistConstraint;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createKind } from "../kind.mjs";
|
|
2
|
+
import * as DEither from "@duplojs/lang/either";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
//#region scripts/dataStructure/constraint/exist.ts
|
|
5
|
+
const existConstraintKind = createKind("exist-constraint");
|
|
6
|
+
const ExistConstraint = DDataStructure.createConstraint(existConstraintKind, ({ init }) => () => init({}, {
|
|
7
|
+
executeCheck: async (_self, data) => {
|
|
8
|
+
const result = DEither.rightPipe(await data.stat(), (stat) => stat.isFile ? stat : DEither.fail());
|
|
9
|
+
if (DEither.isLeft(result)) return DDataStructure.ErrorSymbol;
|
|
10
|
+
return DDataStructure.SuccessSymbol;
|
|
11
|
+
},
|
|
12
|
+
isAsynchronous: () => true
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ExistConstraint, existConstraintKind };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_kind = require("../kind.cjs");
|
|
3
|
+
let _duplojs_lang_common = require("@duplojs/lang/common");
|
|
4
|
+
_duplojs_lang_common = require_runtime.__toESM(_duplojs_lang_common, 1);
|
|
5
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
6
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
7
|
+
//#region scripts/dataStructure/constraint/mimeType.ts
|
|
8
|
+
const mimeTypeConstraintKind = require_kind.createKind("mime-type-constraint");
|
|
9
|
+
const MimeTypeConstraint = _duplojs_lang_dataStructure.createConstraint(mimeTypeConstraintKind, ({ init }) => (mimeType) => init({ regex: _duplojs_lang_common.toRegExp(mimeType) }, {
|
|
10
|
+
executeCheck: (self, data) => {
|
|
11
|
+
if (self.definition.regex.test(data.getMimeType() ?? "")) return _duplojs_lang_dataStructure.ErrorSymbol;
|
|
12
|
+
return _duplojs_lang_dataStructure.SuccessSymbol;
|
|
13
|
+
},
|
|
14
|
+
isAsynchronous: () => false
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.MimeTypeConstraint = MimeTypeConstraint;
|
|
18
|
+
exports.mimeTypeConstraintKind = mimeTypeConstraintKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
2
|
+
import type * as DKind from "@duplojs/lang/kind";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
import type * as DSFile from '../../file';
|
|
5
|
+
export declare const mimeTypeConstraintKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/mime-type-constraint", unknown>>;
|
|
6
|
+
export interface MimeTypeConstraintDefinition extends DDataStructure.ConstraintDefinition {
|
|
7
|
+
regex: RegExp;
|
|
8
|
+
}
|
|
9
|
+
export interface MimeTypeConstraint extends DCommon.UnionToIntersection<DDataStructure.Constraint<DSFile.FileInterface, DSFile.FileInterface, MimeTypeConstraintDefinition> & DKind.Kind<typeof mimeTypeConstraintKind>> {
|
|
10
|
+
}
|
|
11
|
+
export declare const MimeTypeConstraint: (mimeType: Parameters<typeof DCommon.toRegExp>[0]) => MimeTypeConstraint;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createKind } from "../kind.mjs";
|
|
2
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
//#region scripts/dataStructure/constraint/mimeType.ts
|
|
5
|
+
const mimeTypeConstraintKind = createKind("mime-type-constraint");
|
|
6
|
+
const MimeTypeConstraint = DDataStructure.createConstraint(mimeTypeConstraintKind, ({ init }) => (mimeType) => init({ regex: DCommon.toRegExp(mimeType) }, {
|
|
7
|
+
executeCheck: (self, data) => {
|
|
8
|
+
if (self.definition.regex.test(data.getMimeType() ?? "")) return DDataStructure.ErrorSymbol;
|
|
9
|
+
return DDataStructure.SuccessSymbol;
|
|
10
|
+
},
|
|
11
|
+
isAsynchronous: () => false
|
|
12
|
+
}));
|
|
13
|
+
//#endregion
|
|
14
|
+
export { MimeTypeConstraint, mimeTypeConstraintKind };
|