@514labs/moose-lib 0.6.320-ci-6-g8ee5a20d → 0.6.320-ci-4-g05309f4d
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/browserCompatible.js +8 -0
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +8 -0
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/dataModels/toDataModels.js +7 -3
- package/dist/dataModels/toDataModels.js.map +1 -1
- package/dist/dataModels/toDataModels.mjs +7 -3
- package/dist/dataModels/toDataModels.mjs.map +1 -1
- package/dist/dmv2/index.js +8 -0
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +8 -0
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index.js +59 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -21
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +107 -53
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +114 -60
- package/dist/moose-runner.mjs.map +1 -1
- package/dist/moose-tspc.d.mts +1 -0
- package/dist/moose-tspc.d.ts +1 -0
- package/dist/moose-tspc.js +85 -0
- package/dist/moose-tspc.js.map +1 -0
- package/dist/moose-tspc.mjs +62 -0
- package/dist/moose-tspc.mjs.map +1 -0
- package/package.json +3 -2
package/dist/moose-runner.js
CHANGED
|
@@ -30,6 +30,59 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
+
// src/compiler-config.ts
|
|
34
|
+
function getSourceDir() {
|
|
35
|
+
return process.env.MOOSE_SOURCE_DIR || "app";
|
|
36
|
+
}
|
|
37
|
+
function hasCompiledArtifacts(projectRoot = process.cwd()) {
|
|
38
|
+
const sourceDir = getSourceDir();
|
|
39
|
+
const compiledIndexPath = import_path.default.join(
|
|
40
|
+
projectRoot,
|
|
41
|
+
".moose",
|
|
42
|
+
"compiled",
|
|
43
|
+
sourceDir,
|
|
44
|
+
"index.js"
|
|
45
|
+
);
|
|
46
|
+
return (0, import_fs.existsSync)(compiledIndexPath);
|
|
47
|
+
}
|
|
48
|
+
function shouldUseCompiled(projectRoot = process.cwd()) {
|
|
49
|
+
const envSaysCompiled = process.env.MOOSE_USE_COMPILED === "true";
|
|
50
|
+
if (!envSaysCompiled) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const hasArtifacts = hasCompiledArtifacts(projectRoot);
|
|
54
|
+
if (!hasArtifacts) {
|
|
55
|
+
console.warn(
|
|
56
|
+
`[moose] MOOSE_USE_COMPILED=true but no compiled artifacts found at .moose/compiled/${getSourceDir()}/index.js. Falling back to ts-node.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return hasArtifacts;
|
|
60
|
+
}
|
|
61
|
+
var import_fs, import_path, MOOSE_COMPILER_PLUGINS, COMMANDS_REQUIRING_PLUGINS;
|
|
62
|
+
var init_compiler_config = __esm({
|
|
63
|
+
"src/compiler-config.ts"() {
|
|
64
|
+
"use strict";
|
|
65
|
+
import_fs = require("fs");
|
|
66
|
+
import_path = __toESM(require("path"));
|
|
67
|
+
MOOSE_COMPILER_PLUGINS = [
|
|
68
|
+
{
|
|
69
|
+
transform: "./node_modules/@514labs/moose-lib/dist/compilerPlugin.js",
|
|
70
|
+
transformProgram: true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
transform: "typia/lib/transform"
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
COMMANDS_REQUIRING_PLUGINS = [
|
|
77
|
+
"consumption-apis",
|
|
78
|
+
"consumption-type-serializer",
|
|
79
|
+
"dmv2-serializer",
|
|
80
|
+
"streaming-functions",
|
|
81
|
+
"scripts"
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
33
86
|
// src/dmv2/utils/stackTrace.ts
|
|
34
87
|
var init_stackTrace = __esm({
|
|
35
88
|
"src/dmv2/utils/stackTrace.ts"() {
|
|
@@ -1225,7 +1278,7 @@ var init_runner = __esm({
|
|
|
1225
1278
|
...config,
|
|
1226
1279
|
useSSL: config.useSSL ? "true" : "false"
|
|
1227
1280
|
});
|
|
1228
|
-
createPath = (apisDir,
|
|
1281
|
+
createPath = (apisDir, path6) => `${apisDir}${path6}.ts`;
|
|
1229
1282
|
httpLogger = (req, res, startMs) => {
|
|
1230
1283
|
console.log(
|
|
1231
1284
|
`${req.method} ${req.url} ${res.statusCode} ${Date.now() - startMs}ms`
|
|
@@ -1728,15 +1781,12 @@ var init_index = __esm({
|
|
|
1728
1781
|
});
|
|
1729
1782
|
|
|
1730
1783
|
// src/dmv2/internal.ts
|
|
1731
|
-
function getSourceDir() {
|
|
1732
|
-
return import_process.default.env.MOOSE_SOURCE_DIR || "app";
|
|
1733
|
-
}
|
|
1734
1784
|
function findSourceFiles(dir, extensions = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"]) {
|
|
1735
1785
|
const files = [];
|
|
1736
1786
|
try {
|
|
1737
1787
|
const entries = fs2.readdirSync(dir, { withFileTypes: true });
|
|
1738
1788
|
for (const entry of entries) {
|
|
1739
|
-
const fullPath =
|
|
1789
|
+
const fullPath = path3.join(dir, entry.name);
|
|
1740
1790
|
if (entry.isDirectory()) {
|
|
1741
1791
|
if (entry.name !== "node_modules" && !entry.name.startsWith(".")) {
|
|
1742
1792
|
files.push(...findSourceFiles(fullPath, extensions));
|
|
@@ -1745,7 +1795,7 @@ function findSourceFiles(dir, extensions = [".ts", ".tsx", ".js", ".jsx", ".mts"
|
|
|
1745
1795
|
if (entry.name.endsWith(".d.ts") || entry.name.endsWith(".d.mts") || entry.name.endsWith(".d.cts")) {
|
|
1746
1796
|
continue;
|
|
1747
1797
|
}
|
|
1748
|
-
const ext =
|
|
1798
|
+
const ext = path3.extname(entry.name);
|
|
1749
1799
|
if (extensions.includes(ext)) {
|
|
1750
1800
|
files.push(fullPath);
|
|
1751
1801
|
}
|
|
@@ -1757,12 +1807,12 @@ function findSourceFiles(dir, extensions = [".ts", ".tsx", ".js", ".jsx", ".mts"
|
|
|
1757
1807
|
return files;
|
|
1758
1808
|
}
|
|
1759
1809
|
function findUnloadedFiles() {
|
|
1760
|
-
const appDir =
|
|
1810
|
+
const appDir = path3.resolve(import_process.default.cwd(), getSourceDir());
|
|
1761
1811
|
const allSourceFiles = findSourceFiles(appDir);
|
|
1762
1812
|
const loadedFiles = new Set(
|
|
1763
|
-
Object.keys(require.cache).filter((key) => key.startsWith(appDir)).map((key) =>
|
|
1813
|
+
Object.keys(require.cache).filter((key) => key.startsWith(appDir)).map((key) => path3.resolve(key))
|
|
1764
1814
|
);
|
|
1765
|
-
const unloadedFiles = allSourceFiles.map((file) =>
|
|
1815
|
+
const unloadedFiles = allSourceFiles.map((file) => path3.resolve(file)).filter((file) => !loadedFiles.has(file)).map((file) => path3.relative(import_process.default.cwd(), file));
|
|
1766
1816
|
return unloadedFiles;
|
|
1767
1817
|
}
|
|
1768
1818
|
function isS3QueueConfig(config) {
|
|
@@ -2015,15 +2065,16 @@ function findTaskInTree(task, targetName) {
|
|
|
2015
2065
|
}
|
|
2016
2066
|
return void 0;
|
|
2017
2067
|
}
|
|
2018
|
-
var import_process, fs2,
|
|
2068
|
+
var import_process, fs2, path3, moose_internal, defaultRetentionPeriod, toInfraMap, getMooseInternal, dumpMooseInternal, loadIndex, getStreamingFunctions, getApis2, getWorkflows2, getTaskForWorkflow, getWebApps2;
|
|
2019
2069
|
var init_internal = __esm({
|
|
2020
2070
|
"src/dmv2/internal.ts"() {
|
|
2021
2071
|
"use strict";
|
|
2022
2072
|
import_process = __toESM(require("process"));
|
|
2023
2073
|
fs2 = __toESM(require("fs"));
|
|
2024
|
-
|
|
2074
|
+
path3 = __toESM(require("path"));
|
|
2025
2075
|
init_index();
|
|
2026
2076
|
init_commons();
|
|
2077
|
+
init_compiler_config();
|
|
2027
2078
|
moose_internal = {
|
|
2028
2079
|
tables: /* @__PURE__ */ new Map(),
|
|
2029
2080
|
streams: /* @__PURE__ */ new Map(),
|
|
@@ -2308,6 +2359,7 @@ var init_internal = __esm({
|
|
|
2308
2359
|
);
|
|
2309
2360
|
};
|
|
2310
2361
|
loadIndex = () => {
|
|
2362
|
+
const useCompiled2 = shouldUseCompiled();
|
|
2311
2363
|
const registry = getMooseInternal();
|
|
2312
2364
|
registry.tables.clear();
|
|
2313
2365
|
registry.streams.clear();
|
|
@@ -2318,14 +2370,21 @@ var init_internal = __esm({
|
|
|
2318
2370
|
registry.webApps.clear();
|
|
2319
2371
|
registry.materializedViews.clear();
|
|
2320
2372
|
registry.views.clear();
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2373
|
+
if (!useCompiled2) {
|
|
2374
|
+
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
2375
|
+
Object.keys(require.cache).forEach((key) => {
|
|
2376
|
+
if (key.startsWith(appDir)) {
|
|
2377
|
+
delete require.cache[key];
|
|
2378
|
+
}
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2327
2381
|
try {
|
|
2328
|
-
|
|
2382
|
+
const sourceDir = getSourceDir();
|
|
2383
|
+
if (useCompiled2) {
|
|
2384
|
+
require(`${import_process.default.cwd()}/.moose/compiled/${sourceDir}/index.js`);
|
|
2385
|
+
} else {
|
|
2386
|
+
require(`${import_process.default.cwd()}/${sourceDir}/index.ts`);
|
|
2387
|
+
}
|
|
2329
2388
|
} catch (error) {
|
|
2330
2389
|
let hint;
|
|
2331
2390
|
let includeDetails = true;
|
|
@@ -2433,6 +2492,7 @@ var init_internal = __esm({
|
|
|
2433
2492
|
|
|
2434
2493
|
// src/moose-runner.ts
|
|
2435
2494
|
var import_ts_node = require("ts-node");
|
|
2495
|
+
init_compiler_config();
|
|
2436
2496
|
init_internal();
|
|
2437
2497
|
|
|
2438
2498
|
// src/blocks/runner.ts
|
|
@@ -2522,10 +2582,10 @@ var runBlocks = async (config) => {
|
|
|
2522
2582
|
}
|
|
2523
2583
|
}
|
|
2524
2584
|
});
|
|
2525
|
-
for (const
|
|
2526
|
-
console.log(`Adding to queue: ${
|
|
2585
|
+
for (const path6 of blocksFiles) {
|
|
2586
|
+
console.log(`Adding to queue: ${path6}`);
|
|
2527
2587
|
try {
|
|
2528
|
-
const blocks = require(
|
|
2588
|
+
const blocks = require(path6).default;
|
|
2529
2589
|
queue.push({
|
|
2530
2590
|
chClient,
|
|
2531
2591
|
blocks,
|
|
@@ -2534,7 +2594,7 @@ var runBlocks = async (config) => {
|
|
|
2534
2594
|
} catch (err) {
|
|
2535
2595
|
cliLog({
|
|
2536
2596
|
action: "Blocks",
|
|
2537
|
-
message: `Failed to import blocks from ${
|
|
2597
|
+
message: `Failed to import blocks from ${path6}: ${err}`,
|
|
2538
2598
|
message_type: "Error"
|
|
2539
2599
|
});
|
|
2540
2600
|
}
|
|
@@ -3111,11 +3171,9 @@ async function runExportSerializer(targetModel) {
|
|
|
3111
3171
|
|
|
3112
3172
|
// src/consumption-apis/exportTypeSerializer.ts
|
|
3113
3173
|
var import_process2 = __toESM(require("process"));
|
|
3114
|
-
|
|
3115
|
-
return import_process2.default.env.MOOSE_SOURCE_DIR || "app";
|
|
3116
|
-
}
|
|
3174
|
+
init_compiler_config();
|
|
3117
3175
|
async function runApiTypeSerializer(targetModel) {
|
|
3118
|
-
const func = require(`${import_process2.default.cwd()}/${
|
|
3176
|
+
const func = require(`${import_process2.default.cwd()}/${getSourceDir()}/apis/${targetModel}.ts`).default;
|
|
3119
3177
|
const inputSchema = func["moose_input_schema"] || null;
|
|
3120
3178
|
const outputSchema = func["moose_output_schema"] || null;
|
|
3121
3179
|
console.log(
|
|
@@ -3128,7 +3186,7 @@ async function runApiTypeSerializer(targetModel) {
|
|
|
3128
3186
|
|
|
3129
3187
|
// src/scripts/runner.ts
|
|
3130
3188
|
var import_worker2 = require("@temporalio/worker");
|
|
3131
|
-
var
|
|
3189
|
+
var path5 = __toESM(require("path"));
|
|
3132
3190
|
var fs4 = __toESM(require("fs"));
|
|
3133
3191
|
init_internal();
|
|
3134
3192
|
|
|
@@ -3421,7 +3479,7 @@ async function registerWorkflows(logger2, config) {
|
|
|
3421
3479
|
}
|
|
3422
3480
|
};
|
|
3423
3481
|
const workflowBundle = await (0, import_worker2.bundleWorkflowCode)({
|
|
3424
|
-
workflowsPath:
|
|
3482
|
+
workflowsPath: path5.resolve(__dirname, "scripts/workflow.js"),
|
|
3425
3483
|
logger: silentLogger
|
|
3426
3484
|
});
|
|
3427
3485
|
const worker = await import_worker2.Worker.create({
|
|
@@ -3502,31 +3560,27 @@ async function runScripts(config) {
|
|
|
3502
3560
|
// src/moose-runner.ts
|
|
3503
3561
|
var import_process3 = __toESM(require("process"));
|
|
3504
3562
|
var import_commander = require("commander");
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
}
|
|
3526
|
-
(0, import_ts_node.register)({
|
|
3527
|
-
esm: true,
|
|
3528
|
-
experimentalTsImportSpecifiers: true
|
|
3529
|
-
});
|
|
3563
|
+
var useCompiled = shouldUseCompiled();
|
|
3564
|
+
if (!useCompiled) {
|
|
3565
|
+
const command = import_process3.default.argv[2];
|
|
3566
|
+
const needsPlugins = COMMANDS_REQUIRING_PLUGINS.includes(command);
|
|
3567
|
+
if (needsPlugins) {
|
|
3568
|
+
(0, import_ts_node.register)({
|
|
3569
|
+
require: ["tsconfig-paths/register"],
|
|
3570
|
+
esm: true,
|
|
3571
|
+
experimentalTsImportSpecifiers: true,
|
|
3572
|
+
compiler: "ts-patch/compiler",
|
|
3573
|
+
compilerOptions: {
|
|
3574
|
+
plugins: [...MOOSE_COMPILER_PLUGINS],
|
|
3575
|
+
experimentalDecorators: true
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3578
|
+
} else {
|
|
3579
|
+
(0, import_ts_node.register)({
|
|
3580
|
+
esm: true,
|
|
3581
|
+
experimentalTsImportSpecifiers: true
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3530
3584
|
}
|
|
3531
3585
|
var program = new import_commander.Command();
|
|
3532
3586
|
program.name("moose-runner").description("Moose runner for various operations").version("1.0.0");
|