@dataform/cli
Version:
Dataform command line interface.
1,074 lines (1,004 loc) • 1.07 MB
JavaScript
#!/usr/bin/env node
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
var fs = require('fs');
var glob = require('glob');
var path = require('path');
var semver = require('semver');
var vm2 = require('vm2');
var protobufjs = require('protobufjs');
var $protobuf = require('protobufjs/minimal');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
var glob__namespace = /*#__PURE__*/_interopNamespace(glob);
var path__namespace = /*#__PURE__*/_interopNamespace(path);
var semver__namespace = /*#__PURE__*/_interopNamespace(semver);
var $protobuf__namespace = /*#__PURE__*/_interopNamespace($protobuf);
var VerifyProtoErrorBehaviour;
(function (VerifyProtoErrorBehaviour) {
VerifyProtoErrorBehaviour[VerifyProtoErrorBehaviour["DEFAULT"] = 0] = "DEFAULT";
VerifyProtoErrorBehaviour[VerifyProtoErrorBehaviour["SUGGEST_REPORTING_TO_DATAFORM_TEAM"] = 1] = "SUGGEST_REPORTING_TO_DATAFORM_TEAM";
VerifyProtoErrorBehaviour[VerifyProtoErrorBehaviour["SHOW_DOCS_LINK"] = 2] = "SHOW_DOCS_LINK";
})(VerifyProtoErrorBehaviour || (VerifyProtoErrorBehaviour = {}));
function encode64(protoType, value = {}) {
return toBase64(protoType.encode(protoType.create(value)).finish());
}
function toBase64(value) {
return protobufjs.util.base64.encode(value, 0, value.length);
}
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
// Common aliases
const $Reader = $protobuf__namespace.Reader, $Writer = $protobuf__namespace.Writer, $util = $protobuf__namespace.util;
// Exported root namespace
const $root = $protobuf__namespace.roots["default"] || ($protobuf__namespace.roots["default"] = {});
const dataform = $root.dataform = (() => {
/**
* Namespace dataform.
* @exports dataform
* @namespace
*/
const dataform = {};
dataform.WorkflowSettings = (function() {
/**
* Properties of a WorkflowSettings.
* @memberof dataform
* @interface IWorkflowSettings
* @property {string|null} [dataformCoreVersion] WorkflowSettings dataformCoreVersion
* @property {string|null} [defaultProject] WorkflowSettings defaultProject
* @property {string|null} [defaultDataset] WorkflowSettings defaultDataset
* @property {string|null} [defaultLocation] WorkflowSettings defaultLocation
* @property {string|null} [defaultAssertionDataset] WorkflowSettings defaultAssertionDataset
* @property {Object.<string,string>|null} [vars] WorkflowSettings vars
* @property {string|null} [projectSuffix] WorkflowSettings projectSuffix
* @property {string|null} [datasetSuffix] WorkflowSettings datasetSuffix
* @property {string|null} [namePrefix] WorkflowSettings namePrefix
* @property {dataform.INotebookRuntimeOptionsConfig|null} [defaultNotebookRuntimeOptions] WorkflowSettings defaultNotebookRuntimeOptions
* @property {string|null} [builtinAssertionNamePrefix] WorkflowSettings builtinAssertionNamePrefix
*/
/**
* Constructs a new WorkflowSettings.
* @memberof dataform
* @classdesc Represents a WorkflowSettings.
* @implements IWorkflowSettings
* @constructor
* @param {dataform.IWorkflowSettings=} [properties] Properties to set
*/
function WorkflowSettings(properties) {
this.vars = {};
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* WorkflowSettings dataformCoreVersion.
* @member {string} dataformCoreVersion
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.dataformCoreVersion = "";
/**
* WorkflowSettings defaultProject.
* @member {string} defaultProject
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.defaultProject = "";
/**
* WorkflowSettings defaultDataset.
* @member {string} defaultDataset
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.defaultDataset = "";
/**
* WorkflowSettings defaultLocation.
* @member {string} defaultLocation
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.defaultLocation = "";
/**
* WorkflowSettings defaultAssertionDataset.
* @member {string} defaultAssertionDataset
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.defaultAssertionDataset = "";
/**
* WorkflowSettings vars.
* @member {Object.<string,string>} vars
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.vars = $util.emptyObject;
/**
* WorkflowSettings projectSuffix.
* @member {string} projectSuffix
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.projectSuffix = "";
/**
* WorkflowSettings datasetSuffix.
* @member {string} datasetSuffix
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.datasetSuffix = "";
/**
* WorkflowSettings namePrefix.
* @member {string} namePrefix
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.namePrefix = "";
/**
* WorkflowSettings defaultNotebookRuntimeOptions.
* @member {dataform.INotebookRuntimeOptionsConfig|null|undefined} defaultNotebookRuntimeOptions
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.defaultNotebookRuntimeOptions = null;
/**
* WorkflowSettings builtinAssertionNamePrefix.
* @member {string} builtinAssertionNamePrefix
* @memberof dataform.WorkflowSettings
* @instance
*/
WorkflowSettings.prototype.builtinAssertionNamePrefix = "";
/**
* Creates a new WorkflowSettings instance using the specified properties.
* @function create
* @memberof dataform.WorkflowSettings
* @static
* @param {dataform.IWorkflowSettings=} [properties] Properties to set
* @returns {dataform.WorkflowSettings} WorkflowSettings instance
*/
WorkflowSettings.create = function create(properties) {
return new WorkflowSettings(properties);
};
/**
* Encodes the specified WorkflowSettings message. Does not implicitly {@link dataform.WorkflowSettings.verify|verify} messages.
* @function encode
* @memberof dataform.WorkflowSettings
* @static
* @param {dataform.IWorkflowSettings} message WorkflowSettings message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
WorkflowSettings.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.dataformCoreVersion != null && Object.hasOwnProperty.call(message, "dataformCoreVersion"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.dataformCoreVersion);
if (message.defaultProject != null && Object.hasOwnProperty.call(message, "defaultProject"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.defaultProject);
if (message.defaultDataset != null && Object.hasOwnProperty.call(message, "defaultDataset"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultDataset);
if (message.defaultLocation != null && Object.hasOwnProperty.call(message, "defaultLocation"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultLocation);
if (message.defaultAssertionDataset != null && Object.hasOwnProperty.call(message, "defaultAssertionDataset"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.defaultAssertionDataset);
if (message.vars != null && Object.hasOwnProperty.call(message, "vars"))
for (let keys = Object.keys(message.vars), i = 0; i < keys.length; ++i)
writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.vars[keys[i]]).ldelim();
if (message.projectSuffix != null && Object.hasOwnProperty.call(message, "projectSuffix"))
writer.uint32(/* id 7, wireType 2 =*/58).string(message.projectSuffix);
if (message.datasetSuffix != null && Object.hasOwnProperty.call(message, "datasetSuffix"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.datasetSuffix);
if (message.namePrefix != null && Object.hasOwnProperty.call(message, "namePrefix"))
writer.uint32(/* id 9, wireType 2 =*/74).string(message.namePrefix);
if (message.defaultNotebookRuntimeOptions != null && Object.hasOwnProperty.call(message, "defaultNotebookRuntimeOptions"))
$root.dataform.NotebookRuntimeOptionsConfig.encode(message.defaultNotebookRuntimeOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
if (message.builtinAssertionNamePrefix != null && Object.hasOwnProperty.call(message, "builtinAssertionNamePrefix"))
writer.uint32(/* id 11, wireType 2 =*/90).string(message.builtinAssertionNamePrefix);
return writer;
};
/**
* Encodes the specified WorkflowSettings message, length delimited. Does not implicitly {@link dataform.WorkflowSettings.verify|verify} messages.
* @function encodeDelimited
* @memberof dataform.WorkflowSettings
* @static
* @param {dataform.IWorkflowSettings} message WorkflowSettings message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
WorkflowSettings.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a WorkflowSettings message from the specified reader or buffer.
* @function decode
* @memberof dataform.WorkflowSettings
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {dataform.WorkflowSettings} WorkflowSettings
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
WorkflowSettings.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dataform.WorkflowSettings(), key, value;
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.dataformCoreVersion = reader.string();
break;
}
case 2: {
message.defaultProject = reader.string();
break;
}
case 3: {
message.defaultDataset = reader.string();
break;
}
case 4: {
message.defaultLocation = reader.string();
break;
}
case 5: {
message.defaultAssertionDataset = reader.string();
break;
}
case 6: {
if (message.vars === $util.emptyObject)
message.vars = {};
let end2 = reader.uint32() + reader.pos;
key = "";
value = "";
while (reader.pos < end2) {
let tag2 = reader.uint32();
switch (tag2 >>> 3) {
case 1:
key = reader.string();
break;
case 2:
value = reader.string();
break;
default:
reader.skipType(tag2 & 7);
break;
}
}
message.vars[key] = value;
break;
}
case 7: {
message.projectSuffix = reader.string();
break;
}
case 8: {
message.datasetSuffix = reader.string();
break;
}
case 9: {
message.namePrefix = reader.string();
break;
}
case 10: {
message.defaultNotebookRuntimeOptions = $root.dataform.NotebookRuntimeOptionsConfig.decode(reader, reader.uint32());
break;
}
case 11: {
message.builtinAssertionNamePrefix = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a WorkflowSettings message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof dataform.WorkflowSettings
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {dataform.WorkflowSettings} WorkflowSettings
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
WorkflowSettings.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a WorkflowSettings message.
* @function verify
* @memberof dataform.WorkflowSettings
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
WorkflowSettings.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.dataformCoreVersion != null && message.hasOwnProperty("dataformCoreVersion"))
if (!$util.isString(message.dataformCoreVersion))
return "dataformCoreVersion: string expected";
if (message.defaultProject != null && message.hasOwnProperty("defaultProject"))
if (!$util.isString(message.defaultProject))
return "defaultProject: string expected";
if (message.defaultDataset != null && message.hasOwnProperty("defaultDataset"))
if (!$util.isString(message.defaultDataset))
return "defaultDataset: string expected";
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
if (!$util.isString(message.defaultLocation))
return "defaultLocation: string expected";
if (message.defaultAssertionDataset != null && message.hasOwnProperty("defaultAssertionDataset"))
if (!$util.isString(message.defaultAssertionDataset))
return "defaultAssertionDataset: string expected";
if (message.vars != null && message.hasOwnProperty("vars")) {
if (!$util.isObject(message.vars))
return "vars: object expected";
let key = Object.keys(message.vars);
for (let i = 0; i < key.length; ++i)
if (!$util.isString(message.vars[key[i]]))
return "vars: string{k:string} expected";
}
if (message.projectSuffix != null && message.hasOwnProperty("projectSuffix"))
if (!$util.isString(message.projectSuffix))
return "projectSuffix: string expected";
if (message.datasetSuffix != null && message.hasOwnProperty("datasetSuffix"))
if (!$util.isString(message.datasetSuffix))
return "datasetSuffix: string expected";
if (message.namePrefix != null && message.hasOwnProperty("namePrefix"))
if (!$util.isString(message.namePrefix))
return "namePrefix: string expected";
if (message.defaultNotebookRuntimeOptions != null && message.hasOwnProperty("defaultNotebookRuntimeOptions")) {
let error = $root.dataform.NotebookRuntimeOptionsConfig.verify(message.defaultNotebookRuntimeOptions);
if (error)
return "defaultNotebookRuntimeOptions." + error;
}
if (message.builtinAssertionNamePrefix != null && message.hasOwnProperty("builtinAssertionNamePrefix"))
if (!$util.isString(message.builtinAssertionNamePrefix))
return "builtinAssertionNamePrefix: string expected";
return null;
};
/**
* Creates a WorkflowSettings message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof dataform.WorkflowSettings
* @static
* @param {Object.<string,*>} object Plain object
* @returns {dataform.WorkflowSettings} WorkflowSettings
*/
WorkflowSettings.fromObject = function fromObject(object) {
if (object instanceof $root.dataform.WorkflowSettings)
return object;
let message = new $root.dataform.WorkflowSettings();
if (object.dataformCoreVersion != null)
message.dataformCoreVersion = String(object.dataformCoreVersion);
if (object.defaultProject != null)
message.defaultProject = String(object.defaultProject);
if (object.defaultDataset != null)
message.defaultDataset = String(object.defaultDataset);
if (object.defaultLocation != null)
message.defaultLocation = String(object.defaultLocation);
if (object.defaultAssertionDataset != null)
message.defaultAssertionDataset = String(object.defaultAssertionDataset);
if (object.vars) {
if (typeof object.vars !== "object")
throw TypeError(".dataform.WorkflowSettings.vars: object expected");
message.vars = {};
for (let keys = Object.keys(object.vars), i = 0; i < keys.length; ++i)
message.vars[keys[i]] = String(object.vars[keys[i]]);
}
if (object.projectSuffix != null)
message.projectSuffix = String(object.projectSuffix);
if (object.datasetSuffix != null)
message.datasetSuffix = String(object.datasetSuffix);
if (object.namePrefix != null)
message.namePrefix = String(object.namePrefix);
if (object.defaultNotebookRuntimeOptions != null) {
if (typeof object.defaultNotebookRuntimeOptions !== "object")
throw TypeError(".dataform.WorkflowSettings.defaultNotebookRuntimeOptions: object expected");
message.defaultNotebookRuntimeOptions = $root.dataform.NotebookRuntimeOptionsConfig.fromObject(object.defaultNotebookRuntimeOptions);
}
if (object.builtinAssertionNamePrefix != null)
message.builtinAssertionNamePrefix = String(object.builtinAssertionNamePrefix);
return message;
};
/**
* Creates a plain object from a WorkflowSettings message. Also converts values to other types if specified.
* @function toObject
* @memberof dataform.WorkflowSettings
* @static
* @param {dataform.WorkflowSettings} message WorkflowSettings
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
WorkflowSettings.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.objects || options.defaults)
object.vars = {};
if (options.defaults) {
object.dataformCoreVersion = "";
object.defaultProject = "";
object.defaultDataset = "";
object.defaultLocation = "";
object.defaultAssertionDataset = "";
object.projectSuffix = "";
object.datasetSuffix = "";
object.namePrefix = "";
object.defaultNotebookRuntimeOptions = null;
object.builtinAssertionNamePrefix = "";
}
if (message.dataformCoreVersion != null && message.hasOwnProperty("dataformCoreVersion"))
object.dataformCoreVersion = message.dataformCoreVersion;
if (message.defaultProject != null && message.hasOwnProperty("defaultProject"))
object.defaultProject = message.defaultProject;
if (message.defaultDataset != null && message.hasOwnProperty("defaultDataset"))
object.defaultDataset = message.defaultDataset;
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
object.defaultLocation = message.defaultLocation;
if (message.defaultAssertionDataset != null && message.hasOwnProperty("defaultAssertionDataset"))
object.defaultAssertionDataset = message.defaultAssertionDataset;
let keys2;
if (message.vars && (keys2 = Object.keys(message.vars)).length) {
object.vars = {};
for (let j = 0; j < keys2.length; ++j)
object.vars[keys2[j]] = message.vars[keys2[j]];
}
if (message.projectSuffix != null && message.hasOwnProperty("projectSuffix"))
object.projectSuffix = message.projectSuffix;
if (message.datasetSuffix != null && message.hasOwnProperty("datasetSuffix"))
object.datasetSuffix = message.datasetSuffix;
if (message.namePrefix != null && message.hasOwnProperty("namePrefix"))
object.namePrefix = message.namePrefix;
if (message.defaultNotebookRuntimeOptions != null && message.hasOwnProperty("defaultNotebookRuntimeOptions"))
object.defaultNotebookRuntimeOptions = $root.dataform.NotebookRuntimeOptionsConfig.toObject(message.defaultNotebookRuntimeOptions, options);
if (message.builtinAssertionNamePrefix != null && message.hasOwnProperty("builtinAssertionNamePrefix"))
object.builtinAssertionNamePrefix = message.builtinAssertionNamePrefix;
return object;
};
/**
* Converts this WorkflowSettings to JSON.
* @function toJSON
* @memberof dataform.WorkflowSettings
* @instance
* @returns {Object.<string,*>} JSON object
*/
WorkflowSettings.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
};
/**
* Gets the default type url for WorkflowSettings
* @function getTypeUrl
* @memberof dataform.WorkflowSettings
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
WorkflowSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/dataform.WorkflowSettings";
};
return WorkflowSettings;
})();
dataform.ActionConfigs = (function() {
/**
* Properties of an ActionConfigs.
* @memberof dataform
* @interface IActionConfigs
* @property {Array.<dataform.IActionConfig>|null} [actions] ActionConfigs actions
*/
/**
* Constructs a new ActionConfigs.
* @memberof dataform
* @classdesc Represents an ActionConfigs.
* @implements IActionConfigs
* @constructor
* @param {dataform.IActionConfigs=} [properties] Properties to set
*/
function ActionConfigs(properties) {
this.actions = [];
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ActionConfigs actions.
* @member {Array.<dataform.IActionConfig>} actions
* @memberof dataform.ActionConfigs
* @instance
*/
ActionConfigs.prototype.actions = $util.emptyArray;
/**
* Creates a new ActionConfigs instance using the specified properties.
* @function create
* @memberof dataform.ActionConfigs
* @static
* @param {dataform.IActionConfigs=} [properties] Properties to set
* @returns {dataform.ActionConfigs} ActionConfigs instance
*/
ActionConfigs.create = function create(properties) {
return new ActionConfigs(properties);
};
/**
* Encodes the specified ActionConfigs message. Does not implicitly {@link dataform.ActionConfigs.verify|verify} messages.
* @function encode
* @memberof dataform.ActionConfigs
* @static
* @param {dataform.IActionConfigs} message ActionConfigs message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ActionConfigs.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.actions != null && message.actions.length)
for (let i = 0; i < message.actions.length; ++i)
$root.dataform.ActionConfig.encode(message.actions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified ActionConfigs message, length delimited. Does not implicitly {@link dataform.ActionConfigs.verify|verify} messages.
* @function encodeDelimited
* @memberof dataform.ActionConfigs
* @static
* @param {dataform.IActionConfigs} message ActionConfigs message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ActionConfigs.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an ActionConfigs message from the specified reader or buffer.
* @function decode
* @memberof dataform.ActionConfigs
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {dataform.ActionConfigs} ActionConfigs
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ActionConfigs.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dataform.ActionConfigs();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (!(message.actions && message.actions.length))
message.actions = [];
message.actions.push($root.dataform.ActionConfig.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an ActionConfigs message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof dataform.ActionConfigs
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {dataform.ActionConfigs} ActionConfigs
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ActionConfigs.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an ActionConfigs message.
* @function verify
* @memberof dataform.ActionConfigs
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ActionConfigs.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.actions != null && message.hasOwnProperty("actions")) {
if (!Array.isArray(message.actions))
return "actions: array expected";
for (let i = 0; i < message.actions.length; ++i) {
let error = $root.dataform.ActionConfig.verify(message.actions[i]);
if (error)
return "actions." + error;
}
}
return null;
};
/**
* Creates an ActionConfigs message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof dataform.ActionConfigs
* @static
* @param {Object.<string,*>} object Plain object
* @returns {dataform.ActionConfigs} ActionConfigs
*/
ActionConfigs.fromObject = function fromObject(object) {
if (object instanceof $root.dataform.ActionConfigs)
return object;
let message = new $root.dataform.ActionConfigs();
if (object.actions) {
if (!Array.isArray(object.actions))
throw TypeError(".dataform.ActionConfigs.actions: array expected");
message.actions = [];
for (let i = 0; i < object.actions.length; ++i) {
if (typeof object.actions[i] !== "object")
throw TypeError(".dataform.ActionConfigs.actions: object expected");
message.actions[i] = $root.dataform.ActionConfig.fromObject(object.actions[i]);
}
}
return message;
};
/**
* Creates a plain object from an ActionConfigs message. Also converts values to other types if specified.
* @function toObject
* @memberof dataform.ActionConfigs
* @static
* @param {dataform.ActionConfigs} message ActionConfigs
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ActionConfigs.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.arrays || options.defaults)
object.actions = [];
if (message.actions && message.actions.length) {
object.actions = [];
for (let j = 0; j < message.actions.length; ++j)
object.actions[j] = $root.dataform.ActionConfig.toObject(message.actions[j], options);
}
return object;
};
/**
* Converts this ActionConfigs to JSON.
* @function toJSON
* @memberof dataform.ActionConfigs
* @instance
* @returns {Object.<string,*>} JSON object
*/
ActionConfigs.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
};
/**
* Gets the default type url for ActionConfigs
* @function getTypeUrl
* @memberof dataform.ActionConfigs
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ActionConfigs.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/dataform.ActionConfigs";
};
return ActionConfigs;
})();
dataform.ActionConfig = (function() {
/**
* Properties of an ActionConfig.
* @memberof dataform
* @interface IActionConfig
* @property {dataform.ActionConfig.ITableConfig|null} [table] ActionConfig table
* @property {dataform.ActionConfig.IViewConfig|null} [view] ActionConfig view
* @property {dataform.ActionConfig.IIncrementalTableConfig|null} [incrementalTable] ActionConfig incrementalTable
* @property {dataform.ActionConfig.IAssertionConfig|null} [assertion] ActionConfig assertion
* @property {dataform.ActionConfig.IOperationConfig|null} [operation] ActionConfig operation
* @property {dataform.ActionConfig.IDeclarationConfig|null} [declaration] ActionConfig declaration
* @property {dataform.ActionConfig.INotebookConfig|null} [notebook] ActionConfig notebook
* @property {dataform.ActionConfig.IDataPreparationConfig|null} [dataPreparation] ActionConfig dataPreparation
*/
/**
* Constructs a new ActionConfig.
* @memberof dataform
* @classdesc Represents an ActionConfig.
* @implements IActionConfig
* @constructor
* @param {dataform.IActionConfig=} [properties] Properties to set
*/
function ActionConfig(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ActionConfig table.
* @member {dataform.ActionConfig.ITableConfig|null|undefined} table
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.table = null;
/**
* ActionConfig view.
* @member {dataform.ActionConfig.IViewConfig|null|undefined} view
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.view = null;
/**
* ActionConfig incrementalTable.
* @member {dataform.ActionConfig.IIncrementalTableConfig|null|undefined} incrementalTable
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.incrementalTable = null;
/**
* ActionConfig assertion.
* @member {dataform.ActionConfig.IAssertionConfig|null|undefined} assertion
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.assertion = null;
/**
* ActionConfig operation.
* @member {dataform.ActionConfig.IOperationConfig|null|undefined} operation
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.operation = null;
/**
* ActionConfig declaration.
* @member {dataform.ActionConfig.IDeclarationConfig|null|undefined} declaration
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.declaration = null;
/**
* ActionConfig notebook.
* @member {dataform.ActionConfig.INotebookConfig|null|undefined} notebook
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.notebook = null;
/**
* ActionConfig dataPreparation.
* @member {dataform.ActionConfig.IDataPreparationConfig|null|undefined} dataPreparation
* @memberof dataform.ActionConfig
* @instance
*/
ActionConfig.prototype.dataPreparation = null;
// OneOf field names bound to virtual getters and setters
let $oneOfFields;
/**
* ActionConfig action.
* @member {"table"|"view"|"incrementalTable"|"assertion"|"operation"|"declaration"|"notebook"|"dataPreparation"|undefined} action
* @memberof dataform.ActionConfig
* @instance
*/
Object.defineProperty(ActionConfig.prototype, "action", {
get: $util.oneOfGetter($oneOfFields = ["table", "view", "incrementalTable", "assertion", "operation", "declaration", "notebook", "dataPreparation"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new ActionConfig instance using the specified properties.
* @function create
* @memberof dataform.ActionConfig
* @static
* @param {dataform.IActionConfig=} [properties] Properties to set
* @returns {dataform.ActionConfig} ActionConfig instance
*/
ActionConfig.create = function create(properties) {
return new ActionConfig(properties);
};
/**
* Encodes the specified ActionConfig message. Does not implicitly {@link dataform.ActionConfig.verify|verify} messages.
* @function encode
* @memberof dataform.ActionConfig
* @static
* @param {dataform.IActionConfig} message ActionConfig message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ActionConfig.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.table != null && Object.hasOwnProperty.call(message, "table"))
$root.dataform.ActionConfig.TableConfig.encode(message.table, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.view != null && Object.hasOwnProperty.call(message, "view"))
$root.dataform.ActionConfig.ViewConfig.encode(message.view, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.incrementalTable != null && Object.hasOwnProperty.call(message, "incrementalTable"))
$root.dataform.ActionConfig.IncrementalTableConfig.encode(message.incrementalTable, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.assertion != null && Object.hasOwnProperty.call(message, "assertion"))
$root.dataform.ActionConfig.AssertionConfig.encode(message.assertion, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.operation != null && Object.hasOwnProperty.call(message, "operation"))
$root.dataform.ActionConfig.OperationConfig.encode(message.operation, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
if (message.declaration != null && Object.hasOwnProperty.call(message, "declaration"))
$root.dataform.ActionConfig.DeclarationConfig.encode(message.declaration, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.notebook != null && Object.hasOwnProperty.call(message, "notebook"))
$root.dataform.ActionConfig.NotebookConfig.encode(message.notebook, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
if (message.dataPreparation != null && Object.hasOwnProperty.call(message, "dataPreparation"))
$root.dataform.ActionConfig.DataPreparationConfig.encode(message.dataPreparation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
return writer;
};
/**
* Encodes the specified ActionConfig message, length delimited. Does not implicitly {@link dataform.ActionConfig.verify|verify} messages.
* @function encodeDelimited
* @memberof dataform.ActionConfig
* @static
* @param {dataform.IActionConfig} message ActionConfig message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ActionConfig.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an ActionConfig message from the specified reader or buffer.
* @function decode
* @memberof dataform.ActionConfig
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {dataform.ActionConfig} ActionConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ActionConfig.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dataform.ActionConfig();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.table = $root.dataform.ActionConfig.TableConfig.decode(reader, reader.uint32());
break;
}
case 2: {
message.view = $root.dataform.ActionConfig.ViewConfig.decode(reader, reader.uint32());
break;
}
case 3: {
message.incrementalTable = $root.dataform.ActionConfig.IncrementalTableConfig.decode(reader, reader.uint32());
break;
}
case 4: {
message.assertion = $root.dataform.ActionConfig.AssertionConfig.decode(reader, reader.uint32());
break;
}
case 5: {
message.operation = $root.dataform.ActionConfig.OperationConfig.decode(reader, reader.uint32());
break;
}
case 6: {
message.declaration = $root.dataform.ActionConfig.DeclarationConfig.decode(reader, reader.uint32());
break;
}
case 7: {
message.notebook = $root.dataform.ActionConfig.NotebookConfig.decode(reader, reader.uint32());
break;
}
case 8: {
message.dataPreparation = $root.dataform.ActionConfig.DataPreparationConfig.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an ActionConfig message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof dataform.ActionConfig
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {dataform.ActionConfig} ActionConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ActionConfig.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an ActionConfig message.
* @function verify
* @memberof dataform.ActionConfig
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ActionConfig.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
let properties = {};
if (message.table != null && message.hasOwnProperty("table")) {
properties.action = 1;
{
let error = $root.dataform.ActionConfig.TableConfig.verify(message.table);
if (error)
return "table." + error;
}
}
if (message.view != null && message.hasOwnProperty("view")) {
if (properties.action === 1)
return "action: multiple values";
properties.action = 1;
{
let error = $root.dataform.ActionConfig.ViewConfig.verify(message.view);
if (error)
return "view." + error;
}
}
if (message.incrementalTable != null && message.hasOwnProperty("incrementalTable")) {
if (properties.action === 1)
return "action: multiple values";
properties.action = 1;
{
let error = $root.dataform.ActionConfig.IncrementalTableConfig.verify(message.incrementalTable);
if (error)
return "incrementalTable." + error;
}
}
if (message.assertion != null && message.hasOwnProperty("assertion")) {
if (properties.action === 1)
return "action: multiple values";
properties.action = 1;
{
let error = $root.dataform.ActionConfig.AssertionConfig.verify(message.assertion);
if (error)
return "assertion." + error;
}
}
if (message.operation != null && message.hasOwnProperty("operation")) {
if (properties.action === 1)
return "action: multiple values";
properties.action = 1;
{
let error = $root.dataform.ActionConfig.OperationConfig.verify(message.operation);