@sqlanvil/cli 1.4.0 → 1.5.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/package.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "js-beautify": "^1.10.2",
10
10
  "js-yaml": "^4.1.1",
11
11
  "moo": "^0.5.0",
12
+ "mysql2": "^3.11.0",
12
13
  "object-sizeof": "^1.6.1",
13
14
  "parse-duration": "^1.0.0",
14
15
  "pg": "^8.11.3",
@@ -61,7 +62,7 @@
61
62
  "bin": {
62
63
  "sqlanvil": "bundle.js"
63
64
  },
64
- "version": "1.4.0",
65
+ "version": "1.5.0",
65
66
  "name": "@sqlanvil/cli",
66
67
  "description": "sqlanvil command line interface.",
67
68
  "main": "bundle.js"
package/worker_bundle.js CHANGED
@@ -14892,6 +14892,327 @@ const sqlanvil = $root.sqlanvil = (() => {
14892
14892
  return SupabaseConnection;
14893
14893
  })();
14894
14894
 
14895
+ sqlanvil.MysqlConnection = (function() {
14896
+
14897
+ /**
14898
+ * Properties of a MysqlConnection.
14899
+ * @memberof sqlanvil
14900
+ * @interface IMysqlConnection
14901
+ * @property {string|null} [host] MysqlConnection host
14902
+ * @property {number|null} [port] MysqlConnection port
14903
+ * @property {string|null} [database] MysqlConnection database
14904
+ * @property {string|null} [user] MysqlConnection user
14905
+ * @property {string|null} [password] MysqlConnection password
14906
+ * @property {string|null} [sslMode] MysqlConnection sslMode
14907
+ */
14908
+
14909
+ /**
14910
+ * Constructs a new MysqlConnection.
14911
+ * @memberof sqlanvil
14912
+ * @classdesc Represents a MysqlConnection.
14913
+ * @implements IMysqlConnection
14914
+ * @constructor
14915
+ * @param {sqlanvil.IMysqlConnection=} [properties] Properties to set
14916
+ */
14917
+ function MysqlConnection(properties) {
14918
+ if (properties)
14919
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
14920
+ if (properties[keys[i]] != null)
14921
+ this[keys[i]] = properties[keys[i]];
14922
+ }
14923
+
14924
+ /**
14925
+ * MysqlConnection host.
14926
+ * @member {string} host
14927
+ * @memberof sqlanvil.MysqlConnection
14928
+ * @instance
14929
+ */
14930
+ MysqlConnection.prototype.host = "";
14931
+
14932
+ /**
14933
+ * MysqlConnection port.
14934
+ * @member {number} port
14935
+ * @memberof sqlanvil.MysqlConnection
14936
+ * @instance
14937
+ */
14938
+ MysqlConnection.prototype.port = 0;
14939
+
14940
+ /**
14941
+ * MysqlConnection database.
14942
+ * @member {string} database
14943
+ * @memberof sqlanvil.MysqlConnection
14944
+ * @instance
14945
+ */
14946
+ MysqlConnection.prototype.database = "";
14947
+
14948
+ /**
14949
+ * MysqlConnection user.
14950
+ * @member {string} user
14951
+ * @memberof sqlanvil.MysqlConnection
14952
+ * @instance
14953
+ */
14954
+ MysqlConnection.prototype.user = "";
14955
+
14956
+ /**
14957
+ * MysqlConnection password.
14958
+ * @member {string} password
14959
+ * @memberof sqlanvil.MysqlConnection
14960
+ * @instance
14961
+ */
14962
+ MysqlConnection.prototype.password = "";
14963
+
14964
+ /**
14965
+ * MysqlConnection sslMode.
14966
+ * @member {string} sslMode
14967
+ * @memberof sqlanvil.MysqlConnection
14968
+ * @instance
14969
+ */
14970
+ MysqlConnection.prototype.sslMode = "";
14971
+
14972
+ /**
14973
+ * Creates a new MysqlConnection instance using the specified properties.
14974
+ * @function create
14975
+ * @memberof sqlanvil.MysqlConnection
14976
+ * @static
14977
+ * @param {sqlanvil.IMysqlConnection=} [properties] Properties to set
14978
+ * @returns {sqlanvil.MysqlConnection} MysqlConnection instance
14979
+ */
14980
+ MysqlConnection.create = function create(properties) {
14981
+ return new MysqlConnection(properties);
14982
+ };
14983
+
14984
+ /**
14985
+ * Encodes the specified MysqlConnection message. Does not implicitly {@link sqlanvil.MysqlConnection.verify|verify} messages.
14986
+ * @function encode
14987
+ * @memberof sqlanvil.MysqlConnection
14988
+ * @static
14989
+ * @param {sqlanvil.IMysqlConnection} message MysqlConnection message or plain object to encode
14990
+ * @param {$protobuf.Writer} [writer] Writer to encode to
14991
+ * @returns {$protobuf.Writer} Writer
14992
+ */
14993
+ MysqlConnection.encode = function encode(message, writer) {
14994
+ if (!writer)
14995
+ writer = $Writer.create();
14996
+ if (message.host != null && Object.hasOwnProperty.call(message, "host"))
14997
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.host);
14998
+ if (message.port != null && Object.hasOwnProperty.call(message, "port"))
14999
+ writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.port);
15000
+ if (message.database != null && Object.hasOwnProperty.call(message, "database"))
15001
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.database);
15002
+ if (message.user != null && Object.hasOwnProperty.call(message, "user"))
15003
+ writer.uint32(/* id 4, wireType 2 =*/34).string(message.user);
15004
+ if (message.password != null && Object.hasOwnProperty.call(message, "password"))
15005
+ writer.uint32(/* id 5, wireType 2 =*/42).string(message.password);
15006
+ if (message.sslMode != null && Object.hasOwnProperty.call(message, "sslMode"))
15007
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.sslMode);
15008
+ return writer;
15009
+ };
15010
+
15011
+ /**
15012
+ * Encodes the specified MysqlConnection message, length delimited. Does not implicitly {@link sqlanvil.MysqlConnection.verify|verify} messages.
15013
+ * @function encodeDelimited
15014
+ * @memberof sqlanvil.MysqlConnection
15015
+ * @static
15016
+ * @param {sqlanvil.IMysqlConnection} message MysqlConnection message or plain object to encode
15017
+ * @param {$protobuf.Writer} [writer] Writer to encode to
15018
+ * @returns {$protobuf.Writer} Writer
15019
+ */
15020
+ MysqlConnection.encodeDelimited = function encodeDelimited(message, writer) {
15021
+ return this.encode(message, writer).ldelim();
15022
+ };
15023
+
15024
+ /**
15025
+ * Decodes a MysqlConnection message from the specified reader or buffer.
15026
+ * @function decode
15027
+ * @memberof sqlanvil.MysqlConnection
15028
+ * @static
15029
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
15030
+ * @param {number} [length] Message length if known beforehand
15031
+ * @returns {sqlanvil.MysqlConnection} MysqlConnection
15032
+ * @throws {Error} If the payload is not a reader or valid buffer
15033
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
15034
+ */
15035
+ MysqlConnection.decode = function decode(reader, length, error) {
15036
+ if (!(reader instanceof $Reader))
15037
+ reader = $Reader.create(reader);
15038
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.MysqlConnection();
15039
+ while (reader.pos < end) {
15040
+ let tag = reader.uint32();
15041
+ if (tag === error)
15042
+ break;
15043
+ switch (tag >>> 3) {
15044
+ case 1: {
15045
+ message.host = reader.string();
15046
+ break;
15047
+ }
15048
+ case 2: {
15049
+ message.port = reader.uint32();
15050
+ break;
15051
+ }
15052
+ case 3: {
15053
+ message.database = reader.string();
15054
+ break;
15055
+ }
15056
+ case 4: {
15057
+ message.user = reader.string();
15058
+ break;
15059
+ }
15060
+ case 5: {
15061
+ message.password = reader.string();
15062
+ break;
15063
+ }
15064
+ case 6: {
15065
+ message.sslMode = reader.string();
15066
+ break;
15067
+ }
15068
+ default:
15069
+ reader.skipType(tag & 7);
15070
+ break;
15071
+ }
15072
+ }
15073
+ return message;
15074
+ };
15075
+
15076
+ /**
15077
+ * Decodes a MysqlConnection message from the specified reader or buffer, length delimited.
15078
+ * @function decodeDelimited
15079
+ * @memberof sqlanvil.MysqlConnection
15080
+ * @static
15081
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
15082
+ * @returns {sqlanvil.MysqlConnection} MysqlConnection
15083
+ * @throws {Error} If the payload is not a reader or valid buffer
15084
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
15085
+ */
15086
+ MysqlConnection.decodeDelimited = function decodeDelimited(reader) {
15087
+ if (!(reader instanceof $Reader))
15088
+ reader = new $Reader(reader);
15089
+ return this.decode(reader, reader.uint32());
15090
+ };
15091
+
15092
+ /**
15093
+ * Verifies a MysqlConnection message.
15094
+ * @function verify
15095
+ * @memberof sqlanvil.MysqlConnection
15096
+ * @static
15097
+ * @param {Object.<string,*>} message Plain object to verify
15098
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
15099
+ */
15100
+ MysqlConnection.verify = function verify(message) {
15101
+ if (typeof message !== "object" || message === null)
15102
+ return "object expected";
15103
+ if (message.host != null && message.hasOwnProperty("host"))
15104
+ if (!$util.isString(message.host))
15105
+ return "host: string expected";
15106
+ if (message.port != null && message.hasOwnProperty("port"))
15107
+ if (!$util.isInteger(message.port))
15108
+ return "port: integer expected";
15109
+ if (message.database != null && message.hasOwnProperty("database"))
15110
+ if (!$util.isString(message.database))
15111
+ return "database: string expected";
15112
+ if (message.user != null && message.hasOwnProperty("user"))
15113
+ if (!$util.isString(message.user))
15114
+ return "user: string expected";
15115
+ if (message.password != null && message.hasOwnProperty("password"))
15116
+ if (!$util.isString(message.password))
15117
+ return "password: string expected";
15118
+ if (message.sslMode != null && message.hasOwnProperty("sslMode"))
15119
+ if (!$util.isString(message.sslMode))
15120
+ return "sslMode: string expected";
15121
+ return null;
15122
+ };
15123
+
15124
+ /**
15125
+ * Creates a MysqlConnection message from a plain object. Also converts values to their respective internal types.
15126
+ * @function fromObject
15127
+ * @memberof sqlanvil.MysqlConnection
15128
+ * @static
15129
+ * @param {Object.<string,*>} object Plain object
15130
+ * @returns {sqlanvil.MysqlConnection} MysqlConnection
15131
+ */
15132
+ MysqlConnection.fromObject = function fromObject(object) {
15133
+ if (object instanceof $root.sqlanvil.MysqlConnection)
15134
+ return object;
15135
+ let message = new $root.sqlanvil.MysqlConnection();
15136
+ if (object.host != null)
15137
+ message.host = String(object.host);
15138
+ if (object.port != null)
15139
+ message.port = object.port >>> 0;
15140
+ if (object.database != null)
15141
+ message.database = String(object.database);
15142
+ if (object.user != null)
15143
+ message.user = String(object.user);
15144
+ if (object.password != null)
15145
+ message.password = String(object.password);
15146
+ if (object.sslMode != null)
15147
+ message.sslMode = String(object.sslMode);
15148
+ return message;
15149
+ };
15150
+
15151
+ /**
15152
+ * Creates a plain object from a MysqlConnection message. Also converts values to other types if specified.
15153
+ * @function toObject
15154
+ * @memberof sqlanvil.MysqlConnection
15155
+ * @static
15156
+ * @param {sqlanvil.MysqlConnection} message MysqlConnection
15157
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
15158
+ * @returns {Object.<string,*>} Plain object
15159
+ */
15160
+ MysqlConnection.toObject = function toObject(message, options) {
15161
+ if (!options)
15162
+ options = {};
15163
+ let object = {};
15164
+ if (options.defaults) {
15165
+ object.host = "";
15166
+ object.port = 0;
15167
+ object.database = "";
15168
+ object.user = "";
15169
+ object.password = "";
15170
+ object.sslMode = "";
15171
+ }
15172
+ if (message.host != null && message.hasOwnProperty("host"))
15173
+ object.host = message.host;
15174
+ if (message.port != null && message.hasOwnProperty("port"))
15175
+ object.port = message.port;
15176
+ if (message.database != null && message.hasOwnProperty("database"))
15177
+ object.database = message.database;
15178
+ if (message.user != null && message.hasOwnProperty("user"))
15179
+ object.user = message.user;
15180
+ if (message.password != null && message.hasOwnProperty("password"))
15181
+ object.password = message.password;
15182
+ if (message.sslMode != null && message.hasOwnProperty("sslMode"))
15183
+ object.sslMode = message.sslMode;
15184
+ return object;
15185
+ };
15186
+
15187
+ /**
15188
+ * Converts this MysqlConnection to JSON.
15189
+ * @function toJSON
15190
+ * @memberof sqlanvil.MysqlConnection
15191
+ * @instance
15192
+ * @returns {Object.<string,*>} JSON object
15193
+ */
15194
+ MysqlConnection.prototype.toJSON = function toJSON() {
15195
+ return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
15196
+ };
15197
+
15198
+ /**
15199
+ * Gets the default type url for MysqlConnection
15200
+ * @function getTypeUrl
15201
+ * @memberof sqlanvil.MysqlConnection
15202
+ * @static
15203
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
15204
+ * @returns {string} The default type url
15205
+ */
15206
+ MysqlConnection.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
15207
+ if (typeUrlPrefix === undefined) {
15208
+ typeUrlPrefix = "type.googleapis.com";
15209
+ }
15210
+ return typeUrlPrefix + "/sqlanvil.MysqlConnection";
15211
+ };
15212
+
15213
+ return MysqlConnection;
15214
+ })();
15215
+
14895
15216
  sqlanvil.WarehouseConfig = (function() {
14896
15217
 
14897
15218
  /**
@@ -14901,6 +15222,7 @@ const sqlanvil = $root.sqlanvil = (() => {
14901
15222
  * @property {sqlanvil.IBigQueryConnection|null} [bigquery] WarehouseConfig bigquery
14902
15223
  * @property {sqlanvil.IPostgresConnection|null} [postgres] WarehouseConfig postgres
14903
15224
  * @property {sqlanvil.ISupabaseConnection|null} [supabase] WarehouseConfig supabase
15225
+ * @property {sqlanvil.IMysqlConnection|null} [mysql] WarehouseConfig mysql
14904
15226
  */
14905
15227
 
14906
15228
  /**
@@ -14942,17 +15264,25 @@ const sqlanvil = $root.sqlanvil = (() => {
14942
15264
  */
14943
15265
  WarehouseConfig.prototype.supabase = null;
14944
15266
 
15267
+ /**
15268
+ * WarehouseConfig mysql.
15269
+ * @member {sqlanvil.IMysqlConnection|null|undefined} mysql
15270
+ * @memberof sqlanvil.WarehouseConfig
15271
+ * @instance
15272
+ */
15273
+ WarehouseConfig.prototype.mysql = null;
15274
+
14945
15275
  // OneOf field names bound to virtual getters and setters
14946
15276
  let $oneOfFields;
14947
15277
 
14948
15278
  /**
14949
15279
  * WarehouseConfig connection.
14950
- * @member {"bigquery"|"postgres"|"supabase"|undefined} connection
15280
+ * @member {"bigquery"|"postgres"|"supabase"|"mysql"|undefined} connection
14951
15281
  * @memberof sqlanvil.WarehouseConfig
14952
15282
  * @instance
14953
15283
  */
14954
15284
  Object.defineProperty(WarehouseConfig.prototype, "connection", {
14955
- get: $util.oneOfGetter($oneOfFields = ["bigquery", "postgres", "supabase"]),
15285
+ get: $util.oneOfGetter($oneOfFields = ["bigquery", "postgres", "supabase", "mysql"]),
14956
15286
  set: $util.oneOfSetter($oneOfFields)
14957
15287
  });
14958
15288
 
@@ -14986,6 +15316,8 @@ const sqlanvil = $root.sqlanvil = (() => {
14986
15316
  $root.sqlanvil.PostgresConnection.encode(message.postgres, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
14987
15317
  if (message.supabase != null && Object.hasOwnProperty.call(message, "supabase"))
14988
15318
  $root.sqlanvil.SupabaseConnection.encode(message.supabase, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
15319
+ if (message.mysql != null && Object.hasOwnProperty.call(message, "mysql"))
15320
+ $root.sqlanvil.MysqlConnection.encode(message.mysql, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
14989
15321
  return writer;
14990
15322
  };
14991
15323
 
@@ -15034,6 +15366,10 @@ const sqlanvil = $root.sqlanvil = (() => {
15034
15366
  message.supabase = $root.sqlanvil.SupabaseConnection.decode(reader, reader.uint32());
15035
15367
  break;
15036
15368
  }
15369
+ case 4: {
15370
+ message.mysql = $root.sqlanvil.MysqlConnection.decode(reader, reader.uint32());
15371
+ break;
15372
+ }
15037
15373
  default:
15038
15374
  reader.skipType(tag & 7);
15039
15375
  break;
@@ -15098,6 +15434,16 @@ const sqlanvil = $root.sqlanvil = (() => {
15098
15434
  return "supabase." + error;
15099
15435
  }
15100
15436
  }
15437
+ if (message.mysql != null && message.hasOwnProperty("mysql")) {
15438
+ if (properties.connection === 1)
15439
+ return "connection: multiple values";
15440
+ properties.connection = 1;
15441
+ {
15442
+ let error = $root.sqlanvil.MysqlConnection.verify(message.mysql);
15443
+ if (error)
15444
+ return "mysql." + error;
15445
+ }
15446
+ }
15101
15447
  return null;
15102
15448
  };
15103
15449
 
@@ -15128,6 +15474,11 @@ const sqlanvil = $root.sqlanvil = (() => {
15128
15474
  throw TypeError(".sqlanvil.WarehouseConfig.supabase: object expected");
15129
15475
  message.supabase = $root.sqlanvil.SupabaseConnection.fromObject(object.supabase);
15130
15476
  }
15477
+ if (object.mysql != null) {
15478
+ if (typeof object.mysql !== "object")
15479
+ throw TypeError(".sqlanvil.WarehouseConfig.mysql: object expected");
15480
+ message.mysql = $root.sqlanvil.MysqlConnection.fromObject(object.mysql);
15481
+ }
15131
15482
  return message;
15132
15483
  };
15133
15484
 
@@ -15159,6 +15510,11 @@ const sqlanvil = $root.sqlanvil = (() => {
15159
15510
  if (options.oneofs)
15160
15511
  object.connection = "supabase";
15161
15512
  }
15513
+ if (message.mysql != null && message.hasOwnProperty("mysql")) {
15514
+ object.mysql = $root.sqlanvil.MysqlConnection.toObject(message.mysql, options);
15515
+ if (options.oneofs)
15516
+ object.connection = "mysql";
15517
+ }
15162
15518
  return object;
15163
15519
  };
15164
15520