@514labs/moose-lib 0.6.252-ci-2-g41538689 → 0.6.252-ci-3-g37e54b29

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.
@@ -1894,6 +1894,7 @@ interface FrameworkApp {
1894
1894
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
1895
1895
  callback?: () => WebAppHandler;
1896
1896
  routing?: (req: http.IncomingMessage, res: http.ServerResponse) => void;
1897
+ ready?: () => PromiseLike<unknown>;
1897
1898
  }
1898
1899
  interface WebAppConfig {
1899
1900
  mountPath: string;
@@ -1894,6 +1894,7 @@ interface FrameworkApp {
1894
1894
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
1895
1895
  callback?: () => WebAppHandler;
1896
1896
  routing?: (req: http.IncomingMessage, res: http.ServerResponse) => void;
1897
+ ready?: () => PromiseLike<unknown>;
1897
1898
  }
1898
1899
  interface WebAppConfig {
1899
1900
  mountPath: string;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-BTN82akc.mjs';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-CNlTyF6R.mjs';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, 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, aa as QueryClient, 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-CNlTyF6R.mjs';
1
+ 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-DnYA4Zgi.mjs';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-rECDLgTX.mjs';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, 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, aa as QueryClient, 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-rECDLgTX.mjs';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@confluentinc/kafka-javascript';
6
6
  import http from 'http';
@@ -44,25 +44,6 @@ declare const RETRY_INITIAL_TIME_MS = 100;
44
44
  declare const MAX_RETRIES_PRODUCER = 150;
45
45
  declare const RETRY_FACTOR_PRODUCER = 0.2;
46
46
  declare const ACKs = -1;
47
- /**
48
- * Creates the base producer configuration for Kafka.
49
- * Used by both the SDK stream publishing and streaming function workers.
50
- *
51
- * @param maxMessageBytes - Optional max message size in bytes (synced with topic config)
52
- * @returns Producer configuration object for the Confluent Kafka client
53
- */
54
- declare function createProducerConfig(maxMessageBytes?: number): {
55
- "message.max.bytes"?: number | undefined;
56
- kafkaJS: {
57
- idempotent: boolean;
58
- acks: number;
59
- retry: {
60
- retries: number;
61
- maxRetryTime: number;
62
- };
63
- };
64
- "linger.ms": number;
65
- };
66
47
  type KafkaClientConfig = {
67
48
  clientId: string;
68
49
  broker: string;
@@ -74,12 +55,8 @@ type KafkaClientConfig = {
74
55
  /**
75
56
  * Dynamically creates and connects a KafkaJS producer using the provided configuration.
76
57
  * Returns a connected producer instance.
77
- *
78
- * @param cfg - Kafka client configuration
79
- * @param logger - Logger instance
80
- * @param maxMessageBytes - Optional max message size in bytes (synced with topic config)
81
58
  */
82
- declare function getKafkaProducer(cfg: KafkaClientConfig, logger: Logger, maxMessageBytes?: number): Promise<Producer>;
59
+ declare function getKafkaProducer(cfg: KafkaClientConfig, logger: Logger): Promise<Producer>;
83
60
  /**
84
61
  * Interface for logging functionality
85
62
  */
@@ -554,4 +531,4 @@ type DataModelConfig<T> = Partial<{
554
531
  parallelism?: number;
555
532
  }>;
556
533
 
557
- export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
534
+ export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-CoxWbneN.js';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-CNlTyF6R.js';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, 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, aa as QueryClient, 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-CNlTyF6R.js';
1
+ 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-B_aEflr_.js';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-rECDLgTX.js';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, 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, aa as QueryClient, 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-rECDLgTX.js';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@confluentinc/kafka-javascript';
6
6
  import http from 'http';
@@ -44,25 +44,6 @@ declare const RETRY_INITIAL_TIME_MS = 100;
44
44
  declare const MAX_RETRIES_PRODUCER = 150;
45
45
  declare const RETRY_FACTOR_PRODUCER = 0.2;
46
46
  declare const ACKs = -1;
47
- /**
48
- * Creates the base producer configuration for Kafka.
49
- * Used by both the SDK stream publishing and streaming function workers.
50
- *
51
- * @param maxMessageBytes - Optional max message size in bytes (synced with topic config)
52
- * @returns Producer configuration object for the Confluent Kafka client
53
- */
54
- declare function createProducerConfig(maxMessageBytes?: number): {
55
- "message.max.bytes"?: number | undefined;
56
- kafkaJS: {
57
- idempotent: boolean;
58
- acks: number;
59
- retry: {
60
- retries: number;
61
- maxRetryTime: number;
62
- };
63
- };
64
- "linger.ms": number;
65
- };
66
47
  type KafkaClientConfig = {
67
48
  clientId: string;
68
49
  broker: string;
@@ -74,12 +55,8 @@ type KafkaClientConfig = {
74
55
  /**
75
56
  * Dynamically creates and connects a KafkaJS producer using the provided configuration.
76
57
  * Returns a connected producer instance.
77
- *
78
- * @param cfg - Kafka client configuration
79
- * @param logger - Logger instance
80
- * @param maxMessageBytes - Optional max message size in bytes (synced with topic config)
81
58
  */
82
- declare function getKafkaProducer(cfg: KafkaClientConfig, logger: Logger, maxMessageBytes?: number): Promise<Producer>;
59
+ declare function getKafkaProducer(cfg: KafkaClientConfig, logger: Logger): Promise<Producer>;
83
60
  /**
84
61
  * Interface for logging functionality
85
62
  */
@@ -554,4 +531,4 @@ type DataModelConfig<T> = Partial<{
554
531
  parallelism?: number;
555
532
  }>;
556
533
 
557
- export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
534
+ export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
package/dist/index.js CHANGED
@@ -42,7 +42,6 @@ __export(commons_exports, {
42
42
  antiCachePath: () => antiCachePath,
43
43
  cliLog: () => cliLog,
44
44
  compilerLog: () => compilerLog,
45
- createProducerConfig: () => createProducerConfig,
46
45
  getClickhouseClient: () => getClickhouseClient,
47
46
  getFileName: () => getFileName,
48
47
  getKafkaClient: () => getKafkaClient,
@@ -65,25 +64,18 @@ function isTruthy(value) {
65
64
  function mapTstoJs(filePath) {
66
65
  return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
67
66
  }
68
- function createProducerConfig(maxMessageBytes) {
69
- return {
67
+ async function getKafkaProducer(cfg, logger) {
68
+ const kafka = await getKafkaClient(cfg, logger);
69
+ const producer = kafka.producer({
70
70
  kafkaJS: {
71
- idempotent: false,
72
- // Not needed for at-least-once delivery
71
+ idempotent: true,
73
72
  acks: ACKs,
74
73
  retry: {
75
74
  retries: MAX_RETRIES_PRODUCER,
76
75
  maxRetryTime: MAX_RETRY_TIME_MS
77
76
  }
78
- },
79
- "linger.ms": 0,
80
- // Send immediately - batching happens at application level
81
- ...maxMessageBytes && { "message.max.bytes": maxMessageBytes }
82
- };
83
- }
84
- async function getKafkaProducer(cfg, logger, maxMessageBytes) {
85
- const kafka = await getKafkaClient(cfg, logger);
86
- const producer = kafka.producer(createProducerConfig(maxMessageBytes));
77
+ }
78
+ });
87
79
  await producer.connect();
88
80
  return producer;
89
81
  }
@@ -425,7 +417,6 @@ __export(index_exports, {
425
417
  createClickhouseParameter: () => createClickhouseParameter,
426
418
  createConsumptionApi: () => createConsumptionApi,
427
419
  createMaterializedView: () => createMaterializedView,
428
- createProducerConfig: () => createProducerConfig,
429
420
  dropView: () => dropView,
430
421
  expressMiddleware: () => expressMiddleware,
431
422
  getApi: () => getApi,
@@ -2626,7 +2617,19 @@ var WebApp = class {
2626
2617
  return app.callback();
2627
2618
  }
2628
2619
  if (typeof app.routing === "function") {
2629
- return (req, res) => {
2620
+ let isReady = false;
2621
+ let readyPromise = null;
2622
+ if (typeof app.ready === "function") {
2623
+ readyPromise = app.ready().then(() => {
2624
+ isReady = true;
2625
+ });
2626
+ } else {
2627
+ isReady = true;
2628
+ }
2629
+ return async (req, res) => {
2630
+ if (!isReady && readyPromise) {
2631
+ await readyPromise;
2632
+ }
2630
2633
  app.routing(req, res);
2631
2634
  };
2632
2635
  }
@@ -3407,7 +3410,6 @@ var DataSource = class {
3407
3410
  createClickhouseParameter,
3408
3411
  createConsumptionApi,
3409
3412
  createMaterializedView,
3410
- createProducerConfig,
3411
3413
  dropView,
3412
3414
  expressMiddleware,
3413
3415
  getApi,