@sqlanvil/cli 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +468 -8
- package/package.json +1 -1
- package/worker_bundle.js +398 -0
package/bundle.js
CHANGED
|
@@ -147,6 +147,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
147
147
|
* @property {boolean|null} [includeTestsInCompiledGraph] WorkflowSettings includeTestsInCompiledGraph
|
|
148
148
|
* @property {string|null} [warehouse] WorkflowSettings warehouse
|
|
149
149
|
* @property {Object.<string,sqlanvil.IConnectionConfig>|null} [connections] WorkflowSettings connections
|
|
150
|
+
* @property {Object.<string,sqlanvil.IEnvironment>|null} [environments] WorkflowSettings environments
|
|
150
151
|
*/
|
|
151
152
|
|
|
152
153
|
/**
|
|
@@ -160,6 +161,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
160
161
|
function WorkflowSettings(properties) {
|
|
161
162
|
this.vars = {};
|
|
162
163
|
this.connections = {};
|
|
164
|
+
this.environments = {};
|
|
163
165
|
if (properties)
|
|
164
166
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
165
167
|
if (properties[keys[i]] != null)
|
|
@@ -310,6 +312,14 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
310
312
|
*/
|
|
311
313
|
WorkflowSettings.prototype.connections = $util.emptyObject;
|
|
312
314
|
|
|
315
|
+
/**
|
|
316
|
+
* WorkflowSettings environments.
|
|
317
|
+
* @member {Object.<string,sqlanvil.IEnvironment>} environments
|
|
318
|
+
* @memberof sqlanvil.WorkflowSettings
|
|
319
|
+
* @instance
|
|
320
|
+
*/
|
|
321
|
+
WorkflowSettings.prototype.environments = $util.emptyObject;
|
|
322
|
+
|
|
313
323
|
/**
|
|
314
324
|
* Creates a new WorkflowSettings instance using the specified properties.
|
|
315
325
|
* @function create
|
|
@@ -374,6 +384,11 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
374
384
|
writer.uint32(/* id 18, wireType 2 =*/146).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
|
|
375
385
|
$root.sqlanvil.ConnectionConfig.encode(message.connections[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
|
376
386
|
}
|
|
387
|
+
if (message.environments != null && Object.hasOwnProperty.call(message, "environments"))
|
|
388
|
+
for (let keys = Object.keys(message.environments), i = 0; i < keys.length; ++i) {
|
|
389
|
+
writer.uint32(/* id 19, wireType 2 =*/154).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
|
|
390
|
+
$root.sqlanvil.Environment.encode(message.environments[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
|
391
|
+
}
|
|
377
392
|
return writer;
|
|
378
393
|
};
|
|
379
394
|
|
|
@@ -520,6 +535,29 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
520
535
|
message.connections[key] = value;
|
|
521
536
|
break;
|
|
522
537
|
}
|
|
538
|
+
case 19: {
|
|
539
|
+
if (message.environments === $util.emptyObject)
|
|
540
|
+
message.environments = {};
|
|
541
|
+
let end2 = reader.uint32() + reader.pos;
|
|
542
|
+
key = "";
|
|
543
|
+
value = null;
|
|
544
|
+
while (reader.pos < end2) {
|
|
545
|
+
let tag2 = reader.uint32();
|
|
546
|
+
switch (tag2 >>> 3) {
|
|
547
|
+
case 1:
|
|
548
|
+
key = reader.string();
|
|
549
|
+
break;
|
|
550
|
+
case 2:
|
|
551
|
+
value = $root.sqlanvil.Environment.decode(reader, reader.uint32());
|
|
552
|
+
break;
|
|
553
|
+
default:
|
|
554
|
+
reader.skipType(tag2 & 7);
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
message.environments[key] = value;
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
523
561
|
default:
|
|
524
562
|
reader.skipType(tag & 7);
|
|
525
563
|
break;
|
|
@@ -627,6 +665,16 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
627
665
|
return "connections." + error;
|
|
628
666
|
}
|
|
629
667
|
}
|
|
668
|
+
if (message.environments != null && message.hasOwnProperty("environments")) {
|
|
669
|
+
if (!$util.isObject(message.environments))
|
|
670
|
+
return "environments: object expected";
|
|
671
|
+
let key = Object.keys(message.environments);
|
|
672
|
+
for (let i = 0; i < key.length; ++i) {
|
|
673
|
+
let error = $root.sqlanvil.Environment.verify(message.environments[key[i]]);
|
|
674
|
+
if (error)
|
|
675
|
+
return "environments." + error;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
630
678
|
return null;
|
|
631
679
|
};
|
|
632
680
|
|
|
@@ -700,6 +748,16 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
700
748
|
message.connections[keys[i]] = $root.sqlanvil.ConnectionConfig.fromObject(object.connections[keys[i]]);
|
|
701
749
|
}
|
|
702
750
|
}
|
|
751
|
+
if (object.environments) {
|
|
752
|
+
if (typeof object.environments !== "object")
|
|
753
|
+
throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
|
|
754
|
+
message.environments = {};
|
|
755
|
+
for (let keys = Object.keys(object.environments), i = 0; i < keys.length; ++i) {
|
|
756
|
+
if (typeof object.environments[keys[i]] !== "object")
|
|
757
|
+
throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
|
|
758
|
+
message.environments[keys[i]] = $root.sqlanvil.Environment.fromObject(object.environments[keys[i]]);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
703
761
|
return message;
|
|
704
762
|
};
|
|
705
763
|
|
|
@@ -719,6 +777,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
719
777
|
if (options.objects || options.defaults) {
|
|
720
778
|
object.vars = {};
|
|
721
779
|
object.connections = {};
|
|
780
|
+
object.environments = {};
|
|
722
781
|
}
|
|
723
782
|
if (options.defaults) {
|
|
724
783
|
object.sqlanvilCoreVersion = "";
|
|
@@ -781,6 +840,11 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
781
840
|
for (let j = 0; j < keys2.length; ++j)
|
|
782
841
|
object.connections[keys2[j]] = $root.sqlanvil.ConnectionConfig.toObject(message.connections[keys2[j]], options);
|
|
783
842
|
}
|
|
843
|
+
if (message.environments && (keys2 = Object.keys(message.environments)).length) {
|
|
844
|
+
object.environments = {};
|
|
845
|
+
for (let j = 0; j < keys2.length; ++j)
|
|
846
|
+
object.environments[keys2[j]] = $root.sqlanvil.Environment.toObject(message.environments[keys2[j]], options);
|
|
847
|
+
}
|
|
784
848
|
return object;
|
|
785
849
|
};
|
|
786
850
|
|
|
@@ -813,6 +877,340 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
813
877
|
return WorkflowSettings;
|
|
814
878
|
})();
|
|
815
879
|
|
|
880
|
+
sqlanvil.Environment = (function() {
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Properties of an Environment.
|
|
884
|
+
* @memberof sqlanvil
|
|
885
|
+
* @interface IEnvironment
|
|
886
|
+
* @property {string|null} [schemaSuffix] Environment schemaSuffix
|
|
887
|
+
* @property {Object.<string,string>|null} [vars] Environment vars
|
|
888
|
+
* @property {string|null} [defaultDatabase] Environment defaultDatabase
|
|
889
|
+
* @property {string|null} [defaultLocation] Environment defaultLocation
|
|
890
|
+
* @property {string|null} [credentials] Environment credentials
|
|
891
|
+
*/
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Constructs a new Environment.
|
|
895
|
+
* @memberof sqlanvil
|
|
896
|
+
* @classdesc Represents an Environment.
|
|
897
|
+
* @implements IEnvironment
|
|
898
|
+
* @constructor
|
|
899
|
+
* @param {sqlanvil.IEnvironment=} [properties] Properties to set
|
|
900
|
+
*/
|
|
901
|
+
function Environment(properties) {
|
|
902
|
+
this.vars = {};
|
|
903
|
+
if (properties)
|
|
904
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
905
|
+
if (properties[keys[i]] != null)
|
|
906
|
+
this[keys[i]] = properties[keys[i]];
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Environment schemaSuffix.
|
|
911
|
+
* @member {string} schemaSuffix
|
|
912
|
+
* @memberof sqlanvil.Environment
|
|
913
|
+
* @instance
|
|
914
|
+
*/
|
|
915
|
+
Environment.prototype.schemaSuffix = "";
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Environment vars.
|
|
919
|
+
* @member {Object.<string,string>} vars
|
|
920
|
+
* @memberof sqlanvil.Environment
|
|
921
|
+
* @instance
|
|
922
|
+
*/
|
|
923
|
+
Environment.prototype.vars = $util.emptyObject;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Environment defaultDatabase.
|
|
927
|
+
* @member {string} defaultDatabase
|
|
928
|
+
* @memberof sqlanvil.Environment
|
|
929
|
+
* @instance
|
|
930
|
+
*/
|
|
931
|
+
Environment.prototype.defaultDatabase = "";
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Environment defaultLocation.
|
|
935
|
+
* @member {string} defaultLocation
|
|
936
|
+
* @memberof sqlanvil.Environment
|
|
937
|
+
* @instance
|
|
938
|
+
*/
|
|
939
|
+
Environment.prototype.defaultLocation = "";
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Environment credentials.
|
|
943
|
+
* @member {string} credentials
|
|
944
|
+
* @memberof sqlanvil.Environment
|
|
945
|
+
* @instance
|
|
946
|
+
*/
|
|
947
|
+
Environment.prototype.credentials = "";
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Creates a new Environment instance using the specified properties.
|
|
951
|
+
* @function create
|
|
952
|
+
* @memberof sqlanvil.Environment
|
|
953
|
+
* @static
|
|
954
|
+
* @param {sqlanvil.IEnvironment=} [properties] Properties to set
|
|
955
|
+
* @returns {sqlanvil.Environment} Environment instance
|
|
956
|
+
*/
|
|
957
|
+
Environment.create = function create(properties) {
|
|
958
|
+
return new Environment(properties);
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Encodes the specified Environment message. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
|
|
963
|
+
* @function encode
|
|
964
|
+
* @memberof sqlanvil.Environment
|
|
965
|
+
* @static
|
|
966
|
+
* @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
|
|
967
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
968
|
+
* @returns {$protobuf.Writer} Writer
|
|
969
|
+
*/
|
|
970
|
+
Environment.encode = function encode(message, writer) {
|
|
971
|
+
if (!writer)
|
|
972
|
+
writer = $Writer.create();
|
|
973
|
+
if (message.schemaSuffix != null && Object.hasOwnProperty.call(message, "schemaSuffix"))
|
|
974
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.schemaSuffix);
|
|
975
|
+
if (message.vars != null && Object.hasOwnProperty.call(message, "vars"))
|
|
976
|
+
for (let keys = Object.keys(message.vars), i = 0; i < keys.length; ++i)
|
|
977
|
+
writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.vars[keys[i]]).ldelim();
|
|
978
|
+
if (message.defaultDatabase != null && Object.hasOwnProperty.call(message, "defaultDatabase"))
|
|
979
|
+
writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultDatabase);
|
|
980
|
+
if (message.defaultLocation != null && Object.hasOwnProperty.call(message, "defaultLocation"))
|
|
981
|
+
writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultLocation);
|
|
982
|
+
if (message.credentials != null && Object.hasOwnProperty.call(message, "credentials"))
|
|
983
|
+
writer.uint32(/* id 5, wireType 2 =*/42).string(message.credentials);
|
|
984
|
+
return writer;
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Encodes the specified Environment message, length delimited. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
|
|
989
|
+
* @function encodeDelimited
|
|
990
|
+
* @memberof sqlanvil.Environment
|
|
991
|
+
* @static
|
|
992
|
+
* @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
|
|
993
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
994
|
+
* @returns {$protobuf.Writer} Writer
|
|
995
|
+
*/
|
|
996
|
+
Environment.encodeDelimited = function encodeDelimited(message, writer) {
|
|
997
|
+
return this.encode(message, writer).ldelim();
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* Decodes an Environment message from the specified reader or buffer.
|
|
1002
|
+
* @function decode
|
|
1003
|
+
* @memberof sqlanvil.Environment
|
|
1004
|
+
* @static
|
|
1005
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1006
|
+
* @param {number} [length] Message length if known beforehand
|
|
1007
|
+
* @returns {sqlanvil.Environment} Environment
|
|
1008
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1009
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1010
|
+
*/
|
|
1011
|
+
Environment.decode = function decode(reader, length, error) {
|
|
1012
|
+
if (!(reader instanceof $Reader))
|
|
1013
|
+
reader = $Reader.create(reader);
|
|
1014
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.Environment(), key, value;
|
|
1015
|
+
while (reader.pos < end) {
|
|
1016
|
+
let tag = reader.uint32();
|
|
1017
|
+
if (tag === error)
|
|
1018
|
+
break;
|
|
1019
|
+
switch (tag >>> 3) {
|
|
1020
|
+
case 1: {
|
|
1021
|
+
message.schemaSuffix = reader.string();
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
case 2: {
|
|
1025
|
+
if (message.vars === $util.emptyObject)
|
|
1026
|
+
message.vars = {};
|
|
1027
|
+
let end2 = reader.uint32() + reader.pos;
|
|
1028
|
+
key = "";
|
|
1029
|
+
value = "";
|
|
1030
|
+
while (reader.pos < end2) {
|
|
1031
|
+
let tag2 = reader.uint32();
|
|
1032
|
+
switch (tag2 >>> 3) {
|
|
1033
|
+
case 1:
|
|
1034
|
+
key = reader.string();
|
|
1035
|
+
break;
|
|
1036
|
+
case 2:
|
|
1037
|
+
value = reader.string();
|
|
1038
|
+
break;
|
|
1039
|
+
default:
|
|
1040
|
+
reader.skipType(tag2 & 7);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
message.vars[key] = value;
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
case 3: {
|
|
1048
|
+
message.defaultDatabase = reader.string();
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
case 4: {
|
|
1052
|
+
message.defaultLocation = reader.string();
|
|
1053
|
+
break;
|
|
1054
|
+
}
|
|
1055
|
+
case 5: {
|
|
1056
|
+
message.credentials = reader.string();
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
default:
|
|
1060
|
+
reader.skipType(tag & 7);
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return message;
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Decodes an Environment message from the specified reader or buffer, length delimited.
|
|
1069
|
+
* @function decodeDelimited
|
|
1070
|
+
* @memberof sqlanvil.Environment
|
|
1071
|
+
* @static
|
|
1072
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1073
|
+
* @returns {sqlanvil.Environment} Environment
|
|
1074
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1075
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1076
|
+
*/
|
|
1077
|
+
Environment.decodeDelimited = function decodeDelimited(reader) {
|
|
1078
|
+
if (!(reader instanceof $Reader))
|
|
1079
|
+
reader = new $Reader(reader);
|
|
1080
|
+
return this.decode(reader, reader.uint32());
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Verifies an Environment message.
|
|
1085
|
+
* @function verify
|
|
1086
|
+
* @memberof sqlanvil.Environment
|
|
1087
|
+
* @static
|
|
1088
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1089
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1090
|
+
*/
|
|
1091
|
+
Environment.verify = function verify(message) {
|
|
1092
|
+
if (typeof message !== "object" || message === null)
|
|
1093
|
+
return "object expected";
|
|
1094
|
+
if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
|
|
1095
|
+
if (!$util.isString(message.schemaSuffix))
|
|
1096
|
+
return "schemaSuffix: string expected";
|
|
1097
|
+
if (message.vars != null && message.hasOwnProperty("vars")) {
|
|
1098
|
+
if (!$util.isObject(message.vars))
|
|
1099
|
+
return "vars: object expected";
|
|
1100
|
+
let key = Object.keys(message.vars);
|
|
1101
|
+
for (let i = 0; i < key.length; ++i)
|
|
1102
|
+
if (!$util.isString(message.vars[key[i]]))
|
|
1103
|
+
return "vars: string{k:string} expected";
|
|
1104
|
+
}
|
|
1105
|
+
if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
|
|
1106
|
+
if (!$util.isString(message.defaultDatabase))
|
|
1107
|
+
return "defaultDatabase: string expected";
|
|
1108
|
+
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
|
|
1109
|
+
if (!$util.isString(message.defaultLocation))
|
|
1110
|
+
return "defaultLocation: string expected";
|
|
1111
|
+
if (message.credentials != null && message.hasOwnProperty("credentials"))
|
|
1112
|
+
if (!$util.isString(message.credentials))
|
|
1113
|
+
return "credentials: string expected";
|
|
1114
|
+
return null;
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates an Environment message from a plain object. Also converts values to their respective internal types.
|
|
1119
|
+
* @function fromObject
|
|
1120
|
+
* @memberof sqlanvil.Environment
|
|
1121
|
+
* @static
|
|
1122
|
+
* @param {Object.<string,*>} object Plain object
|
|
1123
|
+
* @returns {sqlanvil.Environment} Environment
|
|
1124
|
+
*/
|
|
1125
|
+
Environment.fromObject = function fromObject(object) {
|
|
1126
|
+
if (object instanceof $root.sqlanvil.Environment)
|
|
1127
|
+
return object;
|
|
1128
|
+
let message = new $root.sqlanvil.Environment();
|
|
1129
|
+
if (object.schemaSuffix != null)
|
|
1130
|
+
message.schemaSuffix = String(object.schemaSuffix);
|
|
1131
|
+
if (object.vars) {
|
|
1132
|
+
if (typeof object.vars !== "object")
|
|
1133
|
+
throw TypeError(".sqlanvil.Environment.vars: object expected");
|
|
1134
|
+
message.vars = {};
|
|
1135
|
+
for (let keys = Object.keys(object.vars), i = 0; i < keys.length; ++i)
|
|
1136
|
+
message.vars[keys[i]] = String(object.vars[keys[i]]);
|
|
1137
|
+
}
|
|
1138
|
+
if (object.defaultDatabase != null)
|
|
1139
|
+
message.defaultDatabase = String(object.defaultDatabase);
|
|
1140
|
+
if (object.defaultLocation != null)
|
|
1141
|
+
message.defaultLocation = String(object.defaultLocation);
|
|
1142
|
+
if (object.credentials != null)
|
|
1143
|
+
message.credentials = String(object.credentials);
|
|
1144
|
+
return message;
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Creates a plain object from an Environment message. Also converts values to other types if specified.
|
|
1149
|
+
* @function toObject
|
|
1150
|
+
* @memberof sqlanvil.Environment
|
|
1151
|
+
* @static
|
|
1152
|
+
* @param {sqlanvil.Environment} message Environment
|
|
1153
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1154
|
+
* @returns {Object.<string,*>} Plain object
|
|
1155
|
+
*/
|
|
1156
|
+
Environment.toObject = function toObject(message, options) {
|
|
1157
|
+
if (!options)
|
|
1158
|
+
options = {};
|
|
1159
|
+
let object = {};
|
|
1160
|
+
if (options.objects || options.defaults)
|
|
1161
|
+
object.vars = {};
|
|
1162
|
+
if (options.defaults) {
|
|
1163
|
+
object.schemaSuffix = "";
|
|
1164
|
+
object.defaultDatabase = "";
|
|
1165
|
+
object.defaultLocation = "";
|
|
1166
|
+
object.credentials = "";
|
|
1167
|
+
}
|
|
1168
|
+
if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
|
|
1169
|
+
object.schemaSuffix = message.schemaSuffix;
|
|
1170
|
+
let keys2;
|
|
1171
|
+
if (message.vars && (keys2 = Object.keys(message.vars)).length) {
|
|
1172
|
+
object.vars = {};
|
|
1173
|
+
for (let j = 0; j < keys2.length; ++j)
|
|
1174
|
+
object.vars[keys2[j]] = message.vars[keys2[j]];
|
|
1175
|
+
}
|
|
1176
|
+
if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
|
|
1177
|
+
object.defaultDatabase = message.defaultDatabase;
|
|
1178
|
+
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
|
|
1179
|
+
object.defaultLocation = message.defaultLocation;
|
|
1180
|
+
if (message.credentials != null && message.hasOwnProperty("credentials"))
|
|
1181
|
+
object.credentials = message.credentials;
|
|
1182
|
+
return object;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Converts this Environment to JSON.
|
|
1187
|
+
* @function toJSON
|
|
1188
|
+
* @memberof sqlanvil.Environment
|
|
1189
|
+
* @instance
|
|
1190
|
+
* @returns {Object.<string,*>} JSON object
|
|
1191
|
+
*/
|
|
1192
|
+
Environment.prototype.toJSON = function toJSON() {
|
|
1193
|
+
return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* Gets the default type url for Environment
|
|
1198
|
+
* @function getTypeUrl
|
|
1199
|
+
* @memberof sqlanvil.Environment
|
|
1200
|
+
* @static
|
|
1201
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
1202
|
+
* @returns {string} The default type url
|
|
1203
|
+
*/
|
|
1204
|
+
Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
1205
|
+
if (typeUrlPrefix === undefined) {
|
|
1206
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
1207
|
+
}
|
|
1208
|
+
return typeUrlPrefix + "/sqlanvil.Environment";
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
return Environment;
|
|
1212
|
+
})();
|
|
1213
|
+
|
|
816
1214
|
sqlanvil.ConnectionConfig = (function() {
|
|
817
1215
|
|
|
818
1216
|
/**
|
|
@@ -39801,7 +40199,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
|
|
|
39801
40199
|
.filter(validationQuery => !!validationQuery.query);
|
|
39802
40200
|
}
|
|
39803
40201
|
|
|
39804
|
-
const version = "1.
|
|
40202
|
+
const version = "1.7.0";
|
|
39805
40203
|
const dataformVersion = "3.0.59";
|
|
39806
40204
|
|
|
39807
40205
|
async function build(compiledGraph, runConfig, dbadapter) {
|
|
@@ -40128,6 +40526,7 @@ async function test$1(dbadapter, timeoutMs = 10000) {
|
|
|
40128
40526
|
|
|
40129
40527
|
const gitIgnoreContents = `
|
|
40130
40528
|
${CREDENTIALS_FILENAME}
|
|
40529
|
+
.df-credentials*.json
|
|
40131
40530
|
node_modules/
|
|
40132
40531
|
`;
|
|
40133
40532
|
function postgresCredentialsTemplate(warehouse) {
|
|
@@ -41003,6 +41402,46 @@ function normalizeRow(row) {
|
|
|
41003
41402
|
return newRow;
|
|
41004
41403
|
}
|
|
41005
41404
|
|
|
41405
|
+
function resolveEnvironment(projectDir, envName) {
|
|
41406
|
+
const settings = readConfigFromWorkflowSettings(projectDir);
|
|
41407
|
+
const environments = (settings === null || settings === void 0 ? void 0 : settings.environments) || {};
|
|
41408
|
+
const env = environments[envName];
|
|
41409
|
+
if (!env) {
|
|
41410
|
+
const available = Object.keys(environments);
|
|
41411
|
+
throw new Error(`Environment "${envName}" not found. ` +
|
|
41412
|
+
(available.length
|
|
41413
|
+
? `Available environments: ${available.join(", ")}.`
|
|
41414
|
+
: `No environments defined in workflow_settings.yaml.`));
|
|
41415
|
+
}
|
|
41416
|
+
const configOverride = {};
|
|
41417
|
+
if (env.schemaSuffix) {
|
|
41418
|
+
configOverride.schemaSuffix = env.schemaSuffix;
|
|
41419
|
+
}
|
|
41420
|
+
if (env.vars && Object.keys(env.vars).length > 0) {
|
|
41421
|
+
configOverride.vars = env.vars;
|
|
41422
|
+
}
|
|
41423
|
+
if (env.defaultDatabase) {
|
|
41424
|
+
configOverride.defaultDatabase = env.defaultDatabase;
|
|
41425
|
+
}
|
|
41426
|
+
if (env.defaultLocation) {
|
|
41427
|
+
configOverride.defaultLocation = env.defaultLocation;
|
|
41428
|
+
}
|
|
41429
|
+
return { configOverride, credentials: env.credentials || undefined };
|
|
41430
|
+
}
|
|
41431
|
+
function mergeProjectConfigOverride(envOverride, cliOverride) {
|
|
41432
|
+
const merged = Object.assign(Object.assign({}, envOverride), cliOverride);
|
|
41433
|
+
if (envOverride.vars || cliOverride.vars) {
|
|
41434
|
+
merged.vars = Object.assign(Object.assign({}, envOverride.vars), cliOverride.vars);
|
|
41435
|
+
}
|
|
41436
|
+
return merged;
|
|
41437
|
+
}
|
|
41438
|
+
function resolveCredentials(envCredentials, cliCredentials, defaultFilename) {
|
|
41439
|
+
if (cliCredentials && cliCredentials !== defaultFilename) {
|
|
41440
|
+
return cliCredentials;
|
|
41441
|
+
}
|
|
41442
|
+
return envCredentials || defaultFilename;
|
|
41443
|
+
}
|
|
41444
|
+
|
|
41006
41445
|
function parsePostgresEvalError(_query, error) {
|
|
41007
41446
|
return sqlanvil.QueryEvaluationError.create({
|
|
41008
41447
|
message: (error === null || error === void 0 ? void 0 : error.message) ? String(error.message) : String(error)
|
|
@@ -43632,6 +44071,21 @@ const actionRetryLimitName = "action-retry-limit";
|
|
|
43632
44071
|
function getCredentialsPath(projectDir, credentialsPath) {
|
|
43633
44072
|
return actuallyResolve(projectDir, credentialsPath);
|
|
43634
44073
|
}
|
|
44074
|
+
function projectConfigOverrideWithEnvironment(projectDir, argv) {
|
|
44075
|
+
const cliOverride = ProjectConfigOptions.constructProjectConfigOverride(argv);
|
|
44076
|
+
if (!argv[ProjectConfigOptions.environment.name]) {
|
|
44077
|
+
return cliOverride;
|
|
44078
|
+
}
|
|
44079
|
+
const { configOverride } = resolveEnvironment(projectDir, argv[ProjectConfigOptions.environment.name]);
|
|
44080
|
+
return mergeProjectConfigOverride(configOverride, cliOverride);
|
|
44081
|
+
}
|
|
44082
|
+
function credentialsPathWithEnvironment(projectDir, argv) {
|
|
44083
|
+
const envCredentials = argv[ProjectConfigOptions.environment.name]
|
|
44084
|
+
? resolveEnvironment(projectDir, argv[ProjectConfigOptions.environment.name]).credentials
|
|
44085
|
+
: undefined;
|
|
44086
|
+
const chosen = resolveCredentials(envCredentials, argv[credentialsOption.name], CREDENTIALS_FILENAME);
|
|
44087
|
+
return getCredentialsPath(projectDir, chosen);
|
|
44088
|
+
}
|
|
43635
44089
|
function runCli() {
|
|
43636
44090
|
const builtYargs = createYargsCli({
|
|
43637
44091
|
commands: [
|
|
@@ -43789,7 +44243,7 @@ function runCli() {
|
|
|
43789
44243
|
}
|
|
43790
44244
|
const compiledGraph = await compile({
|
|
43791
44245
|
projectDir,
|
|
43792
|
-
projectConfigOverride:
|
|
44246
|
+
projectConfigOverride: projectConfigOverrideWithEnvironment(projectDir, argv),
|
|
43793
44247
|
timeoutMillis: argv[timeoutOption.name] || undefined,
|
|
43794
44248
|
verbose: argv[verboseOptionName] || false
|
|
43795
44249
|
});
|
|
@@ -43870,7 +44324,7 @@ function runCli() {
|
|
|
43870
44324
|
}
|
|
43871
44325
|
const compiledGraph = await compile({
|
|
43872
44326
|
projectDir: argv[projectDirMustExistOption.name],
|
|
43873
|
-
projectConfigOverride:
|
|
44327
|
+
projectConfigOverride: projectConfigOverrideWithEnvironment(argv[projectDirMustExistOption.name], argv),
|
|
43874
44328
|
timeoutMillis: argv[timeoutOption.name] || undefined
|
|
43875
44329
|
});
|
|
43876
44330
|
if (compiledGraphHasErrors(compiledGraph)) {
|
|
@@ -43881,7 +44335,7 @@ function runCli() {
|
|
|
43881
44335
|
printSuccess("Compiled successfully.\n");
|
|
43882
44336
|
}
|
|
43883
44337
|
const warehouse = compiledGraph.projectConfig.warehouse || "bigquery";
|
|
43884
|
-
const readCredentials = read(
|
|
44338
|
+
const readCredentials = read(credentialsPathWithEnvironment(argv[projectDirMustExistOption.name], argv), warehouse);
|
|
43885
44339
|
if (!compiledGraph.tests.length) {
|
|
43886
44340
|
printError("No unit tests found.");
|
|
43887
44341
|
return 1;
|
|
@@ -43953,7 +44407,7 @@ function runCli() {
|
|
|
43953
44407
|
}
|
|
43954
44408
|
const compiledGraph = await compile({
|
|
43955
44409
|
projectDir: argv[projectDirOption.name],
|
|
43956
|
-
projectConfigOverride:
|
|
44410
|
+
projectConfigOverride: projectConfigOverrideWithEnvironment(argv[projectDirOption.name], argv),
|
|
43957
44411
|
timeoutMillis: argv[timeoutOption.name] || undefined
|
|
43958
44412
|
});
|
|
43959
44413
|
if (compiledGraphHasErrors(compiledGraph)) {
|
|
@@ -43964,7 +44418,7 @@ function runCli() {
|
|
|
43964
44418
|
printSuccess("Compiled successfully.\n");
|
|
43965
44419
|
}
|
|
43966
44420
|
const warehouse = compiledGraph.projectConfig.warehouse || "bigquery";
|
|
43967
|
-
const readCredentials = read(
|
|
44421
|
+
const readCredentials = read(credentialsPathWithEnvironment(argv[projectDirOption.name], argv), warehouse);
|
|
43968
44422
|
let dbadapter;
|
|
43969
44423
|
if (warehouse.toLowerCase() === "supabase") {
|
|
43970
44424
|
dbadapter = await SupabaseDbAdapter.create(readCredentials);
|
|
@@ -44019,7 +44473,7 @@ function runCli() {
|
|
|
44019
44473
|
print("No actions to run.\n");
|
|
44020
44474
|
return 0;
|
|
44021
44475
|
}
|
|
44022
|
-
const connectionCredentials = readConnections(
|
|
44476
|
+
const connectionCredentials = readConnections(credentialsPathWithEnvironment(argv[projectDirOption.name], argv));
|
|
44023
44477
|
assertConnectionCredentialsAvailable(executionGraph, connectionCredentials);
|
|
44024
44478
|
if (argv[dryRunOptionName]) {
|
|
44025
44479
|
print("Dry running (no changes to the warehouse will be applied)...");
|
|
@@ -44263,6 +44717,11 @@ ProjectConfigOptions.defaultReservation = option("default-reservation", {
|
|
|
44263
44717
|
"workflow_settings.yaml is used. If neither is set, default BigQuery behavior applies.",
|
|
44264
44718
|
type: "string"
|
|
44265
44719
|
});
|
|
44720
|
+
ProjectConfigOptions.environment = option("environment", {
|
|
44721
|
+
describe: "Named environment from workflow_settings.yaml `environments:` to load (its schemaSuffix, " +
|
|
44722
|
+
"vars, defaultDatabase/location, and credentials file). Explicit flags override the environment.",
|
|
44723
|
+
type: "string"
|
|
44724
|
+
});
|
|
44266
44725
|
ProjectConfigOptions.allYargsOptions = [
|
|
44267
44726
|
ProjectConfigOptions.defaultDatabase,
|
|
44268
44727
|
ProjectConfigOptions.defaultSchema,
|
|
@@ -44273,7 +44732,8 @@ ProjectConfigOptions.allYargsOptions = [
|
|
|
44273
44732
|
ProjectConfigOptions.schemaSuffix,
|
|
44274
44733
|
ProjectConfigOptions.tablePrefix,
|
|
44275
44734
|
ProjectConfigOptions.disableAssertions,
|
|
44276
|
-
ProjectConfigOptions.defaultReservation
|
|
44735
|
+
ProjectConfigOptions.defaultReservation,
|
|
44736
|
+
ProjectConfigOptions.environment
|
|
44277
44737
|
];
|
|
44278
44738
|
|
|
44279
44739
|
runCli();
|
package/package.json
CHANGED
package/worker_bundle.js
CHANGED
|
@@ -88,6 +88,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
88
88
|
* @property {boolean|null} [includeTestsInCompiledGraph] WorkflowSettings includeTestsInCompiledGraph
|
|
89
89
|
* @property {string|null} [warehouse] WorkflowSettings warehouse
|
|
90
90
|
* @property {Object.<string,sqlanvil.IConnectionConfig>|null} [connections] WorkflowSettings connections
|
|
91
|
+
* @property {Object.<string,sqlanvil.IEnvironment>|null} [environments] WorkflowSettings environments
|
|
91
92
|
*/
|
|
92
93
|
|
|
93
94
|
/**
|
|
@@ -101,6 +102,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
101
102
|
function WorkflowSettings(properties) {
|
|
102
103
|
this.vars = {};
|
|
103
104
|
this.connections = {};
|
|
105
|
+
this.environments = {};
|
|
104
106
|
if (properties)
|
|
105
107
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
106
108
|
if (properties[keys[i]] != null)
|
|
@@ -251,6 +253,14 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
251
253
|
*/
|
|
252
254
|
WorkflowSettings.prototype.connections = $util.emptyObject;
|
|
253
255
|
|
|
256
|
+
/**
|
|
257
|
+
* WorkflowSettings environments.
|
|
258
|
+
* @member {Object.<string,sqlanvil.IEnvironment>} environments
|
|
259
|
+
* @memberof sqlanvil.WorkflowSettings
|
|
260
|
+
* @instance
|
|
261
|
+
*/
|
|
262
|
+
WorkflowSettings.prototype.environments = $util.emptyObject;
|
|
263
|
+
|
|
254
264
|
/**
|
|
255
265
|
* Creates a new WorkflowSettings instance using the specified properties.
|
|
256
266
|
* @function create
|
|
@@ -315,6 +325,11 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
315
325
|
writer.uint32(/* id 18, wireType 2 =*/146).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
|
|
316
326
|
$root.sqlanvil.ConnectionConfig.encode(message.connections[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
|
317
327
|
}
|
|
328
|
+
if (message.environments != null && Object.hasOwnProperty.call(message, "environments"))
|
|
329
|
+
for (let keys = Object.keys(message.environments), i = 0; i < keys.length; ++i) {
|
|
330
|
+
writer.uint32(/* id 19, wireType 2 =*/154).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
|
|
331
|
+
$root.sqlanvil.Environment.encode(message.environments[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
|
332
|
+
}
|
|
318
333
|
return writer;
|
|
319
334
|
};
|
|
320
335
|
|
|
@@ -461,6 +476,29 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
461
476
|
message.connections[key] = value;
|
|
462
477
|
break;
|
|
463
478
|
}
|
|
479
|
+
case 19: {
|
|
480
|
+
if (message.environments === $util.emptyObject)
|
|
481
|
+
message.environments = {};
|
|
482
|
+
let end2 = reader.uint32() + reader.pos;
|
|
483
|
+
key = "";
|
|
484
|
+
value = null;
|
|
485
|
+
while (reader.pos < end2) {
|
|
486
|
+
let tag2 = reader.uint32();
|
|
487
|
+
switch (tag2 >>> 3) {
|
|
488
|
+
case 1:
|
|
489
|
+
key = reader.string();
|
|
490
|
+
break;
|
|
491
|
+
case 2:
|
|
492
|
+
value = $root.sqlanvil.Environment.decode(reader, reader.uint32());
|
|
493
|
+
break;
|
|
494
|
+
default:
|
|
495
|
+
reader.skipType(tag2 & 7);
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
message.environments[key] = value;
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
464
502
|
default:
|
|
465
503
|
reader.skipType(tag & 7);
|
|
466
504
|
break;
|
|
@@ -568,6 +606,16 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
568
606
|
return "connections." + error;
|
|
569
607
|
}
|
|
570
608
|
}
|
|
609
|
+
if (message.environments != null && message.hasOwnProperty("environments")) {
|
|
610
|
+
if (!$util.isObject(message.environments))
|
|
611
|
+
return "environments: object expected";
|
|
612
|
+
let key = Object.keys(message.environments);
|
|
613
|
+
for (let i = 0; i < key.length; ++i) {
|
|
614
|
+
let error = $root.sqlanvil.Environment.verify(message.environments[key[i]]);
|
|
615
|
+
if (error)
|
|
616
|
+
return "environments." + error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
571
619
|
return null;
|
|
572
620
|
};
|
|
573
621
|
|
|
@@ -641,6 +689,16 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
641
689
|
message.connections[keys[i]] = $root.sqlanvil.ConnectionConfig.fromObject(object.connections[keys[i]]);
|
|
642
690
|
}
|
|
643
691
|
}
|
|
692
|
+
if (object.environments) {
|
|
693
|
+
if (typeof object.environments !== "object")
|
|
694
|
+
throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
|
|
695
|
+
message.environments = {};
|
|
696
|
+
for (let keys = Object.keys(object.environments), i = 0; i < keys.length; ++i) {
|
|
697
|
+
if (typeof object.environments[keys[i]] !== "object")
|
|
698
|
+
throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
|
|
699
|
+
message.environments[keys[i]] = $root.sqlanvil.Environment.fromObject(object.environments[keys[i]]);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
644
702
|
return message;
|
|
645
703
|
};
|
|
646
704
|
|
|
@@ -660,6 +718,7 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
660
718
|
if (options.objects || options.defaults) {
|
|
661
719
|
object.vars = {};
|
|
662
720
|
object.connections = {};
|
|
721
|
+
object.environments = {};
|
|
663
722
|
}
|
|
664
723
|
if (options.defaults) {
|
|
665
724
|
object.sqlanvilCoreVersion = "";
|
|
@@ -722,6 +781,11 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
722
781
|
for (let j = 0; j < keys2.length; ++j)
|
|
723
782
|
object.connections[keys2[j]] = $root.sqlanvil.ConnectionConfig.toObject(message.connections[keys2[j]], options);
|
|
724
783
|
}
|
|
784
|
+
if (message.environments && (keys2 = Object.keys(message.environments)).length) {
|
|
785
|
+
object.environments = {};
|
|
786
|
+
for (let j = 0; j < keys2.length; ++j)
|
|
787
|
+
object.environments[keys2[j]] = $root.sqlanvil.Environment.toObject(message.environments[keys2[j]], options);
|
|
788
|
+
}
|
|
725
789
|
return object;
|
|
726
790
|
};
|
|
727
791
|
|
|
@@ -754,6 +818,340 @@ const sqlanvil = $root.sqlanvil = (() => {
|
|
|
754
818
|
return WorkflowSettings;
|
|
755
819
|
})();
|
|
756
820
|
|
|
821
|
+
sqlanvil.Environment = (function() {
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Properties of an Environment.
|
|
825
|
+
* @memberof sqlanvil
|
|
826
|
+
* @interface IEnvironment
|
|
827
|
+
* @property {string|null} [schemaSuffix] Environment schemaSuffix
|
|
828
|
+
* @property {Object.<string,string>|null} [vars] Environment vars
|
|
829
|
+
* @property {string|null} [defaultDatabase] Environment defaultDatabase
|
|
830
|
+
* @property {string|null} [defaultLocation] Environment defaultLocation
|
|
831
|
+
* @property {string|null} [credentials] Environment credentials
|
|
832
|
+
*/
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Constructs a new Environment.
|
|
836
|
+
* @memberof sqlanvil
|
|
837
|
+
* @classdesc Represents an Environment.
|
|
838
|
+
* @implements IEnvironment
|
|
839
|
+
* @constructor
|
|
840
|
+
* @param {sqlanvil.IEnvironment=} [properties] Properties to set
|
|
841
|
+
*/
|
|
842
|
+
function Environment(properties) {
|
|
843
|
+
this.vars = {};
|
|
844
|
+
if (properties)
|
|
845
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
846
|
+
if (properties[keys[i]] != null)
|
|
847
|
+
this[keys[i]] = properties[keys[i]];
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Environment schemaSuffix.
|
|
852
|
+
* @member {string} schemaSuffix
|
|
853
|
+
* @memberof sqlanvil.Environment
|
|
854
|
+
* @instance
|
|
855
|
+
*/
|
|
856
|
+
Environment.prototype.schemaSuffix = "";
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Environment vars.
|
|
860
|
+
* @member {Object.<string,string>} vars
|
|
861
|
+
* @memberof sqlanvil.Environment
|
|
862
|
+
* @instance
|
|
863
|
+
*/
|
|
864
|
+
Environment.prototype.vars = $util.emptyObject;
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Environment defaultDatabase.
|
|
868
|
+
* @member {string} defaultDatabase
|
|
869
|
+
* @memberof sqlanvil.Environment
|
|
870
|
+
* @instance
|
|
871
|
+
*/
|
|
872
|
+
Environment.prototype.defaultDatabase = "";
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Environment defaultLocation.
|
|
876
|
+
* @member {string} defaultLocation
|
|
877
|
+
* @memberof sqlanvil.Environment
|
|
878
|
+
* @instance
|
|
879
|
+
*/
|
|
880
|
+
Environment.prototype.defaultLocation = "";
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Environment credentials.
|
|
884
|
+
* @member {string} credentials
|
|
885
|
+
* @memberof sqlanvil.Environment
|
|
886
|
+
* @instance
|
|
887
|
+
*/
|
|
888
|
+
Environment.prototype.credentials = "";
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Creates a new Environment instance using the specified properties.
|
|
892
|
+
* @function create
|
|
893
|
+
* @memberof sqlanvil.Environment
|
|
894
|
+
* @static
|
|
895
|
+
* @param {sqlanvil.IEnvironment=} [properties] Properties to set
|
|
896
|
+
* @returns {sqlanvil.Environment} Environment instance
|
|
897
|
+
*/
|
|
898
|
+
Environment.create = function create(properties) {
|
|
899
|
+
return new Environment(properties);
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Encodes the specified Environment message. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
|
|
904
|
+
* @function encode
|
|
905
|
+
* @memberof sqlanvil.Environment
|
|
906
|
+
* @static
|
|
907
|
+
* @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
|
|
908
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
909
|
+
* @returns {$protobuf.Writer} Writer
|
|
910
|
+
*/
|
|
911
|
+
Environment.encode = function encode(message, writer) {
|
|
912
|
+
if (!writer)
|
|
913
|
+
writer = $Writer.create();
|
|
914
|
+
if (message.schemaSuffix != null && Object.hasOwnProperty.call(message, "schemaSuffix"))
|
|
915
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.schemaSuffix);
|
|
916
|
+
if (message.vars != null && Object.hasOwnProperty.call(message, "vars"))
|
|
917
|
+
for (let keys = Object.keys(message.vars), i = 0; i < keys.length; ++i)
|
|
918
|
+
writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.vars[keys[i]]).ldelim();
|
|
919
|
+
if (message.defaultDatabase != null && Object.hasOwnProperty.call(message, "defaultDatabase"))
|
|
920
|
+
writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultDatabase);
|
|
921
|
+
if (message.defaultLocation != null && Object.hasOwnProperty.call(message, "defaultLocation"))
|
|
922
|
+
writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultLocation);
|
|
923
|
+
if (message.credentials != null && Object.hasOwnProperty.call(message, "credentials"))
|
|
924
|
+
writer.uint32(/* id 5, wireType 2 =*/42).string(message.credentials);
|
|
925
|
+
return writer;
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Encodes the specified Environment message, length delimited. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
|
|
930
|
+
* @function encodeDelimited
|
|
931
|
+
* @memberof sqlanvil.Environment
|
|
932
|
+
* @static
|
|
933
|
+
* @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
|
|
934
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
935
|
+
* @returns {$protobuf.Writer} Writer
|
|
936
|
+
*/
|
|
937
|
+
Environment.encodeDelimited = function encodeDelimited(message, writer) {
|
|
938
|
+
return this.encode(message, writer).ldelim();
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Decodes an Environment message from the specified reader or buffer.
|
|
943
|
+
* @function decode
|
|
944
|
+
* @memberof sqlanvil.Environment
|
|
945
|
+
* @static
|
|
946
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
947
|
+
* @param {number} [length] Message length if known beforehand
|
|
948
|
+
* @returns {sqlanvil.Environment} Environment
|
|
949
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
950
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
951
|
+
*/
|
|
952
|
+
Environment.decode = function decode(reader, length, error) {
|
|
953
|
+
if (!(reader instanceof $Reader))
|
|
954
|
+
reader = $Reader.create(reader);
|
|
955
|
+
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.Environment(), key, value;
|
|
956
|
+
while (reader.pos < end) {
|
|
957
|
+
let tag = reader.uint32();
|
|
958
|
+
if (tag === error)
|
|
959
|
+
break;
|
|
960
|
+
switch (tag >>> 3) {
|
|
961
|
+
case 1: {
|
|
962
|
+
message.schemaSuffix = reader.string();
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
case 2: {
|
|
966
|
+
if (message.vars === $util.emptyObject)
|
|
967
|
+
message.vars = {};
|
|
968
|
+
let end2 = reader.uint32() + reader.pos;
|
|
969
|
+
key = "";
|
|
970
|
+
value = "";
|
|
971
|
+
while (reader.pos < end2) {
|
|
972
|
+
let tag2 = reader.uint32();
|
|
973
|
+
switch (tag2 >>> 3) {
|
|
974
|
+
case 1:
|
|
975
|
+
key = reader.string();
|
|
976
|
+
break;
|
|
977
|
+
case 2:
|
|
978
|
+
value = reader.string();
|
|
979
|
+
break;
|
|
980
|
+
default:
|
|
981
|
+
reader.skipType(tag2 & 7);
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
message.vars[key] = value;
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
case 3: {
|
|
989
|
+
message.defaultDatabase = reader.string();
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
case 4: {
|
|
993
|
+
message.defaultLocation = reader.string();
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
case 5: {
|
|
997
|
+
message.credentials = reader.string();
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
default:
|
|
1001
|
+
reader.skipType(tag & 7);
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
return message;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Decodes an Environment message from the specified reader or buffer, length delimited.
|
|
1010
|
+
* @function decodeDelimited
|
|
1011
|
+
* @memberof sqlanvil.Environment
|
|
1012
|
+
* @static
|
|
1013
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1014
|
+
* @returns {sqlanvil.Environment} Environment
|
|
1015
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1016
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1017
|
+
*/
|
|
1018
|
+
Environment.decodeDelimited = function decodeDelimited(reader) {
|
|
1019
|
+
if (!(reader instanceof $Reader))
|
|
1020
|
+
reader = new $Reader(reader);
|
|
1021
|
+
return this.decode(reader, reader.uint32());
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Verifies an Environment message.
|
|
1026
|
+
* @function verify
|
|
1027
|
+
* @memberof sqlanvil.Environment
|
|
1028
|
+
* @static
|
|
1029
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1030
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1031
|
+
*/
|
|
1032
|
+
Environment.verify = function verify(message) {
|
|
1033
|
+
if (typeof message !== "object" || message === null)
|
|
1034
|
+
return "object expected";
|
|
1035
|
+
if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
|
|
1036
|
+
if (!$util.isString(message.schemaSuffix))
|
|
1037
|
+
return "schemaSuffix: string expected";
|
|
1038
|
+
if (message.vars != null && message.hasOwnProperty("vars")) {
|
|
1039
|
+
if (!$util.isObject(message.vars))
|
|
1040
|
+
return "vars: object expected";
|
|
1041
|
+
let key = Object.keys(message.vars);
|
|
1042
|
+
for (let i = 0; i < key.length; ++i)
|
|
1043
|
+
if (!$util.isString(message.vars[key[i]]))
|
|
1044
|
+
return "vars: string{k:string} expected";
|
|
1045
|
+
}
|
|
1046
|
+
if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
|
|
1047
|
+
if (!$util.isString(message.defaultDatabase))
|
|
1048
|
+
return "defaultDatabase: string expected";
|
|
1049
|
+
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
|
|
1050
|
+
if (!$util.isString(message.defaultLocation))
|
|
1051
|
+
return "defaultLocation: string expected";
|
|
1052
|
+
if (message.credentials != null && message.hasOwnProperty("credentials"))
|
|
1053
|
+
if (!$util.isString(message.credentials))
|
|
1054
|
+
return "credentials: string expected";
|
|
1055
|
+
return null;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Creates an Environment message from a plain object. Also converts values to their respective internal types.
|
|
1060
|
+
* @function fromObject
|
|
1061
|
+
* @memberof sqlanvil.Environment
|
|
1062
|
+
* @static
|
|
1063
|
+
* @param {Object.<string,*>} object Plain object
|
|
1064
|
+
* @returns {sqlanvil.Environment} Environment
|
|
1065
|
+
*/
|
|
1066
|
+
Environment.fromObject = function fromObject(object) {
|
|
1067
|
+
if (object instanceof $root.sqlanvil.Environment)
|
|
1068
|
+
return object;
|
|
1069
|
+
let message = new $root.sqlanvil.Environment();
|
|
1070
|
+
if (object.schemaSuffix != null)
|
|
1071
|
+
message.schemaSuffix = String(object.schemaSuffix);
|
|
1072
|
+
if (object.vars) {
|
|
1073
|
+
if (typeof object.vars !== "object")
|
|
1074
|
+
throw TypeError(".sqlanvil.Environment.vars: object expected");
|
|
1075
|
+
message.vars = {};
|
|
1076
|
+
for (let keys = Object.keys(object.vars), i = 0; i < keys.length; ++i)
|
|
1077
|
+
message.vars[keys[i]] = String(object.vars[keys[i]]);
|
|
1078
|
+
}
|
|
1079
|
+
if (object.defaultDatabase != null)
|
|
1080
|
+
message.defaultDatabase = String(object.defaultDatabase);
|
|
1081
|
+
if (object.defaultLocation != null)
|
|
1082
|
+
message.defaultLocation = String(object.defaultLocation);
|
|
1083
|
+
if (object.credentials != null)
|
|
1084
|
+
message.credentials = String(object.credentials);
|
|
1085
|
+
return message;
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Creates a plain object from an Environment message. Also converts values to other types if specified.
|
|
1090
|
+
* @function toObject
|
|
1091
|
+
* @memberof sqlanvil.Environment
|
|
1092
|
+
* @static
|
|
1093
|
+
* @param {sqlanvil.Environment} message Environment
|
|
1094
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1095
|
+
* @returns {Object.<string,*>} Plain object
|
|
1096
|
+
*/
|
|
1097
|
+
Environment.toObject = function toObject(message, options) {
|
|
1098
|
+
if (!options)
|
|
1099
|
+
options = {};
|
|
1100
|
+
let object = {};
|
|
1101
|
+
if (options.objects || options.defaults)
|
|
1102
|
+
object.vars = {};
|
|
1103
|
+
if (options.defaults) {
|
|
1104
|
+
object.schemaSuffix = "";
|
|
1105
|
+
object.defaultDatabase = "";
|
|
1106
|
+
object.defaultLocation = "";
|
|
1107
|
+
object.credentials = "";
|
|
1108
|
+
}
|
|
1109
|
+
if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
|
|
1110
|
+
object.schemaSuffix = message.schemaSuffix;
|
|
1111
|
+
let keys2;
|
|
1112
|
+
if (message.vars && (keys2 = Object.keys(message.vars)).length) {
|
|
1113
|
+
object.vars = {};
|
|
1114
|
+
for (let j = 0; j < keys2.length; ++j)
|
|
1115
|
+
object.vars[keys2[j]] = message.vars[keys2[j]];
|
|
1116
|
+
}
|
|
1117
|
+
if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
|
|
1118
|
+
object.defaultDatabase = message.defaultDatabase;
|
|
1119
|
+
if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
|
|
1120
|
+
object.defaultLocation = message.defaultLocation;
|
|
1121
|
+
if (message.credentials != null && message.hasOwnProperty("credentials"))
|
|
1122
|
+
object.credentials = message.credentials;
|
|
1123
|
+
return object;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Converts this Environment to JSON.
|
|
1128
|
+
* @function toJSON
|
|
1129
|
+
* @memberof sqlanvil.Environment
|
|
1130
|
+
* @instance
|
|
1131
|
+
* @returns {Object.<string,*>} JSON object
|
|
1132
|
+
*/
|
|
1133
|
+
Environment.prototype.toJSON = function toJSON() {
|
|
1134
|
+
return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Gets the default type url for Environment
|
|
1139
|
+
* @function getTypeUrl
|
|
1140
|
+
* @memberof sqlanvil.Environment
|
|
1141
|
+
* @static
|
|
1142
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
1143
|
+
* @returns {string} The default type url
|
|
1144
|
+
*/
|
|
1145
|
+
Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
1146
|
+
if (typeUrlPrefix === undefined) {
|
|
1147
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
1148
|
+
}
|
|
1149
|
+
return typeUrlPrefix + "/sqlanvil.Environment";
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
return Environment;
|
|
1153
|
+
})();
|
|
1154
|
+
|
|
757
1155
|
sqlanvil.ConnectionConfig = (function() {
|
|
758
1156
|
|
|
759
1157
|
/**
|