exupery-core-bin 0.3.3 → 0.3.4
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/guaranteed/do_nothing.d.ts +2 -0
- package/dist/algorithms/procedures/guaranteed/do_nothing.js +35 -0
- package/dist/algorithms/procedures/guaranteed/log.d.ts +3 -0
- package/dist/algorithms/procedures/guaranteed/log.js +38 -0
- package/dist/algorithms/procedures/guaranteed/log_error.d.ts +3 -0
- package/dist/algorithms/procedures/guaranteed/log_error.js +38 -0
- package/dist/algorithms/procedures/guaranteed/write_to_stderr.d.ts +3 -0
- package/dist/algorithms/procedures/guaranteed/write_to_stderr.js +36 -0
- package/dist/algorithms/procedures/guaranteed/write_to_stdout.d.ts +3 -0
- package/dist/algorithms/procedures/guaranteed/write_to_stdout.js +36 -0
- package/dist/algorithms/procedures/unguaranteed/copy.d.ts +3 -0
- package/dist/algorithms/procedures/unguaranteed/copy.js +71 -0
- package/dist/algorithms/procedures/unguaranteed/execute_any_procedure_executable.d.ts +8 -0
- package/dist/algorithms/procedures/unguaranteed/execute_any_procedure_executable.js +67 -0
- package/dist/algorithms/procedures/unguaranteed/execute_any_smelly_procedure_executable.d.ts +8 -0
- package/dist/algorithms/procedures/unguaranteed/execute_any_smelly_procedure_executable.js +74 -0
- package/dist/algorithms/procedures/unguaranteed/make_directory.d.ts +3 -0
- package/dist/algorithms/procedures/unguaranteed/make_directory.js +57 -0
- package/dist/algorithms/procedures/unguaranteed/remove.d.ts +3 -0
- package/dist/algorithms/procedures/unguaranteed/remove.js +71 -0
- package/dist/algorithms/procedures/unguaranteed/write_file.d.ts +3 -0
- package/dist/algorithms/procedures/unguaranteed/write_file.js +70 -0
- package/dist/algorithms/queries/guaranteed/execute_query_executable_and_catch.d.ts +8 -0
- package/dist/algorithms/queries/guaranteed/execute_query_executable_and_catch.js +71 -0
- package/dist/algorithms/queries/guaranteed/get_instream_data.d.ts +3 -0
- package/dist/algorithms/queries/guaranteed/get_instream_data.js +44 -0
- package/dist/algorithms/queries/unguaranteed/execute_any_query_executable.d.ts +8 -0
- package/dist/algorithms/queries/unguaranteed/execute_any_query_executable.js +75 -0
- package/dist/algorithms/queries/unguaranteed/read_directory.d.ts +3 -0
- package/dist/algorithms/queries/unguaranteed/read_directory.js +65 -0
- package/dist/algorithms/queries/unguaranteed/read_file.d.ts +3 -0
- package/dist/algorithms/queries/unguaranteed/read_file.js +67 -0
- package/dist/algorithms/queries/unguaranteed/stat.d.ts +3 -0
- package/dist/algorithms/queries/unguaranteed/stat.js +55 -0
- package/dist/index.d.ts +32 -3
- package/dist/index.js +24 -4
- package/package.json +4 -3
|
@@ -0,0 +1,35 @@
|
|
|
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 $$ = () => {
|
|
29
|
+
return _easync.__create_guaranted_procedure({
|
|
30
|
+
'execute': (on_success) => {
|
|
31
|
+
on_success();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
$p.lines.__for_each(($) => {
|
|
32
|
+
process.stdout.write($ + `\n`);
|
|
33
|
+
});
|
|
34
|
+
on_success();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
$p.lines.__for_each(($) => {
|
|
32
|
+
process.stderr.write($ + `\n`);
|
|
33
|
+
});
|
|
34
|
+
on_success();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
process.stderr.write($p);
|
|
32
|
+
on_success();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
process.stdout.write($p);
|
|
32
|
+
on_success();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.$$ = $$;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _easync from 'exupery-core-async';
|
|
2
|
+
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/execute_any_procedure_executable/data_types/target";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* The executable being executed is assumed to only cause side effects
|
|
6
|
+
* and not return any meaningful data, std::out is therefor ignored
|
|
7
|
+
*/
|
|
8
|
+
export declare const $$: _easync.Unguaranteed_Procedure<d.Parameters, d.Error, null>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 node_child_process_1 = require("node:child_process");
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* The executable being executed is assumed to only cause side effects
|
|
33
|
+
* and not return any meaningful data, std::out is therefor ignored
|
|
34
|
+
*/
|
|
35
|
+
const $$ = ($p) => {
|
|
36
|
+
const args = $p.args.__get_raw_copy();
|
|
37
|
+
return _easync.__create_unguaranteed_procedure({
|
|
38
|
+
'execute': (on_success, on_exception) => {
|
|
39
|
+
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
40
|
+
shell: false, // ✅ direct execution, no shell
|
|
41
|
+
});
|
|
42
|
+
let stderrData = "";
|
|
43
|
+
child.stderr.on("data", chunk => {
|
|
44
|
+
stderrData += chunk.toString("utf8");
|
|
45
|
+
});
|
|
46
|
+
child.on("error", err => {
|
|
47
|
+
on_exception(_ei.block(() => {
|
|
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 {
|
|
56
|
+
on_exception(_ei.block(() => {
|
|
57
|
+
return ['non zero exit code', {
|
|
58
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
59
|
+
'stderr': stderrData
|
|
60
|
+
}];
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _easync from 'exupery-core-async';
|
|
2
|
+
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/execute_any_smelly_procedure_executable/data_types/target";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* The executable being executed is assumed to only cause side effects
|
|
6
|
+
* and not return any meaningful data, std::out is therefor ignored
|
|
7
|
+
*/
|
|
8
|
+
export declare const $$: _easync.Unguaranteed_Procedure<d.Parameters, d.Error, null>;
|
|
@@ -0,0 +1,74 @@
|
|
|
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 node_child_process_1 = require("node:child_process");
|
|
30
|
+
// import { Signature } from "exupery-resources/dist/interface/algorithms/procedures/unguaranteed/execute_smelly_procedure_executable"
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* The executable being executed is assumed to only cause side effects
|
|
34
|
+
* and not return any meaningful data, std::out is therefor ignored
|
|
35
|
+
*/
|
|
36
|
+
const $$ = ($p) => {
|
|
37
|
+
const args = $p.args.__get_raw_copy();
|
|
38
|
+
return _easync.__create_unguaranteed_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
|
+
let stdoutData = "";
|
|
45
|
+
child.stdout.on("data", chunk => {
|
|
46
|
+
stdoutData += chunk.toString("utf8");
|
|
47
|
+
});
|
|
48
|
+
child.stderr.on("data", chunk => {
|
|
49
|
+
stderrData += chunk.toString("utf8");
|
|
50
|
+
});
|
|
51
|
+
child.on("error", err => {
|
|
52
|
+
on_exception(_ei.block(() => {
|
|
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 {
|
|
62
|
+
on_exception(_ei.block(() => {
|
|
63
|
+
return ['non zero exit code', {
|
|
64
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
65
|
+
'stderr': stderrData,
|
|
66
|
+
'stdout': stdoutData,
|
|
67
|
+
}];
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
(0, fs_1.mkdir)(__possibly_escape_filename($p.path, $p['escape spaces in path']), {
|
|
40
|
+
'recursive': true,
|
|
41
|
+
}, (err, path) => {
|
|
42
|
+
if (err) {
|
|
43
|
+
on_exception(_ei.block(() => {
|
|
44
|
+
if (err.code === 'EEXIST') {
|
|
45
|
+
return ['directory already exists', null];
|
|
46
|
+
}
|
|
47
|
+
return _ei.panic(`unhandled fs.mkdir error code: ${err.code}`);
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
on_success();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
(0, fs_1.rm)(__possibly_escape_filename($p.path.path, $p.path['escape spaces in path']), {
|
|
40
|
+
'recursive': true,
|
|
41
|
+
}, (err) => {
|
|
42
|
+
if (err) {
|
|
43
|
+
if (err.code === 'ENOENT' && !$p['error if not exists']) {
|
|
44
|
+
on_success();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
on_exception(_ei.block(() => {
|
|
48
|
+
if (err.code === 'ENOENT') {
|
|
49
|
+
return ['node does not exist', null];
|
|
50
|
+
}
|
|
51
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
52
|
+
return ['permission denied', null];
|
|
53
|
+
}
|
|
54
|
+
// if (err.code === 'EISDIR' || err.code === 'ENOTDIR') {
|
|
55
|
+
// return ['node is not a directory', null]
|
|
56
|
+
// }
|
|
57
|
+
// if (err.code === 'ERR_FS_EISDIR') {
|
|
58
|
+
// return ['node is a directory', null]
|
|
59
|
+
// }
|
|
60
|
+
return _ei.panic(`unhandled fs.rm error code: ${err.code}`);
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
on_success();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 path_1 = require("path");
|
|
31
|
+
const $$ = ($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_unguaranteed_procedure({
|
|
39
|
+
'execute': (on_success, on_exception) => {
|
|
40
|
+
const fname = __possibly_escape_filename($p.path.path, $p.path['escape spaces in path']);
|
|
41
|
+
(0, fs_1.mkdir)((0, path_1.dirname)(fname), {
|
|
42
|
+
'recursive': true
|
|
43
|
+
}, (err, path) => {
|
|
44
|
+
if (err) {
|
|
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) => {
|
|
54
|
+
if (err) {
|
|
55
|
+
on_exception(_ei.block(() => {
|
|
56
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
57
|
+
return ['permission denied', null];
|
|
58
|
+
}
|
|
59
|
+
return _ei.panic(`unhandled fs.writeFile error code: ${err.code}`);
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
on_success();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _easync from 'exupery-core-async';
|
|
2
|
+
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/execute_query_executable_and_catch/data_types/target";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* The executable being executed is assumed to be side effect free
|
|
6
|
+
* There is no way to give guarantees about that though
|
|
7
|
+
*/
|
|
8
|
+
export declare const $$: _easync.Guaranteed_Query<d.Parameters, d.Result, null>;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 node_child_process_1 = require("node:child_process");
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* The executable being executed is assumed to be side effect free
|
|
33
|
+
* There is no way to give guarantees about that though
|
|
34
|
+
*/
|
|
35
|
+
const $$ = ($p) => {
|
|
36
|
+
const args = $p.args.__get_raw_copy();
|
|
37
|
+
return _easync.__create_guaranteed_query({
|
|
38
|
+
'execute': (on_result) => {
|
|
39
|
+
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
40
|
+
shell: false, // ✅ no implicit parsing
|
|
41
|
+
});
|
|
42
|
+
let stdoutData = "";
|
|
43
|
+
let stderrData = "";
|
|
44
|
+
child.stdout.on("data", chunk => {
|
|
45
|
+
stdoutData += chunk.toString("utf8");
|
|
46
|
+
});
|
|
47
|
+
child.stderr.on("data", chunk => {
|
|
48
|
+
stderrData += chunk.toString("utf8");
|
|
49
|
+
});
|
|
50
|
+
child.on("error", err => {
|
|
51
|
+
on_result(['error', ['failed to spawn', {
|
|
52
|
+
message: err instanceof Error ? err.message : `${err}`
|
|
53
|
+
}]]);
|
|
54
|
+
});
|
|
55
|
+
child.on("close", exitCode => {
|
|
56
|
+
if (exitCode === 0) {
|
|
57
|
+
on_result(['success', {
|
|
58
|
+
stdout: stdoutData,
|
|
59
|
+
}]);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
on_result(['error', ['non zero exit code', {
|
|
63
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
64
|
+
'stderr': stderrData,
|
|
65
|
+
}]]);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 $$ = () => {
|
|
29
|
+
return _easync.__create_guaranteed_query({
|
|
30
|
+
'execute': (on_value) => {
|
|
31
|
+
const stdin = process.stdin;
|
|
32
|
+
let data = '';
|
|
33
|
+
stdin.setEncoding('utf8');
|
|
34
|
+
stdin.on('data', (chunk) => {
|
|
35
|
+
data += chunk;
|
|
36
|
+
});
|
|
37
|
+
stdin.on('end', () => {
|
|
38
|
+
on_value(data);
|
|
39
|
+
});
|
|
40
|
+
stdin.resume();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _easync from 'exupery-core-async';
|
|
2
|
+
import * as d from "exupery-resources/dist/interface/generated/pareto/schemas/execute_any_query_executable/data_types/target";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* The executable being executed is assumed to be side effect free
|
|
6
|
+
* There is no way to give guarantees about that though
|
|
7
|
+
*/
|
|
8
|
+
export declare const $$: _easync.Unguaranteed_Query<d.Parameters, d.Result, d.Error, null>;
|
|
@@ -0,0 +1,75 @@
|
|
|
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 node_child_process_1 = require("node:child_process");
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* The executable being executed is assumed to be side effect free
|
|
33
|
+
* There is no way to give guarantees about that though
|
|
34
|
+
*/
|
|
35
|
+
const $$ = ($p) => {
|
|
36
|
+
const args = $p.args.__get_raw_copy();
|
|
37
|
+
return _easync.__create_unguaranteed_query({
|
|
38
|
+
'execute': (on_value, on_exception) => {
|
|
39
|
+
const child = (0, node_child_process_1.spawn)($p.program, args, {
|
|
40
|
+
shell: false, // ✅ no implicit parsing
|
|
41
|
+
});
|
|
42
|
+
let stdoutData = "";
|
|
43
|
+
let stderrData = "";
|
|
44
|
+
child.stdout.on("data", chunk => {
|
|
45
|
+
stdoutData += chunk.toString("utf8");
|
|
46
|
+
});
|
|
47
|
+
child.stderr.on("data", chunk => {
|
|
48
|
+
stderrData += chunk.toString("utf8");
|
|
49
|
+
});
|
|
50
|
+
child.on("error", err => {
|
|
51
|
+
on_exception(_ei.block(() => {
|
|
52
|
+
return ['failed to spawn', {
|
|
53
|
+
message: err instanceof Error ? err.message : `${err}`
|
|
54
|
+
}];
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
child.on("close", exitCode => {
|
|
58
|
+
if (exitCode === 0) {
|
|
59
|
+
on_value({
|
|
60
|
+
stdout: stdoutData,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
on_exception(_ei.block(() => {
|
|
65
|
+
return ['non zero exit code', {
|
|
66
|
+
'exit code': exitCode === null ? _ei.not_set() : _ei.set(exitCode),
|
|
67
|
+
'stderr': stderrData,
|
|
68
|
+
}];
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,65 @@
|
|
|
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_query({
|
|
38
|
+
'execute': (on_value, on_exception) => {
|
|
39
|
+
(0, fs_1.readdir)(__possibly_escape_filename($p.path.path, $p.path['escape spaces in path']), {
|
|
40
|
+
'encoding': 'utf-8',
|
|
41
|
+
'withFileTypes': true,
|
|
42
|
+
}, (err, files) => {
|
|
43
|
+
if (err) {
|
|
44
|
+
on_exception(_ei.block(() => {
|
|
45
|
+
if (err.code === 'ENOENT') {
|
|
46
|
+
return ['directory does not exist', null];
|
|
47
|
+
}
|
|
48
|
+
if (err.code === 'ENOTDIR' || err.code === 'EISDIR') {
|
|
49
|
+
return ['node is not a directory', null];
|
|
50
|
+
}
|
|
51
|
+
return _ei.panic(`unhandled fs.readdir error code: ${err.code}`);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const out = {};
|
|
56
|
+
files.forEach((file) => {
|
|
57
|
+
out[($p['prepend results with path'] ? ($p.path.path + "/") : "") + file.name] = file.isFile() ? ['file', null] : ['directory', null];
|
|
58
|
+
});
|
|
59
|
+
on_value(_ei.dictionary_literal(out));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,67 @@
|
|
|
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_query({
|
|
38
|
+
'execute': (on_value, on_exception) => {
|
|
39
|
+
(0, fs_1.readFile)(__possibly_escape_filename($p.path, $p['escape spaces in path']), { 'encoding': 'utf-8' }, (err, data) => {
|
|
40
|
+
if (err) {
|
|
41
|
+
on_exception(_ei.block(() => {
|
|
42
|
+
if (err.code === 'ENOENT') {
|
|
43
|
+
return ['file does not exist', null];
|
|
44
|
+
}
|
|
45
|
+
if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
46
|
+
return ['permission denied', null];
|
|
47
|
+
}
|
|
48
|
+
if (err.code === 'EISDIR' || err.code === 'ENOTDIR') {
|
|
49
|
+
return ['node is not a file', null];
|
|
50
|
+
}
|
|
51
|
+
if (err.code === 'EFBIG') {
|
|
52
|
+
return ['file too large', null];
|
|
53
|
+
}
|
|
54
|
+
if (err.code === 'EIO' || err.code === 'ENXIO') {
|
|
55
|
+
return ['device not ready', null];
|
|
56
|
+
}
|
|
57
|
+
return _ei.panic(`unhandled fs.readFile error code: ${err.code}`);
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
on_value(data);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.$$ = $$;
|
|
@@ -0,0 +1,55 @@
|
|
|
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_query({
|
|
38
|
+
'execute': (on_value, on_exception) => {
|
|
39
|
+
(0, fs_1.stat)(__possibly_escape_filename($p.path, $p['escape spaces in path']), (err, stats) => {
|
|
40
|
+
if (err) {
|
|
41
|
+
on_exception(_ei.block(() => {
|
|
42
|
+
if (err.code === 'ENOENT') {
|
|
43
|
+
return ['node does not exist', null];
|
|
44
|
+
}
|
|
45
|
+
return _ei.panic(`unhandled fs.stat error code: ${err.code}`);
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
on_value(stats.isFile()
|
|
49
|
+
? ['file', null]
|
|
50
|
+
: ['directory', null]);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
exports.$$ = $$;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import * as _easync from 'exupery-core-async';
|
|
3
|
+
import * as d_copy from "exupery-resources/dist/interface/generated/pareto/schemas/copy/data_types/source";
|
|
4
|
+
import * as d_make_directory from "exupery-resources/dist/interface/generated/pareto/schemas/make_directory/data_types/source";
|
|
5
|
+
import * as d_write_file from "exupery-resources/dist/interface/generated/pareto/schemas/write_file/data_types/source";
|
|
6
|
+
import * as d_execute_any_procedure_executable from "exupery-resources/dist/interface/generated/pareto/schemas/execute_any_procedure_executable/data_types/target";
|
|
7
|
+
import * as d_log from "exupery-resources/dist/interface/generated/pareto/schemas/log/data_types/target";
|
|
8
|
+
import * as d_log_error from "exupery-resources/dist/interface/generated/pareto/schemas/log_error/data_types/target";
|
|
9
|
+
import * as d_write_to_stdout from "exupery-resources/dist/interface/generated/pareto/schemas/write_to_stdout/data_types/target";
|
|
10
|
+
import * as d_write_to_stderr from "exupery-resources/dist/interface/generated/pareto/schemas/write_to_stderr/data_types/target";
|
|
11
|
+
import * as d_execute_any_query_executable from "exupery-resources/dist/interface/generated/pareto/schemas/execute_any_query_executable/data_types/target";
|
|
12
|
+
import * as d_read_file from "exupery-resources/dist/interface/generated/pareto/schemas/read_file/data_types/target";
|
|
13
|
+
import * as d_stat from "exupery-resources/dist/interface/generated/pareto/schemas/stat/data_types/target";
|
|
14
|
+
import * as d_read_directory from "exupery-resources/dist/interface/generated/pareto/schemas/read_directory/data_types/target";
|
|
3
15
|
export type Parameters = {
|
|
4
16
|
'arguments': _et.Array<string>;
|
|
5
17
|
};
|
|
6
18
|
export type Error = {
|
|
7
19
|
'exit code': number;
|
|
8
20
|
};
|
|
9
|
-
export type
|
|
21
|
+
export type Available_Standard_Resources = {
|
|
22
|
+
'procedures': {
|
|
23
|
+
'copy': _easync.Guaranteed_Procedure<d_copy.Parameters, null>;
|
|
24
|
+
'make directory': _easync.Guaranteed_Procedure<d_make_directory.Parameters, null>;
|
|
25
|
+
'write file': _easync.Guaranteed_Procedure<d_write_file.Parameters, null>;
|
|
26
|
+
'execute any procedure executable': _easync.Guaranteed_Procedure<d_execute_any_procedure_executable.Parameters, null>;
|
|
27
|
+
'log': _easync.Guaranteed_Procedure<d_log.Parameters, null>;
|
|
28
|
+
'log error': _easync.Guaranteed_Procedure<d_log_error.Parameters, null>;
|
|
29
|
+
'write to stdout': _easync.Guaranteed_Procedure<d_write_to_stdout.Parameters, null>;
|
|
30
|
+
'write to stderr': _easync.Guaranteed_Procedure<d_write_to_stderr.Parameters, null>;
|
|
31
|
+
};
|
|
32
|
+
'queries': {
|
|
33
|
+
'execute any query executable': _easync.Unguaranteed_Procedure<d_execute_any_query_executable.Parameters, d_execute_any_query_executable.Result, d_execute_any_query_executable.Error>;
|
|
34
|
+
'read file': _easync.Unguaranteed_Procedure<d_read_file.Parameters, d_read_file.Result, d_read_file.Error>;
|
|
35
|
+
'stat': _easync.Unguaranteed_Procedure<d_stat.Parameters, d_stat.Result, d_stat.Error>;
|
|
36
|
+
'read directory': _easync.Unguaranteed_Procedure<d_read_directory.Parameters, d_read_directory.Result, d_read_directory.Error>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
10
39
|
/**
|
|
11
40
|
* Runs a program main function, passing command line arguments (excluding
|
|
12
41
|
* `node` and the script name)
|
|
13
42
|
*/
|
|
14
|
-
export declare const run_guaranteed_main_procedure: (main: _easync.Guaranteed_Procedure<Parameters,
|
|
43
|
+
export declare const run_guaranteed_main_procedure: <Main_Resources>(initialize_resources: ($r: Available_Standard_Resources) => Main_Resources, main: _easync.Guaranteed_Procedure<Parameters, Main_Resources>) => void;
|
|
15
44
|
/**
|
|
16
45
|
* Runs a program main function, passing command line arguments (excluding
|
|
17
46
|
* `node` and the script name), and setting the process exit code to the
|
|
18
47
|
* returned value when the async value completes.
|
|
19
48
|
*/
|
|
20
|
-
export declare const run_unguaranteed_main_procedure: (main: _easync.Unguaranteed_Procedure<Parameters, Error,
|
|
49
|
+
export declare const run_unguaranteed_main_procedure: <Main_Resources>(initialize_resources: ($r: Available_Standard_Resources) => Main_Resources, main: _easync.Unguaranteed_Procedure<Parameters, Error, Main_Resources>) => void;
|
package/dist/index.js
CHANGED
|
@@ -25,14 +25,34 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.run_unguaranteed_main_procedure = exports.run_guaranteed_main_procedure = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
+
const create_available_resources = () => {
|
|
29
|
+
return {
|
|
30
|
+
'procedures': {
|
|
31
|
+
'copy': require('../algorithms/procedures/guaranteed/copy').$$,
|
|
32
|
+
'make directory': require('../algorithms/procedures/guaranteed/make_directory').$$,
|
|
33
|
+
'write file': require('../algorithms/procedures/guaranteed/write_file').$$,
|
|
34
|
+
'execute any procedure executable': require('../algorithms/procedures/guaranteed/execute_any_procedure_executable').$$,
|
|
35
|
+
'log': require('../algorithms/procedures/guaranteed/log').$$,
|
|
36
|
+
'log error': require('../algorithms/procedures/guaranteed/log_error').$$,
|
|
37
|
+
'write to stdout': require('../algorithms/procedures/guaranteed/write_to_stdout').$$,
|
|
38
|
+
'write to stderr': require('../algorithms/procedures/guaranteed/write_to_stderr').$$,
|
|
39
|
+
},
|
|
40
|
+
'queries': {
|
|
41
|
+
'execute any query executable': require('../algorithms/queries/unguaranteed/execute_any_query_executable').$$,
|
|
42
|
+
'read file': require('../algorithms/queries/unguaranteed/read_file').$$,
|
|
43
|
+
'stat': require('../algorithms/queries/unguaranteed/stat').$$,
|
|
44
|
+
'read directory': require('../algorithms/queries/unguaranteed/read_directory').$$,
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
28
48
|
/**
|
|
29
49
|
* Runs a program main function, passing command line arguments (excluding
|
|
30
50
|
* `node` and the script name)
|
|
31
51
|
*/
|
|
32
|
-
const run_guaranteed_main_procedure = (main) => {
|
|
52
|
+
const run_guaranteed_main_procedure = (initialize_resources, main) => {
|
|
33
53
|
main({
|
|
34
54
|
'arguments': _ei.array_literal(process.argv.slice(2))
|
|
35
|
-
},
|
|
55
|
+
}, initialize_resources(create_available_resources())).__start(() => { });
|
|
36
56
|
};
|
|
37
57
|
exports.run_guaranteed_main_procedure = run_guaranteed_main_procedure;
|
|
38
58
|
/**
|
|
@@ -40,10 +60,10 @@ exports.run_guaranteed_main_procedure = run_guaranteed_main_procedure;
|
|
|
40
60
|
* `node` and the script name), and setting the process exit code to the
|
|
41
61
|
* returned value when the async value completes.
|
|
42
62
|
*/
|
|
43
|
-
const run_unguaranteed_main_procedure = (main) => {
|
|
63
|
+
const run_unguaranteed_main_procedure = (initialize_resources, main) => {
|
|
44
64
|
main({
|
|
45
65
|
'arguments': _ei.array_literal(process.argv.slice(2))
|
|
46
|
-
},
|
|
66
|
+
}, initialize_resources(create_available_resources())).__start(() => {
|
|
47
67
|
}, ($) => {
|
|
48
68
|
process.exitCode = $['exit code'];
|
|
49
69
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exupery-core-bin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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,8 @@
|
|
|
27
27
|
"url": "git+https://github.com/corno/exupery-core.git"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"exupery-core-async": "^0.3.
|
|
31
|
-
"exupery-core-internals": "^0.3.0"
|
|
30
|
+
"exupery-core-async": "^0.3.5",
|
|
31
|
+
"exupery-core-internals": "^0.3.0",
|
|
32
|
+
"exupery-resources": "^0.3.4"
|
|
32
33
|
}
|
|
33
34
|
}
|