@dataform/core
Advanced tools
Comparing version 0.0.2-alpha.11 to 0.0.2-alpha.12
import * as protos from "@dataform/protos"; | ||
import * as adapters from "./adapters"; | ||
import { Materialization, MContextable } from "./materialization"; | ||
import { Materialization, MContextable, MConfig } from "./materialization"; | ||
import { Operation, OContextable } from "./operation"; | ||
@@ -24,5 +24,5 @@ import { Assertion, AContextable } from "./assertion"; | ||
operate(name: string, statement?: OContextable<string | string[]>): Operation; | ||
materialize(name: string, query?: MContextable<string>): Materialization; | ||
materialize(name: string, queryOrConfig?: MContextable<string> | MConfig): Materialization; | ||
assert(name: string, query?: AContextable<string | string[]>): Assertion; | ||
compile(): protos.CompiledGraph; | ||
} |
@@ -48,3 +48,3 @@ "use strict"; | ||
} | ||
materialize(name, query) { | ||
materialize(name, queryOrConfig) { | ||
var materialization = new materialization_1.Materialization(); | ||
@@ -54,4 +54,9 @@ materialization.dataform = this; | ||
materialization.proto.target = this.target(name); | ||
if (query) { | ||
materialization.query(query); | ||
if (!!queryOrConfig) { | ||
if (typeof (queryOrConfig) === "object") { | ||
materialization.config(queryOrConfig); | ||
} | ||
else { | ||
materialization.query(queryOrConfig); | ||
} | ||
} | ||
@@ -58,0 +63,0 @@ materialization.proto.fileName = utils.getCallerFile(Dataform.ROOT_DIR); |
import * as protos from "@dataform/protos"; | ||
import { Dataform } from "./dataform"; | ||
import { Materialization, MContextable } from "./materialization"; | ||
import { Materialization, MaterializationContext, MConfig } from "./materialization"; | ||
import { Operation, OContextable } from "./operation"; | ||
@@ -9,4 +9,4 @@ import { Assertion, AContextable } from "./assertion"; | ||
import * as parser from "./parser"; | ||
export { adapters, utils, parser, Dataform, Materialization, Operation, Assertion }; | ||
export declare const materialize: (name: string, query?: MContextable<string>) => Materialization; | ||
export { adapters, utils, parser, Dataform, Materialization, MaterializationContext, MConfig, Operation, Assertion }; | ||
export declare const materialize: (name: string, queryOrConfig?: string | MConfig | ((ctx: MaterializationContext) => string)) => Materialization; | ||
export declare const operate: (name: string, statement?: OContextable<string | string[]>) => Operation; | ||
@@ -13,0 +13,0 @@ export declare const assert: (name: string, query?: AContextable<string | string[]>) => Assertion; |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.Materialization = materialization_1.Materialization; | ||
exports.MaterializationContext = materialization_1.MaterializationContext; | ||
const operation_1 = require("./operation"); | ||
@@ -39,3 +40,3 @@ exports.Operation = operation_1.Operation; | ||
const singleton = new dataform_1.Dataform(); | ||
exports.materialize = (name, query) => singleton.materialize(name, query); | ||
exports.materialize = (name, queryOrConfig) => singleton.materialize(name, queryOrConfig); | ||
exports.operate = (name, statement) => singleton.operate(name, statement); | ||
@@ -42,0 +43,0 @@ exports.assert = (name, query) => singleton.assert(name, query); |
@@ -43,2 +43,3 @@ import { Dataform } from "./index"; | ||
constructor(materialization: Materialization); | ||
config(config: MConfig): string; | ||
self(): string; | ||
@@ -45,0 +46,0 @@ ref(name: string): string; |
@@ -126,2 +126,6 @@ "use strict"; | ||
} | ||
config(config) { | ||
this.materialization.config(config); | ||
return ""; | ||
} | ||
self() { | ||
@@ -128,0 +132,0 @@ return this.materialization.dataform |
@@ -24,2 +24,3 @@ "use strict"; | ||
materialize("${baseFilename(path)}").query(ctx => { | ||
const config = ctx.config.bind(ctx); | ||
const type = ctx.type.bind(ctx); | ||
@@ -34,2 +35,4 @@ const post = ctx.post.bind(ctx); | ||
const assert = ctx.assert.bind(ctx); | ||
const schema = ctx.schema.bind(ctx); | ||
const describe = ctx.describe.bind(ctx); | ||
return \`${code}\`; | ||
@@ -36,0 +39,0 @@ })`; |
@@ -5,3 +5,3 @@ import * as protos from "@dataform/protos"; | ||
import * as parser from "./parser"; | ||
import { Materialization, MContextable } from "./materialization"; | ||
import { Materialization, MContextable, MConfig } from "./materialization"; | ||
import { Operation, OContextable } from "./operation"; | ||
@@ -71,3 +71,3 @@ import { Assertion, AContextable } from "./assertion"; | ||
materialize(name: string, query?: MContextable<string>): Materialization { | ||
materialize(name: string, queryOrConfig?: MContextable<string> | MConfig): Materialization { | ||
var materialization = new Materialization(); | ||
@@ -77,4 +77,8 @@ materialization.dataform = this; | ||
materialization.proto.target = this.target(name); | ||
if (query) { | ||
materialization.query(query); | ||
if (!!queryOrConfig) { | ||
if (typeof(queryOrConfig) === "object") { | ||
materialization.config(queryOrConfig); | ||
} else { | ||
materialization.query(queryOrConfig); | ||
} | ||
} | ||
@@ -81,0 +85,0 @@ materialization.proto.fileName = utils.getCallerFile(Dataform.ROOT_DIR); |
import * as protos from "@dataform/protos"; | ||
import { Dataform } from "./dataform"; | ||
import { Materialization, MContextable } from "./materialization"; | ||
import { Materialization, MaterializationContext, MContextable, MConfig } from "./materialization"; | ||
import { Operation, OContextable } from "./operation"; | ||
@@ -21,2 +21,4 @@ import { Assertion, AContextable } from "./assertion"; | ||
Materialization, | ||
MaterializationContext, | ||
MConfig, | ||
Operation, | ||
@@ -51,4 +53,4 @@ Assertion | ||
export const materialize = (name: string, query?: MContextable<string>) => | ||
singleton.materialize(name, query); | ||
export const materialize = (name: string, queryOrConfig?: MContextable<string> | MConfig) => | ||
singleton.materialize(name, queryOrConfig); | ||
export const operate = ( | ||
@@ -55,0 +57,0 @@ name: string, |
@@ -177,2 +177,6 @@ import { Dataform } from "./index"; | ||
public config(config: MConfig) { | ||
this.materialization.config(config); | ||
return ""; | ||
} | ||
public self(): string { | ||
@@ -179,0 +183,0 @@ return this.materialization.dataform |
{ | ||
"name": "@dataform/core", | ||
"version": "0.0.2-alpha.11", | ||
"version": "0.0.2-alpha.12", | ||
"description": "Dataform core API.", | ||
@@ -8,3 +8,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@dataform/protos": "^0.0.2-alpha.11", | ||
"@dataform/protos": "^0.0.2-alpha.12", | ||
"protobufjs": "^6.8.8" | ||
@@ -15,3 +15,3 @@ }, | ||
}, | ||
"gitHead": "0f9110759c0f226d79970f3e5dca493807155914" | ||
"gitHead": "cfe5c32fba15d9af1f76560599d1802d74a97cd3" | ||
} |
@@ -21,2 +21,3 @@ export function relativePath(path: string, base: string) { | ||
materialize("${baseFilename(path)}").query(ctx => { | ||
const config = ctx.config.bind(ctx); | ||
const type = ctx.type.bind(ctx); | ||
@@ -31,2 +32,4 @@ const post = ctx.post.bind(ctx); | ||
const assert = ctx.assert.bind(ctx); | ||
const schema = ctx.schema.bind(ctx); | ||
const describe = ctx.describe.bind(ctx); | ||
return \`${code}\`; | ||
@@ -33,0 +36,0 @@ })`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
403284
7677