@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.mjs
CHANGED
|
@@ -434,7 +434,7 @@ var init_commons = __esm({
|
|
|
434
434
|
console.log(message);
|
|
435
435
|
}
|
|
436
436
|
};
|
|
437
|
-
antiCachePath = (
|
|
437
|
+
antiCachePath = (path3) => `${path3}?num=${Math.random().toString()}&time=${Date.now()}`;
|
|
438
438
|
getFileName = (filePath) => {
|
|
439
439
|
const regex = /\/([^\/]+)\.ts/;
|
|
440
440
|
const matches = filePath.match(regex);
|
|
@@ -531,17 +531,51 @@ var init_commons = __esm({
|
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
533
|
|
|
534
|
-
// src/
|
|
535
|
-
import
|
|
534
|
+
// src/compiler-config.ts
|
|
535
|
+
import { existsSync } from "fs";
|
|
536
|
+
import path from "path";
|
|
536
537
|
function getSourceDir() {
|
|
537
|
-
return
|
|
538
|
+
return process.env.MOOSE_SOURCE_DIR || "app";
|
|
539
|
+
}
|
|
540
|
+
function hasCompiledArtifacts(projectRoot = process.cwd()) {
|
|
541
|
+
const sourceDir = getSourceDir();
|
|
542
|
+
const compiledIndexPath = path.join(
|
|
543
|
+
projectRoot,
|
|
544
|
+
".moose",
|
|
545
|
+
"compiled",
|
|
546
|
+
sourceDir,
|
|
547
|
+
"index.js"
|
|
548
|
+
);
|
|
549
|
+
return existsSync(compiledIndexPath);
|
|
550
|
+
}
|
|
551
|
+
function shouldUseCompiled(projectRoot = process.cwd()) {
|
|
552
|
+
const envSaysCompiled = process.env.MOOSE_USE_COMPILED === "true";
|
|
553
|
+
if (!envSaysCompiled) {
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
const hasArtifacts = hasCompiledArtifacts(projectRoot);
|
|
557
|
+
if (!hasArtifacts) {
|
|
558
|
+
console.warn(
|
|
559
|
+
`[moose] MOOSE_USE_COMPILED=true but no compiled artifacts found at .moose/compiled/${getSourceDir()}/index.js. Falling back to ts-node.`
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
return hasArtifacts;
|
|
538
563
|
}
|
|
564
|
+
var init_compiler_config = __esm({
|
|
565
|
+
"src/compiler-config.ts"() {
|
|
566
|
+
"use strict";
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
// src/dmv2/internal.ts
|
|
571
|
+
import process2 from "process";
|
|
539
572
|
var isClientOnlyMode, moose_internal, defaultRetentionPeriod, getMooseInternal, loadIndex, dlqSchema, dlqColumns, getWorkflows;
|
|
540
573
|
var init_internal = __esm({
|
|
541
574
|
"src/dmv2/internal.ts"() {
|
|
542
575
|
"use strict";
|
|
543
576
|
init_index();
|
|
544
577
|
init_commons();
|
|
578
|
+
init_compiler_config();
|
|
545
579
|
isClientOnlyMode = () => process2.env.MOOSE_CLIENT_ONLY === "true";
|
|
546
580
|
moose_internal = {
|
|
547
581
|
tables: /* @__PURE__ */ new Map(),
|
|
@@ -560,6 +594,7 @@ var init_internal = __esm({
|
|
|
560
594
|
globalThis.moose_internal = moose_internal;
|
|
561
595
|
}
|
|
562
596
|
loadIndex = () => {
|
|
597
|
+
const useCompiled = shouldUseCompiled();
|
|
563
598
|
const registry = getMooseInternal();
|
|
564
599
|
registry.tables.clear();
|
|
565
600
|
registry.streams.clear();
|
|
@@ -570,14 +605,21 @@ var init_internal = __esm({
|
|
|
570
605
|
registry.webApps.clear();
|
|
571
606
|
registry.materializedViews.clear();
|
|
572
607
|
registry.views.clear();
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
608
|
+
if (!useCompiled) {
|
|
609
|
+
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
610
|
+
Object.keys(__require.cache).forEach((key) => {
|
|
611
|
+
if (key.startsWith(appDir)) {
|
|
612
|
+
delete __require.cache[key];
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
579
616
|
try {
|
|
580
|
-
|
|
617
|
+
const sourceDir = getSourceDir();
|
|
618
|
+
if (useCompiled) {
|
|
619
|
+
__require(`${process2.cwd()}/.moose/compiled/${sourceDir}/index.js`);
|
|
620
|
+
} else {
|
|
621
|
+
__require(`${process2.cwd()}/${sourceDir}/index.ts`);
|
|
622
|
+
}
|
|
581
623
|
} catch (error) {
|
|
582
624
|
let hint;
|
|
583
625
|
let includeDetails = true;
|
|
@@ -730,17 +772,17 @@ var init_internal = __esm({
|
|
|
730
772
|
});
|
|
731
773
|
|
|
732
774
|
// src/config/configFile.ts
|
|
733
|
-
import
|
|
775
|
+
import path2 from "path";
|
|
734
776
|
import * as toml from "toml";
|
|
735
777
|
async function findConfigFile(startDir = process.cwd()) {
|
|
736
778
|
const fs2 = await import("fs");
|
|
737
|
-
let currentDir =
|
|
779
|
+
let currentDir = path2.resolve(startDir);
|
|
738
780
|
while (true) {
|
|
739
|
-
const configPath =
|
|
781
|
+
const configPath = path2.join(currentDir, "moose.config.toml");
|
|
740
782
|
if (fs2.existsSync(configPath)) {
|
|
741
783
|
return configPath;
|
|
742
784
|
}
|
|
743
|
-
const parentDir =
|
|
785
|
+
const parentDir = path2.dirname(currentDir);
|
|
744
786
|
if (parentDir === currentDir) {
|
|
745
787
|
break;
|
|
746
788
|
}
|
|
@@ -2161,22 +2203,22 @@ var init_consumptionApi = __esm({
|
|
|
2161
2203
|
return this._handler;
|
|
2162
2204
|
};
|
|
2163
2205
|
async call(baseUrl, queryParams) {
|
|
2164
|
-
let
|
|
2206
|
+
let path3;
|
|
2165
2207
|
if (this.config?.path) {
|
|
2166
2208
|
if (this.config.version) {
|
|
2167
2209
|
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] === "/";
|
|
2168
2210
|
if (pathEndsWithVersion) {
|
|
2169
|
-
|
|
2211
|
+
path3 = this.config.path;
|
|
2170
2212
|
} else {
|
|
2171
|
-
|
|
2213
|
+
path3 = `${this.config.path.replace(/\/$/, "")}/${this.config.version}`;
|
|
2172
2214
|
}
|
|
2173
2215
|
} else {
|
|
2174
|
-
|
|
2216
|
+
path3 = this.config.path;
|
|
2175
2217
|
}
|
|
2176
2218
|
} else {
|
|
2177
|
-
|
|
2219
|
+
path3 = this.config?.version ? `${this.name}/${this.config.version}` : this.name;
|
|
2178
2220
|
}
|
|
2179
|
-
const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${
|
|
2221
|
+
const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${path3}`);
|
|
2180
2222
|
const searchParams = url.searchParams;
|
|
2181
2223
|
for (const [key, value] of Object.entries(queryParams)) {
|
|
2182
2224
|
if (Array.isArray(value)) {
|
|
@@ -3272,6 +3314,7 @@ var init_runner = __esm({
|
|
|
3272
3314
|
init_cluster_utils();
|
|
3273
3315
|
init_sqlHelpers();
|
|
3274
3316
|
init_internal();
|
|
3317
|
+
init_compiler_config();
|
|
3275
3318
|
createConsumptionApi = createApi;
|
|
3276
3319
|
}
|
|
3277
3320
|
});
|