@dataform/core 2.0.0-beta.0 → 2.0.1

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 +1 -2
  2. package/bundle.js +34 -24
  3. package/package.json +11 -4
package/bundle.d.ts CHANGED
@@ -8477,12 +8477,11 @@ declare class Session {
8477
8477
  private compileGraphChunk;
8478
8478
  private fullyQualifyDependencies;
8479
8479
  private alterActionName;
8480
- private checkActionNameUniqueness;
8481
- private checkCanonicalTargetUniqueness;
8482
8480
  private checkTableConfigValidity;
8483
8481
  private checkTestNameUniqueness;
8484
8482
  private checkCircularity;
8485
8483
  private checkRunCachingCorrectness;
8484
+ private removeNonUniqueActionsFromCompiledGraph;
8486
8485
  }
8487
8486
  declare class ActionIndex {
8488
8487
  private readonly adapter;
package/bundle.js CHANGED
@@ -23742,7 +23742,7 @@ class RefReplacingContext {
23742
23742
  }
23743
23743
  }
23744
23744
 
23745
- const version = "2.0.0-beta.0";
23745
+ const version = "2.0.1";
23746
23746
 
23747
23747
  const SQL_DATA_WAREHOUSE_DIST_HASH_REGEXP = new RegExp("HASH\\s*\\(\\s*\\w*\\s*\\)\\s*");
23748
23748
  const DEFAULT_CONFIG = {
@@ -23950,7 +23950,7 @@ class Session {
23950
23950
  compile() {
23951
23951
  this.indexedActions = new ActionIndex(this.adapter(), this.actions);
23952
23952
  if (this.config.warehouse === "bigquery" && !this.config.defaultLocation) {
23953
- this.compileError("A defaultLocation is required for BigQuery. This can be configured in dataform.json.");
23953
+ this.compileError("A defaultLocation is required for BigQuery. This can be configured in dataform.json.", "dataform.json");
23954
23954
  }
23955
23955
  const compiledGraph = dataform.CompiledGraph.create({
23956
23956
  projectConfig: this.config,
@@ -23965,10 +23965,8 @@ class Session {
23965
23965
  });
23966
23966
  this.fullyQualifyDependencies([].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations));
23967
23967
  this.alterActionName([].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations), [].concat(compiledGraph.declarations.map(declaration => declaration.target)));
23968
- const standardActions = [].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations, compiledGraph.declarations);
23969
- this.checkActionNameUniqueness(standardActions);
23968
+ this.removeNonUniqueActionsFromCompiledGraph(compiledGraph);
23970
23969
  this.checkTestNameUniqueness(compiledGraph.tests);
23971
- this.checkCanonicalTargetUniqueness(standardActions);
23972
23970
  this.checkTableConfigValidity(compiledGraph.tables);
23973
23971
  this.checkCircularity([].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations));
23974
23972
  if (this.config.useRunCache) {
@@ -24052,25 +24050,6 @@ class Session {
24052
24050
  }
24053
24051
  });
24054
24052
  }
