@514labs/moose-lib 0.6.337 → 0.6.338

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.
@@ -140,7 +140,7 @@ var init_types = __esm({
140
140
  });
141
141
 
142
142
  // src/sqlHelpers.ts
143
- function sql(strings, ...values) {
143
+ function sqlImpl(strings, ...values) {
144
144
  return new Sql(strings, values);
145
145
  }
146
146
  function createClickhouseParameter(parameterIndex, value) {
@@ -149,15 +149,16 @@ function createClickhouseParameter(parameterIndex, value) {
149
149
  function emptyIfUndefined(value) {
150
150
  return value === void 0 ? "" : value;
151
151
  }
152
- var isTable, isView, isColumn, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
152
+ var isTable, isView, isColumn, sql, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
153
153
  var init_sqlHelpers = __esm({
154
154
  "src/sqlHelpers.ts"() {
155
155
  "use strict";
156
156
  isTable = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapTable";
157
157
  isView = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "View";
158
158
  isColumn = (value) => typeof value === "object" && value !== null && !("kind" in value) && "name" in value && "annotations" in value;
159
+ sql = sqlImpl;
159
160
  instanceofSql = (value) => typeof value === "object" && "values" in value && "strings" in value;
160
- Sql = class {
161
+ Sql = class _Sql {
161
162
  values;
162
163
  strings;
163
164
  constructor(rawStrings, rawValues) {
@@ -214,6 +215,23 @@ var init_sqlHelpers = __esm({
214
215
  }
215
216
  }
216
217
  }
218
+ /**
219
+ * Append another Sql fragment, returning a new Sql instance.
220
+ */
221
+ append(other) {
222
+ return new _Sql([...this.strings, ""], [...this.values, other]);
223
+ }
224
+ };
225
+ sql.join = function(fragments, separator) {
226
+ if (fragments.length === 0) return new Sql([""], []);
227
+ if (fragments.length === 1) return fragments[0];
228
+ const sep = separator ?? ", ";
229
+ const normalized = sep.includes(" ") ? sep : ` ${sep} `;
230
+ const strings = ["", ...Array(fragments.length - 1).fill(normalized), ""];
231
+ return new Sql(strings, fragments);
232
+ };
233
+ sql.raw = function(text) {
234
+ return new Sql([text], []);
217
235
  };
218
236
  toQuery = (sql3) => {
219
237
  const parameterizedStubs = sql3.values.map(