@dataform/core 1.18.0 → 1.20.2

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 +196 -14
  2. package/bundle.js +537 -81
  3. package/package.json +10 -2
package/bundle.d.ts CHANGED
@@ -1342,18 +1342,18 @@ namespace dataform {
1342
1342
  /** CompileConfig projectDir */
1343
1343
  projectDir?: (string|null);
1344
1344
 
1345
+ /** CompileConfig filePaths */
1346
+ filePaths?: (string[]|null);
1347
+
1345
1348
  /** CompileConfig projectConfigOverride */
1346
1349
  projectConfigOverride?: (dataform.IProjectConfig|null);
1347
1350
 
1348
- /** CompileConfig compileSingleQuery */
1349
- compileSingleQuery?: (boolean|null);
1350
-
1351
- /** CompileConfig query */
1352
- query?: (string|null);
1353
-
1354
1351
  /** CompileConfig timeoutMillis */
1355
1352
  timeoutMillis?: (number|null);
1356
1353
 
1354
+ /** CompileConfig useMain */
1355
+ useMain?: (boolean|null);
1356
+
1357
1357
  /** CompileConfig schemaSuffixOverride */
1358
1358
  schemaSuffixOverride?: (string|null);
1359
1359
 
@@ -1373,18 +1373,18 @@ namespace dataform {
1373
1373
  /** CompileConfig projectDir. */
1374
1374
  public projectDir: string;
1375
1375
 
1376
+ /** CompileConfig filePaths. */
1377
+ public filePaths: string[];
1378
+
1376
1379
  /** CompileConfig projectConfigOverride. */
1377
1380
  public projectConfigOverride?: (dataform.IProjectConfig|null);
1378
1381
 
1379
- /** CompileConfig compileSingleQuery. */
1380
- public compileSingleQuery: boolean;
1381
-
1382
- /** CompileConfig query. */
1383
- public query: string;
1384
-
1385
1382
  /** CompileConfig timeoutMillis. */
1386
1383
  public timeoutMillis: number;
1387
1384
 
1385
+ /** CompileConfig useMain. */
1386
+ public useMain: boolean;
1387
+
1388
1388
  /** CompileConfig schemaSuffixOverride. */
1389
1389
  public schemaSuffixOverride: string;
1390
1390
 
@@ -6035,6 +6035,186 @@ namespace dataform {
6035
6035
  }
6036
6036
  }
6037
6037
 
6038
+ /** Properties of a CoreExecutionConfig. */
6039
+ interface ICoreExecutionConfig {
6040
+
6041
+ /** CoreExecutionConfig compileConfig */
6042
+ compileConfig?: (dataform.ICompileConfig|null);
6043
+ }
6044
+
6045
+ /** Represents a CoreExecutionConfig. */
6046
+ class CoreExecutionConfig implements ICoreExecutionConfig {
6047
+
6048
+ /**
6049
+ * Constructs a new CoreExecutionConfig.
6050
+ * @param [properties] Properties to set
6051
+ */
6052
+ constructor(properties?: dataform.ICoreExecutionConfig);
6053
+
6054
+ /** CoreExecutionConfig compileConfig. */
6055
+ public compileConfig?: (dataform.ICompileConfig|null);
6056
+
6057
+ /**
6058
+ * Creates a new CoreExecutionConfig instance using the specified properties.
6059
+ * @param [properties] Properties to set
6060
+ * @returns CoreExecutionConfig instance
6061
+ */
6062
+ public static create(properties?: dataform.ICoreExecutionConfig): dataform.CoreExecutionConfig;
6063
+
6064
+ /**
6065
+ * Encodes the specified CoreExecutionConfig message. Does not implicitly {@link dataform.CoreExecutionConfig.verify|verify} messages.
6066
+ * @param message CoreExecutionConfig message or plain object to encode
6067
+ * @param [writer] Writer to encode to
6068
+ * @returns Writer
6069
+ */
6070
+ public static encode(message: dataform.ICoreExecutionConfig, writer?: Writer): Writer;
6071
+
6072
+ /**
6073
+ * Encodes the specified CoreExecutionConfig message, length delimited. Does not implicitly {@link dataform.CoreExecutionConfig.verify|verify} messages.
6074
+ * @param message CoreExecutionConfig message or plain object to encode
6075
+ * @param [writer] Writer to encode to
6076
+ * @returns Writer
6077
+ */
6078
+ public static encodeDelimited(message: dataform.ICoreExecutionConfig, writer?: Writer): Writer;
6079
+
6080
+ /**
6081
+ * Decodes a CoreExecutionConfig message from the specified reader or buffer.
6082
+ * @param reader Reader or buffer to decode from
6083
+ * @param [length] Message length if known beforehand
6084
+ * @returns CoreExecutionConfig
6085
+ * @throws {Error} If the payload is not a reader or valid buffer
6086
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6087
+ */
6088
+ public static decode(reader: (Reader|Uint8Array), length?: number): dataform.CoreExecutionConfig;
6089
+
6090
+ /**
6091
+ * Decodes a CoreExecutionConfig message from the specified reader or buffer, length delimited.
6092
+ * @param reader Reader or buffer to decode from
6093
+ * @returns CoreExecutionConfig
6094
+ * @throws {Error} If the payload is not a reader or valid buffer
6095
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6096
+ */
6097
+ public static decodeDelimited(reader: (Reader|Uint8Array)): dataform.CoreExecutionConfig;
6098
+
6099
+ /**
6100
+ * Verifies a CoreExecutionConfig message.
6101
+ * @param message Plain object to verify
6102
+ * @returns `null` if valid, otherwise the reason why it is not
6103
+ */
6104
+ public static verify(message: { [k: string]: any }): (string|null);
6105
+
6106
+ /**
6107
+ * Creates a CoreExecutionConfig message from a plain object. Also converts values to their respective internal types.
6108
+ * @param object Plain object
6109
+ * @returns CoreExecutionConfig
6110
+ */
6111
+ public static fromObject(object: { [k: string]: any }): dataform.CoreExecutionConfig;
6112
+
6113
+ /**
6114
+ * Creates a plain object from a CoreExecutionConfig message. Also converts values to other types if specified.
6115
+ * @param message CoreExecutionConfig
6116
+ * @param [options] Conversion options
6117
+ * @returns Plain object
6118
+ */
6119
+ public static toObject(message: dataform.CoreExecutionConfig, options?: IConversionOptions): { [k: string]: any };
6120
+
6121
+ /**
6122
+ * Converts this CoreExecutionConfig to JSON.
6123
+ * @returns JSON object
6124
+ */
6125
+ public toJSON(): { [k: string]: any };
6126
+ }
6127
+
6128
+ /** Properties of a CoreExecutionResult. */
6129
+ interface ICoreExecutionResult {
6130
+
6131
+ /** CoreExecutionResult compiledGraph */
6132
+ compiledGraph?: (dataform.ICompiledGraph|null);
6133
+ }
6134
+
6135
+ /** Represents a CoreExecutionResult. */
6136
+ class CoreExecutionResult implements ICoreExecutionResult {
6137
+
6138
+ /**
6139
+ * Constructs a new CoreExecutionResult.
6140
+ * @param [properties] Properties to set
6141
+ */
6142
+ constructor(properties?: dataform.ICoreExecutionResult);
6143
+
6144
+ /** CoreExecutionResult compiledGraph. */
6145
+ public compiledGraph?: (dataform.ICompiledGraph|null);
6146
+
6147
+ /**
6148
+ * Creates a new CoreExecutionResult instance using the specified properties.
6149
+ * @param [properties] Properties to set
6150
+ * @returns CoreExecutionResult instance
6151
+ */
6152
+ public static create(properties?: dataform.ICoreExecutionResult): dataform.CoreExecutionResult;
6153
+
6154
+ /**
6155
+ * Encodes the specified CoreExecutionResult message. Does not implicitly {@link dataform.CoreExecutionResult.verify|verify} messages.
6156
+ * @param message CoreExecutionResult message or plain object to encode
6157
+ * @param [writer] Writer to encode to
6158
+ * @returns Writer
6159
+ */
6160
+ public static encode(message: dataform.ICoreExecutionResult, writer?: Writer): Writer;
6161
+
6162
+ /**
6163
+ * Encodes the specified CoreExecutionResult message, length delimited. Does not implicitly {@link dataform.CoreExecutionResult.verify|verify} messages.
6164
+ * @param message CoreExecutionResult message or plain object to encode
6165
+ * @param [writer] Writer to encode to
6166
+ * @returns Writer
6167
+ */
6168
+ public static encodeDelimited(message: dataform.ICoreExecutionResult, writer?: Writer): Writer;
6169
+
6170
+ /**
6171
+ * Decodes a CoreExecutionResult message from the specified reader or buffer.
6172
+ * @param reader Reader or buffer to decode from
6173
+ * @param [length] Message length if known beforehand
6174
+ * @returns CoreExecutionResult
6175
+ * @throws {Error} If the payload is not a reader or valid buffer
6176
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6177
+ */
6178
+ public static decode(reader: (Reader|Uint8Array), length?: number): dataform.CoreExecutionResult;
6179
+
6180
+ /**
6181
+ * Decodes a CoreExecutionResult message from the specified reader or buffer, length delimited.
6182
+ * @param reader Reader or buffer to decode from
6183
+ * @returns CoreExecutionResult
6184
+ * @throws {Error} If the payload is not a reader or valid buffer
6185
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
6186
+ */
6187
+ public static decodeDelimited(reader: (Reader|Uint8Array)): dataform.CoreExecutionResult;
6188
+
6189
+ /**
6190
+ * Verifies a CoreExecutionResult message.
6191
+ * @param message Plain object to verify
6192
+ * @returns `null` if valid, otherwise the reason why it is not
6193
+ */
6194
+ public static verify(message: { [k: string]: any }): (string|null);
6195
+
6196
+ /**
6197
+ * Creates a CoreExecutionResult message from a plain object. Also converts values to their respective internal types.
6198
+ * @param object Plain object
6199
+ * @returns CoreExecutionResult
6200
+ */
6201
+ public static fromObject(object: { [k: string]: any }): dataform.CoreExecutionResult;
6202
+
6203
+ /**
6204
+ * Creates a plain object from a CoreExecutionResult message. Also converts values to other types if specified.
6205
+ * @param message CoreExecutionResult
6206
+ * @param [options] Conversion options
6207
+ * @returns Plain object
6208
+ */
6209
+ public static toObject(message: dataform.CoreExecutionResult, options?: IConversionOptions): { [k: string]: any };
6210
+
6211
+ /**
6212
+ * Converts this CoreExecutionResult to JSON.
6213
+ * @returns JSON object
6214
+ */
6215
+ public toJSON(): { [k: string]: any };
6216
+ }
6217
+
6038
6218
  /** Properties of a JDBC. */
6039
6219
  interface IJDBC {
6040
6220
 
@@ -8262,7 +8442,7 @@ declare class Session {
8262
8442
  [name: string]: Test;
8263
8443
  };
8264
8444
  graphErrors: dataform.IGraphErrors;
8265
- constructor(rootDir: string, projectConfig?: dataform.IProjectConfig, originalProjectConfig?: dataform.IProjectConfig);
8445
+ constructor(rootDir?: string, projectConfig?: dataform.IProjectConfig, originalProjectConfig?: dataform.IProjectConfig);
8266
8446
  init(rootDir: string, projectConfig?: dataform.IProjectConfig, originalProjectConfig?: dataform.IProjectConfig): void;
8267
8447
  get projectConfig(): Pick<dataform.IProjectConfig, "warehouse" | "defaultDatabase" | "defaultSchema" | "assertionSchema" | "databaseSuffix" | "schemaSuffix" | "tablePrefix" | "vars">;
8268
8448
  adapter(): IAdapter;
@@ -8302,9 +8482,11 @@ declare class Session {
8302
8482
  private checkRunCachingCorrectness;
8303
8483
  }
8304
8484
 
8485
+ declare function main(encodedCoreExecutionConfig: string): string;
8486
+
8305
8487
  declare const indexFileGenerator: typeof genIndex;
8306
8488
  declare const compiler: typeof compile;
8307
8489
  declare const session: Session;
8308
8490
  declare const compileStandaloneSqlxQuery$1: typeof compileStandaloneSqlxQuery;
8309
8491
 
8310
- export { index_d as adapters, compileStandaloneSqlxQuery$1 as compileStandaloneSqlxQuery, compiler, indexFileGenerator, session };
8492
+ export { index_d as adapters, compileStandaloneSqlxQuery$1 as compileStandaloneSqlxQuery, compiler, indexFileGenerator, main, session };
package/bundle.js CHANGED
@@ -6,7 +6,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var semver = require('semver');
8
8
  var $protobuf = require('protobufjs/minimal');
9
- var path = require('path');
10
9
  var moo = require('moo');
11
10
  var protobufjs = require('protobufjs');
12
11
  var TarjanGraphConstructor = _interopDefault(require('tarjan-graph'));
@@ -3491,10 +3490,10 @@ const dataform = $root.dataform = (() => {
3491
3490
  * @memberof dataform
3492
3491
  * @interface ICompileConfig
3493
3492
  * @property {string|null} [projectDir] CompileConfig projectDir
3493
+ * @property {Array.<string>|null} [filePaths] CompileConfig filePaths
3494
3494
  * @property {dataform.IProjectConfig|null} [projectConfigOverride] CompileConfig projectConfigOverride
3495
- * @property {boolean|null} [compileSingleQuery] CompileConfig compileSingleQuery
3496
- * @property {string|null} [query] CompileConfig query
3497
3495
  * @property {number|null} [timeoutMillis] CompileConfig timeoutMillis
3496
+ * @property {boolean|null} [useMain] CompileConfig useMain
3498
3497
  * @property {string|null} [schemaSuffixOverride] CompileConfig schemaSuffixOverride
3499
3498
  * @property {string|null} [returnOverride] CompileConfig returnOverride
3500
3499
  */
@@ -3508,6 +3507,7 @@ const dataform = $root.dataform = (() => {
3508
3507
  * @param {dataform.ICompileConfig=} [properties] Properties to set
3509
3508
  */
3510
3509
  function CompileConfig(properties) {
3510
+ this.filePaths = [];
3511
3511
  if (properties)
3512
3512
  for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3513
3513
  if (properties[keys[i]] != null)
@@ -3523,36 +3523,36 @@ const dataform = $root.dataform = (() => {
3523
3523
  CompileConfig.prototype.projectDir = "";
3524
3524
 
3525
3525
  /**
3526
- * CompileConfig projectConfigOverride.
3527
- * @member {dataform.IProjectConfig|null|undefined} projectConfigOverride
3526
+ * CompileConfig filePaths.
3527
+ * @member {Array.<string>} filePaths
3528
3528
  * @memberof dataform.CompileConfig
3529
3529
  * @instance
3530
3530
  */
3531
- CompileConfig.prototype.projectConfigOverride = null;
3531
+ CompileConfig.prototype.filePaths = $util.emptyArray;
3532
3532
 
3533
3533
  /**
3534
- * CompileConfig compileSingleQuery.
3535
- * @member {boolean} compileSingleQuery
3534
+ * CompileConfig projectConfigOverride.
3535
+ * @member {dataform.IProjectConfig|null|undefined} projectConfigOverride
3536
3536
  * @memberof dataform.CompileConfig
3537
3537
  * @instance
3538
3538
  */
3539
- CompileConfig.prototype.compileSingleQuery = false;
3539
+ CompileConfig.prototype.projectConfigOverride = null;
3540
3540
 
3541
3541
  /**
3542
- * CompileConfig query.
3543
- * @member {string} query
3542
+ * CompileConfig timeoutMillis.
3543
+ * @member {number} timeoutMillis
3544
3544
  * @memberof dataform.CompileConfig
3545
3545
  * @instance
3546
3546
  */
3547
- CompileConfig.prototype.query = "";
3547
+ CompileConfig.prototype.timeoutMillis = 0;
3548
3548
 
3549
3549
  /**
3550
- * CompileConfig timeoutMillis.
3551
- * @member {number} timeoutMillis
3550
+ * CompileConfig useMain.
3551
+ * @member {boolean} useMain
3552
3552
  * @memberof dataform.CompileConfig
3553
3553
  * @instance
3554
3554
  */
3555
- CompileConfig.prototype.timeoutMillis = 0;
3555
+ CompileConfig.prototype.useMain = false;
3556
3556
 
3557
3557
  /**
3558
3558
  * CompileConfig schemaSuffixOverride.
@@ -3600,14 +3600,15 @@ const dataform = $root.dataform = (() => {
3600
3600
  writer.uint32(/* id 2, wireType 2 =*/18).string(message.schemaSuffixOverride);
3601
3601
  if (message.projectConfigOverride != null && message.hasOwnProperty("projectConfigOverride"))
3602
3602
  $root.dataform.ProjectConfig.encode(message.projectConfigOverride, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
3603
- if (message.query != null && message.hasOwnProperty("query"))
3604
- writer.uint32(/* id 4, wireType 2 =*/34).string(message.query);
3605
3603
  if (message.returnOverride != null && message.hasOwnProperty("returnOverride"))
3606
3604
  writer.uint32(/* id 5, wireType 2 =*/42).string(message.returnOverride);
3607
3605
  if (message.timeoutMillis != null && message.hasOwnProperty("timeoutMillis"))
3608
3606
  writer.uint32(/* id 6, wireType 0 =*/48).int32(message.timeoutMillis);
3609
- if (message.compileSingleQuery != null && message.hasOwnProperty("compileSingleQuery"))
3610
- writer.uint32(/* id 7, wireType 0 =*/56).bool(message.compileSingleQuery);
3607
+ if (message.filePaths != null && message.filePaths.length)
3608
+ for (let i = 0; i < message.filePaths.length; ++i)
3609
+ writer.uint32(/* id 8, wireType 2 =*/66).string(message.filePaths[i]);
3610
+ if (message.useMain != null && message.hasOwnProperty("useMain"))
3611
+ writer.uint32(/* id 9, wireType 0 =*/72).bool(message.useMain);
3611
3612
  return writer;
3612
3613
  };
3613
3614
 
@@ -3645,18 +3646,20 @@ const dataform = $root.dataform = (() => {
3645
3646
  case 1:
3646
3647
  message.projectDir = reader.string();
3647
3648
  break;
3649
+ case 8:
3650
+ if (!(message.filePaths && message.filePaths.length))
3651
+ message.filePaths = [];
3652
+ message.filePaths.push(reader.string());
3653
+ break;
3648
3654
  case 3:
3649
3655
  message.projectConfigOverride = $root.dataform.ProjectConfig.decode(reader, reader.uint32());
3650
3656
  break;
3651
- case 7:
3652
- message.compileSingleQuery = reader.bool();
3653
- break;
3654
- case 4:
3655
- message.query = reader.string();
3656
- break;
3657
3657
  case 6:
3658
3658
  message.timeoutMillis = reader.int32();
3659
3659
  break;
3660
+ case 9:
3661
+ message.useMain = reader.bool();
3662
+ break;
3660
3663
  case 2:
3661
3664
  message.schemaSuffixOverride = reader.string();
3662
3665
  break;
@@ -3701,20 +3704,24 @@ const dataform = $root.dataform = (() => {
3701
3704
  if (message.projectDir != null && message.hasOwnProperty("projectDir"))
3702
3705
  if (!$util.isString(message.projectDir))
3703
3706
  return "projectDir: string expected";
3707
+ if (message.filePaths != null && message.hasOwnProperty("filePaths")) {
3708
+ if (!Array.isArray(message.filePaths))
3709
+ return "filePaths: array expected";
3710
+ for (let i = 0; i < message.filePaths.length; ++i)
3711
+ if (!$util.isString(message.filePaths[i]))
3712
+ return "filePaths: string[] expected";
3713
+ }
3704
3714
  if (message.projectConfigOverride != null && message.hasOwnProperty("projectConfigOverride")) {
3705
3715
  let error = $root.dataform.ProjectConfig.verify(message.projectConfigOverride);
3706
3716
  if (error)
3707
3717
  return "projectConfigOverride." + error;
3708
3718
  }
3709
- if (message.compileSingleQuery != null && message.hasOwnProperty("compileSingleQuery"))
3710
- if (typeof message.compileSingleQuery !== "boolean")
3711
- return "compileSingleQuery: boolean expected";
3712
- if (message.query != null && message.hasOwnProperty("query"))
3713
- if (!$util.isString(message.query))
3714
- return "query: string expected";
3715
3719
  if (message.timeoutMillis != null && message.hasOwnProperty("timeoutMillis"))
3716
3720
  if (!$util.isInteger(message.timeoutMillis))
3717
3721
  return "timeoutMillis: integer expected";
3722
+ if (message.useMain != null && message.hasOwnProperty("useMain"))
3723
+ if (typeof message.useMain !== "boolean")
3724
+ return "useMain: boolean expected";
3718
3725
  if (message.schemaSuffixOverride != null && message.hasOwnProperty("schemaSuffixOverride"))
3719
3726
  if (!$util.isString(message.schemaSuffixOverride))
3720
3727
  return "schemaSuffixOverride: string expected";
@@ -3738,17 +3745,22 @@ const dataform = $root.dataform = (() => {
3738
3745
  let message = new $root.dataform.CompileConfig();
3739
3746
  if (object.projectDir != null)
3740
3747
  message.projectDir = String(object.projectDir);
3748
+ if (object.filePaths) {
3749
+ if (!Array.isArray(object.filePaths))
3750
+ throw TypeError(".dataform.CompileConfig.filePaths: array expected");
3751
+ message.filePaths = [];
3752
+ for (let i = 0; i < object.filePaths.length; ++i)
3753
+ message.filePaths[i] = String(object.filePaths[i]);
3754
+ }
3741
3755
  if (object.projectConfigOverride != null) {
3742
3756
  if (typeof object.projectConfigOverride !== "object")
3743
3757
  throw TypeError(".dataform.CompileConfig.projectConfigOverride: object expected");
3744
3758
  message.projectConfigOverride = $root.dataform.ProjectConfig.fromObject(object.projectConfigOverride);
3745
3759
  }
3746
- if (object.compileSingleQuery != null)
3747
- message.compileSingleQuery = Boolean(object.compileSingleQuery);
3748
- if (object.query != null)
3749
- message.query = String(object.query);
3750
3760
  if (object.timeoutMillis != null)
3751
3761
  message.timeoutMillis = object.timeoutMillis | 0;
3762
+ if (object.useMain != null)
3763
+ message.useMain = Boolean(object.useMain);
3752
3764
  if (object.schemaSuffixOverride != null)
3753
3765
  message.schemaSuffixOverride = String(object.schemaSuffixOverride);
3754
3766
  if (object.returnOverride != null)
@@ -3769,14 +3781,15 @@ const dataform = $root.dataform = (() => {
3769
3781
  if (!options)
3770
3782
  options = {};
3771
3783
  let object = {};
3784
+ if (options.arrays || options.defaults)
3785
+ object.filePaths = [];
3772
3786
  if (options.defaults) {
3773
3787
  object.projectDir = "";
3774
3788
  object.schemaSuffixOverride = "";
3775
3789
  object.projectConfigOverride = null;
3776
- object.query = "";
3777
3790
  object.returnOverride = "";
3778
3791
  object.timeoutMillis = 0;
3779
- object.compileSingleQuery = false;
3792
+ object.useMain = false;
3780
3793
  }
3781
3794
  if (message.projectDir != null && message.hasOwnProperty("projectDir"))
3782
3795
  object.projectDir = message.projectDir;
@@ -3784,14 +3797,17 @@ const dataform = $root.dataform = (() => {
3784
3797
  object.schemaSuffixOverride = message.schemaSuffixOverride;
3785
3798
  if (message.projectConfigOverride != null && message.hasOwnProperty("projectConfigOverride"))
3786
3799
  object.projectConfigOverride = $root.dataform.ProjectConfig.toObject(message.projectConfigOverride, options);
3787
- if (message.query != null && message.hasOwnProperty("query"))
3788
- object.query = message.query;
3789
3800
  if (message.returnOverride != null && message.hasOwnProperty("returnOverride"))
3790
3801
  object.returnOverride = message.returnOverride;
3791
3802
  if (message.timeoutMillis != null && message.hasOwnProperty("timeoutMillis"))
3792
3803
  object.timeoutMillis = message.timeoutMillis;
3793
- if (message.compileSingleQuery != null && message.hasOwnProperty("compileSingleQuery"))
3794
- object.compileSingleQuery = message.compileSingleQuery;
3804
+ if (message.filePaths && message.filePaths.length) {
3805
+ object.filePaths = [];
3806
+ for (let j = 0; j < message.filePaths.length; ++j)
3807
+ object.filePaths[j] = message.filePaths[j];
3808
+ }
3809
+ if (message.useMain != null && message.hasOwnProperty("useMain"))
3810
+ object.useMain = message.useMain;
3795
3811
  return object;
3796
3812
  };
3797
3813
 
@@ -16306,6 +16322,390 @@ const dataform = $root.dataform = (() => {
16306
16322
  return PersistedTableMetadata;
16307
16323
  })();
16308
16324
 
16325
+ dataform.CoreExecutionConfig = (function() {
16326
+
16327
+ /**
16328
+ * Properties of a CoreExecutionConfig.
16329
+ * @memberof dataform
16330
+ * @interface ICoreExecutionConfig
16331
+ * @property {dataform.ICompileConfig|null} [compileConfig] CoreExecutionConfig compileConfig
16332
+ */
16333
+
16334
+ /**
16335
+ * Constructs a new CoreExecutionConfig.
16336
+ * @memberof dataform
16337
+ * @classdesc Represents a CoreExecutionConfig.
16338
+ * @implements ICoreExecutionConfig
16339
+ * @constructor
16340
+ * @param {dataform.ICoreExecutionConfig=} [properties] Properties to set
16341
+ */
16342
+ function CoreExecutionConfig(properties) {
16343
+ if (properties)
16344
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
16345
+ if (properties[keys[i]] != null)
16346
+ this[keys[i]] = properties[keys[i]];
16347
+ }
16348
+
16349
+ /**
16350
+ * CoreExecutionConfig compileConfig.
16351
+ * @member {dataform.ICompileConfig|null|undefined} compileConfig
16352
+ * @memberof dataform.CoreExecutionConfig
16353
+ * @instance
16354
+ */
16355
+ CoreExecutionConfig.prototype.compileConfig = null;
16356
+
16357
+ /**
16358
+ * Creates a new CoreExecutionConfig instance using the specified properties.
16359
+ * @function create
16360
+ * @memberof dataform.CoreExecutionConfig
16361
+ * @static
16362
+ * @param {dataform.ICoreExecutionConfig=} [properties] Properties to set
16363
+ * @returns {dataform.CoreExecutionConfig} CoreExecutionConfig instance
16364
+ */
16365
+ CoreExecutionConfig.create = function create(properties) {
16366
+ return new CoreExecutionConfig(properties);
16367
+ };
16368
+
16369
+ /**
16370
+ * Encodes the specified CoreExecutionConfig message. Does not implicitly {@link dataform.CoreExecutionConfig.verify|verify} messages.
16371
+ * @function encode
16372
+ * @memberof dataform.CoreExecutionConfig
16373
+ * @static
16374
+ * @param {dataform.ICoreExecutionConfig} message CoreExecutionConfig message or plain object to encode
16375
+ * @param {$protobuf.Writer} [writer] Writer to encode to
16376
+ * @returns {$protobuf.Writer} Writer
16377
+ */
16378
+ CoreExecutionConfig.encode = function encode(message, writer) {
16379
+ if (!writer)
16380
+ writer = $Writer.create();
16381
+ if (message.compileConfig != null && message.hasOwnProperty("compileConfig"))
16382
+ $root.dataform.CompileConfig.encode(message.compileConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
16383
+ return writer;
16384
+ };
16385
+
16386
+ /**
16387
+ * Encodes the specified CoreExecutionConfig message, length delimited. Does not implicitly {@link dataform.CoreExecutionConfig.verify|verify} messages.
16388
+ * @function encodeDelimited
16389
+ * @memberof dataform.CoreExecutionConfig
16390
+ * @static
16391
+ * @param {dataform.ICoreExecutionConfig} message CoreExecutionConfig message or plain object to encode
16392
+ * @param {$protobuf.Writer} [writer] Writer to encode to
16393
+ * @returns {$protobuf.Writer} Writer
16394
+ */
16395
+ CoreExecutionConfig.encodeDelimited = function encodeDelimited(message, writer) {
16396
+ return this.encode(message, writer).ldelim();
16397
+ };
16398
+
16399
+ /**
16400
+ * Decodes a CoreExecutionConfig message from the specified reader or buffer.
16401
+ * @function decode
16402
+ * @memberof dataform.CoreExecutionConfig
16403
+ * @static
16404
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
16405
+ * @param {number} [length] Message length if known beforehand
16406
+ * @returns {dataform.CoreExecutionConfig} CoreExecutionConfig
16407
+ * @throws {Error} If the payload is not a reader or valid buffer
16408
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
16409
+ */
16410
+ CoreExecutionConfig.decode = function decode(reader, length) {
16411
+ if (!(reader instanceof $Reader))
16412
+ reader = $Reader.create(reader);
16413
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dataform.CoreExecutionConfig();
16414
+ while (reader.pos < end) {
16415
+ let tag = reader.uint32();
16416
+ switch (tag >>> 3) {
16417
+ case 1:
16418
+ message.compileConfig = $root.dataform.CompileConfig.decode(reader, reader.uint32());
16419
+ break;
16420
+ default:
16421
+ reader.skipType(tag & 7);
16422
+ break;
16423
+ }
16424
+ }
16425
+ return message;
16426
+ };
16427
+
16428
+ /**
16429
+ * Decodes a CoreExecutionConfig message from the specified reader or buffer, length delimited.
16430
+ * @function decodeDelimited
16431
+ * @memberof dataform.CoreExecutionConfig
16432
+ * @static
16433
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
16434
+ * @returns {dataform.CoreExecutionConfig} CoreExecutionConfig
16435
+ * @throws {Error} If the payload is not a reader or valid buffer
16436
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
16437
+ */
16438
+ CoreExecutionConfig.decodeDelimited = function decodeDelimited(reader) {
16439
+ if (!(reader instanceof $Reader))
16440
+ reader = new $Reader(reader);
16441
+ return this.decode(reader, reader.uint32());
16442
+ };
16443
+
16444
+ /**
16445
+ * Verifies a CoreExecutionConfig message.
16446
+ * @function verify
16447
+ * @memberof dataform.CoreExecutionConfig
16448
+ * @static
16449
+ * @param {Object.<string,*>} message Plain object to verify
16450
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
16451
+ */
16452
+ CoreExecutionConfig.verify = function verify(message) {
16453
+ if (typeof message !== "object" || message === null)
16454
+ return "object expected";
16455
+ if (message.compileConfig != null && message.hasOwnProperty("compileConfig")) {
16456
+ let error = $root.dataform.CompileConfig.verify(message.compileConfig);
16457
+ if (error)
16458
+ return "compileConfig." + error;
16459
+ }
16460
+ return null;
16461
+ };
16462
+
16463
+ /**
16464
+ * Creates a CoreExecutionConfig message from a plain object. Also converts values to their respective internal types.
16465
+ * @function fromObject
16466
+ * @memberof dataform.CoreExecutionConfig
16467
+ * @static
16468
+ * @param {Object.<string,*>} object Plain object
16469
+ * @returns {dataform.CoreExecutionConfig} CoreExecutionConfig
16470
+ */
16471
+ CoreExecutionConfig.fromObject = function fromObject(object) {
16472
+ if (object instanceof $root.dataform.CoreExecutionConfig)
16473
+ return object;
16474
+ let message = new $root.dataform.CoreExecutionConfig();
16475
+ if (object.compileConfig != null) {
16476
+ if (typeof object.compileConfig !== "object")
16477
+ throw TypeError(".dataform.CoreExecutionConfig.compileConfig: object expected");
16478
+ message.compileConfig = $root.dataform.CompileConfig.fromObject(object.compileConfig);
16479
+ }
16480
+ return message;
16481
+ };
16482
+
16483
+ /**
16484
+ * Creates a plain object from a CoreExecutionConfig message. Also converts values to other types if specified.
16485
+ * @function toObject
16486
+ * @memberof dataform.CoreExecutionConfig
16487
+ * @static
16488
+ * @param {dataform.CoreExecutionConfig} message CoreExecutionConfig
16489
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
16490
+ * @returns {Object.<string,*>} Plain object
16491
+ */
16492
+ CoreExecutionConfig.toObject = function toObject(message, options) {
16493
+ if (!options)
16494
+ options = {};
16495
+ let object = {};
16496
+ if (options.defaults)
16497
+ object.compileConfig = null;
16498
+ if (message.compileConfig != null && message.hasOwnProperty("compileConfig"))
16499
+ object.compileConfig = $root.dataform.CompileConfig.toObject(message.compileConfig, options);
16500
+ return object;
16501
+ };
16502
+
16503
+ /**
16504
+ * Converts this CoreExecutionConfig to JSON.
16505
+ * @function toJSON
16506
+ * @memberof dataform.CoreExecutionConfig
16507
+ * @instance
16508
+ * @returns {Object.<string,*>} JSON object
16509
+ */
16510
+ CoreExecutionConfig.prototype.toJSON = function toJSON() {
16511
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
16512
+ };
16513
+
16514
+ return CoreExecutionConfig;
16515
+ })();
16516
+
16517
+ dataform.CoreExecutionResult = (function() {
16518
+
16519
+ /**
16520
+ * Properties of a CoreExecutionResult.
16521
+ * @memberof dataform
16522
+ * @interface ICoreExecutionResult
16523
+ * @property {dataform.ICompiledGraph|null} [compiledGraph] CoreExecutionResult compiledGraph
16524
+ */
16525
+
16526
+ /**
16527
+ * Constructs a new CoreExecutionResult.
16528
+ * @memberof dataform
16529
+ * @classdesc Represents a CoreExecutionResult.
16530
+ * @implements ICoreExecutionResult
16531
+ * @constructor
16532
+ * @param {dataform.ICoreExecutionResult=} [properties] Properties to set
16533
+ */
16534
+ function CoreExecutionResult(properties) {
16535
+ if (properties)
16536
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
16537
+ if (properties[keys[i]] != null)
16538
+ this[keys[i]] = properties[keys[i]];
16539
+ }
16540
+
16541
+ /**
16542
+ * CoreExecutionResult compiledGraph.
16543
+ * @member {dataform.ICompiledGraph|null|undefined} compiledGraph
16544
+ * @memberof dataform.CoreExecutionResult
16545
+ * @instance
16546
+ */
16547
+ CoreExecutionResult.prototype.compiledGraph = null;
16548
+
16549
+ /**
16550
+ * Creates a new CoreExecutionResult instance using the specified properties.
16551
+ * @function create
16552
+ * @memberof dataform.CoreExecutionResult
16553
+ * @static
16554
+ * @param {dataform.ICoreExecutionResult=} [properties] Properties to set
16555
+ * @returns {dataform.CoreExecutionResult} CoreExecutionResult instance
16556
+ */
16557
+ CoreExecutionResult.create = function create(properties) {
16558
+ return new CoreExecutionResult(properties);
16559
+ };
16560
+
16561
+ /**
16562
+ * Encodes the specified CoreExecutionResult message. Does not implicitly {@link dataform.CoreExecutionResult.verify|verify} messages.
16563
+ * @function encode
16564
+ * @memberof dataform.CoreExecutionResult
16565
+ * @static
16566
+ * @param {dataform.ICoreExecutionResult} message CoreExecutionResult message or plain object to encode
16567
+ * @param {$protobuf.Writer} [writer] Writer to encode to
16568
+ * @returns {$protobuf.Writer} Writer
16569
+ */
16570
+ CoreExecutionResult.encode = function encode(message, writer) {
16571
+ if (!writer)
16572
+ writer = $Writer.create();
16573
+ if (message.compiledGraph != null && message.hasOwnProperty("compiledGraph"))
16574
+ $root.dataform.CompiledGraph.encode(message.compiledGraph, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
16575
+ return writer;
16576
+ };
16577
+
16578
+ /**
16579
+ * Encodes the specified CoreExecutionResult message, length delimited. Does not implicitly {@link dataform.CoreExecutionResult.verify|verify} messages.
16580
+ * @function encodeDelimited
16581
+ * @memberof dataform.CoreExecutionResult
16582
+ * @static
16583
+ * @param {dataform.ICoreExecutionResult} message CoreExecutionResult message or plain object to encode
16584
+ * @param {$protobuf.Writer} [writer] Writer to encode to
16585
+ * @returns {$protobuf.Writer} Writer
16586
+ */
16587
+ CoreExecutionResult.encodeDelimited = function encodeDelimited(message, writer) {
16588
+ return this.encode(message, writer).ldelim();
16589
+ };
16590
+
16591
+ /**
16592
+ * Decodes a CoreExecutionResult message from the specified reader or buffer.
16593
+ * @function decode
16594
+ * @memberof dataform.CoreExecutionResult
16595
+ * @static
16596
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
16597
+ * @param {number} [length] Message length if known beforehand
16598
+ * @returns {dataform.CoreExecutionResult} CoreExecutionResult
16599
+ * @throws {Error} If the payload is not a reader or valid buffer
16600
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
16601
+ */
16602
+ CoreExecutionResult.decode = function decode(reader, length) {
16603
+ if (!(reader instanceof $Reader))
16604
+ reader = $Reader.create(reader);
16605
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dataform.CoreExecutionResult();
16606
+ while (reader.pos < end) {
16607
+ let tag = reader.uint32();
16608
+ switch (tag >>> 3) {
16609
+ case 1:
16610
+ message.compiledGraph = $root.dataform.CompiledGraph.decode(reader, reader.uint32());
16611
+ break;
16612
+ default:
16613
+ reader.skipType(tag & 7);
16614
+ break;
16615
+ }
16616
+ }
16617
+ return message;
16618
+ };
16619
+
16620
+ /**
16621
+ * Decodes a CoreExecutionResult message from the specified reader or buffer, length delimited.
16622
+ * @function decodeDelimited
16623
+ * @memberof dataform.CoreExecutionResult
16624
+ * @static
16625
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
16626
+ * @returns {dataform.CoreExecutionResult} CoreExecutionResult
16627
+ * @throws {Error} If the payload is not a reader or valid buffer
16628
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
16629
+ */
16630
+ CoreExecutionResult.decodeDelimited = function decodeDelimited(reader) {
16631
+ if (!(reader instanceof $Reader))
16632
+ reader = new $Reader(reader);
16633
+ return this.decode(reader, reader.uint32());
16634
+ };
16635
+
16636
+ /**
16637
+ * Verifies a CoreExecutionResult message.
16638
+ * @function verify
16639
+ * @memberof dataform.CoreExecutionResult
16640
+ * @static
16641
+ * @param {Object.<string,*>} message Plain object to verify
16642
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
16643
+ */
16644
+ CoreExecutionResult.verify = function verify(message) {
16645
+ if (typeof message !== "object" || message === null)
16646
+ return "object expected";
16647
+ if (message.compiledGraph != null && message.hasOwnProperty("compiledGraph")) {
16648
+ let error = $root.dataform.CompiledGraph.verify(message.compiledGraph);
16649
+ if (error)
16650
+ return "compiledGraph." + error;
16651
+ }
16652
+ return null;
16653
+ };
16654
+
16655
+ /**
16656
+ * Creates a CoreExecutionResult message from a plain object. Also converts values to their respective internal types.
16657
+ * @function fromObject
16658
+ * @memberof dataform.CoreExecutionResult
16659
+ * @static
16660
+ * @param {Object.<string,*>} object Plain object
16661
+ * @returns {dataform.CoreExecutionResult} CoreExecutionResult
16662
+ */
16663
+ CoreExecutionResult.fromObject = function fromObject(object) {
16664
+ if (object instanceof $root.dataform.CoreExecutionResult)
16665
+ return object;
16666
+ let message = new $root.dataform.CoreExecutionResult();
16667
+ if (object.compiledGraph != null) {
16668
+ if (typeof object.compiledGraph !== "object")
16669
+ throw TypeError(".dataform.CoreExecutionResult.compiledGraph: object expected");
16670
+ message.compiledGraph = $root.dataform.CompiledGraph.fromObject(object.compiledGraph);
16671
+ }
16672
+ return message;
16673
+ };
16674
+
16675
+ /**
16676
+ * Creates a plain object from a CoreExecutionResult message. Also converts values to other types if specified.
16677
+ * @function toObject
16678
+ * @memberof dataform.CoreExecutionResult
16679
+ * @static
16680
+ * @param {dataform.CoreExecutionResult} message CoreExecutionResult
16681
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
16682
+ * @returns {Object.<string,*>} Plain object
16683
+ */
16684
+ CoreExecutionResult.toObject = function toObject(message, options) {
16685
+ if (!options)
16686
+ options = {};
16687
+ let object = {};
16688
+ if (options.defaults)
16689
+ object.compiledGraph = null;
16690
+ if (message.compiledGraph != null && message.hasOwnProperty("compiledGraph"))
16691
+ object.compiledGraph = $root.dataform.CompiledGraph.toObject(message.compiledGraph, options);
16692
+ return object;
16693
+ };
16694
+
16695
+ /**
16696
+ * Converts this CoreExecutionResult to JSON.
16697
+ * @function toJSON
16698
+ * @memberof dataform.CoreExecutionResult
16699
+ * @instance
16700
+ * @returns {Object.<string,*>} JSON object
16701
+ */
16702
+ CoreExecutionResult.prototype.toJSON = function toJSON() {
16703
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
16704
+ };
16705
+
16706
+ return CoreExecutionResult;
16707
+ })();
16708
+
16309
16709
  dataform.JDBC = (function() {
16310
16710
 
16311
16711
  /**
@@ -20771,7 +21171,7 @@ function concatenateQueries(statements, modifier) {
20771
21171
  ? statement.substring(0, statement.length - 1)
20772
21172
  : statement)
20773
21173
  .map(statement => (!!modifier ? modifier(statement) : statement))
20774
- .join(";\n");
21174
+ .join("\n;\n");
20775
21175
  }
20776
21176
  class Tasks {
20777
21177
  constructor() {
@@ -20960,7 +21360,7 @@ class BigQueryAdapter extends Adapter {
20960
21360
  else {
20961
21361
  tasks.add(Task.statement(table.uniqueKey && table.uniqueKey.length > 0
20962
21362
  ? this.mergeInto(table.target, tableMetadata === null || tableMetadata === void 0 ? void 0 : tableMetadata.fields.map(f => f.name), this.where(table.incrementalQuery || table.query, table.where), table.uniqueKey, table.bigquery && table.bigquery.updatePartitionFilter)
20963
- : this.insertInto(table.target, tableMetadata === null || tableMetadata === void 0 ? void 0 : tableMetadata.fields.map(f => f.name), this.where(table.incrementalQuery || table.query, table.where))));
21363
+ : this.insertInto(table.target, tableMetadata === null || tableMetadata === void 0 ? void 0 : tableMetadata.fields.map(f => f.name).map(column => `\`${column}\``), this.where(table.incrementalQuery || table.query, table.where))));
20964
21364
  }
20965
21365
  }
20966
21366
  else {
@@ -20995,6 +21395,7 @@ class BigQueryAdapter extends Adapter {
20995
21395
  create or replace view ${this.resolveTarget(target)} as ${query}`;
20996
21396
  }
20997
21397
  mergeInto(target, columns, query, uniqueKey, updatePartitionFilter) {
21398
+ const backtickedColumns = columns.map(column => `\`${column}\``);
20998
21399
  return `
20999
21400
  merge ${this.resolveTarget(target)} T
21000
21401
  using (${query}
@@ -21002,9 +21403,9 @@ using (${query}
21002
21403
  on ${uniqueKey.map(uniqueKeyCol => `T.${uniqueKeyCol} = S.${uniqueKeyCol}`).join(` and `)}
21003
21404
  ${updatePartitionFilter ? `and T.${updatePartitionFilter}` : ""}
21004
21405
  when matched then
21005
- update set ${columns.map(column => `${column} = S.${column}`).join(",")}
21406
+ update set ${columns.map(column => `\`${column}\` = S.${column}`).join(",")}
21006
21407
  when not matched then
21007
- insert (${columns.join(",")}) values (${columns.join(",")})`;
21408
+ insert (${backtickedColumns.join(",")}) values (${backtickedColumns.join(",")})`;
21008
21409
  }
21009
21410
  }
21010
21411
 
@@ -21342,8 +21743,7 @@ function supportsCancel(warehouseType) {
21342
21743
  });
21343
21744
  }
21344
21745
  const requiredBigQueryWarehouseProps = [
21345
- "projectId",
21346
- "credentials"
21746
+ "projectId"
21347
21747
  ];
21348
21748
  const requiredJdbcWarehouseProps = [
21349
21749
  "host",
@@ -21458,12 +21858,18 @@ var index = /*#__PURE__*/Object.freeze({
21458
21858
  collectEvaluationQueries: collectEvaluationQueries
21459
21859
  });
21460
21860
 
21861
+ const pathSeperator = (() => {
21862
+ if (typeof process !== "undefined") {
21863
+ return process.platform === "win32" ? "\\" : "/";
21864
+ }
21865
+ return "/";
21866
+ })();
21461
21867
  function relativePath(fullPath, base) {
21462
21868
  if (base.length === 0) {
21463
21869
  return fullPath;
21464
21870
  }
21465
21871
  const stripped = fullPath.substr(base.length);
21466
- if (stripped.startsWith(path.sep)) {
21872
+ if (stripped.startsWith(pathSeperator)) {
21467
21873
  return stripped.substr(1);
21468
21874
  }
21469
21875
  else {
@@ -21471,7 +21877,10 @@ function relativePath(fullPath, base) {
21471
21877
  }
21472
21878
  }
21473
21879
  function baseFilename(fullPath) {
21474
- return path.basename(fullPath).split(".")[0];
21880
+ return fullPath
21881
+ .split(pathSeperator)
21882
+ .slice(-1)[0]
21883
+ .split(".")[0];
21475
21884
  }
21476
21885
  function getCallerFile(rootDir) {
21477
21886
  let lastfile;
@@ -21488,8 +21897,8 @@ function getCallerFile(rootDir) {
21488
21897
  continue;
21489
21898
  }
21490
21899
  lastfile = nextLastfile;
21491
- if (!(nextLastfile.includes(`definitions${path.sep}`) ||
21492
- nextLastfile.includes(`models${path.sep}`))) {
21900
+ if (!(nextLastfile.includes(`definitions${pathSeperator}`) ||
21901
+ nextLastfile.includes(`models${pathSeperator}`))) {
21493
21902
  continue;
21494
21903
  }
21495
21904
  break;
@@ -21589,6 +21998,12 @@ function validateQueryString(session, query, filename) {
21589
21998
  session.compileError(new Error("Semi-colons are not allowed at the end of SQL statements."), filename);
21590
21999
  }
21591
22000
  }
22001
+ function throwIfInvalid(proto, verify) {
22002
+ const verifyError = verify(proto);
22003
+ if (verifyError) {
22004
+ throw new Error(verifyError);
22005
+ }
22006
+ }
21592
22007
 
21593
22008
  const IAssertionConfigProperties = strictKeysOf()([
21594
22009
  "database",
@@ -22976,10 +23391,10 @@ function escapeNode(node) {
22976
23391
  return node.concatenate(SQL_STATEMENT_ESCAPERS);
22977
23392
  }
22978
23393
 
22979
- function encode(protoType, value = {}) {
23394
+ function encode64(protoType, value = {}) {
22980
23395
  return toBase64(protoType.encode(protoType.create(value)).finish());
22981
23396
  }
22982
- function decode(protoType, encodedValue) {
23397
+ function decode64(protoType, encodedValue) {
22983
23398
  if (!encodedValue) {
22984
23399
  return protoType.create();
22985
23400
  }
@@ -22995,7 +23410,7 @@ function fromBase64(value) {
22995
23410
  }
22996
23411
 
22997
23412
  function genIndex(base64EncodedConfig) {
22998
- const config = decode(dataform.GenerateIndexConfig, base64EncodedConfig);
23413
+ const config = decode64(dataform.GenerateIndexConfig, base64EncodedConfig);
22999
23414
  const includeRequires = config.includePaths
23000
23415
  .map(path => {
23001
23416
  return `
@@ -23013,20 +23428,6 @@ function genIndex(base64EncodedConfig) {
23013
23428
  })
23014
23429
  .join("\n");
23015
23430
  const projectOverridesJsonString = JSON.stringify(dataform.ProjectConfig.create(config.compileConfig.projectConfigOverride).toJSON());
23016
- const escapedQuery = config.compileConfig.query
23017
- .replace(/\\/g, "\\\\")
23018
- .replace(/`/g, "\\`")
23019
- .replace(/\${/g, "\\${");
23020
- const returnValue = config.compileConfig.compileSingleQuery
23021
- ? `(function() {
23022
- try {
23023
- const compiled = require("@dataform/core").compileStandaloneSqlxQuery(\`${escapedQuery}\`);
23024
- return new Function(compiled)();
23025
- } catch (e) {
23026
- return e.message;
23027
- }
23028
- })()`
23029
- : "base64EncodedGraphBytes";
23030
23431
  return `
23031
23432
  // Read the project config.
23032
23433
  const originalProjectConfig = require("./dataform.json");
@@ -23066,8 +23467,7 @@ global.test = session.test.bind(session);
23066
23467
  ${definitionRequires}
23067
23468
 
23068
23469
  // Return a base64 encoded proto via NodeVM. Returning a Uint8Array directly causes issues.
23069
- const base64EncodedGraphBytes = session.compileToBase64();
23070
- return ${returnValue};`;
23470
+ return session.compileToBase64();`;
23071
23471
  }
23072
23472
 
23073
23473
  class JSONObjectStringifier {
@@ -23330,7 +23730,7 @@ class RefReplacingContext {
23330
23730
  }
23331
23731
  }
23332
23732
 
23333
- const version = "1.18.0";
23733
+ const version = "1.20.2";
23334
23734
 
23335
23735
  const SQL_DATA_WAREHOUSE_DIST_HASH_REGEXP = new RegExp("HASH\\s*\\(\\s*\\w*\\s*\\)\\s*");
23336
23736
  const DEFAULT_CONFIG = {
@@ -23537,11 +23937,11 @@ class Session {
23537
23937
  compile() {
23538
23938
  const compiledGraph = dataform.CompiledGraph.create({
23539
23939
  projectConfig: this.config,
23540
- tables: this.compileGraphChunk(this.actions.filter(action => action instanceof Table)),
23541
- operations: this.compileGraphChunk(this.actions.filter(action => action instanceof Operation)),
23542
- assertions: this.compileGraphChunk(this.actions.filter(action => action instanceof Assertion)),
23543
- declarations: this.compileGraphChunk(this.actions.filter(action => action instanceof Declaration)),
23544
- tests: this.compileGraphChunk(Object.values(this.tests)),
23940
+ tables: this.compileGraphChunk(this.actions.filter(action => action instanceof Table), dataform.Table.verify),
23941
+ operations: this.compileGraphChunk(this.actions.filter(action => action instanceof Operation), dataform.Operation.verify),
23942
+ assertions: this.compileGraphChunk(this.actions.filter(action => action instanceof Assertion), dataform.Assertion.verify),
23943
+ declarations: this.compileGraphChunk(this.actions.filter(action => action instanceof Declaration), dataform.Declaration.verify),
23944
+ tests: this.compileGraphChunk(Object.values(this.tests), dataform.Test.verify),
23545
23945
  graphErrors: this.graphErrors,
23546
23946
  dataformCoreVersion: version,
23547
23947
  targets: this.actions.map(action => action.proto.target)
@@ -23557,10 +23957,11 @@ class Session {
23557
23957
  if (this.config.useRunCache) {
23558
23958
  this.checkRunCachingCorrectness([].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations.filter(operation => operation.hasOutput)));
23559
23959
  }
23960
+ throwIfInvalid(compiledGraph, dataform.CompiledGraph.verify);
23560
23961
  return compiledGraph;
23561
23962
  }
23562
23963
  compileToBase64() {
23563
- return encode(dataform.CompiledGraph, this.compile());
23964
+ return encode64(dataform.CompiledGraph, this.compile());
23564
23965
  }
23565
23966
  findActions(target) {
23566
23967
  const adapter = this.adapter();
@@ -23585,11 +23986,12 @@ class Session {
23585
23986
  getTablePrefixWithUnderscore() {
23586
23987
  return !!this.config.tablePrefix ? `${this.config.tablePrefix}_` : "";
23587
23988
  }
23588
- compileGraphChunk(actions) {
23989
+ compileGraphChunk(actions, verify) {
23589
23990
  const compiledChunks = [];
23590
23991
  actions.forEach(action => {
23591
23992
  try {
23592
23993
  const compiledChunk = action.compile();
23994
+ throwIfInvalid(compiledChunk, verify);
23593
23995
  compiledChunks.push(compiledChunk);
23594
23996
  }
23595
23997
  catch (e) {
@@ -23636,11 +24038,17 @@ class Session {
23636
24038
  action.target = newTargetByOriginalTarget.get(action.target);
23637
24039
  action.name = targetToName(action.target);
23638
24040
  });
24041
+ const getUpdatedTarget = (originalTarget) => {
24042
+ if (!newTargetByOriginalTarget.has(originalTarget)) {
24043
+ return originalTarget;
24044
+ }
24045
+ return newTargetByOriginalTarget.get(originalTarget);
24046
+ };
23639
24047
  actions.forEach(action => {
23640
- action.dependencyTargets = (action.dependencyTargets || []).map(dependencyTarget => newTargetByOriginalTarget.get(dependencyTarget));
24048
+ action.dependencyTargets = (action.dependencyTargets || []).map(getUpdatedTarget);
23641
24049
  action.dependencies = (action.dependencyTargets || []).map(dependencyTarget => targetToName(dependencyTarget));
23642
24050
  if (!!action.parentAction) {
23643
- action.parentAction = newTargetByOriginalTarget.get(action.parentAction);
24051
+ action.parentAction = getUpdatedTarget(action.parentAction);
23644
24052
  }
23645
24053
  });
23646
24054
  }
@@ -23803,11 +24211,58 @@ function objectExistsOrIsNonEmpty(prop) {
23803
24211
  typeof prop !== "object");
23804
24212
  }
23805
24213
 
24214
+ function main(encodedCoreExecutionConfig) {
24215
+ var _a;
24216
+ const globalAny = global;
24217
+ const config = decode64(dataform.CoreExecutionConfig, encodedCoreExecutionConfig);
24218
+ const originalProjectConfig = require("dataform.json");
24219
+ const projectConfigOverride = (_a = config.compileConfig.projectConfigOverride) !== null && _a !== void 0 ? _a : {};
24220
+ if (!originalProjectConfig.defaultDatabase) {
24221
+ originalProjectConfig.defaultDatabase = originalProjectConfig.gcloudProjectId;
24222
+ }
24223
+ delete originalProjectConfig.gcloudProjectId;
24224
+ let projectConfig = Object.assign({}, originalProjectConfig);
24225
+ projectConfig.schemaSuffix =
24226
+ config.compileConfig.schemaSuffixOverride || projectConfig.schemaSuffix;
24227
+ projectConfig = Object.assign(Object.assign(Object.assign({}, projectConfig), projectConfigOverride), { vars: Object.assign(Object.assign({}, projectConfig.vars), projectConfigOverride.vars) });
24228
+ const session = require("@dataform/core").session;
24229
+ session.init(config.compileConfig.projectDir, projectConfig, originalProjectConfig);
24230
+ globalAny.dataform = session;
24231
+ config.compileConfig.filePaths
24232
+ .filter(path => path.startsWith("includes/"))
24233
+ .filter(path => path.endsWith(".js"))
24234
+ .forEach(includePath => {
24235
+ try {
24236
+ globalAny[baseFilename(includePath)] = require(includePath);
24237
+ }
24238
+ catch (e) {
24239
+ session.compileError(e, includePath);
24240
+ }
24241
+ });
24242
+ globalAny.publish = session.publish.bind(session);
24243
+ globalAny.operate = session.operate.bind(session);
24244
+ globalAny.assert = session.assert.bind(session);
24245
+ globalAny.declare = session.declare.bind(session);
24246
+ globalAny.test = session.test.bind(session);
24247
+ config.compileConfig.filePaths
24248
+ .filter(path => path.startsWith("definitions/"))
24249
+ .filter(path => path.endsWith(".js") || path.endsWith(".sqlx"))
24250
+ .forEach(definitionPath => {
24251
+ try {
24252
+ require(definitionPath);
24253
+ }
24254
+ catch (e) {
24255
+ session.compileError(e, definitionPath);
24256
+ }
24257
+ });
24258
+ return encode64(dataform.CoreExecutionResult, dataform.CoreExecutionResult.create({ compiledGraph: session.compile() }));
24259
+ }
24260
+
23806
24261
  const indexFileGenerator = genIndex;
23807
24262
  const compiler = compile;
23808
24263
  function globalSession() {
23809
24264
  if (!global._DF_SESSION) {
23810
- global._DF_SESSION = new Session(process.cwd());
24265
+ global._DF_SESSION = new Session();
23811
24266
  }
23812
24267
  return global._DF_SESSION;
23813
24268
  }
@@ -23818,4 +24273,5 @@ exports.adapters = index;
23818
24273
  exports.compileStandaloneSqlxQuery = compileStandaloneSqlxQuery$1;
23819
24274
  exports.compiler = compiler;
23820
24275
  exports.indexFileGenerator = indexFileGenerator;
24276
+ exports.main = main;
23821
24277
  exports.session = session;
package/package.json CHANGED
@@ -3,7 +3,15 @@
3
3
  "protobufjs": "6.8.8",
4
4
  "tarjan-graph": "^2.0.0",
5
5
  "semver": "^5.6.0",
6
- "moo": "^0.5.0"
6
+ "moo": "^0.5.0",
7
+ "long": "^4.0.0"
8
+ },
9
+ "resolutions": {
10
+ "**/object-path": "^0.11.5",
11
+ "**/http-proxy": "^1.18.1",
12
+ "**/serialize-javascript": "^3.1.0",
13
+ "webpack/**/acorn": "^5.7.4",
14
+ "**/lodash": "^4.17.21"
7
15
  },
8
16
  "homepage": "https://github.com/dataform-co/dataform",
9
17
  "license": "MIT",
@@ -21,7 +29,7 @@
21
29
  "publishConfig": {
22
30
  "access": "public"
23
31
  },
24
- "version": "1.18.0",
32
+ "version": "1.20.2",
25
33
  "name": "@dataform/core",
26
34
  "description": "Dataform core API.",
27
35
  "main": "bundle.js",