24055
- checkActionNameUniqueness(actions) {
24056
- const allNames = [];
24057
- actions.forEach(action => {
24058
- const name = targetAsReadableString(action.target);
24059
- if (allNames.includes(name)) {
24060
- this.compileError(new Error(`Duplicate action name detected. Names within a schema must be unique across tables, declarations, assertions, and operations`), action.fileName, action.target);
24061
- }
24062
- allNames.push(name);
24063
- });
24064
- }
24065
- checkCanonicalTargetUniqueness(actions) {
24066
- const allCanonicalTargets = new StringifiedSet(targetStringifier);
24067
- actions.forEach(action => {
24068
- if (allCanonicalTargets.has(action.canonicalTarget)) {
24069
- this.compileError(new Error(`Duplicate canonical target detected. Canonical targets must be unique across tables, declarations, assertions, and operations:\n"${JSON.stringify(action.canonicalTarget)}"`), action.fileName, action.target);
24070
- }
24071
- allCanonicalTargets.add(action.canonicalTarget);
24072
- });
24073
- }
24074
24053
  checkTableConfigValidity(tables) {
24075
24054
  tables.forEach(table => {
24076
24055
  var _a, _b;
@@ -24206,6 +24185,37 @@ class Session {
24206
24185
  this.compileError(new Error("Zero-dependency actions which create datasets are required to explicitly declare 'hermetic: (true|false)' when run caching is turned on."), action.fileName, action.target);
24207
24186
  });
24208
24187
  }
24188
+ removeNonUniqueActionsFromCompiledGraph(compiledGraph) {
24189
+ function getNonUniqueTargets(targets) {
24190
+ const allTargets = new StringifiedSet(targetStringifier);
24191
+ const nonUniqueTargets = new StringifiedSet(targetStringifier);
24192
+ targets.forEach(target => {
24193
+ if (allTargets.has(target)) {
24194
+ nonUniqueTargets.add(target);
24195
+ }
24196
+ allTargets.add(target);
24197
+ });
24198
+ return nonUniqueTargets;
24199
+ }
24200
+ const actions = [].concat(compiledGraph.tables, compiledGraph.assertions, compiledGraph.operations, compiledGraph.declarations);
24201
+ const nonUniqueActionsTargets = getNonUniqueTargets(actions.map(action => action.target));
24202
+ const nonUniqueActionsCanonicalTargets = getNonUniqueTargets(actions.map(action => action.canonicalTarget));
24203
+ const isUniqueAction = (action) => {
24204
+ const isNonUniqueTarget = nonUniqueActionsTargets.has(action.target);
24205
+ const isNonUniqueCanonicalTarget = nonUniqueActionsCanonicalTargets.has(action.canonicalTarget);
24206
+ if (isNonUniqueTarget) {
24207
+ this.compileError(new Error(`Duplicate action name detected. Names within a schema must be unique across tables, declarations, assertions, and operations`), action.fileName, action.target);
24208
+ }
24209
+ if (isNonUniqueCanonicalTarget) {
24210
+ this.compileError(new Error(`Duplicate canonical target detected. Canonical targets must be unique across tables, declarations, assertions, and operations:\n"${JSON.stringify(action.canonicalTarget)}"`), action.fileName, action.target);
24211
+ }
24212
+ return !isNonUniqueTarget && !isNonUniqueCanonicalTarget;
24213
+ };
24214
+ compiledGraph.tables = compiledGraph.tables.filter(isUniqueAction);
24215
+ compiledGraph.operations = compiledGraph.operations.filter(isUniqueAction);
24216
+ compiledGraph.declarations = compiledGraph.declarations.filter(isUniqueAction);
24217
+ compiledGraph.assertions = compiledGraph.assertions.filter(isUniqueAction);
24218
+ }
24209
24219
  }
24210
24220
  function definesDataset(type) {
24211
24221
  return type === "view" || type === "table" || type === "inline" || type === "incremental";
package/package.json CHANGED
@@ -16,8 +16,8 @@
16
16
  "**/postcss": "^8.2.10",
17
17
  "**/browserslist": "^4.16.5",
18
18
  "**/glob-parent": "^5.1.2",
19
- "**/marked": "^2.0.0",
20
- "**/node-forge": "^0.10.0",
19
+ "**/marked": "^4.0.10",
20
+ "**/node-forge": "^1.0.0",
21
21
  "**/json-bigint": "^1.0.0",
22
22
  "**/y18n": "^5.0.5",
23
23
  "**/underscore": "^1.12.1",
@@ -25,7 +25,14 @@
25
25
  "**/dns-packet": "^1.3.2",
26
26
  "**/prismjs": "^1.24.0",
27
27
  "**/url-parse": "^1.5.2",
28
- "**/handlebars": "^4.7.7"
28
+ "**/handlebars": "^4.7.7",
29
+ "**/protobufjs": "^7.0.0",
30
+ "**/ansi-regex": "^3.0.1",
31
+ "**/ansi-html": "^0.0.8",
32
+ "**/json-schema": "^0.4.0",
33
+ "**/nth-check": "^2.0.1",
34
+ "**/node-fetch": "^2.6.7",
35
+ "**/markdown-it": "^12.3.2"
29
36
  },
30
37
  "homepage": "https://github.com/dataform-co/dataform",
31
38
  "license": "MIT",
@@ -43,7 +50,7 @@
43
50
  "publishConfig": {
44
51
  "access": "public"
45
52
  },
46
- "version": "2.0.0-beta.0",
53
+ "version": "2.0.1",
47
54
  "name": "@dataform/core",
48
55
  "description": "Dataform core API.",
49
56
  "main": "bundle.js",