@514labs/moose-lib 0.6.320-ci-6-g6656ed59 → 0.6.321-ci-8-g6956014f

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