@narrative.io/data-collaboration-sdk-ts 2.33.0 → 2.34.0

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 type { NqlBudget } from "./Ast";
1
+ import type { NqlBudget, NqlPlaceholder } from "./Ast";
2
2
  import type { CreateMaterializedView, CreateMaterializedViewMetadata, Deduplication, Explain, Expression, Output, Raw, Select, Statement, Table } from "./AstParser";
3
3
  export type CompiledNql = string;
4
4
  export declare function compileStatement(n: Statement): CompiledNql;
@@ -11,3 +11,4 @@ export declare function compileDeduplication(d: Deduplication | Raw): CompiledNq
11
11
  export declare function compileFrom(tables: Table[] | Raw): CompiledNql;
12
12
  export declare function compileOutput(n: Output): CompiledNql;
13
13
  export declare function compileExpression(n: Expression): CompiledNql;
14
+ export declare function compilePlaceholder(n: NqlPlaceholder): CompiledNql;
@@ -210,6 +210,8 @@ export function compileOutput(n) {
210
210
  return compileRawRef(n.nql, n.as);
211
211
  case "nql":
212
212
  return raw(n);
213
+ case "placeholder":
214
+ return compilePlaceholder(n);
213
215
  }
214
216
  throw new Error("unreachable");
215
217
  }
@@ -251,6 +253,8 @@ export function compileExpression(n) {
251
253
  return raw(n);
252
254
  case "raw_ref":
253
255
  return compileRawRef(n.nql, n.as);
256
+ case "placeholder":
257
+ return compilePlaceholder(n);
254
258
  }
255
259
  throw new Error("unreachable");
256
260
  }
@@ -345,6 +349,20 @@ function compileRawRef(nql, as) {
345
349
  function compileUnaryMinus(operand, as) {
346
350
  return aliased(`-(${compileExpression(operand)})`, as);
347
351
  }
352
+ export function compilePlaceholder(n) {
353
+ switch (n.expectedType) {
354
+ case "literal":
355
+ case "string_literal":
356
+ case "long_literal":
357
+ case "double_literal":
358
+ case "boolean_literal":
359
+ case "timestamp_literal":
360
+ case "column":
361
+ return `{{${n.identifier}}}`;
362
+ default:
363
+ throw new Error("unsupported placeholder");
364
+ }
365
+ }
348
366
  function aliased(nql, as, parens) {
349
367
  const alias = as !== undefined ? `${nql} AS ${quote(as)}` : nql;
350
368
  if ((parens === undefined || parens) && as !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "2.33.0",
3
+ "version": "2.34.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -24,17 +24,17 @@
24
24
  "@babel/preset-env": "7.26.0",
25
25
  "@babel/preset-typescript": "7.26.0",
26
26
  "@biomejs/biome": "1.9.4",
27
- "@commitlint/cli": "19.5.0",
28
- "@commitlint/config-conventional": "19.5.0",
27
+ "@commitlint/cli": "19.6.1",
28
+ "@commitlint/config-conventional": "19.6.0",
29
29
  "@types/jest": "29.5.14",
30
30
  "babel-jest": "29.7.0",
31
31
  "jest": "29.7.0",
32
- "lefthook": "1.8.4",
32
+ "lefthook": "1.10.2",
33
33
  "ts-jest": "29.2.5"
34
34
  },
35
35
  "dependencies": {
36
36
  "mande": "2.0.9",
37
- "zod": "3.23.8",
37
+ "zod": "3.24.1",
38
38
  "bignumber.js": "9.1.2"
39
39
  },
40
40
  "overrides": {