@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.js CHANGED
@@ -450,7 +450,7 @@ var init_commons = __esm({
450
450
  console.log(message);
451
451
  }
452
452
  };
453
- antiCachePath = (path3) => `${path3}?num=${Math.random().toString()}&time=${Date.now()}`;
453
+ antiCachePath = (path2) => `${path2}?num=${Math.random().toString()}&time=${Date.now()}`;
454
454
  getFileName = (filePath) => {
455
455
  const regex = /\/([^\/]+)\.ts/;
456
456
  const matches = filePath.match(regex);
@@ -547,44 +547,10 @@ var init_commons = __esm({
547
547
  }
548
548
  });
549
549
 
550
- // src/compiler-config.ts
550
+ // src/dmv2/internal.ts
551
551
  function getSourceDir() {
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;
552
+ return import_process.default.env.MOOSE_SOURCE_DIR || "app";
577
553
  }
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
588
554
  var import_process, isClientOnlyMode, moose_internal, defaultRetentionPeriod, getMooseInternal, loadIndex, dlqSchema, dlqColumns, getWorkflows;
589
555
  var init_internal = __esm({
590
556
  "src/dmv2/internal.ts"() {
@@ -592,7 +558,6 @@ var init_internal = __esm({
592
558
  import_process = __toESM(require("process"));
593
559
  init_index();
594
560
  init_commons();
595
- init_compiler_config();
596
561
  isClientOnlyMode = () => import_process.default.env.MOOSE_CLIENT_ONLY === "true";
597
562
  moose_internal = {
598
563
  tables: /* @__PURE__ */ new Map(),
@@ -611,7 +576,6 @@ var init_internal = __esm({
611
576
  globalThis.moose_internal = moose_internal;
612
577
  }
613
578
  loadIndex = () => {
614
- const useCompiled = shouldUseCompiled();
615
579
  const registry = getMooseInternal();
616
580
  registry.tables.clear();
617
581
  registry.streams.clear();
@@ -622,21 +586,14 @@ var init_internal = __esm({
622
586
  registry.webApps.clear();
623
587
  registry.materializedViews.clear();
624
588
  registry.views.clear();
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
- }
633
- try {
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`);
589
+ const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
590
+ Object.keys(require.cache).forEach((key) => {
591
+ if (key.startsWith(appDir)) {
592
+ delete require.cache[key];
639
593
  }
594
+ });
595
+ try {
596
+ require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
640
597
  } catch (error) {
641
598
  let hint;
642
599
  let includeDetails = true;
@@ -2220,22 +2177,22 @@ var init_consumptionApi = __esm({
2220
2177
  return this._handler;
2221
2178
  };
2222
2179
  async call(baseUrl, queryParams) {
2223
- let path3;
2180
+ let path2;
2224
2181
  if (this.config?.path) {
2225
2182
  if (this.config.version) {
2226
2183
  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] === "/";
2227
2184
  if (pathEndsWithVersion) {
2228
- path3 = this.config.path;
2185
+ path2 = this.config.path;
2229
2186
  } else {
2230
- path3 = `${this.config.path.replace(/\/$/, "")}/${this.config.version}`;
2187
+ path2 = `${this.config.path.replace(/\/$/, "")}/${this.config.version}`;
2231
2188
  }
2232
2189
  } else {
2233
- path3 = this.config.path;
2190
+ path2 = this.config.path;
2234
2191
  }
2235
2192
  } else {
2236
- path3 = this.config?.version ? `${this.name}/${this.config.version}` : this.name;
2193
+ path2 = this.config?.version ? `${this.name}/${this.config.version}` : this.name;
2237
2194
  }
2238
- const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${path3}`);
2195
+ const url = new URL(`${baseUrl.replace(/\/$/, "")}/api/${path2}`);
2239
2196
  const searchParams = url.searchParams;
2240
2197
  for (const [key, value] of Object.entries(queryParams)) {
2241
2198
  if (Array.isArray(value)) {