Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public assert(name: string, query?: AContextable): Assertion {
const assertion = new Assertion();
assertion.session = this;
utils.setNameAndTarget(this, assertion.proto, name, this.config.assertionSchema);
if (query) {
assertion.query(query);
}
assertion.proto.fileName = utils.getCallerFile(this.rootDir);
this.actions.push(assertion);
return assertion;
}
public publish(
name: string,
queryOrConfig?: table.TContextable | table.TConfig
): table.Table {
const newTable = new table.Table();
newTable.session = this;
utils.setNameAndTarget(this, newTable.proto, name);
if (!!queryOrConfig) {
if (typeof queryOrConfig === "object") {
newTable.config(queryOrConfig);
} else {
newTable.query(queryOrConfig);
}
}
newTable.proto.fileName = utils.getCallerFile(this.rootDir);
this.actions.push(newTable);
return newTable;
}
public declare(dataset: dataform.ITarget): Declaration {
const declaration = new Declaration();
declaration.session = this;
utils.setNameAndTarget(this, declaration.proto, dataset.name, dataset.schema, dataset.database);
declaration.proto.fileName = utils.getCallerFile(this.rootDir);
this.actions.push(declaration);
return declaration;
}
public operate(name: string, queries?: OContextable): Operation {
const operation = new Operation();
operation.session = this;
utils.setNameAndTarget(this, operation.proto, name);
if (queries) {
operation.queries(queries);
}
operation.proto.fileName = utils.getCallerFile(this.rootDir);
this.actions.push(operation);
return operation;
}