@514labs/moose-lib 0.6.321 → 0.6.322-ci-9-g72529e37
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 +9 -0
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +9 -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 +9 -0
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +9 -0
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index.js +60 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -21
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +140 -57
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +147 -64
- 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 +121 -0
- package/dist/moose-tspc.js.map +1 -0
- package/dist/moose-tspc.mjs +98 -0
- package/dist/moose-tspc.mjs.map +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -450,7 +450,7 @@ var init_commons = __esm({
|
|
|
450
450
|
console.log(message);
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
|
-
antiCachePath = (
|
|
453
|
+
antiCachePath = (path3) => `${path3}?num=${Math.random().toString()}&time=${Date.now()}`;
|
|
454
454
|
getFileName = (filePath) => {
|
|
455
455
|
const regex = /\/([^\/]+)\.ts/;
|
|
456
456
|
const matches = filePath.match(regex);
|
|
@@ -547,10 +547,44 @@ var init_commons = __esm({
|
|
|
547
547
|
}
|
|
548
548
|
});
|
|
549
549
|
|
|
550
|
-
// src/
|
|
550
|
+
// src/compiler-config.ts
|
|
551
551
|
function getSourceDir() {
|
|
552
|
-
return
|
|
552
|
+
return process.env.MOOSE_SOURCE_DIR || "app";
|
|
553
|
+
}
|
|
554
|
+
function hasCompiledArtifacts(projectRoot = process.cwd()) {
|
|
555
|
+
const sourceDir = getSourceDir();
|
|
556
|
+
const compiledIndexPath = import_path.default.join(
|
|
557
|
+
projectRoot,
|
|
558
|
+
".moose",
|
|
559
|
+
"compiled",
|
|
560
|
+
sourceDir,
|
|
561
|
+
"index.js"
|
|
562
|
+
);
|
|
563
|
+
return (0, import_fs.existsSync)(compiledIndexPath);
|
|
564
|
+
}
|
|
565
|
+
function shouldUseCompiled(projectRoot = process.cwd()) {
|
|
566
|
+
const envSaysCompiled = process.env.MOOSE_USE_COMPILED === "true";
|
|
567
|
+
if (!envSaysCompiled) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
const hasArtifacts = hasCompiledArtifacts(projectRoot);
|
|
571
|
+
if (!hasArtifacts) {
|
|
572
|
+
console.warn(
|
|
573
|
+
`[moose] MOOSE_USE_COMPILED=true but no compiled artifacts found at .moose/compiled/${getSourceDir()}/index.js. Falling back to ts-node.`
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
return hasArtifacts;
|
|
553
577
|
}
|
|
578
|
+
var import_fs, import_path;
|
|
579
|
+
var init_compiler_config = __esm({
|
|
580
|
+
"src/compiler-config.ts"() {
|
|
581
|
+
"use strict";
|
|
582
|
+
import_fs = require("fs");
|
|
583
|
+
import_path = __toESM(require("path"));
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
// src/dmv2/internal.ts
|
|
554
588
|
var import_process, isClientOnlyMode, moose_internal, defaultRetentionPeriod, getMooseInternal, loadIndex, dlqSchema, dlqColumns, getWorkflows;
|
|
555
589
|
var init_internal = __esm({
|
|
556
590
|
"src/dmv2/internal.ts"() {
|
|
@@ -558,6 +592,7 @@ var init_internal = __esm({
|
|
|
558
592
|
import_process = __toESM(require("process"));
|
|
559
593
|
init_index();
|
|
560
594
|
init_commons();
|
|
595
|
+
init_compiler_config();
|
|
561
596
|
isClientOnlyMode = () => import_process.default.env.MOOSE_CLIENT_ONLY === "true";
|
|
562
597
|
moose_internal = {
|
|
563
598
|
tables: /* @__PURE__ */ new Map(),
|
|
@@ -576,6 +611,7 @@ var init_internal = __esm({
|
|
|
576
611
|
globalThis.moose_internal = moose_internal;
|
|
577
612
|
}
|
|
578
613
|
loadIndex = () => {
|
|
614
|
+
const useCompiled = shouldUseCompiled();
|
|
579
615
|
const registry = getMooseInternal();
|
|
580
616
|
registry.tables.clear();
|
|
581
617
|
registry.streams.clear();
|
|
@@ -586,14 +622,21 @@ var init_internal = __esm({
|
|
|
586
622
|
registry.webApps.clear();
|
|
587
623
|
registry.materializedViews.clear();
|
|
588
624
|
registry.views.clear();
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
625
|
+
if (!useCompiled) {
|
|
626
|
+
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
627
|
+
Object.keys(require.cache).forEach((key) => {
|
|
628
|
+
if (key.startsWith(appDir)) {
|
|
629
|
+
delete require.cache[key];
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
}
|
|
595
633
|
try {
|
|
596
|
-
|
|
634
|
+
const sourceDir = getSourceDir();
|
|
635
|
+
if (useCompiled) {
|
|
636
|
+
require(`${import_process.default.cwd()}/.moose/compiled/${sourceDir}/index.js`);
|
|
637
|
+
} else {
|
|
638
|
+
require(`${import_process.default.cwd()}/${sourceDir}/index.ts`);
|
|
639
|
+
}
|
|
597
640
|
} catch (error) {
|
|
598
641
|
let hint;
|
|
599
642
|
let includeDetails = true;
|
|
@@ -2177,22 +2220,22 @@ var init_consumptionApi = __esm({
|
|
|
2177
2220
|
return this._handler;
|
|
2178
2221
|
};
|
|
2179
2222
|
async call(baseUrl, queryParams) {
|
|
2180
|
-
let
|
|
2223
|
+
let path3;
|
|
2181
2224
|
if (this.config?.path) {
|
|
2182
2225
|
if (this.config.version) {
|
|
2183
2226
|
const pathEndsWithVersion = this.config.path.endsWith(`/${this.config.version}`) || this.config.path === this.config.version || this.config.path.endsWith(this.config.version) && this.config.path.length > this.config.version.length && this.config.path[this.config.path.length - this.config.version.length - 1] === "/";
|
|
2184
2227
|
if (pathEndsWithVersion) {
|
|
2185
|
-
|
|
2228
|
+
path3 = this.config.path;
|
|
2186
2229
|
} else {
|
|
2187
|
-
|
|
2230
|
+
path3 = `${this.config.path.replace(/\/$/, "")}/${this.config.version}`;
|
|
2188
2231
|
}
|
|
2189
2232
|
} else {
|
|
2190
|
-
|
|
2233
|
+
path3 = this.config.path;
|
|
2191
2234
|
}
|
|
2192
2235
|
} else {
|
|
2193
|
-
|
|
2236
|
+
path3 = this.config?.version ? `${this.name}/${this.config.version}` : this.name;
|
|
2194
2237
|
}
|
|
2195
|
-
const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${
|
|
2238
|
+
const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${path3}`);
|
|
2196
2239
|
const searchParams = url.searchParams;
|
|
2197
2240
|
for (const [key, value] of Object.entries(queryParams)) {
|
|
2198
2241
|
if (Array.isArray(value)) {
|
|
@@ -3286,6 +3329,7 @@ var init_runner = __esm({
|
|
|
3286
3329
|
init_cluster_utils();
|
|
3287
3330
|
init_sqlHelpers();
|
|
3288
3331
|
init_internal();
|
|
3332
|
+
init_compiler_config();
|
|
3289
3333
|
createConsumptionApi = createApi;
|
|
3290
3334
|
}
|
|
3291
3335
|
});
|