From 7198c266f6dcc8413c287b6803141666a0b8d102 Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 3 Sep 2024 10:19:08 +1000 Subject: [PATCH 1/9] contract updates for batch --- .../nitric/proto/batch/v1/batch_grpc_pb.d.ts | 40 + .../nitric/proto/batch/v1/batch_grpc_pb.js | 84 + src/gen/nitric/proto/batch/v1/batch_pb.d.ts | 270 +++ src/gen/nitric/proto/batch/v1/batch_pb.js | 2006 +++++++++++++++++ .../deployments/v1/deployments_grpc_pb.js | 1 + .../proto/deployments/v1/deployments_pb.d.ts | 75 + .../proto/deployments/v1/deployments_pb.js | 585 ++++- .../proto/resources/v1/resources_pb.d.ts | 26 + .../nitric/proto/resources/v1/resources_pb.js | 188 +- 9 files changed, 3267 insertions(+), 8 deletions(-) create mode 100644 src/gen/nitric/proto/batch/v1/batch_grpc_pb.d.ts create mode 100644 src/gen/nitric/proto/batch/v1/batch_grpc_pb.js create mode 100644 src/gen/nitric/proto/batch/v1/batch_pb.d.ts create mode 100644 src/gen/nitric/proto/batch/v1/batch_pb.js diff --git a/src/gen/nitric/proto/batch/v1/batch_grpc_pb.d.ts b/src/gen/nitric/proto/batch/v1/batch_grpc_pb.d.ts new file mode 100644 index 0000000..db84428 --- /dev/null +++ b/src/gen/nitric/proto/batch/v1/batch_grpc_pb.d.ts @@ -0,0 +1,40 @@ +// GENERATED CODE -- DO NOT EDIT! + +// package: nitric.proto.batch.v1 +// file: nitric/proto/batch/v1/batch.proto + +import * as nitric_proto_batch_v1_batch_pb from "../../../../nitric/proto/batch/v1/batch_pb"; +import * as grpc from "@grpc/grpc-js"; + +interface IJobService extends grpc.ServiceDefinition { + handleJob: grpc.MethodDefinition; +} + +export const JobService: IJobService; + +export interface IJobServer extends grpc.UntypedServiceImplementation { + handleJob: grpc.handleBidiStreamingCall; +} + +export class JobClient extends grpc.Client { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); + handleJob(metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientDuplexStream; + handleJob(metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientDuplexStream; +} + +interface IBatchService extends grpc.ServiceDefinition { + submitJob: grpc.MethodDefinition; +} + +export const BatchService: IBatchService; + +export interface IBatchServer extends grpc.UntypedServiceImplementation { + submitJob: grpc.handleUnaryCall; +} + +export class BatchClient extends grpc.Client { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); + submitJob(argument: nitric_proto_batch_v1_batch_pb.JobSubmitRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + submitJob(argument: nitric_proto_batch_v1_batch_pb.JobSubmitRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + submitJob(argument: nitric_proto_batch_v1_batch_pb.JobSubmitRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; +} diff --git a/src/gen/nitric/proto/batch/v1/batch_grpc_pb.js b/src/gen/nitric/proto/batch/v1/batch_grpc_pb.js new file mode 100644 index 0000000..c68b45f --- /dev/null +++ b/src/gen/nitric/proto/batch/v1/batch_grpc_pb.js @@ -0,0 +1,84 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var grpc = require('@grpc/grpc-js'); +var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); +var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); + +function serialize_nitric_proto_batch_v1_ClientMessage(arg) { + if (!(arg instanceof nitric_proto_batch_v1_batch_pb.ClientMessage)) { + throw new Error('Expected argument of type nitric.proto.batch.v1.ClientMessage'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_nitric_proto_batch_v1_ClientMessage(buffer_arg) { + return nitric_proto_batch_v1_batch_pb.ClientMessage.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_nitric_proto_batch_v1_JobSubmitRequest(arg) { + if (!(arg instanceof nitric_proto_batch_v1_batch_pb.JobSubmitRequest)) { + throw new Error('Expected argument of type nitric.proto.batch.v1.JobSubmitRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_nitric_proto_batch_v1_JobSubmitRequest(buffer_arg) { + return nitric_proto_batch_v1_batch_pb.JobSubmitRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_nitric_proto_batch_v1_JobSubmitResponse(arg) { + if (!(arg instanceof nitric_proto_batch_v1_batch_pb.JobSubmitResponse)) { + throw new Error('Expected argument of type nitric.proto.batch.v1.JobSubmitResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_nitric_proto_batch_v1_JobSubmitResponse(buffer_arg) { + return nitric_proto_batch_v1_batch_pb.JobSubmitResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_nitric_proto_batch_v1_ServerMessage(arg) { + if (!(arg instanceof nitric_proto_batch_v1_batch_pb.ServerMessage)) { + throw new Error('Expected argument of type nitric.proto.batch.v1.ServerMessage'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_nitric_proto_batch_v1_ServerMessage(buffer_arg) { + return nitric_proto_batch_v1_batch_pb.ServerMessage.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +// Service for processing jobs +var JobService = exports.JobService = { + handleJob: { + path: '/nitric.proto.batch.v1.Job/HandleJob', + requestStream: true, + responseStream: true, + requestType: nitric_proto_batch_v1_batch_pb.ClientMessage, + responseType: nitric_proto_batch_v1_batch_pb.ServerMessage, + requestSerialize: serialize_nitric_proto_batch_v1_ClientMessage, + requestDeserialize: deserialize_nitric_proto_batch_v1_ClientMessage, + responseSerialize: serialize_nitric_proto_batch_v1_ServerMessage, + responseDeserialize: deserialize_nitric_proto_batch_v1_ServerMessage, + }, +}; + +exports.JobClient = grpc.makeGenericClientConstructor(JobService); +// Service for submitting jobs to be processed +var BatchService = exports.BatchService = { + submitJob: { + path: '/nitric.proto.batch.v1.Batch/SubmitJob', + requestStream: false, + responseStream: false, + requestType: nitric_proto_batch_v1_batch_pb.JobSubmitRequest, + responseType: nitric_proto_batch_v1_batch_pb.JobSubmitResponse, + requestSerialize: serialize_nitric_proto_batch_v1_JobSubmitRequest, + requestDeserialize: deserialize_nitric_proto_batch_v1_JobSubmitRequest, + responseSerialize: serialize_nitric_proto_batch_v1_JobSubmitResponse, + responseDeserialize: deserialize_nitric_proto_batch_v1_JobSubmitResponse, + }, +}; + +exports.BatchClient = grpc.makeGenericClientConstructor(BatchService); diff --git a/src/gen/nitric/proto/batch/v1/batch_pb.d.ts b/src/gen/nitric/proto/batch/v1/batch_pb.d.ts new file mode 100644 index 0000000..cd2f75d --- /dev/null +++ b/src/gen/nitric/proto/batch/v1/batch_pb.d.ts @@ -0,0 +1,270 @@ +// package: nitric.proto.batch.v1 +// file: nitric/proto/batch/v1/batch.proto + +import * as jspb from "google-protobuf"; +import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb"; + +export class ClientMessage extends jspb.Message { + getId(): string; + setId(value: string): void; + + hasRegistrationRequest(): boolean; + clearRegistrationRequest(): void; + getRegistrationRequest(): RegistrationRequest | undefined; + setRegistrationRequest(value?: RegistrationRequest): void; + + hasJobResponse(): boolean; + clearJobResponse(): void; + getJobResponse(): JobResponse | undefined; + setJobResponse(value?: JobResponse): void; + + getContentCase(): ClientMessage.ContentCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ClientMessage.AsObject; + static toObject(includeInstance: boolean, msg: ClientMessage): ClientMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ClientMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ClientMessage; + static deserializeBinaryFromReader(message: ClientMessage, reader: jspb.BinaryReader): ClientMessage; +} + +export namespace ClientMessage { + export type AsObject = { + id: string, + registrationRequest?: RegistrationRequest.AsObject, + jobResponse?: JobResponse.AsObject, + } + + export enum ContentCase { + CONTENT_NOT_SET = 0, + REGISTRATION_REQUEST = 2, + JOB_RESPONSE = 3, + } +} + +export class JobRequest extends jspb.Message { + getJobName(): string; + setJobName(value: string): void; + + hasData(): boolean; + clearData(): void; + getData(): JobData | undefined; + setData(value?: JobData): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobRequest.AsObject; + static toObject(includeInstance: boolean, msg: JobRequest): JobRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobRequest; + static deserializeBinaryFromReader(message: JobRequest, reader: jspb.BinaryReader): JobRequest; +} + +export namespace JobRequest { + export type AsObject = { + jobName: string, + data?: JobData.AsObject, + } +} + +export class JobData extends jspb.Message { + hasStruct(): boolean; + clearStruct(): void; + getStruct(): google_protobuf_struct_pb.Struct | undefined; + setStruct(value?: google_protobuf_struct_pb.Struct): void; + + getDataCase(): JobData.DataCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobData.AsObject; + static toObject(includeInstance: boolean, msg: JobData): JobData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobData; + static deserializeBinaryFromReader(message: JobData, reader: jspb.BinaryReader): JobData; +} + +export namespace JobData { + export type AsObject = { + struct?: google_protobuf_struct_pb.Struct.AsObject, + } + + export enum DataCase { + DATA_NOT_SET = 0, + STRUCT = 1, + } +} + +export class JobResponse extends jspb.Message { + getSuccess(): boolean; + setSuccess(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobResponse.AsObject; + static toObject(includeInstance: boolean, msg: JobResponse): JobResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobResponse; + static deserializeBinaryFromReader(message: JobResponse, reader: jspb.BinaryReader): JobResponse; +} + +export namespace JobResponse { + export type AsObject = { + success: boolean, + } +} + +export class RegistrationRequest extends jspb.Message { + getJobName(): string; + setJobName(value: string): void; + + hasRequirements(): boolean; + clearRequirements(): void; + getRequirements(): JobResourceRequirements | undefined; + setRequirements(value?: JobResourceRequirements): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RegistrationRequest.AsObject; + static toObject(includeInstance: boolean, msg: RegistrationRequest): RegistrationRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RegistrationRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RegistrationRequest; + static deserializeBinaryFromReader(message: RegistrationRequest, reader: jspb.BinaryReader): RegistrationRequest; +} + +export namespace RegistrationRequest { + export type AsObject = { + jobName: string, + requirements?: JobResourceRequirements.AsObject, + } +} + +export class RegistrationResponse extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RegistrationResponse.AsObject; + static toObject(includeInstance: boolean, msg: RegistrationResponse): RegistrationResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RegistrationResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RegistrationResponse; + static deserializeBinaryFromReader(message: RegistrationResponse, reader: jspb.BinaryReader): RegistrationResponse; +} + +export namespace RegistrationResponse { + export type AsObject = { + } +} + +export class JobResourceRequirements extends jspb.Message { + getCpus(): number; + setCpus(value: number): void; + + getMemory(): number; + setMemory(value: number): void; + + getGpus(): number; + setGpus(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobResourceRequirements.AsObject; + static toObject(includeInstance: boolean, msg: JobResourceRequirements): JobResourceRequirements.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobResourceRequirements, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobResourceRequirements; + static deserializeBinaryFromReader(message: JobResourceRequirements, reader: jspb.BinaryReader): JobResourceRequirements; +} + +export namespace JobResourceRequirements { + export type AsObject = { + cpus: number, + memory: number, + gpus: number, + } +} + +export class ServerMessage extends jspb.Message { + getId(): string; + setId(value: string): void; + + hasRegistrationResponse(): boolean; + clearRegistrationResponse(): void; + getRegistrationResponse(): RegistrationResponse | undefined; + setRegistrationResponse(value?: RegistrationResponse): void; + + hasJobRequest(): boolean; + clearJobRequest(): void; + getJobRequest(): JobRequest | undefined; + setJobRequest(value?: JobRequest): void; + + getContentCase(): ServerMessage.ContentCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ServerMessage.AsObject; + static toObject(includeInstance: boolean, msg: ServerMessage): ServerMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ServerMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServerMessage; + static deserializeBinaryFromReader(message: ServerMessage, reader: jspb.BinaryReader): ServerMessage; +} + +export namespace ServerMessage { + export type AsObject = { + id: string, + registrationResponse?: RegistrationResponse.AsObject, + jobRequest?: JobRequest.AsObject, + } + + export enum ContentCase { + CONTENT_NOT_SET = 0, + REGISTRATION_RESPONSE = 2, + JOB_REQUEST = 3, + } +} + +export class JobSubmitRequest extends jspb.Message { + getJobName(): string; + setJobName(value: string): void; + + hasData(): boolean; + clearData(): void; + getData(): JobData | undefined; + setData(value?: JobData): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobSubmitRequest.AsObject; + static toObject(includeInstance: boolean, msg: JobSubmitRequest): JobSubmitRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobSubmitRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobSubmitRequest; + static deserializeBinaryFromReader(message: JobSubmitRequest, reader: jspb.BinaryReader): JobSubmitRequest; +} + +export namespace JobSubmitRequest { + export type AsObject = { + jobName: string, + data?: JobData.AsObject, + } +} + +export class JobSubmitResponse extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobSubmitResponse.AsObject; + static toObject(includeInstance: boolean, msg: JobSubmitResponse): JobSubmitResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobSubmitResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobSubmitResponse; + static deserializeBinaryFromReader(message: JobSubmitResponse, reader: jspb.BinaryReader): JobSubmitResponse; +} + +export namespace JobSubmitResponse { + export type AsObject = { + } +} + diff --git a/src/gen/nitric/proto/batch/v1/batch_pb.js b/src/gen/nitric/proto/batch/v1/batch_pb.js new file mode 100644 index 0000000..cb5d2d6 --- /dev/null +++ b/src/gen/nitric/proto/batch/v1/batch_pb.js @@ -0,0 +1,2006 @@ +// source: nitric/proto/batch/v1/batch.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = (function() { + if (this) { return this; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + if (typeof self !== 'undefined') { return self; } + return Function('return this')(); +}.call(null)); + +var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); +goog.object.extend(proto, google_protobuf_struct_pb); +goog.exportSymbol('proto.nitric.proto.batch.v1.ClientMessage', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.ClientMessage.ContentCase', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobData', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobData.DataCase', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobRequest', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobResourceRequirements', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobResponse', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobSubmitRequest', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.JobSubmitResponse', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.RegistrationRequest', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.RegistrationResponse', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.ServerMessage', null, global); +goog.exportSymbol('proto.nitric.proto.batch.v1.ServerMessage.ContentCase', null, global); +/** + * 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.batch.v1.ClientMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.nitric.proto.batch.v1.ClientMessage.oneofGroups_); +}; +goog.inherits(proto.nitric.proto.batch.v1.ClientMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.ClientMessage.displayName = 'proto.nitric.proto.batch.v1.ClientMessage'; +} +/** + * 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.batch.v1.JobRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobRequest.displayName = 'proto.nitric.proto.batch.v1.JobRequest'; +} +/** + * 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.batch.v1.JobData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.nitric.proto.batch.v1.JobData.oneofGroups_); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobData.displayName = 'proto.nitric.proto.batch.v1.JobData'; +} +/** + * 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.batch.v1.JobResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobResponse.displayName = 'proto.nitric.proto.batch.v1.JobResponse'; +} +/** + * 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.batch.v1.RegistrationRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.RegistrationRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.RegistrationRequest.displayName = 'proto.nitric.proto.batch.v1.RegistrationRequest'; +} +/** + * 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.batch.v1.RegistrationResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.RegistrationResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.RegistrationResponse.displayName = 'proto.nitric.proto.batch.v1.RegistrationResponse'; +} +/** + * 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.batch.v1.JobResourceRequirements = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobResourceRequirements, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobResourceRequirements.displayName = 'proto.nitric.proto.batch.v1.JobResourceRequirements'; +} +/** + * 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.batch.v1.ServerMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.nitric.proto.batch.v1.ServerMessage.oneofGroups_); +}; +goog.inherits(proto.nitric.proto.batch.v1.ServerMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.ServerMessage.displayName = 'proto.nitric.proto.batch.v1.ServerMessage'; +} +/** + * 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.batch.v1.JobSubmitRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobSubmitRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobSubmitRequest.displayName = 'proto.nitric.proto.batch.v1.JobSubmitRequest'; +} +/** + * 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.batch.v1.JobSubmitResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.batch.v1.JobSubmitResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.batch.v1.JobSubmitResponse.displayName = 'proto.nitric.proto.batch.v1.JobSubmitResponse'; +} + +/** + * 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>} + * @const + */ +proto.nitric.proto.batch.v1.ClientMessage.oneofGroups_ = [[2,3]]; + +/** + * @enum {number} + */ +proto.nitric.proto.batch.v1.ClientMessage.ContentCase = { + CONTENT_NOT_SET: 0, + REGISTRATION_REQUEST: 2, + JOB_RESPONSE: 3 +}; + +/** + * @return {proto.nitric.proto.batch.v1.ClientMessage.ContentCase} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.getContentCase = function() { + return /** @type {proto.nitric.proto.batch.v1.ClientMessage.ContentCase} */(jspb.Message.computeOneofCase(this, proto.nitric.proto.batch.v1.ClientMessage.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_, 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.batch.v1.ClientMessage.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.ClientMessage.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.batch.v1.ClientMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.ClientMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + registrationRequest: (f = msg.getRegistrationRequest()) && proto.nitric.proto.batch.v1.RegistrationRequest.toObject(includeInstance, f), + jobResponse: (f = msg.getJobResponse()) && proto.nitric.proto.batch.v1.JobResponse.toObject(includeInstance, f) + }; + + 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.batch.v1.ClientMessage} + */ +proto.nitric.proto.batch.v1.ClientMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.ClientMessage; + return proto.nitric.proto.batch.v1.ClientMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.ClientMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.ClientMessage} + */ +proto.nitric.proto.batch.v1.ClientMessage.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.setId(value); + break; + case 2: + var value = new proto.nitric.proto.batch.v1.RegistrationRequest; + reader.readMessage(value,proto.nitric.proto.batch.v1.RegistrationRequest.deserializeBinaryFromReader); + msg.setRegistrationRequest(value); + break; + case 3: + var value = new proto.nitric.proto.batch.v1.JobResponse; + reader.readMessage(value,proto.nitric.proto.batch.v1.JobResponse.deserializeBinaryFromReader); + msg.setJobResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.ClientMessage.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.batch.v1.ClientMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.ClientMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRegistrationRequest(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.nitric.proto.batch.v1.RegistrationRequest.serializeBinaryToWriter + ); + } + f = message.getJobResponse(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.nitric.proto.batch.v1.JobResponse.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.batch.v1.ClientMessage} returns this + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional RegistrationRequest registration_request = 2; + * @return {?proto.nitric.proto.batch.v1.RegistrationRequest} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.getRegistrationRequest = function() { + return /** @type{?proto.nitric.proto.batch.v1.RegistrationRequest} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.RegistrationRequest, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.RegistrationRequest|undefined} value + * @return {!proto.nitric.proto.batch.v1.ClientMessage} returns this +*/ +proto.nitric.proto.batch.v1.ClientMessage.prototype.setRegistrationRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.nitric.proto.batch.v1.ClientMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.ClientMessage} returns this + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.clearRegistrationRequest = function() { + return this.setRegistrationRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.hasRegistrationRequest = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional JobResponse job_response = 3; + * @return {?proto.nitric.proto.batch.v1.JobResponse} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.getJobResponse = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobResponse} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.JobResponse, 3)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobResponse|undefined} value + * @return {!proto.nitric.proto.batch.v1.ClientMessage} returns this +*/ +proto.nitric.proto.batch.v1.ClientMessage.prototype.setJobResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.nitric.proto.batch.v1.ClientMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.ClientMessage} returns this + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.clearJobResponse = function() { + return this.setJobResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.ClientMessage.prototype.hasJobResponse = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +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_, 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.batch.v1.JobRequest.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobRequest.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.batch.v1.JobRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobRequest.toObject = function(includeInstance, msg) { + var f, obj = { + jobName: jspb.Message.getFieldWithDefault(msg, 1, ""), + data: (f = msg.getData()) && proto.nitric.proto.batch.v1.JobData.toObject(includeInstance, f) + }; + + 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.batch.v1.JobRequest} + */ +proto.nitric.proto.batch.v1.JobRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobRequest; + return proto.nitric.proto.batch.v1.JobRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobRequest} + */ +proto.nitric.proto.batch.v1.JobRequest.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.setJobName(value); + break; + case 2: + var value = new proto.nitric.proto.batch.v1.JobData; + reader.readMessage(value,proto.nitric.proto.batch.v1.JobData.deserializeBinaryFromReader); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobRequest.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.batch.v1.JobRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getJobName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getData(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.nitric.proto.batch.v1.JobData.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string job_name = 1; + * @return {string} + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.getJobName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.batch.v1.JobRequest} returns this + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.setJobName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional JobData data = 2; + * @return {?proto.nitric.proto.batch.v1.JobData} + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.getData = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobData} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.JobData, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobData|undefined} value + * @return {!proto.nitric.proto.batch.v1.JobRequest} returns this +*/ +proto.nitric.proto.batch.v1.JobRequest.prototype.setData = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.JobRequest} returns this + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.clearData = function() { + return this.setData(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.JobRequest.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * 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>} + * @const + */ +proto.nitric.proto.batch.v1.JobData.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.nitric.proto.batch.v1.JobData.DataCase = { + DATA_NOT_SET: 0, + STRUCT: 1 +}; + +/** + * @return {proto.nitric.proto.batch.v1.JobData.DataCase} + */ +proto.nitric.proto.batch.v1.JobData.prototype.getDataCase = function() { + return /** @type {proto.nitric.proto.batch.v1.JobData.DataCase} */(jspb.Message.computeOneofCase(this, proto.nitric.proto.batch.v1.JobData.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_, 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.batch.v1.JobData.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobData.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.batch.v1.JobData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobData.toObject = function(includeInstance, msg) { + var f, obj = { + struct: (f = msg.getStruct()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f) + }; + + 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.batch.v1.JobData} + */ +proto.nitric.proto.batch.v1.JobData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobData; + return proto.nitric.proto.batch.v1.JobData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobData} + */ +proto.nitric.proto.batch.v1.JobData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_struct_pb.Struct; + reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader); + msg.setStruct(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobData.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.batch.v1.JobData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStruct(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_struct_pb.Struct.serializeBinaryToWriter + ); + } +}; + + +/** + * optional google.protobuf.Struct struct = 1; + * @return {?proto.google.protobuf.Struct} + */ +proto.nitric.proto.batch.v1.JobData.prototype.getStruct = function() { + return /** @type{?proto.google.protobuf.Struct} */ ( + jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 1)); +}; + + +/** + * @param {?proto.google.protobuf.Struct|undefined} value + * @return {!proto.nitric.proto.batch.v1.JobData} returns this +*/ +proto.nitric.proto.batch.v1.JobData.prototype.setStruct = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.nitric.proto.batch.v1.JobData.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.JobData} returns this + */ +proto.nitric.proto.batch.v1.JobData.prototype.clearStruct = function() { + return this.setStruct(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.JobData.prototype.hasStruct = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +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_, 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.batch.v1.JobResponse.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobResponse.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.batch.v1.JobResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobResponse.toObject = function(includeInstance, msg) { + var f, obj = { + success: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + 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.batch.v1.JobResponse} + */ +proto.nitric.proto.batch.v1.JobResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobResponse; + return proto.nitric.proto.batch.v1.JobResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobResponse} + */ +proto.nitric.proto.batch.v1.JobResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSuccess(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobResponse.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.batch.v1.JobResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSuccess(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool success = 1; + * @return {boolean} + */ +proto.nitric.proto.batch.v1.JobResponse.prototype.getSuccess = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.nitric.proto.batch.v1.JobResponse} returns this + */ +proto.nitric.proto.batch.v1.JobResponse.prototype.setSuccess = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + + + + +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_, 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.batch.v1.RegistrationRequest.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.RegistrationRequest.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.batch.v1.RegistrationRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.RegistrationRequest.toObject = function(includeInstance, msg) { + var f, obj = { + jobName: jspb.Message.getFieldWithDefault(msg, 1, ""), + requirements: (f = msg.getRequirements()) && proto.nitric.proto.batch.v1.JobResourceRequirements.toObject(includeInstance, f) + }; + + 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.batch.v1.RegistrationRequest} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.RegistrationRequest; + return proto.nitric.proto.batch.v1.RegistrationRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.RegistrationRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.RegistrationRequest} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.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.setJobName(value); + break; + case 2: + var value = new proto.nitric.proto.batch.v1.JobResourceRequirements; + reader.readMessage(value,proto.nitric.proto.batch.v1.JobResourceRequirements.deserializeBinaryFromReader); + msg.setRequirements(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.RegistrationRequest.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.batch.v1.RegistrationRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.RegistrationRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getJobName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRequirements(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.nitric.proto.batch.v1.JobResourceRequirements.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string job_name = 1; + * @return {string} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.getJobName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.batch.v1.RegistrationRequest} returns this + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.setJobName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional JobResourceRequirements requirements = 2; + * @return {?proto.nitric.proto.batch.v1.JobResourceRequirements} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.getRequirements = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobResourceRequirements} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.JobResourceRequirements, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobResourceRequirements|undefined} value + * @return {!proto.nitric.proto.batch.v1.RegistrationRequest} returns this +*/ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.setRequirements = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.RegistrationRequest} returns this + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.clearRequirements = function() { + return this.setRequirements(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.RegistrationRequest.prototype.hasRequirements = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +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_, 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.batch.v1.RegistrationResponse.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.RegistrationResponse.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.batch.v1.RegistrationResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.RegistrationResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + 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.batch.v1.RegistrationResponse} + */ +proto.nitric.proto.batch.v1.RegistrationResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.RegistrationResponse; + return proto.nitric.proto.batch.v1.RegistrationResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.RegistrationResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.RegistrationResponse} + */ +proto.nitric.proto.batch.v1.RegistrationResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.RegistrationResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.RegistrationResponse.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.batch.v1.RegistrationResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.RegistrationResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +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_, 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.batch.v1.JobResourceRequirements.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobResourceRequirements.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.batch.v1.JobResourceRequirements} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.toObject = function(includeInstance, msg) { + var f, obj = { + cpus: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + memory: jspb.Message.getFieldWithDefault(msg, 2, 0), + gpus: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + 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.batch.v1.JobResourceRequirements} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobResourceRequirements; + return proto.nitric.proto.batch.v1.JobResourceRequirements.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobResourceRequirements} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobResourceRequirements} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readFloat()); + msg.setCpus(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMemory(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setGpus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobResourceRequirements.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.batch.v1.JobResourceRequirements} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCpus(); + if (f !== 0.0) { + writer.writeFloat( + 1, + f + ); + } + f = message.getMemory(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getGpus(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * optional float cpus = 1; + * @return {number} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.getCpus = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.nitric.proto.batch.v1.JobResourceRequirements} returns this + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.setCpus = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); +}; + + +/** + * optional int64 memory = 2; + * @return {number} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.getMemory = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.nitric.proto.batch.v1.JobResourceRequirements} returns this + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.setMemory = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int64 gpus = 3; + * @return {number} + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.getGpus = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.nitric.proto.batch.v1.JobResourceRequirements} returns this + */ +proto.nitric.proto.batch.v1.JobResourceRequirements.prototype.setGpus = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + +/** + * 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>} + * @const + */ +proto.nitric.proto.batch.v1.ServerMessage.oneofGroups_ = [[2,3]]; + +/** + * @enum {number} + */ +proto.nitric.proto.batch.v1.ServerMessage.ContentCase = { + CONTENT_NOT_SET: 0, + REGISTRATION_RESPONSE: 2, + JOB_REQUEST: 3 +}; + +/** + * @return {proto.nitric.proto.batch.v1.ServerMessage.ContentCase} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.getContentCase = function() { + return /** @type {proto.nitric.proto.batch.v1.ServerMessage.ContentCase} */(jspb.Message.computeOneofCase(this, proto.nitric.proto.batch.v1.ServerMessage.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_, 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.batch.v1.ServerMessage.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.ServerMessage.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.batch.v1.ServerMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.ServerMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + registrationResponse: (f = msg.getRegistrationResponse()) && proto.nitric.proto.batch.v1.RegistrationResponse.toObject(includeInstance, f), + jobRequest: (f = msg.getJobRequest()) && proto.nitric.proto.batch.v1.JobRequest.toObject(includeInstance, f) + }; + + 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.batch.v1.ServerMessage} + */ +proto.nitric.proto.batch.v1.ServerMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.ServerMessage; + return proto.nitric.proto.batch.v1.ServerMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.ServerMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.ServerMessage} + */ +proto.nitric.proto.batch.v1.ServerMessage.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.setId(value); + break; + case 2: + var value = new proto.nitric.proto.batch.v1.RegistrationResponse; + reader.readMessage(value,proto.nitric.proto.batch.v1.RegistrationResponse.deserializeBinaryFromReader); + msg.setRegistrationResponse(value); + break; + case 3: + var value = new proto.nitric.proto.batch.v1.JobRequest; + reader.readMessage(value,proto.nitric.proto.batch.v1.JobRequest.deserializeBinaryFromReader); + msg.setJobRequest(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.ServerMessage.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.batch.v1.ServerMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.ServerMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRegistrationResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.nitric.proto.batch.v1.RegistrationResponse.serializeBinaryToWriter + ); + } + f = message.getJobRequest(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.nitric.proto.batch.v1.JobRequest.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.batch.v1.ServerMessage} returns this + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional RegistrationResponse registration_response = 2; + * @return {?proto.nitric.proto.batch.v1.RegistrationResponse} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.getRegistrationResponse = function() { + return /** @type{?proto.nitric.proto.batch.v1.RegistrationResponse} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.RegistrationResponse, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.RegistrationResponse|undefined} value + * @return {!proto.nitric.proto.batch.v1.ServerMessage} returns this +*/ +proto.nitric.proto.batch.v1.ServerMessage.prototype.setRegistrationResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.nitric.proto.batch.v1.ServerMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.ServerMessage} returns this + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.clearRegistrationResponse = function() { + return this.setRegistrationResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.hasRegistrationResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional JobRequest job_request = 3; + * @return {?proto.nitric.proto.batch.v1.JobRequest} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.getJobRequest = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobRequest} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.JobRequest, 3)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobRequest|undefined} value + * @return {!proto.nitric.proto.batch.v1.ServerMessage} returns this +*/ +proto.nitric.proto.batch.v1.ServerMessage.prototype.setJobRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.nitric.proto.batch.v1.ServerMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.ServerMessage} returns this + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.clearJobRequest = function() { + return this.setJobRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.ServerMessage.prototype.hasJobRequest = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +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_, 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.batch.v1.JobSubmitRequest.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobSubmitRequest.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.batch.v1.JobSubmitRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.toObject = function(includeInstance, msg) { + var f, obj = { + jobName: jspb.Message.getFieldWithDefault(msg, 1, ""), + data: (f = msg.getData()) && proto.nitric.proto.batch.v1.JobData.toObject(includeInstance, f) + }; + + 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.batch.v1.JobSubmitRequest} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobSubmitRequest; + return proto.nitric.proto.batch.v1.JobSubmitRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobSubmitRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobSubmitRequest} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.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.setJobName(value); + break; + case 2: + var value = new proto.nitric.proto.batch.v1.JobData; + reader.readMessage(value,proto.nitric.proto.batch.v1.JobData.deserializeBinaryFromReader); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobSubmitRequest.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.batch.v1.JobSubmitRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getJobName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getData(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.nitric.proto.batch.v1.JobData.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string job_name = 1; + * @return {string} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.getJobName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.batch.v1.JobSubmitRequest} returns this + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.setJobName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional JobData data = 2; + * @return {?proto.nitric.proto.batch.v1.JobData} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.getData = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobData} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.batch.v1.JobData, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobData|undefined} value + * @return {!proto.nitric.proto.batch.v1.JobSubmitRequest} returns this +*/ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.setData = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.batch.v1.JobSubmitRequest} returns this + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.clearData = function() { + return this.setData(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.batch.v1.JobSubmitRequest.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +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_, 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.batch.v1.JobSubmitResponse.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.batch.v1.JobSubmitResponse.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.batch.v1.JobSubmitResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobSubmitResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + 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.batch.v1.JobSubmitResponse} + */ +proto.nitric.proto.batch.v1.JobSubmitResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.batch.v1.JobSubmitResponse; + return proto.nitric.proto.batch.v1.JobSubmitResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.batch.v1.JobSubmitResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.batch.v1.JobSubmitResponse} + */ +proto.nitric.proto.batch.v1.JobSubmitResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.batch.v1.JobSubmitResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.batch.v1.JobSubmitResponse.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.batch.v1.JobSubmitResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.batch.v1.JobSubmitResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + +goog.object.extend(exports, proto.nitric.proto.batch.v1); diff --git a/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js b/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js index 50a797f..9ad3437 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js +++ b/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js @@ -6,6 +6,7 @@ var nitric_proto_deployments_v1_deployments_pb = require('../../../../nitric/pro var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); var nitric_proto_resources_v1_resources_pb = require('../../../../nitric/proto/resources/v1/resources_pb.js'); var nitric_proto_storage_v1_storage_pb = require('../../../../nitric/proto/storage/v1/storage_pb.js'); +var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); function serialize_nitric_proto_deployments_v1_DeploymentDownEvent(arg) { if (!(arg instanceof nitric_proto_deployments_v1_deployments_pb.DeploymentDownEvent)) { diff --git a/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts b/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts index badcb66..fc41a48 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts +++ b/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts @@ -5,6 +5,7 @@ import * as jspb from "google-protobuf"; import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb"; import * as nitric_proto_resources_v1_resources_pb from "../../../../nitric/proto/resources/v1/resources_pb"; import * as nitric_proto_storage_v1_storage_pb from "../../../../nitric/proto/storage/v1/storage_pb"; +import * as nitric_proto_batch_v1_batch_pb from "../../../../nitric/proto/batch/v1/batch_pb"; export class DeploymentUpRequest extends jspb.Message { hasSpec(): boolean; @@ -301,6 +302,73 @@ export namespace Service { } } +export class Job extends jspb.Message { + getName(): string; + setName(value: string): void; + + hasRequirements(): boolean; + clearRequirements(): void; + getRequirements(): nitric_proto_batch_v1_batch_pb.JobResourceRequirements | undefined; + setRequirements(value?: nitric_proto_batch_v1_batch_pb.JobResourceRequirements): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Job.AsObject; + static toObject(includeInstance: boolean, msg: Job): Job.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Job, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Job; + static deserializeBinaryFromReader(message: Job, reader: jspb.BinaryReader): Job; +} + +export namespace Job { + export type AsObject = { + name: string, + requirements?: nitric_proto_batch_v1_batch_pb.JobResourceRequirements.AsObject, + } +} + +export class Batch extends jspb.Message { + hasImage(): boolean; + clearImage(): void; + getImage(): ImageSource | undefined; + setImage(value?: ImageSource): void; + + getType(): string; + setType(value: string): void; + + getEnvMap(): jspb.Map; + clearEnvMap(): void; + clearJobsList(): void; + getJobsList(): Array; + setJobsList(value: Array): void; + addJobs(value?: Job, index?: number): Job; + + getSourceCase(): Batch.SourceCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Batch.AsObject; + static toObject(includeInstance: boolean, msg: Batch): Batch.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Batch, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Batch; + static deserializeBinaryFromReader(message: Batch, reader: jspb.BinaryReader): Batch; +} + +export namespace Batch { + export type AsObject = { + image?: ImageSource.AsObject, + type: string, + envMap: Array<[string, string]>, + jobsList: Array, + } + + export enum SourceCase { + SOURCE_NOT_SET = 0, + IMAGE = 1, + } +} + export class Bucket extends jspb.Message { clearListenersList(): void; getListenersList(): Array; @@ -820,6 +888,11 @@ export class Resource extends jspb.Message { getSqlDatabase(): SqlDatabase | undefined; setSqlDatabase(value?: SqlDatabase): void; + hasBatch(): boolean; + clearBatch(): void; + getBatch(): Batch | undefined; + setBatch(value?: Batch): void; + getConfigCase(): Resource.ConfigCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Resource.AsObject; @@ -846,6 +919,7 @@ export namespace Resource { http?: Http.AsObject, queue?: Queue.AsObject, sqlDatabase?: SqlDatabase.AsObject, + batch?: Batch.AsObject, } export enum ConfigCase { @@ -862,6 +936,7 @@ export namespace Resource { HTTP = 19, QUEUE = 20, SQL_DATABASE = 21, + BATCH = 22, } } diff --git a/src/gen/nitric/proto/deployments/v1/deployments_pb.js b/src/gen/nitric/proto/deployments/v1/deployments_pb.js index b17f5f2..ef428e1 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_pb.js +++ b/src/gen/nitric/proto/deployments/v1/deployments_pb.js @@ -27,8 +27,12 @@ var nitric_proto_resources_v1_resources_pb = require('../../../../nitric/proto/r goog.object.extend(proto, nitric_proto_resources_v1_resources_pb); var nitric_proto_storage_v1_storage_pb = require('../../../../nitric/proto/storage/v1/storage_pb.js'); goog.object.extend(proto, nitric_proto_storage_v1_storage_pb); +var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); +goog.object.extend(proto, nitric_proto_batch_v1_batch_pb); goog.exportSymbol('proto.nitric.proto.deployments.v1.Api', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Api.DocumentCase', null, global); +goog.exportSymbol('proto.nitric.proto.deployments.v1.Batch', null, global); +goog.exportSymbol('proto.nitric.proto.deployments.v1.Batch.SourceCase', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Bucket', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.BucketListener', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.BucketListener.TargetCase', null, global); @@ -43,6 +47,7 @@ goog.exportSymbol('proto.nitric.proto.deployments.v1.Http', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.HttpTarget', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.HttpTarget.TargetCase', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.ImageSource', null, global); +goog.exportSymbol('proto.nitric.proto.deployments.v1.Job', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.KeyValueStore', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Policy', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Queue', null, global); @@ -261,6 +266,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.nitric.proto.deployments.v1.Service.displayName = 'proto.nitric.proto.deployments.v1.Service'; } +/** + * 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.Job = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.deployments.v1.Job, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.deployments.v1.Job.displayName = 'proto.nitric.proto.deployments.v1.Job'; +} +/** + * 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.Batch = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.nitric.proto.deployments.v1.Batch.repeatedFields_, proto.nitric.proto.deployments.v1.Batch.oneofGroups_); +}; +goog.inherits(proto.nitric.proto.deployments.v1.Batch, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.deployments.v1.Batch.displayName = 'proto.nitric.proto.deployments.v1.Batch'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -2704,6 +2751,486 @@ proto.nitric.proto.deployments.v1.Service.prototype.clearEnvMap = function() { + + +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_, 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.Job.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.deployments.v1.Job.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.Job} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.deployments.v1.Job.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + requirements: (f = msg.getRequirements()) && nitric_proto_batch_v1_batch_pb.JobResourceRequirements.toObject(includeInstance, f) + }; + + 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.Job} + */ +proto.nitric.proto.deployments.v1.Job.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.deployments.v1.Job; + return proto.nitric.proto.deployments.v1.Job.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.Job} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.deployments.v1.Job} + */ +proto.nitric.proto.deployments.v1.Job.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.setName(value); + break; + case 2: + var value = new nitric_proto_batch_v1_batch_pb.JobResourceRequirements; + reader.readMessage(value,nitric_proto_batch_v1_batch_pb.JobResourceRequirements.deserializeBinaryFromReader); + msg.setRequirements(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.Job.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.deployments.v1.Job.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.Job} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.deployments.v1.Job.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRequirements(); + if (f != null) { + writer.writeMessage( + 2, + f, + nitric_proto_batch_v1_batch_pb.JobResourceRequirements.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.nitric.proto.deployments.v1.Job.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.deployments.v1.Job} returns this + */ +proto.nitric.proto.deployments.v1.Job.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional nitric.proto.batch.v1.JobResourceRequirements requirements = 2; + * @return {?proto.nitric.proto.batch.v1.JobResourceRequirements} + */ +proto.nitric.proto.deployments.v1.Job.prototype.getRequirements = function() { + return /** @type{?proto.nitric.proto.batch.v1.JobResourceRequirements} */ ( + jspb.Message.getWrapperField(this, nitric_proto_batch_v1_batch_pb.JobResourceRequirements, 2)); +}; + + +/** + * @param {?proto.nitric.proto.batch.v1.JobResourceRequirements|undefined} value + * @return {!proto.nitric.proto.deployments.v1.Job} returns this +*/ +proto.nitric.proto.deployments.v1.Job.prototype.setRequirements = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.deployments.v1.Job} returns this + */ +proto.nitric.proto.deployments.v1.Job.prototype.clearRequirements = function() { + return this.setRequirements(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.deployments.v1.Job.prototype.hasRequirements = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.nitric.proto.deployments.v1.Batch.repeatedFields_ = [12]; + +/** + * 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>} + * @const + */ +proto.nitric.proto.deployments.v1.Batch.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.nitric.proto.deployments.v1.Batch.SourceCase = { + SOURCE_NOT_SET: 0, + IMAGE: 1 +}; + +/** + * @return {proto.nitric.proto.deployments.v1.Batch.SourceCase} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.getSourceCase = function() { + return /** @type {proto.nitric.proto.deployments.v1.Batch.SourceCase} */(jspb.Message.computeOneofCase(this, proto.nitric.proto.deployments.v1.Batch.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_, 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.Batch.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.deployments.v1.Batch.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.Batch} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.deployments.v1.Batch.toObject = function(includeInstance, msg) { + var f, obj = { + image: (f = msg.getImage()) && proto.nitric.proto.deployments.v1.ImageSource.toObject(includeInstance, f), + type: jspb.Message.getFieldWithDefault(msg, 10, ""), + envMap: (f = msg.getEnvMap()) ? f.toObject(includeInstance, undefined) : [], + jobsList: jspb.Message.toObjectList(msg.getJobsList(), + proto.nitric.proto.deployments.v1.Job.toObject, includeInstance) + }; + + 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.Batch} + */ +proto.nitric.proto.deployments.v1.Batch.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.deployments.v1.Batch; + return proto.nitric.proto.deployments.v1.Batch.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.Batch} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.deployments.v1.Batch} + */ +proto.nitric.proto.deployments.v1.Batch.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.nitric.proto.deployments.v1.ImageSource; + reader.readMessage(value,proto.nitric.proto.deployments.v1.ImageSource.deserializeBinaryFromReader); + msg.setImage(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setType(value); + break; + case 11: + var value = msg.getEnvMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + case 12: + var value = new proto.nitric.proto.deployments.v1.Job; + reader.readMessage(value,proto.nitric.proto.deployments.v1.Job.deserializeBinaryFromReader); + msg.addJobs(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.Batch.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.deployments.v1.Batch.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.Batch} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.deployments.v1.Batch.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getImage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.nitric.proto.deployments.v1.ImageSource.serializeBinaryToWriter + ); + } + f = message.getType(); + if (f.length > 0) { + writer.writeString( + 10, + f + ); + } + f = message.getEnvMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(11, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = message.getJobsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 12, + f, + proto.nitric.proto.deployments.v1.Job.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ImageSource image = 1; + * @return {?proto.nitric.proto.deployments.v1.ImageSource} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.getImage = function() { + return /** @type{?proto.nitric.proto.deployments.v1.ImageSource} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.deployments.v1.ImageSource, 1)); +}; + + +/** + * @param {?proto.nitric.proto.deployments.v1.ImageSource|undefined} value + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this +*/ +proto.nitric.proto.deployments.v1.Batch.prototype.setImage = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.nitric.proto.deployments.v1.Batch.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this + */ +proto.nitric.proto.deployments.v1.Batch.prototype.clearImage = function() { + return this.setImage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.hasImage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string type = 10; + * @return {string} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.getType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * @param {string} value + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this + */ +proto.nitric.proto.deployments.v1.Batch.prototype.setType = function(value) { + return jspb.Message.setProto3StringField(this, 10, value); +}; + + +/** + * map env = 11; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.getEnvMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 11, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this + */ +proto.nitric.proto.deployments.v1.Batch.prototype.clearEnvMap = function() { + this.getEnvMap().clear(); + return this;}; + + +/** + * repeated Job jobs = 12; + * @return {!Array} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.getJobsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.nitric.proto.deployments.v1.Job, 12)); +}; + + +/** + * @param {!Array} value + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this +*/ +proto.nitric.proto.deployments.v1.Batch.prototype.setJobsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 12, value); +}; + + +/** + * @param {!proto.nitric.proto.deployments.v1.Job=} opt_value + * @param {number=} opt_index + * @return {!proto.nitric.proto.deployments.v1.Job} + */ +proto.nitric.proto.deployments.v1.Batch.prototype.addJobs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 12, opt_value, proto.nitric.proto.deployments.v1.Job, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.nitric.proto.deployments.v1.Batch} returns this + */ +proto.nitric.proto.deployments.v1.Batch.prototype.clearJobsList = function() { + return this.setJobsList([]); +}; + + + /** * List of repeated fields within this message type. * @private {!Array} @@ -5691,7 +6218,7 @@ proto.nitric.proto.deployments.v1.ScheduleCron.prototype.setExpression = functio * @private {!Array>} * @const */ -proto.nitric.proto.deployments.v1.Resource.oneofGroups_ = [[10,11,12,13,14,15,16,17,18,19,20,21]]; +proto.nitric.proto.deployments.v1.Resource.oneofGroups_ = [[10,11,12,13,14,15,16,17,18,19,20,21,22]]; /** * @enum {number} @@ -5709,7 +6236,8 @@ proto.nitric.proto.deployments.v1.Resource.ConfigCase = { WEBSOCKET: 18, HTTP: 19, QUEUE: 20, - SQL_DATABASE: 21 + SQL_DATABASE: 21, + BATCH: 22 }; /** @@ -5762,7 +6290,8 @@ proto.nitric.proto.deployments.v1.Resource.toObject = function(includeInstance, 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), - sqlDatabase: (f = msg.getSqlDatabase()) && proto.nitric.proto.deployments.v1.SqlDatabase.toObject(includeInstance, f) + sqlDatabase: (f = msg.getSqlDatabase()) && proto.nitric.proto.deployments.v1.SqlDatabase.toObject(includeInstance, f), + batch: (f = msg.getBatch()) && proto.nitric.proto.deployments.v1.Batch.toObject(includeInstance, f) }; if (includeInstance) { @@ -5864,6 +6393,11 @@ proto.nitric.proto.deployments.v1.Resource.deserializeBinaryFromReader = functio reader.readMessage(value,proto.nitric.proto.deployments.v1.SqlDatabase.deserializeBinaryFromReader); msg.setSqlDatabase(value); break; + case 22: + var value = new proto.nitric.proto.deployments.v1.Batch; + reader.readMessage(value,proto.nitric.proto.deployments.v1.Batch.deserializeBinaryFromReader); + msg.setBatch(value); + break; default: reader.skipField(); break; @@ -5997,6 +6531,14 @@ proto.nitric.proto.deployments.v1.Resource.serializeBinaryToWriter = function(me proto.nitric.proto.deployments.v1.SqlDatabase.serializeBinaryToWriter ); } + f = message.getBatch(); + if (f != null) { + writer.writeMessage( + 22, + f, + proto.nitric.proto.deployments.v1.Batch.serializeBinaryToWriter + ); + } }; @@ -6481,6 +7023,43 @@ proto.nitric.proto.deployments.v1.Resource.prototype.hasSqlDatabase = function() }; +/** + * optional Batch batch = 22; + * @return {?proto.nitric.proto.deployments.v1.Batch} + */ +proto.nitric.proto.deployments.v1.Resource.prototype.getBatch = function() { + return /** @type{?proto.nitric.proto.deployments.v1.Batch} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.deployments.v1.Batch, 22)); +}; + + +/** + * @param {?proto.nitric.proto.deployments.v1.Batch|undefined} value + * @return {!proto.nitric.proto.deployments.v1.Resource} returns this +*/ +proto.nitric.proto.deployments.v1.Resource.prototype.setBatch = function(value) { + return jspb.Message.setOneofWrapperField(this, 22, 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.clearBatch = function() { + return this.setBatch(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.deployments.v1.Resource.prototype.hasBatch = function() { + return jspb.Message.getField(this, 22) != null; +}; + + /** * List of repeated fields within this message type. diff --git a/src/gen/nitric/proto/resources/v1/resources_pb.d.ts b/src/gen/nitric/proto/resources/v1/resources_pb.d.ts index 77229a7..91d48ea 100644 --- a/src/gen/nitric/proto/resources/v1/resources_pb.d.ts +++ b/src/gen/nitric/proto/resources/v1/resources_pb.d.ts @@ -112,6 +112,11 @@ export class ResourceDeclareRequest extends jspb.Message { getSqlDatabase(): SqlDatabaseResource | undefined; setSqlDatabase(value?: SqlDatabaseResource): void; + hasJob(): boolean; + clearJob(): void; + getJob(): JobResource | undefined; + setJob(value?: JobResource): void; + getConfigCase(): ResourceDeclareRequest.ConfigCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ResourceDeclareRequest.AsObject; @@ -135,6 +140,7 @@ export namespace ResourceDeclareRequest { apiSecurityDefinition?: ApiSecurityDefinitionResource.AsObject, queue?: QueueResource.AsObject, sqlDatabase?: SqlDatabaseResource.AsObject, + job?: JobResource.AsObject, } export enum ConfigCase { @@ -148,6 +154,7 @@ export namespace ResourceDeclareRequest { API_SECURITY_DEFINITION = 16, QUEUE = 17, SQL_DATABASE = 18, + JOB = 19, } } @@ -231,6 +238,22 @@ export namespace SecretResource { } } +export class JobResource extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): JobResource.AsObject; + static toObject(includeInstance: boolean, msg: JobResource): JobResource.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: JobResource, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): JobResource; + static deserializeBinaryFromReader(message: JobResource, reader: jspb.BinaryReader): JobResource; +} + +export namespace JobResource { + export type AsObject = { + } +} + export class SqlDatabaseMigrations extends jspb.Message { hasMigrationsPath(): boolean; clearMigrationsPath(): void; @@ -412,6 +435,8 @@ export interface ResourceTypeMap { APISECURITYDEFINITION: 12; QUEUE: 13; SQLDATABASE: 14; + BATCH: 15; + JOB: 16; } export const ResourceType: ResourceTypeMap; @@ -430,6 +455,7 @@ export interface ActionMap { WEBSOCKETMANAGE: 500; QUEUEENQUEUE: 600; QUEUEDEQUEUE: 601; + JOBSUBMIT: 700; } export const Action: ActionMap; diff --git a/src/gen/nitric/proto/resources/v1/resources_pb.js b/src/gen/nitric/proto/resources/v1/resources_pb.js index f2ba32a..d8de968 100644 --- a/src/gen/nitric/proto/resources/v1/resources_pb.js +++ b/src/gen/nitric/proto/resources/v1/resources_pb.js @@ -28,6 +28,7 @@ goog.exportSymbol('proto.nitric.proto.resources.v1.ApiScopes', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.ApiSecurityDefinitionResource', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.ApiSecurityDefinitionResource.DefinitionCase', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.BucketResource', null, global); +goog.exportSymbol('proto.nitric.proto.resources.v1.JobResource', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.KeyValueStoreResource', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.PolicyResource', null, global); goog.exportSymbol('proto.nitric.proto.resources.v1.QueueResource', null, global); @@ -209,6 +210,27 @@ if (goog.DEBUG && !COMPILED) { */ proto.nitric.proto.resources.v1.SecretResource.displayName = 'proto.nitric.proto.resources.v1.SecretResource'; } +/** + * 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.resources.v1.JobResource = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.nitric.proto.resources.v1.JobResource, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.nitric.proto.resources.v1.JobResource.displayName = 'proto.nitric.proto.resources.v1.JobResource'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -789,7 +811,7 @@ proto.nitric.proto.resources.v1.ResourceIdentifier.prototype.setName = function( * @private {!Array>} * @const */ -proto.nitric.proto.resources.v1.ResourceDeclareRequest.oneofGroups_ = [[10,11,12,13,14,15,16,17,18]]; +proto.nitric.proto.resources.v1.ResourceDeclareRequest.oneofGroups_ = [[10,11,12,13,14,15,16,17,18,19]]; /** * @enum {number} @@ -804,7 +826,8 @@ proto.nitric.proto.resources.v1.ResourceDeclareRequest.ConfigCase = { API: 15, API_SECURITY_DEFINITION: 16, QUEUE: 17, - SQL_DATABASE: 18 + SQL_DATABASE: 18, + JOB: 19 }; /** @@ -854,7 +877,8 @@ proto.nitric.proto.resources.v1.ResourceDeclareRequest.toObject = function(inclu api: (f = msg.getApi()) && proto.nitric.proto.resources.v1.ApiResource.toObject(includeInstance, f), apiSecurityDefinition: (f = msg.getApiSecurityDefinition()) && proto.nitric.proto.resources.v1.ApiSecurityDefinitionResource.toObject(includeInstance, f), queue: (f = msg.getQueue()) && proto.nitric.proto.resources.v1.QueueResource.toObject(includeInstance, f), - sqlDatabase: (f = msg.getSqlDatabase()) && proto.nitric.proto.resources.v1.SqlDatabaseResource.toObject(includeInstance, f) + sqlDatabase: (f = msg.getSqlDatabase()) && proto.nitric.proto.resources.v1.SqlDatabaseResource.toObject(includeInstance, f), + job: (f = msg.getJob()) && proto.nitric.proto.resources.v1.JobResource.toObject(includeInstance, f) }; if (includeInstance) { @@ -941,6 +965,11 @@ proto.nitric.proto.resources.v1.ResourceDeclareRequest.deserializeBinaryFromRead reader.readMessage(value,proto.nitric.proto.resources.v1.SqlDatabaseResource.deserializeBinaryFromReader); msg.setSqlDatabase(value); break; + case 19: + var value = new proto.nitric.proto.resources.v1.JobResource; + reader.readMessage(value,proto.nitric.proto.resources.v1.JobResource.deserializeBinaryFromReader); + msg.setJob(value); + break; default: reader.skipField(); break; @@ -1050,6 +1079,14 @@ proto.nitric.proto.resources.v1.ResourceDeclareRequest.serializeBinaryToWriter = proto.nitric.proto.resources.v1.SqlDatabaseResource.serializeBinaryToWriter ); } + f = message.getJob(); + if (f != null) { + writer.writeMessage( + 19, + f, + proto.nitric.proto.resources.v1.JobResource.serializeBinaryToWriter + ); + } }; @@ -1423,6 +1460,43 @@ proto.nitric.proto.resources.v1.ResourceDeclareRequest.prototype.hasSqlDatabase }; +/** + * optional JobResource job = 19; + * @return {?proto.nitric.proto.resources.v1.JobResource} + */ +proto.nitric.proto.resources.v1.ResourceDeclareRequest.prototype.getJob = function() { + return /** @type{?proto.nitric.proto.resources.v1.JobResource} */ ( + jspb.Message.getWrapperField(this, proto.nitric.proto.resources.v1.JobResource, 19)); +}; + + +/** + * @param {?proto.nitric.proto.resources.v1.JobResource|undefined} value + * @return {!proto.nitric.proto.resources.v1.ResourceDeclareRequest} returns this +*/ +proto.nitric.proto.resources.v1.ResourceDeclareRequest.prototype.setJob = function(value) { + return jspb.Message.setOneofWrapperField(this, 19, proto.nitric.proto.resources.v1.ResourceDeclareRequest.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.nitric.proto.resources.v1.ResourceDeclareRequest} returns this + */ +proto.nitric.proto.resources.v1.ResourceDeclareRequest.prototype.clearJob = function() { + return this.setJob(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.nitric.proto.resources.v1.ResourceDeclareRequest.prototype.hasJob = function() { + return jspb.Message.getField(this, 19) != null; +}; + + @@ -1929,6 +2003,107 @@ proto.nitric.proto.resources.v1.SecretResource.serializeBinaryToWriter = functio + + +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_, 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.resources.v1.JobResource.prototype.toObject = function(opt_includeInstance) { + return proto.nitric.proto.resources.v1.JobResource.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.resources.v1.JobResource} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.resources.v1.JobResource.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + 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.resources.v1.JobResource} + */ +proto.nitric.proto.resources.v1.JobResource.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.nitric.proto.resources.v1.JobResource; + return proto.nitric.proto.resources.v1.JobResource.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.nitric.proto.resources.v1.JobResource} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.nitric.proto.resources.v1.JobResource} + */ +proto.nitric.proto.resources.v1.JobResource.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.nitric.proto.resources.v1.JobResource.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.nitric.proto.resources.v1.JobResource.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.resources.v1.JobResource} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.nitric.proto.resources.v1.JobResource.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + /** * Oneof group definitions for this message. Each group defines the field * numbers belonging to that group. When of these fields' value is set, all @@ -3052,7 +3227,9 @@ proto.nitric.proto.resources.v1.ResourceType = { HTTP: 11, APISECURITYDEFINITION: 12, QUEUE: 13, - SQLDATABASE: 14 + SQLDATABASE: 14, + BATCH: 15, + JOB: 16 }; /** @@ -3071,7 +3248,8 @@ proto.nitric.proto.resources.v1.Action = { SECRETACCESS: 401, WEBSOCKETMANAGE: 500, QUEUEENQUEUE: 600, - QUEUEDEQUEUE: 601 + QUEUEDEQUEUE: 601, + JOBSUBMIT: 700 }; goog.object.extend(exports, proto.nitric.proto.resources.v1); From 6a74820449504d2a7499f0fd487e824851e01f9e Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 3 Sep 2024 14:16:22 +1000 Subject: [PATCH 2/9] feat: batch job support --- src/api/batch/v1/batch.ts | 15 +++ src/api/batch/v1/index.ts | 1 + src/api/batch/v1/job.ts | 46 +++++++++ src/context/index.ts | 1 + src/context/job.ts | 47 +++++++++ src/handlers/handler.ts | 3 +- src/resources/batch.ts | 196 ++++++++++++++++++++++++++++++++++++++ src/resources/index.ts | 1 + 8 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 src/api/batch/v1/batch.ts create mode 100644 src/api/batch/v1/index.ts create mode 100644 src/api/batch/v1/job.ts create mode 100644 src/context/job.ts create mode 100644 src/resources/batch.ts diff --git a/src/api/batch/v1/batch.ts b/src/api/batch/v1/batch.ts new file mode 100644 index 0000000..715e201 --- /dev/null +++ b/src/api/batch/v1/batch.ts @@ -0,0 +1,15 @@ +import { SERVICE_BIND } from '@nitric/sdk/constants'; +import { BatchClient } from '@nitric/sdk/gen/nitric/proto/batch/v1/batch_grpc_pb'; +import * as grpc from '@grpc/grpc-js'; + +let batchClient: BatchClient; + +export const getBatchClient = (): BatchClient => { + if (!batchClient) { + batchClient = new BatchClient( + SERVICE_BIND, + grpc.ChannelCredentials.createInsecure() + ); + } + return batchClient; +}; diff --git a/src/api/batch/v1/index.ts b/src/api/batch/v1/index.ts new file mode 100644 index 0000000..77c6125 --- /dev/null +++ b/src/api/batch/v1/index.ts @@ -0,0 +1 @@ +export * from './job'; diff --git a/src/api/batch/v1/job.ts b/src/api/batch/v1/job.ts new file mode 100644 index 0000000..3699dde --- /dev/null +++ b/src/api/batch/v1/job.ts @@ -0,0 +1,46 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +import { BatchClient } from '@nitric/proto/batch/v1/batch_grpc_pb'; +import { JobData, JobSubmitRequest } from '@nitric/proto/batch/v1/batch_pb'; +import { Struct } from 'google-protobuf/google/protobuf/struct_pb'; +import { fromGrpcError } from '../../errors'; + +export class Job = Record> { + private name: string; + private client: BatchClient; + + constructor(name: string, client: BatchClient) { + this.name = name; + this.client = client; + } + + async submit(data: T): Promise { + const request = new JobSubmitRequest(); + const jobData = new JobData(); + + jobData.setStruct(Struct.fromJavaScript(data)); + request.setJobName(this.name); + request.setData(jobData); + + return new Promise((resolve, reject) => { + this.client.submitJob(request, (error, _response) => { + if (error) { + reject(fromGrpcError(error)); + } else { + resolve(); + } + }); + }); + } +} diff --git a/src/context/index.ts b/src/context/index.ts index 83a6df6..af51cfe 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -17,3 +17,4 @@ export * from './http'; export * from './interval'; export * from './message'; export * from './websocket'; +export * from './job'; diff --git a/src/context/job.ts b/src/context/job.ts new file mode 100644 index 0000000..bc133f4 --- /dev/null +++ b/src/context/job.ts @@ -0,0 +1,47 @@ +import { + JobRequest as JobRequestPb, + JobResponse as JobResponsePb, +} from '../gen/nitric/proto/batch/v1/batch_pb'; +import { AbstractRequest, BaseContext } from './base'; + +export interface JobResponse { + success: boolean; +} + +export class JobRequest extends AbstractRequest { + public readonly jobName: string; + + constructor(data: string | Uint8Array, jobName: string) { + super(data); + this.jobName = jobName; + } +} + +export class JobContext extends BaseContext { + public get job(): JobContext { + return this; + } + + static fromJobRequest(jobRequest: JobRequestPb): JobContext { + const ctx = new JobContext(); + const jobName = jobRequest.getJobName(); + + const data = jobRequest.getData().getStruct().toJavaScript(); + + ctx.request = new JobRequest(JSON.stringify(data), jobName); + + ctx.response = { + success: true, + }; + + return ctx; + } + + static toJobResponse(ctx: JobContext): JobResponsePb { + const evtCtx = ctx.job; + const jobResponse = new JobResponsePb(); + jobResponse.setSuccess(evtCtx.res.success); + + return jobResponse; + } +} diff --git a/src/handlers/handler.ts b/src/handlers/handler.ts index 2a19e4f..e16b455 100644 --- a/src/handlers/handler.ts +++ b/src/handlers/handler.ts @@ -16,6 +16,7 @@ import { BaseContext, JSONTypes } from '../context/base'; import { BlobEventContext, BucketEventContext } from '../context/bucket'; import { HttpContext } from '../context/http'; import { IntervalContext } from '../context/interval'; +import { JobContext } from '../context/job'; import { MessageContext } from '../context/message'; import { WebsocketNotificationContext } from '../context/websocket'; @@ -40,7 +41,7 @@ export type ScheduleMiddleware = GenericMiddleware; export type BucketNotificationMiddleware = GenericMiddleware; export type FileNotificationMiddleware = GenericMiddleware; - +export type JobMiddleware = GenericMiddleware; /** * createHandler * diff --git a/src/resources/batch.ts b/src/resources/batch.ts new file mode 100644 index 0000000..82b29d6 --- /dev/null +++ b/src/resources/batch.ts @@ -0,0 +1,196 @@ +import { getBatchClient } from '../api/batch/v1/batch'; +import { Job } from '../api/batch/v1/job'; +import { fromGrpcError } from '../api/errors'; +import { SERVICE_BIND } from '../constants'; +import { JobContext } from '../context/job'; +import { JobClient } from '../gen/nitric/proto/batch/v1/batch_grpc_pb'; +import { + ClientMessage, + JobResourceRequirements as JobResourceRequirementsPb, + JobResponse, + RegistrationRequest, + ServerMessage, +} from '../gen/nitric/proto/batch/v1/batch_pb'; +import { + ResourceDeclareRequest, + ResourceIdentifier, + ResourceType, + JobResource as JobResourcePb, + ResourceDeclareResponse, + ResourceTypeMap, + ActionMap, + Action, +} from '../gen/nitric/proto/resources/v1/resources_pb'; +import { createHandler, JobMiddleware } from '../handlers'; +import resourceClient from './client'; +import { SecureResource, make, startStreamHandler } from './common'; +import * as grpc from '@grpc/grpc-js'; + +type JobPermission = 'submit'; + +interface JobResourceRequirements { + cpus: number; + memory: number; + gpus: number; +} + +const everything: JobPermission[] = ['submit']; + +export class JobHandler { + private readonly jobName: string; + private readonly handler: JobMiddleware; + private readonly requirements: JobResourceRequirements; + + constructor( + jobName: string, + requirements: JobResourceRequirements, + ...middleware: JobMiddleware[] + ) { + this.jobName = jobName; + this.requirements = requirements; + this.handler = createHandler(...middleware); + } + + private async start(): Promise { + return startStreamHandler(async () => { + const storageListenerClient = new JobClient( + SERVICE_BIND, + grpc.ChannelCredentials.createInsecure() + ); + + // Begin Bi-Di streaming + const stream = storageListenerClient.handleJob(); + + stream.on('data', async (message: ServerMessage) => { + // We have an init response from the membrane + if (message.hasRegistrationResponse()) { + // We got an init response from the membrane + // The client can configure itself with any information provided by the membrane.. + } else if (message.hasJobRequest()) { + // We want to handle a function here... + const jobRequest = message.getJobRequest(); + const responseMessage = new ClientMessage(); + + responseMessage.setId(message.getId()); + + try { + const ctx = JobContext.fromJobRequest(jobRequest); + + const result = (await this.handler(ctx, async (ctx) => ctx)) || ctx; + + responseMessage.setJobResponse(JobContext.toJobResponse(result)); + } catch (e) { + // generic error handling + console.error(e); + const jobResponse = new JobResponse(); + jobResponse.setSuccess(false); + responseMessage.setJobResponse(jobResponse); + } + // Send the response back to the membrane + stream.write(responseMessage); + } + }); + + // Let the membrane know we're ready to start + const initRequest = new RegistrationRequest(); + const initMessage = new ClientMessage(); + + // Set the resource requirements + const requirementsPb = new JobResourceRequirementsPb(); + requirementsPb.setCpus(this.requirements.cpus); + requirementsPb.setMemory(this.requirements.memory); + requirementsPb.setGpus(this.requirements.gpus); + + initRequest.setJobName(this.jobName); + initRequest.setRequirements(requirementsPb); + + // Original faas workers should return a blank InitRequest for compatibility. + initMessage.setRegistrationRequest(initRequest); + stream.write(initMessage); + + return stream; + }); + } +} + +class JobResource extends SecureResource { + constructor(name: string) { + super(name); + } + + protected async register(): Promise { + const req = new ResourceDeclareRequest(); + const resource = new ResourceIdentifier(); + resource.setName(this.name); + resource.setType(ResourceType.JOB); + + req.setId(resource); + req.setJob(new JobResourcePb()); + + return new Promise((resolve, reject) => { + resourceClient.declare(req, (error, _: ResourceDeclareResponse) => { + if (error) { + reject(fromGrpcError(error)); + } else { + resolve(resource); + } + }); + }); + } + + protected permsToActions( + ...perms: JobPermission[] + ): ActionMap[keyof ActionMap][] { + const actions = perms.reduce((actions, perm) => { + switch (perm) { + case 'submit': + return [...actions, Action.JOBSUBMIT]; + default: + throw new Error( + `unknown job permission ${perm}, supported permissions are ${everything.join( + ', ' + )}` + ); + } + }, []); + + return actions; + } + + protected resourceType(): ResourceTypeMap[keyof ResourceTypeMap] { + return ResourceType.JOB; + } + + /** + * Return a job reference and register the permissions required by the currently scoped function for this resource. + * + * e.g. const job = job('jobName').allow('submit') + * + * @param perm the required permission set + * @returns a usable job reference + */ + public allow(perm: JobPermission, ...perms: JobPermission[]): Job { + this.registerPolicy(perm, ...perms); + + return new Job(this.name, getBatchClient()); + } + + public handler( + requirements: JobResourceRequirements, + ...middleware: JobMiddleware[] + ) { + const jobHandler = new JobHandler(this.name, requirements, ...middleware); + + return jobHandler['start'](); + } +} + +/** + * Create a reference to a named batch job in this project. + * + * If the batch job hasn't been referenced before this is a request for a new resource. Otherwise, the existing batch job with the same name will be used. + * + * @param name the name of the job. + * @returns a reference to the job. + */ +export const job = (name: string): JobResource => make(JobResource)(name); diff --git a/src/resources/index.ts b/src/resources/index.ts index ecb5394..62896e7 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -21,4 +21,5 @@ export * from './secret'; export * from './sql'; export * from './http'; export * from './websocket'; +export * from './batch'; export { oidcRule } from './oidc'; From 5acde4ad8f4f85f86c2fedc287912899024c6174 Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 5 Sep 2024 10:14:03 +1000 Subject: [PATCH 3/9] add comments and tests --- src/api/batch/v1/job.test.ts | 75 ++++++++++++++++ src/api/batch/v1/job.ts | 15 ++++ src/resources/batch.test.ts | 170 +++++++++++++++++++++++++++++++++++ src/resources/batch.ts | 22 ++++- 4 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 src/api/batch/v1/job.test.ts create mode 100644 src/resources/batch.test.ts diff --git a/src/api/batch/v1/job.test.ts b/src/api/batch/v1/job.test.ts new file mode 100644 index 0000000..d22780d --- /dev/null +++ b/src/api/batch/v1/job.test.ts @@ -0,0 +1,75 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. +import { Job } from './job'; +import { UnimplementedError } from '../../errors'; +import { status } from '@grpc/grpc-js'; +import { getBatchClient } from './batch'; +import { JobSubmitResponse } from '@nitric/sdk/gen/nitric/proto/batch/v1/batch_pb'; +import { BatchClient } from '@nitric/sdk/gen/nitric/proto/batch/v1/batch_grpc_pb'; + +describe('Job Client Tests', () => { + describe('Given the grpc client returns an unimplemented error status', () => { + const MOCK_ERROR = { + code: status.UNIMPLEMENTED, + message: 'UNIMPLEMENTED', + }; + let submitMock; + beforeAll(() => { + submitMock = jest + .spyOn(BatchClient.prototype, 'submitJob') + .mockImplementation((request, callback: any) => { + callback(MOCK_ERROR, null); + return null as any; + }); + }); + afterAll(() => { + jest.resetAllMocks(); + }); + test('Then submit call should return an UnimplementedError', async () => { + const job = new Job('test', getBatchClient()); + await expect( + job.submit({ + test: 'test', + }) + ).rejects.toBeInstanceOf(UnimplementedError); + }); + test('The Grpc client for Job.submit should have been called exactly once', () => { + expect(submitMock).toHaveBeenCalledTimes(1); + }); + }); + describe('Given the grpc returns successfully', () => { + let submitMock; + beforeAll(() => { + submitMock = jest + .spyOn(BatchClient.prototype, 'submitJob') + .mockImplementation((request, callback: any) => { + const response = new JobSubmitResponse(); + callback(null, response); + return null as any; + }); + }); + afterAll(() => { + jest.resetAllMocks(); + }); + test('Then Eventing.submit should resolve with the provided id', async () => { + const client = new Job('test', getBatchClient()); + await expect( + client.submit({ message: 'Test Payload' }) + ).resolves.toBeUndefined(); + }); + test('The Grpc client for Eventing.submit should have been called exactly once', () => { + expect(submitMock).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/src/api/batch/v1/job.ts b/src/api/batch/v1/job.ts index 3699dde..1a0f461 100644 --- a/src/api/batch/v1/job.ts +++ b/src/api/batch/v1/job.ts @@ -25,6 +25,21 @@ export class Job = Record> { this.client = client; } + /** + * Submit a job to the batch service + * + * @example + * ```typescript + * const analyse = job('analyse').allow('submit'); + * + * await analyse.submit({ + * data: 'some data', + * }); + * ``` + * + * @param data - Data to submit to the job + * @returns Promise that resolves when the job has been submitted + */ async submit(data: T): Promise { const request = new JobSubmitRequest(); const jobData = new JobData(); diff --git a/src/resources/batch.test.ts b/src/resources/batch.test.ts new file mode 100644 index 0000000..4acd73d --- /dev/null +++ b/src/resources/batch.test.ts @@ -0,0 +1,170 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. + +import { ResourcesClient } from '@nitric/proto/resources/v1/resources_grpc_pb'; +import { UnimplementedError } from '../api/errors'; +import { job, JobHandler, JobResource } from '.'; +import { ResourceDeclareResponse } from '@nitric/proto/resources/v1/resources_pb'; +import { status } from '@grpc/grpc-js'; +import { Job } from '../api/batch/v1'; + +describe('Registering batch resources', () => { + describe('Given declare returns an error from the resource server', () => { + const MOCK_ERROR = { + code: status.UNIMPLEMENTED, + message: 'UNIMPLEMENTED', + }; + + const validName = 'my-job'; + let declareSpy; + + beforeAll(() => { + jest.spyOn(console, 'error').mockImplementation(() => {}); + declareSpy = jest + .spyOn(ResourcesClient.prototype, 'declare') + .mockImplementationOnce((request, callback: any) => { + callback(MOCK_ERROR, null); + + return null as any; + }); + }); + + afterAll(() => { + jest.restoreAllMocks(); + }); + + it('Should throw the error', async () => { + await expect(job(validName)['registerPromise']).rejects.toBeInstanceOf( + UnimplementedError + ); + }); + + it('Should call the resource server', () => { + expect(declareSpy).toHaveBeenCalledTimes(1); + }); + }); + + describe('Given declare succeeds on the resource server', () => { + describe('When the service succeeds', () => { + const validName = 'my-job2'; + let otherSpy; + + beforeAll(() => { + otherSpy = jest + .spyOn(ResourcesClient.prototype, 'declare') + .mockImplementationOnce((request, callback: any) => { + const response = new ResourceDeclareResponse(); + callback(null, response); + return null as any; + }); + }); + + afterAll(() => { + jest.resetAllMocks(); + }); + + it('Should succeed', async () => { + await expect(job(validName)['registerPromise']).resolves.not.toBeNull(); + }); + + it('Should call the resource server', () => { + expect(otherSpy).toHaveBeenCalledTimes(1); + }); + }); + }); + + describe('Given a batch is already registered', () => { + const jobName = 'already-exists'; + let jobResource; + let existsSpy; + + beforeEach(() => { + // ensure a success is returned and calls can be counted. + existsSpy = jest + .spyOn(ResourcesClient.prototype, 'declare') + .mockImplementation((request, callback: any) => { + const response = new ResourceDeclareResponse(); + callback(null, response); + return null; + }); + + // register the resource for the first time + jobResource = job(jobName); + }); + + afterEach(() => { + jest.resetAllMocks(); + }); + + describe('When registering a batch with the same name', () => { + let secondJob; + + beforeEach(() => { + // make sure the initial registration isn't counted for these tests. + existsSpy.mockClear(); + secondJob = job(jobName); + }); + + it('Should not call the server again', () => { + expect(existsSpy).not.toHaveBeenCalled(); + }); + + it('Should return the same resource object', () => { + expect(jobResource === secondJob).toEqual(true); + }); + }); + + describe('When declaring usage', () => { + it('Should return a job reference', () => { + const ref = jobResource; + expect(ref).toBeInstanceOf(JobResource); + }); + + it('Should return a job api reference', () => { + const ref = jobResource.allow('submit'); + expect(ref).toBeInstanceOf(Job); + }); + }); + }); +}); + +describe('subscription', () => { + let startSpy; + let mockFn; + + beforeAll(() => { + startSpy = jest + .spyOn(JobHandler.prototype as any, 'start') + .mockReturnValue(Promise.resolve()); + mockFn = jest.fn(); + }); + + afterAll(() => { + jest.clearAllMocks(); + }); + + describe('When registering a handler', () => { + afterAll(() => { + jest.resetAllMocks(); + }); + + beforeAll(async () => { + await job('test-handler').handler(mockFn); + }); + + it('should call Handler start()', () => { + expect(startSpy).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/src/resources/batch.ts b/src/resources/batch.ts index 82b29d6..a3dfcd2 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -113,7 +113,7 @@ export class JobHandler { } } -class JobResource extends SecureResource { +export class JobResource extends SecureResource { constructor(name: string) { super(name); } @@ -164,7 +164,10 @@ class JobResource extends SecureResource { /** * Return a job reference and register the permissions required by the currently scoped function for this resource. * - * e.g. const job = job('jobName').allow('submit') + * @example + * ```typescript + * const myJob = job('jobName').allow('submit') + * ``` * * @param perm the required permission set * @returns a usable job reference @@ -175,6 +178,21 @@ class JobResource extends SecureResource { return new Job(this.name, getBatchClient()); } + /** + * Register a handler for the job. + * + * @example + * ```typescript + * job('my-job').handler({ cpus: 1, memory: 1024, gpus: 0 }, async (ctx) => { + * console.log('Hello from my-job'); + * return ctx; + * }); + * ``` + * + * @param requirements the resource requirements for the job, e.g. cpus, memory, gpus + * @param middleware the middleware to be executed for the job + * @returns Promise which resolves when the handler server terminates + */ public handler( requirements: JobResourceRequirements, ...middleware: JobMiddleware[] From ffed2a788663c08648383362d8af8384d8a5f9a8 Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 5 Sep 2024 10:14:52 +1000 Subject: [PATCH 4/9] add missing license headers --- src/api/batch/v1/batch.ts | 13 +++++++++++++ src/api/batch/v1/index.ts | 13 +++++++++++++ src/context/job.ts | 13 +++++++++++++ src/resources/batch.ts | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/src/api/batch/v1/batch.ts b/src/api/batch/v1/batch.ts index 715e201..633dafb 100644 --- a/src/api/batch/v1/batch.ts +++ b/src/api/batch/v1/batch.ts @@ -1,3 +1,16 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { SERVICE_BIND } from '@nitric/sdk/constants'; import { BatchClient } from '@nitric/sdk/gen/nitric/proto/batch/v1/batch_grpc_pb'; import * as grpc from '@grpc/grpc-js'; diff --git a/src/api/batch/v1/index.ts b/src/api/batch/v1/index.ts index 77c6125..49629ea 100644 --- a/src/api/batch/v1/index.ts +++ b/src/api/batch/v1/index.ts @@ -1 +1,14 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. export * from './job'; diff --git a/src/context/job.ts b/src/context/job.ts index bc133f4..623b5c3 100644 --- a/src/context/job.ts +++ b/src/context/job.ts @@ -1,3 +1,16 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { JobRequest as JobRequestPb, JobResponse as JobResponsePb, diff --git a/src/resources/batch.ts b/src/resources/batch.ts index a3dfcd2..573a7e4 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -1,3 +1,16 @@ +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { getBatchClient } from '../api/batch/v1/batch'; import { Job } from '../api/batch/v1/job'; import { fromGrpcError } from '../api/errors'; From cad832337be899c8925d5b24e58beb9ee3439af4 Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 5 Sep 2024 10:17:52 +1000 Subject: [PATCH 5/9] fix lint warnings and errors --- src/api/batch/v1/batch.ts | 26 +++++++++++++------------- src/api/batch/v1/index.ts | 26 +++++++++++++------------- src/context/job.ts | 26 +++++++++++++------------- src/resources/batch.ts | 29 +++++++++++++++-------------- src/resources/queue.ts | 3 ++- src/resources/sql.ts | 6 ++++-- 6 files changed, 60 insertions(+), 56 deletions(-) diff --git a/src/api/batch/v1/batch.ts b/src/api/batch/v1/batch.ts index 633dafb..242d5e3 100644 --- a/src/api/batch/v1/batch.ts +++ b/src/api/batch/v1/batch.ts @@ -1,16 +1,16 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { SERVICE_BIND } from '@nitric/sdk/constants'; import { BatchClient } from '@nitric/sdk/gen/nitric/proto/batch/v1/batch_grpc_pb'; import * as grpc from '@grpc/grpc-js'; diff --git a/src/api/batch/v1/index.ts b/src/api/batch/v1/index.ts index 49629ea..44a8f3b 100644 --- a/src/api/batch/v1/index.ts +++ b/src/api/batch/v1/index.ts @@ -1,14 +1,14 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. export * from './job'; diff --git a/src/context/job.ts b/src/context/job.ts index 623b5c3..ecdf222 100644 --- a/src/context/job.ts +++ b/src/context/job.ts @@ -1,16 +1,16 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { JobRequest as JobRequestPb, JobResponse as JobResponsePb, diff --git a/src/resources/batch.ts b/src/resources/batch.ts index 573a7e4..1767410 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -1,16 +1,16 @@ -// Copyright 2021, Nitric Technologies Pty Ltd. -// -// 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. +// Copyright 2021, Nitric Technologies Pty Ltd. +// +// 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. import { getBatchClient } from '../api/batch/v1/batch'; import { Job } from '../api/batch/v1/job'; import { fromGrpcError } from '../api/errors'; @@ -183,6 +183,7 @@ export class JobResource extends SecureResource { * ``` * * @param perm the required permission set + * @param perms additional required permissions set * @returns a usable job reference */ public allow(perm: JobPermission, ...perms: JobPermission[]): Job { @@ -209,7 +210,7 @@ export class JobResource extends SecureResource { public handler( requirements: JobResourceRequirements, ...middleware: JobMiddleware[] - ) { + ): Promise { const jobHandler = new JobHandler(this.name, requirements, ...middleware); return jobHandler['start'](); diff --git a/src/resources/queue.ts b/src/resources/queue.ts index 6da2ac9..33aad44 100644 --- a/src/resources/queue.ts +++ b/src/resources/queue.ts @@ -19,6 +19,7 @@ import { ResourceType, Action, QueueResource as NitricQueueResource, + ResourceTypeMap, } from '@nitric/proto/resources/v1/resources_pb'; import resourceClient from './client'; import { fromGrpcError } from '../api/errors'; @@ -77,7 +78,7 @@ export class QueueResource< return actions; } - protected resourceType() { + protected resourceType(): ResourceTypeMap[keyof ResourceTypeMap] { return ResourceType.QUEUE; } diff --git a/src/resources/sql.ts b/src/resources/sql.ts index 4908246..8c960c4 100644 --- a/src/resources/sql.ts +++ b/src/resources/sql.ts @@ -126,5 +126,7 @@ const maker = make(SQLDatabaseResource); * @param options the options for the SQL Database * @returns a SQL resource */ -export const sql = (name: string, options?: SQLDatabaseOptions) => - maker(name, options); +export const sql = ( + name: string, + options?: SQLDatabaseOptions +): SQLDatabaseResource => maker(name, options); From db4de8088111227b23860e37c9d449fa91e2eaa6 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Thu, 3 Oct 2024 12:10:29 +1000 Subject: [PATCH 6/9] make job requirements optional --- src/resources/batch.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/resources/batch.ts b/src/resources/batch.ts index 1767410..38797ec 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -126,6 +126,12 @@ export class JobHandler { } } +const defaultJobRequirements: JobResourceRequirements = { + cpus: 0, + memory: 0, + gpus: 0, +}; + export class JobResource extends SecureResource { constructor(name: string) { super(name); @@ -197,10 +203,10 @@ export class JobResource extends SecureResource { * * @example * ```typescript - * job('my-job').handler({ cpus: 1, memory: 1024, gpus: 0 }, async (ctx) => { + * job('my-job').handler(async (ctx) => { * console.log('Hello from my-job'); * return ctx; - * }); + * }, { cpus: 1, memory: 1024, gpus: 0 }); * ``` * * @param requirements the resource requirements for the job, e.g. cpus, memory, gpus @@ -208,10 +214,15 @@ export class JobResource extends SecureResource { * @returns Promise which resolves when the handler server terminates */ public handler( - requirements: JobResourceRequirements, - ...middleware: JobMiddleware[] + middleware: JobMiddleware, + requirements: JobResourceRequirements = defaultJobRequirements, ): Promise { - const jobHandler = new JobHandler(this.name, requirements, ...middleware); + const jobRequirements = { + ...defaultJobRequirements, + ...requirements, + } + + const jobHandler = new JobHandler(this.name, jobRequirements, middleware); return jobHandler['start'](); } From 7810b5c9a6bc8af05fdf7992cbbffc1a69f6cc2a Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Thu, 3 Oct 2024 16:43:16 +1000 Subject: [PATCH 7/9] update nitric version. --- package.json | 2 +- src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js | 2 +- src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts | 2 +- src/gen/nitric/proto/deployments/v1/deployments_pb.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1bf8fef..2b4a45c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nitric/sdk", "description": "Nitric NodeJS client sdk", - "nitric": "v1.6.0", + "nitric": "v1.14.0", "author": "Nitric ", "repository": "https://github.com/nitrictech/node-sdk", "main": "lib/index.js", diff --git a/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js b/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js index 9ad3437..571305c 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js +++ b/src/gen/nitric/proto/deployments/v1/deployments_grpc_pb.js @@ -4,9 +4,9 @@ var grpc = require('@grpc/grpc-js'); var nitric_proto_deployments_v1_deployments_pb = require('../../../../nitric/proto/deployments/v1/deployments_pb.js'); var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); +var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); var nitric_proto_resources_v1_resources_pb = require('../../../../nitric/proto/resources/v1/resources_pb.js'); var nitric_proto_storage_v1_storage_pb = require('../../../../nitric/proto/storage/v1/storage_pb.js'); -var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); function serialize_nitric_proto_deployments_v1_DeploymentDownEvent(arg) { if (!(arg instanceof nitric_proto_deployments_v1_deployments_pb.DeploymentDownEvent)) { diff --git a/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts b/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts index fc41a48..1f0bc2a 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts +++ b/src/gen/nitric/proto/deployments/v1/deployments_pb.d.ts @@ -3,9 +3,9 @@ import * as jspb from "google-protobuf"; import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb"; +import * as nitric_proto_batch_v1_batch_pb from "../../../../nitric/proto/batch/v1/batch_pb"; import * as nitric_proto_resources_v1_resources_pb from "../../../../nitric/proto/resources/v1/resources_pb"; import * as nitric_proto_storage_v1_storage_pb from "../../../../nitric/proto/storage/v1/storage_pb"; -import * as nitric_proto_batch_v1_batch_pb from "../../../../nitric/proto/batch/v1/batch_pb"; export class DeploymentUpRequest extends jspb.Message { hasSpec(): boolean; diff --git a/src/gen/nitric/proto/deployments/v1/deployments_pb.js b/src/gen/nitric/proto/deployments/v1/deployments_pb.js index ef428e1..aeafa52 100644 --- a/src/gen/nitric/proto/deployments/v1/deployments_pb.js +++ b/src/gen/nitric/proto/deployments/v1/deployments_pb.js @@ -23,12 +23,12 @@ var global = (function() { var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); goog.object.extend(proto, google_protobuf_struct_pb); +var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); +goog.object.extend(proto, nitric_proto_batch_v1_batch_pb); var nitric_proto_resources_v1_resources_pb = require('../../../../nitric/proto/resources/v1/resources_pb.js'); goog.object.extend(proto, nitric_proto_resources_v1_resources_pb); var nitric_proto_storage_v1_storage_pb = require('../../../../nitric/proto/storage/v1/storage_pb.js'); goog.object.extend(proto, nitric_proto_storage_v1_storage_pb); -var nitric_proto_batch_v1_batch_pb = require('../../../../nitric/proto/batch/v1/batch_pb.js'); -goog.object.extend(proto, nitric_proto_batch_v1_batch_pb); goog.exportSymbol('proto.nitric.proto.deployments.v1.Api', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Api.DocumentCase', null, global); goog.exportSymbol('proto.nitric.proto.deployments.v1.Batch', null, global); From 4d2c7b114617022fc1f16789ed493a1e56df0b81 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Thu, 3 Oct 2024 16:45:22 +1000 Subject: [PATCH 8/9] lint --- src/resources/batch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/batch.ts b/src/resources/batch.ts index 38797ec..3d933f9 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -209,8 +209,8 @@ export class JobResource extends SecureResource { * }, { cpus: 1, memory: 1024, gpus: 0 }); * ``` * - * @param requirements the resource requirements for the job, e.g. cpus, memory, gpus * @param middleware the middleware to be executed for the job + * @param requirements the resource requirements for the job, e.g. cpus, memory, gpus * @returns Promise which resolves when the handler server terminates */ public handler( From f4504a3b1f07f71ddda2439dc7bba1f6c781c0de Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Thu, 3 Oct 2024 16:46:47 +1000 Subject: [PATCH 9/9] prettier --- src/resources/batch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/batch.ts b/src/resources/batch.ts index 3d933f9..e6ddb1f 100644 --- a/src/resources/batch.ts +++ b/src/resources/batch.ts @@ -215,12 +215,12 @@ export class JobResource extends SecureResource { */ public handler( middleware: JobMiddleware, - requirements: JobResourceRequirements = defaultJobRequirements, + requirements: JobResourceRequirements = defaultJobRequirements ): Promise { const jobRequirements = { ...defaultJobRequirements, ...requirements, - } + }; const jobHandler = new JobHandler(this.name, jobRequirements, middleware);