@duplojs/server 0.1.0-beta.2 → 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
|
@@ -4,6 +4,7 @@ import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
|
4
4
|
const defaultErrorInterpreterDataStructureDictionary = {
|
|
5
5
|
...DDataStructure.defaultErrorInterpreterDataStructureDictionary,
|
|
6
6
|
"@DuplojsServerDataStructure/file-type": () => "Expected a valid file.",
|
|
7
|
+
"@DuplojsServerDataStructure/folder-type": () => "Expected a valid folder.",
|
|
7
8
|
"@DuplojsServerDataStructure/size-constraint": (source) => {
|
|
8
9
|
const { min, max } = source.definition;
|
|
9
10
|
if (min !== void 0 && max !== void 0) return `Expected a file size between ${min} and ${max} bytes.`;
|
|
@@ -12,7 +13,8 @@ const defaultErrorInterpreterDataStructureDictionary = {
|
|
|
12
13
|
return "Expected a valid file size.";
|
|
13
14
|
},
|
|
14
15
|
"@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
|
+
"@DuplojsServerDataStructure/file-exist-constraint": () => "Expected the file to exist.",
|
|
17
|
+
"@DuplojsServerDataStructure/folder-exist-constraint": () => "Expected the folder to exist."
|
|
16
18
|
};
|
|
17
19
|
const defaultErrorInterpreterCodecDictionary = [...DDataStructure.defaultErrorInterpreterCodecDictionary, [codecsJson.definition.file, (_codec, issue) => {
|
|
18
20
|
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.";
|
|
@@ -4,9 +4,9 @@ let _duplojs_lang_either = require("@duplojs/lang/either");
|
|
|
4
4
|
_duplojs_lang_either = require_runtime.__toESM(_duplojs_lang_either, 1);
|
|
5
5
|
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
6
6
|
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
7
|
-
//#region scripts/dataStructure/constraint/
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
//#region scripts/dataStructure/constraint/fileExist.ts
|
|
8
|
+
const fileExistConstraintKind = require_kind.createKind("file-exist-constraint");
|
|
9
|
+
const FileExistConstraint = _duplojs_lang_dataStructure.createConstraint(fileExistConstraintKind, ({ init }) => () => init({}, {
|
|
10
10
|
executeCheck: async (_self, data) => {
|
|
11
11
|
const result = _duplojs_lang_either.rightPipe(await data.stat(), (stat) => stat.isFile ? stat : _duplojs_lang_either.fail());
|
|
12
12
|
if (_duplojs_lang_either.isLeft(result)) return _duplojs_lang_dataStructure.ErrorSymbol;
|
|
@@ -15,5 +15,5 @@ const ExistConstraint = _duplojs_lang_dataStructure.createConstraint(existConstr
|
|
|
15
15
|
isAsynchronous: () => true
|
|
16
16
|
}));
|
|
17
17
|
//#endregion
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
18
|
+
exports.FileExistConstraint = FileExistConstraint;
|
|
19
|
+
exports.fileExistConstraintKind = fileExistConstraintKind;
|
|
@@ -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 fileExistConstraintKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/file-exist-constraint", unknown>>;
|
|
6
|
+
export interface FileExistConstraintDefinition extends DDataStructure.ConstraintDefinition {
|
|
7
|
+
}
|
|
8
|
+
export interface FileExistConstraint extends DCommon.UnionToIntersection<DDataStructure.Constraint<DSFile.FileInterface, DSFile.FileInterface, FileExistConstraintDefinition> & DKind.Kind<typeof fileExistConstraintKind>> {
|
|
9
|
+
}
|
|
10
|
+
export declare const FileExistConstraint: () => FileExistConstraint;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createKind } from "../kind.mjs";
|
|
2
2
|
import * as DEither from "@duplojs/lang/either";
|
|
3
3
|
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
-
//#region scripts/dataStructure/constraint/
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
//#region scripts/dataStructure/constraint/fileExist.ts
|
|
5
|
+
const fileExistConstraintKind = createKind("file-exist-constraint");
|
|
6
|
+
const FileExistConstraint = DDataStructure.createConstraint(fileExistConstraintKind, ({ init }) => () => init({}, {
|
|
7
7
|
executeCheck: async (_self, data) => {
|
|
8
8
|
const result = DEither.rightPipe(await data.stat(), (stat) => stat.isFile ? stat : DEither.fail());
|
|
9
9
|
if (DEither.isLeft(result)) return DDataStructure.ErrorSymbol;
|
|
@@ -12,4 +12,4 @@ const ExistConstraint = DDataStructure.createConstraint(existConstraintKind, ({
|
|
|
12
12
|
isAsynchronous: () => true
|
|
13
13
|
}));
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export { FileExistConstraint, fileExistConstraintKind };
|
|
@@ -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/folderExist.ts
|
|
8
|
+
const folderExistConstraintKind = require_kind.createKind("folder-exist-constraint");
|
|
9
|
+
const FolderExistConstraint = _duplojs_lang_dataStructure.createConstraint(folderExistConstraintKind, ({ init }) => () => init({}, {
|
|
10
|
+
executeCheck: async (_self, data) => {
|
|
11
|
+
const result = _duplojs_lang_either.rightPipe(await data.stat(), (stat) => stat.isDirectory ? 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.FolderExistConstraint = FolderExistConstraint;
|
|
19
|
+
exports.folderExistConstraintKind = folderExistConstraintKind;
|
|
@@ -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 folderExistConstraintKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/folder-exist-constraint", unknown>>;
|
|
6
|
+
export interface FolderExistConstraintDefinition extends DDataStructure.ConstraintDefinition {
|
|
7
|
+
}
|
|
8
|
+
export interface FolderExistConstraint extends DCommon.UnionToIntersection<DDataStructure.Constraint<DSFile.FolderInterface, DSFile.FolderInterface, FolderExistConstraintDefinition> & DKind.Kind<typeof folderExistConstraintKind>> {
|
|
9
|
+
}
|
|
10
|
+
export declare const FolderExistConstraint: () => FolderExistConstraint;
|
|
@@ -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/folderExist.ts
|
|
5
|
+
const folderExistConstraintKind = createKind("folder-exist-constraint");
|
|
6
|
+
const FolderExistConstraint = DDataStructure.createConstraint(folderExistConstraintKind, ({ init }) => () => init({}, {
|
|
7
|
+
executeCheck: async (_self, data) => {
|
|
8
|
+
const result = DEither.rightPipe(await data.stat(), (stat) => stat.isDirectory ? stat : DEither.fail());
|
|
9
|
+
if (DEither.isLeft(result)) return DDataStructure.ErrorSymbol;
|
|
10
|
+
return DDataStructure.SuccessSymbol;
|
|
11
|
+
},
|
|
12
|
+
isAsynchronous: () => true
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { FolderExistConstraint, folderExistConstraintKind };
|
|
@@ -8,7 +8,7 @@ _duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructur
|
|
|
8
8
|
const mimeTypeConstraintKind = require_kind.createKind("mime-type-constraint");
|
|
9
9
|
const MimeTypeConstraint = _duplojs_lang_dataStructure.createConstraint(mimeTypeConstraintKind, ({ init }) => (mimeType) => init({ regex: _duplojs_lang_common.toRegExp(mimeType) }, {
|
|
10
10
|
executeCheck: (self, data) => {
|
|
11
|
-
if (self.definition.regex.test(data.getMimeType() ?? "")) return _duplojs_lang_dataStructure.ErrorSymbol;
|
|
11
|
+
if (!self.definition.regex.test(data.getMimeType() ?? "")) return _duplojs_lang_dataStructure.ErrorSymbol;
|
|
12
12
|
return _duplojs_lang_dataStructure.SuccessSymbol;
|
|
13
13
|
},
|
|
14
14
|
isAsynchronous: () => false
|
|
@@ -5,7 +5,7 @@ import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
|
5
5
|
const mimeTypeConstraintKind = createKind("mime-type-constraint");
|
|
6
6
|
const MimeTypeConstraint = DDataStructure.createConstraint(mimeTypeConstraintKind, ({ init }) => (mimeType) => init({ regex: DCommon.toRegExp(mimeType) }, {
|
|
7
7
|
executeCheck: (self, data) => {
|
|
8
|
-
if (self.definition.regex.test(data.getMimeType() ?? "")) return DDataStructure.ErrorSymbol;
|
|
8
|
+
if (!self.definition.regex.test(data.getMimeType() ?? "")) return DDataStructure.ErrorSymbol;
|
|
9
9
|
return DDataStructure.SuccessSymbol;
|
|
10
10
|
},
|
|
11
11
|
isAsynchronous: () => false
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileExistConstraint } from '../fileExist';
|
|
2
|
+
import { FolderExistConstraint } from '../folderExist';
|
|
2
3
|
import { MimeTypeConstraint } from '../mimeType';
|
|
3
4
|
import { SizeConstraint } from '../size';
|
|
4
5
|
declare module "@duplojs/lang/dataStructure" {
|
|
5
6
|
interface ConstraintsStore {
|
|
6
|
-
|
|
7
|
+
fileExist: FileExistConstraint;
|
|
8
|
+
folderExist: FolderExistConstraint;
|
|
7
9
|
size: SizeConstraint;
|
|
8
10
|
mimeType: MimeTypeConstraint;
|
|
9
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_folderInterface = require("../../file/folderInterface.cjs");
|
|
3
|
+
const require_kind = require("../kind.cjs");
|
|
4
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
5
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
6
|
+
//#region scripts/dataStructure/fundamentalType/folder.ts
|
|
7
|
+
const folderFundamentalTypeKind = require_kind.createKind("folder-fundamental-type");
|
|
8
|
+
const TheFolder = _duplojs_lang_dataStructure.createFundamentalType(folderFundamentalTypeKind, (self, data) => require_folderInterface.isFolderInterface(data) ? _duplojs_lang_dataStructure.SuccessSymbol : _duplojs_lang_dataStructure.ErrorSymbol);
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.TheFolder = TheFolder;
|
|
11
|
+
exports.folderFundamentalTypeKind = folderFundamentalTypeKind;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 * as DSFile from '../../file';
|
|
5
|
+
export declare const folderFundamentalTypeKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/folder-fundamental-type", unknown>>;
|
|
6
|
+
export interface TheFolder extends DCommon.UnionToIntersection<DDataStructure.FundamentalType<DSFile.FolderInterface> & DKind.Kind<typeof folderFundamentalTypeKind>> {
|
|
7
|
+
}
|
|
8
|
+
export declare const TheFolder: TheFolder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isFolderInterface } from "../../file/folderInterface.mjs";
|
|
2
|
+
import { createKind } from "../kind.mjs";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
//#region scripts/dataStructure/fundamentalType/folder.ts
|
|
5
|
+
const folderFundamentalTypeKind = createKind("folder-fundamental-type");
|
|
6
|
+
const TheFolder = DDataStructure.createFundamentalType(folderFundamentalTypeKind, (self, data) => isFolderInterface(data) ? DDataStructure.SuccessSymbol : DDataStructure.ErrorSymbol);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { TheFolder, folderFundamentalTypeKind };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
2
2
|
import type * as DSFile from '../../file';
|
|
3
|
-
export declare function file<const GenericConstraints extends readonly DDataStructure.Constraint<DSFile.FileInterface>[] = readonly []>(constraints?: GenericConstraints): NoInfer<DDataStructure.TypeStructure<DSFile.FileInterface
|
|
3
|
+
export declare function file<const GenericConstraints extends readonly DDataStructure.Constraint<DSFile.FileInterface>[] = readonly []>(constraints?: GenericConstraints): NoInfer<DDataStructure.TypeStructure<DSFile.FileInterface<DSFile.EntryPath>, readonly [...GenericConstraints]>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_folder = require("../type/folder.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/helper/folder.ts
|
|
6
|
+
function folder(constraints = []) {
|
|
7
|
+
return _duplojs_lang_dataStructure.TypeStructure(require_folder.FolderType(), constraints);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.folder = folder;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
2
|
+
import type * as DSFile from '../../file';
|
|
3
|
+
export declare function folder<const GenericConstraints extends readonly DDataStructure.Constraint<DSFile.FolderInterface>[] = readonly []>(constraints?: GenericConstraints): NoInfer<DDataStructure.TypeStructure<DSFile.FolderInterface<DSFile.EntryPath>, readonly [...GenericConstraints]>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FolderType } from "../type/folder.mjs";
|
|
2
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
3
|
+
//#region scripts/dataStructure/helper/folder.ts
|
|
4
|
+
function folder(constraints = []) {
|
|
5
|
+
return DDataStructure.TypeStructure(FolderType(), constraints);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { folder };
|
|
@@ -1,45 +1,61 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_kind = require("./kind.cjs");
|
|
3
3
|
const require_file = require("./fundamentalType/file.cjs");
|
|
4
|
+
const require_folder = require("./fundamentalType/folder.cjs");
|
|
4
5
|
const require_json = require("./common/codec/defaults/json.cjs");
|
|
5
6
|
const require_string = require("./common/codec/defaults/string.cjs");
|
|
6
7
|
const require_defaultInterpreter = require("./common/error/defaultInterpreter.cjs");
|
|
7
|
-
const
|
|
8
|
+
const require_fileExist = require("./constraint/fileExist.cjs");
|
|
9
|
+
const require_folderExist = require("./constraint/folderExist.cjs");
|
|
8
10
|
const require_mimeType = require("./constraint/mimeType.cjs");
|
|
9
11
|
const require_size = require("./constraint/size.cjs");
|
|
10
|
-
const
|
|
12
|
+
const require_fileExist$1 = require("./helper/fileExist.cjs");
|
|
11
13
|
const require_file$1 = require("./type/file.cjs");
|
|
14
|
+
const require_folder$1 = require("./type/folder.cjs");
|
|
12
15
|
const require_file$2 = require("./helper/file.cjs");
|
|
16
|
+
const require_folder$2 = require("./helper/folder.cjs");
|
|
17
|
+
const require_folderExist$1 = require("./helper/folderExist.cjs");
|
|
13
18
|
const require_mimeType$1 = require("./helper/mimeType.cjs");
|
|
14
19
|
const require_size$1 = require("./helper/size.cjs");
|
|
15
20
|
//#region scripts/dataStructure/index.ts
|
|
16
21
|
var dataStructure_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
17
|
-
|
|
22
|
+
FileExistConstraint: () => require_fileExist.FileExistConstraint,
|
|
18
23
|
FileType: () => require_file$1.FileType,
|
|
24
|
+
FolderExistConstraint: () => require_folderExist.FolderExistConstraint,
|
|
25
|
+
FolderType: () => require_folder$1.FolderType,
|
|
19
26
|
MimeTypeConstraint: () => require_mimeType.MimeTypeConstraint,
|
|
20
27
|
SizeConstraint: () => require_size.SizeConstraint,
|
|
21
28
|
TheFile: () => require_file.TheFile,
|
|
29
|
+
TheFolder: () => require_folder.TheFolder,
|
|
22
30
|
codecsJson: () => require_json.codecsJson,
|
|
23
31
|
codecsString: () => require_string.codecsString,
|
|
24
32
|
createKind: () => require_kind.createKind,
|
|
25
33
|
defaultErrorInterpreterCodecDictionary: () => require_defaultInterpreter.defaultErrorInterpreterCodecDictionary,
|
|
26
34
|
defaultErrorInterpreterDataStructureDictionary: () => require_defaultInterpreter.defaultErrorInterpreterDataStructureDictionary,
|
|
27
|
-
exist: () => require_exist$1.exist,
|
|
28
|
-
existConstraintKind: () => require_exist.existConstraintKind,
|
|
29
35
|
file: () => require_file$2.file,
|
|
36
|
+
fileExist: () => require_fileExist$1.fileExist,
|
|
37
|
+
fileExistConstraintKind: () => require_fileExist.fileExistConstraintKind,
|
|
30
38
|
fileFundamentalTypeKind: () => require_file.fileFundamentalTypeKind,
|
|
31
39
|
fileTypeKind: () => require_file$1.fileTypeKind,
|
|
40
|
+
folder: () => require_folder$2.folder,
|
|
41
|
+
folderExist: () => require_folderExist$1.folderExist,
|
|
42
|
+
folderExistConstraintKind: () => require_folderExist.folderExistConstraintKind,
|
|
43
|
+
folderFundamentalTypeKind: () => require_folder.folderFundamentalTypeKind,
|
|
44
|
+
folderTypeKind: () => require_folder$1.folderTypeKind,
|
|
32
45
|
mimeType: () => require_mimeType$1.mimeType,
|
|
33
46
|
mimeTypeConstraintKind: () => require_mimeType.mimeTypeConstraintKind,
|
|
34
47
|
size: () => require_size$1.size,
|
|
35
48
|
sizeConstraintKind: () => require_size.sizeConstraintKind
|
|
36
49
|
});
|
|
37
50
|
//#endregion
|
|
38
|
-
exports.
|
|
51
|
+
exports.FileExistConstraint = require_fileExist.FileExistConstraint;
|
|
39
52
|
exports.FileType = require_file$1.FileType;
|
|
53
|
+
exports.FolderExistConstraint = require_folderExist.FolderExistConstraint;
|
|
54
|
+
exports.FolderType = require_folder$1.FolderType;
|
|
40
55
|
exports.MimeTypeConstraint = require_mimeType.MimeTypeConstraint;
|
|
41
56
|
exports.SizeConstraint = require_size.SizeConstraint;
|
|
42
57
|
exports.TheFile = require_file.TheFile;
|
|
58
|
+
exports.TheFolder = require_folder.TheFolder;
|
|
43
59
|
exports.codecsJson = require_json.codecsJson;
|
|
44
60
|
exports.codecsString = require_string.codecsString;
|
|
45
61
|
exports.createKind = require_kind.createKind;
|
|
@@ -51,11 +67,16 @@ Object.defineProperty(exports, "dataStructure_exports", {
|
|
|
51
67
|
});
|
|
52
68
|
exports.defaultErrorInterpreterCodecDictionary = require_defaultInterpreter.defaultErrorInterpreterCodecDictionary;
|
|
53
69
|
exports.defaultErrorInterpreterDataStructureDictionary = require_defaultInterpreter.defaultErrorInterpreterDataStructureDictionary;
|
|
54
|
-
exports.exist = require_exist$1.exist;
|
|
55
|
-
exports.existConstraintKind = require_exist.existConstraintKind;
|
|
56
70
|
exports.file = require_file$2.file;
|
|
71
|
+
exports.fileExist = require_fileExist$1.fileExist;
|
|
72
|
+
exports.fileExistConstraintKind = require_fileExist.fileExistConstraintKind;
|
|
57
73
|
exports.fileFundamentalTypeKind = require_file.fileFundamentalTypeKind;
|
|
58
74
|
exports.fileTypeKind = require_file$1.fileTypeKind;
|
|
75
|
+
exports.folder = require_folder$2.folder;
|
|
76
|
+
exports.folderExist = require_folderExist$1.folderExist;
|
|
77
|
+
exports.folderExistConstraintKind = require_folderExist.folderExistConstraintKind;
|
|
78
|
+
exports.folderFundamentalTypeKind = require_folder.folderFundamentalTypeKind;
|
|
79
|
+
exports.folderTypeKind = require_folder$1.folderTypeKind;
|
|
59
80
|
exports.mimeType = require_mimeType$1.mimeType;
|
|
60
81
|
exports.mimeTypeConstraintKind = require_mimeType.mimeTypeConstraintKind;
|
|
61
82
|
exports.size = require_size$1.size;
|
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { createKind } from "./kind.mjs";
|
|
3
3
|
import { TheFile, fileFundamentalTypeKind } from "./fundamentalType/file.mjs";
|
|
4
|
+
import { TheFolder, folderFundamentalTypeKind } from "./fundamentalType/folder.mjs";
|
|
4
5
|
import { codecsJson } from "./common/codec/defaults/json.mjs";
|
|
5
6
|
import { codecsString } from "./common/codec/defaults/string.mjs";
|
|
6
7
|
import { defaultErrorInterpreterCodecDictionary, defaultErrorInterpreterDataStructureDictionary } from "./common/error/defaultInterpreter.mjs";
|
|
7
|
-
import {
|
|
8
|
+
import { FileExistConstraint, fileExistConstraintKind } from "./constraint/fileExist.mjs";
|
|
9
|
+
import { FolderExistConstraint, folderExistConstraintKind } from "./constraint/folderExist.mjs";
|
|
8
10
|
import { MimeTypeConstraint, mimeTypeConstraintKind } from "./constraint/mimeType.mjs";
|
|
9
11
|
import { SizeConstraint, sizeConstraintKind } from "./constraint/size.mjs";
|
|
10
|
-
import {
|
|
12
|
+
import { fileExist } from "./helper/fileExist.mjs";
|
|
11
13
|
import { FileType, fileTypeKind } from "./type/file.mjs";
|
|
14
|
+
import { FolderType, folderTypeKind } from "./type/folder.mjs";
|
|
12
15
|
import { file } from "./helper/file.mjs";
|
|
16
|
+
import { folder } from "./helper/folder.mjs";
|
|
17
|
+
import { folderExist } from "./helper/folderExist.mjs";
|
|
13
18
|
import { mimeType } from "./helper/mimeType.mjs";
|
|
14
19
|
import { size } from "./helper/size.mjs";
|
|
15
20
|
//#region scripts/dataStructure/index.ts
|
|
16
21
|
var dataStructure_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
-
|
|
22
|
+
FileExistConstraint: () => FileExistConstraint,
|
|
18
23
|
FileType: () => FileType,
|
|
24
|
+
FolderExistConstraint: () => FolderExistConstraint,
|
|
25
|
+
FolderType: () => FolderType,
|
|
19
26
|
MimeTypeConstraint: () => MimeTypeConstraint,
|
|
20
27
|
SizeConstraint: () => SizeConstraint,
|
|
21
28
|
TheFile: () => TheFile,
|
|
29
|
+
TheFolder: () => TheFolder,
|
|
22
30
|
codecsJson: () => codecsJson,
|
|
23
31
|
codecsString: () => codecsString,
|
|
24
32
|
createKind: () => createKind,
|
|
25
33
|
defaultErrorInterpreterCodecDictionary: () => defaultErrorInterpreterCodecDictionary,
|
|
26
34
|
defaultErrorInterpreterDataStructureDictionary: () => defaultErrorInterpreterDataStructureDictionary,
|
|
27
|
-
exist: () => exist,
|
|
28
|
-
existConstraintKind: () => existConstraintKind,
|
|
29
35
|
file: () => file,
|
|
36
|
+
fileExist: () => fileExist,
|
|
37
|
+
fileExistConstraintKind: () => fileExistConstraintKind,
|
|
30
38
|
fileFundamentalTypeKind: () => fileFundamentalTypeKind,
|
|
31
39
|
fileTypeKind: () => fileTypeKind,
|
|
40
|
+
folder: () => folder,
|
|
41
|
+
folderExist: () => folderExist,
|
|
42
|
+
folderExistConstraintKind: () => folderExistConstraintKind,
|
|
43
|
+
folderFundamentalTypeKind: () => folderFundamentalTypeKind,
|
|
44
|
+
folderTypeKind: () => folderTypeKind,
|
|
32
45
|
mimeType: () => mimeType,
|
|
33
46
|
mimeTypeConstraintKind: () => mimeTypeConstraintKind,
|
|
34
47
|
size: () => size,
|
|
35
48
|
sizeConstraintKind: () => sizeConstraintKind
|
|
36
49
|
});
|
|
37
50
|
//#endregion
|
|
38
|
-
export {
|
|
51
|
+
export { FileExistConstraint, FileType, FolderExistConstraint, FolderType, MimeTypeConstraint, SizeConstraint, TheFile, TheFolder, codecsJson, codecsString, createKind, dataStructure_exports, defaultErrorInterpreterCodecDictionary, defaultErrorInterpreterDataStructureDictionary, file, fileExist, fileExistConstraintKind, fileFundamentalTypeKind, fileTypeKind, folder, folderExist, folderExistConstraintKind, folderFundamentalTypeKind, folderTypeKind, mimeType, mimeTypeConstraintKind, size, sizeConstraintKind };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_kind = require("../kind.cjs");
|
|
3
|
+
const require_folder = require("../fundamentalType/folder.cjs");
|
|
4
|
+
let _duplojs_lang_dataStructure = require("@duplojs/lang/dataStructure");
|
|
5
|
+
_duplojs_lang_dataStructure = require_runtime.__toESM(_duplojs_lang_dataStructure, 1);
|
|
6
|
+
//#region scripts/dataStructure/type/folder.ts
|
|
7
|
+
const folderTypeKind = require_kind.createKind("folder-type");
|
|
8
|
+
const FolderType = _duplojs_lang_dataStructure.createType(require_folder.TheFolder, folderTypeKind, ({ init }) => () => init({}, {
|
|
9
|
+
executeCheck: () => _duplojs_lang_dataStructure.SuccessSymbol,
|
|
10
|
+
isAsynchronous: () => false
|
|
11
|
+
}));
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.FolderType = FolderType;
|
|
14
|
+
exports.folderTypeKind = folderTypeKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
import * as FundamentalType from "../fundamentalType";
|
|
6
|
+
export declare const folderTypeKind: DKind.Handler<DKind.Definition<"@DuplojsServerDataStructure/folder-type", unknown>>;
|
|
7
|
+
export interface FolderTypeDefinition extends DDataStructure.TypeDefinition {
|
|
8
|
+
}
|
|
9
|
+
export interface FolderType extends DCommon.UnionToIntersection<DDataStructure.Type<FundamentalType.TheFolder, DSFile.FolderInterface, FolderTypeDefinition> & DKind.Kind<typeof folderTypeKind>> {
|
|
10
|
+
}
|
|
11
|
+
export declare const FolderType: () => FolderType;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createKind } from "../kind.mjs";
|
|
2
|
+
import { TheFolder } from "../fundamentalType/folder.mjs";
|
|
3
|
+
import * as DDataStructure from "@duplojs/lang/dataStructure";
|
|
4
|
+
//#region scripts/dataStructure/type/folder.ts
|
|
5
|
+
const folderTypeKind = createKind("folder-type");
|
|
6
|
+
const FolderType = DDataStructure.createType(TheFolder, folderTypeKind, ({ init }) => () => init({}, {
|
|
7
|
+
executeCheck: () => DDataStructure.SuccessSymbol,
|
|
8
|
+
isAsynchronous: () => false
|
|
9
|
+
}));
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FolderType, folderTypeKind };
|
package/dist/file/appendFile.cjs
CHANGED
|
@@ -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/appendFile.ts
|
|
8
|
+
var AppendFileErrorNotFound = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-not-found", Error) {};
|
|
9
|
+
var AppendFileErrorPermissionDenied = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-permission-denied", Error) {};
|
|
10
|
+
var AppendFileErrorIsDirectory = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-is-directory", Error) {};
|
|
11
|
+
var AppendFileErrorNotDirectory = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-not-directory", Error) {};
|
|
12
|
+
var AppendFileErrorNoSpace = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-no-space", Error) {};
|
|
13
|
+
var AppendFileErrorReadOnly = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-read-only", Error) {};
|
|
14
|
+
var AppendFileErrorInvalidArgument = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-invalid-argument", Error) {};
|
|
15
|
+
var AppendFileErrorTooManyOpenFiles = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-too-many-open-files", Error) {};
|
|
16
|
+
var AppendFileErrorBusy = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-busy", Error) {};
|
|
17
|
+
var AppendFileError = class extends _duplojs_lang_common.DuploJSError.parentClass("file-system-append-file-error", Error) {};
|
|
6
18
|
function handleNodeAppendFileError(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
|
-
|
|
18
|
-
|
|
19
|
+
let appendFileError = void 0;
|
|
20
|
+
if ("code" in error) {
|
|
21
|
+
if (error.code === "ENOENT") appendFileError = new AppendFileErrorNotFound(error);
|
|
22
|
+
else if (error.code === "EACCES" || error.code === "EPERM") appendFileError = new AppendFileErrorPermissionDenied(error);
|
|
23
|
+
else if (error.code === "EISDIR") appendFileError = new AppendFileErrorIsDirectory(error);
|
|
24
|
+
else if (error.code === "ENOTDIR") appendFileError = new AppendFileErrorNotDirectory(error);
|
|
25
|
+
else if (error.code === "ENOSPC") appendFileError = new AppendFileErrorNoSpace(error);
|
|
26
|
+
else if (error.code === "EROFS") appendFileError = new AppendFileErrorReadOnly(error);
|
|
27
|
+
else if (error.code === "EINVAL") appendFileError = new AppendFileErrorInvalidArgument(error);
|
|
28
|
+
else if (error.code === "EMFILE" || error.code === "ENFILE") appendFileError = new AppendFileErrorTooManyOpenFiles(error);
|
|
29
|
+
else if (error.code === "EBUSY") appendFileError = new AppendFileErrorBusy(error);
|
|
30
|
+
else appendFileError = new AppendFileError(error);
|
|
31
|
+
} else appendFileError = new AppendFileError(error);
|
|
32
|
+
return _duplojs_lang_either.left("file-system-append-file-error", appendFileError);
|
|
19
33
|
}
|
|
20
34
|
function handleDenoAppendFileError(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 appendFileError = void 0;
|
|
36
|
+
if (error instanceof Deno.errors.NotFound) appendFileError = new AppendFileErrorNotFound(error);
|
|
37
|
+
else if (error instanceof Deno.errors.PermissionDenied || error instanceof Deno.errors.NotCapable) appendFileError = new AppendFileErrorPermissionDenied(error);
|
|
38
|
+
else if (error instanceof Deno.errors.IsADirectory) appendFileError = new AppendFileErrorIsDirectory(error);
|
|
39
|
+
else if (error instanceof Deno.errors.NotADirectory) appendFileError = new AppendFileErrorNotDirectory(error);
|
|
40
|
+
else if (error instanceof Deno.errors.InvalidData) appendFileError = new AppendFileErrorInvalidArgument(error);
|
|
41
|
+
else if (error instanceof Deno.errors.Busy) appendFileError = new AppendFileErrorBusy(error);
|
|
42
|
+
else appendFileError = new AppendFileError(error);
|
|
43
|
+
return _duplojs_lang_either.left("file-system-append-file-error", appendFileError);
|
|
28
44
|
}
|
|
29
45
|
const appendFileImplementation = require_implementor.implementFunction("appendFile", {
|
|
30
|
-
NODE: async (path, data) =>
|
|
31
|
-
return (await require_implementor.nodeFileSystem.value).appendFile(path, data).then(() => _duplojs_lang_either.right("file-system-append-file")).catch(handleNodeAppendFileError);
|
|
32
|
-
},
|
|
46
|
+
NODE: async (path, data) => require_implementor.nodeFileSystem.value.appendFile(path, data).then(() => _duplojs_lang_either.right("file-system-append-file")).catch(handleNodeAppendFileError),
|
|
33
47
|
DENO: (path, data) => Deno.writeFile(path, data, { append: true }).then(() => _duplojs_lang_either.right("file-system-append-file")).catch(handleDenoAppendFileError)
|
|
34
48
|
});
|
|
35
49
|
function appendFile(...args) {
|