@514labs/moose-lib 0.6.295-ci-3-g6e0c461e → 0.6.295-ci-17-g70d560ac

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.
@@ -1,4 +1,4 @@
1
- import './index-BVXVZXrg.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-BVXVZXrg.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-BVXVZXrg.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-Bn8PzlMa.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-BVXVZXrg.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-DahFm7-i.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;
@@ -2399,6 +2395,67 @@ var ETLPipeline = class {
2399
2395
  }
2400
2396
  };
2401
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
+
2402
2459
  // src/dmv2/sdk/sqlResource.ts
2403
2460
  var SqlResource = class {
2404
2461
  /** @internal */
@@ -2453,66 +2510,18 @@ var SqlResource = class {
2453
2510
  }
2454
2511
  };
2455
2512
 
2456
- // src/dmv2/sdk/materializedView.ts
2457
- var requireTargetTableName = (tableName) => {
2458
- if (typeof tableName === "string") {
2459
- return tableName;
2460
- } else {
2461
- throw new Error("Name of targetTable is not specified.");
2462
- }
2463
- };
2464
- var MaterializedView = class extends SqlResource {
2465
- /** The target OlapTable instance where the materialized data is stored. */
2466
- targetTable;
2467
- constructor(options, targetSchema, targetColumns) {
2468
- let selectStatement = options.selectStatement;
2469
- if (typeof selectStatement !== "string") {
2470
- selectStatement = toStaticQuery(selectStatement);
2471
- }
2472
- if (targetSchema === void 0 || targetColumns === void 0) {
2473
- throw new Error(
2474
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2475
- );
2476
- }
2477
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2478
- requireTargetTableName(
2479
- options.targetTable?.name ?? options.tableName
2480
- ),
2481
- {
2482
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2483
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2484
- },
2485
- targetSchema,
2486
- targetColumns
2487
- );
2488
- if (targetTable.name === options.materializedViewName) {
2489
- throw new Error(
2490
- "Materialized view name cannot be the same as the target table name."
2491
- );
2492
- }
2493
- super(
2494
- options.materializedViewName,
2495
- [
2496
- createMaterializedView({
2497
- name: options.materializedViewName,
2498
- destinationTable: targetTable.name,
2499
- select: selectStatement
2500
- })
2501
- // Population is now handled automatically by Rust infrastructure
2502
- // based on table engine type and whether this is a new or updated view
2503
- ],
2504
- [dropView(options.materializedViewName)],
2505
- {
2506
- pullsDataFrom: options.selectTables,
2507
- pushesDataTo: [targetTable]
2508
- }
2509
- );
2510
- this.targetTable = targetTable;
2511
- }
2512
- };
2513
-
2514
2513
  // src/dmv2/sdk/view.ts
2515
- 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;
2516
2525
  /**
2517
2526
  * Creates a new View instance.
2518
2527
  * @param name The name of the view to be created.
@@ -2523,17 +2532,16 @@ var View = class extends SqlResource {
2523
2532
  if (typeof selectStatement !== "string") {
2524
2533
  selectStatement = toStaticQuery(selectStatement);
2525
2534
  }
2526
- super(
2527
- name,
2528
- [
2529
- `CREATE VIEW IF NOT EXISTS ${name}
2530
- AS ${selectStatement}`.trim()
2531
- ],
2532
- [dropView(name)],
2533
- {
2534
- pullsDataFrom: baseTables
2535
- }
2536
- );
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);
2537
2545
  }
2538
2546
  };
2539
2547
 
@@ -2722,6 +2730,18 @@ function getWebApps2() {
2722
2730
  function getWebApp(name) {
2723
2731
  return getMooseInternal().webApps.get(name);
2724
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
+ }
2725
2745
  // Annotate the CommonJS export names for ESM import in node:
2726
2746
  0 && (module.exports = {
2727
2747
  Api,
@@ -2743,8 +2763,12 @@ function getWebApp(name) {
2743
2763
  createClickhouseParameter,
2744
2764
  getApi,
2745
2765
  getApis,
2766
+ getCustomView,
2767
+ getCustomViews,
2746
2768
  getIngestApi,
2747
2769
  getIngestApis,
2770
+ getMaterializedView,
2771
+ getMaterializedViews,
2748
2772
  getSqlResource,
2749
2773
  getSqlResources,
2750
2774
  getStream,