exupery-core-bin 0.3.13 → 0.3.15
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/algorithms/procedures/{unguaranteed/copy.d.ts → copy.d.ts} +1 -1
- package/dist/algorithms/procedures/{unguaranteed/remove.js → copy.js} +34 -33
- package/dist/algorithms/procedures/{unguaranteed/execute_any_procedure_executable.d.ts → execute_any_procedure_executable.d.ts} +1 -1
- package/dist/algorithms/procedures/{unguaranteed/execute_any_procedure_executable.js → execute_any_procedure_executable.js} +31 -30
- package/dist/algorithms/procedures/{unguaranteed/execute_any_smelly_procedure_executable.d.ts → execute_any_smelly_procedure_executable.d.ts} +1 -1
- package/dist/algorithms/procedures/{unguaranteed/execute_any_smelly_procedure_executable.js → execute_any_smelly_procedure_executable.js} +37 -36
- package/dist/algorithms/procedures/{guaranteed/log.d.ts → log.d.ts} +1 -1
- package/dist/algorithms/procedures/{guaranteed/log.js → log.js} +11 -10
- package/dist/algorithms/procedures/{guaranteed/log_error.d.ts → log_error.d.ts} +1 -1
- package/dist/algorithms/procedures/{guaranteed/log_error.js → log_error.js} +11 -10
- package/dist/algorithms/procedures/{unguaranteed/make_directory.d.ts → make_directory.d.ts} +1 -1
- package/dist/algorithms/procedures/{unguaranteed/make_directory.js → make_directory.js} +28 -27
- package/dist/algorithms/procedures/{unguaranteed/remove.d.ts → remove.d.ts} +1 -1
- package/dist/algorithms/procedures/remove.js +72 -0
- package/dist/algorithms/procedures/{unguaranteed/write_file.d.ts → write_file.d.ts} +1 -1
- package/dist/algorithms/procedures/{unguaranteed/write_file.js → write_file.js} +31 -30
- package/dist/algorithms/procedures/{guaranteed/write_to_stderr.d.ts → write_to_stderr.d.ts} +1 -1
- package/dist/algorithms/procedures/{guaranteed/write_to_stderr.js → write_to_stderr.js} +9 -8
- package/dist/algorithms/procedures/{guaranteed/write_to_stdout.d.ts → write_to_stdout.d.ts} +1 -1
- package/dist/algorithms/procedures/{guaranteed/write_to_stdout.js → write_to_stdout.js} +9 -8
- package/dist/algorithms/queries/guaranteed/execute_query_executable_and_catch.d.ts +1 -1
- package/dist/algorithms/queries/guaranteed/execute_query_executable_and_catch.js +1 -1
- package/dist/algorithms/queries/guaranteed/get_instream_data.d.ts +1 -1
- package/dist/algorithms/queries/guaranteed/get_instream_data.js +1 -1
- package/dist/algorithms/queries/unguaranteed/execute_any_query_executable.d.ts +1 -1
- package/dist/algorithms/queries/unguaranteed/execute_any_query_executable.js +1 -1
- package/dist/algorithms/queries/unguaranteed/read_directory.d.ts +1 -1
- package/dist/algorithms/queries/unguaranteed/read_directory.js +1 -1
- package/dist/algorithms/queries/unguaranteed/read_file.d.ts +1 -1
- package/dist/algorithms/queries/unguaranteed/read_file.js +1 -1
- package/dist/algorithms/queries/unguaranteed/stat.d.ts +1 -1
- package/dist/algorithms/queries/unguaranteed/stat.js +1 -1
- package/dist/index.d.ts +15 -20
- package/dist/index.js +14 -25
- package/package.json +2 -2
- package/dist/algorithms/procedures/guaranteed/do_nothing.d.ts +0 -2
- package/dist/algorithms/procedures/guaranteed/do_nothing.js +0 -35
- package/dist/algorithms/procedures/unguaranteed/copy.js +0 -71
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/copy/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -27,45 +27,46 @@ exports.$$ = void 0;
|
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
28
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
29
29
|
const fs_1 = require("fs");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
else {
|
|
30
|
+
exports.$$ = {
|
|
31
|
+
'execute with synchrounous data': ($p) => {
|
|
32
|
+
const __possibly_escape_filename = (path, escape) => {
|
|
33
|
+
if (escape) {
|
|
34
|
+
return path.replace(/ /g, '_');
|
|
35
|
+
}
|
|
36
|
+
return path;
|
|
37
|
+
};
|
|
38
|
+
return _easync.__create_procedure({
|
|
39
|
+
'execute': (on_success, on_exception) => {
|
|
40
|
+
const options = {};
|
|
41
|
+
$p.options.recursive.map(($) => { options.recursive = $; });
|
|
42
|
+
$p.options.force.map(($) => { options.force = $; });
|
|
43
|
+
$p.options.errorOnExist.map(($) => { options.errorOnExist = $; });
|
|
44
|
+
(0, fs_1.cp)(__possibly_escape_filename($p.source.path, $p.source['escape spaces in path']), __possibly_escape_filename($p.target.path, $p.target['escape spaces in path']), options, (err) => {
|
|
45
|
+
if (err) {
|
|
47
46
|
on_exception(_ei.block(() => {
|
|
48
47
|
if (err.code === 'ENOENT') {
|
|
49
|
-
return ['
|
|
48
|
+
return ['source does not exist', null];
|
|
50
49
|
}
|
|
51
50
|
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
52
51
|
return ['permission denied', null];
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
if (err.code === 'EISDIR' || err.code === 'ERR_FS_EISDIR') {
|
|
54
|
+
return ['node is not a file', null];
|
|
55
|
+
}
|
|
56
|
+
if (err.code === 'EFBIG') {
|
|
57
|
+
return ['file too large', null];
|
|
58
|
+
}
|
|
59
|
+
if (err.code === 'EIO' || err.code === 'ENXIO') {
|
|
60
|
+
return ['device not ready', null];
|
|
61
|
+
}
|
|
62
|
+
return _ei.panic(`unhandled fs.cp error code: ${err.code}`);
|
|
61
63
|
}));
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
65
|
+
else {
|
|
66
|
+
on_success();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
70
72
|
};
|
|
71
|
-
exports.$$ = $$;
|
|
@@ -5,4 +5,4 @@ import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/ex
|
|
|
5
5
|
* The executable being executed is assumed to only cause side effects
|
|
6
6
|
* and not return any meaningful data, std::out is therefor ignored
|
|
7
7
|
*/
|
|
8
|
-
export declare const $$: _et.
|
|
8
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -32,36 +32,37 @@ const node_child_process_1 = require("node:child_process");
|
|
|
32
32
|
* The executable being executed is assumed to only cause side effects
|
|
33
33
|
* and not return any meaningful data, std::out is therefor ignored
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return ['failed to spawn', { message: err instanceof Error ? err.message : `${err}` }];
|
|
49
|
-
}));
|
|
50
|
-
});
|
|
51
|
-
child.on("close", exitCode => {
|
|
52
|
-
if (exitCode === 0) {
|
|
53
|
-
on_success();
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
35
|
+
exports.$$ = {
|
|
36
|
+
'execute with synchrounous data': ($p) => {
|
|
37
|
+
const args = $p.args.__get_raw_copy();
|
|
38
|
+
return _easync.__create_procedure({
|
|
39
|
+
'execute': (on_success, on_exception) => {
|
|
40
|
+
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
41
|
+
shell: false, // ✅ direct execution, no shell
|
|
42
|
+
});
|
|
43
|
+
let stderrData = "";
|
|
44
|
+
child.stderr.on("data", chunk => {
|
|
45
|
+
stderrData += chunk.toString("utf8");
|
|
46
|
+
});
|
|
47
|
+
child.on("error", err => {
|
|
56
48
|
on_exception(_ei.block(() => {
|
|
57
|
-
return ['
|
|
58
|
-
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
59
|
-
'stderr': stderrData
|
|
60
|
-
}];
|
|
49
|
+
return ['failed to spawn', { message: err instanceof Error ? err.message : `${err}` }];
|
|
61
50
|
}));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
});
|
|
52
|
+
child.on("close", exitCode => {
|
|
53
|
+
if (exitCode === 0) {
|
|
54
|
+
on_success();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
on_exception(_ei.block(() => {
|
|
58
|
+
return ['non zero exit code', {
|
|
59
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
60
|
+
'stderr': stderrData
|
|
61
|
+
}];
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
66
68
|
};
|
|
67
|
-
exports.$$ = $$;
|
|
@@ -5,4 +5,4 @@ import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/ex
|
|
|
5
5
|
* The executable being executed is assumed to only cause side effects
|
|
6
6
|
* and not return any meaningful data, std::out is therefor ignored
|
|
7
7
|
*/
|
|
8
|
-
export declare const $$: _et.
|
|
8
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -33,42 +33,43 @@ const node_child_process_1 = require("node:child_process");
|
|
|
33
33
|
* The executable being executed is assumed to only cause side effects
|
|
34
34
|
* and not return any meaningful data, std::out is therefor ignored
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return ['failed to spawn', { message: err instanceof Error ? err.message : `${err}` }];
|
|
54
|
-
}));
|
|
55
|
-
});
|
|
56
|
-
child.on("close", exitCode => {
|
|
57
|
-
//what does an exit code of null even mean?
|
|
58
|
-
if (exitCode === 0) {
|
|
59
|
-
on_success();
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
36
|
+
exports.$$ = {
|
|
37
|
+
'execute with synchrounous data': ($p) => {
|
|
38
|
+
const args = $p.args.__get_raw_copy();
|
|
39
|
+
return _easync.__create_procedure({
|
|
40
|
+
'execute': (on_success, on_exception) => {
|
|
41
|
+
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
42
|
+
shell: false, // ✅ direct execution, no shell
|
|
43
|
+
});
|
|
44
|
+
let stderrData = "";
|
|
45
|
+
let stdoutData = "";
|
|
46
|
+
child.stdout.on("data", chunk => {
|
|
47
|
+
stdoutData += chunk.toString("utf8");
|
|
48
|
+
});
|
|
49
|
+
child.stderr.on("data", chunk => {
|
|
50
|
+
stderrData += chunk.toString("utf8");
|
|
51
|
+
});
|
|
52
|
+
child.on("error", err => {
|
|
62
53
|
on_exception(_ei.block(() => {
|
|
63
|
-
return ['
|
|
64
|
-
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
65
|
-
'stderr': stderrData,
|
|
66
|
-
'stdout': stdoutData,
|
|
67
|
-
}];
|
|
54
|
+
return ['failed to spawn', { message: err instanceof Error ? err.message : `${err}` }];
|
|
68
55
|
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
});
|
|
57
|
+
child.on("close", exitCode => {
|
|
58
|
+
//what does an exit code of null even mean?
|
|
59
|
+
if (exitCode === 0) {
|
|
60
|
+
on_success();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
on_exception(_ei.block(() => {
|
|
64
|
+
return ['non zero exit code', {
|
|
65
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
66
|
+
'stderr': stderrData,
|
|
67
|
+
'stdout': stdoutData,
|
|
68
|
+
}];
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
73
75
|
};
|
|
74
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/log/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, null>;
|
|
@@ -25,14 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.$$ = void 0;
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
exports.$$ = {
|
|
29
|
+
'execute with synchrounous data': ($p) => {
|
|
30
|
+
return _easync.__create_procedure({
|
|
31
|
+
'execute': (on_success) => {
|
|
32
|
+
$p.lines.__for_each(($) => {
|
|
33
|
+
process.stdout.write($ + `\n`);
|
|
34
|
+
});
|
|
35
|
+
on_success();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
37
39
|
};
|
|
38
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/log_error/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, null>;
|
|
@@ -25,14 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.$$ = void 0;
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
exports.$$ = {
|
|
29
|
+
'execute with synchrounous data': ($p) => {
|
|
30
|
+
return _easync.__create_procedure({
|
|
31
|
+
'execute': (on_success) => {
|
|
32
|
+
$p.lines.__for_each(($) => {
|
|
33
|
+
process.stderr.write($ + `\n`);
|
|
34
|
+
});
|
|
35
|
+
on_success();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
37
39
|
};
|
|
38
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/make_directory/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -27,31 +27,32 @@ exports.$$ = void 0;
|
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
28
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
29
29
|
const fs_1 = require("fs");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
'
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
exports.$$ = {
|
|
31
|
+
'execute with synchrounous data': ($p) => {
|
|
32
|
+
const __possibly_escape_filename = (path, escape) => {
|
|
33
|
+
if (escape) {
|
|
34
|
+
return path.replace(/ /g, '_');
|
|
35
|
+
}
|
|
36
|
+
return path;
|
|
37
|
+
};
|
|
38
|
+
return _easync.__create_procedure({
|
|
39
|
+
'execute': (on_success, on_exception) => {
|
|
40
|
+
(0, fs_1.mkdir)(__possibly_escape_filename($p.path, $p['escape spaces in path']), {
|
|
41
|
+
'recursive': true,
|
|
42
|
+
}, (err, path) => {
|
|
43
|
+
if (err) {
|
|
44
|
+
on_exception(_ei.block(() => {
|
|
45
|
+
if (err.code === 'EEXIST') {
|
|
46
|
+
return ['directory already exists', null];
|
|
47
|
+
}
|
|
48
|
+
return _ei.panic(`unhandled fs.mkdir error code: ${err.code}`);
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
on_success();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
56
58
|
};
|
|
57
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/remove/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.$$ = void 0;
|
|
27
|
+
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
+
const _ei = __importStar(require("exupery-core-internals"));
|
|
29
|
+
const fs_1 = require("fs");
|
|
30
|
+
exports.$$ = {
|
|
31
|
+
'execute with synchrounous data': ($p) => {
|
|
32
|
+
const __possibly_escape_filename = (path, escape) => {
|
|
33
|
+
if (escape) {
|
|
34
|
+
return path.replace(/ /g, '_');
|
|
35
|
+
}
|
|
36
|
+
return path;
|
|
37
|
+
};
|
|
38
|
+
return _easync.__create_procedure({
|
|
39
|
+
'execute': (on_success, on_exception) => {
|
|
40
|
+
(0, fs_1.rm)(__possibly_escape_filename($p.path.path, $p.path['escape spaces in path']), {
|
|
41
|
+
'recursive': true,
|
|
42
|
+
}, (err) => {
|
|
43
|
+
if (err) {
|
|
44
|
+
if (err.code === 'ENOENT' && !$p['error if not exists']) {
|
|
45
|
+
on_success();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
on_exception(_ei.block(() => {
|
|
49
|
+
if (err.code === 'ENOENT') {
|
|
50
|
+
return ['node does not exist', null];
|
|
51
|
+
}
|
|
52
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
53
|
+
return ['permission denied', null];
|
|
54
|
+
}
|
|
55
|
+
// if (err.code === 'EISDIR' || err.code === 'ENOTDIR') {
|
|
56
|
+
// return ['node is not a directory', null]
|
|
57
|
+
// }
|
|
58
|
+
// if (err.code === 'ERR_FS_EISDIR') {
|
|
59
|
+
// return ['node is a directory', null]
|
|
60
|
+
// }
|
|
61
|
+
return _ei.panic(`unhandled fs.rm error code: ${err.code}`);
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
on_success();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/write_file/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, d.Error>;
|
|
@@ -28,29 +28,20 @@ const _easync = __importStar(require("exupery-core-async"));
|
|
|
28
28
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
29
29
|
const fs_1 = require("fs");
|
|
30
30
|
const path_1 = require("path");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
on_exception(_ei.block(() => {
|
|
46
|
-
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
47
|
-
return ['permission denied', null];
|
|
48
|
-
}
|
|
49
|
-
return _ei.panic(`unhandled fs.writeFile error code: ${err.code}`);
|
|
50
|
-
}));
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
(0, fs_1.writeFile)(fname, $p.data, (err) => {
|
|
31
|
+
exports.$$ = {
|
|
32
|
+
'execute with synchrounous data': ($p) => {
|
|
33
|
+
const __possibly_escape_filename = (path, escape) => {
|
|
34
|
+
if (escape) {
|
|
35
|
+
return path.replace(/ /g, '_');
|
|
36
|
+
}
|
|
37
|
+
return path;
|
|
38
|
+
};
|
|
39
|
+
return _easync.__create_procedure({
|
|
40
|
+
'execute': (on_success, on_exception) => {
|
|
41
|
+
const fname = __possibly_escape_filename($p.path.path, $p.path['escape spaces in path']);
|
|
42
|
+
(0, fs_1.mkdir)((0, path_1.dirname)(fname), {
|
|
43
|
+
'recursive': true
|
|
44
|
+
}, (err, path) => {
|
|
54
45
|
if (err) {
|
|
55
46
|
on_exception(_ei.block(() => {
|
|
56
47
|
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
@@ -58,13 +49,23 @@ const $$ = ($p) => {
|
|
|
58
49
|
}
|
|
59
50
|
return _ei.panic(`unhandled fs.writeFile error code: ${err.code}`);
|
|
60
51
|
}));
|
|
52
|
+
return;
|
|
61
53
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
(0, fs_1.writeFile)(fname, $p.data, (err) => {
|
|
55
|
+
if (err) {
|
|
56
|
+
on_exception(_ei.block(() => {
|
|
57
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
58
|
+
return ['permission denied', null];
|
|
59
|
+
}
|
|
60
|
+
return _ei.panic(`unhandled fs.writeFile error code: ${err.code}`);
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
on_success();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
65
67
|
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
69
71
|
};
|
|
70
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/write_to_stderr/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, null>;
|
|
@@ -25,12 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.$$ = void 0;
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
exports.$$ = {
|
|
29
|
+
'execute with synchrounous data': ($p) => {
|
|
30
|
+
return _easync.__create_procedure({
|
|
31
|
+
'execute': (on_success) => {
|
|
32
|
+
process.stderr.write($p);
|
|
33
|
+
on_success();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
35
37
|
};
|
|
36
|
-
exports.$$ = $$;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/write_to_stdout/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Procedure_Primed_With_Resources<d.Parameters, null>;
|
|
@@ -25,12 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.$$ = void 0;
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
exports.$$ = {
|
|
29
|
+
'execute with synchrounous data': ($p) => {
|
|
30
|
+
return _easync.__create_procedure({
|
|
31
|
+
'execute': (on_success) => {
|
|
32
|
+
process.stdout.write($p);
|
|
33
|
+
on_success();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
35
37
|
};
|
|
36
|
-
exports.$$ = $$;
|
|
@@ -5,4 +5,4 @@ import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/ex
|
|
|
5
5
|
* The executable being executed is assumed to be side effect free
|
|
6
6
|
* There is no way to give guarantees about that though
|
|
7
7
|
*/
|
|
8
|
-
export declare const $$: _et.
|
|
8
|
+
export declare const $$: _et.Query_Primed_With_Resources<d.Parameters, d.Result, null>;
|
|
@@ -34,7 +34,7 @@ const node_child_process_1 = require("node:child_process");
|
|
|
34
34
|
*/
|
|
35
35
|
const $$ = ($p) => {
|
|
36
36
|
const args = $p.args.__get_raw_copy();
|
|
37
|
-
return _easync.
|
|
37
|
+
return _easync.__create_query({
|
|
38
38
|
'execute': (on_result) => {
|
|
39
39
|
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
40
40
|
shell: false, // ✅ no implicit parsing
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/get_instream_data/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Query_Primed_With_Resources<null, d.Result, null>;
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.$$ = void 0;
|
|
27
27
|
const _easync = __importStar(require("exupery-core-async"));
|
|
28
28
|
const $$ = () => {
|
|
29
|
-
return _easync.
|
|
29
|
+
return _easync.__create_query({
|
|
30
30
|
'execute': (on_value) => {
|
|
31
31
|
const stdin = process.stdin;
|
|
32
32
|
let data = '';
|
|
@@ -5,4 +5,4 @@ import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/ex
|
|
|
5
5
|
* The executable being executed is assumed to be side effect free
|
|
6
6
|
* There is no way to give guarantees about that though
|
|
7
7
|
*/
|
|
8
|
-
export declare const $$: _et.
|
|
8
|
+
export declare const $$: _et.Query_Primed_With_Resources<d.Parameters, d.Result, d.Error>;
|
|
@@ -34,7 +34,7 @@ const node_child_process_1 = require("node:child_process");
|
|
|
34
34
|
*/
|
|
35
35
|
const $$ = ($p) => {
|
|
36
36
|
const args = $p.args.__get_raw_copy();
|
|
37
|
-
return _easync.
|
|
37
|
+
return _easync.__create_query({
|
|
38
38
|
'execute': (on_value, on_exception) => {
|
|
39
39
|
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
40
40
|
shell: false, // ✅ no implicit parsing
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/read_directory/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Query_Primed_With_Resources<d.Parameters, d.Result, d.Error>;
|
|
@@ -34,7 +34,7 @@ const $$ = ($p) => {
|
|
|
34
34
|
}
|
|
35
35
|
return path;
|
|
36
36
|
};
|
|
37
|
-
return _easync.
|
|
37
|
+
return _easync.__create_query({
|
|
38
38
|
'execute': (on_value, on_exception) => {
|
|
39
39
|
(0, fs_1.readdir)(__possibly_escape_filename($p.path.path, $p.path['escape spaces in path']), {
|
|
40
40
|
'encoding': 'utf-8',
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/read_file/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Query_Primed_With_Resources<d.Parameters, d.Result, d.Error>;
|
|
@@ -34,7 +34,7 @@ const $$ = ($p) => {
|
|
|
34
34
|
}
|
|
35
35
|
return path;
|
|
36
36
|
};
|
|
37
|
-
return _easync.
|
|
37
|
+
return _easync.__create_query({
|
|
38
38
|
'execute': (on_value, on_exception) => {
|
|
39
39
|
(0, fs_1.readFile)(__possibly_escape_filename($p.path, $p['escape spaces in path']), { 'encoding': 'utf-8' }, (err, data) => {
|
|
40
40
|
if (err) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/stat/data_types/target";
|
|
3
|
-
export declare const $$: _et.
|
|
3
|
+
export declare const $$: _et.Query_Primed_With_Resources<d.Parameters, d.Result, d.Error>;
|
|
@@ -34,7 +34,7 @@ const $$ = ($p) => {
|
|
|
34
34
|
}
|
|
35
35
|
return path;
|
|
36
36
|
};
|
|
37
|
-
return _easync.
|
|
37
|
+
return _easync.__create_query({
|
|
38
38
|
'execute': (on_value, on_exception) => {
|
|
39
39
|
(0, fs_1.stat)(__possibly_escape_filename($p.path, $p['escape spaces in path']), (err, stats) => {
|
|
40
40
|
if (err) {
|
package/dist/index.d.ts
CHANGED
|
@@ -22,33 +22,28 @@ export type Error = {
|
|
|
22
22
|
type temp_instream_parameters = null;
|
|
23
23
|
export type Available_Standard_Resources = {
|
|
24
24
|
'procedures': {
|
|
25
|
-
'copy': _et.
|
|
26
|
-
'execute any procedure executable': _et.
|
|
27
|
-
'execute any smelly procedure executable': _et.
|
|
28
|
-
'log error': _et.
|
|
29
|
-
'log': _et.
|
|
30
|
-
'make directory': _et.
|
|
31
|
-
'remove': _et.
|
|
32
|
-
'write file': _et.
|
|
33
|
-
'write to stderr': _et.
|
|
34
|
-
'write to stdout': _et.
|
|
25
|
+
'copy': _et.Procedure_Primed_With_Resources<d_copy.Parameters, d_copy.Error>;
|
|
26
|
+
'execute any procedure executable': _et.Procedure_Primed_With_Resources<d_execute_any_procedure_executable.Parameters, d_execute_any_procedure_executable.Error>;
|
|
27
|
+
'execute any smelly procedure executable': _et.Procedure_Primed_With_Resources<d_execute_any_smelly_procedure_executable.Parameters, d_execute_any_smelly_procedure_executable.Error>;
|
|
28
|
+
'log error': _et.Procedure_Primed_With_Resources<d_log_error.Parameters, null>;
|
|
29
|
+
'log': _et.Procedure_Primed_With_Resources<d_log.Parameters, null>;
|
|
30
|
+
'make directory': _et.Procedure_Primed_With_Resources<d_make_directory.Parameters, d_make_directory.Error>;
|
|
31
|
+
'remove': _et.Procedure_Primed_With_Resources<d_remove.Parameters, d_remove.Error>;
|
|
32
|
+
'write file': _et.Procedure_Primed_With_Resources<d_write_file.Parameters, d_write_file.Error>;
|
|
33
|
+
'write to stderr': _et.Procedure_Primed_With_Resources<d_write_to_stderr.Parameters, null>;
|
|
34
|
+
'write to stdout': _et.Procedure_Primed_With_Resources<d_write_to_stdout.Parameters, null>;
|
|
35
35
|
};
|
|
36
36
|
'queries': {
|
|
37
|
-
'execute any query executable': _et.
|
|
38
|
-
'get instream data': _et.
|
|
39
|
-
'read directory': _et.
|
|
40
|
-
'read file': _et.
|
|
37
|
+
'execute any query executable': _et.Query_Primed_With_Resources<d_execute_any_query_executable.Parameters, d_execute_any_query_executable.Result, d_execute_any_query_executable.Error>;
|
|
38
|
+
'get instream data': _et.Query_Primed_With_Resources<temp_instream_parameters, d_get_instream_data.Result, null>;
|
|
39
|
+
'read directory': _et.Query_Primed_With_Resources<d_read_directory.Parameters, d_read_directory.Result, d_read_directory.Error>;
|
|
40
|
+
'read file': _et.Query_Primed_With_Resources<d_read_file.Parameters, d_read_file.Result, d_read_file.Error>;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Runs a program main function, passing command line arguments (excluding
|
|
45
|
-
* `node` and the script name)
|
|
46
|
-
*/
|
|
47
|
-
export declare const run_guaranteed_main_procedure: (get_main: ($r: Available_Standard_Resources) => _et.Guaranteed_Procedure_Primed_With_Resources<Parameters>) => void;
|
|
48
43
|
/**
|
|
49
44
|
* Runs a program main function, passing command line arguments (excluding
|
|
50
45
|
* `node` and the script name), and setting the process exit code to the
|
|
51
46
|
* returned value when the async value completes.
|
|
52
47
|
*/
|
|
53
|
-
export declare const
|
|
48
|
+
export declare const run_main_procedure: (get_main: ($r: Available_Standard_Resources) => _et.Procedure_Primed_With_Resources<Parameters, Error>) => void;
|
|
54
49
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -23,18 +23,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.run_main_procedure = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
-
const copy_1 = require("./algorithms/procedures/
|
|
29
|
-
const execute_any_procedure_executable_1 = require("./algorithms/procedures/
|
|
30
|
-
const execute_any_smelly_procedure_executable_1 = require("./algorithms/procedures/
|
|
31
|
-
const log_1 = require("./algorithms/procedures/
|
|
32
|
-
const log_error_1 = require("./algorithms/procedures/
|
|
33
|
-
const make_directory_1 = require("./algorithms/procedures/
|
|
34
|
-
const remove_1 = require("./algorithms/procedures/
|
|
35
|
-
const write_file_1 = require("./algorithms/procedures/
|
|
36
|
-
const write_to_stderr_1 = require("./algorithms/procedures/
|
|
37
|
-
const write_to_stdout_1 = require("./algorithms/procedures/
|
|
28
|
+
const copy_1 = require("./algorithms/procedures/copy");
|
|
29
|
+
const execute_any_procedure_executable_1 = require("./algorithms/procedures/execute_any_procedure_executable");
|
|
30
|
+
const execute_any_smelly_procedure_executable_1 = require("./algorithms/procedures/execute_any_smelly_procedure_executable");
|
|
31
|
+
const log_1 = require("./algorithms/procedures/log");
|
|
32
|
+
const log_error_1 = require("./algorithms/procedures/log_error");
|
|
33
|
+
const make_directory_1 = require("./algorithms/procedures/make_directory");
|
|
34
|
+
const remove_1 = require("./algorithms/procedures/remove");
|
|
35
|
+
const write_file_1 = require("./algorithms/procedures/write_file");
|
|
36
|
+
const write_to_stderr_1 = require("./algorithms/procedures/write_to_stderr");
|
|
37
|
+
const write_to_stdout_1 = require("./algorithms/procedures/write_to_stdout");
|
|
38
38
|
const execute_any_query_executable_1 = require("./algorithms/queries/unguaranteed/execute_any_query_executable");
|
|
39
39
|
const get_instream_data_1 = require("./algorithms/queries/guaranteed/get_instream_data");
|
|
40
40
|
const read_directory_1 = require("./algorithms/queries/unguaranteed/read_directory");
|
|
@@ -62,28 +62,17 @@ const create_available_resources = () => {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Runs a program main function, passing command line arguments (excluding
|
|
67
|
-
* `node` and the script name)
|
|
68
|
-
*/
|
|
69
|
-
const run_guaranteed_main_procedure = (get_main) => {
|
|
70
|
-
get_main(create_available_resources())({
|
|
71
|
-
'arguments': _ei.array_literal(process.argv.slice(2))
|
|
72
|
-
}).__start(() => {
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
exports.run_guaranteed_main_procedure = run_guaranteed_main_procedure;
|
|
76
65
|
/**
|
|
77
66
|
* Runs a program main function, passing command line arguments (excluding
|
|
78
67
|
* `node` and the script name), and setting the process exit code to the
|
|
79
68
|
* returned value when the async value completes.
|
|
80
69
|
*/
|
|
81
|
-
const
|
|
82
|
-
get_main(create_available_resources())({
|
|
70
|
+
const run_main_procedure = (get_main) => {
|
|
71
|
+
get_main(create_available_resources())['execute with synchrounous data']({
|
|
83
72
|
'arguments': _ei.array_literal(process.argv.slice(2))
|
|
84
73
|
}).__start(() => {
|
|
85
74
|
}, ($) => {
|
|
86
75
|
process.exitCode = $['exit code'];
|
|
87
76
|
});
|
|
88
77
|
};
|
|
89
|
-
exports.
|
|
78
|
+
exports.run_main_procedure = run_main_procedure;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exupery-core-bin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "this is one of the core packages for Exupery. it provides functionality to create executables",
|
|
6
6
|
"author": "Corno",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "git+https://github.com/corno/exupery-core.git"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"exupery-core-async": "^0.3.
|
|
30
|
+
"exupery-core-async": "^0.3.13",
|
|
31
31
|
"exupery-core-internals": "^0.3.1",
|
|
32
32
|
"exupery-resources": "^0.3.6"
|
|
33
33
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.$$ = void 0;
|
|
27
|
-
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
const $$ = ($p) => {
|
|
29
|
-
return _easync.__create_guaranted_procedure({
|
|
30
|
-
'execute': (on_success) => {
|
|
31
|
-
on_success();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
exports.$$ = $$;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.$$ = void 0;
|
|
27
|
-
const _easync = __importStar(require("exupery-core-async"));
|
|
28
|
-
const _ei = __importStar(require("exupery-core-internals"));
|
|
29
|
-
const fs_1 = require("fs");
|
|
30
|
-
const $$ = ($p) => {
|
|
31
|
-
const __possibly_escape_filename = (path, escape) => {
|
|
32
|
-
if (escape) {
|
|
33
|
-
return path.replace(/ /g, '_');
|
|
34
|
-
}
|
|
35
|
-
return path;
|
|
36
|
-
};
|
|
37
|
-
return _easync.__create_unguaranteed_procedure({
|
|
38
|
-
'execute': (on_success, on_exception) => {
|
|
39
|
-
const options = {};
|
|
40
|
-
$p.options.recursive.map(($) => { options.recursive = $; });
|
|
41
|
-
$p.options.force.map(($) => { options.force = $; });
|
|
42
|
-
$p.options.errorOnExist.map(($) => { options.errorOnExist = $; });
|
|
43
|
-
(0, fs_1.cp)(__possibly_escape_filename($p.source.path, $p.source['escape spaces in path']), __possibly_escape_filename($p.target.path, $p.target['escape spaces in path']), options, (err) => {
|
|
44
|
-
if (err) {
|
|
45
|
-
on_exception(_ei.block(() => {
|
|
46
|
-
if (err.code === 'ENOENT') {
|
|
47
|
-
return ['source does not exist', null];
|
|
48
|
-
}
|
|
49
|
-
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
50
|
-
return ['permission denied', null];
|
|
51
|
-
}
|
|
52
|
-
if (err.code === 'EISDIR' || err.code === 'ERR_FS_EISDIR') {
|
|
53
|
-
return ['node is not a file', null];
|
|
54
|
-
}
|
|
55
|
-
if (err.code === 'EFBIG') {
|
|
56
|
-
return ['file too large', null];
|
|
57
|
-
}
|
|
58
|
-
if (err.code === 'EIO' || err.code === 'ENXIO') {
|
|
59
|
-
return ['device not ready', null];
|
|
60
|
-
}
|
|
61
|
-
return _ei.panic(`unhandled fs.cp error code: ${err.code}`);
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
on_success();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
exports.$$ = $$;
|