@hidden
(session?: Session, unverifiedConfig?: any, configPath?: string)
| 124 | |
| 125 | /** @hidden */ |
| 126 | constructor(session?: Session, unverifiedConfig?: any, configPath?: string) { |
| 127 | super(session); |
| 128 | this.session = session; |
| 129 | this.configPath = configPath; |
| 130 | // A copy is used here to prevent manipulation of the original. |
| 131 | this.unverifiedConfig = Object.assign({}, unverifiedConfig); |
| 132 | |
| 133 | if (!unverifiedConfig) { |
| 134 | return; |
| 135 | } |
| 136 | const config = this.verifyConfig(unverifiedConfig); |
| 137 | |
| 138 | if (!config.name) { |
| 139 | config.name = Path.basename(config.filename); |
| 140 | } |
| 141 | const target = actionConfigToCompiledGraphTarget(config); |
| 142 | this.proto.target = this.applySessionToTarget(target, session.projectConfig, config.filename, { |
| 143 | validateTarget: true |
| 144 | }); |
| 145 | this.proto.canonicalTarget = this.applySessionToTarget(target, session.canonicalProjectConfig); |
| 146 | |
| 147 | if (configPath) { |
| 148 | config.filename = resolveActionsConfigFilename(config.filename, configPath); |
| 149 | this.query(nativeRequire(config.filename).query); |
| 150 | } |
| 151 | if (config.filename) { |
| 152 | this.proto.fileName = config.filename; |
| 153 | } |
| 154 | |
| 155 | if (config.dependOnDependencyAssertions) { |
| 156 | this.setDependOnDependencyAssertions(config.dependOnDependencyAssertions); |
| 157 | } |
| 158 | if (config.dependencyTargets) { |
| 159 | this.dependencies(config.dependencyTargets); |
| 160 | } |
| 161 | if (config.hermetic !== undefined) { |
| 162 | this.hermetic(config.hermetic); |
| 163 | } |
| 164 | if (config.disabled) { |
| 165 | this.disabled(); |
| 166 | } |
| 167 | if (config.tags) { |
| 168 | this.tags(config.tags); |
| 169 | } |
| 170 | if (config.description) { |
| 171 | this.description(config.description); |
| 172 | } |
| 173 | if (config.metadata) { |
| 174 | if (!this.proto.actionDescriptor) { |
| 175 | this.proto.actionDescriptor = {}; |
| 176 | } |
| 177 | this.proto.actionDescriptor.metadata = config.metadata; |
| 178 | } |
| 179 | if (config.columns?.length) { |
| 180 | this.columns( |
| 181 | config.columns.map(columnDescriptor => |
| 182 | dataform.ActionConfig.ColumnDescriptor.create(columnDescriptor) |
| 183 | ) |
nothing calls this directly
no test coverage detected