@514labs/moose-lib 0.6.435 → 0.6.436

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.
@@ -29,7 +29,20 @@ type RawValue = Value | Sql;
29
29
  * Sql template tag interface with attached helper methods.
30
30
  */
31
31
  interface SqlTemplateTag {
32
+ /**
33
+ * @deprecated Use `sql.statement` for full SQL statements or `sql.fragment` for SQL fragments.
34
+ */
32
35
  (strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
36
+ /**
37
+ * Template literal tag for complete SQL statements (e.g. SELECT, INSERT, CREATE).
38
+ * Produces a Sql instance with `isFragment = false`.
39
+ */
40
+ statement(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
41
+ /**
42
+ * Template literal tag for SQL fragments (e.g. expressions, conditions, partial clauses).
43
+ * Produces a Sql instance with `isFragment = true`.
44
+ */
45
+ fragment(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
33
46
  /**
34
47
  * Join an array of Sql fragments with a separator.
35
48
  * @param fragments - Array of Sql fragments to join
@@ -49,7 +62,8 @@ declare const sql: SqlTemplateTag;
49
62
  declare class Sql {
50
63
  readonly values: Value[];
51
64
  readonly strings: string[];
52
- constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
65
+ readonly isFragment: boolean | undefined;
66
+ constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[], isFragment?: boolean);
53
67
  /**
54
68
  * Append another Sql fragment, returning a new Sql instance.
55
69
  */
@@ -29,7 +29,20 @@ type RawValue = Value | Sql;
29
29
  * Sql template tag interface with attached helper methods.
30
30
  */
31
31
  interface SqlTemplateTag {
32
+ /**
33
+ * @deprecated Use `sql.statement` for full SQL statements or `sql.fragment` for SQL fragments.
34
+ */
32
35
  (strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
36
+ /**
37
+ * Template literal tag for complete SQL statements (e.g. SELECT, INSERT, CREATE).
38
+ * Produces a Sql instance with `isFragment = false`.
39
+ */
40
+ statement(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
41
+ /**
42
+ * Template literal tag for SQL fragments (e.g. expressions, conditions, partial clauses).
43
+ * Produces a Sql instance with `isFragment = true`.
44
+ */
45
+ fragment(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
33
46
  /**
34
47
  * Join an array of Sql fragments with a separator.
35
48
  * @param fragments - Array of Sql fragments to join
@@ -49,7 +62,8 @@ declare const sql: SqlTemplateTag;
49
62
  declare class Sql {
50
63
  readonly values: Value[];
51
64
  readonly strings: string[];
52
- constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
65
+ readonly isFragment: boolean | undefined;
66
+ constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[], isFragment?: boolean);
53
67
  /**
54
68
  * Append another Sql fragment, returning a new Sql instance.
55
69
  */
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { JWT, Key } from './browserCompatible.mjs';
2
2
  import * as _clickhouse_client from '@clickhouse/client';
3
3
  import { KafkaJS } from '@514labs/kafka-javascript';
4
- import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-DaI1orpy.mjs';
5
- export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-DaI1orpy.mjs';
4
+ import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.mjs';
5
+ export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.mjs';
6
6
  import http from 'http';
7
7
  import { IsTuple } from 'typia/lib/typings/IsTuple';
8
8
  import { Readable } from 'node:stream';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { JWT, Key } from './browserCompatible.js';
2
2
  import * as _clickhouse_client from '@clickhouse/client';
3
3
  import { KafkaJS } from '@514labs/kafka-javascript';
4
- import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-DaI1orpy.js';
5
- export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-DaI1orpy.js';
4
+ import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.js';
5
+ export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.js';
6
6
  import http from 'http';
7
7
  import { IsTuple } from 'typia/lib/typings/IsTuple';
8
8
  import { Readable } from 'node:stream';
package/dist/index.js CHANGED
@@ -1175,11 +1175,18 @@ function sqlImpl(strings, ...values) {
1175
1175
  return new Sql(strings, values);
1176
1176
  }
1177
1177
  var sql = sqlImpl;
1178
+ sql.statement = function(strings, ...values) {
1179
+ return new Sql(strings, values, false);
1180
+ };
1181
+ sql.fragment = function(strings, ...values) {
1182
+ return new Sql(strings, values, true);
1183
+ };
1178
1184
  var instanceofSql = (value) => typeof value === "object" && "values" in value && "strings" in value;
1179
1185
  var Sql = class _Sql {
1180
1186
  values;
1181
1187
  strings;
1182
- constructor(rawStrings, rawValues) {
1188
+ isFragment;
1189
+ constructor(rawStrings, rawValues, isFragment) {
1183
1190
  if (rawStrings.length - 1 !== rawValues.length) {
1184
1191
  if (rawStrings.length === 0) {
1185
1192
  throw new TypeError("Expected at least 1 string");
@@ -1194,6 +1201,7 @@ var Sql = class _Sql {
1194
1201
  );
1195
1202
  this.values = new Array(valuesLength);
1196
1203
  this.strings = new Array(valuesLength + 1);
1204
+ this.isFragment = isFragment;
1197
1205
  this.strings[0] = rawStrings[0];
1198
1206
  let i = 0, pos = 0;
1199
1207
  while (i < rawValues.length) {
@@ -1240,19 +1248,26 @@ var Sql = class _Sql {
1240
1248
  * Append another Sql fragment, returning a new Sql instance.
1241
1249
  */
1242
1250
  append(other) {
1243
- return new _Sql([...this.strings, ""], [...this.values, other]);
1251
+ return new _Sql(
1252
+ [...this.strings, ""],
1253
+ [...this.values, other],
1254
+ this.isFragment
1255
+ );
1244
1256
  }
1245
1257
  };
1246
1258
  sql.join = function(fragments, separator) {
1247
- if (fragments.length === 0) return new Sql([""], []);
1248
- if (fragments.length === 1) return fragments[0];
1259
+ if (fragments.length === 0) return new Sql([""], [], true);
1260
+ if (fragments.length === 1) {
1261
+ const frag = fragments[0];
1262
+ return new Sql(frag.strings, frag.values, true);
1263
+ }
1249
1264
  const sep = separator ?? ", ";
1250
1265
  const normalized = sep.includes(" ") ? sep : ` ${sep} `;
1251
1266
  const strings = ["", ...Array(fragments.length - 1).fill(normalized), ""];
1252
- return new Sql(strings, fragments);
1267
+ return new Sql(strings, fragments, true);
1253
1268
  };
1254
1269
  sql.raw = function(text) {
1255
- return new Sql([text], []);
1270
+ return new Sql([text], [], true);
1256
1271
  };
1257
1272
  var toStaticQuery = (sql3) => {
1258
1273
  const [query, params] = toQuery(sql3);