@dataform/core 2.2.0 → 2.3.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.
Files changed (3) hide show
  1. package/bundle.d.ts +4 -0
  2. package/bundle.js +31 -10
  3. package/package.json +1 -1
package/bundle.d.ts CHANGED
@@ -6261,6 +6261,7 @@ interface ICommonContext {
6261
6261
  ref: (ref: Resolvable | string[], ...rest: string[]) => string;
6262
6262
  resolve: (ref: Resolvable | string[], ...rest: string[]) => string;
6263
6263
  schema: () => string;
6264
+ database: () => string;
6264
6265
  }
6265
6266
  interface INamedConfig {
6266
6267
  type?: string;
@@ -6333,6 +6334,7 @@ declare class AssertionContext implements ICommonContext {
6333
6334
  ref(ref: Resolvable | string[], ...rest: string[]): string;
6334
6335
  resolve(ref: Resolvable | string[], ...rest: string[]): string;
6335
6336
  schema(): string;
6337
+ database(): string;
6336
6338
  dependencies(name: Resolvable | Resolvable[]): string;
6337
6339
  tags(name: string | string[]): string;
6338
6340
  when(cond: boolean, trueCase: string, falseCase?: string): string;
@@ -6378,6 +6380,7 @@ declare class OperationContext implements ICommonContext {
6378
6380
  ref(ref: Resolvable | string[], ...rest: string[]): string;
6379
6381
  resolve(ref: Resolvable | string[], ...rest: string[]): string;
6380
6382
  schema(): string;
6383
+ database(): string;
6381
6384
  dependencies(name: Resolvable | Resolvable[]): string;
6382
6385
  tags(name: string | string[]): string;
6383
6386
  hasOutput(hasOutput: boolean): string;
@@ -6487,6 +6490,7 @@ declare class TableContext implements ITableContext {
6487
6490
  ref(ref: Resolvable | string[], ...rest: string[]): string;
6488
6491
  resolve(ref: Resolvable | string[], ...rest: string[]): string;
6489
6492
  schema(): string;
6493
+ database(): string;
6490
6494
  type(type: TableType): string;
6491
6495
  where(where: Contextable<ITableContext, string>): string;
6492
6496
  when(cond: boolean, trueCase: string, falseCase?: string): string;
package/bundle.js CHANGED
@@ -17284,13 +17284,12 @@ class AssertionContext {
17284
17284
  return this.resolve(this.assertion.proto.target);
17285
17285
  }
17286
17286
  name() {
17287
- return this.assertion.proto.target.name;
17287
+ return this.assertion.session.finalizeName(this.assertion.proto.target.name);
17288
17288
  }
17289
17289
  ref(ref, ...rest) {
17290
17290
  ref = toResolvable(ref, rest);
17291
17291
  if (!resolvableAsTarget(ref)) {
17292
- const message = `Action name is not specified`;
17293
- this.assertion.session.compileError(new Error(message));
17292
+ this.assertion.session.compileError(new Error(`Action name is not specified`));
17294
17293
  return "";
17295
17294
  }
17296
17295
  this.assertion.dependencies(ref);
@@ -17302,6 +17301,13 @@ class AssertionContext {
17302
17301
  schema() {
17303
17302
  return this.assertion.session.finalizeSchema(this.assertion.proto.target.schema);
17304
17303
  }
17304
+ database() {
17305
+ if (!this.assertion.proto.target.database) {
17306
+ this.assertion.session.compileError(new Error(`Warehouse does not support multiple databases`));
17307
+ return "";
17308
+ }
17309
+ return this.assertion.session.finalizeDatabase(this.assertion.proto.target.database);
17310
+ }
17305
17311
  dependencies(name) {
17306
17312
  this.assertion.dependencies(name);
17307
17313
  return "";
@@ -17555,13 +17561,12 @@ class OperationContext {
17555
17561
  return this.resolve(this.operation.proto.target);
17556
17562
  }
17557
17563
  name() {
17558
- return this.operation.proto.target.name;
17564
+ return this.operation.session.finalizeName(this.operation.proto.target.name);
17559
17565
  }
17560
17566
  ref(ref, ...rest) {
17561
17567
  ref = toResolvable(ref, rest);
17562
17568
  if (!resolvableAsTarget(ref)) {
17563
- const message = `Action name is not specified`;
17564
- this.operation.session.compileError(new Error(message));
17569
+ this.operation.session.compileError(new Error(`Action name is not specified`));
17565
17570
  return "";
17566
17571
  }
17567
17572
  this.operation.dependencies(ref);
@@ -17573,6 +17578,13 @@ class OperationContext {
17573
17578
  schema() {
17574
17579
  return this.operation.session.finalizeSchema(this.operation.proto.target.schema);
17575
17580
  }
17581
+ database() {
17582
+ if (!this.operation.proto.target.database) {
17583
+ this.operation.session.compileError(new Error(`Warehouse does not support multiple databases`));
17584
+ return "";
17585
+ }
17586
+ return this.operation.session.finalizeDatabase(this.operation.proto.target.database);
17587
+ }
17576
17588
  dependencies(name) {
17577
17589
  this.operation.dependencies(name);
17578
17590
  return "";
@@ -17915,13 +17927,12 @@ class TableContext {
17915
17927
  return this.resolve(this.table.proto.target);
17916
17928
  }
17917
17929
  name() {
17918
- return this.table.proto.target.name;
17930
+ return this.table.session.finalizeName(this.table.proto.target.name);
17919
17931
  }
17920
17932
  ref(ref, ...rest) {
17921
17933
  ref = toResolvable(ref, rest);
17922
17934
  if (!resolvableAsTarget(ref)) {
17923
- const message = `Action name is not specified`;
17924
- this.table.session.compileError(new Error(message));
17935
+ this.table.session.compileError(new Error(`Action name is not specified`));
17925
17936
  return "";
17926
17937
  }
17927
17938
  this.table.dependencies(ref);
@@ -17933,6 +17944,13 @@ class TableContext {
17933
17944
  schema() {
17934
17945
  return this.table.session.finalizeSchema(this.table.proto.target.schema);
17935
17946
  }
17947
+ database() {
17948
+ if (!this.table.proto.target.database) {
17949
+ this.table.session.compileError(new Error(`Warehouse does not support multiple databases`));
17950
+ return "";
17951
+ }
17952
+ return this.table.session.finalizeDatabase(this.table.proto.target.database);
17953
+ }
17936
17954
  type(type) {
17937
17955
  this.table.type(type);
17938
17956
  return "";
@@ -19007,6 +19025,9 @@ class RefReplacingContext {
19007
19025
  schema() {
19008
19026
  return "";
19009
19027
  }
19028
+ database() {
19029
+ return "";
19030
+ }
19010
19031
  where(where) {
19011
19032
  return "";
19012
19033
  }
@@ -19039,7 +19060,7 @@ class RefReplacingContext {
19039
19060
  }
19040
19061
  }
19041
19062
 
19042
- const version = "2.2.0";
19063
+ const version = "2.3.0";
19043
19064
 
19044
19065
  const SQL_DATA_WAREHOUSE_DIST_HASH_REGEXP = new RegExp("HASH\\s*\\(\\s*\\w*\\s*\\)\\s*");
19045
19066
  const DEFAULT_CONFIG = {
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "version": "2.2.0",
53
+ "version": "2.3.0",
54
54
  "name": "@dataform/core",
55
55
  "description": "Dataform core API.",
56
56
  "main": "bundle.js",