@duplojs/server 0.1.0-beta.1 → 0.1.0-beta.3
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/dist/_virtual/_rolldown/runtime.mjs +5 -1
- package/dist/command/create.cjs +11 -9
- package/dist/command/create.mjs +11 -9
- package/dist/command/error.cjs +2 -2
- package/dist/command/error.mjs +1 -1
- package/dist/command/help.cjs +11 -9
- package/dist/command/help.mjs +10 -8
- package/dist/common/environmentVariable/parseEnvironmentFiles.d.ts +2 -1
- package/dist/common/index.cjs +3 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.mjs +3 -1
- package/dist/common/meta/getCurrentDirectoryName.cjs +10 -0
- package/dist/common/meta/getCurrentDirectoryName.d.ts +7 -0
- package/dist/common/meta/getCurrentDirectoryName.mjs +7 -0
- package/dist/common/meta/index.d.ts +7 -0
- package/dist/dataStructure/common/codec/defaults/json.cjs +12 -1
- package/dist/dataStructure/common/codec/defaults/json.d.ts +2 -2
- package/dist/dataStructure/common/codec/defaults/json.mjs +12 -1
- package/dist/dataStructure/common/codec/defaults/string.cjs +12 -1
- package/dist/dataStructure/common/codec/defaults/string.d.ts +2 -2
- package/dist/dataStructure/common/codec/defaults/string.mjs +12 -1
- package/dist/dataStructure/common/error/defaultInterpreter.cjs +3 -1
- package/dist/dataStructure/common/error/defaultInterpreter.d.ts +7 -2
- package/dist/dataStructure/common/error/defaultInterpreter.mjs +3 -1
- package/dist/dataStructure/constraint/{exist.cjs → fileExist.cjs} +5 -5
- package/dist/dataStructure/constraint/fileExist.d.ts +10 -0
- package/dist/dataStructure/constraint/{exist.mjs → fileExist.mjs} +4 -4
- package/dist/dataStructure/constraint/folderExist.cjs +19 -0
- package/dist/dataStructure/constraint/folderExist.d.ts +10 -0
- package/dist/dataStructure/constraint/folderExist.mjs +15 -0
- package/dist/dataStructure/constraint/index.d.ts +2 -1
- package/dist/dataStructure/constraint/mimeType.cjs +1 -1
- package/dist/dataStructure/constraint/mimeType.mjs +1 -1
- package/dist/dataStructure/constraint/types/constraints.d.ts +4 -2
- package/dist/dataStructure/fundamentalType/folder.cjs +11 -0
- package/dist/dataStructure/fundamentalType/folder.d.ts +8 -0
- package/dist/dataStructure/fundamentalType/folder.mjs +8 -0
- package/dist/dataStructure/fundamentalType/index.d.ts +1 -0
- package/dist/dataStructure/fundamentalType/types/fundamentalTypes.d.ts +2 -0
- package/dist/dataStructure/helper/file.d.ts +1 -1
- package/dist/dataStructure/helper/fileExist.cjs +7 -0
- package/dist/dataStructure/helper/fileExist.d.ts +2 -0
- package/dist/dataStructure/helper/fileExist.mjs +7 -0
- package/dist/dataStructure/helper/folder.cjs +10 -0
- package/dist/dataStructure/helper/folder.d.ts +3 -0
- package/dist/dataStructure/helper/folder.mjs +8 -0
- package/dist/dataStructure/helper/folderExist.cjs +7 -0
- package/dist/dataStructure/helper/folderExist.d.ts +2 -0
- package/dist/dataStructure/helper/folderExist.mjs +7 -0
- package/dist/dataStructure/helper/index.d.ts +3 -1
- package/dist/dataStructure/index.cjs +29 -8
- package/dist/dataStructure/index.mjs +19 -6
- package/dist/dataStructure/type/folder.cjs +14 -0
- package/dist/dataStructure/type/folder.d.ts +11 -0
- package/dist/dataStructure/type/folder.mjs +11 -0
- package/dist/dataStructure/type/index.d.ts +1 -0
- package/dist/dataStructure/type/types/types.d.ts +2 -0
- package/dist/file/appendFile.cjs +36 -22
- package/dist/file/appendFile.d.ts +34 -2
- package/dist/file/appendFile.mjs +35 -22
- package/dist/file/appendTextFile.cjs +34 -20
- package/dist/file/appendTextFile.d.ts +34 -2
- package/dist/file/appendTextFile.mjs +33 -20
- package/dist/file/copy.cjs +26 -14
- package/dist/file/copy.d.ts +34 -2
- package/dist/file/copy.mjs +25 -14
- package/dist/file/createEntryInterface.cjs +2 -2
- package/dist/file/createEntryInterface.d.ts +1 -1
- package/dist/file/createEntryInterface.mjs +1 -1
- package/dist/file/ensureDirectory.cjs +29 -17
- package/dist/file/ensureDirectory.d.ts +28 -2
- package/dist/file/ensureDirectory.mjs +28 -17
- package/dist/file/ensureFile.cjs +32 -19
- package/dist/file/ensureFile.d.ts +31 -2
- package/dist/file/ensureFile.mjs +31 -19
- package/dist/file/exists.cjs +23 -14
- package/dist/file/exists.d.ts +19 -2
- package/dist/file/exists.mjs +22 -14
- package/dist/file/fileInterface.cjs +2 -0
- package/dist/file/fileInterface.d.ts +8 -6
- package/dist/file/fileInterface.mjs +2 -1
- package/dist/file/folderInterface.cjs +2 -0
- package/dist/file/folderInterface.d.ts +7 -5
- package/dist/file/folderInterface.mjs +2 -1
- package/dist/file/index.cjs +6 -0
- package/dist/file/index.d.ts +0 -1
- package/dist/file/index.mjs +7 -4
- package/dist/file/link.cjs +37 -22
- package/dist/file/link.d.ts +37 -2
- package/dist/file/link.mjs +36 -22
- package/dist/file/linkStat.cjs +23 -15
- package/dist/file/linkStat.d.ts +22 -2
- package/dist/file/linkStat.mjs +23 -15
- package/dist/file/makeDirectory.cjs +35 -21
- package/dist/file/makeDirectory.d.ts +33 -2
- package/dist/file/makeDirectory.mjs +34 -21
- package/dist/file/makeTemporaryDirectory.cjs +26 -15
- package/dist/file/makeTemporaryDirectory.d.ts +25 -2
- package/dist/file/makeTemporaryDirectory.mjs +25 -15
- package/dist/file/makeTemporaryFile.cjs +29 -20
- package/dist/file/makeTemporaryFile.d.ts +28 -2
- package/dist/file/makeTemporaryFile.mjs +29 -20
- package/dist/file/move.cjs +38 -23
- package/dist/file/move.d.ts +37 -2
- package/dist/file/move.mjs +37 -23
- package/dist/file/readDirectory.cjs +27 -9
- package/dist/file/readDirectory.d.ts +26 -5
- package/dist/file/readDirectory.mjs +24 -9
- package/dist/file/readFile.cjs +28 -17
- package/dist/file/readFile.d.ts +25 -2
- package/dist/file/readFile.mjs +27 -17
- package/dist/file/readJsonFile.cjs +28 -17
- package/dist/file/readJsonFile.d.ts +25 -3
- package/dist/file/readJsonFile.mjs +27 -17
- package/dist/file/readLink.cjs +25 -15
- package/dist/file/readLink.d.ts +22 -2
- package/dist/file/readLink.mjs +24 -15
- package/dist/file/readTextFile.cjs +28 -17
- package/dist/file/readTextFile.d.ts +25 -2
- package/dist/file/readTextFile.mjs +27 -17
- package/dist/file/realPath.cjs +22 -13
- package/dist/file/realPath.d.ts +19 -2
- package/dist/file/realPath.mjs +21 -13
- package/dist/file/relocate.cjs +41 -25
- package/dist/file/relocate.d.ts +37 -2
- package/dist/file/relocate.mjs +40 -25
- package/dist/file/remove.cjs +36 -23
- package/dist/file/remove.d.ts +30 -2
- package/dist/file/remove.mjs +35 -23
- package/dist/file/rename.cjs +41 -25
- package/dist/file/rename.d.ts +37 -2
- package/dist/file/rename.mjs +40 -25
- package/dist/file/setMode.cjs +23 -15
- package/dist/file/setMode.d.ts +21 -2
- package/dist/file/setMode.mjs +23 -15
- package/dist/file/setOwner.cjs +25 -15
- package/dist/file/setOwner.d.ts +22 -2
- package/dist/file/setOwner.mjs +24 -15
- package/dist/file/setTime.cjs +25 -15
- package/dist/file/setTime.d.ts +21 -2
- package/dist/file/setTime.mjs +24 -15
- package/dist/file/stat.cjs +23 -15
- package/dist/file/stat.d.ts +22 -2
- package/dist/file/stat.mjs +23 -15
- package/dist/file/symlink.cjs +33 -20
- package/dist/file/symlink.d.ts +31 -2
- package/dist/file/symlink.mjs +32 -20
- package/dist/file/truncate.cjs +33 -21
- package/dist/file/truncate.d.ts +34 -2
- package/dist/file/truncate.mjs +33 -21
- package/dist/file/unknownEntryInterface.cjs +2 -0
- package/dist/file/unknownEntryInterface.d.ts +7 -5
- package/dist/file/unknownEntryInterface.mjs +2 -1
- package/dist/file/walkDirectory.cjs +28 -15
- package/dist/file/walkDirectory.d.ts +23 -2
- package/dist/file/walkDirectory.mjs +27 -14
- package/dist/file/writeFile.cjs +35 -21
- package/dist/file/writeFile.d.ts +34 -2
- package/dist/file/writeFile.mjs +34 -21
- package/dist/file/writeJsonFile.cjs +38 -27
- package/dist/file/writeJsonFile.d.ts +36 -5
- package/dist/file/writeJsonFile.mjs +38 -27
- package/dist/file/writeTextFile.cjs +35 -21
- package/dist/file/writeTextFile.d.ts +34 -2
- package/dist/file/writeTextFile.mjs +34 -21
- package/dist/implementor.cjs +8 -5
- package/dist/implementor.d.ts +4 -4
- package/dist/implementor.mjs +8 -5
- package/dist/index.cjs +2 -0
- package/dist/index.mjs +2 -1
- package/package.json +4 -4
- package/dist/dataStructure/constraint/exist.d.ts +0 -10
- package/dist/dataStructure/helper/exist.cjs +0 -7
- package/dist/dataStructure/helper/exist.d.ts +0 -2
- package/dist/dataStructure/helper/exist.mjs +0 -7
- package/dist/file/types/fileSystemEither.d.ts +0 -2
- package/dist/file/types/index.d.ts +0 -1
- /package/{README → README.md} +0 -0
package/dist/file/index.mjs
CHANGED
|
@@ -8,11 +8,11 @@ import { exists } from "./exists.mjs";
|
|
|
8
8
|
import { move } from "./move.mjs";
|
|
9
9
|
import { remove } from "./remove.mjs";
|
|
10
10
|
import { relocate } from "./relocate.mjs";
|
|
11
|
-
import { createFileInterface, isFileInterface } from "./fileInterface.mjs";
|
|
11
|
+
import { createFileInterface, isFileInterface, isFileInterfaceFromUnknown } from "./fileInterface.mjs";
|
|
12
12
|
import { readDirectory } from "./readDirectory.mjs";
|
|
13
|
-
import { createUnknownEntryInterface, isUnknownEntryInterface } from "./unknownEntryInterface.mjs";
|
|
13
|
+
import { createUnknownEntryInterface, isUnknownEntryInterface, isUnknownEntryInterfaceFromUnknown } from "./unknownEntryInterface.mjs";
|
|
14
14
|
import { walkDirectory } from "./walkDirectory.mjs";
|
|
15
|
-
import { createFolderInterface, isFolderInterface } from "./folderInterface.mjs";
|
|
15
|
+
import { createFolderInterface, isFolderInterface, isFolderInterfaceFromUnknown } from "./folderInterface.mjs";
|
|
16
16
|
import { createEntryInterface } from "./createEntryInterface.mjs";
|
|
17
17
|
import { ensureDirectory } from "./ensureDirectory.mjs";
|
|
18
18
|
import { ensureFile } from "./ensureFile.mjs";
|
|
@@ -47,8 +47,11 @@ var file_exports = /* @__PURE__ */ __exportAll({
|
|
|
47
47
|
ensureFile: () => ensureFile,
|
|
48
48
|
exists: () => exists,
|
|
49
49
|
isFileInterface: () => isFileInterface,
|
|
50
|
+
isFileInterfaceFromUnknown: () => isFileInterfaceFromUnknown,
|
|
50
51
|
isFolderInterface: () => isFolderInterface,
|
|
52
|
+
isFolderInterfaceFromUnknown: () => isFolderInterfaceFromUnknown,
|
|
51
53
|
isUnknownEntryInterface: () => isUnknownEntryInterface,
|
|
54
|
+
isUnknownEntryInterfaceFromUnknown: () => isUnknownEntryInterfaceFromUnknown,
|
|
52
55
|
link: () => link,
|
|
53
56
|
linkStat: () => linkStat,
|
|
54
57
|
makeDirectory: () => makeDirectory,
|
|
@@ -76,4 +79,4 @@ var file_exports = /* @__PURE__ */ __exportAll({
|
|
|
76
79
|
writeTextFile: () => writeTextFile
|
|
77
80
|
});
|
|
78
81
|
//#endregion
|
|
79
|
-
export { appendFile, appendTextFile, copy, createEntryInterface, createFileInterface, createFolderInterface, createUnknownEntryInterface, ensureDirectory, ensureFile, exists, file_exports, isFileInterface, isFolderInterface, isUnknownEntryInterface, link, linkStat, makeDirectory, makeTemporaryDirectory, makeTemporaryFile, move, readDirectory, readFile, readJsonFile, readLink, readTextFile, realPath, relocate, remove, rename, setMode, setOwner, setTime, stat, symlink, truncate, walkDirectory, writeFile, writeJsonFile, writeTextFile };
|
|
82
|
+
export { appendFile, appendTextFile, copy, createEntryInterface, createFileInterface, createFolderInterface, createUnknownEntryInterface, ensureDirectory, ensureFile, exists, file_exports, isFileInterface, isFileInterfaceFromUnknown, isFolderInterface, isFolderInterfaceFromUnknown, isUnknownEntryInterface, isUnknownEntryInterfaceFromUnknown, link, linkStat, makeDirectory, makeTemporaryDirectory, makeTemporaryFile, move, readDirectory, readFile, readJsonFile, readLink, readTextFile, realPath, relocate, remove, rename, setMode, setOwner, setTime, stat, symlink, truncate, walkDirectory, writeFile, writeJsonFile, writeTextFile };
|
package/dist/file/link.cjs
CHANGED
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_implementor = require("../implementor.cjs");
|
|
3
|
+
let _duplojs_lang_common = require("@duplojs/lang/common");
|
|
4
|
+
_duplojs_lang_common = require_runtime.__toESM(_duplojs_lang_common, 1);
|
|
3
5
|
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
4
6
|
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
5
7
|
//#region scripts/file/link.ts
|
|
8
|
+
var LinkErrorNotFound = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-not-found", Error) {};
|
|
9
|
+
var LinkErrorPermissionDenied = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-permission-denied", Error) {};
|
|
10
|
+
var LinkErrorAlreadyExists = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-already-exists", Error) {};
|
|
11
|
+
var LinkErrorNotDirectory = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-not-directory", Error) {};
|
|
12
|
+
var LinkErrorNoSpace = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-no-space", Error) {};
|
|
13
|
+
var LinkErrorReadOnly = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-read-only", Error) {};
|
|
14
|
+
var LinkErrorInvalidArgument = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-invalid-argument", Error) {};
|
|
15
|
+
var LinkErrorTooManyOpenFiles = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-too-many-open-files", Error) {};
|
|
16
|
+
var LinkErrorBusy = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-busy", Error) {};
|
|
17
|
+
var LinkErrorCrossDevice = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-cross-device", Error) {};
|
|
18
|
+
var LinkError = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-error", Error) {};
|
|
6
19
|
function handleNodeLinkError(error) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
else if (error.code === "
|
|
11
|
-
else if (error.code === "
|
|
12
|
-
else if (error.code === "
|
|
13
|
-
else if (error.code === "
|
|
14
|
-
else if (error.code === "
|
|
15
|
-
else if (error.code === "
|
|
16
|
-
else if (error.code === "
|
|
17
|
-
else if (error.code === "
|
|
20
|
+
let linkError = void 0;
|
|
21
|
+
if ("code" in error) {
|
|
22
|
+
if (error.code === "ENOENT") linkError = new LinkErrorNotFound(error);
|
|
23
|
+
else if (error.code === "EACCES" || error.code === "EPERM") linkError = new LinkErrorPermissionDenied(error);
|
|
24
|
+
else if (error.code === "EEXIST") linkError = new LinkErrorAlreadyExists(error);
|
|
25
|
+
else if (error.code === "ENOTDIR") linkError = new LinkErrorNotDirectory(error);
|
|
26
|
+
else if (error.code === "ENOSPC") linkError = new LinkErrorNoSpace(error);
|
|
27
|
+
else if (error.code === "EROFS") linkError = new LinkErrorReadOnly(error);
|
|
28
|
+
else if (error.code === "EINVAL") linkError = new LinkErrorInvalidArgument(error);
|
|
29
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") linkError = new LinkErrorTooManyOpenFiles(error);
|
|
30
|
+
else if (error.code === "EBUSY") linkError = new LinkErrorBusy(error);
|
|
31
|
+
else if (error.code === "EXDEV") linkError = new LinkErrorCrossDevice(error);
|
|
18
32
|
}
|
|
19
|
-
|
|
33
|
+
if (linkError === void 0) linkError = new LinkError(error);
|
|
34
|
+
return _duplojs_lang_either.left("file-system-link-error", linkError);
|
|
20
35
|
}
|
|
21
36
|
function handleDenoLinkError(error) {
|
|
22
|
-
|
|
23
|
-
if (error instanceof Deno.errors.
|
|
24
|
-
if (error instanceof Deno.errors.
|
|
25
|
-
if (error instanceof Deno.errors.
|
|
26
|
-
if (error instanceof Deno.errors.
|
|
27
|
-
if (error instanceof Deno.errors.
|
|
28
|
-
|
|
37
|
+
let linkError = void 0;
|
|
38
|
+
if (error instanceof Deno.errors.NotFound) linkError = new LinkErrorNotFound(error);
|
|
39
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) linkError = new LinkErrorPermissionDenied(error);
|
|
40
|
+
else if (error instanceof Deno.errors.AlreadyExists) linkError = new LinkErrorAlreadyExists(error);
|
|
41
|
+
else if (error instanceof Deno.errors.NotADirectory) linkError = new LinkErrorNotDirectory(error);
|
|
42
|
+
else if (error instanceof Deno.errors.InvalidData) linkError = new LinkErrorInvalidArgument(error);
|
|
43
|
+
else if (error instanceof Deno.errors.Busy) linkError = new LinkErrorBusy(error);
|
|
44
|
+
if (linkError === void 0) linkError = new LinkError(error);
|
|
45
|
+
return _duplojs_lang_either.left("file-system-link-error", linkError);
|
|
29
46
|
}
|
|
30
47
|
const linkImplementation = require_implementor.implementFunction("link", {
|
|
31
|
-
NODE: async (existingPath, newPath) =>
|
|
32
|
-
return (await require_implementor.nodeFileSystem.value).link(existingPath, newPath).then(() => _duplojs_lang_either.right("file-system-link")).catch(handleNodeLinkError);
|
|
33
|
-
},
|
|
48
|
+
NODE: async (existingPath, newPath) => require_implementor.nodeFileSystem.value.link(existingPath, newPath).then(() => _duplojs_lang_either.right("file-system-link")).catch(handleNodeLinkError),
|
|
34
49
|
DENO: (existingPath, newPath) => Deno.link(existingPath, newPath).then(() => _duplojs_lang_either.right("file-system-link")).catch(handleDenoLinkError)
|
|
35
50
|
});
|
|
36
51
|
function link(...args) {
|
package/dist/file/link.d.ts
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import { FileSystemEither } from './types';
|
|
2
1
|
import * as DEither from "@duplojs/lang/either";
|
|
3
2
|
import type * as DPath from "@duplojs/lang/path";
|
|
4
|
-
|
|
3
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
4
|
+
declare const LinkErrorNotFound_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-not-found", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-not-found", unknown>>, unknown>;
|
|
5
|
+
declare class LinkErrorNotFound extends LinkErrorNotFound_base {
|
|
6
|
+
}
|
|
7
|
+
declare const LinkErrorPermissionDenied_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-permission-denied", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-permission-denied", unknown>>, unknown>;
|
|
8
|
+
declare class LinkErrorPermissionDenied extends LinkErrorPermissionDenied_base {
|
|
9
|
+
}
|
|
10
|
+
declare const LinkErrorAlreadyExists_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-already-exists", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-already-exists", unknown>>, unknown>;
|
|
11
|
+
declare class LinkErrorAlreadyExists extends LinkErrorAlreadyExists_base {
|
|
12
|
+
}
|
|
13
|
+
declare const LinkErrorNotDirectory_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-not-directory", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-not-directory", unknown>>, unknown>;
|
|
14
|
+
declare class LinkErrorNotDirectory extends LinkErrorNotDirectory_base {
|
|
15
|
+
}
|
|
16
|
+
declare const LinkErrorNoSpace_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-no-space", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-no-space", unknown>>, unknown>;
|
|
17
|
+
declare class LinkErrorNoSpace extends LinkErrorNoSpace_base {
|
|
18
|
+
}
|
|
19
|
+
declare const LinkErrorReadOnly_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-read-only", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-read-only", unknown>>, unknown>;
|
|
20
|
+
declare class LinkErrorReadOnly extends LinkErrorReadOnly_base {
|
|
21
|
+
}
|
|
22
|
+
declare const LinkErrorInvalidArgument_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-invalid-argument", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-invalid-argument", unknown>>, unknown>;
|
|
23
|
+
declare class LinkErrorInvalidArgument extends LinkErrorInvalidArgument_base {
|
|
24
|
+
}
|
|
25
|
+
declare const LinkErrorTooManyOpenFiles_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-too-many-open-files", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-too-many-open-files", unknown>>, unknown>;
|
|
26
|
+
declare class LinkErrorTooManyOpenFiles extends LinkErrorTooManyOpenFiles_base {
|
|
27
|
+
}
|
|
28
|
+
declare const LinkErrorBusy_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-busy", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-busy", unknown>>, unknown>;
|
|
29
|
+
declare class LinkErrorBusy extends LinkErrorBusy_base {
|
|
30
|
+
}
|
|
31
|
+
declare const LinkErrorCrossDevice_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-cross-device", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-cross-device", unknown>>, unknown>;
|
|
32
|
+
declare class LinkErrorCrossDevice extends LinkErrorCrossDevice_base {
|
|
33
|
+
}
|
|
34
|
+
declare const LinkError_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-error", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-error", unknown>>, unknown>;
|
|
35
|
+
declare class LinkError extends LinkError_base {
|
|
36
|
+
}
|
|
37
|
+
export type LinkErrors = (LinkErrorNotFound | LinkErrorPermissionDenied | LinkErrorAlreadyExists | LinkErrorNotDirectory | LinkErrorNoSpace | LinkErrorReadOnly | LinkErrorInvalidArgument | LinkErrorTooManyOpenFiles | LinkErrorBusy | LinkErrorCrossDevice | LinkError);
|
|
38
|
+
export type LinkResult = (DEither.Right<"file-system-link", void> | DEither.Left<"file-system-link-error", LinkErrors>);
|
|
5
39
|
declare module '../implementor' {
|
|
6
40
|
interface ServerFunction {
|
|
7
41
|
link(existingPath: string & DPath.Path, newPath: string & DPath.Path): Promise<LinkResult>;
|
|
@@ -9,3 +43,4 @@ declare module '../implementor' {
|
|
|
9
43
|
}
|
|
10
44
|
export declare function link(newPath: string & DPath.Path): (existingPath: string & DPath.Path) => Promise<LinkResult>;
|
|
11
45
|
export declare function link(existingPath: string & DPath.Path, newPath: string & DPath.Path): Promise<LinkResult>;
|
|
46
|
+
export {};
|
package/dist/file/link.mjs
CHANGED
|
@@ -1,34 +1,48 @@
|
|
|
1
1
|
import { implementFunction, nodeFileSystem } from "../implementor.mjs";
|
|
2
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
2
3
|
import * as DEither from "@duplojs/lang/either";
|
|
3
4
|
//#region scripts/file/link.ts
|
|
5
|
+
var LinkErrorNotFound = class extends DCommon.DuploJSError.parentClass("file-system-link-not-found", Error) {};
|
|
6
|
+
var LinkErrorPermissionDenied = class extends DCommon.DuploJSError.parentClass("file-system-link-permission-denied", Error) {};
|
|
7
|
+
var LinkErrorAlreadyExists = class extends DCommon.DuploJSError.parentClass("file-system-link-already-exists", Error) {};
|
|
8
|
+
var LinkErrorNotDirectory = class extends DCommon.DuploJSError.parentClass("file-system-link-not-directory", Error) {};
|
|
9
|
+
var LinkErrorNoSpace = class extends DCommon.DuploJSError.parentClass("file-system-link-no-space", Error) {};
|
|
10
|
+
var LinkErrorReadOnly = class extends DCommon.DuploJSError.parentClass("file-system-link-read-only", Error) {};
|
|
11
|
+
var LinkErrorInvalidArgument = class extends DCommon.DuploJSError.parentClass("file-system-link-invalid-argument", Error) {};
|
|
12
|
+
var LinkErrorTooManyOpenFiles = class extends DCommon.DuploJSError.parentClass("file-system-link-too-many-open-files", Error) {};
|
|
13
|
+
var LinkErrorBusy = class extends DCommon.DuploJSError.parentClass("file-system-link-busy", Error) {};
|
|
14
|
+
var LinkErrorCrossDevice = class extends DCommon.DuploJSError.parentClass("file-system-link-cross-device", Error) {};
|
|
15
|
+
var LinkError = class extends DCommon.DuploJSError.parentClass("file-system-link-error", Error) {};
|
|
4
16
|
function handleNodeLinkError(error) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
else if (error.code === "
|
|
9
|
-
else if (error.code === "
|
|
10
|
-
else if (error.code === "
|
|
11
|
-
else if (error.code === "
|
|
12
|
-
else if (error.code === "
|
|
13
|
-
else if (error.code === "
|
|
14
|
-
else if (error.code === "
|
|
15
|
-
else if (error.code === "
|
|
17
|
+
let linkError = void 0;
|
|
18
|
+
if ("code" in error) {
|
|
19
|
+
if (error.code === "ENOENT") linkError = new LinkErrorNotFound(error);
|
|
20
|
+
else if (error.code === "EACCES" || error.code === "EPERM") linkError = new LinkErrorPermissionDenied(error);
|
|
21
|
+
else if (error.code === "EEXIST") linkError = new LinkErrorAlreadyExists(error);
|
|
22
|
+
else if (error.code === "ENOTDIR") linkError = new LinkErrorNotDirectory(error);
|
|
23
|
+
else if (error.code === "ENOSPC") linkError = new LinkErrorNoSpace(error);
|
|
24
|
+
else if (error.code === "EROFS") linkError = new LinkErrorReadOnly(error);
|
|
25
|
+
else if (error.code === "EINVAL") linkError = new LinkErrorInvalidArgument(error);
|
|
26
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") linkError = new LinkErrorTooManyOpenFiles(error);
|
|
27
|
+
else if (error.code === "EBUSY") linkError = new LinkErrorBusy(error);
|
|
28
|
+
else if (error.code === "EXDEV") linkError = new LinkErrorCrossDevice(error);
|
|
16
29
|
}
|
|
17
|
-
|
|
30
|
+
if (linkError === void 0) linkError = new LinkError(error);
|
|
31
|
+
return DEither.left("file-system-link-error", linkError);
|
|
18
32
|
}
|
|
19
33
|
function handleDenoLinkError(error) {
|
|
20
|
-
|
|
21
|
-
if (error instanceof Deno.errors.
|
|
22
|
-
if (error instanceof Deno.errors.
|
|
23
|
-
if (error instanceof Deno.errors.
|
|
24
|
-
if (error instanceof Deno.errors.
|
|
25
|
-
if (error instanceof Deno.errors.
|
|
26
|
-
|
|
34
|
+
let linkError = void 0;
|
|
35
|
+
if (error instanceof Deno.errors.NotFound) linkError = new LinkErrorNotFound(error);
|
|
36
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) linkError = new LinkErrorPermissionDenied(error);
|
|
37
|
+
else if (error instanceof Deno.errors.AlreadyExists) linkError = new LinkErrorAlreadyExists(error);
|
|
38
|
+
else if (error instanceof Deno.errors.NotADirectory) linkError = new LinkErrorNotDirectory(error);
|
|
39
|
+
else if (error instanceof Deno.errors.InvalidData) linkError = new LinkErrorInvalidArgument(error);
|
|
40
|
+
else if (error instanceof Deno.errors.Busy) linkError = new LinkErrorBusy(error);
|
|
41
|
+
if (linkError === void 0) linkError = new LinkError(error);
|
|
42
|
+
return DEither.left("file-system-link-error", linkError);
|
|
27
43
|
}
|
|
28
44
|
const linkImplementation = implementFunction("link", {
|
|
29
|
-
NODE: async (existingPath, newPath) =>
|
|
30
|
-
return (await nodeFileSystem.value).link(existingPath, newPath).then(() => DEither.right("file-system-link")).catch(handleNodeLinkError);
|
|
31
|
-
},
|
|
45
|
+
NODE: async (existingPath, newPath) => nodeFileSystem.value.link(existingPath, newPath).then(() => DEither.right("file-system-link")).catch(handleNodeLinkError),
|
|
32
46
|
DENO: (existingPath, newPath) => Deno.link(existingPath, newPath).then(() => DEither.right("file-system-link")).catch(handleDenoLinkError)
|
|
33
47
|
});
|
|
34
48
|
function link(...args) {
|
package/dist/file/linkStat.cjs
CHANGED
|
@@ -7,22 +7,32 @@ _duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
|
7
7
|
let _duplojs_lang_chrono = require("@duplojs/lang/chrono");
|
|
8
8
|
_duplojs_lang_chrono = require_runtime.__toESM(_duplojs_lang_chrono, 1);
|
|
9
9
|
//#region scripts/file/linkStat.ts
|
|
10
|
+
var LinkStatErrorNotFound = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-not-found", Error) {};
|
|
11
|
+
var LinkStatErrorPermissionDenied = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-permission-denied", Error) {};
|
|
12
|
+
var LinkStatErrorNotDirectory = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-not-directory", Error) {};
|
|
13
|
+
var LinkStatErrorTooManyOpenFiles = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-too-many-open-files", Error) {};
|
|
14
|
+
var LinkStatErrorBusy = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-busy", Error) {};
|
|
15
|
+
var LinkStatError = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-link-stat-error", Error) {};
|
|
10
16
|
function handleNodeLinkStatError(error) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
else if (error.code === "
|
|
15
|
-
else if (error.code === "
|
|
16
|
-
else if (error.code === "
|
|
17
|
+
let linkStatError = void 0;
|
|
18
|
+
if ("code" in error) {
|
|
19
|
+
if (error.code === "ENOENT") linkStatError = new LinkStatErrorNotFound(error);
|
|
20
|
+
else if (error.code === "EACCES" || error.code === "EPERM") linkStatError = new LinkStatErrorPermissionDenied(error);
|
|
21
|
+
else if (error.code === "ENOTDIR") linkStatError = new LinkStatErrorNotDirectory(error);
|
|
22
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") linkStatError = new LinkStatErrorTooManyOpenFiles(error);
|
|
23
|
+
else if (error.code === "EBUSY") linkStatError = new LinkStatErrorBusy(error);
|
|
17
24
|
}
|
|
18
|
-
|
|
25
|
+
if (linkStatError === void 0) linkStatError = new LinkStatError(error);
|
|
26
|
+
return _duplojs_lang_either.left("file-system-link-stat-error", linkStatError);
|
|
19
27
|
}
|
|
20
28
|
function handleDenoLinkStatError(error) {
|
|
21
|
-
|
|
22
|
-
if (error instanceof Deno.errors.
|
|
23
|
-
if (error instanceof Deno.errors.
|
|
24
|
-
if (error instanceof Deno.errors.
|
|
25
|
-
|
|
29
|
+
let linkStatError = void 0;
|
|
30
|
+
if (error instanceof Deno.errors.NotFound) linkStatError = new LinkStatErrorNotFound(error);
|
|
31
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) linkStatError = new LinkStatErrorPermissionDenied(error);
|
|
32
|
+
else if (error instanceof Deno.errors.NotADirectory) linkStatError = new LinkStatErrorNotDirectory(error);
|
|
33
|
+
else if (error instanceof Deno.errors.Busy) linkStatError = new LinkStatErrorBusy(error);
|
|
34
|
+
if (linkStatError === void 0) linkStatError = new LinkStatError(error);
|
|
35
|
+
return _duplojs_lang_either.left("file-system-link-stat-error", linkStatError);
|
|
26
36
|
}
|
|
27
37
|
function createStatInfoWithFsSource(source) {
|
|
28
38
|
return {
|
|
@@ -75,9 +85,7 @@ function createStatInfoWithDeno(source) {
|
|
|
75
85
|
};
|
|
76
86
|
}
|
|
77
87
|
const linkStat = require_implementor.implementFunction("linkStat", {
|
|
78
|
-
NODE: async (path) =>
|
|
79
|
-
return (await require_implementor.nodeFileSystem.value).lstat(path).then(_duplojs_lang_common.innerPipe(createStatInfoWithFsSource, (value) => _duplojs_lang_either.right("file-system-link-stat", value))).catch(handleNodeLinkStatError);
|
|
80
|
-
},
|
|
88
|
+
NODE: async (path) => require_implementor.nodeFileSystem.value.lstat(path).then(_duplojs_lang_common.innerPipe(createStatInfoWithFsSource, (value) => _duplojs_lang_either.right("file-system-link-stat", value))).catch(handleNodeLinkStatError),
|
|
81
89
|
DENO: (path) => Deno.lstat(path).then(_duplojs_lang_common.innerPipe(createStatInfoWithDeno, (value) => _duplojs_lang_either.right("file-system-link-stat", value))).catch(handleDenoLinkStatError)
|
|
82
90
|
});
|
|
83
91
|
//#endregion
|
package/dist/file/linkStat.d.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { StatInfo } from './stat';
|
|
2
|
-
import
|
|
2
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
3
3
|
import type * as DPath from "@duplojs/lang/path";
|
|
4
4
|
import * as DEither from "@duplojs/lang/either";
|
|
5
|
-
|
|
5
|
+
declare const LinkStatErrorNotFound_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-not-found", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-not-found", unknown>>, unknown>;
|
|
6
|
+
declare class LinkStatErrorNotFound extends LinkStatErrorNotFound_base {
|
|
7
|
+
}
|
|
8
|
+
declare const LinkStatErrorPermissionDenied_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-permission-denied", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-permission-denied", unknown>>, unknown>;
|
|
9
|
+
declare class LinkStatErrorPermissionDenied extends LinkStatErrorPermissionDenied_base {
|
|
10
|
+
}
|
|
11
|
+
declare const LinkStatErrorNotDirectory_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-not-directory", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-not-directory", unknown>>, unknown>;
|
|
12
|
+
declare class LinkStatErrorNotDirectory extends LinkStatErrorNotDirectory_base {
|
|
13
|
+
}
|
|
14
|
+
declare const LinkStatErrorTooManyOpenFiles_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-too-many-open-files", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-too-many-open-files", unknown>>, unknown>;
|
|
15
|
+
declare class LinkStatErrorTooManyOpenFiles extends LinkStatErrorTooManyOpenFiles_base {
|
|
16
|
+
}
|
|
17
|
+
declare const LinkStatErrorBusy_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-busy", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-busy", unknown>>, unknown>;
|
|
18
|
+
declare class LinkStatErrorBusy extends LinkStatErrorBusy_base {
|
|
19
|
+
}
|
|
20
|
+
declare const LinkStatError_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-link-stat-error", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-link-stat-error", unknown>>, unknown>;
|
|
21
|
+
declare class LinkStatError extends LinkStatError_base {
|
|
22
|
+
}
|
|
23
|
+
export type LinkStatErrors = (LinkStatErrorNotFound | LinkStatErrorPermissionDenied | LinkStatErrorNotDirectory | LinkStatErrorTooManyOpenFiles | LinkStatErrorBusy | LinkStatError);
|
|
24
|
+
export type LinkStatResult = (DEither.Right<"file-system-link-stat", StatInfo> | DEither.Left<"file-system-link-stat-error", LinkStatErrors>);
|
|
6
25
|
declare module '../implementor' {
|
|
7
26
|
interface ServerFunction {
|
|
8
27
|
linkStat(path: string & DPath.Path): Promise<LinkStatResult>;
|
|
9
28
|
}
|
|
10
29
|
}
|
|
11
30
|
export declare const linkStat: (path: string & DPath.Path) => Promise<LinkStatResult>;
|
|
31
|
+
export {};
|
package/dist/file/linkStat.mjs
CHANGED
|
@@ -3,22 +3,32 @@ import * as DCommon from "@duplojs/lang/common";
|
|
|
3
3
|
import * as DEither from "@duplojs/lang/either";
|
|
4
4
|
import * as DChrono from "@duplojs/lang/chrono";
|
|
5
5
|
//#region scripts/file/linkStat.ts
|
|
6
|
+
var LinkStatErrorNotFound = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-not-found", Error) {};
|
|
7
|
+
var LinkStatErrorPermissionDenied = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-permission-denied", Error) {};
|
|
8
|
+
var LinkStatErrorNotDirectory = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-not-directory", Error) {};
|
|
9
|
+
var LinkStatErrorTooManyOpenFiles = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-too-many-open-files", Error) {};
|
|
10
|
+
var LinkStatErrorBusy = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-busy", Error) {};
|
|
11
|
+
var LinkStatError = class extends DCommon.DuploJSError.parentClass("file-system-link-stat-error", Error) {};
|
|
6
12
|
function handleNodeLinkStatError(error) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
else if (error.code === "
|
|
11
|
-
else if (error.code === "
|
|
12
|
-
else if (error.code === "
|
|
13
|
+
let linkStatError = void 0;
|
|
14
|
+
if ("code" in error) {
|
|
15
|
+
if (error.code === "ENOENT") linkStatError = new LinkStatErrorNotFound(error);
|
|
16
|
+
else if (error.code === "EACCES" || error.code === "EPERM") linkStatError = new LinkStatErrorPermissionDenied(error);
|
|
17
|
+
else if (error.code === "ENOTDIR") linkStatError = new LinkStatErrorNotDirectory(error);
|
|
18
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") linkStatError = new LinkStatErrorTooManyOpenFiles(error);
|
|
19
|
+
else if (error.code === "EBUSY") linkStatError = new LinkStatErrorBusy(error);
|
|
13
20
|
}
|
|
14
|
-
|
|
21
|
+
if (linkStatError === void 0) linkStatError = new LinkStatError(error);
|
|
22
|
+
return DEither.left("file-system-link-stat-error", linkStatError);
|
|
15
23
|
}
|
|
16
24
|
function handleDenoLinkStatError(error) {
|
|
17
|
-
|
|
18
|
-
if (error instanceof Deno.errors.
|
|
19
|
-
if (error instanceof Deno.errors.
|
|
20
|
-
if (error instanceof Deno.errors.
|
|
21
|
-
|
|
25
|
+
let linkStatError = void 0;
|
|
26
|
+
if (error instanceof Deno.errors.NotFound) linkStatError = new LinkStatErrorNotFound(error);
|
|
27
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) linkStatError = new LinkStatErrorPermissionDenied(error);
|
|
28
|
+
else if (error instanceof Deno.errors.NotADirectory) linkStatError = new LinkStatErrorNotDirectory(error);
|
|
29
|
+
else if (error instanceof Deno.errors.Busy) linkStatError = new LinkStatErrorBusy(error);
|
|
30
|
+
if (linkStatError === void 0) linkStatError = new LinkStatError(error);
|
|
31
|
+
return DEither.left("file-system-link-stat-error", linkStatError);
|
|
22
32
|
}
|
|
23
33
|
function createStatInfoWithFsSource(source) {
|
|
24
34
|
return {
|
|
@@ -71,9 +81,7 @@ function createStatInfoWithDeno(source) {
|
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
const linkStat = implementFunction("linkStat", {
|
|
74
|
-
NODE: async (path) =>
|
|
75
|
-
return (await nodeFileSystem.value).lstat(path).then(DCommon.innerPipe(createStatInfoWithFsSource, (value) => DEither.right("file-system-link-stat", value))).catch(handleNodeLinkStatError);
|
|
76
|
-
},
|
|
84
|
+
NODE: async (path) => nodeFileSystem.value.lstat(path).then(DCommon.innerPipe(createStatInfoWithFsSource, (value) => DEither.right("file-system-link-stat", value))).catch(handleNodeLinkStatError),
|
|
77
85
|
DENO: (path) => Deno.lstat(path).then(DCommon.innerPipe(createStatInfoWithDeno, (value) => DEither.right("file-system-link-stat", value))).catch(handleDenoLinkStatError)
|
|
78
86
|
});
|
|
79
87
|
//#endregion
|
|
@@ -1,35 +1,49 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_implementor = require("../implementor.cjs");
|
|
3
|
+
let _duplojs_lang_common = require("@duplojs/lang/common");
|
|
4
|
+
_duplojs_lang_common = require_runtime.__toESM(_duplojs_lang_common, 1);
|
|
3
5
|
let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
4
6
|
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
5
7
|
//#region scripts/file/makeDirectory.ts
|
|
8
|
+
var MakeDirectoryErrorNotFound = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-not-found", Error) {};
|
|
9
|
+
var MakeDirectoryErrorPermissionDenied = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-permission-denied", Error) {};
|
|
10
|
+
var MakeDirectoryErrorAlreadyExists = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-already-exists", Error) {};
|
|
11
|
+
var MakeDirectoryErrorNotDirectory = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-not-directory", Error) {};
|
|
12
|
+
var MakeDirectoryErrorNoSpace = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-no-space", Error) {};
|
|
13
|
+
var MakeDirectoryErrorReadOnly = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-read-only", Error) {};
|
|
14
|
+
var MakeDirectoryErrorInvalidArgument = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-invalid-argument", Error) {};
|
|
15
|
+
var MakeDirectoryErrorTooManyOpenFiles = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-too-many-open-files", Error) {};
|
|
16
|
+
var MakeDirectoryErrorBusy = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-busy", Error) {};
|
|
17
|
+
var MakeDirectoryError = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-make-directory-error", Error) {};
|
|
6
18
|
function handleNodeMakeDirectoryError(error) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
else if (error.code === "
|
|
11
|
-
else if (error.code === "
|
|
12
|
-
else if (error.code === "
|
|
13
|
-
else if (error.code === "
|
|
14
|
-
else if (error.code === "
|
|
15
|
-
else if (error.code === "
|
|
16
|
-
else if (error.code === "
|
|
19
|
+
let makeDirectoryError = void 0;
|
|
20
|
+
if ("code" in error) {
|
|
21
|
+
if (error.code === "ENOENT") makeDirectoryError = new MakeDirectoryErrorNotFound(error);
|
|
22
|
+
else if (error.code === "EACCES" || error.code === "EPERM") makeDirectoryError = new MakeDirectoryErrorPermissionDenied(error);
|
|
23
|
+
else if (error.code === "EEXIST") makeDirectoryError = new MakeDirectoryErrorAlreadyExists(error);
|
|
24
|
+
else if (error.code === "ENOTDIR") makeDirectoryError = new MakeDirectoryErrorNotDirectory(error);
|
|
25
|
+
else if (error.code === "ENOSPC") makeDirectoryError = new MakeDirectoryErrorNoSpace(error);
|
|
26
|
+
else if (error.code === "EROFS") makeDirectoryError = new MakeDirectoryErrorReadOnly(error);
|
|
27
|
+
else if (error.code === "EINVAL") makeDirectoryError = new MakeDirectoryErrorInvalidArgument(error);
|
|
28
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") makeDirectoryError = new MakeDirectoryErrorTooManyOpenFiles(error);
|
|
29
|
+
else if (error.code === "EBUSY") makeDirectoryError = new MakeDirectoryErrorBusy(error);
|
|
17
30
|
}
|
|
18
|
-
|
|
31
|
+
if (makeDirectoryError === void 0) makeDirectoryError = new MakeDirectoryError(error);
|
|
32
|
+
return _duplojs_lang_either.left("file-system-make-directory-error", makeDirectoryError);
|
|
19
33
|
}
|
|
20
34
|
function handleDenoMakeDirectoryError(error) {
|
|
21
|
-
|
|
22
|
-
if (error instanceof Deno.errors.
|
|
23
|
-
if (error instanceof Deno.errors.
|
|
24
|
-
if (error instanceof Deno.errors.
|
|
25
|
-
if (error instanceof Deno.errors.
|
|
26
|
-
if (error instanceof Deno.errors.
|
|
27
|
-
|
|
35
|
+
let makeDirectoryError = void 0;
|
|
36
|
+
if (error instanceof Deno.errors.NotFound) makeDirectoryError = new MakeDirectoryErrorNotFound(error);
|
|
37
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) makeDirectoryError = new MakeDirectoryErrorPermissionDenied(error);
|
|
38
|
+
else if (error instanceof Deno.errors.AlreadyExists) makeDirectoryError = new MakeDirectoryErrorAlreadyExists(error);
|
|
39
|
+
else if (error instanceof Deno.errors.NotADirectory) makeDirectoryError = new MakeDirectoryErrorNotDirectory(error);
|
|
40
|
+
else if (error instanceof Deno.errors.InvalidData) makeDirectoryError = new MakeDirectoryErrorInvalidArgument(error);
|
|
41
|
+
else if (error instanceof Deno.errors.Busy) makeDirectoryError = new MakeDirectoryErrorBusy(error);
|
|
42
|
+
if (makeDirectoryError === void 0) makeDirectoryError = new MakeDirectoryError(error);
|
|
43
|
+
return _duplojs_lang_either.left("file-system-make-directory-error", makeDirectoryError);
|
|
28
44
|
}
|
|
29
45
|
const makeDirectory = require_implementor.implementFunction("makeDirectory", {
|
|
30
|
-
NODE: async (path, params) => {
|
|
31
|
-
return (await require_implementor.nodeFileSystem.value).mkdir(path, { recursive: params?.recursive }).then(() => _duplojs_lang_either.right("file-system-make-directory")).catch(handleNodeMakeDirectoryError);
|
|
32
|
-
},
|
|
46
|
+
NODE: async (path, params) => require_implementor.nodeFileSystem.value.mkdir(path, { recursive: params?.recursive }).then(() => _duplojs_lang_either.right("file-system-make-directory")).catch(handleNodeMakeDirectoryError),
|
|
33
47
|
DENO: (path, params) => Deno.mkdir(path, { recursive: params?.recursive }).then(() => _duplojs_lang_either.right("file-system-make-directory")).catch(handleDenoMakeDirectoryError)
|
|
34
48
|
});
|
|
35
49
|
//#endregion
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
import { FileSystemEither } from './types';
|
|
2
1
|
import * as DEither from "@duplojs/lang/either";
|
|
3
2
|
import type * as DPath from "@duplojs/lang/path";
|
|
3
|
+
import * as DCommon from "@duplojs/lang/common";
|
|
4
4
|
interface MakeDirectoryParams {
|
|
5
5
|
recursive?: boolean;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
declare const MakeDirectoryErrorNotFound_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-not-found", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-not-found", unknown>>, unknown>;
|
|
8
|
+
declare class MakeDirectoryErrorNotFound extends MakeDirectoryErrorNotFound_base {
|
|
9
|
+
}
|
|
10
|
+
declare const MakeDirectoryErrorPermissionDenied_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-permission-denied", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-permission-denied", unknown>>, unknown>;
|
|
11
|
+
declare class MakeDirectoryErrorPermissionDenied extends MakeDirectoryErrorPermissionDenied_base {
|
|
12
|
+
}
|
|
13
|
+
declare const MakeDirectoryErrorAlreadyExists_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-already-exists", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-already-exists", unknown>>, unknown>;
|
|
14
|
+
declare class MakeDirectoryErrorAlreadyExists extends MakeDirectoryErrorAlreadyExists_base {
|
|
15
|
+
}
|
|
16
|
+
declare const MakeDirectoryErrorNotDirectory_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-not-directory", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-not-directory", unknown>>, unknown>;
|
|
17
|
+
declare class MakeDirectoryErrorNotDirectory extends MakeDirectoryErrorNotDirectory_base {
|
|
18
|
+
}
|
|
19
|
+
declare const MakeDirectoryErrorNoSpace_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-no-space", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-no-space", unknown>>, unknown>;
|
|
20
|
+
declare class MakeDirectoryErrorNoSpace extends MakeDirectoryErrorNoSpace_base {
|
|
21
|
+
}
|
|
22
|
+
declare const MakeDirectoryErrorReadOnly_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-read-only", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-read-only", unknown>>, unknown>;
|
|
23
|
+
declare class MakeDirectoryErrorReadOnly extends MakeDirectoryErrorReadOnly_base {
|
|
24
|
+
}
|
|
25
|
+
declare const MakeDirectoryErrorInvalidArgument_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-invalid-argument", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-invalid-argument", unknown>>, unknown>;
|
|
26
|
+
declare class MakeDirectoryErrorInvalidArgument extends MakeDirectoryErrorInvalidArgument_base {
|
|
27
|
+
}
|
|
28
|
+
declare const MakeDirectoryErrorTooManyOpenFiles_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-too-many-open-files", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-too-many-open-files", unknown>>, unknown>;
|
|
29
|
+
declare class MakeDirectoryErrorTooManyOpenFiles extends MakeDirectoryErrorTooManyOpenFiles_base {
|
|
30
|
+
}
|
|
31
|
+
declare const MakeDirectoryErrorBusy_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-busy", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-busy", unknown>>, unknown>;
|
|
32
|
+
declare class MakeDirectoryErrorBusy extends MakeDirectoryErrorBusy_base {
|
|
33
|
+
}
|
|
34
|
+
declare const MakeDirectoryError_base: abstract new (error: Error) => DCommon.DuploJSError<"file-system-make-directory-error", Error> & import('@duplojs/lang/kind').Kind<import('@duplojs/lang/kind').Handler<import('@duplojs/lang/kind').Definition<"@DuplojsLangCommon/duplojs-error-file-system-make-directory-error", unknown>>, unknown>;
|
|
35
|
+
declare class MakeDirectoryError extends MakeDirectoryError_base {
|
|
36
|
+
}
|
|
37
|
+
export type MakeDirectoryErrors = (MakeDirectoryErrorNotFound | MakeDirectoryErrorPermissionDenied | MakeDirectoryErrorAlreadyExists | MakeDirectoryErrorNotDirectory | MakeDirectoryErrorNoSpace | MakeDirectoryErrorReadOnly | MakeDirectoryErrorInvalidArgument | MakeDirectoryErrorTooManyOpenFiles | MakeDirectoryErrorBusy | MakeDirectoryError);
|
|
38
|
+
export type MakeDirectoryResult = (DEither.Right<"file-system-make-directory", void> | DEither.Left<"file-system-make-directory-error", MakeDirectoryErrors>);
|
|
8
39
|
declare module '../implementor' {
|
|
9
40
|
interface ServerFunction {
|
|
10
41
|
makeDirectory(path: string & DPath.Path, params?: MakeDirectoryParams): Promise<MakeDirectoryResult>;
|