@514labs/moose-lib 0.6.288 → 0.6.289-ci-9-g221fb3d9

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.
Files changed (35) hide show
  1. package/dist/{browserCompatible-15NCyT1P.d.mts → browserCompatible-DCCiBirg.d.mts} +1 -1
  2. package/dist/{browserCompatible-BUKAJYbj.d.ts → browserCompatible-DhVPp9qX.d.ts} +1 -1
  3. package/dist/browserCompatible.d.mts +2 -2
  4. package/dist/browserCompatible.d.ts +2 -2
  5. package/dist/browserCompatible.js +115 -86
  6. package/dist/browserCompatible.js.map +1 -1
  7. package/dist/browserCompatible.mjs +111 -86
  8. package/dist/browserCompatible.mjs.map +1 -1
  9. package/dist/compilerPlugin.js +4 -1
  10. package/dist/compilerPlugin.js.map +1 -1
  11. package/dist/compilerPlugin.mjs +5 -1
  12. package/dist/compilerPlugin.mjs.map +1 -1
  13. package/dist/dataModels/toDataModels.js +4 -1
  14. package/dist/dataModels/toDataModels.js.map +1 -1
  15. package/dist/dataModels/toDataModels.mjs +5 -1
  16. package/dist/dataModels/toDataModels.mjs.map +1 -1
  17. package/dist/dmv2/index.d.mts +1 -1
  18. package/dist/dmv2/index.d.ts +1 -1
  19. package/dist/dmv2/index.js +115 -86
  20. package/dist/dmv2/index.js.map +1 -1
  21. package/dist/dmv2/index.mjs +111 -86
  22. package/dist/dmv2/index.mjs.map +1 -1
  23. package/dist/{index-BtkwFbT9.d.mts → index-CcZRaA0b.d.mts} +84 -41
  24. package/dist/{index-BtkwFbT9.d.ts → index-CcZRaA0b.d.ts} +84 -41
  25. package/dist/index.d.mts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +117 -76
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +113 -76
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/moose-runner.js +28 -2
  32. package/dist/moose-runner.js.map +1 -1
  33. package/dist/moose-runner.mjs +28 -2
  34. package/dist/moose-runner.mjs.map +1 -1
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import './index-BtkwFbT9.mjs';
1
+ import './index-CcZRaA0b.mjs';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-BtkwFbT9.js';
1
+ import './index-CcZRaA0b.js';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.mjs';
2
- export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-15NCyT1P.mjs';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Y as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, Z as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, $ as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, a1 as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, _ as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a6 as createClickhouseParameter, x as getApi, w as getApis, K as getCustomView, N as getCustomViews, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a7 as mapToClickHouseType, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-CcZRaA0b.mjs';
2
+ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-DCCiBirg.mjs';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.js';
2
- export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-BUKAJYbj.js';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Y as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, Z as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, $ as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, a1 as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, _ as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a6 as createClickhouseParameter, x as getApi, w as getApis, K as getCustomView, N as getCustomViews, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a7 as mapToClickHouseType, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-CcZRaA0b.js';
2
+ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-DhVPp9qX.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -403,8 +403,12 @@ __export(browserCompatible_exports, {
403
403
  createClickhouseParameter: () => createClickhouseParameter,
404
404
  getApi: () => getApi,
405
405
  getApis: () => getApis2,
406
+ getCustomView: () => getCustomView,
407
+ getCustomViews: () => getCustomViews,
406
408
  getIngestApi: () => getIngestApi,
407
409
  getIngestApis: () => getIngestApis,
410
+ getMaterializedView: () => getMaterializedView,
411
+ getMaterializedViews: () => getMaterializedViews,
408
412
  getSqlResource: () => getSqlResource,
409
413
  getSqlResources: () => getSqlResources,
410
414
  getStream: () => getStream,
@@ -705,16 +709,6 @@ function emptyIfUndefined(value) {
705
709
  return value === void 0 ? "" : value;
706
710
  }
707
711
 
708
- // src/blocks/helpers.ts
709
- function dropView(name) {
710
- return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
711
- }
712
- function createMaterializedView(options) {
713
- return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
714
- TO ${quoteIdentifier(options.destinationTable)}
715
- AS ${options.select}`.trim();
716
- }
717
-
718
712
  // src/dmv2/internal.ts
719
713
  var import_process = __toESM(require("process"));
720
714
 
@@ -765,7 +759,9 @@ var moose_internal = {
765
759
  apis: /* @__PURE__ */ new Map(),
766
760
  sqlResources: /* @__PURE__ */ new Map(),
767
761
  workflows: /* @__PURE__ */ new Map(),
768
- webApps: /* @__PURE__ */ new Map()
762
+ webApps: /* @__PURE__ */ new Map(),
763
+ materializedViews: /* @__PURE__ */ new Map(),
764
+ customViews: /* @__PURE__ */ new Map()
769
765
  };
770
766
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
771
767
  var getMooseInternal = () => globalThis.moose_internal;
@@ -840,7 +836,8 @@ var dlqColumns = [
840
836
  annotations: [],
841
837
  ttl: null,
842
838
  codec: null,
843
- materialized: null
839
+ materialized: null,
840
+ comment: null
844
841
  },
845
842
  {
846
843
  name: "errorMessage",
@@ -852,7 +849,8 @@ var dlqColumns = [
852
849
  annotations: [],
853
850
  ttl: null,
854
851
  codec: null,
855
- materialized: null
852
+ materialized: null,
853
+ comment: null
856
854
  },
857
855
  {
858
856
  name: "errorType",
@@ -864,7 +862,8 @@ var dlqColumns = [
864
862
  annotations: [],
865
863
  ttl: null,
866
864
  codec: null,
867
- materialized: null
865
+ materialized: null,
866
+ comment: null
868
867
  },
869
868
  {
870
869
  name: "failedAt",
@@ -876,7 +875,8 @@ var dlqColumns = [
876
875
  annotations: [],
877
876
  ttl: null,
878
877
  codec: null,
879
- materialized: null
878
+ materialized: null,
879
+ comment: null
880
880
  },
881
881
  {
882
882
  name: "source",
@@ -888,7 +888,8 @@ var dlqColumns = [
888
888
  annotations: [],
889
889
  ttl: null,
890
890
  codec: null,
891
- materialized: null
891
+ materialized: null,
892
+ comment: null
892
893
  }
893
894
  ];
894
895
 
@@ -2394,6 +2395,67 @@ var ETLPipeline = class {
2394
2395
  }
2395
2396
  };
2396
2397
 
2398
+ // src/dmv2/sdk/materializedView.ts
2399
+ var requireTargetTableName = (tableName) => {
2400
+ if (typeof tableName === "string") {
2401
+ return tableName;
2402
+ } else {
2403
+ throw new Error("Name of targetTable is not specified.");
2404
+ }
2405
+ };
2406
+ var MaterializedView = class {
2407
+ /** @internal */
2408
+ kind = "MaterializedView";
2409
+ /** The name of the materialized view */
2410
+ name;
2411
+ /** The target OlapTable instance where the materialized data is stored. */
2412
+ targetTable;
2413
+ /** The SELECT SQL statement */
2414
+ selectSql;
2415
+ /** Names of source tables that the SELECT reads from */
2416
+ sourceTables;
2417
+ /** @internal Source file path where this MV was defined */
2418
+ sourceFile;
2419
+ constructor(options, targetSchema, targetColumns) {
2420
+ let selectStatement = options.selectStatement;
2421
+ if (typeof selectStatement !== "string") {
2422
+ selectStatement = toStaticQuery(selectStatement);
2423
+ }
2424
+ if (targetSchema === void 0 || targetColumns === void 0) {
2425
+ throw new Error(
2426
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2427
+ );
2428
+ }
2429
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2430
+ requireTargetTableName(
2431
+ options.targetTable?.name ?? options.tableName
2432
+ ),
2433
+ {
2434
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2435
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2436
+ },
2437
+ targetSchema,
2438
+ targetColumns
2439
+ );
2440
+ if (targetTable.name === options.materializedViewName) {
2441
+ throw new Error(
2442
+ "Materialized view name cannot be the same as the target table name."
2443
+ );
2444
+ }
2445
+ this.name = options.materializedViewName;
2446
+ this.targetTable = targetTable;
2447
+ this.selectSql = selectStatement;
2448
+ this.sourceTables = options.selectTables.map((t) => t.name);
2449
+ const stack = new Error().stack;
2450
+ this.sourceFile = getSourceFileFromStack(stack);
2451
+ const materializedViews = getMooseInternal().materializedViews;
2452
+ if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2453
+ throw new Error(`MaterializedView with name ${this.name} already exists`);
2454
+ }
2455
+ materializedViews.set(this.name, this);
2456
+ }
2457
+ };
2458
+
2397
2459
  // src/dmv2/sdk/sqlResource.ts
2398
2460
  var SqlResource = class {
2399
2461
  /** @internal */
@@ -2448,66 +2510,18 @@ var SqlResource = class {
2448
2510
  }
2449
2511
  };
2450
2512
 
2451
- // src/dmv2/sdk/materializedView.ts
2452
- var requireTargetTableName = (tableName) => {
2453
- if (typeof tableName === "string") {
2454
- return tableName;
2455
- } else {
2456
- throw new Error("Name of targetTable is not specified.");
2457
- }
2458
- };
2459
- var MaterializedView = class extends SqlResource {
2460
- /** The target OlapTable instance where the materialized data is stored. */
2461
- targetTable;
2462
- constructor(options, targetSchema, targetColumns) {
2463
- let selectStatement = options.selectStatement;
2464
- if (typeof selectStatement !== "string") {
2465
- selectStatement = toStaticQuery(selectStatement);
2466
- }
2467
- if (targetSchema === void 0 || targetColumns === void 0) {
2468
- throw new Error(
2469
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2470
- );
2471
- }
2472
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2473
- requireTargetTableName(
2474
- options.targetTable?.name ?? options.tableName
2475
- ),
2476
- {
2477
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2478
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2479
- },
2480
- targetSchema,
2481
- targetColumns
2482
- );
2483
- if (targetTable.name === options.materializedViewName) {
2484
- throw new Error(
2485
- "Materialized view name cannot be the same as the target table name."
2486
- );
2487
- }
2488
- super(
2489
- options.materializedViewName,
2490
- [
2491
- createMaterializedView({
2492
- name: options.materializedViewName,
2493
- destinationTable: targetTable.name,
2494
- select: selectStatement
2495
- })
2496
- // Population is now handled automatically by Rust infrastructure
2497
- // based on table engine type and whether this is a new or updated view
2498
- ],
2499
- [dropView(options.materializedViewName)],
2500
- {
2501
- pullsDataFrom: options.selectTables,
2502
- pushesDataTo: [targetTable]
2503
- }
2504
- );
2505
- this.targetTable = targetTable;
2506
- }
2507
- };
2508
-
2509
2513
  // src/dmv2/sdk/view.ts
2510
- var View = class extends SqlResource {
2514
+ var View = class {
2515
+ /** @internal */
2516
+ kind = "CustomView";
2517
+ /** The name of the view */
2518
+ name;
2519
+ /** The SELECT SQL statement that defines the view */
2520
+ selectSql;
2521
+ /** Names of source tables/views that the SELECT reads from */
2522
+ sourceTables;
2523
+ /** @internal Source file path where this view was defined */
2524
+ sourceFile;
2511
2525
  /**
2512
2526
  * Creates a new View instance.
2513
2527
  * @param name The name of the view to be created.
@@ -2518,17 +2532,16 @@ var View = class extends SqlResource {
2518
2532
  if (typeof selectStatement !== "string") {
2519
2533
  selectStatement = toStaticQuery(selectStatement);
2520
2534
  }
2521
- super(
2522
- name,
2523
- [
2524
- `CREATE VIEW IF NOT EXISTS ${name}
2525
- AS ${selectStatement}`.trim()
2526
- ],
2527
- [dropView(name)],
2528
- {
2529
- pullsDataFrom: baseTables
2530
- }
2531
- );
2535
+ this.name = name;
2536
+ this.selectSql = selectStatement;
2537
+ this.sourceTables = baseTables.map((t) => t.name);
2538
+ const stack = new Error().stack;
2539
+ this.sourceFile = getSourceFileFromStack(stack);
2540
+ const customViews = getMooseInternal().customViews;
2541
+ if (!isClientOnlyMode() && customViews.has(this.name)) {
2542
+ throw new Error(`View with name ${this.name} already exists`);
2543
+ }
2544
+ customViews.set(this.name, this);
2532
2545
  }
2533
2546
  };
2534
2547
 
@@ -2717,6 +2730,18 @@ function getWebApps2() {
2717
2730
  function getWebApp(name) {
2718
2731
  return getMooseInternal().webApps.get(name);
2719
2732
  }
2733
+ function getMaterializedViews() {
2734
+ return getMooseInternal().materializedViews;
2735
+ }
2736
+ function getMaterializedView(name) {
2737
+ return getMooseInternal().materializedViews.get(name);
2738
+ }
2739
+ function getCustomViews() {
2740
+ return getMooseInternal().customViews;
2741
+ }
2742
+ function getCustomView(name) {
2743
+ return getMooseInternal().customViews.get(name);
2744
+ }
2720
2745
  // Annotate the CommonJS export names for ESM import in node:
2721
2746
  0 && (module.exports = {
2722
2747
  Api,
@@ -2738,8 +2763,12 @@ function getWebApp(name) {
2738
2763
  createClickhouseParameter,
2739
2764
  getApi,
2740
2765
  getApis,
2766
+ getCustomView,
2767
+ getCustomViews,
2741
2768
  getIngestApi,
2742
2769
  getIngestApis,
2770
+ getMaterializedView,
2771
+ getMaterializedViews,
2743
2772
  getSqlResource,
2744
2773
  getSqlResources,
2745
2774
  getStream,