@dataform/assertion_utils
Advanced tools
Comparing version 1.6.12 to 1.6.13
@@ -1,2 +0,1 @@ | ||
/// <amd-module name="df/packages/@dataform/assertion_utils/index" /> | ||
export declare function forDataset(dataset: string): DatasetAssertion; | ||
@@ -3,0 +2,0 @@ export declare class DatasetAssertion { |
58
index.js
@@ -1,27 +0,18 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function forDataset(dataset) { | ||
return new DatasetAssertion(dataset); | ||
} | ||
exports.forDataset = forDataset; | ||
class DatasetAssertion { | ||
constructor(dataset) { | ||
this.groupCols = []; | ||
this.dataset = dataset; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define("df/packages/@dataform/assertion_utils/index", ["require", "exports"], factory); | ||
groupedBy(cols) { | ||
this.groupCols = typeof cols === "string" ? [cols] : cols; | ||
return this; | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function forDataset(dataset) { | ||
return new DatasetAssertion(dataset); | ||
} | ||
exports.forDataset = forDataset; | ||
class DatasetAssertion { | ||
constructor(dataset) { | ||
this.groupCols = []; | ||
this.dataset = dataset; | ||
} | ||
groupedBy(cols) { | ||
this.groupCols = typeof cols === "string" ? [cols] : cols; | ||
return this; | ||
} | ||
getUniqueRowQuery() { | ||
return ` | ||
getUniqueRowQuery() { | ||
return ` | ||
WITH base AS ( | ||
@@ -44,5 +35,5 @@ | ||
`; | ||
} | ||
getNotNullQuery(field) { | ||
return ` | ||
} | ||
getNotNullQuery(field) { | ||
return ` | ||
SELECT | ||
@@ -54,5 +45,5 @@ * | ||
`; | ||
} | ||
getAcceptedValuesQuery(field, acceptedValues) { | ||
return ` | ||
} | ||
getAcceptedValuesQuery(field, acceptedValues) { | ||
return ` | ||
SELECT | ||
@@ -64,6 +55,5 @@ * | ||
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uICBcbiAgICBTRUxFQ1RcbiAgICAgICpcbiAgICBGUk9NXG4gICAgICBiYXNlXG4gICAgV0hFUkVcbiAgICAgIHJvd19jb3VudCA+IDFcbiAgICBgO1xuICB9XG5cbiAgcHVibGljIGdldE5vdE51bGxRdWVyeShmaWVsZDogc3RyaW5nKTogc3RyaW5nIHtcbiAgICByZXR1cm4gYFxuICAgIFNFTEVDVFxuICAgICAgKlxuICAgIEZST00gJHt0aGlzLmRhdGFzZXR9XG4gICAgV0hFUkVcbiAgICAgICR7ZmllbGR9IElTIE5VTExcbiAgICBgXG4gIH1cblxuICBwdWJsaWMgZ2V0QWNjZXB0ZWRWYWx1ZXNRdWVyeShmaWVsZDogc3RyaW5nLCBhY2NlcHRlZFZhbHVlczogc3RyaW5nIHwgc3RyaW5nW10pOiBzdHJpbmcge1xuICAgIHJldHVybiBgXG4gICAgU0VMRUNUXG4gICAgICAqXG4gICAgRlJPTSAke3RoaXMuZGF0YXNldH1cbiAgICBXSEVSRVxuICAgICAgJHtmaWVsZH0gTk9UIElOICR7YWNjZXB0ZWRWYWx1ZXN9XG4gICAgYFxuICB9XG59XG4iXX0= | ||
} | ||
exports.DatasetAssertion = DatasetAssertion; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZGF0YWZvcm0vYXNzZXJ0aW9uX3V0aWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsU0FBZ0IsVUFBVSxDQUFDLE9BQWU7SUFDeEMsT0FBTyxJQUFJLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3ZDLENBQUM7QUFGRCxnQ0FFQztBQUVELE1BQWEsZ0JBQWdCO0lBRzNCLFlBQVksT0FBZTtRQURuQixjQUFTLEdBQWEsRUFBRS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AqXG4gICAgRlJPTSAke3RoaXMuZGF0YXNldH1cbiAgICBXSEVSRVxuICAgICAgJHtmaWVsZH0gTk9UIElOICR7YWNjZXB0ZWRWYWx1ZXN9XG4gICAgYFxuICB9XG59XG4iXX0= |
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "1.6.12", | ||
"version": "1.6.13", | ||
"name": "@dataform/assertion_utils", | ||
@@ -22,0 +22,0 @@ "description": "Assertion utilities for Dataform.", |
4788
63