Skip to content

Commit

Permalink
feat: sql database support (#227)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Holm <[email protected]>
  • Loading branch information
davemooreuws and tjholm committed Jun 11, 2024
1 parent be2bf09 commit 24e97f2
Show file tree
Hide file tree
Showing 11 changed files with 1,345 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nitric/sdk",
"description": "Nitric NodeJS client sdk",
"nitric": "v1.1.0",
"nitric": "v1.6.0",
"author": "Nitric <https://github.com/nitrictech>",
"repository": "https://github.com/nitrictech/node-sdk",
"main": "lib/index.js",
Expand Down
35 changes: 35 additions & 0 deletions src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,34 @@ export namespace Schedule {
}
}

export class SqlDatabase extends jspb.Message {
hasImageUri(): boolean;
clearImageUri(): void;
getImageUri(): string;
setImageUri(value: string): void;

getMigrationsCase(): SqlDatabase.MigrationsCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): SqlDatabase.AsObject;
static toObject(includeInstance: boolean, msg: SqlDatabase): SqlDatabase.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: SqlDatabase, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): SqlDatabase;
static deserializeBinaryFromReader(message: SqlDatabase, reader: jspb.BinaryReader): SqlDatabase;
}

export namespace SqlDatabase {
export type AsObject = {
imageUri: string,
}

export enum MigrationsCase {
MIGRATIONS_NOT_SET = 0,
IMAGE_URI = 1,
}
}

export class ScheduleEvery extends jspb.Message {
getRate(): string;
setRate(value: string): void;
Expand Down Expand Up @@ -787,6 +815,11 @@ export class Resource extends jspb.Message {
getQueue(): Queue | undefined;
setQueue(value?: Queue): void;

hasSqlDatabase(): boolean;
clearSqlDatabase(): void;
getSqlDatabase(): SqlDatabase | undefined;
setSqlDatabase(value?: SqlDatabase): void;

getConfigCase(): Resource.ConfigCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Resource.AsObject;
Expand All @@ -812,6 +845,7 @@ export namespace Resource {
websocket?: Websocket.AsObject,
http?: Http.AsObject,
queue?: Queue.AsObject,
sqlDatabase?: SqlDatabase.AsObject,
}

export enum ConfigCase {
Expand All @@ -827,6 +861,7 @@ export namespace Resource {
WEBSOCKET = 18,
HTTP = 19,
QUEUE = 20,
SQL_DATABASE = 21,
}
}

Expand Down
254 changes: 251 additions & 3 deletions src/gen/nitric/proto/deployments/v1/deployments_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ goog.exportSymbol('proto.nitric.proto.deployments.v1.Secret', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.Service', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.Service.SourceCase', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.Spec', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.SqlDatabase', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.SqlDatabase.MigrationsCase', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.SubscriptionTarget', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.SubscriptionTarget.TargetCase', null, global);
goog.exportSymbol('proto.nitric.proto.deployments.v1.Topic', null, global);
Expand Down Expand Up @@ -574,6 +576,27 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.nitric.proto.deployments.v1.Schedule.displayName = 'proto.nitric.proto.deployments.v1.Schedule';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.nitric.proto.deployments.v1.SqlDatabase = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.nitric.proto.deployments.v1.SqlDatabase.oneofGroups_);
};
goog.inherits(proto.nitric.proto.deployments.v1.SqlDatabase, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.nitric.proto.deployments.v1.SqlDatabase.displayName = 'proto.nitric.proto.deployments.v1.SqlDatabase';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
Expand Down Expand Up @@ -5227,6 +5250,179 @@ proto.nitric.proto.deployments.v1.Schedule.prototype.hasCron = function() {



/**
* Oneof group definitions for this message. Each group defines the field
* numbers belonging to that group. When of these fields' value is set, all
* other fields in the group are cleared. During deserialization, if multiple
* fields are encountered for a group, only the last value seen will be kept.
* @private {!Array<!Array<number>>}
* @const
*/
proto.nitric.proto.deployments.v1.SqlDatabase.oneofGroups_ = [[1]];

/**
* @enum {number}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.MigrationsCase = {
MIGRATIONS_NOT_SET: 0,
IMAGE_URI: 1
};

/**
* @return {proto.nitric.proto.deployments.v1.SqlDatabase.MigrationsCase}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.getMigrationsCase = function() {
return /** @type {proto.nitric.proto.deployments.v1.SqlDatabase.MigrationsCase} */(jspb.Message.computeOneofCase(this, proto.nitric.proto.deployments.v1.SqlDatabase.oneofGroups_[0]));
};



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.toObject = function(opt_includeInstance) {
return proto.nitric.proto.deployments.v1.SqlDatabase.toObject(opt_includeInstance, this);
};


/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.nitric.proto.deployments.v1.SqlDatabase} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.nitric.proto.deployments.v1.SqlDatabase.toObject = function(includeInstance, msg) {
var f, obj = {
imageUri: jspb.Message.getFieldWithDefault(msg, 1, "")
};

if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}


/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.nitric.proto.deployments.v1.SqlDatabase}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.nitric.proto.deployments.v1.SqlDatabase;
return proto.nitric.proto.deployments.v1.SqlDatabase.deserializeBinaryFromReader(msg, reader);
};


/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.nitric.proto.deployments.v1.SqlDatabase} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.nitric.proto.deployments.v1.SqlDatabase}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setImageUri(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};


/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.nitric.proto.deployments.v1.SqlDatabase.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};


