@@ -11,8 +11,13 @@ import {
11
11
Resolvable
12
12
} from "df/core/common" ;
13
13
import { Session } from "df/core/session" ;
14
- import * as utils from "df/core/utils" ;
15
- import { checkExcessProperties , strictKeysOf } from "df/core/utils" ;
14
+ import {
15
+ checkExcessProperties ,
16
+ resolvableAsTarget ,
17
+ setNameAndTarget ,
18
+ strictKeysOf ,
19
+ toResolvable
20
+ } from "df/core/utils" ;
16
21
import { dataform } from "df/protos/ts" ;
17
22
18
23
/**
@@ -108,7 +113,7 @@ export class Operation {
108
113
public dependencies ( value : Resolvable | Resolvable [ ] ) {
109
114
const newDependencies = Array . isArray ( value ) ? value : [ value ] ;
110
115
newDependencies . forEach ( resolvable => {
111
- this . proto . dependencyTargets . push ( utils . resolvableAsTarget ( resolvable ) ) ;
116
+ this . proto . dependencyTargets . push ( resolvableAsTarget ( resolvable ) ) ;
112
117
} ) ;
113
118
return this ;
114
119
}
@@ -159,7 +164,7 @@ export class Operation {
159
164
}
160
165
161
166
public database ( database : string ) {
162
- utils . setNameAndTarget (
167
+ setNameAndTarget (
163
168
this . session ,
164
169
this . proto ,
165
170
this . proto . target . name ,
@@ -170,17 +175,18 @@ export class Operation {
170
175
}
171
176
172
177
public schema ( schema : string ) {
173
- utils . setNameAndTarget ( this . session , this . proto , this . proto . target . name , schema ) ;
178
+ setNameAndTarget (
179
+ this . session ,
180
+ this . proto ,
181
+ this . proto . target . name ,
182
+ schema ,
183
+ this . proto . target . database
184
+ ) ;
174
185
return this ;
175
186
}
176
187
177
188
public compile ( ) {
178
- if (
179
- this . proto . actionDescriptor &&
180
- this . proto . actionDescriptor . columns &&
181
- this . proto . actionDescriptor . columns . length > 0 &&
182
- ! this . proto . hasOutput
183
- ) {
189
+ if ( this . proto . actionDescriptor ?. columns ?. length > 0 && ! this . proto . hasOutput ) {
184
190
this . session . compileError (
185
191
new Error (
186
192
"Actions of type 'operations' may only describe columns if they specify 'hasOutput: true'."
@@ -217,8 +223,8 @@ export class OperationContext implements ICommonContext {
217
223
}
218
224
219
225
public ref ( ref : Resolvable | string [ ] , ...rest : string [ ] ) {
220
- ref = utils . toResolvable ( ref , rest ) ;
221
- if ( ! utils . resolvableAsTarget ( ref ) ) {
226
+ ref = toResolvable ( ref , rest ) ;
227
+ if ( ! resolvableAsTarget ( ref ) ) {
222
228
const message = `Action name is not specified` ;
223
229
this . operation . session . compileError ( new Error ( message ) ) ;
224
230
return "" ;
@@ -228,7 +234,7 @@ export class OperationContext implements ICommonContext {
228
234
}
229
235
230
236
public resolve ( ref : Resolvable | string [ ] , ...rest : string [ ] ) {
231
- return this . operation . session . resolve ( utils . toResolvable ( ref , rest ) ) ;
237
+ return this . operation . session . resolve ( toResolvable ( ref , rest ) ) ;
232
238
}
233
239
234
240
public dependencies ( name : Resolvable | Resolvable [ ] ) {
0 commit comments