/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.nitric.proto.deployments.v1.SqlDatabase} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.nitric.proto.deployments.v1.SqlDatabase.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = /** @type {string} */ (jspb.Message.getField(message, 1));
if (f != null) {
writer.writeString(
1,
f
);
}
};


/**
* optional string image_uri = 1;
* @return {string}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.getImageUri = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};


/**
* @param {string} value
* @return {!proto.nitric.proto.deployments.v1.SqlDatabase} returns this
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.setImageUri = function(value) {
return jspb.Message.setOneofField(this, 1, proto.nitric.proto.deployments.v1.SqlDatabase.oneofGroups_[0], value);
};


/**
* Clears the field making it undefined.
* @return {!proto.nitric.proto.deployments.v1.SqlDatabase} returns this
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.clearImageUri = function() {
return jspb.Message.setOneofField(this, 1, proto.nitric.proto.deployments.v1.SqlDatabase.oneofGroups_[0], undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.nitric.proto.deployments.v1.SqlDatabase.prototype.hasImageUri = function() {
return jspb.Message.getField(this, 1) != null;
};





if (jspb.Message.GENERATE_TO_OBJECT) {
Expand Down Expand Up @@ -5495,7 +5691,7 @@ proto.nitric.proto.deployments.v1.ScheduleCron.prototype.setExpression = functio
* @private {!Array<!Array<number>>}
* @const
*/
proto.nitric.proto.deployments.v1.Resource.oneofGroups_ = [[10,11,12,13,14,15,16,17,18,19,20]];
proto.nitric.proto.deployments.v1.Resource.oneofGroups_ = [[10,11,12,13,14,15,16,17,18,19,20,21]];

/**
* @enum {number}
Expand All @@ -5512,7 +5708,8 @@ proto.nitric.proto.deployments.v1.Resource.ConfigCase = {
SECRET: 17,
WEBSOCKET: 18,
HTTP: 19,
QUEUE: 20
QUEUE: 20,
SQL_DATABASE: 21
};

/**
Expand Down Expand Up @@ -5564,7 +5761,8 @@ proto.nitric.proto.deployments.v1.Resource.toObject = function(includeInstance,
secret: (f = msg.getSecret()) && proto.nitric.proto.deployments.v1.Secret.toObject(includeInstance, f),
websocket: (f = msg.getWebsocket()) && proto.nitric.proto.deployments.v1.Websocket.toObject(includeInstance, f),
http: (f = msg.getHttp()) && proto.nitric.proto.deployments.v1.Http.toObject(includeInstance, f),
queue: (f = msg.getQueue()) && proto.nitric.proto.deployments.v1.Queue.toObject(includeInstance, f)
queue: (f = msg.getQueue()) && proto.nitric.proto.deployments.v1.Queue.toObject(includeInstance, f),
sqlDatabase: (f = msg.getSqlDatabase()) && proto.nitric.proto.deployments.v1.SqlDatabase.toObject(includeInstance, f)
};

if (includeInstance) {
Expand Down Expand Up @@ -5661,6 +5859,11 @@ proto.nitric.proto.deployments.v1.Resource.deserializeBinaryFromReader = functio
reader.readMessage(value,proto.nitric.proto.deployments.v1.Queue.deserializeBinaryFromReader);
msg.setQueue(value);
break;
case 21:
var value = new proto.nitric.proto.deployments.v1.SqlDatabase;
reader.readMessage(value,proto.nitric.proto.deployments.v1.SqlDatabase.deserializeBinaryFromReader);
msg.setSqlDatabase(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -5786,6 +5989,14 @@ proto.nitric.proto.deployments.v1.Resource.serializeBinaryToWriter = function(me
proto.nitric.proto.deployments.v1.Queue.serializeBinaryToWriter
);
}
f = message.getSqlDatabase();
if (f != null) {
writer.writeMessage(
21,
f,
proto.nitric.proto.deployments.v1.SqlDatabase.serializeBinaryToWriter
);
}
};


Expand Down Expand Up @@ -6233,6 +6444,43 @@ proto.nitric.proto.deployments.v1.Resource.prototype.hasQueue = function() {
};


/**
* optional SqlDatabase sql_database = 21;
* @return {?proto.nitric.proto.deployments.v1.SqlDatabase}
*/
proto.nitric.proto.deployments.v1.Resource.prototype.getSqlDatabase = function() {
return /** @type{?proto.nitric.proto.deployments.v1.SqlDatabase} */ (
jspb.Message.getWrapperField(this, proto.nitric.proto.deployments.v1.SqlDatabase, 21));
};


/**
* @param {?proto.nitric.proto.deployments.v1.SqlDatabase|undefined} value
* @return {!proto.nitric.proto.deployments.v1.Resource} returns this
*/
proto.nitric.proto.deployments.v1.Resource.prototype.setSqlDatabase = function(value) {
return jspb.Message.setOneofWrapperField(this, 21, proto.nitric.proto.deployments.v1.Resource.oneofGroups_[0], value);
};


/**
* Clears the message field making it undefined.
* @return {!proto.nitric.proto.deployments.v1.Resource} returns this
*/
proto.nitric.proto.deployments.v1.Resource.prototype.clearSqlDatabase = function() {
return this.setSqlDatabase(undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.nitric.proto.deployments.v1.Resource.prototype.hasSqlDatabase = function() {
return jspb.Message.getField(this, 21) != null;
};



/**
* List of repeated fields within this message type.
Expand Down
Loading

0 comments on commit 24e97f2

Please sign in to comment.